Package org.nlogo.nvm

Examples of org.nlogo.nvm.EngineException


  }

  public Object report_2(final Context context, Agent agent)
      throws LogoException {
    if (agent.id == -1) {
      throw new EngineException(context, this,
        I18N.errorsJ().getN("org.nlogo.$common.thatAgentIsDead", agent.classDisplayName()));
    }
    try {
      return agent.getTurtleVariable(vn);
    } catch (org.nlogo.api.AgentException ex) {
      throw new EngineException(context, this, ex.getMessage());
    }
  }
View Full Code Here


      for (AgentSet.Iterator iter = sourceSet.shufflerator(context.job.random);
           iter.hasNext();) {
        result.add(iter.next().getTurtleVariable(vn));
      }
    } catch (org.nlogo.api.AgentException ex) {
      throw new EngineException(context, this, ex.getMessage());
    }
    return result.toLogoList();
  }
View Full Code Here

      Agent a2 = (Agent) o2;
      if (a1.getAgentBit() == a2.getAgentBit()) {
        return a1.compareTo(a2) < 0;
      }
    }
    throw new EngineException
        (context, this, I18N.errorsJ().getN("org.nlogo.prim._lessthan.cantUseLessthanOnDifferentArgs",
            TypeNames.aName(o1), TypeNames.aName(o2)));
  }
View Full Code Here

  public boolean report_7(Context context, double arg0, Object arg1) throws LogoException {
    if (arg1 instanceof Double) {
      return arg0 < ((Double) arg1).doubleValue();
    }
    throw new EngineException
        (context, this, I18N.errorsJ().getN("org.nlogo.prim._lessthan.cantUseLessthanOnDifferentArgs",
            TypeNames.aName(arg0), TypeNames.aName(arg1)));


  }
View Full Code Here

  public boolean report_8(Context context, Object arg0, double arg1) throws LogoException {
    if (arg0 instanceof Double) {
      return ((Double) arg0).doubleValue() < arg1;
    }
    throw new EngineException
        (context, this, I18N.errorsJ().getN("org.nlogo.prim._lessthan.cantUseLessthanOnDifferentArgs",
            TypeNames.aName(arg0), TypeNames.aName(arg1)));
  }
View Full Code Here

    if (breed == world.links()) {
      breed.setDirected(true);
    }
    if (world.linkManager.findLinkFrom(src, dest, breed, false) == null) {
      if (src == dest) {
        throw new EngineException
            (context, this,
                I18N.errorsJ().get("org.nlogo.prim.$common.turtleCantLinkToSelf"));
      }
      if (src.id != -1 && dest.id != -1) {
        Link link = world.linkManager.createLink(src, dest, breed);
View Full Code Here

  public void perform(Context context) throws LogoException {
    perform_1(context);
  }

  public void perform_1(Context context) throws LogoException {
    throw new EngineException(context, this,
            I18N.errorsJ().get("org.nlogo.prim._returnreport.reportNotCalledInReportProcedure"));
  }
View Full Code Here

      throws LogoException {
    Object value = args[0].report(context);
    try {
      context.agent.setTurtleOrLinkVariable(varName, value);
    } catch (AgentException ex) {
      throw new EngineException(context, this, ex.getMessage());
    }
    context.ip = next;
  }
View Full Code Here

  public void perform_1(final Context context, Object value) throws LogoException {
    try {
      context.agent.setTurtleOrLinkVariable(varName, value);
    } catch (AgentException ex) {
      throw new EngineException(context, this, ex.getMessage());
    }
    context.ip = next;
  }
View Full Code Here

    AgentSet agentset;
    if (target instanceof AgentSet) {
      agentset = (AgentSet) target;
      if (!(context.agent instanceof Observer)) {
        if (agentset == world.turtles()) {
          throw new EngineException
              (context, this, I18N.errorsJ().get("org.nlogo.prim.$common.onlyObserverCanAskAllTurtles"));
        }
        if (agentset == world.patches()) {
          throw new EngineException
              (context, this, I18N.errorsJ().get("org.nlogo.prim.$common.onlyObserverCanAskAllPatches"));
        }
      }
    } else if (target instanceof Agent) {
      Agent agent = (Agent) target;
      if (agent.id == -1) {
        throw new EngineException(context, this,
          I18N.errorsJ().getN("org.nlogo.$common.thatAgentIsDead", agent.classDisplayName()));
      }
      agentset = new ArrayAgentSet(agent.getAgentClass(), 1, false, world);
      agentset.add(agent);
    } else {
View Full Code Here

TOP

Related Classes of org.nlogo.nvm.EngineException

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.