Class SegmentFeatureKey

java.lang.Object
com.e1c.langtool.collector.SegmentFeatureKey
All Implemented Interfaces:
FeatureKey, Serializable, Comparable<FeatureKey>

public class SegmentFeatureKey extends Object implements FeatureKey
See Also:
  • Field Details

  • Constructor Details

    • SegmentFeatureKey

      protected SegmentFeatureKey(String... segments)
  • Method Details

    • create

      public static SegmentFeatureKey create(String singleSegment)
      Low-level factory method.
      Parameters:
      singleSegment - the single segment of the newly created feature key
      Throws:
      IllegalArgumentException - if the singleSegment is null
    • create

      public static SegmentFeatureKey create(String... segments)
      Low-level factory method.
      Parameters:
      segments - the segments of the to-be-created feature key. May be null, but may not contain null entries.
      Returns:
      a FeatureKey. Never null.
      Throws:
      IllegalArgumentException - if any of the segments is null
    • create

      public static SegmentFeatureKey create(List<String> segments)
      Low-level factory method.
      Parameters:
      segments - the segments of the to-be-created feature key. May be null, but may not contain null entries.
      Returns:
      a FeatureKey. Never null.
      Throws:
      IllegalArgumentException - if any of the segments is null
    • compareTo

      public int compareTo(FeatureKey key)
      Specified by:
      compareTo in interface Comparable<FeatureKey>
    • compareToIgnoreCase

      public int compareToIgnoreCase(FeatureKey key)
      Description copied from interface: FeatureKey
      Compare to FeatureKey with ignore case of segments.
      Specified by:
      compareToIgnoreCase in interface FeatureKey
      Parameters:
      key - the key to compare
      Returns:
      the result
    • compareTo

      protected int compareTo(FeatureKey key, boolean ignoreCase)
    • getId

      public String getId()
      Description copied from interface: FeatureKey
      Gets the id representing default serializing of the object to string.
      Specified by:
      getId in interface FeatureKey
      Returns:
      the id
    • getSegments

      public List<String> getSegments()
      Description copied from interface: FeatureKey
      Gets the segments.
      Specified by:
      getSegments in interface FeatureKey
      Returns:
      the segments
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: FeatureKey
      Checks if the key is empty, means that segments are empty.
      Specified by:
      isEmpty in interface FeatureKey
      Returns:
      true, if is empty
    • getSegmentCount

      public int getSegmentCount()
      Description copied from interface: FeatureKey
      Gets the segment count.
      Specified by:
      getSegmentCount in interface FeatureKey
      Returns:
      the segment count
    • getSegment

      public String getSegment(int index)
      Description copied from interface: FeatureKey
      Gets the segment.
      Specified by:
      getSegment in interface FeatureKey
      Parameters:
      index - the index
      Returns:
      the segment
    • getLastSegment

      public String getLastSegment()
      Description copied from interface: FeatureKey
      Gets the last segment.
      Specified by:
      getLastSegment in interface FeatureKey
      Returns:
      the last segment
    • getFirstSegment

      public String getFirstSegment()
      Description copied from interface: FeatureKey
      Gets the first segment.
      Specified by:
      getFirstSegment in interface FeatureKey
      Returns:
      the first segment
    • append

      public FeatureKey append(String segment)
      Description copied from interface: FeatureKey
      Append.
      Specified by:
      append in interface FeatureKey
      Parameters:
      segment - the segment
      Returns:
      the new feature key
    • append

      public FeatureKey append(FeatureKey relativeFeatureKey)
      Description copied from interface: FeatureKey
      Append.
      Specified by:
      append in interface FeatureKey
      Parameters:
      relativeFeatureKey - the relative feature key
      Returns:
      the new feature key
    • skipFirst

      public FeatureKey skipFirst(int skipCount)
      Description copied from interface: FeatureKey
      Skip first.
      Specified by:
      skipFirst in interface FeatureKey
      Parameters:
      skipCount - the skip count
      Returns:
      the new feature key
    • skipLast

      public FeatureKey skipLast(int skipCount)
      Description copied from interface: FeatureKey
      Skip last segments
      Specified by:
      skipLast in interface FeatureKey
      Parameters:
      skipCount - the skip count
      Returns:
      the new feature key
    • startsWith

      public boolean startsWith(FeatureKey prefix)
      Description copied from interface: FeatureKey
      Starts with.
      Specified by:
      startsWith in interface FeatureKey
      Parameters:
      prefix - the prefix
      Returns:
      true, if successful
    • startsWithIgnoreCase

      public boolean startsWithIgnoreCase(FeatureKey prefix)
      Description copied from interface: FeatureKey
      Starts with ignore case.
      Specified by:
      startsWithIgnoreCase in interface FeatureKey
      Parameters:
      prefix - the prefix
      Returns:
      true, if successful
    • toLowerCase

      public FeatureKey toLowerCase()
      Description copied from interface: FeatureKey
      To lower case.
      Specified by:
      toLowerCase in interface FeatureKey
      Returns:
      the new feature key
    • toUpperCase

      public FeatureKey toUpperCase()
      Description copied from interface: FeatureKey
      To upper case.
      Specified by:
      toUpperCase in interface FeatureKey
      Returns:
      the new feature key
    • startsWith

      protected boolean startsWith(FeatureKey prefix, boolean ignoreCase)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Returns a canonical String representation of this using '.' as namespace delimiter.
      Overrides:
      toString in class Object
    • toString

      public String toString(String delimiter)
      Returns a String representation of this using delimiter as namespace delimiter.
      Parameters:
      delimiter - the delimiter to use. null will be represented as the String "null".
      Returns:
      the concatenated segments joined with the given delimiter