Class SetHelper

java.lang.Object
org.cip4.jdflib.extensions.BaseXJDFHelper
org.cip4.jdflib.extensions.SetHelper
All Implemented Interfaces:
IMatches

public class SetHelper extends BaseXJDFHelper implements IMatches
  • Field Details

  • Constructor Details

    • SetHelper

      public SetHelper(KElement set)
      Parameters:
      set - the set to help on
  • Method Details

    • getAmountSum

      public double getAmountSum(boolean bGood)
      Parameters:
      bGood - good=true
      Returns:
    • ensureReference

      public void ensureReference(KElement src, String key)
      ensure a reference *FROM* src
      Parameters:
      src -
      key - the reference key in src
    • isSet

      public static boolean isSet(KElement e)
      is the element a set?
      Parameters:
      e -
      Returns:
    • isSet

      public static boolean isSet(String localName)
      is the element name a set?
      Parameters:
      localName -
      Returns:
    • getPartition

      public ResourceHelper getPartition(JDFAttributeMap map)
      Parameters:
      map -
      Returns:
    • getResource

      public ResourceHelper getResource(JDFAttributeMap map)
      Parameters:
      map -
      Returns:
    • getPartition

      public ResourceHelper getPartition(String key, String value)
      Parameters:
      map -
      Returns:
    • getResource

      public ResourceHelper getResource(String key, String value)
      Parameters:
      map -
      Returns:
    • getPartition

      public ResourceHelper getPartition(int index)
      Parameters:
      index -
      Returns:
    • getResource

      public ResourceHelper getResource(int index)
      Parameters:
      index -
      Returns:
    • getCreatePartition

      public ResourceHelper getCreatePartition(JDFAttributeMap map, boolean addRes)
      Parameters:
      map -
      addRes -
      Returns:
    • getCreateResource

      public ResourceHelper getCreateResource(JDFAttributeMap map, boolean addRes)
      Parameters:
      map -
      addRes -
      Returns:
    • getCreateVPartition

      public ResourceHelper getCreateVPartition(VJDFAttributeMap vmap, boolean addRes)
      get an existing partition with at least a matching partmap
      Parameters:
      vmap -
      addRes -
      Returns:
    • getCreateExactPartition

      public ResourceHelper getCreateExactPartition(JDFAttributeMap map, boolean addRes)
      get an existing partition with at least a matching partmap
      Parameters:
      vmap -
      addRes -
      Returns:
    • getExactPartition

      public ResourceHelper getExactPartition(JDFAttributeMap map)
      Parameters:
      map -
      Returns:
    • insertPartitionBefore

      public ResourceHelper insertPartitionBefore(ResourceHelper e, JDFAttributeMap map, boolean addRes)
      Parameters:
      e -
      map -
      addRes -
      Returns:
    • getCreatePartitions

      public Vector<ResourceHelper> getCreatePartitions(VJDFAttributeMap vmap, boolean addRes)
      creates 1 partition for each entry in the map
      Parameters:
      vmap -
      addRes -
      Returns:
    • getCreatePartition

      public ResourceHelper getCreatePartition(int index, boolean addRes)
      Parameters:
      index -
      addRes -
      Returns:
    • getCreateResource

      public ResourceHelper getCreateResource()
    • getCreateResource

      public ResourceHelper getCreateResource(int index, boolean addRes)
      Parameters:
      index -
      addRes -
      Returns:
    • removePartitions

      public void removePartitions()
      remove all partitions in this set
    • appendResource

      public ResourceHelper appendResource(String partKey, String partValue, boolean addRes)
      Parameters:
      partKey -
      partValue -
      addRes -
      Returns:
    • appendPartition

      public ResourceHelper appendPartition(String partKey, String partValue, boolean addRes)
      Parameters:
      partKey -
      partValue -
      addRes -
      Returns:
    • getCreatePartition

      public ResourceHelper getCreatePartition(String partKey, String partValue, boolean addRes)
      Parameters:
      partKey -
      partValue -
      addRes -
      Returns:
    • appendResource

      public ResourceHelper appendResource(JDFAttributeMap partMap, boolean addRes)
      Parameters:
      partMap -
      addRes - if true, also add the detailed resource element, e.g. Layout
      Returns:
    • appendPartition

      public ResourceHelper appendPartition(JDFAttributeMap partMap, boolean addRes)
      Parameters:
      partMap -
      addRes - if true, also add the detailed resource element, e.g. Layout
      Returns:
    • appendResource

      public ResourceHelper appendResource(VJDFAttributeMap partMaps, boolean addRes)
      Parameters:
      partMap -
      addRes - if true, also add the detailed resource element, e.g. Layout
      Returns:
    • getXJDF

      public XJDFHelper getXJDF()
      Returns:
    • getPartitions

      public Vector<ResourceHelper> getPartitions()
      Returns:
      the vector of partition helpers
    • getPartitionList

      public List<ResourceHelper> getPartitionList()
      Returns:
      the list of partition helpers - never null
    • getResourceList

      public List<ResourceHelper> getResourceList()
      Returns:
      the list of partition helpers - never null
    • cleanUp

      public void cleanUp()
      Description copied from class: BaseXJDFHelper
      generic cleanup routine
      Overrides:
      cleanUp in class BaseXJDFHelper
    • getName

      public String getName()
      Returns:
      the name of the resource set also fixes it in case it needs to be calculated from kids
    • getPartitionName

      public String getPartitionName()
      Returns:
    • getSetName

      public static String getSetName(KElement e)
      Parameters:
      e - the element to test
      Returns:
      the asset type name (Parameter, Resource etc)
    • getResourceName

      public static String getResourceName(KElement e)
      Parameters:
      e - the element to test
      Returns:
      then resourceset @Name (RunList, Layout etc)
    • getSetName

      public static String getSetName(String setName)
      Parameters:
      setName - the name of the set element
      Returns:
      then asset type name (Parameter, Resource etc)
    • getSet

      public static SetHelper getSet(KElement parent, String name, JDFResourceLink.EnumUsage usage, String processUsage, JDFIntegerList cpi)
      Parameters:
      name -
      usage -
      processUsage -
      Returns:
      the SetHelper for the vector of resourcesets
    • getSet

      public static SetHelper getSet(KElement parent, String name, JDFResourceLink.EnumUsage usage, String processUsage, JDFIntegerList cpi, boolean explicitCPI)
      Parameters:
      name -
      usage -
      processUsage -
      explicitCPI - TODO
      Returns:
      the SetHelper for the vector of resourcesets
    • getSet

      public static SetHelper getSet(KElement parent, String name, JDFResourceLink.EnumUsage usage)
      Parameters:
      name -
      usage -
      Returns:
      the SetHelper for the vector of resourcesets
    • getCreateSet

      public static SetHelper getCreateSet(KElement parent, String name, JDFResourceLink.EnumUsage usage)
      Parameters:
      name -
      usage -
      Returns:
      a new set element
    • getCreateSet

      public static SetHelper getCreateSet(KElement parent, String name, JDFResourceLink.EnumUsage usage, String processUsage, JDFIntegerList cpi)
      Parameters:
      name -
      usage -
      processUsage -
      Returns:
      the SetHelper
    • getCreateSet

      public static SetHelper getCreateSet(KElement parent, String name, JDFResourceLink.EnumUsage usage, String processUsage, JDFIntegerList cpi, boolean explicitCPI)
      Parameters:
      name -
      usage -
      processUsage -
      explicitCPI - TODO
      Returns:
      the SetHelper
    • appendSet

      public static SetHelper appendSet(KElement parent, String name, JDFResourceLink.EnumUsage usage)
      Parameters:
      family - - always RESOURCE better use appendResourceSet
      name -
      usage -
      Returns:
      a new set element
    • getPartition

      public ResourceHelper getPartition(VJDFAttributeMap vmap)
      Parameters:
      vmap -
      Returns:
    • getPartitions

      public Vector<ResourceHelper> getPartitions(VJDFAttributeMap vmap)
      Parameters:
      vmap -
      Returns:
    • getPartitions

      public Vector<ResourceHelper> getPartitions(JDFAttributeMap map)
      Parameters:
      map -
      Returns:
    • getSuperPartitions

      public Vector<ResourceHelper> getSuperPartitions(JDFAttributeMap map)
      returns all partitions that are a superset of map
      Parameters:
      map -
      Returns:
    • getSet

      public KElement getSet()
      Returns:
    • setUsage

      public void setUsage(JDFResourceLink.EnumUsage value)
      Parameters:
      value -
    • getUsage

      public JDFResourceLink.EnumUsage getUsage()
      Returns:
    • getProcessUsage

      public String getProcessUsage()
      Returns:
    • getCombinedProcessIndex

      public JDFIntegerList getCombinedProcessIndex()
      Returns:
    • removeTypeFromCPI

      public void removeTypeFromCPI(int pos)
      remove a CPI process
      Parameters:
      typ -
      pos -
    • addTypeToCPI

      public void addTypeToCPI(int pos)
    • addTypeToCPI

      public void addTypeToCPI(int pos, boolean insert)
      add a CPI process
      Parameters:
      typ -
      pos -
    • addCPI

      public void addCPI(int pos, boolean insert)
      add a CPI process
      Parameters:
      typ -
      pos -
    • setCombinedProcessIndex

      public void setCombinedProcessIndex(JDFIntegerList cpi)
    • setProcessUsage

      public void setProcessUsage(String processUsage)
    • setUnit

      public void setUnit(JDFElement.eUnit unit)
    • getUnit

      public JDFElement.eUnit getUnit()
      Returns:
    • getDescriptiveName

      public String getDescriptiveName()
      Overrides:
      getDescriptiveName in class BaseXJDFHelper
      Returns:
    • getExternalID

      public String getExternalID()
      Overrides:
      getExternalID in class BaseXJDFHelper
      Returns:
      the productID of the product
    • toString

      public String toString()
      Overrides:
      toString in class BaseXJDFHelper
      Returns:
      See Also:
    • getPartition

      public ResourceHelper getPartition(String id)
      get a partition by id
      Parameters:
      id -
      Returns:
    • getFamily

      public SetHelper.EnumFamily getFamily()
      Returns:
    • setID

      public void setID(String newID)
      Overrides:
      setID in class BaseXJDFHelper
      See Also:
    • getPartMapVector

      public VJDFAttributeMap getPartMapVector()
      returns the unified partmaps
      Returns:
    • getPartMapList

      public List<JDFAttributeMap> getPartMapList()
      returns the unified partmaps
      Returns:
    • getPartMapVectors

      public Collection<VJDFAttributeMap> getPartMapVectors()
      Returns:
      the ordered collection of PartMapVectors of each child resource
    • getPartMapLists

      public Collection<List<JDFAttributeMap>> getPartMapLists()
      Returns:
      the ordered collection of PartMapVectors of each child resource
    • getDependentJobParts

      public VString getDependentJobParts()
      Returns:
    • setName

      public void setName(String name)
      Parameters:
      name -
    • removeIDs

      public void removeIDs()
    • indexOf

      public int indexOf(ResourceHelper bsHelper)
      Parameters:
      bsHelper -
      Returns:
    • getHelper

      public static SetHelper getHelper(KElement e)
      factory to create a helper from an element
      Parameters:
      root - the element to parse
      Returns:
      the helper
    • setExternalID

      public void setExternalID(String newID)
      See Also:
      • BaseXJDFHelper.setExternalID(java.lang.String)
    • setDescriptiveName

      public void setDescriptiveName(String description)
      See Also:
      • BaseXJDFHelper.setDescriptiveName(java.lang.String)
    • setGeneralID

      public JDFGeneralID setGeneralID(String idUsage, String idValue)
      See Also:
      • BaseXJDFHelper.setGeneralID(java.lang.String, java.lang.String)
    • matches

      public boolean matches(Object subset)
      Description copied from interface: IMatches
      returns true if subset somehow matches this the semantics are defined by the filtering algorithm, thus it could be a filter or a subset i.e. subset contains either equivalent elements or null and no non-matching elements matches(null) always returns true
      Specified by:
      matches in interface IMatches
      Parameters:
      subset - the object to filter against
      Returns:
      true if it matches
    • size

      public int size()
      the number of partitions (resource elements)
      Returns:
    • isEmpty

      public boolean isEmpty()