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

Method contains

base/src/main/java/net/time4j/Duration.java:1056–1079  ·  view source on GitHub ↗
(IsoUnit unit)

Source from the content-addressed store, hash-verified

1054 * @see #getPartialAmount(IsoUnit) getPartialAmount(U)
1055 */
1056 @Override
1057 public boolean contains(IsoUnit unit) {
1058
1059 if (unit == null) {
1060 return false;
1061 }
1062
1063 boolean fractional = isFractionUnit(unit);
1064
1065 for (int i = 0, n = this.items.size(); i < n; i++) {
1066 Item<U> item = this.items.get(i);
1067 U u = item.getUnit();
1068
1069 if (
1070 u.equals(unit)
1071 || (fractional && isFractionUnit(u))
1072 ) {
1073 return (item.getAmount() > 0);
1074 }
1075 }
1076
1077 return false;
1078
1079 }
1080
1081 /**
1082 * <p>Gets the partial amount associated with given time unit. </p>

Callers 1

toStringMethod · 0.95

Calls 6

isFractionUnitMethod · 0.95
getMethod · 0.65
sizeMethod · 0.45
getUnitMethod · 0.45
equalsMethod · 0.45
getAmountMethod · 0.45

Tested by

no test coverage detected