提交 56fb3686 authored 作者: Thomas Mueller's avatar Thomas Mueller

H2 Console: improved autocomplete feature (also simplified the source code for this feature).

上级 3226f510
...@@ -13,13 +13,6 @@ import java.util.HashMap; ...@@ -13,13 +13,6 @@ import java.util.HashMap;
*/ */
public interface Rule { public interface Rule {
/**
* Get the name of the rule.
*
* @return the name
*/
String name();
/** /**
* Update cross references. * Update cross references.
* *
......
...@@ -33,10 +33,6 @@ public class RuleElement implements Rule { ...@@ -33,10 +33,6 @@ public class RuleElement implements Rule {
visitor.visitRuleElement(keyword, name, link); visitor.visitRuleElement(keyword, name, link);
} }
public String name() {
return name;
}
public void setLinks(HashMap<String, RuleHead> ruleMap) { public void setLinks(HashMap<String, RuleHead> ruleMap) {
if (link != null) { if (link != null) {
link.setLinks(ruleMap); link.setLinks(ruleMap);
...@@ -81,8 +77,4 @@ public class RuleElement implements Rule { ...@@ -81,8 +77,4 @@ public class RuleElement implements Rule {
return link.autoComplete(sentence); return link.autoComplete(sentence);
} }
public String toString() {
return name;
}
} }
...@@ -33,10 +33,6 @@ public class RuleFixed implements Rule { ...@@ -33,10 +33,6 @@ public class RuleFixed implements Rule {
visitor.visitRuleFixed(type); visitor.visitRuleFixed(type);
} }
public String name() {
return "type="+type;
}
public void setLinks(HashMap<String, RuleHead> ruleMap) { public void setLinks(HashMap<String, RuleHead> ruleMap) {
// nothing to do // nothing to do
} }
...@@ -201,8 +197,4 @@ public class RuleFixed implements Rule { ...@@ -201,8 +197,4 @@ public class RuleFixed implements Rule {
return false; return false;
} }
public String toString() {
return name();
}
} }
...@@ -38,10 +38,6 @@ public class RuleList implements Rule { ...@@ -38,10 +38,6 @@ public class RuleList implements Rule {
visitor.visitRuleList(or, list); visitor.visitRuleList(or, list);
} }
public String name() {
return null;
}
public void setLinks(HashMap<String, RuleHead> ruleMap) { public void setLinks(HashMap<String, RuleHead> ruleMap) {
if (!mapSet) { if (!mapSet) {
for (Rule r : list) { for (Rule r : list) {
...@@ -75,8 +71,4 @@ public class RuleList implements Rule { ...@@ -75,8 +71,4 @@ public class RuleList implements Rule {
} }
} }
public String toString() {
return or ? "or: " : "" + list.toString();
}
} }
...@@ -23,10 +23,6 @@ public class RuleOptional implements Rule { ...@@ -23,10 +23,6 @@ public class RuleOptional implements Rule {
visitor.visitRuleOptional(rule); visitor.visitRuleOptional(rule);
} }
public String name() {
return null;
}
public void setLinks(HashMap<String, RuleHead> ruleMap) { public void setLinks(HashMap<String, RuleHead> ruleMap) {
if (!mapSet) { if (!mapSet) {
rule.setLinks(ruleMap); rule.setLinks(ruleMap);
...@@ -41,8 +37,4 @@ public class RuleOptional implements Rule { ...@@ -41,8 +37,4 @@ public class RuleOptional implements Rule {
return true; return true;
} }
public String toString() {
return rule.toString();
}
} }
...@@ -25,10 +25,6 @@ public class RuleRepeat implements Rule { ...@@ -25,10 +25,6 @@ public class RuleRepeat implements Rule {
visitor.visitRuleRepeat(comma, rule); visitor.visitRuleRepeat(comma, rule);
} }
public String name() {
return rule.name();
}
public void setLinks(HashMap<String, RuleHead> ruleMap) { public void setLinks(HashMap<String, RuleHead> ruleMap) {
// rule.setLinks(ruleMap); // rule.setLinks(ruleMap);
} }
...@@ -43,8 +39,4 @@ public class RuleRepeat implements Rule { ...@@ -43,8 +39,4 @@ public class RuleRepeat implements Rule {
return true; return true;
} }
public String toString() {
return rule.toString();
}
} }
...@@ -34,29 +34,6 @@ public class DbContextRule implements Rule { ...@@ -34,29 +34,6 @@ public class DbContextRule implements Rule {
this.type = type; this.type = type;
} }
public String toString() {
switch (type) {
case SCHEMA:
return "schema";
case TABLE:
return "table";
case NEW_TABLE_ALIAS:
return "nt";
case TABLE_ALIAS:
return "t";
case COLUMN_ALIAS:
return "c";
case COLUMN:
return "column";
default:
return "?";
}
}
public String name() {
return null;
}
public void setLinks(HashMap<String, RuleHead> ruleMap) { public void setLinks(HashMap<String, RuleHead> ruleMap) {
// nothing to do // nothing to do
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论