1 11 package org.eclipse.jdt.internal.compiler.lookup; 12 13 import org.eclipse.jdt.core.compiler.CharOperation; 14 15 public class SignatureWrapper { 16 public char[] signature; 17 public int start; 18 public int end; 19 public int bracket; 20 21 public SignatureWrapper(char[] signature) { 22 this.signature = signature; 23 this.start = 0; 24 this.end = this.bracket = -1; 25 } 26 public boolean atEnd() { 27 return this.start < 0 || this.start >= this.signature.length; 28 } 29 public int computeEnd() { 30 int index = this.start; 31 while (this.signature[index] == '[') 32 index++; 33 switch (this.signature[index]) { 34 case 'L' : 35 case 'T' : 36 this.end = CharOperation.indexOf(';', this.signature, this.start); 37 if (this.bracket <= this.start) this.bracket = CharOperation.indexOf('<', this.signature, this.start); 39 40 if (this.bracket > this.start && this.bracket < this.end) 41 this.end = this.bracket; 42 else if (this.end == -1) 43 this.end = this.signature.length + 1; 44 break; 45 default : 46 this.end = this.start; 47 } 48 49 this.start = this.end + 1; return this.end; 51 } 52 public char[] nextWord() { 53 this.end = CharOperation.indexOf(';', this.signature, this.start); 54 if (this.bracket <= this.start) this.bracket = CharOperation.indexOf('<', this.signature, this.start); 56 int dot = CharOperation.indexOf('.', this.signature, this.start); 57 58 if (this.bracket > this.start && this.bracket < this.end) 59 this.end = this.bracket; 60 if (dot > this.start && dot < this.end) 61 this.end = dot; 62 63 return CharOperation.subarray(this.signature, this.start, this.start = this.end); } 65 public String toString() { 66 return new String (this.signature) + " @ " + this.start; } 68 } 69 | Popular Tags |