Package org.jostraca.directive

Examples of org.jostraca.directive.ReplaceDirective


    ps.load( Tools.findRelativeSystemPath( "conf/system.conf" ) );
    TextualTransformManagerTable   ttmt = new TextualTransformManagerTable( ps );

    BasicUnitList bul = new BasicUnitList();

    ReplaceDirective rd = new ReplaceDirective();
    assertEquals( "replace", rd.getName() );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a b ", bul, tahs, ps, ttmt );
    assertEquals( "xbx", ttmt.getTextTTM().transform( "xax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace/first", " a b ", bul, tahs, ps, ttmt );
    assertEquals( "xbxax", ttmt.getTextTTM().transform( "xaxax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace", " b 2 ", bul, tahs, ps, ttmt );
    assertEquals( "x1x2x", ttmt.getTextTTM().transform( "xaxbx" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace",       " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt );
    assertEquals( "x1x2xbx1x", ttmt.getTextTTM().transform( "xaxbxbxax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace",       " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt );
    assertEquals( "12b1", ttmt.getTextTTM().transform( "abba" ) );


    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt );
    assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace/first", " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt );
    assertEquals( "12a", ttmt.getTextTTM().transform( "ababa" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt );
    rd.perform( "replace/first", " bab 2 ", bul, tahs, ps, ttmt );
    assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );

  }
View Full Code Here


    ps.load( Tools.findRelativeSystemPath( "conf/system.conf" ) );
    TextualTransformManagerTable   ttmt = new TextualTransformManagerTable( ps );

    BasicUnitList bul = new BasicUnitList();

    ReplaceDirective rd = new ReplaceDirective();
    assertEquals( "replace", rd.getName() );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a b ", bul, tahs, ps, ttmt, tm );
    assertEquals( "xbx", ttmt.getTextTTM().transform( "xax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace/first", " a b ", bul, tahs, ps, ttmt, tm);
    assertEquals( "xbxax", ttmt.getTextTTM().transform( "xaxax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace", " b 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "x1x2x", ttmt.getTextTTM().transform( "xaxbx" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace",       " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "x1x2xbx1x", ttmt.getTextTTM().transform( "xaxbxbxax" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace",       " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace/first", " b 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "12b1", ttmt.getTextTTM().transform( "abba" ) );


    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace/first", " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace", " bab 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "12a", ttmt.getTextTTM().transform( "ababa" ) );

    ttmt = new TextualTransformManagerTable( ps );
    rd   = new ReplaceDirective();
    rd.perform( "replace", " a 1 ", bul, tahs, ps, ttmt, tm );
    rd.perform( "replace/first", " bab 2 ", bul, tahs, ps, ttmt, tm );
    assertEquals( "121", ttmt.getTextTTM().transform( "ababa" ) );

  }
View Full Code Here

TOP

Related Classes of org.jostraca.directive.ReplaceDirective

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.