Class JDFXYPairRangeList

java.lang.Object
org.cip4.jdflib.datatypes.JDFRangeList
org.cip4.jdflib.datatypes.JDFXYPairRangeList
All Implemented Interfaces:
JDFBaseDataTypes

public class JDFXYPairRangeList extends JDFRangeList
This class is a representation of a xy pair range list (JDFXYPairRangeList). It is a whitespace separated list of xy pair ranges, for example "1 2~5 8 10.25 10.25~44.55 55.34"
  • Constructor Details

    • JDFXYPairRangeList

      public JDFXYPairRangeList()
      constructs an empty range list
    • JDFXYPairRangeList

      public JDFXYPairRangeList(JDFXYPairRangeList rl)
      copy constructor
      constructs a JDFXYPairRangeList with the given JDFXYPairRangeList
      Parameters:
      rl - the JDFXYPairRangeList to copy
    • JDFXYPairRangeList

      public JDFXYPairRangeList(JDFXYPairRange r)
      constructs a JDFXYPairRangeList with the given JDFXYPairRange
      Parameters:
      r - the given JDFXYPairRange
    • JDFXYPairRangeList

      public JDFXYPairRangeList(String s) throws DataFormatException
      constructs a JDFXYPairRangeList with values from a given string
      Parameters:
      s - the given string
      Throws:
      DataFormatException - - if the String has not a valid format
  • Method Details

    • createXYPairRangeList

      public static JDFXYPairRangeList createXYPairRangeList(String s)
      factory for JDFXYPairRangeList that silently returns null in case of illegal strings
      Parameters:
      s - the string to parse
      Returns:
      the JDFXYPairRangeList, null if s is not compatible
    • inRange

      public boolean inRange(JDFXYPair x)
      inRange - returns true if the given JDFXYPair value is in one of the ranges of this range list
      Parameters:
      x - the given double value to compare
      Returns:
      boolean - true if in range otherwise false
    • setString

      public void setString(String s) throws DataFormatException
      setString
      Parse the string and set the single ranges or pairs and put them into a vector.
      The first and the last positions in the vector are special, because they contain only a half range: the first can start with a pair and the last can end with a pair. The elements in the middle (position 2 - (n-1)) start and end with a half range, but can have pairs in the middle.

      For example, if the string looks like this: * "1 2 ~ 4 5 6 7 ~ 8 9 10 11 ~ 1 1"
      it is the representation of 3 ranges:
      range 1: "1 2 ~ 4 5", range 2: "6 7 ~ 8 9" and range 3: "10 11 ~ 1 1"

      Parameters:
      s - the given string to cut in seperate xy pair ranges
      Throws:
      DataFormatException
    • isValid

      public boolean isValid(String s)
      isValid - validate the given String
      Parameters:
      s - the given string
      Returns:
      boolean - false if the String has not a valid format
    • append

      public void append(JDFXYPairRange r)
      append - appends a JDFXYPairRange to this number range
      Parameters:
      r - the JDFXYPairRange range to append
    • append

      public void append(JDFXYPair xMin, JDFXYPair xMax)
      append - appends a new range to the range list
      Parameters:
      xMin - the min value of the new range
      xMax - the max value of the new range
    • append

      public void append(JDFXYPair x)
      append - appends a new range to the range list, based on a single JDFXYPair
      Parameters:
      x - both the min and the max value of the new range
    • isOrdered

      public boolean isOrdered()
      isOrdered - tests if 'this' is OrderedRangeList
      Specified by:
      isOrdered in class JDFRangeList
      Returns:
      boolean - true if 'this' is a OrdneredRangeList
    • isUniqueOrdered

      public boolean isUniqueOrdered()
      isUniqueOrdered - tests if 'this' is UniqueOrdered RangeList
      Specified by:
      isUniqueOrdered in class JDFRangeList
      Returns:
      boolean - true if 'this' is UniqueOrdered RangeList