Package org.nlogo.api

Examples of org.nlogo.api.AgentException


  }

  @Override
  public void setPatchVariable(int vn, double value)
      throws AgentException {
    throw new AgentException("the observer can't set a patch variable without specifying which turtle");
  }
View Full Code Here


  }

  @Override
  public void setLinkVariable(int vn, Object value)
      throws AgentException {
    throw new AgentException
        ("the observer can't access a link variable without specifying which link");
  }
View Full Code Here

  public double towards(org.nlogo.api.Agent fromAgent, org.nlogo.api.Agent toAgent,
                        boolean wrap)
      throws AgentException {
    double x, y;
    if (fromAgent == toAgent) {
      throw new AgentException
          (I18N.errorsJ().get("org.nlogo.agent.Protractor.noHeadingFromAgentToSelf"));
    }
    if (toAgent instanceof Turtle) {
      Turtle turtle = (Turtle) toAgent;
      x = turtle.xcor();
View Full Code Here

  public double towards(double fromX, double fromY,
                        double toX, double toY,
                        boolean wrap)
      throws AgentException {
    if (fromX == toX && fromY == toY) {
      throw new AgentException
          (I18N.errorsJ().getN("org.nlogo.agent.Protractor.noHeadingFromPointToSelf", fromX, fromY));
    }
    double dx = toX - fromX;
    double dy = toY - fromY;
    if (wrap) {
View Full Code Here

  public double towardsPitch(org.nlogo.api.Agent fromAgent, org.nlogo.api.Agent toAgent,
                             boolean wrap)
      throws AgentException {
    double x, y, z;
    if (fromAgent == toAgent) {
      throw new AgentException
          ("no pitch is defined from an agent to itself");
    }
    if (toAgent instanceof Turtle) {
      Turtle turtle = (Turtle) toAgent;
      x = turtle.xcor();
View Full Code Here

  public double towardsPitch(double fromX, double fromY, double fromZ,
                             double toX, double toY, double toZ,
                             boolean wrap)
      throws AgentException {
    if (fromX == toX && fromY == toY && fromZ == toZ) {
      throw new AgentException
          ("no pitch is defined from a point (" +
              fromX + "," + fromY + "," + fromZ + ") to that same point");
    }
    double dx = toX - fromX;
    double dy = toY - fromY;
View Full Code Here

      throws AgentException {
    // floor() is slow so we don't use it
    try {
      x = topology.wrapX(x);
    } catch (AgentException ex) {
      throw new AgentException("Cannot access patches beyond the limits of current world.");
    }
    if (x > 0) {
      return (int) (x + 0.5);
    } else {
      int intPart = (int) x;
View Full Code Here

      throws AgentException {
    // floor() is slow so we don't use it
    try {
      y = topology.wrapY(y);
    } catch (AgentException ex) {
      throw new AgentException("Cannot access patches beyond the limits of current world.");
    }
    if (y > 0) {
      return (int) (y + 0.5);
    } else {
      int intPart = (int) y;
View Full Code Here

  double wrapX(double x)
      throws AgentException {
    double max = world.maxPxcor() + 0.5;
    double min = world.minPxcor() - 0.5;
    if (x >= max || x < min) {
      throw new AgentException(I18N.errorsJ().get("org.nlogo.agent.Box.cantMoveTurtleBeyondWorldEdge"));
    }
    return x;
  }
View Full Code Here

  double wrapY(double y)
      throws AgentException {
    double max = world.maxPycor() + 0.5;
    double min = world.minPycor() - 0.5;
    if (y >= max || y < min) {
      throw new AgentException(I18N.errorsJ().get("org.nlogo.agent.Box.cantMoveTurtleBeyondWorldEdge"));
    }
    return y;
  }
View Full Code Here

TOP

Related Classes of org.nlogo.api.AgentException

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.