Class MachineElementsManagerImpl
- java.lang.Object
-
- cern.accsoft.steering.aloha.machine.manage.MachineElementsManagerImpl
-
- All Implemented Interfaces:
MachineElementsManager,Data
public class MachineElementsManagerImpl extends java.lang.Object implements MachineElementsManager
the basic implementation of a class, that keeps track of active monitors and correctors.
-
-
Constructor Summary
Constructors Constructor Description MachineElementsManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends DataValue>
voidactivateAvailableMonitors(java.util.Collection<? extends MeasuredData<T>> readingDatas)sets the status of the monitors correctly and deactivates the monitors, which are not available in at least one dataset.voidaddListener(MachineElementsManagerListener listener)voidapply(MonitorSelection monitorSelection)activates all monitors, whose key is contained in theMonitorSelectionobject.voidclear()sets all the fields to the initial valuesjava.lang.IntegerconvertToActiveCorrectorIndex(int allCorrectorIndex)converts an index in the all-correcors list to an index which is valid in the active correctors list.java.lang.IntegerconvertToActiveMonitorIndex(int allMonitorIndex)converts an index in the all-monitor list to an index which is valid in the active monitors list.voidfill(cern.accsoft.steering.jmad.model.JMadModel model, JMadModelAdapter jMadModelAdapter)fills the lists with the initial values from the modeljava.util.List<java.lang.Double>getActiveCorrectorGainErrors()java.util.List<java.lang.Double>getActiveCorrectorGains()java.util.ArrayList<java.lang.String>getActiveCorrectorNames()java.util.List<java.lang.String>getActiveCorrectorNames(Plane plane)intgetActiveCorrectorNumber()java.util.List<Corrector>getActiveCorrectors()Collects all active correctors in an ArrayList.java.util.List<Corrector>getActiveCorrectors(Plane plane)intgetActiveCorrectorsCount()determines the number of correctors which were activated during the measurement.intgetActiveCorrectorsCount(Plane plane)java.util.List<java.lang.Double>getActiveMonitorGainErrors()java.util.List<java.lang.Double>getActiveMonitorGains()java.util.ArrayList<java.lang.String>getActiveMonitorNames()java.util.List<java.lang.String>getActiveMonitorNames(Plane plane)intgetActiveMonitorNumber()java.util.List<Monitor>getActiveMonitors()collects all working monitors and returns an ArrayList.java.util.List<Monitor>getActiveMonitors(Plane plane)intgetActiveMonitorsCount()counts the monitors which have an OK status.intgetActiveMonitorsCount(Plane plane)MonitorSelectiongetActiveMonitorSelection()determines, which monitors are actually selected and returns the keys in an object.java.util.List<Corrector>getAllCorrectors()java.util.List<Monitor>getAllMonitors()cern.accsoft.steering.jmad.gui.mark.MarkerXProvidergetCorrectorHVBorderProvider()cern.accsoft.steering.jmad.gui.mark.MarkerXProvidergetMonitorHVBorderProvider()booleanisFilled()voidremoveListener(MachineElementsManagerListener listener)removes aMachineElementsManagerListenervoidresetAllGains()resets the gains of all monitors and correctors to their initial value.voidsetActiveCorrectorNumber(int activeCorrectorNumber)set the actually displayed corrector-numbervoidsetActiveMonitorNumber(int activeMonitorNumber)set the actually displayed monitor-numbervoidsetSuppressActiveElementsChangedEvent(boolean suppressActiveElementsChangedEvent)if this property is set to true, then no listener is notified, that one of the elements changed its state.voidsetSuppressChangedCorrectorGainsEvent(boolean suppressChangedCorrectorGainsEvent)voidsetSuppressChangedMonitorGainsEvent(boolean suppressChangedMonitorGainsEvent)
-
-
-
Method Detail
-
clear
public void clear()
sets all the fields to the initial values- Specified by:
clearin interfaceMachineElementsManager
-
fill
public void fill(cern.accsoft.steering.jmad.model.JMadModel model, JMadModelAdapter jMadModelAdapter)Description copied from interface:MachineElementsManagerfills the lists with the initial values from the model- Specified by:
fillin interfaceMachineElementsManager- Parameters:
model- theJMadModelto use for filling the lists
-
activateAvailableMonitors
public <T extends DataValue> void activateAvailableMonitors(java.util.Collection<? extends MeasuredData<T>> readingDatas)
Description copied from interface:MachineElementsManagersets the status of the monitors correctly and deactivates the monitors, which are not available in at least one dataset.- Specified by:
activateAvailableMonitorsin interfaceMachineElementsManager- Parameters:
readingDatas- the data read from files
-
getActiveMonitorNames
public java.util.ArrayList<java.lang.String> getActiveMonitorNames()
- Specified by:
getActiveMonitorNamesin interfaceMachineElementsManager- Returns:
- the names of all active monitors
-
getActiveMonitorsCount
public int getActiveMonitorsCount()
Description copied from interface:MachineElementsManagercounts the monitors which have an OK status.- Specified by:
getActiveMonitorsCountin interfaceMachineElementsManager- Returns:
- the number of monitors with status OK.
-
getActiveCorrectorsCount
public int getActiveCorrectorsCount()
Description copied from interface:MachineElementsManagerdetermines the number of correctors which were activated during the measurement. (= number of StearingFiles)- Specified by:
getActiveCorrectorsCountin interfaceMachineElementsManager- Returns:
-
getActiveCorrectorNames
public java.util.ArrayList<java.lang.String> getActiveCorrectorNames()
- Specified by:
getActiveCorrectorNamesin interfaceMachineElementsManager- Returns:
- the names of all active correctors
-
getActiveMonitors
public java.util.List<Monitor> getActiveMonitors()
Description copied from interface:MachineElementsManagercollects all working monitors and returns an ArrayList.- Specified by:
getActiveMonitorsin interfaceMachineElementsManager- Returns:
- the functional monitors.
-
getActiveCorrectors
public java.util.List<Corrector> getActiveCorrectors()
Description copied from interface:MachineElementsManagerCollects all active correctors in an ArrayList.- Specified by:
getActiveCorrectorsin interfaceMachineElementsManager- Returns:
- the active Correctors
-
addListener
public void addListener(MachineElementsManagerListener listener)
Description copied from interface:MachineElementsManager- Specified by:
addListenerin interfaceMachineElementsManager- Parameters:
listener- the listener to add
-
removeListener
public void removeListener(MachineElementsManagerListener listener)
Description copied from interface:MachineElementsManagerremoves aMachineElementsManagerListener- Specified by:
removeListenerin interfaceMachineElementsManager- Parameters:
listener- the listener to remove
-
getAllCorrectors
public java.util.List<Corrector> getAllCorrectors()
- Specified by:
getAllCorrectorsin interfaceMachineElementsManager- Returns:
- all available Correctors
-
getAllMonitors
public java.util.List<Monitor> getAllMonitors()
- Specified by:
getAllMonitorsin interfaceMachineElementsManager- Returns:
- all available Monitors
-
getActiveCorrectorNames
public java.util.List<java.lang.String> getActiveCorrectorNames(Plane plane)
- Specified by:
getActiveCorrectorNamesin interfaceMachineElementsManager- Parameters:
plane- the plane for which to get the monitor names- Returns:
- the names of the active monitors for the given plane
-
getActiveCorrectors
public java.util.List<Corrector> getActiveCorrectors(Plane plane)
- Specified by:
getActiveCorrectorsin interfaceMachineElementsManager- Returns:
- the active correctors for the given plane
-
getActiveMonitorNames
public java.util.List<java.lang.String> getActiveMonitorNames(Plane plane)
- Specified by:
getActiveMonitorNamesin interfaceMachineElementsManager- Parameters:
plane- the plane for which to return the active monitor names- Returns:
- the active monitor names for that plane
-
getActiveMonitors
public java.util.List<Monitor> getActiveMonitors(Plane plane)
- Specified by:
getActiveMonitorsin interfaceMachineElementsManager- Returns:
- the active monitors for the given plane
-
getActiveCorrectorsCount
public int getActiveCorrectorsCount(Plane plane)
- Specified by:
getActiveCorrectorsCountin interfaceMachineElementsManager- Parameters:
plane- the plane for which to retrieve the count- Returns:
- the amount of active correctors in the given plane
-
getActiveMonitorsCount
public int getActiveMonitorsCount(Plane plane)
- Specified by:
getActiveMonitorsCountin interfaceMachineElementsManager- Parameters:
plane- the plane for which to retrieve the count- Returns:
- the amount of active monitors in the given plane
-
setActiveCorrectorNumber
public void setActiveCorrectorNumber(int activeCorrectorNumber)
Description copied from interface:MachineElementsManagerset the actually displayed corrector-number- Specified by:
setActiveCorrectorNumberin interfaceMachineElementsManager
-
setActiveMonitorNumber
public void setActiveMonitorNumber(int activeMonitorNumber)
Description copied from interface:MachineElementsManagerset the actually displayed monitor-number- Specified by:
setActiveMonitorNumberin interfaceMachineElementsManager
-
getActiveCorrectorNumber
public int getActiveCorrectorNumber()
- Specified by:
getActiveCorrectorNumberin interfaceMachineElementsManager- Returns:
- the actual displayed Corrector - number (out of the active Correctors)
-
getActiveMonitorNumber
public int getActiveMonitorNumber()
- Specified by:
getActiveMonitorNumberin interfaceMachineElementsManager- Returns:
- the actual displayed monitor - number
-
getMonitorHVBorderProvider
public cern.accsoft.steering.jmad.gui.mark.MarkerXProvider getMonitorHVBorderProvider()
- Specified by:
getMonitorHVBorderProviderin interfaceMachineElementsManager- Returns:
- a provider for aloha-charts, which indicates the border between x and y monitors
-
getCorrectorHVBorderProvider
public cern.accsoft.steering.jmad.gui.mark.MarkerXProvider getCorrectorHVBorderProvider()
- Specified by:
getCorrectorHVBorderProviderin interfaceMachineElementsManager- Returns:
- a provider for aloha-charts, which indicates the border between x and y correctors
-
isFilled
public boolean isFilled()
- Specified by:
isFilledin interfaceMachineElementsManager- Returns:
- true, if the manager already has its correctors, false, if not.
-
convertToActiveCorrectorIndex
public java.lang.Integer convertToActiveCorrectorIndex(int allCorrectorIndex)
Description copied from interface:MachineElementsManagerconverts an index in the all-correcors list to an index which is valid in the active correctors list. if the corrector of the given index is not active, then it returns null.- Specified by:
convertToActiveCorrectorIndexin interfaceMachineElementsManager- Parameters:
allCorrectorIndex- the index in the all-correctors list- Returns:
- the index related to active correctors if the corrector is a
-
convertToActiveMonitorIndex
public java.lang.Integer convertToActiveMonitorIndex(int allMonitorIndex)
Description copied from interface:MachineElementsManagerconverts an index in the all-monitor list to an index which is valid in the active monitors list. if the monitor of the given index is not active, then it returns null.- Specified by:
convertToActiveMonitorIndexin interfaceMachineElementsManager- Parameters:
allMonitorIndex- the index in the all-monitors list- Returns:
- the index related to active monitors if the corrector is a
-
setSuppressActiveElementsChangedEvent
public void setSuppressActiveElementsChangedEvent(boolean suppressActiveElementsChangedEvent)
Description copied from interface:MachineElementsManagerif this property is set to true, then no listener is notified, that one of the elements changed its state. This is useful, if a group of states is changed at once. When the value is set back to false, then one event is sent to all listeners.- Specified by:
setSuppressActiveElementsChangedEventin interfaceMachineElementsManager
-
setSuppressChangedMonitorGainsEvent
public void setSuppressChangedMonitorGainsEvent(boolean suppressChangedMonitorGainsEvent)
- Specified by:
setSuppressChangedMonitorGainsEventin interfaceMachineElementsManager
-
setSuppressChangedCorrectorGainsEvent
public void setSuppressChangedCorrectorGainsEvent(boolean suppressChangedCorrectorGainsEvent)
- Specified by:
setSuppressChangedCorrectorGainsEventin interfaceMachineElementsManager
-
getActiveCorrectorGains
public java.util.List<java.lang.Double> getActiveCorrectorGains()
- Specified by:
getActiveCorrectorGainsin interfaceMachineElementsManager- Returns:
- the gains of the active correctors
-
getActiveMonitorGains
public java.util.List<java.lang.Double> getActiveMonitorGains()
- Specified by:
getActiveMonitorGainsin interfaceMachineElementsManager- Returns:
- the gains of the active monitors
-
getActiveCorrectorGainErrors
public java.util.List<java.lang.Double> getActiveCorrectorGainErrors()
- Specified by:
getActiveCorrectorGainErrorsin interfaceMachineElementsManager- Returns:
- the errors of the gains of the active correctors
-
getActiveMonitorGainErrors
public java.util.List<java.lang.Double> getActiveMonitorGainErrors()
- Specified by:
getActiveMonitorGainErrorsin interfaceMachineElementsManager- Returns:
- the errors on the gains of the active monitors
-
resetAllGains
public void resetAllGains()
Description copied from interface:MachineElementsManagerresets the gains of all monitors and correctors to their initial value.- Specified by:
resetAllGainsin interfaceMachineElementsManager
-
apply
public void apply(MonitorSelection monitorSelection)
Description copied from interface:MachineElementsManageractivates all monitors, whose key is contained in theMonitorSelectionobject. All other monitors will be deselected.- Specified by:
applyin interfaceMachineElementsManager- Parameters:
monitorSelection- the object from which to take the active keys.
-
getActiveMonitorSelection
public MonitorSelection getActiveMonitorSelection()
Description copied from interface:MachineElementsManagerdetermines, which monitors are actually selected and returns the keys in an object.- Specified by:
getActiveMonitorSelectionin interfaceMachineElementsManager- Returns:
- The object containing all the selected keys.
-
-