diff options
| author | 2015-01-13 23:25:04 -0500 | |
|---|---|---|
| committer | 2015-01-13 23:25:04 -0500 | |
| commit | 959cb5fd4f9586ec3bd265b452fe25fe1db82e3f (patch) | |
| tree | bdd8a2c52c2fe053ba3460614bde8542e5378dbe /src/cuchaz/enigma/analysis/Token.java | |
| parent | got rid of gradle in favor of ivy+ssjb (diff) | |
| download | enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.tar.gz enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.tar.xz enigma-fork-959cb5fd4f9586ec3bd265b452fe25fe1db82e3f.zip | |
source format change
don't hate me too much if you were planning a big merge. =P
Diffstat (limited to 'src/cuchaz/enigma/analysis/Token.java')
| -rw-r--r-- | src/cuchaz/enigma/analysis/Token.java | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/src/cuchaz/enigma/analysis/Token.java b/src/cuchaz/enigma/analysis/Token.java index 5e70db7..481d2f4 100644 --- a/src/cuchaz/enigma/analysis/Token.java +++ b/src/cuchaz/enigma/analysis/Token.java | |||
| @@ -10,56 +10,47 @@ | |||
| 10 | ******************************************************************************/ | 10 | ******************************************************************************/ |
| 11 | package cuchaz.enigma.analysis; | 11 | package cuchaz.enigma.analysis; |
| 12 | 12 | ||
| 13 | public class Token implements Comparable<Token> | 13 | public class Token implements Comparable<Token> { |
| 14 | { | 14 | |
| 15 | public int start; | 15 | public int start; |
| 16 | public int end; | 16 | public int end; |
| 17 | public String text; | 17 | public String text; |
| 18 | 18 | ||
| 19 | public Token( int start, int end ) | 19 | public Token(int start, int end) { |
| 20 | { | 20 | this(start, end, null); |
| 21 | this( start, end, null ); | ||
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | public Token( int start, int end, String source ) | 23 | public Token(int start, int end, String source) { |
| 25 | { | ||
| 26 | this.start = start; | 24 | this.start = start; |
| 27 | this.end = end; | 25 | this.end = end; |
| 28 | if( source != null ) | 26 | if (source != null) { |
| 29 | { | 27 | this.text = source.substring(start, end); |
| 30 | this.text = source.substring( start, end ); | ||
| 31 | } | 28 | } |
| 32 | } | 29 | } |
| 33 | 30 | ||
| 34 | public boolean contains( int pos ) | 31 | public boolean contains(int pos) { |
| 35 | { | ||
| 36 | return pos >= start && pos <= end; | 32 | return pos >= start && pos <= end; |
| 37 | } | 33 | } |
| 38 | 34 | ||
| 39 | @Override | 35 | @Override |
| 40 | public int compareTo( Token other ) | 36 | public int compareTo(Token other) { |
| 41 | { | ||
| 42 | return start - other.start; | 37 | return start - other.start; |
| 43 | } | 38 | } |
| 44 | 39 | ||
| 45 | @Override | 40 | @Override |
| 46 | public boolean equals( Object other ) | 41 | public boolean equals(Object other) { |
| 47 | { | 42 | if (other instanceof Token) { |
| 48 | if( other instanceof Token ) | 43 | return equals((Token)other); |
| 49 | { | ||
| 50 | return equals( (Token)other ); | ||
| 51 | } | 44 | } |
| 52 | return false; | 45 | return false; |
| 53 | } | 46 | } |
| 54 | 47 | ||
| 55 | public boolean equals( Token other ) | 48 | public boolean equals(Token other) { |
| 56 | { | ||
| 57 | return start == other.start && end == other.end; | 49 | return start == other.start && end == other.end; |
| 58 | } | 50 | } |
| 59 | 51 | ||
| 60 | @Override | 52 | @Override |
| 61 | public String toString( ) | 53 | public String toString() { |
| 62 | { | 54 | return String.format("[%d,%d]", start, end); |
| 63 | return String.format( "[%d,%d]", start, end ); | ||
| 64 | } | 55 | } |
| 65 | } | 56 | } |