package journal.reader; import java.text.ParseException; // contains one token // hashes and compares on name and the fact that the token started at the beginning public class Token { public enum Type { START_TOKEN, STRING_TOKEN, INTEGER_TOKEN, HEX_TOKEN, BASE64_TOKEN } private String value; private boolean atLeftMargin; private int column; private int line; private Type type; private ActionType action = null; public Token(int column, int line, boolean atLeftMargin) { this.column = column; this.line = line; this.atLeftMargin = atLeftMargin; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } Token other = (Token) obj; return (value.equals(other.value) && atLeftMargin == other.atLeftMargin); } public int hashCode() { return value.hashCode(); } public String toString() { StringBuffer buf = new StringBuffer("Token : "); buf.append(value); buf.append(" line = "); buf.append(line); buf.append(" col = "); buf.append(column); buf.append(" start = "); buf.append(atLeftMargin); buf.append(" type = "); buf.append(type); return buf.toString(); } public ActionType getAction() { return action; } public void setValue(String value, Type type) throws ParseException { this.value = value; this.type = type; if (type == Type.START_TOKEN) { setActionType(); } else if (atLeftMargin) { throw new ParseException("Illegal token at left margin : " + this, line); } } private void setActionType() throws ParseException { for(ActionType act : ActionType.values()) { if (value.equals(act.symbol)) { action = act; return; } } throw new ParseException("Not a legal StartToken : " + this, line); } public String getValue() { return value; } public boolean isAtLeftMargin() { return atLeftMargin; } public int getColumn() { return column; } public int getLine() { return line; } public Type getType() { return type; } public void setAtLeftMargin(boolean atLeftMargin) { this.atLeftMargin = atLeftMargin; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 23518 | Sven Erik Knop | Upgrade the Tokenizer to deal with Base64 encoded numbers. | ||
#1 | 7589 | Sven Erik Knop | Rescue attempt to recover missing files from the JournalReader | ||
//guest/sven_erik_knop/JournalReader/src/journal/reader/Token.java | |||||
#2 | 7375 | Sven Erik Knop |
Major update of the JournalReader. Complete rewrite of the command line parsing Change in the options parsing within the journal reader New SQLLoader action. Currently only against MySQL (needs MySQL JDBC driver) with fixed database and user name. This will be replaced by a config file at some stage. |
||
#1 | 7374 | Sven Erik Knop | Rename/move file(s) - correct location for Eclipse project | ||
//guest/sven_erik_knop/JournalReader/journal/reader/Token.java | |||||
#1 | 6467 | Sven Erik Knop |
Added JournalReader, a Java library of useful tools to read and process checkpoints and journals. Added are a readme.txt to explain some details, and a jar file that contains the compiled class files. The programs will need Java 1.6 to run. |