Example #1
0
  public void signOutput(Sign sign, Map map) {
    if (this.args.length <= 4) return;
    int flux;
    if (this.args[3].equalsIgnoreCase("n")) {
      flux = map.getNewSignal();
    } else if (!Utils.isInt(this.args[3])) return;
    else {
      flux = Integer.parseInt(this.args[3]);
    }
    boolean fluxValue;
    if (this.args[4].equalsIgnoreCase("true")
        || this.args[4].equalsIgnoreCase("t")
        || this.args[4].equalsIgnoreCase("on")) fluxValue = true;
    else if (this.args[4].equalsIgnoreCase("false")
        || this.args[4].equalsIgnoreCase("f")
        || this.args[4].equalsIgnoreCase("off")) fluxValue = false;
    else return;

    switch (this.args[2]) {
      case "add":
      case "a":
      case "+":
        this.signAddOutput(sign, map, flux, fluxValue);
        break;
      case "remove":
      case "r":
      case "-":
        this.signRemoveOutput(sign, map, flux, fluxValue);
        break;
    }
  }
Example #2
0
  public void signInput(Sign sign, Map map) {
    if (this.args.length <= 3) return;

    int flux;
    if (this.args[3].equalsIgnoreCase("n")) {
      flux = map.getNewSignal();
    } else if (!Utils.isInt(this.args[3])) return;
    else {
      flux = Integer.parseInt(this.args[3]);
    }

    switch (this.args[2]) {
      case "add":
      case "a":
      case "+":
        this.signAddInput(sign, map, flux);
        break;
      case "remove":
      case "r":
      case "-":
        this.signRemoveInput(sign, map, flux);
        break;
    }
  }