-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1339 from lf-lang/master
Merge from Master
- Loading branch information
Showing
13 changed files
with
225 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule reactor-ts
updated
13 files
+1 −1 | lingua-franca-ref.txt | |
+196 −2,016 | package-lock.json | |
+24 −22 | package.json | |
+0 −0 | src/core/@types/command-line-args/index.d.ts | |
+0 −0 | src/core/@types/command-line-usage/index.d.ts | |
+0 −0 | src/core/@types/microtime/index.d.ts | |
+0 −0 | src/core/@types/ulog/index.d.ts | |
+0 −1 | src/core/README.md | |
+62 −62 | src/core/federation.ts | |
+1 −0 | src/core/index.ts | |
+1 −1 | src/core/internal.ts | |
+4 −4 | src/core/port.ts | |
+1 −1 | tsconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,10 @@ | |
|
||
/** | ||
* A helper class for processing attributes in the AST. | ||
* | ||
* @author{Shaokai Lin <[email protected]>} | ||
* @author{Clément Fournier, TU Dresden, INSA Rennes} | ||
* @author{Alexander Schulz-Rosengarten <[email protected]>} | ||
*/ | ||
public class AttributeUtils { | ||
|
||
|
@@ -74,20 +76,30 @@ public static List<Attribute> getAttributes(EObject node) { | |
} | ||
|
||
/** | ||
* Return the value of the {@code @label} attribute if | ||
* present, otherwise return null. | ||
* Return the value of the attribute with the given name | ||
* if present, otherwise return null. | ||
* | ||
* @throws IllegalArgumentException If the node cannot have attributes | ||
*/ | ||
public static String findLabelAttribute(EObject node) { | ||
public static String findAttributeByName(EObject node, String name) { | ||
List<Attribute> attrs = getAttributes(node); | ||
return attrs.stream() | ||
.filter(it -> it.getAttrName().equals("label")) | ||
.filter(it -> it.getAttrName().equalsIgnoreCase(name)) // case-insensitive search (more user-friendly) | ||
.map(it -> it.getAttrParms().get(0).getValue().getStr()) | ||
.findFirst() | ||
.orElse(null); | ||
} | ||
|
||
/** | ||
* Return the value of the {@code @label} attribute if | ||
* present, otherwise return null. | ||
* | ||
* @throws IllegalArgumentException If the node cannot have attributes | ||
*/ | ||
public static String findLabelAttribute(EObject node) { | ||
return findAttributeByName(node, "label"); | ||
} | ||
|
||
/** | ||
* Return true if the specified node is an Input and has an {@code @sparse} | ||
* attribute. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.