Examples of Func


Examples of com.l2jfrozen.gameserver.skills.funcs.Func

    {
      Env env = new Env();
      env.player = getEffector();
      env.target = getEffected();
      env.skill = getSkill();
      Func f = t.getFunc(env, this); // effect is owner
      if(f != null)
      {
        funcs.add(f);
      }
    }
View Full Code Here

Examples of com.l2jfrozen.gameserver.skills.funcs.Func

      for(FuncTemplate t : _funcTemplates)
      {
        Env env = new Env();
        env.player = player;
        env.item = instance;
        Func f = t.getFunc(env, instance);
        if(f != null)
        {
          funcs.add(f);
        }
      }
View Full Code Here

Examples of com.l2jfrozen.gameserver.skills.funcs.Func

      for(FuncTemplate t : _funcTemplates)
      {
        Env env = new Env();
        env.player = player;
        env.item = instance;
        Func f = t.getFunc(env, instance);
        if(f != null)
        {
          funcs.add(f);
        }
      }
View Full Code Here

Examples of com.l2jfrozen.gameserver.skills.funcs.Func

    {
      Env env = new Env();
      env.player = player;
      env.target = player;
      env.item = instance;
      Func f = t.getFunc(env, this); // skill is owner
      if(f != null)
      {
        funcs.add(f);
      }
    }
View Full Code Here

Examples of com.l2jfrozen.gameserver.skills.funcs.Func

    for(FuncTemplate t : _funcTemplates)
    {
      Env env = new Env();
      env.player = player;
      env.skill = this;
      Func f = t.getFunc(env, this); // skill is owner

      if(f != null)
      {
        funcs.add(f);
      }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Func

        return true;
    }

    /** {@inheritDoc} */
    @Override public Object visit(ExprCall x) throws Err {
        final Func f = x.fun;
        final int n = f.count();
        final Object candidate = n==0 ? cacheForConstants.get(f) : null;
        if (candidate!=null) return candidate;
        final Expr body = f.getBody();
        if (body.type().arity()<0 || body.type().arity()!=f.returnDecl.type().arity()) throw new ErrorType(body.span(), "Function return value not fully resolved.");
        for(Func ff:current_function) if (ff==f) throw new ErrorSyntax(x.span(), ""+f+" cannot call itself recursively!");
        Env<ExprVar,Object> newenv = new Env<ExprVar,Object>();
        List<SimTupleset> list = new ArrayList<SimTupleset>(x.args.size());
        for(int i=0; i<n; i++) { SimTupleset ts = cset(x.args.get(i)); newenv.put(f.get(i), ts);  list.add(ts); }
        final SimCallback cb = callbacks.get(f);
        if (cb!=null) {
           try {
              Object answer = cb.compute(f, list);
              if (answer!=null) {
                 if (x.args.size()==0) cacheForConstants.put(f, answer);
                 return answer;
              }
           } catch(Exception ex) {
              // if the callback failed, we can just continue with our original attempt to evaluate this call
           }
        }
        Env<ExprVar,Object> oldenv = env;
        env = newenv;
        current_function.add(f);
        Object ans = visitThis(body);
        env = oldenv;
        current_function.remove(current_function.size()-1);
        if (f.count()==0) cacheForConstants.put(f, ans);
        return ans;
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Func

        Expr g = A.addField("g", B);
        // The line above is the same as:   A.addField(null, "g", B.oneOf())  since B is unary.
        // If you want "setOf", you need:   A.addField(null, "g", B.setOf())

        // pred someG { some g }
        Func someG = new Func(null, "SomeG", null, null, g.some());

        // pred atMostThree[x:univ, y:univ] { #(x+y) >= 3 }
        Decl x = UNIV.oneOf("x");
        Decl y = UNIV.oneOf("y");
        Expr body = x.get().plus(y.get()).cardinality().lte(ExprConstant.makeNUMBER(3));
        Func atMost3 = new Func(null, "atMost3", Util.asList(x,y), null, body);

        List<Sig> sigs = Arrays.asList(new Sig[]{A, B, A1, A2});

        // run { some A && atMostThree[B,B] } for 3 but 3 int, 3 seq
        Expr expr1 = A.some().and(atMost3.call(B,B));
        Command cmd1 = new Command(false, 3, 3, 3, expr1);
        A4Solution sol1 = TranslateAlloyToKodkod.execute_command(NOP, sigs, cmd1, opt);
        System.out.println("[Solution1]:");
        System.out.println(sol1.toString());
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Func

     */
    private String skolem(String name) {
        if (current_function.size()==0) {
            if (cmd!=null && cmd.label.length()>0 && cmd.label.indexOf('$')<0) return cmd.label+"_"+name; else return name;
        }
        Func last=current_function.get(current_function.size()-1);
        String funcname=tail(last.label);
        if (funcname.indexOf('$')<0) return funcname+"_"+name; else return name;
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Func

    /** Caches parameter-less functions to a Kodkod Expression, Kodkod IntExpression, or Kodkod Formula. */
    private final Map<Func,Object> cacheForConstants = new IdentityHashMap<Func,Object>();

    /** {@inheritDoc} */
    @Override public Object visit(ExprCall x) throws Err {
        final Func f = x.fun;
        final Object candidate = f.count()==0 ? cacheForConstants.get(f) : null;
        if (candidate!=null) return candidate;
        final Expr body = f.getBody();
        if (body.type().arity()<0 || body.type().arity()!=f.returnDecl.type().arity()) throw new ErrorType(body.span(), "Function return value not fully resolved.");
        final int n = f.count();
        int maxRecursion = unrolls;
        for(Func ff:current_function) if (ff==f) {
            if (maxRecursion<0) {
                throw new ErrorSyntax(x.span(), ""+f+" cannot call itself recursively!");
            }
            if (maxRecursion==0) {
                Type t = f.returnDecl.type();
                if (t.is_bool) return Formula.FALSE;
                if (t.is_int) return IntConstant.constant(0);
                int i = t.arity();
                Expression ans = Expression.NONE;
                while(i>1) { ans = ans.product(Expression.NONE); i--; }
                return ans;
            }
            maxRecursion--;
        }
        Env<ExprVar,Object> newenv = new Env<ExprVar,Object>();
        for(int i=0; i<n; i++) newenv.put(f.get(i), cset(x.args.get(i)));
        Env<ExprVar,Object> oldenv = env;
        env = newenv;
        current_function.add(f);
        Object ans = visitThis(body);
        env = oldenv;
        current_function.remove(current_function.size()-1);
        if (ans instanceof Formula) k2pos((Formula)ans, x);
        if (f.count()==0) cacheForConstants.put(f, ans);
        return ans;
    }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4compiler.ast.Func

         Object x=objs.get(i);
         if (x instanceof Sig) {
            Sig y = (Sig)x; msg.append("sig ").append(y.label).append("\n"+"at ").append(y.pos.toShortString());
         }
         else if (x instanceof Func) {
            Func y = (Func)x;
            msg.append(y.isPred?"pred ":"fun ")
            .append(y.label).append("\n"+"at ").append(y.pos.toShortString());
         }
         else if (x instanceof Expr) {
            Expr y = (Expr)x;
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.