use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.
the class VisibleToken method parseNonEmptyToken.
@Override
protected ParseResult parseNonEmptyToken(LoadContext context, EquipmentModifier eqm, String value) {
Visibility vis;
if (value.equals("QUALIFY")) {
vis = Visibility.QUALIFY;
} else if (value.equals("NO")) {
vis = Visibility.HIDDEN;
} else if (value.equals("YES")) {
vis = Visibility.DEFAULT;
} else {
return new ParseResult.Fail("Can't understand Visibility: " + value, context);
}
context.getObjectContext().put(eqm, ObjectKey.VISIBILITY, vis);
return ParseResult.SUCCESS;
}
use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.
the class VisibleToken method unparse.
@Override
public String[] unparse(LoadContext context, AbilityCategory ac) {
Visibility vis = ac.getVisibility();
String visString;
if (vis.equals(Visibility.DEFAULT)) {
visString = "YES";
} else if (vis.equals(Visibility.QUALIFY)) {
visString = "QUALIFY";
} else if (vis.equals(Visibility.HIDDEN)) {
visString = "NO";
} else {
context.addWriteMessage("Visibility " + vis + " is not a valid Visibility for " + ac.getClass().getSimpleName() + " " + ac.getKeyName());
return null;
}
return new String[] { visString };
}
use of pcgen.util.enumeration.Visibility in project pcgen by PCGen.
the class VisibleToken method parseNonEmptyToken.
@Override
protected ParseResult parseNonEmptyToken(LoadContext context, PCTemplate template, String value) {
Visibility vis;
if (value.equals("DISPLAY")) {
vis = Visibility.DISPLAY_ONLY;
} else if (value.equals("EXPORT")) {
vis = Visibility.OUTPUT_ONLY;
} else if (value.equals("NO")) {
vis = Visibility.HIDDEN;
} else if (value.equals("YES")) {
vis = Visibility.DEFAULT;
} else {
return new ParseResult.Fail("Can't understand Visibility: " + value, context);
}
context.getObjectContext().put(template, ObjectKey.VISIBILITY, vis);
return ParseResult.SUCCESS;
}
Aggregations