Documentation of 'org.jquantlib.time.Period' Java class
Period
org.jquantlib.time

Class Period

  • All Implemented Interfaces:
    java.lang.Cloneable


    public class Period
    extends java.lang.Object
    implements java.lang.Cloneable
    This class provides a Period (length + TimeUnit) class and implements a limited algebra.
    • Field Detail

      • ONE_YEAR_FORWARD

        public static final Period ONE_YEAR_FORWARD
        Constant that can be used to represent one year period forward
      • ONE_YEAR_BACKWARD

        public static final Period ONE_YEAR_BACKWARD
        Constant that can be used to represent one year period in the past
      • ONE_MONTH_FORWARD

        public static final Period ONE_MONTH_FORWARD
        Constant that can be used to represent one year period forward
      • ONE_MONTH_BACKWARD

        public static final Period ONE_MONTH_BACKWARD
        Constant that can be used to represent one year period in the past
      • ONE_DAY_FORWARD

        public static final Period ONE_DAY_FORWARD
        Constant that can be used to represent one year period forward
      • ONE_DAY_BACKWARD

        public static final Period ONE_DAY_BACKWARD
        Constant that can be used to represent one year period in the past
    • Constructor Detail

      • Period

        public Period()
        Default constructor. Defaults to period of 0 days
      • Period

        public Period(int length,
                      TimeUnit units)
        To construct period representing the specified length and units
        Parameters:
        length -
        units -
      • Period

        public Period(Frequency f)
        To create a period by Frequency
        Parameters:
        f -
    • Method Detail

      • negative

        public Period negative()
      • addAssign

        public Period addAssign(Period another)
        Returns this Period added to another Period
        Parameters:
        another -
        Returns:
        this
      • subAssign

        public Period subAssign(Period another)
        Returns this Period subtracted another Period
        Parameters:
        another -
        Returns:
        this
      • divAssign

        public Period divAssign(int scalar)
        Returns this Period divided by a scalar
        Parameters:
        scalar -
        Returns:
        this
      • mul

        public Period mul(int scalar)
        Returns this Period multiplied by a scalar
        Parameters:
        scalar -
        Returns:
        a new instance
      • add

        public Period add(Period another)
        Returns this Period added another Period
        Parameters:
        another -
        Returns:
        a new instance
      • sub

        public Period sub(Period another)
        Returns this Period subtracted another Period
        Parameters:
        another -
        Returns:
        a new instance
      • div

        public Period div(int scalar)
        Returns this Period divided by a scalar
        Parameters:
        another -
        Returns:
        a new instance
      • eq

        public boolean eq(Period another)
        Compares this to another Period
        Parameters:
        another -
        Returns:
        true if this is equal to another, false otherwise
      • neq

        public boolean neq(Period another)
        Compares this to another Period
        Parameters:
        another -
        Returns:
        true if this is not equal to another, false otherwise
      • gt

        public boolean gt(Period another)
        Compares this to another Period
        Parameters:
        another -
        Returns:
        true if this is greater than another, false otherwise
      • le

        public boolean le(Period another)
        Compares this to another Period
        Parameters:
        another -
        Returns:
        true if this is less than or equal to another, false otherwise
      • ge

        public boolean ge(Period another)
        Compares this to another Period
        Parameters:
        another -
        Returns:
        true if this is greater or equal to another, false otherwise
      • lt

        public boolean lt(Period another)
        Compares this to another Period
        Parameters:
        another -
        Returns:
        true if this is less than another, false otherwise
      • length

        public final int length()
        Returns:
        length of the period
      • units

        public final TimeUnit units()
        Time units represented by the period
        Returns:
        time units of the period
      • frequency

        public final Frequency frequency()
        To get at Frequency represented by the period
        Returns:
      • years

        public double years(Period p)
      • months

        public double months(Period p)
      • weeks

        public double weeks(Period p)
      • days

        public double days(Period p)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getLongFormat

        public java.lang.String getLongFormat()
        Returns the name of period in long format
        Returns:
        the name of period in long format
      • getShortFormat

        public java.lang.String getShortFormat()
        Returns the name of period in short format (3 letters)
        Returns:
        the name of period in short format (3 letters)
      • normalize

        public void normalize()

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.