Interface Extractor
-
- All Implemented Interfaces:
public interface Extractor<E extends Object>
An object that is able to extract numeric informations from an Alchemist {@link Environment}, given the current {@link it.unibo.alchemist.core.Simulation} {@link Time}, the last {@link Reaction} executed and the current simulation step.
-
-
Method Summary
Modifier and Type Method Description abstract <T extends Any> Map<String, E>
extractData(Environment<T, ?> environment, Actionable<T> reaction, Time time, Long step)
Extracts properties from an environment. <T extends Any> Map<String, String>
extractDataAsText(Environment<T, ?> environment, Actionable<T> reaction, Time time, Long step)
Same as extractData, but specifically meant for textual outputs. abstract List<String>
getColumnNames()
-
-
Method Detail
-
extractData
abstract <T extends Any> Map<String, E> extractData(Environment<T, ?> environment, Actionable<T> reaction, Time time, Long step)
Extracts properties from an environment. The returned map must either:
contain a single element,
have the keys matching columnNames, or
be iterable in predictable order (namely, implement SortedMap or extend one of LinkedHashMap or ConcurrentLinkedHashMap).
- Parameters:
environment
-the {@link Environment}
reaction
-the last executed {@link Reaction}
time
-the current {@link Time}
step
-the simulation step
- Returns:
the extracted properties with their names. The returned map must either: - contain a single element, - have the keys matching columnNames, or - be iterable in predictable order (namely, implement SortedMap or extend LinkedHashMap).
-
extractDataAsText
<T extends Any> Map<String, String> extractDataAsText(Environment<T, ?> environment, Actionable<T> reaction, Time time, Long step)
Same as extractData, but specifically meant for textual outputs. Captures E to String conversions. The default implementation just runs a
toString()
conversion ver extractData's return value's values.- Parameters:
environment
-the {@link Environment}
reaction
-the last executed {@link Reaction}
time
-the current {@link Time}
step
-the simulation step
- Returns:
the extracted properties in textual format with their names.
-
getColumnNames
abstract List<String> getColumnNames()
- Returns:
the name of the properties that this Extractor can provide
-
-
-
-