Interface Account

All Superinterfaces:
Comparable<Account>
All Known Implementing Classes:
Exclusive, ExclusiveDependent, FlowRatioTarget, FlowValueTarget, PatchTarget, PoolAccount, TabulateTarget

public interface Account extends Comparable<Account>
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
    Modifier and Type
    Field
    Description
    static double
     
    static double
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accept​(ca.spatial.patchworks.AccountVisitor visitor, Object[] args)
    Implement the visitor pattern on the account structure
    void
    add​(Complex delta, long[][] values, double[] factors, int index)
    Add a set of values, one per period
    void
    add​(Complex delta, long[] value, double factor, int period, int index)
    Add a value to a specific period.
    void
    addCache​(Complex delta, long[][] values, double[] factors, int index)
    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 account
    ca.spatial.patchworks.DuplicateAccount
    getDuplicate​(int i)
    Return a duplicate account.
    int
    Determine the number of duplicate accounts
    int
    Get the index number of the account.
    double
    getInitial​(int period)
     
    Get the name of the account
    Get the type of the account
    boolean
    Report if this account is an account that does not depend on any inputs
    boolean
    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 debugging information
    void
    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 state
    resolve​(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
    sub​(Complex delta, long[][] values, double[] factors, int index)
    Subtract a set of values, one per period
    void
    sub​(Complex delta, long[] value, double factor, int period, int index)
    Subtract a value from a specific period
    void
    subCache​(Complex delta, long[][] values, double[] factors, int index)
    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

  • 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

      void print(PrintStream pw)
      Print debugging information
    • add

      void add(Complex delta, long[][] values, double[] factors, int index)
      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 period
      index - The internal block id of the feature that is changing
    • add

      void add(Complex delta, long[] value, double factor, int period, int index)
      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 period
      period - the planning period of interest
      index - The internal block id of the feature that is changing
    • sub

      void sub(Complex delta, long[][] values, double[] factors, int index)
      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 period
      index - The internal block id of the feature that is changing
    • sub

      void sub(Complex delta, long[] value, double factor, int period, int index)
      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 period
      period - the planning period of interest
      index - The internal block id of the feature that is changing
    • addCache

      void addCache(Complex delta, long[][] values, double[] factors, int index)
      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 period
      index - The internal block id of the feature that is changing
    • subCache

      void subCache(Complex delta, long[][] values, double[] factors, int index)
      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 period
      index - 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

      void addDuplicate(Account account, double factor)
      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

      void addDuplicate(Account account, double[] factors)
      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

      void accept(ca.spatial.patchworks.AccountVisitor visitor, Object[] args)
      Implement the visitor pattern on the account structure
    • findAccount

      Account findAccount(String label)
      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

      String getDescription(ca.spatial.patchworks.Forest forest, Vector<Vector<Object>> outputs)
      Get a description of this account that can be used in the AccountExplorer.
    • listInputs

      void listInputs(Account account, Vector<Vector<Object>> inputs)
      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

      default int compareTo(Account ac)
      Specified by:
      compareTo in interface Comparable<Account>