Klasse SimplePolicy.DeltaTime

java.lang.Object
de.dlr.proseo.model.SimplePolicy.DeltaTime
Alle implementierten Schnittstellen:
Comparable<SimplePolicy.DeltaTime>
Umschließende Klasse:
SimplePolicy

@Embeddable public static class SimplePolicy.DeltaTime extends Object implements Comparable<SimplePolicy.DeltaTime>
Class representing a single overlapping time period
  • Felddetails

    • duration

      public long duration
      The duration of the time period in time units (non-negative)
    • unit

      public TimeUnit unit
      The time unit applicable for this time period
  • Konstruktordetails

    • DeltaTime

      public DeltaTime()
      No-argument constructor sets delta time to zero days
    • DeltaTime

      public DeltaTime(long duration, TimeUnit unit)
      Create a delta time with duration and unit
      Parameter:
      duration - the delta time duration
      unit - the delta time unit
  • Methodendetails

    • merge

      public SimplePolicy.DeltaTime merge(SimplePolicy.DeltaTime anotherDeltaTime)
      Merge two delta times by creating a new delta time with the smaller unit and the larger (converted) duration
      Parameter:
      anotherDeltaTime - the delta time to merge this one with
      Gibt zurück:
      a new DeltaTime object with the larger duration
    • toSeconds

      public long toSeconds()
      Convert the delta time to seconds (rounded to the nearest second)
      Gibt zurück:
      the duration of the delta time in seconds
    • toMilliseconds

      public long toMilliseconds()
      Convert the delta time to milliseconds
      Gibt zurück:
      the duration of the delta time in milliseconds
    • normalize

      public SimplePolicy.DeltaTime normalize()
      Normalize delta time to biggest unit, which can be represented with an integer duration
      Gibt zurück:
      the delta time itself for method chaining
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • hashCode

      public int hashCode()
      Setzt außer Kraft:
      hashCode in Klasse Object
    • equals

      public boolean equals(Object obj)
      Setzt außer Kraft:
      equals in Klasse Object
    • compareTo

      public int compareTo(SimplePolicy.DeltaTime o)
      Angegeben von:
      compareTo in Schnittstelle Comparable<SimplePolicy.DeltaTime>