|
|
@@ -1,13 +1,12 @@
|
|
|
package de.jplag;
|
|
|
|
|
|
-import java.io.Serializable;
|
|
|
-
|
|
|
-abstract public class Token implements TokenConstants, Serializable {
|
|
|
- private static final long serialVersionUID = 862935679966383302L;
|
|
|
+abstract public class Token {
|
|
|
public int type;
|
|
|
public String file;
|
|
|
|
|
|
- protected boolean marked;
|
|
|
+ protected int line, column, length;
|
|
|
+
|
|
|
+ protected boolean marked; // TODO TS: Why protected/no accessors?
|
|
|
protected boolean basecode = false;
|
|
|
protected int hash = -1;// hash-value. set and used by main algorithm (GSTiling)
|
|
|
|
|
|
@@ -23,20 +22,28 @@ abstract public class Token implements TokenConstants, Serializable {
|
|
|
setLength(length);
|
|
|
}
|
|
|
|
|
|
- // abstract members
|
|
|
- abstract public int getLine();
|
|
|
+ public int getLine() {
|
|
|
+ return line;
|
|
|
+ }
|
|
|
|
|
|
- abstract public int getColumn();
|
|
|
+ public int getColumn() {
|
|
|
+ return column;
|
|
|
+ }
|
|
|
|
|
|
- abstract public int getLength();
|
|
|
+ public int getLength() {
|
|
|
+ return length;
|
|
|
+ }
|
|
|
|
|
|
- protected void setLine(int line) {
|
|
|
+ public void setLine(int line) {
|
|
|
+ this.line = line;
|
|
|
}
|
|
|
|
|
|
- protected void setColumn(int line) {
|
|
|
+ public void setColumn(int column) {
|
|
|
+ this.column = column;
|
|
|
}
|
|
|
|
|
|
- protected void setLength(int line) {
|
|
|
+ public void setLength(int length) {
|
|
|
+ this.length = length;
|
|
|
}
|
|
|
|
|
|
// this is made to distinguish the character front end. Maybe other front ends can use it too?
|
|
|
@@ -44,12 +51,10 @@ abstract public class Token implements TokenConstants, Serializable {
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- public static String type2string(int type) {
|
|
|
- return "<abstract>";
|
|
|
- }
|
|
|
+ protected abstract String type2string();
|
|
|
|
|
|
@Override
|
|
|
public String toString() {
|
|
|
- return type2string(type);
|
|
|
+ return type2string();
|
|
|
}
|
|
|
}
|