Exemplo n.º 1
0
  public void buildRestAfterNight() {
    String ret = all + "*";
    ret += "1+0";
    ret += all + "*";

    full = full.intersection(new RegExp(StringUtils.toCharExp(ret)).toAutomaton().complement());
    full.minimize();
  }
Exemplo n.º 2
0
  public void buildNoMoreThanDayRule() {
    String ret = all + "*";
    for (int i = 0; i < 6; i++) ret += work;
    ret += all + "*";

    full = full.intersection(new RegExp(StringUtils.toCharExp(ret)).toAutomaton().complement());
    full.minimize();
  }
  private Automaton intersect(Automaton automaton, Automaton candidateAutomaton) {
    Automaton intersectedAutomaton = automaton.intersection(candidateAutomaton);

    logger.trace(
        "Automaton states: "
            + intersectedAutomaton.getNumberOfStates()
            + "; transitions: "
            + intersectedAutomaton.getNumberOfTransitions());

    return intersectedAutomaton;
  }
Exemplo n.º 4
0
  public void buildNoNightBeforeFreeWE() {
    String ret = "((";
    for (int i = 0; i < 4; i++) {
      ret += all;
    }
    ret += "122";

    for (int j = 0; j < 3; j++) for (int i = 0; i < 7; i++) ret += all;
    ret += ")|(";

    for (int i = 0; i < 7; i++) ret += all;

    for (int i = 0; i < 4; i++) {
      ret += all;
    }
    ret += "122";

    for (int j = 0; j < 2; j++) for (int i = 0; i < 7; i++) ret += all;
    ret += ")|(";

    for (int j = 0; j < 2; j++) for (int i = 0; i < 7; i++) ret += all;

    for (int i = 0; i < 4; i++) {
      ret += all;
    }
    ret += "122";

    for (int i = 0; i < 7; i++) ret += all;

    ret += ")|(";

    for (int j = 0; j < 3; j++) for (int i = 0; i < 7; i++) ret += all;

    for (int i = 0; i < 4; i++) {
      ret += all;
    }
    ret += "122";
    ret += "))";

    full = full.intersection(new RegExp(StringUtils.toCharExp(ret)).toAutomaton().complement());
    full.minimize();
  }
Exemplo n.º 5
0
  public void buildCompleteWE() {
    StringBuffer b = new StringBuffer("(");
    String patter = "((2(0|1))|((0|1)2))";
    int nd = 2;
    int nw = 4;
    int sd = 6;

    for (int w = 0; w < nw; w++) {
      b.append("(");
      for (int i = 1; i < sd + (7 * w); i++) b.append(all);
      b.append(patter);
      for (int i = (sd + 7 * w) + nd; i <= 28; i++) b.append(all);
      b.append(")|");
    }
    b.deleteCharAt(b.length() - 1).append(")");

    full =
        full.intersection(
            new RegExp(StringUtils.toCharExp(b.toString())).toAutomaton().complement());
    full.minimize();
  }