Package org.nlogo.nvm

Examples of org.nlogo.nvm.ArgumentTypeException


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


  @Override
  public void perform(final Context context) throws LogoException {
    AgentSet agentset = argEvalAgentSet(context, 0);
    if (agentset.type() != Turtle.class) {
      throw new ArgumentTypeException(
        context, this, 0, Syntax.TurtlesetType(), agentset);
    }
    AgentSet breed = breedName == null ? world.links() : world.getLinkBreed(breedName);
    mustNotBeUndirected(breed, context);
    checkForBreedCompatibility(breed, context);
View Full Code Here

  @Override
  public void perform(final Context context) throws LogoException {
    AgentSet agentset = argEvalAgentSet(context, 0);
    if (agentset.type() != Turtle.class) {
      throw new ArgumentTypeException(
        context, this, 0, Syntax.TurtlesetType(), agentset);
    }
    AgentSet breed = breedName == null ? world.links() : world.getLinkBreed(breedName);
    mustNotBeUndirected(breed, context);
    checkForBreedCompatibility(breed, context);
View Full Code Here

  @Override
  public void perform(final Context context) throws LogoException {
    AgentSet agentset = argEvalAgentSet(context, 0);
    if (agentset.type() != Turtle.class) {
      throw new ArgumentTypeException(
        context, this, 0, Syntax.TurtlesetType(), agentset);
    }
    AgentSet breed = breedName == null ? world.links() : world.getLinkBreed(breedName);
    mustNotBeDirected(breed, context);
    checkForBreedCompatibility(breed, context);
View Full Code Here

          I18N.errorsJ().getN("org.nlogo.$common.thatAgentIsDead", agent.classDisplayName()));
      }
      agentset = new ArrayAgentSet(agent.getAgentClass(), 1, false, world);
      agentset.add(agent);
    } else {
      throw new ArgumentTypeException(context, this, 0, Syntax.AgentsetType() | Syntax.AgentType(), target);
    }
    context.runExclusiveJob(agentset, next);
    context.ip = offset;
  }
View Full Code Here

        throw new EngineException(context, this,
            I18N.errorsJ().getN("org.nlogo.prim.etc.$common.emptyStringInput", token().name()));
      }
      return string.substring(1);
    } else {
      throw new ArgumentTypeException
          (context, this, 0, Syntax.ListType() | Syntax.StringType(), arg0);
    }
  }
View Full Code Here

            I18N.errorsJ().getN("org.nlogo.prim.etc.$common.indexExceedsListSize",
                index, Dump.logoObject(string), string.length()));
      }
      return string.substring(index, index + 1);
    } else {
      throw new ArgumentTypeException
          (context, this, 1, Syntax.ListType() | Syntax.StringType(), obj);
    }
  }
View Full Code Here

        throw new EngineException(context, this,
            I18N.errorsJ().getN("org.nlogo.prim.etc.$common.notThatManyAgentsExist", n, count));
      }
      return agents.randomSubset(n, count, context.job.random);
    } else {
      throw new ArgumentTypeException
          (context, this, 1, Syntax.ListType() | Syntax.AgentsetType(), obj);
    }
  }
View Full Code Here

        }
      }
      return listCopy.toLogoList();
    } else if (obj instanceof String) {
      if (!(value instanceof String)) {
        throw new ArgumentTypeException(context, this, 0, Syntax.StringType(), value);
      }
      String string = (String) obj;
      String elt = (String) value;
      StringBuilder sbCopy = new StringBuilder();
      if (elt.length() <= string.length() && elt.length() != 0) {
        int i = 0;
        while (i <= string.length() - elt.length()) {
          if (!string.regionMatches(i, elt, 0, elt.length())) {
            sbCopy.append(string.charAt(i));
            i++;
          } else {
            i = i + elt.length();
          }
        }
        if (i > string.length() - elt.length() && (!string.regionMatches(i, elt, 0, elt.length()))) {
          sbCopy.append(string.substring(i));
        }
        return sbCopy.toString();
      } else {
        return string;
      }
    } else {
      throw new ArgumentTypeException
          (context, this, 1, Syntax.ListType() | Syntax.StringType(), obj);
    }
  }
View Full Code Here

        throw new EngineException(context, this,
            I18N.errorsJ().getN("org.nlogo.prim.etc.$common.emptyStringInput", token().name()));
      }
      return string.substring(0, string.length() - 1);
    } else {
      throw new ArgumentTypeException(context, this, 0, Syntax.ListType() |
          Syntax.StringType(), arg0);
    }
  }
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.