1 19 20 package org.netbeans.api.editor.fold; 21 22 35 36 public final class FoldStateChange { 37 38 private static final int COLLAPSED_CHANGED_BIT = 1; 39 40 private static final int START_OFFSET_CHANGED_BIT = 2; 41 42 private static final int END_OFFSET_CHANGED_BIT = 4; 43 44 private static final int DESCRIPTION_CHANGED_BIT = 8; 45 46 47 private Fold fold; 48 49 private int stateChangeBits; 50 51 private int originalStartOffset = -1; 52 53 private int originalEndOffset = -1; 54 55 59 FoldStateChange(Fold fold) { 60 this.fold = fold; 61 } 62 63 66 public Fold getFold() { 67 return fold; 68 } 69 70 77 public boolean isCollapsedChanged() { 78 return ((stateChangeBits & COLLAPSED_CHANGED_BIT) != 0); 79 } 80 81 88 public boolean isStartOffsetChanged() { 89 return ((stateChangeBits & START_OFFSET_CHANGED_BIT) != 0); 90 } 91 92 99 public int getOriginalStartOffset() { 100 return originalStartOffset; 101 } 102 103 110 public boolean isEndOffsetChanged() { 111 return ((stateChangeBits & END_OFFSET_CHANGED_BIT) != 0); 112 } 113 114 121 public int getOriginalEndOffset() { 122 return originalEndOffset; 123 } 124 125 132 public boolean isDescriptionChanged() { 133 return ((stateChangeBits & DESCRIPTION_CHANGED_BIT) != 0); 134 } 135 136 140 void collapsedChanged() { 141 stateChangeBits |= COLLAPSED_CHANGED_BIT; 142 } 143 144 148 void startOffsetChanged(int originalStartOffset) { 149 stateChangeBits |= START_OFFSET_CHANGED_BIT; 150 this.originalStartOffset = originalStartOffset; 151 } 152 153 157 void endOffsetChanged(int originalEndOffset) { 158 stateChangeBits |= END_OFFSET_CHANGED_BIT; 159 this.originalEndOffset = originalEndOffset; 160 } 161 162 166 void descriptionChanged() { 167 stateChangeBits |= DESCRIPTION_CHANGED_BIT; 168 } 169 170 public String toString() { 171 return org.netbeans.modules.editor.fold.FoldUtilitiesImpl.foldStateChangeToString(this); 172 } 173 174 } 175 | Popular Tags |