public class RecorderElementMap
extends java.lang.Object
recorder elements to class names which then can be referenced by ids, i.e.
a recorder element may be retrieved by its class name or by a grouping id
which represents multiple class names.The interface of this class is incomplete as (nearly) only required methods are realized (pragmatic agility).
| Modifier and Type | Class and Description |
|---|---|
private static class |
RecorderElementMap.PositionRecord
Information to be stored for a recording id on the index into the
configuration string and the related char value.
|
| Modifier and Type | Field and Description |
|---|---|
private HashMap<java.lang.String,java.lang.String> |
classNameToId
Stores the class name to group-id mappings.
|
private char[] |
currentConfiguration
Stores the current configuration as array of numbers (can be transformed
to a string as map key).
|
private RecorderElement |
currentConfigurationRecord
Stores the current configuration record for fast access.
|
private RecorderElementFactory |
factory
Stores the recorder element factory.
|
private HashMap<java.lang.String,RecorderElementMap.PositionRecord> |
idToConfiguration
Stores the records for the recording ids.
|
private HashMap<java.lang.String,RecorderElementMap.PositionRecord> |
lruRecords
Stores the last recently used mappings between variability (i.e.
|
private HashMap<java.lang.String,RecorderElement> |
mappedClasses
Stores the class name / id mapping to recorder elements.
|
private HashMap<java.lang.String,RecorderElement> |
mappedConfigurations
Stores the records for the individual configurations.
|
private java.util.LinkedList<MultipleRecorderElement> |
pseudoElt
Stores the pseudo recorder elements.
|
private ArrayList<java.lang.String> |
recorderIds
Stores the recorder ids (in sequence of registration).
|
private char |
separatorChar
Stores the variant separator, i.e. the separator to be used between
variability and variant (e.g. drawer@none).
|
private java.lang.String |
variabilitySeparator
Stores the variability separator, i.e. the separator to be used between
two variabilities.
|
private char |
variabilitySeparatorChar
Stores the variability separator, i.e. the separator to be used between
two variabilities.
|
private HashMap<java.lang.String,java.lang.Integer> |
varIds
Stores the variability identification to integer mapping (simplified
recognition of variabilities during assignment to recording elements).
|
| Constructor and Description |
|---|
RecorderElementMap(RecorderElementFactory factory)
Creates a new map.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
configurationKeyToString(java.lang.String key,
boolean check)
Formats a configuration key to a string, i.e. converts chars to numbers
and inserts a separator char.
|
java.lang.Iterable<java.lang.String> |
configurations()
Returns the set of all configurations recorded until now.
|
java.lang.Iterable<HashMap.Entry<java.lang.String,RecorderElement>> |
configurationToRecording()
Returns the bindings between configurations and recording elements.
|
boolean |
containsKey(java.lang.String recId)
Does this map contains a (redirected) entry for
className? |
void |
enterCompleteConfiguration(java.lang.String ids,
boolean force)
Changes the entire variability configuration, i.e. sets all currently
active variants new.
|
void |
enterConfiguration(java.lang.String id)
Notifies this class about explicitly entering a configuration, i.e. the
change of an individual variability (used for automatic detection).
|
RecorderElement |
getAggregatedRecord(java.lang.String recId)
Returns the (redirected) entry assigned to
recId? |
int |
getConfigurationLength()
Returns the current length of the configuration.
|
ConfigurationToName |
getConfigurationMapping()
Returns an instance which is responsible for mapping back a configuration
string to a readable configuration description.
|
java.lang.String |
getCurrentConfigurationId()
Returns the current configuration identification.
|
RecorderElement |
getCurrentConfigurationRecord(java.lang.String recId)
Returns the current configuration record.
|
private java.lang.String |
getId(java.lang.String className)
Maps a class name back to the key used for
mappedClasses. |
java.lang.String |
getPossibleAggregatedRecorderId(java.lang.String recId)
Returns a possible recording id for the given
recId. |
(package private) java.lang.String |
getRecorderId(RecorderElement element)
Returns the recording id for the given recorder
element. |
java.lang.String |
getRecorderId(java.lang.String className)
Returns the recording id for the given class name.
|
char |
getSeparatorChar()
Returns the char separating variabilities from concrete variants in
recorder ids.
|
java.lang.String |
getVariabilityId(java.lang.String recId)
Returns the part of the
recId representing the variability
identification. |
int |
getVariabilityIdNum(java.lang.String recId)
Returns the numerical identification of the variability identification
(retrieved by
getVariabilityId(String). |
java.lang.Iterable<HashMap.Entry<java.lang.String,RecorderElement>> |
idToRecordingSet()
Returns all mappings to recorder elements.
|
boolean |
isEmpty()
Returns whether recorder elements have been stored (not
classname-id-mappings).
|
java.util.LinkedList<MultipleRecorderElement> |
pseudoElements()
Returns the pseudo elements.
|
int |
pseudoElementsSize()
Returns the current number of pseudo elements.
|
void |
put(java.lang.String recId,
RecorderElement[] elements,
MonitoringGroupConfiguration conf,
MonitoringGroupSettings settings)
Adds a pseudo recorder element which represents multiple recorder
elements.
|
void |
put(java.lang.String className,
java.lang.String id,
MonitoringGroupConfiguration conf)
Stores a new recorder element.
|
java.util.Iterator<java.lang.String> |
recorderIds()
Returns all stored recorder ids (in sequence of registration).
|
private void |
setCurrentConfigurationRecord()
Changes the current configuration record, i.e. caches the record
assigned to the current configuration.
|
java.lang.Iterable<RecorderElement> |
values()
Returns all stored recorder elements.
|
private HashMap<java.lang.String,java.lang.String> classNameToId
private HashMap<java.lang.String,RecorderElement> mappedClasses
private ArrayList<java.lang.String> recorderIds
private HashMap<java.lang.String,RecorderElement> mappedConfigurations
private RecorderElement currentConfigurationRecord
private HashMap<java.lang.String,RecorderElementMap.PositionRecord> idToConfiguration
private HashMap<java.lang.String,RecorderElementMap.PositionRecord> lruRecords
separatorChar) and the assigned position.private HashMap<java.lang.String,java.lang.Integer> varIds
private java.util.LinkedList<MultipleRecorderElement> pseudoElt
private char[] currentConfiguration
private char separatorChar
private char variabilitySeparatorChar
private java.lang.String variabilitySeparator
private RecorderElementFactory factory
public RecorderElementMap(RecorderElementFactory factory)
factory - the recorder element factorypublic char getSeparatorChar()
public java.lang.String getVariabilityId(java.lang.String recId)
recId representing the variability
identification.recId - the recording identificationpublic int getVariabilityIdNum(java.lang.String recId)
getVariabilityId(String).recId - the recording identificationpublic void put(java.lang.String recId,
RecorderElement[] elements,
MonitoringGroupConfiguration conf,
MonitoringGroupSettings settings)
recId - the unique (pseudo) identificationelements - the elementsconf - the recorder configurationsettings - the monitoring group settings including all configuration
information (reference should not be stored, will be freed
explicitly)public java.util.LinkedList<MultipleRecorderElement> pseudoElements()
public int pseudoElementsSize()
public void put(java.lang.String className,
java.lang.String id,
MonitoringGroupConfiguration conf)
id might be specified to which the measurements are
assigned to. Ids are unique strings without inherent semantics. If
not given, the className is used for grouping and assigning
measurements (implicit 1-groups).className - the name of the class measurements should be registered
forid - an optional group identification (may be empty or null)conf - an optional monitoring group configuration associated with
id (may be null)private void setCurrentConfigurationRecord()
public void enterConfiguration(java.lang.String id)
id - the new configuration entry (variability@variant)public void enterCompleteConfiguration(java.lang.String ids,
boolean force)
ids - the recording ids for the currently active configurationforce - if true dummy recording elements are created
for recording groups which have not been registered so far (but which
probably will during the run of the monitored program, if false
only registered ids will be considered (may lead to
incomplete configurations)public RecorderElement getCurrentConfigurationRecord(java.lang.String recId)
recId - the requested variant at the specified positionpublic java.lang.String getPossibleAggregatedRecorderId(java.lang.String recId)
recId.
If recId denotes a recoding group, the recorder element
for that group is returned. Otherways, recId is considered
as a possible prefix to a variant (if enabled) and the related active
variant is returned.recId - the recorder id or a recorder id prefixpublic java.lang.String getCurrentConfigurationId()
public ConfigurationToName getConfigurationMapping()
private java.lang.String getId(java.lang.String className)
mappedClasses.
This method queries classNameToId if an id was registered
for className. If an id was registered,
mappedClasses is queried with that idclassName - the class name to be searched formappedClassespublic java.lang.String getRecorderId(java.lang.String className)
className - the class name to look forpublic boolean containsKey(java.lang.String recId)
className?recId - the recorder identificationtrue if this map contains an entry,
false elsepublic RecorderElement getAggregatedRecord(java.lang.String recId)
recId?recId - the recorder identificationpublic java.lang.Iterable<HashMap.Entry<java.lang.String,RecorderElement>> idToRecordingSet()
public boolean isEmpty()
true if recorder elements have been stored,
false elsepublic java.lang.Iterable<RecorderElement> values()
public java.util.Iterator<java.lang.String> recorderIds()
public java.lang.Iterable<java.lang.String> configurations()
public java.lang.Iterable<HashMap.Entry<java.lang.String,RecorderElement>> configurationToRecording()
public int getConfigurationLength()
public java.lang.String configurationKeyToString(java.lang.String key,
boolean check)
key - the key to be formattedcheck - if true emit only valid configurationsjava.lang.String getRecorderId(RecorderElement element)
element.
This method is intended for debugging only.element - the recorder element