Class Horizon

java.lang.Object
ca.spatial.patchworks.Horizon

public abstract class Horizon extends Object
This class keeps track of the length of the planning horizon and the division into planning period intervals. This is a pure static class that is initialized by the Control object.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static int[]
     
    static int[]
     
    static int
     
    static float[]
     
    static int[]
     
    static double[]
     
    static double[]
     
    static int[]
     
    static int
     
    static int[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    discount​(double rate)
    Return an array having discount values for the time mid-points of each planning period.
    static double[]
    discount​(double rate, int startYear)
    Return an array having discount values for the time mid-points of each planning period.
    static double[]
    factors​(double factor)
    Return an array that is the length of the planning period (plus time 0) with all array entries having the factor value.
    static double[]
    factors​(double[] factors)
    Return an array that is the length of the planning period (plus time 0) with array entries being assigned from the input factors array.
    static boolean
    Identifies if the horizon has been initialized.
    static int
    Return the number of planning periods (not including time 0)
    static double[]
    productOfFactors​(double[] f1, double[] f2)
    Return an array that is the product of the two input arrays.
    static int
    setHorizon​(int[] intervals)
    Iniitalize the planning horizon to list of variable width periods.
    static int
    setHorizon​(int periods, int interval)
    Initialize the planning horizon to be a specified number of fixed width periods.
    static String
    simplifyFactors​(double[] factors)
    Return a string having the factor valuess in their most simplified form.
    static String
    simplifyFactors​(double[] factors, boolean round)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • periodList

      public static int[] periodList
    • activeList

      public static int[] activeList
    • periods

      public static int periods
    • horizon

      public static int horizon
    • lookup

      public static int[] lookup
    • census

      public static int[] census
    • intervals

      public static float[] intervals
    • periodWidths

      public static int[] periodWidths
    • oneFactors

      public static double[] oneFactors
    • negoneFactors

      public static double[] negoneFactors
  • Constructor Details

    • Horizon

      public Horizon()
  • Method Details

    • setHorizon

      public static int setHorizon(int periods, int interval)
      Initialize the planning horizon to be a specified number of fixed width periods.
    • setHorizon

      public static int setHorizon(int[] intervals)
      Iniitalize the planning horizon to list of variable width periods.
    • getIsInitialized

      public static boolean getIsInitialized()
      Identifies if the horizon has been initialized.
    • getPeriods

      public static int getPeriods()
      Return the number of planning periods (not including time 0)
    • factors

      public static double[] factors(double factor)
      Return an array that is the length of the planning period (plus time 0) with all array entries having the factor value.
      Parameters:
      factor - the value to assign to all array cells
    • factors

      public static double[] factors(double[] factors)
      Return an array that is the length of the planning period (plus time 0) with array entries being assigned from the input factors array. If the input array does not have enough values then pad out with the last value. If the input array has too many values then truncate.
      Parameters:
      factors - the values to assign to the array cells
    • productOfFactors

      public static double[] productOfFactors(double[] f1, double[] f2)
      Return an array that is the product of the two input arrays.
      Parameters:
      f1 - the first input array
      f2 - the second input array
    • discount

      public static double[] discount(double rate)
      Return an array having discount values for the time mid-points of each planning period.
      Parameters:
      rate - the discount rate as a fraction
    • discount

      public static double[] discount(double rate, int startYear)
      Return an array having discount values for the time mid-points of each planning period.
      Parameters:
      rate - the discount rate as a fraction
    • simplifyFactors

      public static String simplifyFactors(double[] factors)
      Return a string having the factor valuess in their most simplified form. If all factor values are the same then return a single number. Otherwise return a list of with any trailing repeated values truncated
    • simplifyFactors

      public static String simplifyFactors(double[] factors, boolean round)