X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/PHPIdentifierLocation.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/PHPIdentifierLocation.java index e3ea468..57886e6 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/PHPIdentifierLocation.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/PHPIdentifierLocation.java @@ -1,38 +1,55 @@ package net.sourceforge.phpeclipse.builder; -import net.sourceforge.phpeclipse.mover.obfuscator.PHPIdentifier; +import net.sourceforge.phpeclipse.obfuscator.PHPIdentifier; /** - * @author khartlage - * + * */ -public class PHPIdentifierLocation extends PHPIdentifier { +public class PHPIdentifierLocation extends PHPIdentifier implements Comparable { + final public static int UNDEFINED_MATCH = 0; + final public static int PATTERN_MATCH = 1; + final public static int EXACT_MATCH = 2; + + private int fMatch; + private String fClassname; + private String fFilename; - private int fOffset; - private int fPHPDocLength; - private int fPHPDocOffset; + + private int fOffset; + + private int fPHPDocLength; + + private int fPHPDocOffset; + + private String fUsage; public PHPIdentifierLocation(String identifier, int type, String filename) { this(identifier, type, filename, null); } - public PHPIdentifierLocation(String identifier, int type, String filename, String classname) { - super(identifier, type); - fFilename = filename; - fClassname = classname; - fOffset = -1; - fPHPDocLength = -1; - fPHPDocOffset = -1; - } - /* (non-Javadoc) + public PHPIdentifierLocation(String identifier, int type, String filename, + String classname) { + super(identifier, type); + fFilename = filename; + fClassname = classname; + fOffset = -1; + fPHPDocLength = -1; + fPHPDocOffset = -1; + fUsage = null; + } + + /* + * (non-Javadoc) + * * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { - if (!(obj instanceof PHPIdentifierLocation)) { - return false; - } - return super.equals(obj)&&fFilename.equals(((PHPIdentifierLocation)obj).fFilename); + if (!(obj instanceof PHPIdentifierLocation)) { + return false; + } + return super.equals(obj) + && fFilename.equals(((PHPIdentifierLocation) obj).fFilename); } /** @@ -71,6 +88,13 @@ public class PHPIdentifierLocation extends PHPIdentifier { } /** + * @return + */ + public String getUsage() { + return fUsage; + } + + /** * @param string */ public void setClassname(String string) { @@ -105,11 +129,58 @@ public class PHPIdentifierLocation extends PHPIdentifier { fPHPDocOffset = i; } - /* (non-Javadoc) + /** + * @param string + */ + public void setUsage(String string) { + fUsage = string; + } + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ public String toString() { - return super.toString()+fFilename; + String result=null; + switch (fMatch) { + case UNDEFINED_MATCH: + result = " ["; + break; + case PATTERN_MATCH: + result = " [pattern include]["; + break; + case EXACT_MATCH: + result = " [exact include]["; + break; + default: + result = ""; + } + return super.toString() + result + fFilename+"]"; } -} + /* (non-Javadoc) + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + public int compareTo(Object o) { + PHPIdentifierLocation i = (PHPIdentifierLocation)o; + if (fMatch>i.fMatch) { + return -1; + } else if (fMatch