use of pcgen.cdom.content.DatasetVariable in project pcgen by PCGen.
the class VariableLoader method parseLine.
public final void parseLine(LoadContext context, String lstLine, SourceEntry source) throws PersistenceLayerException {
final StringTokenizer colToken = new StringTokenizer(lstLine, SystemLoader.TAB_DELIM);
//Need the IF so that it is not an empty line causing issues
if (colToken.hasMoreTokens()) {
String tok = colToken.nextToken().intern();
if (tok.indexOf(':') == -1) {
tok = "GLOBAL:" + tok;
}
DatasetVariable po = new DatasetVariable();
boolean success = LstUtils.processToken(context, po, source, tok);
if (!success) {
Logging.errorPrint("Failed to parse first token on Variable Line: " + "ignoring rest of line");
return;
}
po.setSourceURI(source.getURI());
while (colToken.hasMoreTokens()) {
LstUtils.processToken(context, po, source, colToken.nextToken());
}
}
}
use of pcgen.cdom.content.DatasetVariable in project pcgen by PCGen.
the class ExplanationTokenTest method testDisplayNameRequired.
@Test
public void testDisplayNameRequired() throws PersistenceLayerException {
DatasetVariable dv = new DatasetVariable();
ParseResult pr = token.parseToken(primaryContext, dv, "Try Me!");
assertFalse(pr.passed());
assertNoSideEffects();
}
use of pcgen.cdom.content.DatasetVariable in project pcgen by PCGen.
the class GlobalTokenTest method testDisplayNameProhibited.
@Test
public void testDisplayNameProhibited() throws PersistenceLayerException {
DatasetVariable dv = new DatasetVariable();
dv.setName("FirstName");
ParseResult pr = token.parseToken(primaryContext, dv, "VarName");
assertFalse(pr.passed());
assertNoSideEffects();
}
use of pcgen.cdom.content.DatasetVariable in project pcgen by PCGen.
the class LocalTokenTest method testInvalidDupeVarName.
@Test
public void testInvalidDupeVarName() throws PersistenceLayerException {
DatasetVariable dv = new DatasetVariable();
ParseResult pr = token.parseToken(primaryContext, dv, "EQUIPMENT|MyVar");
assertTrue(pr.passed());
assertFalse(parse("EQUIPMENT|STRING=MyVar"));
assertNoSideEffects();
}
use of pcgen.cdom.content.DatasetVariable in project pcgen by PCGen.
the class LocalTokenTest method testDisplayNameProhibited.
@Test
public void testDisplayNameProhibited() throws PersistenceLayerException {
DatasetVariable dv = new DatasetVariable();
dv.setName("FirstName");
ParseResult pr = token.parseToken(primaryContext, dv, "VarName");
assertFalse(pr.passed());
assertNoSideEffects();
}
Aggregations