Revision 4b8da4a0
Added by Andreas Müller almost 2 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/PolytomousKey.java | ||
---|---|---|
30 | 30 |
import javax.xml.bind.annotation.XmlType; |
31 | 31 |
|
32 | 32 |
import org.apache.commons.lang3.StringUtils; |
33 |
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger; |
|
33 |
import org.apache.logging.log4j.LogManager; |
|
34 |
import org.apache.logging.log4j.Logger; |
|
34 | 35 |
import org.hibernate.annotations.Cascade; |
35 | 36 |
import org.hibernate.annotations.CascadeType; |
36 | 37 |
import org.hibernate.envers.Audited; |
... | ... | |
202 | 203 |
@Override |
203 | 204 |
public Set<Taxon> getCoveredTaxa() { |
204 | 205 |
if (coveredTaxa == null) { |
205 |
this.coveredTaxa = new HashSet<Taxon>();
|
|
206 |
this.coveredTaxa = new HashSet<>(); |
|
206 | 207 |
} |
207 | 208 |
return coveredTaxa; |
208 | 209 |
} |
... | ... | |
248 | 249 |
@Override |
249 | 250 |
public Set<NamedArea> getGeographicalScope() { |
250 | 251 |
if (geographicalScope == null) { |
251 |
this.geographicalScope = new HashSet<NamedArea>();
|
|
252 |
this.geographicalScope = new HashSet<>(); |
|
252 | 253 |
} |
253 | 254 |
return geographicalScope; |
254 | 255 |
} |
... | ... | |
287 | 288 |
@Override |
288 | 289 |
public Set<Taxon> getTaxonomicScope() { |
289 | 290 |
if (taxonomicScope == null) { |
290 |
this.taxonomicScope = new HashSet<Taxon>();
|
|
291 |
this.taxonomicScope = new HashSet<>(); |
|
291 | 292 |
} |
292 | 293 |
return taxonomicScope; |
293 | 294 |
} |
... | ... | |
326 | 327 |
@Override |
327 | 328 |
public Set<DefinedTerm> getScopeRestrictions() { |
328 | 329 |
if (scopeRestrictions == null) { |
329 |
this.scopeRestrictions = new HashSet<DefinedTerm>();
|
|
330 |
this.scopeRestrictions = new HashSet<>(); |
|
330 | 331 |
} |
331 | 332 |
return scopeRestrictions; |
332 | 333 |
} |
... | ... | |
380 | 381 |
|
381 | 382 |
// ******************** toString *****************************************/ |
382 | 383 |
|
383 |
private class IntegerObject { |
|
384 |
int number = 0; |
|
385 |
|
|
386 |
int inc() { |
|
387 |
return number++; |
|
388 |
}; |
|
389 |
|
|
390 |
@Override |
|
391 |
public String toString() { |
|
392 |
return String.valueOf(number); |
|
393 |
} |
|
394 |
} |
|
395 |
|
|
396 | 384 |
public String print(PrintStream stream) { |
397 | 385 |
String title = this.getTitleCache() + "\n"; |
398 | 386 |
String strPrint = title; |
... | ... | |
498 | 486 |
} |
499 | 487 |
|
500 | 488 |
|
501 |
// *********************** CLONE ************************************/
|
|
489 |
// *********************** CLONE ************************************/ |
|
502 | 490 |
|
503 | 491 |
/** |
504 | 492 |
* Clones <i>this</i> PolytomousKey. This is a shortcut that enables to |
... | ... | |
515 | 503 |
try { |
516 | 504 |
result = (PolytomousKey) super.clone(); |
517 | 505 |
|
518 |
result.coveredTaxa = new HashSet<Taxon>();
|
|
506 |
result.coveredTaxa = new HashSet<>(); |
|
519 | 507 |
for (Taxon taxon : this.coveredTaxa) { |
520 | 508 |
result.addCoveredTaxon(taxon); |
521 | 509 |
} |
522 | 510 |
|
523 |
result.geographicalScope = new HashSet<NamedArea>();
|
|
511 |
result.geographicalScope = new HashSet<>(); |
|
524 | 512 |
for (NamedArea area : this.geographicalScope) { |
525 | 513 |
result.addGeographicalScope(area); |
526 | 514 |
} |
527 | 515 |
|
528 | 516 |
result.root = this.root.clone(); |
529 | 517 |
|
530 |
result.scopeRestrictions = new HashSet<DefinedTerm>();
|
|
518 |
result.scopeRestrictions = new HashSet<>(); |
|
531 | 519 |
for (DefinedTerm scope : this.scopeRestrictions) { |
532 | 520 |
result.addScopeRestriction(scope); |
533 | 521 |
} |
534 | 522 |
|
535 |
result.taxonomicScope = new HashSet<Taxon>();
|
|
523 |
result.taxonomicScope = new HashSet<>(); |
|
536 | 524 |
for (Taxon taxon : this.taxonomicScope) { |
537 | 525 |
result.addTaxonomicScope(taxon); |
538 | 526 |
} |
... | ... | |
545 | 533 |
return null; |
546 | 534 |
} |
547 | 535 |
} |
548 |
} |
|
536 |
} |
Also available in: Unified diff
cleanup