@Override public Syntax syntax() { int left = Syntax.NumberType(); int[] right = {Syntax.NumberType()}; return Syntax.reporterSyntax( left, right, Syntax.NumberType(), org.nlogo.api.Syntax.NormalPrecedence() - 2); }
@Override public Syntax syntax() { int[] right; right = new int[] {Syntax.NumberType(), Syntax.NumberType()}; return Syntax.reporterSyntax(right, Syntax.PatchType() | Syntax.NobodyType()); }
@Override public Syntax getSyntax() { int[] input = new int[] {Syntax.StringType() | Syntax.TurtleType(), Syntax.StringType()}; int output = Syntax.BooleanType(); return Syntax.reporterSyntax(input, output); }
@Override public Syntax syntax() { return Syntax.reporterSyntax( new int[] {Syntax.AgentsetType(), Syntax.BooleanBlockType()}, Syntax.NumberType(), "OTPL", "?"); }
@Override public Syntax getSyntax() { return Syntax.reporterSyntax( new int[] { Syntax.WildcardType(), Syntax.NumberType(), }, Syntax.WildcardType()); }
@Override public Syntax syntax() { return Syntax.commandSyntax( new int[] {Syntax.NumberType(), Syntax.CommandBlockType() | Syntax.OptionalType()}, "O---", "-T--", true); }
@Override public Object report(final org.nlogo.nvm.Context context) throws LogoException { Object obj = args[1].report(context); if (obj instanceof LogoList) { Object value = args[0].report(context); LogoList list = (LogoList) obj; for (Iterator<Object> it = list.iterator(); it.hasNext(); ) { if (Equality.equals(value, it.next())) { return Boolean.TRUE; } } return Boolean.FALSE; } else if (obj instanceof String) { return ((String) obj).indexOf(argEvalString(context, 0)) != -1 ? Boolean.TRUE : Boolean.FALSE; } else if (obj instanceof AgentSet) { Agent agent = argEvalAgent(context, 0); AgentSet agentset = (AgentSet) obj; if (agent instanceof Turtle) { if (agent.id == -1) { return Boolean.FALSE; } if (agentset.type() != Turtle.class) { return Boolean.FALSE; } if (agentset == world.turtles()) { return Boolean.TRUE; } if (world.isBreed(agentset)) { return agentset == ((Turtle) agent).getBreed() ? Boolean.TRUE : Boolean.FALSE; } } if (agent instanceof Link) { if (agent.id == -1) { return Boolean.FALSE; } if (agentset.type() != Link.class) { return Boolean.FALSE; } if (agentset == world.links()) { return Boolean.TRUE; } if (world.isBreed(agentset)) { return agentset == ((Link) agent).getBreed() ? Boolean.TRUE : Boolean.FALSE; } } else if (agent instanceof Patch) { if (agentset.type() != Patch.class) { return Boolean.FALSE; } if (agentset == world.patches()) { return Boolean.TRUE; } } return agentset.contains(agent) ? Boolean.TRUE : Boolean.FALSE; } else { throw new ArgumentTypeException( context, this, 1, Syntax.ListType() | Syntax.StringType() | Syntax.AgentsetType(), obj); } }
public Syntax getSyntax() { return Syntax.commandSyntax( new int[] { Syntax.StringType(), Syntax.NumberType(), Syntax.NumberType(), Syntax.NumberType(), Syntax.NumberType(), Syntax.NumberType(), Syntax.NumberType() }); }
@Override public Object report(final org.nlogo.nvm.Context context) throws LogoException { int index = argEvalIntValue(context, 0); Object obj = args[1].report(context); if (index < 0) { throw new EngineException( context, this, I18N.errorsJ().getN("org.nlogo.prim.etc.$common.negativeIndex", index)); } if (obj instanceof LogoList) { LogoList list = (LogoList) obj; if (index >= list.size()) { throw new EngineException( context, this, I18N.errorsJ() .getN( "org.nlogo.prim.etc.$common.indexExceedsListSize", index, Dump.logoObject(list), list.size())); } return list.get(index); } else if (obj instanceof String) { String string = (String) obj; if (index >= string.length()) { throw new EngineException( context, this, 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); } }
@Override public Syntax syntax() { int[] right = { Syntax.WildcardType(), Syntax.ListType() | Syntax.StringType() | Syntax.AgentsetType() }; int ret = Syntax.BooleanType(); return Syntax.reporterSyntax(right, ret); }
@Override public Syntax getSyntax() { return Syntax.commandSyntax( new int[] { Syntax.StringType(), Syntax.StringType(), Syntax.NumberType(), Syntax.StringType() | Syntax.RepeatableType() }, 3); }
@Override public Syntax syntax() { return Syntax.commandSyntax( new int[] { Syntax.TurtlesetType(), Syntax.LinksetType(), Syntax.NumberType(), Syntax.NumberType(), Syntax.NumberType() }, true); }
public org.nlogo.api.Syntax getSyntax() { int[] right = { org.nlogo.api.Syntax.TYPE_STRING, }; return org.nlogo.api.Syntax.commandSyntax(right); }
@Override public Syntax getSyntax() { return Syntax.commandSyntax(new int[] {Syntax.StringType()}); }
@Override public Syntax syntax() { int[] right = {Syntax.NumberType(), Syntax.NumberType()}; return Syntax.reporterSyntax(right, Syntax.NumberType(), "-TP-"); }
@Override public Syntax syntax() { int[] right = {Syntax.WildcardType(), Syntax.ListType()}; int ret = Syntax.ListType(); return Syntax.reporterSyntax(right, ret); }
@Override public Syntax syntax() { return Syntax.commandSyntax(new int[] {Syntax.ReferenceType()}, "-T--", true); }
@Override public Syntax syntax() { int[] right = {Syntax.NumberType(), Syntax.NumberType()}; int ret = Syntax.BooleanType(); return Syntax.reporterSyntax(right, ret); }
@Override public Syntax syntax() { return Syntax.reporterSyntax(Syntax.NumberType(), "-TP-"); }
public Syntax getSyntax() { return Syntax.commandSyntax(new int[] {}); }
@Override public Syntax syntax() { return Syntax.commandSyntax(); }
@Override public Syntax syntax() { return Syntax.reporterSyntax(new int[] {Syntax.NumberType()}, Syntax.NumberType()); }
@Override public Syntax syntax() { return Syntax.commandSyntax("-T--", true); }
@Override public Syntax syntax() { int[] right = {Syntax.AgentsetType(), Syntax.NumberBlockType()}; int ret = Syntax.AgentType(); return Syntax.reporterSyntax(right, ret, "OTPL", "?"); }
public Syntax getSyntax() { return Syntax.reporterSyntax(new int[] {Syntax.NumberType()}, Syntax.ListType()); }