public class SyntacticHeaps extends Object
| Constructor and Description |
|---|
SyntacticHeaps() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends wybs.lang.SyntacticItem> |
clone(T item)
Recursively copy this syntactic item.
|
static <T extends wybs.lang.SyntacticItem> |
cloneOnly(T item,
Map<wybs.lang.SyntacticItem,wybs.lang.SyntacticItem> mapping,
Class<?> clazz) |
static wybs.lang.SyntacticItem |
substitute(wybs.lang.SyntacticItem item,
wybs.lang.SyntacticItem from,
wybs.lang.SyntacticItem to)
Create a new syntactic item by replacing all occurrences of one item
(
from) with another (to). |
public static <T extends wybs.lang.SyntacticItem> T clone(T item)
Recursively copy this syntactic item. Observe the resulting cloned syntactic item is *not* allocated to any heap, and this must be done separately. All children are recursively cloned as well.
This method preserves the underlying aliasing structure of the object being cloned. However, aliasing information is not preserved across calls to this method. Furthermore, it is not currently capable of handling cyclic structures.
public static <T extends wybs.lang.SyntacticItem> T cloneOnly(T item,
Map<wybs.lang.SyntacticItem,wybs.lang.SyntacticItem> mapping,
Class<?> clazz)
public static wybs.lang.SyntacticItem substitute(wybs.lang.SyntacticItem item,
wybs.lang.SyntacticItem from,
wybs.lang.SyntacticItem to)
Create a new syntactic item by replacing all occurrences of one item
(from) with another (to). In the case that
there is no change to the item (or any of its children) then the original
item is returned untouched. Specifically, the exact same reference will
be returned.
Any new items created during this process are allocated into the heap of the item they are replacing. This is necessary since otherwise a mix of allocated and unallocated items would be returned, making it difficult to then allocate them all.
This method preserves the underlying aliasing structure of the object being cloned. However, aliasing information is not preserved across calls to this method. Furthermore, it is not currently capable of handling cyclic structures.
item - The syntactic item we are currently substituting intofrom - The syntactic item we are looking to replaceto - The syntactic item that will replace all occurrences of fromCopyright © 2017. All rights reserved.