Class JDFNameRange

java.lang.Object
org.cip4.jdflib.datatypes.JDFRange
org.cip4.jdflib.datatypes.JDFNameRange
All Implemented Interfaces:
JDFBaseDataTypes

public class JDFNameRange extends JDFRange
This class represents a name range (JDFNameRange). It is a whitespace separated list of 2 names separated by a tilde "~", for example "jack ~ john"
  • Constructor Details

    • JDFNameRange

      public JDFNameRange()
      constructor
    • JDFNameRange

      public JDFNameRange(String s)
      constructs a JDFNameRange with the given string
      Parameters:
      s - the given string
      Throws:
      DataFormatException - - if the String has not a valid format
    • JDFNameRange

      public JDFNameRange(String p_left, String p_right)
      constructs a JDFNameRange with two given strings the left and the right name
      Parameters:
      p_left - the given left string
      p_right - the given right string
    • JDFNameRange

      public JDFNameRange(JDFNameRange nr)
      constructs a JDFNameRange with a give JDFNameRange
      Parameters:
      JDFNameRange - nr
  • Method Details

    • toString

      public String toString()
      toString
      Overrides:
      toString in class JDFRange
      Returns:
      String
    • inRange

      public boolean inRange(String x)
      inRange - returns true if (left string >= x <= right string), it is a lexicographical compare
      Parameters:
      x - comparison string
      Returns:
      boolean - true if x in range otherwise false
    • equals

      public boolean equals(Object other)
      equals - returns true if both JDFNameRange are equal otherwise false
      Overrides:
      equals in class JDFRange
      Parameters:
      other - Object to compare
      Returns:
      boolean - true if equal, otherwise false
    • hashCode

      public int hashCode()
      hashCode complements equals() to fulfill the equals/hashCode contract
      Overrides:
      hashCode in class JDFRange
      Returns:
      int
    • getLowerValue

      public String getLowerValue()
      getLowerValue - returns the lower value of the range
      Returns:
      String - the lower value of the range
    • getUpperValue

      public String getUpperValue()
      getUpperValue - return the upper value of the range
      Returns:
      String - the upper value of the range
    • isValid

      protected void isValid(String s)
      isValid - validates the given String
      Parameters:
      s - the given string
      Throws:
      DataFormatException - - if the String has not a valid format
    • getLeft

      public String getLeft()
    • getRight

      public String getRight()
    • isPartOfRange

      public boolean isPartOfRange(JDFRange ra)
      Description copied from class: JDFRange
      isPartOfRange - is range 'ra' within this range?
      Specified by:
      isPartOfRange in class JDFRange
      Parameters:
      ra - the range to test
      Returns:
      boolean - true if range 'r' is within this range, else false
    • getRightObject

      protected Object getRightObject()
      Specified by:
      getRightObject in class JDFRange
    • getLeftObject

      protected Object getLeftObject()
      Specified by:
      getLeftObject in class JDFRange
    • inObjectRange

      protected boolean inObjectRange(Object other)
      Overrides:
      inObjectRange in class JDFRange