| 1 | |
package de.glossmaker.bib.datastructure; |
| 2 | |
|
| 3 | |
import de.glossmaker.gloss.datastructure.IItem; |
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
public class InBook extends ABibItem { |
| 30 | |
|
| 31 | |
InBook(String key, EBibTeXReference reference) { |
| 32 | 50 | super(key, reference); |
| 33 | 50 | } |
| 34 | |
|
| 35 | |
public InBook(String key, EBookType bookType, String title, String author, String chapter, String publisher, |
| 36 | |
String pages, String year) { |
| 37 | 3 | super(key, EBibTeXReference.INBOOK); |
| 38 | 3 | setTitle(title); |
| 39 | 3 | if (bookType == EBookType.AUTHOR) { |
| 40 | 1 | setAuthor(author); |
| 41 | |
} else { |
| 42 | 2 | setEditor(author); |
| 43 | |
} |
| 44 | 3 | setChapter(chapter); |
| 45 | 3 | setPublisher(publisher); |
| 46 | 3 | setPages(pages); |
| 47 | 3 | setYear(year); |
| 48 | 3 | } |
| 49 | |
|
| 50 | |
|
| 51 | |
@Override |
| 52 | |
public boolean isItemValid() { |
| 53 | 11 | boolean result = getKey() != null && getKey().length() > 0; |
| 54 | 11 | result &= (getAuthor() != null && getAuthor().length() > 0) || |
| 55 | |
(getEditor() != null && getEditor().length() > 0); |
| 56 | 11 | result &= (getChapter() != null && getChapter().length() > 0) || |
| 57 | |
(getPages() != null && getPages().length() > 0); |
| 58 | 11 | result &= getTitle() != null && getTitle().length() > 0; |
| 59 | 11 | result &= getPublisher() != null && getPublisher().length() > 0; |
| 60 | 11 | result &= getYear() != null; |
| 61 | 11 | return result; |
| 62 | |
} |
| 63 | |
|
| 64 | |
@Override |
| 65 | |
public IItem cloneItem() { |
| 66 | 1 | InBook clone = new InBook(getKey(), EBookType.AUTHOR, getTitle(), getAuthor(), getChapter(), getPublisher(), getPages(), getYear()); |
| 67 | 1 | clone.setItemValues(this); |
| 68 | 1 | return clone; |
| 69 | |
} |
| 70 | |
} |