Class/Object

org.nlogo.core

Syntax

Related Docs: object Syntax | package core

Permalink

case class Syntax extends Product with Serializable

Specifies the arguments accepted by a primitive. Used by the compiler for type-checking.

You cannot instantiate this class directly. Instead, use the static construction methods Syntax.commandSyntax(...) or Syntax.reporterSyntax(...).

For example, in a Reporter that takes two number arguments and returns a boolean, implement Primitive.getSyntax() as follows:

public Syntax getSyntax() {
  return Syntax.reporterSyntax(
    new int[] { Syntax.NumberType(), Syntax.NumberType() },
    Syntax.BooleanType());
}

An input can be made variadic, meaning that it can be repeated any number of times when enclosed in parentheses, if you add the RepeatableType flag. When using variadic inputs you should also define the default number of inputs, that is, the number of inputs expect if the user does not use parentheses. For example:

 public Syntax getSyntax() {
   return Syntax.reporterSyntax(
     new int[] { Syntax.WildcardType() | Syntax.RepeatableType() },
     Syntax.ListType(), 2);
 }

Source
Syntax.scala
See also

Primitive#getSyntax()

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Syntax
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val agentClassString: String

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. val blockAgentClassString: Option[String]

    Permalink
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. val defaultOption: Option[Int]

    Permalink
  9. def dfault: Int

    Permalink
  10. def dump: String

    Permalink
  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. val introducesContext: Boolean

    Permalink
  15. def isInfix: Boolean

    Permalink

    indicates whether this instruction should be parsed as infix.

    indicates whether this instruction should be parsed as infix. Infix instructions expect exactly one argument on the left and should not be variadic on the right.

    returns

    true if this instruction is infix, false otherwise.

  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. val isRightAssociative: Boolean

    Permalink
  18. def isVariadic: Boolean

    Permalink

    determines whether an instruction allows a variable number of args.

  19. val left: Int

    Permalink
  20. def minimum: Int

    Permalink
  21. val minimumOption: Option[Int]

    Permalink
  22. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. val precedence: Int

    Permalink
  26. val ret: Int

    Permalink
  27. val right: List[Int]

    Permalink
  28. def rightDefault: Int

    Permalink

    returns the number of args this instruction takes on the right by default.

  29. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  30. def takesOptionalCommandBlock: Boolean

    Permalink
  31. def totalDefault: Int

    Permalink

    returns the total number of args, left and right, this instruction takes by default.

  32. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped