Top Description Fields Constructors Methods
org.antlr.stringtemplate.language

public Class FormalArgument

extends Object
Class Inheritance
Imports
org.antlr.stringtemplate.StringTemplate, java.util.HashMap, .Map, .List, .LinkedHashMap

Represents the name of a formal argument defined in a template: group test; test(a,b) : "$a$ $b$" t() : "blort" Each template has a set of these formal arguments or uses a placeholder object: UNKNOWN (indicating that no arguments were specified such as when a template is loaded from a file.st).

Note

originally, I tracked cardinality as well as the name of an attribute. I'm leaving the code here as I suspect something may come of it later. Currently, though, cardinality is not used.

Field Summary

Modifier and TypeField and Description
public StringTemplate
defaultValueST

If they specified name="value", store the template here

public String
public static final int
public static final int
public static final int
public static final String[]
public static final LinkedHashMap<K, V>
UNKNOWN

When template arguments are not available such as when the user uses "new StringTemplate(...)", then the list of formal arguments must be distinguished from the case where a template can specify args and there just aren't any such as the t() template above.

public static final int

Constructor Summary

AccessConstructor and Description
public
public
FormalArgument(String name, StringTemplate defaultValueST)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public static String
getCardinalityName(int cardinality)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

defaultValueSTback to summary
public StringTemplate defaultValueST

If they specified name="value", store the template here

nameback to summary
public String name
ONE_OR_MOREback to summary
public static final int ONE_OR_MORE
OPTIONALback to summary
public static final int OPTIONAL
REQUIREDback to summary
public static final int REQUIRED
suffixesback to summary
public static final String[] suffixes
UNKNOWNback to summary
public static final LinkedHashMap<K, V> UNKNOWN

When template arguments are not available such as when the user uses "new StringTemplate(...)", then the list of formal arguments must be distinguished from the case where a template can specify args and there just aren't any such as the t() template above.

ZERO_OR_MOREback to summary
public static final int ZERO_OR_MORE

Constructor Detail

FormalArgumentback to summary
public FormalArgument(String name)
FormalArgumentback to summary
public FormalArgument(String name, StringTemplate defaultValueST)

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

getCardinalityNameback to summary
public static String getCardinalityName(int cardinality)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object