Exemplo n.º 1
0
  /**
   * uy.edu.fing.mina.omega.tffst.test 8. it shows determinization of a union
   *
   * @param args
   */
  public static void main(String[] args) {

    Tffst.setMinimizeAlways(false);

    // tffst1
    Tffst tffst1 = new Tffst();

    State s0 = new State();
    tffst1.setInitialState(s0);
    State s1 = new State();
    State s2 = new State();
    s2.setAccept(true);

    SimpleTf tfd = new SimpleTf();
    tfd.setName("D");
    Transition trans1 = new Transition(tfd, tfd, s1, 1);
    s0.addOutTran(trans1);

    SimpleTf tfall = new SimpleTf();
    tfall.setAcceptAll();
    SimpleTf tfc = new SimpleTf();
    tfc.setName("C");
    TfI tfall_c = tfall.and(tfc.not());

    Transition trans2 = new Transition(tfall_c, tfall_c, s1, 1);
    s1.addOutTran(trans2);

    SimpleTf tfk = new SimpleTf();
    tfk.setName("K");
    TfString sec = new TfString(tfc);
    TfString seck = new TfString(tfc);
    seck.add(tfk);
    Transition trans3 = new Transition(sec, seck, s2);
    s1.addOutTran(trans3);

    Utils.showDot(tffst1.toDot("tffst1"));

    tffst1 = tffst1.toSingleLabelTransitions(); // FIXME
    Utils.showDot(tffst1.toDot("tffst1 simple"));

    tffst1.removeInputEpsilonLabel();
    Utils.showDot(tffst1.toDot("tffst1 without epsilons"));

    //      tffst1.removeDeadTransitions();
    //      Utils.showDot(tffst1.toDot("tffst1 without dead transitions"));
  }
Exemplo n.º 2
0
  /**
   * uy.edu.fing.mina.omega.tffst.test 5, is the very example of the Policy 2004's paper.
   *
   * @param args
   */
  public static void main(String[] args) {

    Tffst.setMinimizeAlways(false);

    Tffst tffst1 = new Tffst();

    State s0 = new State();
    tffst1.setInitialState(s0);

    State s1 = new State();

    State s2 = new State();

    State s3 = new State();

    State s4 = new State();
    s4.setAccept(true);

    SimpleTf tf1 = new SimpleTf();
    tf1.setName("A");

    SimpleTf tf2 = new SimpleTf();
    tf2.setName("C");

    SimpleTf tf3 = new SimpleTf();
    tf3.setName("D");

    SimpleTf tf4 = new SimpleTf();
    tf4.setName("E");

    SimpleTf tf5 = new SimpleTf();
    tf5.setName("F");

    SimpleTf tf6 = new SimpleTf();
    tf6.setName("G");

    SimpleTf tf7 = new SimpleTf();
    tf7.setName("I");

    SimpleTf tf8 = new SimpleTf();
    tf8.setName("J");

    Transition trans1 = new Transition(tf1, tf2, s1);
    Transition trans2 = new Transition(tf1, tf3, s2);
    Transition trans3 = new Transition(tf4, tf5, s3);
    Transition trans4 = new Transition(tf6, tf5, s3);
    Transition trans5 = new Transition(tf7, tf8, s4);
    Transition trans6 = new Transition(tf7, tf8, s4);

    s0.addOutTran(trans1);
    s0.addOutTran(trans2);
    s1.addOutTran(trans3);
    s2.addOutTran(trans4);
    s3.addOutTran(trans5);
    s4.addOutTran(trans6);

    Utils.showDot(tffst1.toDot("START"));

    tffst1.setDeterministic(false);
    tffst1.determinize();

    Utils.showDot(tffst1.toDot("FIN"));
  }