summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/analysis/Token.java
diff options
context:
space:
mode:
authorGravatar jeff2014-08-10 01:03:40 -0400
committerGravatar jeff2014-08-10 01:03:40 -0400
commitd24d2b9ad9b5c895020b56f700a72906346482e5 (patch)
treeda360c07209e6e327325db53dbb4df05e77cb7e9 /src/cuchaz/enigma/analysis/Token.java
parentadded sorting for deobfuscated classes (diff)
downloadenigma-fork-d24d2b9ad9b5c895020b56f700a72906346482e5.tar.gz
enigma-fork-d24d2b9ad9b5c895020b56f700a72906346482e5.tar.xz
enigma-fork-d24d2b9ad9b5c895020b56f700a72906346482e5.zip
completely re-wrote token recognizer to bootstrap from Procyon's AST
changed imports to guava instead of whatever collections library happened to be on my classpath
Diffstat (limited to 'src/cuchaz/enigma/analysis/Token.java')
-rw-r--r--src/cuchaz/enigma/analysis/Token.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/analysis/Token.java b/src/cuchaz/enigma/analysis/Token.java
new file mode 100644
index 0000000..74023e3
--- /dev/null
+++ b/src/cuchaz/enigma/analysis/Token.java
@@ -0,0 +1,49 @@
1/*******************************************************************************
2 * Copyright (c) 2014 Jeff Martin.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Public License v3.0
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/gpl.html
7 *
8 * Contributors:
9 * Jeff Martin - initial API and implementation
10 ******************************************************************************/
11package cuchaz.enigma.analysis;
12
13public class Token implements Comparable<Token>
14{
15 public int start;
16 public int end;
17
18 public Token( int start, int end )
19 {
20 this.start = start;
21 this.end = end;
22 }
23
24 public boolean contains( int pos )
25 {
26 return pos >= start && pos <= end;
27 }
28
29 @Override
30 public int compareTo( Token other )
31 {
32 return start - other.start;
33 }
34
35 @Override
36 public boolean equals( Object other )
37 {
38 if( other instanceof Token )
39 {
40 return equals( (Token)other );
41 }
42 return false;
43 }
44
45 public boolean equals( Token other )
46 {
47 return start == other.start && end == other.end;
48 }
49}