Package org.nlogo.nvm

Examples of org.nlogo.nvm.ArgumentTypeException


    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.Patch.class) {
          throw new ArgumentTypeException
              (context, this, i, Syntax.PatchType() | Syntax.PatchsetType(), elt);
        }
        for (AgentSet.Iterator iter = tempSet.iterator(); iter.hasNext();) {
          resultSet.add((Patch) iter.next());
        }
      } else if (elt instanceof LogoList) {
        descendList(context, (LogoList) elt, resultSet);
      } else if (elt instanceof Patch) {
        resultSet.add((Patch) elt);
      } else if (elt != org.nlogo.api.Nobody$.MODULE$) {
        throw new ArgumentTypeException
            (context, this, i, Syntax.PatchType() | Syntax.PatchsetType(), elt);
      }
    }
    return new org.nlogo.agent.ArrayAgentSet(
        org.nlogo.agent.Patch.class,
View Full Code Here


      } else {
        Collections.sort(agents);
        return LogoList.fromJava(agents);
      }
    }
    throw new ArgumentTypeException
        (context, this, 0, Syntax.ListType() | Syntax.AgentsetType(), obj);
  }
View Full Code Here

      }
      return agentset.contains(agent)
          ? Boolean.TRUE
          : Boolean.FALSE;
    } else {
      throw new ArgumentTypeException
          (context, this, 1,
              Syntax.ListType() | Syntax.StringType() | Syntax.AgentsetType(),
              obj);
    }
  }
View Full Code Here

        return org.nlogo.api.Nobody$.MODULE$;
      } else {
        return agents.randomOne(count, context.job.random.nextInt(count));
      }
    } else {
      throw new ArgumentTypeException
          (context, this, 0, Syntax.ListType() | Syntax.AgentsetType(), obj);
    }
  }
View Full Code Here

        return org.nlogo.api.Nobody$.MODULE$;
      } else {
        return agents.randomOne(count, context.job.random.nextInt(count));
      }
    } else {
      throw new ArgumentTypeException(context, this, 0,
          Syntax.ListType() | Syntax.AgentsetType(), obj);
    }
  }
View Full Code Here

    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.Link.class) {
          throw new ArgumentTypeException
              (context, this, i, Syntax.LinkType() | Syntax.LinksetType(), elt);
        }
        for (AgentSet.Iterator iter = tempSet.iterator(); iter.hasNext();) {
          resultSet.add((Link) iter.next());
        }
      } else if (elt instanceof LogoList) {
        descendList(context, (LogoList) elt, resultSet);
      } else if (elt instanceof Link) {
        resultSet.add((Link) elt);
      } else if (elt != org.nlogo.api.Nobody$.MODULE$) {
        throw new ArgumentTypeException
            (context, this, i, Syntax.LinkType() | Syntax.LinksetType(), elt);
      }
    }
    return new org.nlogo.agent.ArrayAgentSet(
        org.nlogo.agent.Link.class,
View Full Code Here

    if (obj instanceof LogoList) {
      return ((LogoList) obj).reverse();
    } else if (obj instanceof String) {
      return new StringBuilder((String) obj).reverse().toString();
    } else {
      throw new ArgumentTypeException
          (context, this, 0, Syntax.ListType() | Syntax.StringType(), obj);
    }
  }
View Full Code Here

        for (AgentSet.Iterator iter = sourceSet.iterator(); iter.hasNext();) {
          addAll(resultList, ((Patch) iter.next()).turtlesHere());
        }
      }
    } else {
      throw new ArgumentTypeException
          (context, this, 0, Syntax.AgentType() | Syntax.AgentsetType(), agentOrSet);
    }
    return new org.nlogo.agent.ArrayAgentSet
        (Turtle.class,
            resultList.toArray
View Full Code Here

            }
          }
        }
      }
    } else {
      throw new ArgumentTypeException
          (context, this, 0,
              Syntax.TurtleType() | Syntax.PatchType() |
                  Syntax.TurtlesetType() | Syntax.PatchsetType(),
              agentOrSet);
    }
View Full Code Here

            resultList.add(turtle);
          }
        }
      }
    } else {
      throw new ArgumentTypeException
          (context, this, 0,
              Syntax.TurtleType() | Syntax.PatchType() |
                  Syntax.TurtlesetType() | Syntax.PatchsetType(),
              sourceSet);
    }
View Full Code Here

TOP

Related Classes of org.nlogo.nvm.ArgumentTypeException

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.