< prev index next >

modules/javafx.controls/src/main/java/javafx/scene/control/IndexRange.java

Print this page




  54         }
  55 
  56         this.start = start;
  57         this.end = end;
  58     }
  59 
  60     /**
  61      * Creates an instance of IndexRange by copying the values from the
  62      * given IndexRange object.
  63      *
  64      * @param range The IndexRange instance from which to copy the start and end
  65      *      values.
  66      */
  67     public IndexRange(@NamedArg("range") IndexRange range) {
  68         this.start = range.start;
  69         this.end = range.end;
  70     }
  71 
  72     /**
  73      * Returns the start position of the range.

  74      */
  75     public int getStart() {
  76         return start;
  77     }
  78 
  79     /**
  80      * Returns the end position of the range (exclusive).

  81      */
  82     public int getEnd() {
  83         return end;
  84     }
  85 
  86     /**
  87      * Returns the length of the range.

  88      */
  89     public int getLength() {
  90         return end - start;
  91     }
  92 
  93     /**
  94      * Indicates whether some other object is "equal to" this one.
  95      * @param object the reference object with which to compare.
  96      * @return {@code true} if this object is equal to the {@code object} argument; {@code false} otherwise.
  97      */
  98     @Override
  99     public boolean equals(Object object) {
 100         if (object == this) return true;
 101         if (object instanceof IndexRange) {
 102             IndexRange range = (IndexRange)object;
 103             return (start == range.start
 104                 && end == range.end);
 105         }
 106 
 107         return false;




  54         }
  55 
  56         this.start = start;
  57         this.end = end;
  58     }
  59 
  60     /**
  61      * Creates an instance of IndexRange by copying the values from the
  62      * given IndexRange object.
  63      *
  64      * @param range The IndexRange instance from which to copy the start and end
  65      *      values.
  66      */
  67     public IndexRange(@NamedArg("range") IndexRange range) {
  68         this.start = range.start;
  69         this.end = range.end;
  70     }
  71 
  72     /**
  73      * Returns the start position of the range.
  74      * @return the start position of the range
  75      */
  76     public int getStart() {
  77         return start;
  78     }
  79 
  80     /**
  81      * Returns the end position of the range (exclusive).
  82      * @return the end position of the range (exclusive)
  83      */
  84     public int getEnd() {
  85         return end;
  86     }
  87 
  88     /**
  89      * Returns the length of the range.
  90      * @return the length of the range
  91      */
  92     public int getLength() {
  93         return end - start;
  94     }
  95 
  96     /**
  97      * Indicates whether some other object is "equal to" this one.
  98      * @param object the reference object with which to compare.
  99      * @return {@code true} if this object is equal to the {@code object} argument; {@code false} otherwise.
 100      */
 101     @Override
 102     public boolean equals(Object object) {
 103         if (object == this) return true;
 104         if (object instanceof IndexRange) {
 105             IndexRange range = (IndexRange)object;
 106             return (start == range.start
 107                 && end == range.end);
 108         }
 109 
 110         return false;


< prev index next >