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

Method parseDomainLine

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

Source from the content-addressed store, hash-verified

2081 }
2082
2083 private void parseDomainLine(final String line)
2084 {
2085 final PCGTokenizer tokens;
2086
2087 try
2088 {
2089 tokens = new PCGTokenizer(line);
2090 }
2091 catch (PCGParseException pcgpex)
2092 {
2093 final String msg = LanguageBundle.getFormattedString("Warnings.PCGenParser.IllegalDomain", //$NON-NLS-1$
2094 line, pcgpex.getMessage());
2095 warnings.add(msg);
2096
2097 return;
2098 }
2099
2100 final Iterator<PCGElement> it = tokens.getElements().iterator();
2101
2102 if (it.hasNext())
2103 {
2104 PCGElement element = it.next();
2105
2106 // the first element defines the domain name
2107 final String domainKey = EntityEncoder.decode(element.getText());
2108 final Domain aDomain = Globals.getContext().getReferenceContext()
2109 .silentlyGetConstructedCDOMObject(Domain.class, domainKey);
2110
2111 if ((aDomain == null) && (!Constants.NONE.equals(domainKey)))
2112 {
2113 // TODO
2114 // create Domain object from
2115 // information contained in pcg
2116 // But for now just issue a warning
2117 final String msg =
2118 LanguageBundle.getFormattedString("Warnings.PCGenParser.DomainNotFound", //$NON-NLS-1$
2119 domainKey);
2120 warnings.add(msg);
2121 }
2122 else if (!thePC.hasDomain(aDomain) && (!Constants.NONE.equals(domainKey)))
2123 {
2124 // PC doesn't have the domain, so create a new
2125 // one and add it to the PC domain list
2126 ClassSource source = null;
2127
2128 String fullassoc = null;
2129 while (it.hasNext())
2130 {
2131 element = it.next();
2132 String tag = element.getName();
2133
2134 if (IOConstants.TAG_SOURCE.equals(tag))
2135 {
2136 source = getDomainSource(sourceElementToString(element));
2137 }
2138 else if (IOConstants.TAG_ASSOCIATEDDATA.equals(tag))
2139 {
2140 if (fullassoc != null)

Callers 1

parseCachedLinesMethod · 0.95

Calls 15

getFormattedStringMethod · 0.95
getElementsMethod · 0.95
decodeMethod · 0.95
getTextMethod · 0.95
getContextMethod · 0.95
getNameMethod · 0.95
getDomainSourceMethod · 0.95
sourceElementToStringMethod · 0.95
debugPrintMethod · 0.95
applyDomainMethod · 0.95
parseAddTokenInfoMethod · 0.95
errorPrintLocalisedMethod · 0.95

Tested by

no test coverage detected