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

Method parseClassLine

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

Source from the content-addressed store, hash-verified

1850 * ###############################################################
1851 */
1852 private void parseClassLine(final String line) throws PCGParseException
1853 {
1854 final PCGTokenizer tokens;
1855
1856 try
1857 {
1858 tokens = new PCGTokenizer(line);
1859 }
1860 catch (PCGParseException pcgpex)
1861 {
1862 /*
1863 * Classes are critical for characters,
1864 * need to stop the load process
1865 *
1866 * Thomas Behr 14-08-02
1867 */
1868 throw new PCGParseException("parseClassLine", line, pcgpex.getMessage(), pcgpex); //$NON-NLS-1$
1869 }
1870
1871 PCClass aPCClass = null;
1872 String tag;
1873 PCGElement element;
1874
1875 final Iterator<PCGElement> it = tokens.getElements().iterator();
1876
1877 // the first element defines the class key name!!!
1878 if (it.hasNext())
1879 {
1880 element = it.next();
1881
1882 String classKey = EntityEncoder.decode(element.getText());
1883 // First check for an existing class, say from a racial casting ability
1884 aPCClass = thePC.getClassKeyed(classKey);
1885 if (aPCClass == null)
1886 {
1887 aPCClass = Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(PCClass.class,
1888 classKey);
1889
1890 if (aPCClass != null)
1891 {
1892 // Icky: Need to redesign the way classes work!
1893 // Icky: Having to clone the class here is UGLY!
1894 aPCClass = aPCClass.clone();
1895 }
1896 else
1897 {
1898 final String msg =
1899 LanguageBundle.getFormattedString(
1900 "Warnings.PCGenParser.CouldntAddClass", //$NON-NLS-1$
1901 element.getText());
1902 warnings.add(msg);
1903
1904 return;
1905 }
1906 }
1907 }
1908
1909 int level = -1;

Callers 1

parseCachedLinesMethod · 0.95

Calls 15

getElementsMethod · 0.95
decodeMethod · 0.95
getTextMethod · 0.95
getContextMethod · 0.95
cloneMethod · 0.95
getFormattedStringMethod · 0.95
getNameMethod · 0.95
getSubClassKeyedMethod · 0.95
debugPrintMethod · 0.95
setTypeMethod · 0.95
addValueMethod · 0.95
setSubClassKeyMethod · 0.95

Tested by

no test coverage detected