Package org.nlogo.api

Examples of org.nlogo.api.AgentException


  @Override
  public Patch getPatchAtOffsets(double dx, double dy)
      throws AgentException {
    Patch target = ((World3D) world).getPatchAt(xcor + dx, ycor + dy, zcor);
    if (target == null) {
      throw new AgentException("Cannot get patch beyond limits of current world.");
    }
    return target;
  }
View Full Code Here


  public Patch3D getPatchAtOffsets(double dx, double dy, double dz)
      throws AgentException {
    Patch3D target = ((World3D) world).getPatchAt(xcor + dx, ycor + dy, zcor + dz);
    if (target == null) {
      throw new AgentException("Cannot get patch beyond limits of current world.");
    }
    return target;
  }
View Full Code Here

        break;
      case VAR_ZCOR3D:
        zcor(value);
        break;
      case VAR_WHO3D:
        throw new AgentException("you can't change a turtle's who number");
      default:
        throw new IllegalArgumentException
            (vn + " is not a double variable");
    }
  }
View Full Code Here

          break;
        case VAR_SHAPE3D:
          if (value instanceof String) {
            String newShape = world.checkTurtleShapeName((String) value);
            if (newShape == null) {
              throw new AgentException
                  ("\"" + (String) value + "\" is not a currently defined shape");
            }
            shape(newShape);
          } else {
            wrongTypeForVariable(AgentVariables.getImplicitTurtleVariables(true)[vn],
                String.class, value);
          }
          break;
        case VAR_LABEL3D:
          label(value);
          break;
        case VAR_LABELCOLOR3D:
          if (value instanceof Number) {
            labelColor(((Number) value).doubleValue());
          } else if (value instanceof LogoList) {
            labelColor((LogoList) value, VAR_LABELCOLOR3D);
          } else {
            wrongTypeForVariable(AgentVariables.getImplicitTurtleVariables(true)[vn],
                Double.class, value);
          }
          break;
        case VAR_BREED3D:
          if (value instanceof AgentSet) {
            AgentSet breed = (AgentSet) value;
            if (breed != world.turtles() && !world.isBreed(breed)) {
              throw new AgentException(I18N.errorsJ().get("org.nlogo.agent.Turtle.cantSetBreedToNonBreedAgentSet"));
            }
            setBreed(breed);
          } else {
            wrongTypeForVariable(AgentVariables.getImplicitTurtleVariables(true)[vn],
                AgentSet.class, value);
          }
          break;
        case VAR_HIDDEN3D:
          if (value instanceof Boolean) {
            hidden(((Boolean) value).booleanValue());
          } else {
            wrongTypeForVariable(AgentVariables.getImplicitTurtleVariables(true)[vn],
                Boolean.class, value);
          }
          break;
        case VAR_SIZE3D:
          if (value instanceof Number) {
            size(((Number) value).doubleValue());
          } else {
            wrongTypeForVariable(AgentVariables.getImplicitTurtleVariables(true)[vn],
                Double.class, value);
          }
          break;
        case VAR_PENMODE3D:
          if (value instanceof String) {
            penMode((String) value);
          } else {
            wrongTypeForVariable(AgentVariables.getImplicitTurtleVariables(true)[vn],
                String.class, value);
          }
          break;

        case VAR_PENSIZE3D:
          if (value instanceof Number) {
            penSize(((Number) value).doubleValue());
          } else {
            wrongTypeForVariable(AgentVariables.getImplicitTurtleVariables(true)[vn],
                Double.class, value);
          }
          break;

        case VAR_WHO3D:
          throw new AgentException("you can't change a turtle's ID number");

        case VAR_PITCH3D:
          if (value instanceof Number) {
            pitch(((Number) value).doubleValue());
          } else {
View Full Code Here

  }

  @Override
  public Object getTurtleVariable(int vn)
      throws AgentException {
    throw new AgentException
        (I18N.errorsJ().get("org.nlogo.agent.Patch.cantAccessTurtleWithoutSpecifyingTurtle"));
  }
View Full Code Here


  @Override
  public Object getLinkVariable(int vn)
      throws AgentException {
    throw new AgentException
        (I18N.errorsJ().get("org.nlogo.agent.Patch.cantAccessLinkVarWithoutSpecifyingLink"));
  }
View Full Code Here

  }

  @Override
  public Object getTurtleOrLinkVariable(String varName)
      throws AgentException {
    throw new AgentException
        (I18N.errorsJ().get("org.nlogo.agent.Patch.cantAccessTurtleOrLinkWithoutSpecifyingAgent"));
  }
View Full Code Here

  }

  @Override
  public Object getLinkBreedVariable(String name)
      throws AgentException {
    throw new AgentException
        (I18N.errorsJ().get("org.nlogo.agent.Patch.cantAccessLinkVarWithoutSpecifyingLink"));
  }
View Full Code Here

  }

  @Override
  public Object getBreedVariable(String name)
      throws AgentException {
    throw new AgentException(I18N.errorsJ().get("org.nlogo.agent.Patch.cantAccessTurtleWithoutSpecifyingTurtle"));
  }
View Full Code Here

  }

  @Override
  public void setTurtleVariable(int vn, Object value)
      throws AgentException {
    throw new AgentException(I18N.errorsJ().get("org.nlogo.agent.Patch.cantSetTurtleWithoutSpecifyingTurtle"));
  }
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.