MCPcopy Create free account
hub / github.com/PCGen/pcgen / parseMasterLine

Method parseMasterLine

code/src/java/pcgen/io/PCGVer2Parser.java:3054–3134  ·  view source on GitHub ↗
(final String line)

Source from the content-addressed store, hash-verified

3052 }
3053
3054 private void parseMasterLine(final String line)
3055 {
3056 final PCGTokenizer tokens;
3057
3058 try
3059 {
3060 tokens = new PCGTokenizer(line);
3061 }
3062 catch (PCGParseException pcgpex)
3063 {
3064 final String msg = LanguageBundle.getFormattedString("Warnings.PCGenParser.IllegalMaster", //$NON-NLS-1$
3065 line, pcgpex.getMessage());
3066 warnings.add(msg);
3067
3068 return;
3069 }
3070
3071 final Follower aMaster = new Follower(Constants.EMPTY_STRING, Constants.EMPTY_STRING, null);
3072
3073 for (PCGElement element : tokens.getElements())
3074 {
3075 final String tag = element.getName();
3076
3077 if (IOConstants.TAG_MASTER.equals(tag))
3078 {
3079 aMaster.setName(EntityEncoder.decode(element.getText()));
3080 }
3081 else if (IOConstants.TAG_TYPE.equals(tag))
3082 {
3083 String cType = EntityEncoder.decode(element.getText());
3084 CompanionList cList = Globals.getContext().getReferenceContext()
3085 .silentlyGetConstructedCDOMObject(CompanionList.class, cType);
3086 if (cList == null)
3087 {
3088 Logging.errorPrint("Cannot find CompanionList: " + cType);
3089 }
3090 else
3091 {
3092 aMaster.setType(cList);
3093 }
3094 }
3095 else if (IOConstants.TAG_HITDICE.equals(tag))
3096 {
3097 try
3098 {
3099 aMaster.setUsedHD(Integer.parseInt(element.getText()));
3100 }
3101 catch (NumberFormatException nfe)
3102 {
3103 // nothing we can do about it
3104 }
3105 }
3106 else if (IOConstants.TAG_FILE.equals(tag))
3107 {
3108 String inputFileName = EntityEncoder.decode(element.getText());
3109 String masterFileName = makeFilenameAbsolute(inputFileName);
3110 if (masterFileName == null)
3111 {

Callers 1

parseCachedLinesMethod · 0.95

Calls 15

getFormattedStringMethod · 0.95
getElementsMethod · 0.95
setNameMethod · 0.95
decodeMethod · 0.95
getContextMethod · 0.95
errorPrintMethod · 0.95
setTypeMethod · 0.95
setUsedHDMethod · 0.95
makeFilenameAbsoluteMethod · 0.95
setFileNameMethod · 0.95
setAdjustmentMethod · 0.95
getFileNameMethod · 0.95

Tested by

no test coverage detected