use of pcgen.cdom.helper.ClassSource in project pcgen by PCGen.
the class PCGVer2Parser method getDomainSource.
/**
* Set the source of the domain. See getDomainSource() for details.
* This method should NOT be called outside of file i/o routines!
* @param aSource the source to be set
**/
public ClassSource getDomainSource(String aSource) {
final StringTokenizer aTok = new StringTokenizer(aSource, "|", false);
if (aTok.countTokens() < 2) {
Logging.errorPrint("Invalid Domain Source:" + aSource);
return null;
}
//Throw away "PCClass"
aTok.nextToken();
String classString = aTok.nextToken();
PCClass cl = thePC.getClassKeyed(classString);
if (cl == null) {
Logging.errorPrint("Invalid Class in Domain Source:" + aSource);
return null;
}
ClassSource cs;
if (aTok.hasMoreTokens()) {
int level = Integer.parseInt(aTok.nextToken());
cs = new ClassSource(cl, level);
} else {
cs = new ClassSource(cl);
}
return cs;
}
Aggregations