Пример #1
0
    private void executeEvent(final int x, final int y) {
      if (executer == null) {
        return;
      }
      final ILocation pp = getModelCoordinatesFrom(x, y, surface);
      if (pp.getX() < 0
          || pp.getY() < 0
          || pp.getX() >= surface.getEnvWidth()
          || pp.getY() >= surface.getEnvHeight()) {
        return;
      }
      final Arguments args = new Arguments();
      final Collection<IAgent> agentset = surface.selectAgent(x, y);
      if (pointArg != null) {
        args.put(
            pointArg, ConstantExpressionDescription.create(new GamaPoint(pp.getX(), pp.getY())));
      }
      if (listArg != null) {
        args.put(listArg, ConstantExpressionDescription.create(agentset));
      }

      executer.setRuntimeArgs(args);
      GAMA.run(
          new GAMA.InScope.Void() {

            @Override
            public void process(final IScope scope) {
              executer.executeOn(scope);
            }
          });
      if (surface.getOutput().isPaused() || GAMA.isPaused()) {
        surface.updateDisplay(true);
      }
    }
Пример #2
0
 @Override
 public final ISymbol compile() {
   final SymbolProto proto = getMeta();
   validate();
   final ISymbol cs = proto.create(this);
   if (cs == null) {
     return null;
   }
   if (proto.isHasArgs()) {
     ((IStatement.WithArgs) cs).setFormalArgs(((StatementDescription) this).validateArgs());
   }
   if (proto.hasSequence() && !keyword.equals(PRIMITIVE)) {
     if (proto.isRemoteContext()) {
       copyTempsAbove();
     }
     cs.setChildren(compileChildren());
   }
   return cs;
 }