Package avrora.core

Examples of avrora.core.Instr$ST


public class STModelAdaptor implements ModelAdaptor {
  @Override
  public Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName)
    throws STNoSuchPropertyException
  {
    ST st = (ST)o;
    return st.getAttribute(propertyName);
  }
View Full Code Here


  public void time2Args(int reps) {
    String templates =
      "t(x,y) ::= \"<x><y>\"\n";
    Misc.writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("t");
    st.add("x", 1);
    st.add("y", 2);

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }
View Full Code Here

    String templates =
      "t(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z) ::=" +
        " \"<a>,<b>,<c>,<d>,<e>,<f>,<g>,<h>,<i>,<j>,<k>,<l>,<m>,<n>,<o>,<p>,<q>,<r>,<s>,<t>,<u>,<v>,<w>,<x>,<y>,<z>\"\n";
    Misc.writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("t");
    st.add("x", 1);
    st.add("y", 2);

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }
View Full Code Here

  public void timeSimplePropsOfArgs(int reps) {
    String templates =
      "t(x) ::= \"<x.id><x.name><x.id><x.name><x.id><x.name>\"\n";
    Misc.writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("t");
    st.add("x", new User(32,"parrt"));

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }
View Full Code Here

    String templates =
      "t(x,y) ::= \"<u()>\"\n"+
      "u() ::= \"<x><y>\"\n";
    Misc.writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("t");
    st.add("x", 1);
    st.add("y", 2);

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }
View Full Code Here

      "u15(a) ::= \"<u16({eh})>\"\n"+
      "u16(a) ::= \"<z({eh})>\"\n"+
      "z(a) ::= \"<x><y>\"\n";
    Misc.writeFile(tmpdir, "t.stg", templates);
    STGroup group = new STGroupFile(tmpdir+"/"+"t.stg");
    ST st = group.getInstanceOf("t");
    st.add("x", 1);
    st.add("y", 2);

    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }
View Full Code Here

  }

  public void timeSingle(int reps) {
    String template =
      "A smallish string to write out";
    ST st = new ST(template);
    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }
View Full Code Here

      st.render();
    }
  }

  public void timeSingleBigger(int reps) {
    ST st = new ST(bigTemplate);
    for (int i = 0; i < reps; i++) {
      st.render();
    }
  }
View Full Code Here

      STGroup group = new STGroup();
//      System.out.println("running "+test);
      group.defineTemplate("t", "x", "<x>");
      group.defineTemplate("u", "x", "<x>");
      group.defineTemplate("test", "x", test.template);
      ST st = group.getInstanceOf("test");
      if ( test.x!=UNDEF ) {
        st.add("x", test.x);
      }
      String result = st.render();
      if ( !result.equals(test.expecting) ) {
        test.result = result;
        failed.add(test);
      }
    }
View Full Code Here


  @Test public void testSeparatorWithNullFirstValue() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("test", "name", "hi <name; separator=\", \">!");
    ST st = group.getInstanceOf("test");
    st.add("name", null); // null is added to list, but ignored in iteration
    st.add("name", "Tom");
    st.add("name", "Sumana");
    String expected = "hi Tom, Sumana!";
    String result = st.render();
    assertEquals(expected, result);
  }
View Full Code Here

TOP

Related Classes of avrora.core.Instr$ST

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.