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 Summary
Modifier and TypeMethodDescriptionvoidSecurity implementation: clear all the cost fields with a Double.NaN value.voidensureSpreadSpansDate(Date date) Makes sure that a bucket is available for the given date, and if not, adds a bucket for it.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.String[]Gets the cost field names in the spread data.intGets the bucket type of spread data.Gets the bucket type of spread data in enum.Gets the end date of this batch of spread data.getSpreadIterator(boolean bIncludeEmptyBuckets) Creates a spread iterator object through which to access spread data.getSpreadPeriod(Date date, boolean bIncludeEmptyBucket) Finds the spread period by a given date which falls in the bucket start time (inclusive) and end time (exclusive).Gets the start date of this batch of spread data.String[]Gets the unit field names in the spread data.booleanIndicates whether cumulative data has been loaded.iterator()intsize()Gets the number of buckets in this batch of spread data.toString()Returns a string representation on this object.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
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
Gets the unit field names in the spread data.- Returns:
- an array of unit field names
-
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
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
- Specified by:
iteratorin interfaceIterable<SpreadPeriod>
-
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
Gets the start date of this batch of spread data.- Returns:
- the spread start date
-
getSpreadEnd
Gets the end date of this batch of spread data.- Returns:
- the spread end time
-
ensureSpreadSpansDate
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
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 inbIncludeEmptyBucket- 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
Returns a string representation on this object.
-