Package civquest.parser.ruleset.exception

Examples of civquest.parser.ruleset.exception.RulesetException


      String physUnitString = currSection.getField("StandardUnit").getStringValue();
      PhysicalAmount.PhysicalUnit physUnit
        = PhysicalAmount.PhysicalUnit.fromString(physUnitString);
      if (physUnit == null) {
        throw new RulesetException("While loading resource-definitions: "
                       + physUnitString + " is not a valid "
                       + "unit-identifier! (definitions.ruleset)");
      } else {
        resourceDefinitions.put(name, new ResourceDefinition(name, physUnit));
View Full Code Here


      int tb = titSection.getField("tb").getIntValue();
      turnTimedMode = new BorrowTurnTimedMode(tb);
    } else if (timePerTurnMode.equals(STORE_MODE)) {
      turnTimedMode = new StoreTurnTimedMode();
    } else {
      throw new RulesetException(timePerTurnMode + " is not a valid "
                     + "value for field timePerTurnMode "
                     + "in section " + titSection + " in "
                     + "ruleset " + timeRuleset, "");
    }
  }
View Full Code Here

    if (indentTypeString.equals("Spaces")) {
      indentWithWhat = " ";
    } else if (indentTypeString.equals("Tabs")) {
      indentWithWhat = "\t";
    } else {
      throw new RulesetException("Error when reading indent-type: " + indentTypeString
                     + " is no valid type!");
    }

    indentPerLevel = styleSection.getField("indentPerLevel").getIntValue();
    maxIndentLevels = styleSection.getField("maxIndentLevels").getIntValue();
View Full Code Here

      + "Invalid syntax!  Must be of the form <double-number><space><unit>!";

    String[] parts = amountString.split(" ");
    if (parts.length != 2) {
      // first part is a double number, second is the physical unit, e.g. kg
      throw new RulesetException(errMsg);
    } else {
      double amount;
      try {
        amount = Double.parseDouble(parts[0]);
      } catch (NumberFormatException e) {
        throw new RulesetException(errMsg);
      }
      PhysicalAmount.PhysicalUnit unit
        = PhysicalAmount.PhysicalUnit.fromString(parts[1]);

      if (unit == null) {
        // could not identify unit
        throw new RulesetException(errMsg);
      }
      return new PhysicalAmount(amount, unit);
    }
  }
View Full Code Here

TOP

Related Classes of civquest.parser.ruleset.exception.RulesetException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.