com.scudata.dm.query.Token Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esproc Show documentation
Show all versions of esproc Show documentation
SPL(Structured Process Language) A programming language specially for structured data computing.
package com.scudata.dm.query;
public final class Token {
private String id;
private String origin;
private int pos;
private char type;
private StringBuffer spaces;
public Token(char type, String id, int pos, String origin) {
this.type = type;
this.id = id;
this.pos = pos;
this.origin = origin;
this.spaces = new StringBuffer();
}
public boolean isKeyWord() {
return type == Tokenizer.KEYWORD;
}
public int getPos() {
return pos;
}
public void setPos(int pos) {
this.pos = pos;
}
public void setType(char type) {
this.type = type;
}
public char getType() {
return type;
}
public void setString(String str) {
id = str;
}
public void setOriginString(String str) {
origin = str;
}
public String getString() {
return id;
}
public String getOriginString() {
return origin;
}
public String toString() {
return id;
}
public boolean equals(Token other) {
return id.equals(other.id);
}
public boolean equals(String str) {
return id.equals(str);
}
// ?жϱ???ʽ?ڵ??Ƿ???????ҽڵ?
// ??????????????ؼ??ֿ??????ұ???ʽ
public boolean canHaveRightExp() {
if (type == Tokenizer.OPERATOR || type == Tokenizer.DOT) { //type == Tokenizer.TABLEMARK || LEVELMARK
return true;
}
return type == Tokenizer.KEYWORD && Tokenizer.isOperatorKeyWord(id);
}
public boolean isKeyWord(String str) {
return type == Tokenizer.KEYWORD && id.equals(str);
}
public boolean isMergeKeyWord() {
if (type != Tokenizer.KEYWORD) return false;
return id.equals("UNION") || id.equals("INTERSECT") || id.equals("EXCEPT") || id.equals("MINUS");
}
// #L
public String getLevelName() {
return id.substring(1);
}
// @s
public String getTableName() {
return id.substring(1);
}
public String getSpaces() {
return spaces.toString();
}
public void addSpace() {
spaces.append(" ");
}
public void setSpaces(String sps) {
if(sps != null && !sps.isEmpty() && sps.trim().isEmpty()) {
spaces = new StringBuffer(sps);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy