Class AbstractResourceDepot

java.lang.Object
com.dna.jopt.member.unit.pnd.depot.AbstractGenericDepot<ILoadCapacity>
com.dna.jopt.member.unit.pnd.depot.resource.AbstractResourceDepot
All Implemented Interfaces:
IResourceDepot
Direct Known Subclasses:
SimpleResourceDepot

public abstract class AbstractResourceDepot extends AbstractGenericDepot<ILoadCapacity> implements IResourceDepot
  • Constructor Details

    • AbstractResourceDepot

      protected AbstractResourceDepot(String depotId, double maximalTotalCapacity)
    • AbstractResourceDepot

      protected AbstractResourceDepot(String depotId, double maximalTotalCapacity, Map<String,Double> capacityUnitMap)
      Constructor for a copy. The copy uses the given capacity unit map. Its factor maps are empty, like the maps of a new depot, and are only created when their getter is called.
      Parameters:
      depotId - the depot id
      maximalTotalCapacity - the maximal total capacity
      capacityUnitMap - the capacity unit map the copy uses
  • Method Details

    • invokeSearchArray

      public void invokeSearchArray(String[] loadIds)
      Description copied from interface: IResourceDepot
      Invoke search array.
      Specified by:
      invokeSearchArray in interface IResourceDepot
      Parameters:
      loadIds - the load ids
    • getSearchArraySize

      public int getSearchArraySize()
      Description copied from interface: IResourceDepot
      Gets the search array size.
      Specified by:
      getSearchArraySize in interface IResourceDepot
      Returns:
      the search array size
    • addAndUpdate

      public void addAndUpdate(List<ILoadCapacity> loadCapacities, int arraySize)
      Description copied from interface: IResourceDepot
      Adds the and update.
      Specified by:
      addAndUpdate in interface IResourceDepot
      Parameters:
      loadCapacities - the load capacities
      arraySize - the array size
    • getLoadCapacityBySearchIndex

      public Optional<ILoadCapacity> getLoadCapacityBySearchIndex(int index)
      Description copied from interface: IResourceDepot
      Gets the load capacity by search index.
      Specified by:
      getLoadCapacityBySearchIndex in interface IResourceDepot
      Parameters:
      index - the index
      Returns:
      the load capacity by search index
    • getCurrentTotalMatchedLoad

      public double getCurrentTotalMatchedLoad()
      Description copied from interface: IResourceDepot
      Gets the current total matched load.
      Specified by:
      getCurrentTotalMatchedLoad in interface IResourceDepot
      Returns:
      the current total matched load
    • addToCurrentTotalMatchLoad

      public void addToCurrentTotalMatchLoad(double addMatchLoad)
    • calculateMatchLoad

      public double calculateMatchLoad(String itemId, double loadValue)
      Description copied from interface: IResourceDepot
      Calculate match load.
      Specified by:
      calculateMatchLoad in interface IResourceDepot
      Parameters:
      itemId - the item id
      loadValue - the load value
      Returns:
      the double
    • inverseCalculateMatchLoad

      public double inverseCalculateMatchLoad(String itemId, double matchedloadValue)
      Description copied from interface: IResourceDepot
      Inverse calculate match load.
      Specified by:
      inverseCalculateMatchLoad in interface IResourceDepot
      Parameters:
      itemId - the item id
      matchedloadValue - the matchedload value
      Returns:
      the double
    • getMaximalTotalCapacity

      public double getMaximalTotalCapacity()
      Description copied from interface: IResourceDepot
      Gets the maximal total capacity.
      Specified by:
      getMaximalTotalCapacity in interface IResourceDepot
      Returns:
      the maximal total capacity
    • add

      public void add(String loadId, double capacityFactor)
      Description copied from interface: IResourceDepot
      Adds the.
      Specified by:
      add in interface IResourceDepot
      Parameters:
      loadId - the load id
      capacityFactor - the capacity factor
    • getCapacityUnitMap

      public Map<String,Double> getCapacityUnitMap()
      Description copied from interface: IResourceDepot
      Gets the capacity unit map.

      Required alongside IResourceDepot.setCapacityUnitMap(Map) so that Jackson can both serialize and deserialize this field. Without a getter the field is write-only in Jackson's property model, producing a writeOnly schema entry that hides the value in API responses.

      Specified by:
      getCapacityUnitMap in interface IResourceDepot
      Returns:
      the capacity unit map, or an empty map if not configured
    • setCapacityUnitMap

      public void setCapacityUnitMap(Map<String,Double> capacityUnitMap)
      Description copied from interface: IResourceDepot
      Sets the capacity unit map.
      Specified by:
      setCapacityUnitMap in interface IResourceDepot
      Parameters:
      capacityUnitMap - the capacity unit map
    • getEmptyAtEndOfRouteFactorMap

      public Map<String,Integer> getEmptyAtEndOfRouteFactorMap()
    • setEmptyAtEndOfRouteFactorMap

      public void setEmptyAtEndOfRouteFactorMap(Map<String,Integer> emptyEndOfRouteFactorMap)
    • getEmtpyAtEndOfRouteFactor

      public int getEmtpyAtEndOfRouteFactor(String loadId)
      Description copied from interface: IResourceDepot
      Gets the emtpy at end of route factor.
      Specified by:
      getEmtpyAtEndOfRouteFactor in interface IResourceDepot
      Parameters:
      loadId - the id
      Returns:
      the emtpy at end of route factor
    • getPerKilometerCostFactorMap

      public Map<String,Integer> getPerKilometerCostFactorMap()
    • getPerKilometerCostFactor

      public int getPerKilometerCostFactor(String loadId)
      Description copied from interface: IResourceDepot
      Gets the per kilometer cost factor.
      Specified by:
      getPerKilometerCostFactor in interface IResourceDepot
      Parameters:
      loadId - the load id
      Returns:
      the per kilometer cost factor
    • mergeItem

      public Optional<ILoadCapacity> mergeItem(ILoadCapacity itemOne, ILoadCapacity itemTwo)
      Specified by:
      mergeItem in class AbstractGenericDepot<ILoadCapacity>