MCPcopy Create free account
hub / github.com/MenoData/Time4J / getBaseUnit

Method getBaseUnit

base/src/main/java/net/time4j/engine/TimeAxis.java:355–378  ·  view source on GitHub ↗
(ChronoElement<?> element)

Source from the content-addressed store, hash-verified

353 * @see BasicElement#getParent()
354 */
355 public U getBaseUnit(ChronoElement<?> element) {
356
357 if (element == null) {
358 throw new NullPointerException("Missing element.");
359 }
360
361 U baseUnit = this.baseUnits.get(element);
362
363 if (
364 (baseUnit == null)
365 && (element instanceof BasicElement)
366 ) {
367 ChronoElement<?> parent = ((BasicElement) element).getParent();
368 baseUnit = this.baseUnits.get(parent);
369 }
370
371 if (baseUnit == null) {
372 throw new ChronoException(
373 "Base unit not found for: " + element.name());
374 }
375
376 return baseUnit;
377
378 }
379
380 /**
381 * <p>Compares time units by ascending precision (that is descending length). </p>

Calls 3

getMethod · 0.65
nameMethod · 0.65
getParentMethod · 0.45