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

Method plus

base/src/main/java/net/time4j/PlainTimestamp.java:1260–1279  ·  view source on GitHub ↗
(
        long amount,
        CalendarUnit unit
    )

Source from the content-addressed store, hash-verified

1258 * @since 4.19
1259 */
1260 public PlainTimestamp plus(
1261 long amount,
1262 CalendarUnit unit
1263 ) {
1264
1265 if (unit == null) {
1266 throw new NullPointerException("Missing unit.");
1267 } else if (amount == 0) {
1268 return this;
1269 }
1270
1271 try {
1272 return CALENDAR_UNIT_RULE_MAP.get(unit).addTo(this, amount);
1273 } catch (IllegalArgumentException iae) {
1274 ArithmeticException ex = new ArithmeticException("Result beyond boundaries of time axis.");
1275 ex.initCause(iae);
1276 throw ex;
1277 }
1278
1279 }
1280
1281 /**
1282 * <p>Adds given amount in units to this timestamp and yields the result of addition. </p>

Callers 15

betweenTimestamps1Method · 0.95
betweenTimestamps3Method · 0.95
betweenTimestamps5Method · 0.95
betweenTimestamps8Method · 0.95
nowTimestampMethod · 0.95
stream4Method · 0.95
stream5Method · 0.95
streamSizeLimitMethod · 0.95
businessDays5Method · 0.95

Calls 2

addToMethod · 0.65
getMethod · 0.65

Tested by 13

betweenTimestamps1Method · 0.76
betweenTimestamps3Method · 0.76
betweenTimestamps5Method · 0.76
betweenTimestamps8Method · 0.76
nowTimestampMethod · 0.76
stream4Method · 0.76
stream5Method · 0.76
streamSizeLimitMethod · 0.76
businessDays5Method · 0.76