Commit bc8e378a authored by Alexandru Dura's avatar Alexandru Dura
Browse files

Add missing files for ItemLabel and SymbolLabel

parent dfa18a96
package se.lth.sep;
public class ItemLabel extends NodeLabel {
final DottedRule item;
public ItemLabel(DottedRule item, int start, int end) {
super(start, end);
this.item = item;
}
@Override public boolean equals(Object other) {
if (!super.equals(other))
return false;
return (other instanceof ItemLabel) &&
item.equals(((ItemLabel)other).item);
}
@Override public int hashCode() {
return super.hashCode() * 31 + item.hashCode();
}
public String prettyPrint(Grammar info) {
return item.prettyPrint(info) + ", " + super.start + ", " + super.end;
}
public DottedRule getDottedRule() {
return item;
}
}
package se.lth.sep;
public class SymbolLabel extends NodeLabel {
int symbol;
public SymbolLabel(int symbol, int start, int end) {
super(start, end);
this.symbol = symbol;
}
@Override public boolean equals(Object other) {
if (!super.equals(other))
return false;
return (other instanceof SymbolLabel) &&
((SymbolLabel)other).symbol == symbol;
}
@Override public int hashCode() {
return super.hashCode() * 31 + symbol;
}
public String prettyPrint(Grammar info) {
return info.getCategory(symbol).toString() + ", " + super.start + ", " + super.end;
}
public int getSymbol(Grammar info) {
return symbol;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment