jdk/src/java.desktop/share/classes/javax/swing/text/GapContent.java
changeset 26037 508779ce6619
parent 26004 7507a1b93f67
parent 25859 3317bb8137f4
child 28976 8c912c147654
equal deleted inserted replaced
25992:e9b05e933ddd 26037:508779ce6619
   278          * Fetch the location in the contiguous sequence
   278          * Fetch the location in the contiguous sequence
   279          * being modeled.  The index in the gap array
   279          * being modeled.  The index in the gap array
   280          * is held by the mark, so it is adjusted according
   280          * is held by the mark, so it is adjusted according
   281          * to it's relationship to the gap.
   281          * to it's relationship to the gap.
   282          */
   282          */
   283         public final int getOffset() {
   283         public int getOffset() {
   284             int g0 = getGapStart();
   284             int g0 = getGapStart();
   285             int g1 = getGapEnd();
   285             int g1 = getGapEnd();
   286             int offs = (index < g0) ? index : index - (g1 - g0);
   286             int offs = (index < g0) ? index : index - (g1 - g0);
   287             return Math.max(offs, 0);
   287             return Math.max(offs, 0);
   288         }
   288         }
   300 
   300 
   301         void setMark(MarkData mark) {
   301         void setMark(MarkData mark) {
   302             this.mark = mark;
   302             this.mark = mark;
   303         }
   303         }
   304 
   304 
   305         public final int getOffset() {
   305         public int getOffset() {
   306             return mark.getOffset();
   306             return mark.getOffset();
   307         }
   307         }
   308 
   308 
   309         public String toString() {
   309         public String toString() {
   310             return Integer.toString(getOffset());
   310             return Integer.toString(getOffset());