@Test public void testAdd() { Duration d1 = DefaultDuration.of(1, TimeUnit.SECONDS); Duration d2 = DefaultDuration.of(1, TimeUnit.MINUTES); assertEquals(DefaultDuration.of(61, TimeUnit.SECONDS), d1.add(d2)); assertEquals(DefaultDuration.of(1.0166666666666666, TimeUnit.MINUTES), d2.add(d1)); }
@Override public Duration add(Duration other) { return DefaultDuration.of(this.value + getOtherVal(other), this.timeUnit); }
DefaultDuration implements Duration, Serializable { @Override public Duration add(Duration other) { return DefaultDuration.of(this.value + getOtherVal(other), this.timeUnit); } }
DefaultDuration implements Duration, Serializable { @Override public Duration add(Duration other) { return DefaultDuration.of(this.value + getOtherVal(other), this.timeUnit); } private  DefaultDuration(double value, TimeUnit timeUnit); }
DefaultDuration implements Duration, Serializable { @Override public Duration add(Duration other) { return DefaultDuration.of(this.value + getOtherVal(other), this.timeUnit); } private  DefaultDuration(double value, TimeUnit timeUnit); static DefaultDuration of(double value, TimeUnit timeUnit); @Override TimeUnit getTimeUnit(); @Override double getValue(TimeUnit timeUnit); @Override DefaultDuration convertTo(TimeUnit targetUnit); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(Duration other); @Override Duration add(Duration other); @Override Duration subtract(Duration other); @Override Duration divide(double divider); @Override Duration multiply(double multiplier); @Override String toString(); }
DefaultDuration implements Duration, Serializable { @Override public Duration add(Duration other) { return DefaultDuration.of(this.value + getOtherVal(other), this.timeUnit); } private  DefaultDuration(double value, TimeUnit timeUnit); static DefaultDuration of(double value, TimeUnit timeUnit); @Override TimeUnit getTimeUnit(); @Override double getValue(TimeUnit timeUnit); @Override DefaultDuration convertTo(TimeUnit targetUnit); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(Duration other); @Override Duration add(Duration other); @Override Duration subtract(Duration other); @Override Duration divide(double divider); @Override Duration multiply(double multiplier); @Override String toString();  }