Coverage Report - de.glossmaker.bib.datastructure.InCollection
 
Classes in this File Line Coverage Branch Coverage Complexity
InCollection
100%
18/18
77%
14/18
2
 
 1  
 package de.glossmaker.bib.datastructure;
 2  
 
 3  
 import de.glossmaker.gloss.datastructure.IItem;
 4  
 
 5  
 /**
 6  
  * <p>This class implements the BibTeX <code>INCOLLECTION</code> item.</p>
 7  
  * Required fields:
 8  
  * <ul>
 9  
  *   <li>author,</li>
 10  
  *   <li>title,</li>
 11  
  *   <li>booktitle,</li>
 12  
  *   <li>publisher,</li>
 13  
  *   <li>year.</li>
 14  
  *  </ul>
 15  
  *  Optional fields:
 16  
  *  <ul>
 17  
  *    <li>editor,</li>
 18  
  *    <li>volume or number,</li>
 19  
  *    <li>series,</li>
 20  
  *    <li>type,</li>
 21  
  *    <li>chapter,</li>
 22  
  *    <li>pages,</li>
 23  
  *    <li>address,</li>
 24  
  *    <li>edition,</li>
 25  
  *    <li>month,</li>
 26  
  *    <li>note.</li>
 27  
  *  </ul> 
 28  
  *  
 29  
  * @author MarkusFlingelli
 30  
  *
 31  
  */
 32  
 public class InCollection extends ABibItem {
 33  
 
 34  
         InCollection(String key, EBibTeXReference reference) {
 35  50
                 super(key, reference);
 36  50
         }
 37  
         
 38  
         public InCollection(String key, String title, String author, String booktitle, String publisher, String year) {
 39  3
                 super(key, EBibTeXReference.INCOLLECTION);
 40  3
                 setTitle(title);
 41  3
                 setAuthor(author);
 42  3
                 setBookTitle(booktitle);
 43  3
                 setPublisher(publisher);
 44  3
                 setYear(year);
 45  3
         }
 46  
         
 47  
         
 48  
         @Override
 49  
         public boolean isItemValid() {
 50  6
                 boolean result = getKey() != null && getKey().length() > 0;
 51  6
                 result &= getAuthor() != null && getAuthor().length() > 0;
 52  6
                 result &= getBookTitle() != null && getBookTitle().length() > 0;
 53  6
                 result &= getPublisher() != null && getPublisher().length() > 0;
 54  6
                 result &= getYear() != null;
 55  6
                 return result;
 56  
         }
 57  
         
 58  
         @Override
 59  
         public IItem cloneItem() {
 60  1
                 InCollection clone = new InCollection(getKey(), getTitle(), getAuthor(), getBookTitle(), getPublisher(), getYear());
 61  1
                 clone.setItemValues(this);
 62  1
                 return clone;
 63  
         }
 64  
 }