1 19 20 package org.netbeans.lib.lexer.inc; 21 22 import java.util.List ; 23 import org.netbeans.api.lexer.TokenChange; 24 import org.netbeans.api.lexer.TokenId; 25 import org.netbeans.lib.lexer.LAState; 26 import org.netbeans.lib.lexer.LexerApiPackageAccessor; 27 import org.netbeans.lib.lexer.TokenList; 28 import org.netbeans.lib.lexer.token.AbstractToken; 29 30 40 41 public final class TokenChangeInfo<T extends TokenId> { 42 43 private static final TokenChange<? extends TokenId>[] EMPTY_EMBEDDED_CHANGES 44 = (TokenChange<? extends TokenId>[])new TokenChange[0]; 45 46 private TokenChange<? extends TokenId>[] embeddedChanges = EMPTY_EMBEDDED_CHANGES; 47 48 private final TokenList<T> currentTokenList; 49 50 private RemovedTokenList<T> removedTokenList; 51 52 private int addedTokenCount; 53 54 private int index; 55 56 private int offset; 57 58 59 public TokenChangeInfo(TokenList<T> currentTokenList) { 60 this.currentTokenList = currentTokenList; 61 } 62 63 public TokenChange<? extends TokenId>[] embeddedChanges() { 64 return embeddedChanges; 65 } 66 67 public void addEmbeddedChange(TokenChangeInfo<? extends TokenId> change) { 68 TokenChange<? extends TokenId>[] tmp = (TokenChange<? extends TokenId>[]) 69 new TokenChange[embeddedChanges.length + 1]; 70 System.arraycopy(embeddedChanges, 0, tmp, 0, embeddedChanges.length); 71 tmp[embeddedChanges.length] = LexerApiPackageAccessor.get().createTokenChange(change); 72 embeddedChanges = tmp; 73 } 74 75 public int index() { 76 return index; 77 } 78 79 public void setIndex(int index) { 80 this.index = index; 81 } 82 83 public int offset() { 84 return offset; 85 } 86 87 public void setOffset(int offset) { 88 this.offset = offset; 89 } 90 91 public RemovedTokenList<T> removedTokenList() { 92 return removedTokenList; 93 } 94 95 public void setRemovedTokenList(RemovedTokenList<T> removedTokenList) { 96 this.removedTokenList = removedTokenList; 97 } 98 99 public int addedTokenCount() { 100 return addedTokenCount; 101 } 102 103 public void setAddedTokenCount(int addedTokenCount) { 104 this.addedTokenCount = addedTokenCount; 105 } 106 107 public TokenList<T> currentTokenList() { 108 return currentTokenList; 109 } 110 111 } | Popular Tags |