DESY ACOP Beans Home

com.cosylab.gui.displayers
Class DoubleSeqConsumerMulticaster

java.lang.Object
  extended by com.cosylab.gui.displayers.DoubleSeqConsumerMulticaster
All Implemented Interfaces:
DataConsumer, DoubleSeqConsumer, LongSeqConsumer, ObjectSeqConsumer, StringSeqConsumer

public class DoubleSeqConsumerMulticaster
extends java.lang.Object
implements DoubleSeqConsumer, LongSeqConsumer, StringSeqConsumer, ObjectSeqConsumer

DoubleSeqConsumerMulticaster casts different data consumers to DoubleSeqConsumer. ObjectSeqConsumer cast must receive Number instances. Delegate must be set, before any other method can be used.

Since:
Dec 4, 2003.
Version:
$Id: DoubleSeqConsumerMulticaster.java,v 1.5 2008-04-22 12:31:02 jbobnar Exp $
Author:
Igor Kriznar

Field Summary
static java.lang.Class[] PREFERED_CONSUMER_TYPES
          Types of data consumers, that should be prefered by DoubleSeqConsumer parent.
static java.lang.Class[] SUPPORTED_CONSUMER_TYPES
          Types of data consumers, that are supported by this multicaster.
 
Constructor Summary
DoubleSeqConsumerMulticaster()
          Creates a new DoubleConsumerMulticaster object.
DoubleSeqConsumerMulticaster(DoubleSeqConsumer delegate)
          Creates a new DoubleConsumerMulticaster object.
 
Method Summary
static DoubleSeqConsumer createDataConsumer(java.lang.Class type, DoubleSeqConsumer delegate)
          If multicaster supports type, new multicaster is created, otherwise nullis returned.
<D extends DataConsumer>
D
getDataConsumer(java.lang.Class<D> type)
           Returns data consumer for requested data consumer type.
 DataConsumer getDefaultDataConsumer()
          Returns the implementation of default consumer type supported by this data consumer.
 DoubleSeqConsumer getDelegate()
          Returns the consumer to which all call sare delegated.
 java.lang.String getName()
          Returns name of this data consumer.
 java.lang.String[] getSupportedCharacteristics()
          Resturns array with names of supported characteristics.
 java.lang.Class[] getSupportedConsumerTypes()
          Returns array of supported data consumer types, which can be used as parameter and returnned with getDataCosnumer(Class) method.
 void setCharacteristics(java.util.Map characteristics)
          Sets new dynamic value characteristics to this data consumer.
 void setDelegate(DoubleSeqConsumer delegate)
          Sets the consumer to which all call sare delegated.
 void updateDataState(DataState state)
          Push data state (quality) update change for dynamic value.
 void updateValue(long timestamp, double[] value)
          Notifys this consumer about new dynamic value update.
 void updateValue(long timestamp, long[] value)
          Notifys this consumer about new dynamic value update.
 void updateValue(long timestamp, java.lang.Object[] value)
          Notifys this consumer about new dynamic value update.
 void updateValue(long timestamp, java.lang.String[] value)
          Notifys this consumer about new dynamic value update.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUPPORTED_CONSUMER_TYPES

public static final java.lang.Class[] SUPPORTED_CONSUMER_TYPES
Types of data consumers, that are supported by this multicaster.


PREFERED_CONSUMER_TYPES

public static final java.lang.Class[] PREFERED_CONSUMER_TYPES
Types of data consumers, that should be prefered by DoubleSeqConsumer parent.

Constructor Detail

DoubleSeqConsumerMulticaster

public DoubleSeqConsumerMulticaster(DoubleSeqConsumer delegate)
Creates a new DoubleConsumerMulticaster object.

Parameters:
delegate - the consumer to which all call sare delegated

DoubleSeqConsumerMulticaster

public DoubleSeqConsumerMulticaster()
Creates a new DoubleConsumerMulticaster object.

Method Detail

createDataConsumer

public static final DoubleSeqConsumer createDataConsumer(java.lang.Class type,
                                                         DoubleSeqConsumer delegate)
If multicaster supports type, new multicaster is created, otherwise nullis returned.

Parameters:
type - the requested consumer type
delegate - the consumer to which all call sare delegated
Returns:
new multicaster if type is supported, otherwise null

getDelegate

public DoubleSeqConsumer getDelegate()
Returns the consumer to which all call sare delegated.

Returns:
the consumer to which all call sare delegated

setDelegate

public void setDelegate(DoubleSeqConsumer delegate)
Sets the consumer to which all call sare delegated.

Parameters:
delegate - the consumer to which all calls are delegated

updateValue

public void updateValue(long timestamp,
                        double[] value)
                 throws CommonException
Description copied from interface: DoubleSeqConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateValue in interface DoubleSeqConsumer
Parameters:
timestamp - the time of dynamic value event
value - new value
Throws:
CommonException

updateValue

public void updateValue(long timestamp,
                        long[] value)
                 throws CommonException
Description copied from interface: LongSeqConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateValue in interface LongSeqConsumer
Parameters:
timestamp - the time of dynamic value event
value - new value
Throws:
CommonException

getDefaultDataConsumer

public DataConsumer getDefaultDataConsumer()
Description copied from interface: DataConsumer
Returns the implementation of default consumer type supported by this data consumer.

Specified by:
getDefaultDataConsumer in interface DataConsumer
Returns:
the implementation of default consumer type supported by this data consumer

getName

public java.lang.String getName()
Description copied from interface: DataConsumer
Returns name of this data consumer.

Specified by:
getName in interface DataConsumer
Returns:
the name of this data consumer

setCharacteristics

public void setCharacteristics(java.util.Map characteristics)
Description copied from interface: DataConsumer
Sets new dynamic value characteristics to this data consumer. This is usually called only at initializaation, before first data state or value is updated. Usually carries characteristics such as value minimum or maximum. Name and meaning of atributes is defined with contract betwean data consumer and source implementation.

Specified by:
setCharacteristics in interface DataConsumer
Parameters:
characteristics - the Map with attri

updateDataState

public void updateDataState(DataState state)
Description copied from interface: DataConsumer
Push data state (quality) update change for dynamic value. Usually called by data source.

Specified by:
updateDataState in interface DataConsumer
Parameters:
state - new data state(quality) descriptor

updateValue

public void updateValue(long timestamp,
                        java.lang.String[] value)
                 throws CommonException
Description copied from interface: StringSeqConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateValue in interface StringSeqConsumer
Parameters:
timestamp - the time of dynamic value event
value - new value
Throws:
CommonException

updateValue

public void updateValue(long timestamp,
                        java.lang.Object[] value)
                 throws CommonException
Description copied from interface: ObjectSeqConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateValue in interface ObjectSeqConsumer
Parameters:
timestamp - the time of dynamic value event
value - new value
Throws:
CommonException

getSupportedCharacteristics

public java.lang.String[] getSupportedCharacteristics()
Description copied from interface: DataConsumer
Resturns array with names of supported characteristics. Data source can use this method to optimize setting characteristics to this data consumer. If arrray of length 0 is return, then consumer does not need or support any characteristic. If null is returned, than consumer expect all existing characteristics from data source.

Specified by:
getSupportedCharacteristics in interface DataConsumer
Returns:
array with names of supported characteristics

getSupportedConsumerTypes

public java.lang.Class[] getSupportedConsumerTypes()
Description copied from interface: DataConsumer
Returns array of supported data consumer types, which can be used as parameter and returnned with getDataCosnumer(Class) method.

Specified by:
getSupportedConsumerTypes in interface DataConsumer
Returns:
array of supported data consumer types

getDataConsumer

public <D extends DataConsumer> D getDataConsumer(java.lang.Class<D> type)
Description copied from interface: DataConsumer

Returns data consumer for requested data consumer type. If this data consumer does not support required data consumer, null is returned.

If this data cosnumer does not support specific data consumer type, then it means, that it is not desirable to cast data of that type to any by this consumer supported data consumer types.

Specified by:
getDataConsumer in interface DataConsumer
Parameters:
type - Class of specific data consumer (e.g. DoubleConsumer)
Returns:
implementation of required data consumer or null if not supported


Copyright © 2010. All Rights Reserved.