Package ca.spatial.patchworks
Interface Account
- All Superinterfaces:
Comparable<Account>
- All Known Implementing Classes:
Exclusive
,ExclusiveDependent
,FlowRatioTarget
,FlowValueTarget
,PatchTarget
,PoolAccount
,TabulateTarget
The account interface describes how to add and
subtract values from accounts.
Do not confuse this with the
Target
interface,
which specifies how to set target levels and query
the target status.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
Implement the visitor pattern on the account structurevoid
Add a set of values, one per periodvoid
Add a value to a specific period.void
Add a set of values, one per period to the cache accounts.void
addDuplicate(Account account, double factor)
Set up a relationship so that the value from this account will be duplicated into the other account.void
addDuplicate(Account account, double[] factors)
Set up a relationship so that the value from this account will be duplicated into the other account.default int
findAccount(String label)
Find if this account matches the specified name, or if it contains a sub-account that matches that name.getDescription(ca.spatial.patchworks.Forest forest, Vector<Vector<Object>> outputs)
Get a description of this account that can be used in the AccountExplorer.boolean
Check if costs are calculated in period zero for this accountca.spatial.patchworks.DuplicateAccount
getDuplicate(int i)
Return a duplicate account.int
Determine the number of duplicate accountsint
getIndex()
Get the index number of the account.double
getInitial(int period)
getLabel()
Get the name of the accountgetType()
Get the type of the accountboolean
Report if this account is an account that does not depend on any inputsboolean
Has the account been resolved during the initialization process?void
listInputs(Account account, Vector<Vector<Object>> inputs)
Test to see if the account contributes to the specified account.void
minimumCost(float[] costs)
Fill an array with the minimum cost estimates for this account.float
minimumCost(int index)
Estimate the cost of the block at this index.void
print(PrintStream pw)
Print debugging informationvoid
recordLinks(ca.spatial.patchworks.AccountsToDot recorder)
A method to record all of the accounts that are linked from this account.void
reset(boolean init)
Set the account back to an inital stateresolve(HashMap<String,Account> accounts, HashMap<String,Target> targets, float[] intervals, double scale, List<Account> stack)
Resolve references between accounts.void
setDoZeroCosts(boolean state)
Indicate if costs should be computed in period zero.void
setIndependent(boolean state)
Set the dependent status of this account.void
setInitial(double value, int period)
void
Subtract a set of values, one per periodvoid
Subtract a value from a specific periodvoid
Subtract a set of values, one per period to the cache accounts.boolean
validForBlock(int source)
Determine if this account is acceptable for the block.
-
Field Details
-
DEFAULT_FACTOR
static final double DEFAULT_FACTOR- See Also:
- Constant Field Values
-
DEFAULT_SCALE
static final double DEFAULT_SCALE- See Also:
- Constant Field Values
-
-
Method Details
-
reset
void reset(boolean init)Set the account back to an inital state -
getLabel
String getLabel()Get the name of the account -
getType
String getType()Get the type of the account -
getIndex
int getIndex()Get the index number of the account. This is a sequence number that used internally by the accounting mechanism. -
print
Print debugging information -
add
Add a set of values, one per period- Parameters:
delta
- An high-resolution accumulator object that will track the amount that was added in this operation.values
- The array of values to add, one for each period.factors
- the scaling factor for this periodindex
- The internal block id of the feature that is changing
-
add
Add a value to a specific period.- Parameters:
delta
- An high-resolution accumulator object that will track the amount that was added in this operation.value
- The array of values to add, one for each period.factor
- the scaling factor for this periodperiod
- the planning period of interestindex
- The internal block id of the feature that is changing
-
sub
Subtract a set of values, one per period- Parameters:
delta
- An high-resolution accumulator object that will track the amount that was added in this operation.values
- The array of values to add, one for each period.factors
- the scaling factor for this periodindex
- The internal block id of the feature that is changing
-
sub
Subtract a value from a specific period- Parameters:
delta
- An high-resolution accumulator object that will track the amount that was added in this operation.value
- The array of values to add, one for each period.factor
- the scaling factor for this periodperiod
- the planning period of interestindex
- The internal block id of the feature that is changing
-
addCache
Add a set of values, one per period to the cache accounts.- Parameters:
delta
- An high-resolution accumulator object that will track the amount that was added in this operation.values
- The array of values to add, one for each period.factors
- the scaling factor for this periodindex
- The internal block id of the feature that is changing
-
subCache
Subtract a set of values, one per period to the cache accounts.- Parameters:
delta
- An high-resolution accumulator object that will track the amount that was added in this operation.values
- The array of values to add, one for each period.factors
- the scaling factor for this periodindex
- The internal block id of the feature that is changing
-
resolve
Account resolve(HashMap<String,Account> accounts, HashMap<String,Target> targets, float[] intervals, double scale, List<Account> stack)Resolve references between accounts. This method is called when the account structure is being set up in order to link dependent accounts. -
validForBlock
boolean validForBlock(int source)Determine if this account is acceptable for the block. In most cases this will be true, however some blocks may not be eligible to participate in route accounts (for example, if they do not connect to the network). -
minimumCost
void minimumCost(float[] costs)Fill an array with the minimum cost estimates for this account. This will return constants for plain accounts, and haul costs value for route accounts. This value is useful to assess the least cost alternative in an exclusive account. -
minimumCost
float minimumCost(int index)Estimate the cost of the block at this index. This will return a constant for plain accounts, and a rough estimate of the haul cost value for route accounts. This value is useful to assess the least cost alternative in an exclusive account. -
addDuplicate
Set up a relationship so that the value from this account will be duplicated into the other account.- Parameters:
account
- The account to receive the duplicated values.factor
- A scaling factor to be applied to the duplicated account.
-
addDuplicate
Set up a relationship so that the value from this account will be duplicated into the other account.- Parameters:
account
- The account to receive the duplicated values.factors
- An array of scaling factors to be applied to the duplicated account, one for each period.
-
getDuplicateCount
int getDuplicateCount()Determine the number of duplicate accounts -
getDuplicate
ca.spatial.patchworks.DuplicateAccount getDuplicate(int i)Return a duplicate account. -
accept
Implement the visitor pattern on the account structure -
findAccount
Find if this account matches the specified name, or if it contains a sub-account that matches that name. -
isResolved
boolean isResolved()Has the account been resolved during the initialization process? -
recordLinks
void recordLinks(ca.spatial.patchworks.AccountsToDot recorder)A method to record all of the accounts that are linked from this account. -
getDescription
Get a description of this account that can be used in the AccountExplorer. -
listInputs
Test to see if the account contributes to the specified account. If yes, then add information about the relationship to the vector.- Parameters:
account
- The account that we are testing.inputs
- The vector to add information into if this account contributes to the account we are testing for.
-
setInitial
void setInitial(double value, int period) -
getInitial
double getInitial(int period) -
setDoZeroCosts
void setDoZeroCosts(boolean state)Indicate if costs should be computed in period zero. In most cases the answer is no because values are invariant in period zero so they to not influence the objective function. Route costs are always an exception because routes can be changed in this time period. Period zero values can be manipulated when attributes are distributed to period zero.This method will toggle the associated TargetChart so that it will show values in period zero.
-
getDoZeroCosts
boolean getDoZeroCosts()Check if costs are calculated in period zero for this account -
isIndependent
boolean isIndependent()Report if this account is an account that does not depend on any inputs -
setIndependent
void setIndependent(boolean state)Set the dependent status of this account. This can only be done prior to resolving. Accounts that are created without attributes are automatically marked as independent. -
compareTo
- Specified by:
compareTo
in interfaceComparable<Account>
-