Package jflex

Class Interval


  • public final class Interval
    extends java.lang.Object
    An interval of characters with basic operations.
    Version:
    JFlex 1.7.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int end  
      int start  
    • Constructor Summary

      Constructors 
      Constructor Description
      Interval​(int start, int end)
      Construct a new interval from start to end.
      Interval​(Interval other)
      Copy constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(int point)
      Return true iff point is contained in this interval.
      boolean contains​(Interval other)
      Return true iff this interval completely contains the other one.
      Interval copy()
      Make a copy of this interval.
      boolean equals​(java.lang.Object o)
      private static boolean isPrintable​(int c)
      Check whether a character is printable.
      void setEnd​(int end)
      Set a new last character
      void setStart​(int start)
      Set a new first character
      java.lang.String toString()
      Get a String representation of this interval.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • start

        public int start
      • end

        public int end
    • Constructor Detail

      • Interval

        public Interval​(int start,
                        int end)
        Construct a new interval from start to end.
        Parameters:
        start - first character the interval should contain
        end - last character the interval should contain
      • Interval

        public Interval​(Interval other)
        Copy constructor.
        Parameters:
        other - a Interval object.
    • Method Detail

      • contains

        public boolean contains​(int point)
        Return true iff point is contained in this interval.
        Parameters:
        point - the character to check
        Returns:
        whether the codepoint is contained in the interval.
      • contains

        public boolean contains​(Interval other)
        Return true iff this interval completely contains the other one.
        Parameters:
        other - the other interval
        Returns:
        whether this interval completely contains the other one.
      • equals

        public boolean equals​(java.lang.Object o)

        Return true if o is an interval with the same borders.

        Overrides:
        equals in class java.lang.Object
      • setEnd

        public void setEnd​(int end)
        Set a new last character
        Parameters:
        end - the new last character of this interval
      • setStart

        public void setStart​(int start)
        Set a new first character
        Parameters:
        start - the new first character of this interval
      • isPrintable

        private static boolean isPrintable​(int c)
        Check whether a character is printable.
        Parameters:
        c - the character to check
      • toString

        public java.lang.String toString()
        Get a String representation of this interval.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string "[start-end]" or "[start]" (if there is only one character in the interval) where start and end are either a number (the character code) or something of the from 'a'.
      • copy

        public Interval copy()
        Make a copy of this interval.
        Returns:
        the copy