A MalleableString is an object with multiple valid textual representations.
More...
|
| MalleableString | addComments (Stream< String > comments) |
| | Associate comments with this.
|
| abstract MalleableString | constrain (Predicate< String > constraint) |
| | Apply the given constraint to leaf strings of this.
|
| abstract boolean | findBestRepresentation (Supplier< RenderResult > providedRender, ToLongFunction< RenderResult > badness, int width, int indentation, String singleLineCommentPrefix) |
| | Change the state of this such that the badness of the supplied render result is minimized.
|
| MalleableString | indent () |
| | Return this, indented by one more level.
|
| abstract boolean | isEmpty () |
| | Return whether any representation of this contains text.
|
| abstract RenderResult | render (int indentation, String singleLineCommentMarker, boolean codeMapTag, EObject enclosingEObject) |
| | Render this using indentation spaces per indentation level and singleLineCommentMarker to mark the beginnings of single-line comments.
|
| record | RenderResult (Stream< String > unplacedComments, String rendering, int levelsOfCommentDisplacement) |
| | The result of rendering a MalleableString.
|
| MalleableString | setSourceEObject (EObject sourceEObject) |
| | Specify the EObject from which this originated, if applicable.
|
| String | toString () |
|
| static MalleableString | anyOf (MalleableString... possibilities) |
| | Return an object that can be represented as any one of the given alternatives.
|
| static MalleableString | anyOf (Object... possibilities) |
| | Return an object that can be represented as any one of the given alternatives.
|
| static MalleableString | anyOf (String... possibilities) |
| | Return an object that can be represented as any one of the given alternatives.
|
A MalleableString is an object with multiple valid textual representations.
These textual representations are code that may have associated comments.
◆ addComments()
| MalleableString org.lflang.ast.MalleableString.addComments |
( |
Stream< String > | comments | ) |
|
Associate comments with this.
◆ anyOf() [1/3]
| MalleableString org.lflang.ast.MalleableString.anyOf |
( |
MalleableString... | possibilities | ) |
|
|
static |
Return an object that can be represented as any one of the given alternatives.
◆ anyOf() [2/3]
| MalleableString org.lflang.ast.MalleableString.anyOf |
( |
Object... | possibilities | ) |
|
|
static |
Return an object that can be represented as any one of the given alternatives.
◆ anyOf() [3/3]
| MalleableString org.lflang.ast.MalleableString.anyOf |
( |
String... | possibilities | ) |
|
|
static |
Return an object that can be represented as any one of the given alternatives.
◆ constrain()
| abstract MalleableString org.lflang.ast.MalleableString.constrain |
( |
Predicate< String > | constraint | ) |
|
|
abstract |
Apply the given constraint to leaf strings of this.
This is done on a best-effort basis in the sense that if no options satisfy the constraint, the constraint is not applied.
◆ findBestRepresentation()
| abstract boolean org.lflang.ast.MalleableString.findBestRepresentation |
( |
Supplier< RenderResult > | providedRender, |
|
|
ToLongFunction< RenderResult > | badness, |
|
|
int | width, |
|
|
int | indentation, |
|
|
String | singleLineCommentPrefix ) |
|
abstract |
Change the state of this such that the badness of the supplied render result is minimized.
- Parameters
-
| providedRender | A supplier of render results that should be optimized. |
| badness | A badness computer for render results. |
| width | The number of columns permitted for this, excluding indentation applied to the whole of this. |
| indentation | The number of spaces used per level of indentation. |
| singleLineCommentPrefix | The prefix that marks the start of a single-line comment. |
- Returns
- Whether the best representation changed.
◆ indent()
Return this, indented by one more level.
◆ isEmpty()
| abstract boolean org.lflang.ast.MalleableString.isEmpty |
( |
| ) |
|
|
abstract |
Return whether any representation of this contains text.
◆ render()
| abstract RenderResult org.lflang.ast.MalleableString.render |
( |
int | indentation, |
|
|
String | singleLineCommentMarker, |
|
|
boolean | codeMapTag, |
|
|
EObject | enclosingEObject ) |
|
abstract |
Render this using indentation spaces per indentation level and singleLineCommentMarker to mark the beginnings of single-line comments.
◆ RenderResult()
| record org.lflang.ast.MalleableString.RenderResult |
( |
Stream< String > | unplacedComments, |
|
|
String | rendering, |
|
|
int | levelsOfCommentDisplacement ) |
◆ setSourceEObject()
| MalleableString org.lflang.ast.MalleableString.setSourceEObject |
( |
EObject | sourceEObject | ) |
|
Specify the EObject from which this originated, if applicable.
◆ toString()
| String org.lflang.ast.MalleableString.toString |
( |
| ) |
|
◆ comments
| List<String> org.lflang.ast.MalleableString.comments = new ArrayList<>() |
|
protected |
◆ sourceEObject
| EObject org.lflang.ast.MalleableString.sourceEObject = null |
|
protected |
The documentation for this class was generated from the following file:
- /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/ast/MalleableString.java