Package org.nlogo.agent

Examples of org.nlogo.agent.AgentSet$Iterator


  }

  @Override
  public void perform(final Context context)
      throws LogoException {
    AgentSet nodeset = argEvalAgentSet(context, 0, Turtle.class);
    AgentSet linkset = argEvalAgentSet(context, 1, Link.class);
    double springConstant = argEvalDoubleValue(context, 2);
    double springLength = argEvalDoubleValue(context, 3);
    double repulsionConstant = argEvalDoubleValue(context, 4);
    org.nlogo.agent.Layouts.spring
        (nodeset, linkset, springConstant, springLength, repulsionConstant,
View Full Code Here


    perform_1(context);
  }

  public void perform_1(final Context context)
      throws LogoException {
    AgentSet agentset =
        new org.nlogo.agent.ArrayAgentSet
            (context.agent.getAgentClass(), 1, false, world);
    agentset.add(context.agent);
    org.nlogo.util.MersenneTwisterFast random = context.job.random;
    context.job.random = world.mainRNG.clone();
    context.runExclusiveJob(agentset, next);
    context.job.random = random;
    context.ip = offset;
View Full Code Here

    LinkedHashSet<Turtle> resultSet =
        new LinkedHashSet<Turtle>();
    for (int i = 0; i < args.length; i++) {
      Object elt = args[i].report(context);
      if (elt instanceof AgentSet) {
        AgentSet tempSet = (AgentSet) elt;
        if (tempSet.type() != org.nlogo.agent.Turtle.class) {
          throw new ArgumentTypeException
              (context, this, i, Syntax.TurtleType() | Syntax.TurtlesetType(), elt);
        }
        for (AgentSet.Iterator iter = tempSet.iterator();
             iter.hasNext();) {
          resultSet.add((Turtle) iter.next());
        }
      } else if (elt instanceof LogoList) {
        descendList(context, (LogoList) elt, resultSet);
View Full Code Here

         iter.hasNext();) {
      Object obj = iter.next();
      if (obj instanceof Turtle) {
        result.add((Turtle) obj);
      } else if (obj instanceof AgentSet) {
        AgentSet tempSet = (AgentSet) obj;
        if (tempSet.type() != org.nlogo.agent.Turtle.class) {
          throw new EngineException(context, this,
              I18N.errorsJ().getN("org.nlogo.prim.etc._turtleset.listInputsMustBeTurtleOrTurtleAgentset",
                  this.displayName(), Dump.logoObject(tempList, true, false), Dump.logoObject(obj, true, false)));
        }
        for (AgentSet.Iterator iter2 = tempSet.iterator();
             iter2.hasNext();) {
          result.add((Turtle) iter2.next());
        }
      } else if (obj instanceof LogoList) {
        descendList(context, (LogoList) obj, result);
View Full Code Here

    perform_1(context);
  }

  public void perform_1(final Context context)
      throws LogoException {
    AgentSet agentset =
        new org.nlogo.agent.ArrayAgentSet
            (context.agent.getAgentClass(), 1, false, world);
    agentset.add(context.agent);
    context.runExclusiveJob(agentset, next);
    context.ip = offset;
  }
View Full Code Here

  }

  @Override
  public void perform(final Context context)
      throws LogoException {
    AgentSet nodeset = argEvalAgentSet(context, 0, Turtle.class);
    AgentSet linkset = argEvalAgentSet(context, 1, Link.class);
    double radius = argEvalDoubleValue(context, 2);
    try {
      org.nlogo.agent.Layouts.tutte(nodeset, linkset, radius,
          context.job.random);
    } catch (AgentException e) {
View Full Code Here

    try {
      if (nodes instanceof LogoList) {
        org.nlogo.agent.Layouts.circle
            (world, (LogoList) nodes, radius);
      } else {
        AgentSet set = (AgentSet) nodes;
        if (set.type() != Turtle.class) {
          throw new EngineException
              (context, this,
                  I18N.errorsJ().get("org.nlogo.prim.etc._layoutcircle.patchesImmovable"));
        }
        org.nlogo.agent.Layouts.circle(set, radius, context.job.random);
View Full Code Here

TOP

Related Classes of org.nlogo.agent.AgentSet$Iterator

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.