| 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> |