Examples of Interpreter


Examples of bsh.Interpreter

            expanderContext = StringUtil.HtmlEncodingMapWrapper.getHtmlEncodingMapWrapper(context, simpleEncoder);
        }

        try {
            // use the same Interpreter (ie with the same context setup) for all evals
            Interpreter bsh = this.getBshInterpreter(context);
            for (AltTarget altTarget: this.altTargets) {
                Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altTarget.useWhen));
                boolean condTrue = false;
                // retVal should be a Boolean, if not something weird is up...
                if (retVal instanceof Boolean) {
                    Boolean boolVal = (Boolean) retVal;
                    condTrue = boolVal.booleanValue();
View Full Code Here

Examples of bsh.Interpreter

    public void resetBshInterpreter(Map<String, Object> context) {
        context.remove("bshInterpreter");
    }

    public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError {
        Interpreter bsh = (Interpreter) context.get("bshInterpreter");
        if (bsh == null) {
            bsh = BshUtil.makeInterpreter(context);
            context.put("bshInterpreter", bsh);
        }
        return bsh;
View Full Code Here

Examples of bsh.Interpreter

     */
    public String getStyleAltRowStyle(Map<String, Object> context) {
        String styles = "";
        try {
            // use the same Interpreter (ie with the same context setup) for all evals
            Interpreter bsh = this.getBshInterpreter(context);
            for (AltRowStyle altRowStyle : this.altRowStyles) {
                Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altRowStyle.useWhen));
                // retVal should be a Boolean, if not something weird is up...
                if (retVal instanceof Boolean) {
                    Boolean boolVal = (Boolean) retVal;
                    if (boolVal.booleanValue()) {
                        styles += altRowStyle.style;
View Full Code Here

Examples of bsh.Interpreter

 
  public BeanShellAssertion()
  {
    String init="";
    try{
      bshInterpreter = new Interpreter();
      init = JMeterUtils.getPropDefault(INIT_FILE,null);
      if (init != null)
      {
        try
        {
View Full Code Here

Examples of bsh.Interpreter

 
  public BeanShellSampler()
  {
    String init="";
    try{
      bshInterpreter = new Interpreter();
      init = JMeterUtils.getPropDefault(INIT_FILE,null);
      if (init != null)
      {
        try
        {
View Full Code Here

Examples of bsh.Interpreter

        code=new String(buf);

        // create interpreter just-in-time
        if(interpreter == null) {
            interpreter=new Interpreter();

                if(log.isInfoEnabled()) log.info("beanshell interpreter was created");
            try {
                interpreter.set("bsh_prot", this);
View Full Code Here

Examples of bsh.Interpreter

    public static void main(String[] args) throws Exception {
        new BshCommand().execute(args);
    }

    public void execute() throws Exception {
        Interpreter bsh = null;
        Object ret;
        boolean interactive = false;
        InputStream in = getInput().getInputStream();
        OutputStream out = getOutput().getOutputStream();
        OutputStream err = getError().getOutputStream();
        if (FLAG_INTERACTIVE.isSet()) {
            bsh = createInterpreter(in, out, err, true);
            interactive = true;
        }

        if (ARG_CODE.isSet()) {
            if (bsh == null) {
                bsh = createInterpreter(in, out, err, false);
            }
            String code = ARG_CODE.getValue();
            ret = bsh.eval(code);

            if (ret != null) {
                out.write((ret + "\n").getBytes());
            }
        }

        if (ARG_FILE.isSet()) {
            if (bsh == null) {
                bsh = createInterpreter(in, out, err, false);
            }

            String file = ARG_FILE.getValue().toString();
            ret = bsh.source(file);

            if (ret != null) {
                out.write((ret + "\n").getBytes());
            }
        }
        out.flush();

        if (bsh == null) {
            // If no arguments were given, default to interactive mode.
            bsh = createInterpreter(in, out, err, true);
            interactive = true;
        }

        if (interactive) {
            bsh.run();
        }
    }
View Full Code Here

Examples of bsh.Interpreter

    }

    private Interpreter createInterpreter(
            InputStream in, OutputStream out, OutputStream err, boolean interactive)
        throws Exception {
        Interpreter interpreter = new Interpreter(
                new BufferedReader(new InputStreamReader(in)),
                new PrintStream(out),
                new PrintStream(err), interactive);
        if (interactive) {
            interpreter.eval("show();");
        }
        return interpreter;
    }
View Full Code Here

Examples of ch.qos.logback.core.joran.spi.Interpreter

  }
 
  protected void buildInterpreter() {
    RuleStore rs = new SimpleRuleStore(context);
    addInstanceRules(rs);
    this.interpreter = new Interpreter(context, rs, initialPattern());
    InterpretationContext ec = interpreter.getInterpretationContext();
    ec.setContext(context);
    addImplicitRules(interpreter);
    addDefaultNestedComponentRegistryRules(ec.getDefaultNestedComponentRegistry());
  }
View Full Code Here

Examples of com.clarkparsia.pellet.rules.rete.Interpreter

    initialize( expressivity );

    //run the RETE once when the rules are not applied
    if( !abox.ranRete && abox.rulesNotApplied ) {
      // initialize and run the rete
      Interpreter interp = new Interpreter( abox );

      RulesToReteTranslator translator = new RulesToReteTranslator( abox );
      RulesToATermTranslator atermTranslator = new RulesToATermTranslator();
      for( Rule rule : abox.getKB().getRules() ) {
        com.clarkparsia.pellet.rules.rete.Rule reteRule =
          translator.translateRule( rule );
       
        if( reteRule != null ) {
          Set<ATermAppl> explain = abox.doExplanation()         
            ? rule.getExplanation( atermTranslator )
            : Collections.<ATermAppl>emptySet();
         
          interp.rete.compile( reteRule, explain );
        }
      }
     
      interp.rete.compileFacts( abox );
      Set<Fact> inferred = interp.run();

      if( log.isLoggable( Level.FINE ) )
        log.fine( inferred.size() + " inferred fact(s)" );
     
      //need to add the inferred facts back to the tableau
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.