| 1 | |
package de.glossmaker.bib.datastructure; |
| 2 | |
|
| 3 | |
import java.util.Map; |
| 4 | |
import java.util.TreeMap; |
| 5 | |
|
| 6 | |
import de.glossmaker.gloss.datastructure.IItem; |
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | 2360 | public abstract class ABibItem implements IItem, Comparable<IItem> { |
| 14 | 836 | private EBibTeXReference mReference = null; |
| 15 | 836 | private Map<EBibTeXFields, String> mMap = null; |
| 16 | |
|
| 17 | 836 | private ABibItem(EBibTeXReference reference) { |
| 18 | 836 | mReference = reference; |
| 19 | 836 | mMap = new TreeMap<EBibTeXFields, String>(); |
| 20 | 836 | } |
| 21 | |
|
| 22 | |
public ABibItem(String key, EBibTeXReference reference) { |
| 23 | 836 | this(reference); |
| 24 | 836 | mMap.put(EBibTeXFields.KEY, key); |
| 25 | 836 | } |
| 26 | |
|
| 27 | |
private String setValue(String oldValue, String newValue, boolean required) { |
| 28 | 66 | String result = oldValue; |
| 29 | 66 | if (required) { |
| 30 | 33 | if (newValue.length() > 0 && newValue.equals(oldValue) == false) { |
| 31 | 11 | result = newValue; |
| 32 | |
} |
| 33 | |
} else { |
| 34 | 33 | if (newValue.equals(oldValue) == false) { |
| 35 | 22 | result = newValue; |
| 36 | |
} |
| 37 | |
} |
| 38 | 66 | return result; |
| 39 | |
} |
| 40 | |
|
| 41 | |
public String getReference() { |
| 42 | 352 | if (mReference == null) { |
| 43 | 0 | return null; |
| 44 | |
} else { |
| 45 | 352 | return mReference.toString(); |
| 46 | |
} |
| 47 | |
} |
| 48 | |
|
| 49 | |
public String getKey() { |
| 50 | 5468 | return mMap.get(EBibTeXFields.KEY); |
| 51 | |
} |
| 52 | |
|
| 53 | |
public void setKey(String key) { |
| 54 | 35 | mMap.put(EBibTeXFields.KEY, key); |
| 55 | 35 | } |
| 56 | |
|
| 57 | |
public String getAuthor() { |
| 58 | 219 | return mMap.get(EBibTeXFields.AUTHOR); |
| 59 | |
} |
| 60 | |
|
| 61 | |
public void setAuthor(String author) { |
| 62 | 124 | mMap.put(EBibTeXFields.AUTHOR, author); |
| 63 | 124 | } |
| 64 | |
|
| 65 | |
|
| 66 | |
public boolean setAuthor(String author, boolean required) { |
| 67 | 6 | String result = setValue(getAuthor(), author, required); |
| 68 | 6 | if (result.equals(getAuthor()) == false) { |
| 69 | 3 | mMap.put(EBibTeXFields.AUTHOR, result); |
| 70 | 3 | return true; |
| 71 | |
} |
| 72 | 3 | return false; |
| 73 | |
} |
| 74 | |
|
| 75 | |
public String getEditor() { |
| 76 | 156 | return mMap.get(EBibTeXFields.EDITOR); |
| 77 | |
} |
| 78 | |
|
| 79 | |
public void setEditor(String editor) { |
| 80 | 70 | mMap.put(EBibTeXFields.EDITOR, editor); |
| 81 | 70 | } |
| 82 | |
|
| 83 | |
public boolean setEditor(String editor, boolean required) { |
| 84 | 6 | String result = setValue(getEditor(), editor, required); |
| 85 | 6 | if (result.equals(getEditor()) == false) { |
| 86 | 3 | mMap.put(EBibTeXFields.EDITOR, result); |
| 87 | 3 | return true; |
| 88 | |
} |
| 89 | 3 | return false; |
| 90 | |
} |
| 91 | |
|
| 92 | |
public String getPublisher() { |
| 93 | 187 | return mMap.get(EBibTeXFields.PUBLISHER); |
| 94 | |
} |
| 95 | |
|
| 96 | |
public void setPublisher(String publisher) { |
| 97 | 84 | mMap.put(EBibTeXFields.PUBLISHER, publisher); |
| 98 | 84 | } |
| 99 | |
|
| 100 | |
public boolean setPublisher(String publisher, boolean required) { |
| 101 | 6 | String result = setValue(getPublisher(), publisher, required); |
| 102 | 6 | if (result.equals(getPublisher()) == false) { |
| 103 | 3 | mMap.put(EBibTeXFields.PUBLISHER, result); |
| 104 | 3 | return true; |
| 105 | |
} |
| 106 | 3 | return false; |
| 107 | |
} |
| 108 | |
|
| 109 | |
public String getTitle() { |
| 110 | 225 | return mMap.get(EBibTeXFields.TITLE); |
| 111 | |
} |
| 112 | |
|
| 113 | |
public void setTitle(String title) { |
| 114 | 153 | mMap.put(EBibTeXFields.TITLE, title); |
| 115 | 153 | } |
| 116 | |
|
| 117 | |
public boolean setTitle(String title, boolean required) { |
| 118 | 6 | String result = setValue(getTitle(), title, required); |
| 119 | 6 | if (result.equals(getTitle()) == false) { |
| 120 | 3 | mMap.put(EBibTeXFields.TITLE, result); |
| 121 | 3 | return true; |
| 122 | |
} |
| 123 | 3 | return false; |
| 124 | |
} |
| 125 | |
|
| 126 | |
public String getBookTitle() { |
| 127 | 110 | return mMap.get(EBibTeXFields.BOOKTITLE); |
| 128 | |
} |
| 129 | |
|
| 130 | |
public void setBookTitle(String bookTitle) { |
| 131 | 75 | mMap.put(EBibTeXFields.BOOKTITLE, bookTitle); |
| 132 | 75 | } |
| 133 | |
|
| 134 | |
public boolean setBookTitle(String bookTitle, boolean required) { |
| 135 | 6 | String result = setValue(getBookTitle(), bookTitle, required); |
| 136 | 6 | if (result.equals(getBookTitle()) == false) { |
| 137 | 3 | mMap.put(EBibTeXFields.BOOKTITLE, result); |
| 138 | 3 | return true; |
| 139 | |
} |
| 140 | 3 | return false; |
| 141 | |
} |
| 142 | |
|
| 143 | |
public String getJournal() { |
| 144 | 51 | return mMap.get(EBibTeXFields.JOURNAL); |
| 145 | |
} |
| 146 | |
|
| 147 | |
public void setJournal(String journal) { |
| 148 | 128 | mMap.put(EBibTeXFields.JOURNAL, journal); |
| 149 | 128 | } |
| 150 | |
|
| 151 | |
public boolean setJournal(String journal, boolean required) { |
| 152 | 6 | String result = setValue(getJournal(), journal, required); |
| 153 | 6 | if (result.equals(getJournal()) == false) { |
| 154 | 3 | mMap.put(EBibTeXFields.JOURNAL, result); |
| 155 | 3 | return true; |
| 156 | 3 | } else if (journal == null && getJournal() != null) { |
| 157 | 0 | mMap.put(EBibTeXFields.JOURNAL, journal); |
| 158 | 0 | return true; |
| 159 | |
} |
| 160 | 3 | return false; |
| 161 | |
} |
| 162 | |
|
| 163 | |
public String getYear() { |
| 164 | 185 | return mMap.get(EBibTeXFields.YEAR); |
| 165 | |
} |
| 166 | |
|
| 167 | |
public void setYear(int year) { |
| 168 | 8 | if (year < 0) { |
| 169 | 1 | mMap.put(EBibTeXFields.YEAR, null); |
| 170 | |
} else { |
| 171 | 7 | mMap.put(EBibTeXFields.YEAR, "" + year); |
| 172 | |
} |
| 173 | 8 | } |
| 174 | |
|
| 175 | |
public boolean setYear(int year, boolean required) { |
| 176 | 6 | boolean result = false; |
| 177 | 6 | if (required) { |
| 178 | 3 | if (getYear() != null && year > 0 && getYear().equals("" + year) == false) { |
| 179 | 1 | setYear("" + year); |
| 180 | 1 | result = true; |
| 181 | 2 | } else if (getYear() == null && year > 0) { |
| 182 | 0 | setYear("" + year); |
| 183 | 0 | result = true; |
| 184 | |
} |
| 185 | |
} else { |
| 186 | 3 | if (getYear() != null && getYear().equals("" + year) == false) { |
| 187 | 2 | setYear("" + year); |
| 188 | 2 | result = true; |
| 189 | |
} else { |
| 190 | 1 | if (getYear() == null && year > 0) { |
| 191 | 0 | setYear("" + year); |
| 192 | 0 | result = true; |
| 193 | |
} |
| 194 | |
} |
| 195 | |
} |
| 196 | 6 | return result; |
| 197 | |
} |
| 198 | |
|
| 199 | |
public void setYear(String year) { |
| 200 | 125 | mMap.put(EBibTeXFields.YEAR, year); |
| 201 | 125 | } |
| 202 | |
|
| 203 | |
public boolean setYear(String year, boolean required) { |
| 204 | 0 | boolean result = false; |
| 205 | |
try { |
| 206 | 0 | if (year != null) { |
| 207 | 0 | int y = Integer.parseInt(year); |
| 208 | 0 | result = setYear(y, required); |
| 209 | 0 | } else { |
| 210 | 0 | result = setYear((String)null, required); |
| 211 | |
} |
| 212 | 0 | } catch (Exception e) { |
| 213 | |
|
| 214 | 0 | } |
| 215 | 0 | return result; |
| 216 | |
} |
| 217 | |
|
| 218 | |
public String getVolume() { |
| 219 | 168 | return mMap.get(EBibTeXFields.VOLUME); |
| 220 | |
} |
| 221 | |
|
| 222 | |
public boolean setVolume(String volume) { |
| 223 | 31 | if (volume != null && volume.equals(getVolume()) == false) { |
| 224 | 8 | mMap.put(EBibTeXFields.VOLUME, volume); |
| 225 | 8 | return true; |
| 226 | 23 | } else if (volume == null && getVolume() != null) { |
| 227 | 0 | mMap.put(EBibTeXFields.VOLUME, volume); |
| 228 | 0 | return true; |
| 229 | |
} |
| 230 | 23 | return false; |
| 231 | |
} |
| 232 | |
|
| 233 | |
public String getNumber() { |
| 234 | 169 | return mMap.get(EBibTeXFields.NUMBER); |
| 235 | |
} |
| 236 | |
|
| 237 | |
public boolean setNumber(String number) { |
| 238 | 31 | if (number != null && number.equals(getNumber()) == false) { |
| 239 | 8 | mMap.put(EBibTeXFields.NUMBER, number); |
| 240 | 8 | return true; |
| 241 | 23 | } else if (number == null && getNumber() != null) { |
| 242 | 0 | mMap.put(EBibTeXFields.NUMBER, number); |
| 243 | 0 | return true; |
| 244 | |
} |
| 245 | 23 | return false; |
| 246 | |
} |
| 247 | |
|
| 248 | |
public String getPages() { |
| 249 | 151 | return mMap.get(EBibTeXFields.PAGES); |
| 250 | |
} |
| 251 | |
|
| 252 | |
public void setPages(String pages) { |
| 253 | 69 | mMap.put(EBibTeXFields.PAGES, pages); |
| 254 | 69 | } |
| 255 | |
|
| 256 | |
public boolean setPages(String pages, boolean required) { |
| 257 | 6 | String result = setValue(getPages(), pages, required); |
| 258 | 6 | if (result.equals(getPages()) == false) { |
| 259 | 3 | mMap.put(EBibTeXFields.PAGES, result); |
| 260 | 3 | return true; |
| 261 | |
} |
| 262 | 3 | return false; |
| 263 | |
} |
| 264 | |
|
| 265 | |
public String getMonth() { |
| 266 | 177 | return mMap.get(EBibTeXFields.MONTH); |
| 267 | |
} |
| 268 | |
|
| 269 | |
public boolean setMonth(String month) { |
| 270 | 31 | if (month != null && month.equals(getMonth()) == false) { |
| 271 | 8 | mMap.put(EBibTeXFields.MONTH, month); |
| 272 | 8 | return true; |
| 273 | 23 | } else if (month == null && getMonth() != null) { |
| 274 | 0 | mMap.put(EBibTeXFields.MONTH, month); |
| 275 | 0 | return true; |
| 276 | |
} |
| 277 | 23 | return false; |
| 278 | |
} |
| 279 | |
|
| 280 | |
public String getNote() { |
| 281 | 164 | return mMap.get(EBibTeXFields.NOTE); |
| 282 | |
} |
| 283 | |
|
| 284 | |
public void setNote(String note) { |
| 285 | 74 | mMap.put(EBibTeXFields.NOTE, note); |
| 286 | 74 | } |
| 287 | |
|
| 288 | |
public boolean setNote(String note, boolean required) { |
| 289 | 6 | String result = setValue(getNote(), note, required); |
| 290 | 6 | if (result.equals(getNote()) == false) { |
| 291 | 3 | mMap.put(EBibTeXFields.NOTE, result); |
| 292 | 3 | return true; |
| 293 | |
} |
| 294 | 3 | return false; |
| 295 | |
} |
| 296 | |
|
| 297 | |
public String getHowPublished() { |
| 298 | 56 | return mMap.get(EBibTeXFields.HOWPUBLISHED); |
| 299 | |
} |
| 300 | |
|
| 301 | |
public boolean setHowPublished(String howPublished) { |
| 302 | 26 | if (howPublished != null && howPublished.equals(getHowPublished()) == false) { |
| 303 | 3 | mMap.put(EBibTeXFields.HOWPUBLISHED, howPublished); |
| 304 | 3 | return true; |
| 305 | 23 | } else if (howPublished == null && getHowPublished() != null) { |
| 306 | 0 | mMap.put(EBibTeXFields.HOWPUBLISHED, howPublished); |
| 307 | 0 | return true; |
| 308 | |
} |
| 309 | 23 | return false; |
| 310 | |
} |
| 311 | |
|
| 312 | |
public String getSeries() { |
| 313 | 165 | return mMap.get(EBibTeXFields.SERIES); |
| 314 | |
} |
| 315 | |
|
| 316 | |
public boolean setSeries(String series) { |
| 317 | 31 | if (series != null && series.equals(getSeries()) == false) { |
| 318 | 8 | mMap.put(EBibTeXFields.SERIES, series); |
| 319 | 8 | return true; |
| 320 | 23 | } else if(series == null && getSeries() != null) { |
| 321 | 0 | mMap.put(EBibTeXFields.SERIES, series); |
| 322 | 0 | return true; |
| 323 | |
} |
| 324 | 23 | return false; |
| 325 | |
} |
| 326 | |
|
| 327 | |
public String getAddress() { |
| 328 | 171 | return mMap.get(EBibTeXFields.ADDRESS); |
| 329 | |
} |
| 330 | |
|
| 331 | |
public boolean setAddress(String address) { |
| 332 | 31 | if (address != null && address.equals(getAddress()) == false) { |
| 333 | 8 | mMap.put(EBibTeXFields.ADDRESS, address); |
| 334 | 8 | return true; |
| 335 | 23 | } else if (address == null && getAddress() != null) { |
| 336 | 0 | mMap.put(EBibTeXFields.ADDRESS, address); |
| 337 | 0 | return true; |
| 338 | |
} |
| 339 | 23 | return false; |
| 340 | |
} |
| 341 | |
|
| 342 | |
public String getEdition() { |
| 343 | 63 | return mMap.get(EBibTeXFields.EDITION); |
| 344 | |
} |
| 345 | |
|
| 346 | |
public boolean setEdition(String edition) { |
| 347 | 31 | if (edition != null && edition.equals(getEdition()) == false) { |
| 348 | 8 | mMap.put(EBibTeXFields.EDITION, edition); |
| 349 | 8 | return true; |
| 350 | 23 | } else if (edition == null && getEdition() != null) { |
| 351 | 0 | mMap.put(EBibTeXFields.EDITION, edition); |
| 352 | 0 | return true; |
| 353 | |
} |
| 354 | 23 | return false; |
| 355 | |
} |
| 356 | |
|
| 357 | |
public String getISBN() { |
| 358 | 60 | return mMap.get(EBibTeXFields.ISBN); |
| 359 | |
} |
| 360 | |
|
| 361 | |
public boolean setISBN(String isbn) { |
| 362 | 31 | if (isbn != null && isbn.equals(getISBN()) == false) { |
| 363 | 8 | mMap.put(EBibTeXFields.ISBN, isbn); |
| 364 | 8 | return true; |
| 365 | 23 | } else if (isbn == null && getISBN() != null) { |
| 366 | 0 | mMap.put(EBibTeXFields.ISBN, isbn); |
| 367 | 0 | return true; |
| 368 | |
} |
| 369 | 23 | return false; |
| 370 | |
} |
| 371 | |
|
| 372 | |
|
| 373 | |
public String getOrganization() { |
| 374 | 156 | return mMap.get(EBibTeXFields.ORGANIZATION); |
| 375 | |
} |
| 376 | |
|
| 377 | |
public boolean setOrganization(String organization) { |
| 378 | 26 | if (organization != null && organization.equals(getOrganization()) == false) { |
| 379 | 3 | mMap.put(EBibTeXFields.ORGANIZATION, organization); |
| 380 | 3 | return true; |
| 381 | 23 | } else if (organization == null && getOrganization() != null) { |
| 382 | 0 | mMap.put(EBibTeXFields.ORGANIZATION, organization); |
| 383 | 0 | return true; |
| 384 | |
} |
| 385 | 23 | return false; |
| 386 | |
} |
| 387 | |
|
| 388 | |
public String getInstitution() { |
| 389 | 47 | return mMap.get(EBibTeXFields.INSTITUTION); |
| 390 | |
} |
| 391 | |
|
| 392 | |
public void setInstitution(String insitution) { |
| 393 | 69 | mMap.put(EBibTeXFields.INSTITUTION, insitution); |
| 394 | 69 | } |
| 395 | |
|
| 396 | |
public boolean setInstitution(String insitution, boolean required) { |
| 397 | 6 | String result = setValue(getInstitution(), insitution, required); |
| 398 | 6 | if (result.equals(getInstitution()) == false) { |
| 399 | 3 | mMap.put(EBibTeXFields.INSTITUTION, result); |
| 400 | 3 | return true; |
| 401 | |
} |
| 402 | 3 | return false; |
| 403 | |
} |
| 404 | |
|
| 405 | |
public String getSchool() { |
| 406 | 57 | return mMap.get(EBibTeXFields.SCHOOL); |
| 407 | |
} |
| 408 | |
|
| 409 | |
public void setSchool(String school) { |
| 410 | 73 | mMap.put(EBibTeXFields.SCHOOL, school); |
| 411 | 73 | } |
| 412 | |
|
| 413 | |
public boolean setSchool(String school, boolean required) { |
| 414 | 6 | String result = setValue(getSchool(), school, required); |
| 415 | 6 | if (result.equals(getSchool()) == false) { |
| 416 | 3 | mMap.put(EBibTeXFields.SCHOOL, result); |
| 417 | 3 | return true; |
| 418 | |
} |
| 419 | 3 | return false; |
| 420 | |
} |
| 421 | |
|
| 422 | |
public String getType() { |
| 423 | 57 | return mMap.get(EBibTeXFields.TYPE); |
| 424 | |
} |
| 425 | |
|
| 426 | |
public boolean setType(String type) { |
| 427 | 26 | if (type != null && type.equals(getType()) == false) { |
| 428 | 3 | mMap.put(EBibTeXFields.TYPE, type); |
| 429 | 3 | return true; |
| 430 | 23 | } else if(type == null && getType() != null) { |
| 431 | 0 | mMap.put(EBibTeXFields.TYPE, type); |
| 432 | 0 | return true; |
| 433 | |
} |
| 434 | 23 | return false; |
| 435 | |
} |
| 436 | |
|
| 437 | |
public String getChapter() { |
| 438 | 57 | return mMap.get(EBibTeXFields.CHAPTER); |
| 439 | |
} |
| 440 | |
|
| 441 | |
public void setChapter(String chapter) { |
| 442 | 70 | mMap.put(EBibTeXFields.CHAPTER, chapter); |
| 443 | 70 | } |
| 444 | |
|
| 445 | |
public boolean setChapter(String chapter, boolean required) { |
| 446 | 6 | String result = setValue(getChapter(), chapter, required); |
| 447 | 6 | if (result.equals(getChapter()) == false) { |
| 448 | 3 | mMap.put(EBibTeXFields.CHAPTER, result); |
| 449 | 3 | return true; |
| 450 | |
} |
| 451 | 3 | return false; |
| 452 | |
} |
| 453 | |
|
| 454 | |
EBibTeXReference getBibTeXReference() { |
| 455 | 392 | return mReference; |
| 456 | |
} |
| 457 | |
|
| 458 | |
public String getOwner() { |
| 459 | 25 | return mMap.get(EBibTeXFields.OWNER); |
| 460 | |
} |
| 461 | |
|
| 462 | |
public void setOwner(String owner) { |
| 463 | 24 | mMap.put(EBibTeXFields.OWNER, owner); |
| 464 | 24 | } |
| 465 | |
|
| 466 | |
public String getTimeStamp() { |
| 467 | 25 | return mMap.get(EBibTeXFields.TIMESTAMP); |
| 468 | |
} |
| 469 | |
|
| 470 | |
public void setTimeStamp(String timeStamp) { |
| 471 | 24 | mMap.put(EBibTeXFields.TIMESTAMP, timeStamp); |
| 472 | 24 | } |
| 473 | |
|
| 474 | |
public String getCrossRef() { |
| 475 | 25 | return mMap.get(EBibTeXFields.CROSSREF); |
| 476 | |
} |
| 477 | |
|
| 478 | |
public void setCrossRef(String crossRef) { |
| 479 | 24 | mMap.put(EBibTeXFields.CROSSREF, crossRef); |
| 480 | 24 | } |
| 481 | |
|
| 482 | |
public String getEPrint() { |
| 483 | 25 | return mMap.get(EBibTeXFields.EPRINT); |
| 484 | |
} |
| 485 | |
|
| 486 | |
public void setEPrint(String ePrint) { |
| 487 | 24 | mMap.put(EBibTeXFields.EPRINT, ePrint); |
| 488 | 24 | } |
| 489 | |
|
| 490 | |
public String getComment() { |
| 491 | 25 | return mMap.get(EBibTeXFields.COMMENT); |
| 492 | |
} |
| 493 | |
|
| 494 | |
public void setComment(String comment) { |
| 495 | 24 | mMap.put(EBibTeXFields.COMMENT, comment); |
| 496 | 24 | } |
| 497 | |
|
| 498 | |
public String getUrl() { |
| 499 | 25 | return mMap.get(EBibTeXFields.URL); |
| 500 | |
} |
| 501 | |
|
| 502 | |
public void setUrl(String url) { |
| 503 | 24 | mMap.put(EBibTeXFields.URL, url); |
| 504 | 24 | } |
| 505 | |
|
| 506 | |
public boolean equals(Object obj) { |
| 507 | 18 | boolean result = false; |
| 508 | 18 | if (obj != null && obj instanceof ABibItem) { |
| 509 | 18 | result = getKey().equals(((ABibItem)obj).getKey()); |
| 510 | |
} |
| 511 | 18 | return result; |
| 512 | |
} |
| 513 | |
|
| 514 | |
@Override |
| 515 | |
public int compareTo(IItem o) { |
| 516 | 2360 | int result = 0; |
| 517 | 2360 | if (o instanceof ABibItem) { |
| 518 | 2360 | ABibItem item = (ABibItem)o; |
| 519 | 2360 | result = getKey().compareTo(item.getKey()); |
| 520 | |
} |
| 521 | |
|
| 522 | 2360 | return result; |
| 523 | |
} |
| 524 | |
|
| 525 | |
public void setItemValues(ABibItem item) { |
| 526 | 23 | setAddress(item.getAddress()); |
| 527 | 23 | setAuthor(item.getAuthor()); |
| 528 | 23 | setBookTitle(item.getBookTitle()); |
| 529 | 23 | setChapter(item.getChapter()); |
| 530 | 23 | setEdition(item.getEdition()); |
| 531 | 23 | setEditor(item.getEditor()); |
| 532 | 23 | setHowPublished(item.getHowPublished()); |
| 533 | 23 | setInstitution(item.getInstitution()); |
| 534 | 23 | setISBN(item.getISBN()); |
| 535 | 23 | setJournal(item.getJournal()); |
| 536 | 23 | setKey(item.getKey()); |
| 537 | 23 | setMonth(item.getMonth()); |
| 538 | 23 | setNote(item.getNote()); |
| 539 | 23 | setNumber(item.getNumber()); |
| 540 | 23 | setOrganization(item.getOrganization()); |
| 541 | 23 | setPages(item.getPages()); |
| 542 | 23 | setPublisher(item.getPublisher()); |
| 543 | 23 | setSchool(item.getSchool()); |
| 544 | 23 | setSeries(item.getSeries()); |
| 545 | 23 | setTitle(item.getTitle()); |
| 546 | 23 | setType(item.getType()); |
| 547 | 23 | setVolume(item.getVolume()); |
| 548 | 23 | setYear(item.getYear()); |
| 549 | 23 | setOwner(item.getOwner()); |
| 550 | 23 | setTimeStamp(item.getTimeStamp()); |
| 551 | 23 | setCrossRef(item.getCrossRef()); |
| 552 | 23 | setEPrint(item.getEPrint()); |
| 553 | 23 | setComment(item.getComment()); |
| 554 | 23 | setUrl(item.getUrl()); |
| 555 | 23 | } |
| 556 | |
|
| 557 | |
public abstract boolean isItemValid(); |
| 558 | |
|
| 559 | |
public String toHTML() { |
| 560 | 0 | String result = "<html>@" + getReference() + "{" + getKey() + ",<br/>"; |
| 561 | 0 | for(EBibTeXFields field : EBibTeXFields.values()) { |
| 562 | 0 | if (field != EBibTeXFields.KEY) { |
| 563 | 0 | String value = mMap.get(field); |
| 564 | 0 | if (value != null) { |
| 565 | 0 | result += "    " + |
| 566 | |
field.toString().toLowerCase() + " = {" + |
| 567 | |
value + "},<br/>"; |
| 568 | |
} |
| 569 | |
} |
| 570 | |
} |
| 571 | 0 | result += "}</html>"; |
| 572 | |
|
| 573 | 0 | return result; |
| 574 | |
} |
| 575 | |
|
| 576 | |
public String toString() { |
| 577 | 300 | String result = "@" + getReference() + "{" + getKey() + "," + System.getProperty("line.separator"); |
| 578 | 9000 | for(EBibTeXFields field : EBibTeXFields.values()) { |
| 579 | 8700 | if (field != EBibTeXFields.KEY) { |
| 580 | 8400 | if (mMap.get(field) != null) { |
| 581 | 2900 | result += " " + field.toString().toLowerCase() + " = {" + |
| 582 | |
mMap.get(field) + "}," + System.getProperty("line.separator"); |
| 583 | |
} |
| 584 | |
} |
| 585 | |
} |
| 586 | 300 | result += "}"; |
| 587 | |
|
| 588 | 300 | return result; |
| 589 | |
} |
| 590 | |
|
| 591 | |
String getItem(EBibTeXFields field) { |
| 592 | 0 | return mMap.get(field); |
| 593 | |
} |
| 594 | |
|
| 595 | |
void setItem(EBibTeXFields field, String value) { |
| 596 | 7202 | mMap.put(field, value); |
| 597 | 7202 | } |
| 598 | |
} |