Class BaseSpread

java.lang.Object
com.primavera.common.value.spread.BaseSpread
All Implemented Interfaces:
Serializable, Cloneable, Iterable<SpreadPeriod>
Direct Known Subclasses:
com.primavera.common.value.spread.ActivityBaseSpread, com.primavera.common.value.spread.ExpenseCategorySpread, ResourceAssignmentBaseSpread, ResourceAssignmentCBSBaseSpread, WBSSpread

public abstract class BaseSpread extends Object implements Iterable<SpreadPeriod>, Serializable, Cloneable
The base class of all main spread classes. You can access spread data for all periods by first obtaining an iterator using the getSpreadIterator method. This iterator allows access to the SpreadPeriod objects that have been loaded with this spread object. For each SpreadPeriod, you can then call the SpreadPeriod.getUnits(), SpreadPeriod.getCumulativeUnits(), SpreadPeriod.getCost(), or SpreadPeriod.getCumulativeCost() methods, passing in the unit or cost field name. To discover the unit or cost field names that have been loaded, use the getUnitFields() and getCostFields() methods.
See Also:
  • Method Details

    • hasCumulativeData

      public boolean hasCumulativeData()
      Indicates whether cumulative data has been loaded.
      Returns:
      boolean whether cumulative data is available
    • clearFinancialValues

      public void clearFinancialValues()
      Security implementation: clear all the cost fields with a Double.NaN value.
    • getUnitFields

      public String[] getUnitFields()
      Gets the unit field names in the spread data.
      Returns:
      an array of unit field names
    • getCostFields

      public String[] getCostFields()
      Gets the cost field names in the spread data.
      Returns:
      an array of cost field names
    • size

      public int size()
      Gets the number of buckets in this batch of spread data.
      Returns:
      the number of non-empty buckets
    • getSpreadIterator

      public Iterator<SpreadPeriod> getSpreadIterator(boolean bIncludeEmptyBuckets)
      Creates a spread iterator object through which to access spread data. EPSSpreads will return an iterator for a collection of EPSSpreadPeriods, ResourceAssignmentSpreads will return an iterator for a collection of ResourceAssignmentSpreadPeriods, etc.
      Parameters:
      bIncludeEmptyBuckets - when the bucket the date falls in has no spread data, if true, return a spread period with 0 values for all period value fields, and previous cumulative values for all cumulative value fields; if false, skip the empty buckets. This parameter only applies to summarized spread types (EPSSpread, ProjectSpread, and WBSSpread) and does not apply to live spreads (ResourceAssignmentSpread).
      Returns:
      iterator an iterator for a type of SpreadPeriod collection
    • iterator

      public Iterator<SpreadPeriod> iterator()
      Specified by:
      iterator in interface Iterable<SpreadPeriod>
    • getSpreadBucketTypeEnum

      public SpreadBucketType getSpreadBucketTypeEnum()
      Gets the bucket type of spread data in enum.
      Returns:
      the bucket type in enum
    • getSpreadBucketType

      public int getSpreadBucketType()
      Gets the bucket type of spread data.
      Returns:
      the bucket type
    • getSpreadStart

      public Date getSpreadStart()
      Gets the start date of this batch of spread data.
      Returns:
      the spread start date
    • getSpreadEnd

      public Date getSpreadEnd()
      Gets the end date of this batch of spread data.
      Returns:
      the spread end time
    • ensureSpreadSpansDate

      public void ensureSpreadSpansDate(Date date)
      Makes sure that a bucket is available for the given date, and if not, adds a bucket for it.
      Parameters:
      date - the date you wish to have a bucket represent
    • ensureSpreadSpansDate

      public Date ensureSpreadSpansDate(Date date, boolean returnBucketStart)
      Makes sure that a bucket is available for the given date, and if not, adds a bucket for it and returns the created bucket's start date.
      Parameters:
      date - the date you wish to have a bucket represent
    • getSpreadPeriod

      public SpreadPeriod getSpreadPeriod(Date date, boolean bIncludeEmptyBucket) throws SpreadOutOfRangeException
      Finds the spread period by a given date which falls in the bucket start time (inclusive) and end time (exclusive).
      Parameters:
      date - the time when the spread period falls in
      bIncludeEmptyBucket - this indicate what will be returned when there is no data in this period. If true, returned SpreadPeriod will contain 0 for all fields for period value (the cumulative value will be calculated from the previous bucket); if false, it will return null.
      Returns:
      the spread period the date falls in
      Throws:
      SpreadOutOfRangeException - if the date is out of the range of the spread start and end
    • toString

      public String toString()
      Returns a string representation on this object.
      Overrides:
      toString in class Object
      Returns:
      String string representation of BaseSpread