org.nlogo.nvm
Class Argument

java.lang.Object
  extended by org.nlogo.nvm.Argument
All Implemented Interfaces:
Argument

public class Argument
extends Object
implements Argument

Passes arguments to extension primitives.


Constructor Summary
Argument(Context context, Reporter arg)
           
 
Method Summary
 Object get()
          Returns the argument as an Object without type checking.
 Agent getAgent()
          Returns the argument as an Agent.
 AgentSet getAgentSet()
          Returns the argument as an org.nlogo.api.AgentSet.
 Boolean getBoolean()
          Returns the argument as a Boolean
 boolean getBooleanValue()
          Returns the value of the argument as a boolean
 double getDoubleValue()
          Returns the value of the argument as a double.
 int getIntValue()
          Returns the value of the argument as an int.
 Link getLink()
          Returns the argument as a org.nlogo.api.Link.
 LogoList getList()
          Returns the argument as a org.nlogo.api.LogoList
 Patch getPatch()
          Returns the argument as an org.nlogo.api.Patch
 Reporter getReporter()
          Special (undocumented) method for the cities extension.
 String getString()
          Returns the argument as a String
 Turtle getTurtle()
          Returns the argument as a org.nlogo.api.Turtle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Argument

public Argument(Context context,
                Reporter arg)
Method Detail

get

public Object get()
           throws LogoException
Description copied from interface: Argument
Returns the argument as an Object without type checking.

Specified by:
get in interface Argument
Throws:
LogoException - if a LogoException occurred while evaluating this argument

getAgentSet

public AgentSet getAgentSet()
                     throws ExtensionException,
                            LogoException
Description copied from interface: Argument
Returns the argument as an org.nlogo.api.AgentSet.

Specified by:
getAgentSet in interface Argument
Throws:
ExtensionException - if the argument is not an AgentSet
LogoException - if a LogoException occurred while evaluating this argument

getAgent

public Agent getAgent()
               throws ExtensionException,
                      LogoException
Description copied from interface: Argument
Returns the argument as an Agent.

Specified by:
getAgent in interface Argument
Throws:
ExtensionException - if the argument is not an Agent
LogoException - if a LogoException occurred while evaluating this argument

getBoolean

public Boolean getBoolean()
                   throws ExtensionException,
                          LogoException
Description copied from interface: Argument
Returns the argument as a Boolean

Specified by:
getBoolean in interface Argument
Throws:
ExtensionException - if the argument is not a Boolean
LogoException - if a LogoException occurred while evaluating this argument

getBooleanValue

public boolean getBooleanValue()
                        throws ExtensionException,
                               LogoException
Description copied from interface: Argument
Returns the value of the argument as a boolean

Specified by:
getBooleanValue in interface Argument
Throws:
ExtensionException - if the argument is not a boolean
LogoException - if a LogoException occurred while evaluating this argument

getDoubleValue

public double getDoubleValue()
                      throws ExtensionException,
                             LogoException
Description copied from interface: Argument
Returns the value of the argument as a double.

Specified by:
getDoubleValue in interface Argument
Throws:
ExtensionException - if the argument is not a number.
LogoException - if a LogoException occurred while evaluating this argument

getIntValue

public int getIntValue()
                throws ExtensionException,
                       LogoException
Description copied from interface: Argument
Returns the value of the argument as an int. Any fractional part is discarded.

Specified by:
getIntValue in interface Argument
Throws:
ExtensionException - if the argument is not a number.
LogoException - if a LogoException occurred while evaluating this argument

getList

public LogoList getList()
                 throws ExtensionException,
                        LogoException
Description copied from interface: Argument
Returns the argument as a org.nlogo.api.LogoList

Specified by:
getList in interface Argument
Throws:
ExtensionException - if the argument is not a LogoList
LogoException - if a LogoException occurred while evaluating this argument

getPatch

public Patch getPatch()
               throws ExtensionException,
                      LogoException
Description copied from interface: Argument
Returns the argument as an org.nlogo.api.Patch

Specified by:
getPatch in interface Argument
Throws:
ExtensionException - if the argument is not a Patch
LogoException - if a LogoException occurred while evaluating this argument

getString

public String getString()
                 throws ExtensionException,
                        LogoException
Description copied from interface: Argument
Returns the argument as a String

Specified by:
getString in interface Argument
Throws:
ExtensionException - if the argument cannot be cast to a String
LogoException - if a LogoException occurred while evaluating this argument

getTurtle

public Turtle getTurtle()
                 throws ExtensionException,
                        LogoException
Description copied from interface: Argument
Returns the argument as a org.nlogo.api.Turtle.

Specified by:
getTurtle in interface Argument
Throws:
ExtensionException - if the argument is not a Turtle
LogoException - if a LogoException occurred while evaluating this argument

getLink

public Link getLink()
             throws ExtensionException,
                    LogoException
Description copied from interface: Argument
Returns the argument as a org.nlogo.api.Link.

Specified by:
getLink in interface Argument
Throws:
ExtensionException - if the argument is not a Link
LogoException - if a LogoException occurred while evaluating this argument

getReporter

public Reporter getReporter()
Special (undocumented) method for the cities extension. Returns the argument reporter without evaluating.