Class ExtractUtil

java.lang.Object
com.dna.jopt.util.ExtractUtil

public class ExtractUtil extends Object
Util methods to extract objects from result of optimization
  • Method Details

    • getNodeById

      public static Optional<INode> getNodeById(IEntity entity, String id, INodeUnassigner unassignNodeManager)
      Try to find node by ID in routes of optimization entity or unassignedNodeManager (in this case, if node was filtered, it is in UnassignedNodeManager)
      Parameters:
      entity - result of optimization
      id - id
      unassignNodeManager - - try to find node in unassignNodeManager too
      Returns:
      found node or empty result
    • getNodeById

      public static Optional<INode> getNodeById(IEntity entity, String id)
      Try to find node by id in routes of optimization entity in case of violations we don't try to find filtered nodes
      Parameters:
      entity - result of optimization
      id - id
      Returns:
      found node or empty result
    • getNodesByType

      public static List<INode> getNodesByType(IEntity entity, Class<? extends INode> clazz)
      Find nodes by type in routes of optimization result
      Parameters:
      entity - result of optimization
      clazz - type of node to find
      Returns:
      list of found nodes or empty list
    • getResource

      public static Optional<IResource> getResource(IEntity entity, String resourceId)
      find resource by ID in routes of optimization result
      Parameters:
      entity - result of optimization
      resourceId - resource Id
      Returns:
      found resource or empty result
    • getResource

      public static Optional<IResource> getResource(IEntity entity, IDutyHours whs)
      Find any resource in routes of optimization results who's duty hours intersect with parameter whs
      Parameters:
      entity - result of optimization
      whs - working hours to check
      Returns:
      found resource or empty result
    • getRoutes

      public static List<ILogicEntityRoute> getRoutes(IEntity entity, IDutyHours whs)
      Get routes with resource duty hours got intersection with working hours specified by param whs
      Parameters:
      entity - result of optimization
      whs - working hours
      Returns:
      list of found routes
    • getRoutesONS

      public static List<ILogicEntityRoute> getRoutesONS(IEntity entity, Boolean justInUse)
      Get routes containing ONS nodes
      Parameters:
      entity - result of optimization
      justInUse - take in account just elements which are in use in the routes
      Returns:
      list of found routes or empty result
    • getRoutesPillars

      public static List<IPillarNode> getRoutesPillars(IEntity entity)
      get pillar nodes of all result routes
      Parameters:
      entity - entity
      Returns:
      list of routes or empty result
    • getRoutesHavingPillars

      public static List<ILogicEntityRoute> getRoutesHavingPillars(IEntity entity)
      Get routes containing pillars
      Parameters:
      entity - result of optimization
      Returns:
      list of routes or empty result
    • findFirstRoute

      public static Optional<ILogicEntityRoute> findFirstRoute(IEntity entity, Optional<String> resourceId, Boolean pillars, Boolean anchors)
      Find any route satisfied by conditions in params
      Parameters:
      entity - result of optimization
      resourceId - if present, look for routes containing this resource ID
      pillars - if true, look for routes containing pillars
      anchors - if true, look for routes containing anchors
      Returns:
      first found route or empty result