Package adams.flow.core
Class EncapsulateActors
- java.lang.Object
-
- adams.flow.core.EncapsulateActors
-
public class EncapsulateActors extends Object
Helper class for encapsulating actor(s).- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description EncapsulateActors()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StorageName
createInputStorageName(StorageName[] items)
Generates a storage name for the input token, ensuring that it doesn't interfere with storage items to keep.static StorageName
createOutputStorageName(StorageName[] items)
Generates a storage name for the output token, ensuring that it doesn't interfere with storage items to keep.protected static StorageName
createStorageName(StorageName[] items, String prefix)
Generates a storage name, ensuring that it doesn't interfere with storage items to keep.static EncapsulatedActorsContainer
encapsulate(Actor actor, VariableName[] vars, StorageName[] items)
Encapsulates the actor as is.static EncapsulatedActorsContainer
encapsulate(Actor actor, VariableName[] vars, StorageName[] items, Object input)
Encapsulates the actor as is.static Storage
getStorage(Actor context, StorageName[] items)
Extracts the specified storage items and returns the subset.static Variables
getVariables(Actor context, VariableName[] vars)
Extracts the specified variables and their values and returns the subset.static EncapsulatedActorsContainer
wrap(Actor actor, VariableName[] vars, StorageName[] items)
Wraps the actor to obtain a fully self-container flow.static EncapsulatedActorsContainer
wrap(Actor actor, VariableName[] vars, StorageName[] items, Object input)
Wraps the actor to obtain a fully self-container flow.
-
-
-
Method Detail
-
getVariables
public static Variables getVariables(Actor context, VariableName[] vars)
Extracts the specified variables and their values and returns the subset.- Parameters:
context
- the flow context to get the current variables fromvars
- the variables to extract- Returns:
- the subset
-
getStorage
public static Storage getStorage(Actor context, StorageName[] items)
Extracts the specified storage items and returns the subset.- Parameters:
context
- the flow context to get the current storage items fromitems
- the items to extract- Returns:
- the subset
-
createStorageName
protected static StorageName createStorageName(StorageName[] items, String prefix)
Generates a storage name, ensuring that it doesn't interfere with storage items to keep.- Parameters:
items
- the storage items to keepprefix
- the prefix to use- Returns:
- the name for the input token
-
createInputStorageName
public static StorageName createInputStorageName(StorageName[] items)
Generates a storage name for the input token, ensuring that it doesn't interfere with storage items to keep.- Parameters:
items
- the storage items to keep- Returns:
- the name for the input token
-
createOutputStorageName
public static StorageName createOutputStorageName(StorageName[] items)
Generates a storage name for the output token, ensuring that it doesn't interfere with storage items to keep.- Parameters:
items
- the storage items to keep- Returns:
- the name for the output token
-
encapsulate
public static EncapsulatedActorsContainer encapsulate(Actor actor, VariableName[] vars, StorageName[] items)
Encapsulates the actor as is.- Parameters:
actor
- the actor to encapsulatevars
- the variables to migrateitems
- the storage items to migrate- Returns:
- the generated container
-
encapsulate
public static EncapsulatedActorsContainer encapsulate(Actor actor, VariableName[] vars, StorageName[] items, Object input)
Encapsulates the actor as is.- Parameters:
actor
- the actor to encapsulatevars
- the variables to migrateitems
- the storage items to migrateinput
- the input token, can be null- Returns:
- the generated container
-
wrap
public static EncapsulatedActorsContainer wrap(Actor actor, VariableName[] vars, StorageName[] items)
Wraps the actor to obtain a fully self-container flow.- Parameters:
actor
- the actors to wrapvars
- the variables to migrateitems
- the storage items to migrate- Returns:
- the generated container
-
wrap
public static EncapsulatedActorsContainer wrap(Actor actor, VariableName[] vars, StorageName[] items, Object input)
Wraps the actor to obtain a fully self-container flow.- Parameters:
actor
- the actor to wrapvars
- the variables to migrateitems
- the storage items to migrateinput
- the input token payload, can be null; gets ignored if actor is a Flow actor- Returns:
- the generated container
-
-