/** Constructor. */ public MapCheckerFrame() { super("Strategic Primer Map Checker", Optional.empty(), new Dimension(640, 320)); Warning.Custom.setCustomPrinter( Warning.wrapHandler( str -> printParagraph( str, NullCleaner.assertNotNull(StreamingLabel.LabelTextColor.yellow)))); setBackground(Color.black); setContentPane(new JScrollPane(label)); getContentPane().setBackground(Color.black); }
/** * Create a Meadow, to reduce code duplication between 'field' and 'meadow' cases. * * @param element the tag we're parsing * @param field whether this is a field (meadow otherwise) * @param idNum the ID number parsed or generated * @return the parsed Meadow object. * @throws SPFormatException on SP format problems */ private HarvestableFixture createMeadow( final StartElement element, final boolean field, final int idNum) throws SPFormatException { if (!hasParameter(element, STATUS_PAR)) { warner.warn(new MissingPropertyException(element, STATUS_PAR)); } return new Meadow( getParameter(element, KIND_PAR), field, parseBoolean(getParameter(element, CULTIVATED_PARAM)), idNum, FieldStatus.parse(getParameter(element, STATUS_PAR, FieldStatus.random(idNum).toString()))); }
/** * @param element a tag representing a grove or orchard * @return whether the grove or orchard is cultivated * @throws SPFormatException on SP format problems: use of 'wild' if warnings are fatal, or if * both properties are missing. */ private boolean isCultivated(final StartElement element) throws SPFormatException { if (hasParameter(element, CULTIVATED_PARAM)) { return parseBoolean(getParameter(element, CULTIVATED_PARAM)); } else { if (hasParameter(element, "wild")) { warner.warn(new DeprecatedPropertyException(element, "wild", CULTIVATED_PARAM)); return !parseBoolean(getParameter(element, "wild")); } else { throw new MissingPropertyException(element, CULTIVATED_PARAM); } } }