DESY ACOP Beans Home

com.cosylab.gui.displayers
Class LongConsumerMulticaster

java.lang.Object
  extended by com.cosylab.gui.displayers.LongConsumerMulticaster
All Implemented Interfaces:
DataConsumer, DoubleConsumer, LongConsumer, NumberConsumer, ObjectConsumer, PatternConsumer, StringConsumer

public class LongConsumerMulticaster
extends java.lang.Object
implements DoubleConsumer, NumberConsumer, LongConsumer, StringConsumer, ObjectConsumer, PatternConsumer

LongConsumerMulticaster casts different data consumers to LongConsumer. ObjectConsumer cast must receive Number instances. Delegate must be set, before any other method can be used.

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

Field Summary
static java.lang.Class[] SUPPORTED_CONSUMER_TYPES
          Types of data consumers, that are supported by this multicaster.
 
Constructor Summary
LongConsumerMulticaster()
          Creates a new LongConsumerMulticaster object.
LongConsumerMulticaster(LongConsumer delegate)
          Creates a new LongConsumerMulticaster object.
 
Method Summary
static LongConsumer createDataConsumer(java.lang.Class type, LongConsumer delegate)
          If multicaster supports type, new multicaster is created, otherwise nullis returned.
 DataConsumer getDataConsumer(java.lang.Class type)
           Returns data consumer for requested data consumer type.
 DataConsumer getDefaultDataConsumer()
          Returns the implementation of default consumer type supported by this data consumer.
 LongConsumer 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(LongConsumer 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, java.util.BitSet value)
          Notifys this consumer about new dynamic value update.
 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.Number 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.

Constructor Detail

LongConsumerMulticaster

public LongConsumerMulticaster(LongConsumer delegate)
Creates a new LongConsumerMulticaster object.

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

LongConsumerMulticaster

public LongConsumerMulticaster()
Creates a new LongConsumerMulticaster object.

Method Detail

createDataConsumer

public static final LongConsumer createDataConsumer(java.lang.Class type,
                                                    LongConsumer 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 LongConsumer getDelegate()
Returns the consumer to which all call sare delegated.

Returns:
the consumer to which all call sare delegated

setDelegate

public void setDelegate(LongConsumer 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: DoubleConsumer
Notifys this consumer about new dynamic value update.

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

updateValue

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

Specified by:
updateValue in interface NumberConsumer
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: LongConsumer
Notifys this consumer about new dynamic value update.

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

getDataConsumer

public DataConsumer getDataConsumer(java.lang.Class 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

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: StringConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateValue in interface StringConsumer
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: ObjectConsumer
Notifys this consumer about new dynamic value update.

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

updateValue

public void updateValue(long timestamp,
                        java.util.BitSet value)
                 throws CommonException
Description copied from interface: PatternConsumer
Notifys this consumer about new dynamic value update.

Specified by:
updateValue in interface PatternConsumer
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


Copyright © 2010. All Rights Reserved.