|
| static Attribute | findAttributeByName (EObject node, String name) |
| | Return the attribute with the given name if present, otherwise return null.
|
| static List< Attribute > | findAttributesByName (EObject node, String name) throws IllegalArgumentException |
| | Return a list of attributes with the given name.
|
| static TimeValue | getAbsentAfter (EObject node) |
| | Return the value of the @absent_after attribute of the given node or TimeValue.ZERO if does not have one.
|
| static AttrParm | getAttributeParameter (Attribute attribute, String parameterName) |
| | Return the parameter with the given name for the specified attribute or null if no such parameter is found.
|
| static List< Attribute > | getAttributes (EObject node) |
| | Return a list of attributes declared on the given node.
|
| static String | getAttributeValue (EObject node, String attrName) |
| | Return the first argument specified for the first attribute with the given name.
|
| static boolean | getBooleanAttributeParameter (Attribute attribute, String parameterName) |
| | Return true if there is a parameter of the given attribute with the given name whose value is "true" (case-insensitive) and return false otherwise.
|
| static Attribute | getEnclaveAttribute (Instantiation node) |
| | Return the @enclave attribute annotated on the given node.
|
| static int | getEnclaveNumWorkersFromAttribute (Instantiation node) |
| | Retrieve the number of worker parameter from an enclave attribute.
|
| static String | getFirstArgumentValue (Attribute attr) |
| | Return the first argument specified for the attribute or null if the attribute is not found or if it does not have any arguments.
|
| static String | getIconPath (EObject node) |
| | Return the declared icon of the node, as given by the @icon annotation, or null if there is no such annotation.
|
| static String | getLabel (EObject node) |
| | Return the declared label of the node, as given by the @label annotation.
|
| static Map< String, String > | getLayoutOption (EObject node) |
| | Return the layout annotations for the given element or null if there is no such annotation.
|
| static TimeValue | getMaxWait (EObject node) |
| | Return the value of the @maxwait attribute of the given node or TimeValue.ZERO if does not have one.
|
| static String | getPortSide (EObject node) |
| | Return the @side annotation for the given node (presumably a port) or null if there is no such annotation.
|
| static boolean | hasCBody (Reaction reaction) |
| | Return true if the reaction is marked to have a C code body.
|
| static boolean | isEnclave (Instantiation node) |
| | Return true if the specified instance has an @enclave attribute.
|
| static boolean | isEnclaveConnection (Instantiation node) |
| | Return true if the specified instantiation is of an EnclaveConnection reactor.
|
| static boolean | isFederate (Reactor reactor) |
| | Return true if the reactor is marked to be a federate.
|
| static boolean | isSparse (EObject node) |
| | Return true if the specified node is an Input and has an @sparse attribute.
|
A helper class for processing attributes in the AST.
An attribute is an annotation using the @ syntax. For example, @label("My Label") is an attribute. It is associated with whatever node comes immediately after it.
- Author
- Shaokai Lin
-
Clément Fournier
-
Alexander Schulz-Rosengarten
| String org.lflang.AttributeUtils.getAttributeValue |
( |
EObject | node, |
|
|
String | attrName ) |
|
static |
Return the first argument specified for the first attribute with the given name.
If there is no attribute with the given name, return null. If the attribute has no arguments, or if the arguments are not of a suitable form, return null. This ignores any argument name, if one is given, and only returns arguments of the form of strings ("foo"), numbers (123), boolean values (true, false), or the time values forever or never. Time values with units are not returned (the return value will be null).
This is a convenience method for common use cases where an attribute is specified with a single argument of a suitable form. The validator should check that the arguments are of a suitable form.
- Parameters
-
| node | The node to get the attribute value from. |
| attrName | The name of the attribute to get the value from. |
| Map< String, String > org.lflang.AttributeUtils.getLayoutOption |
( |
EObject | node | ) |
|
|
static |
Return the layout annotations for the given element or null if there is no such annotation.
Layout annotations have the form:
@layout(option="string", value="any")
For example:
@layout(option="port.side", value="WEST")
This will return all such annotations for the specified node in the form of a map from the option name to the value.