public DataItemInputCommon ( final DataItemInformation info ) { super ( info ); this.attributes = new AttributeManager ( this ); }
@Override public Map<String, Variant> getAttributes () { return this.attributes.get (); }
public void update ( final String name, final Variant value ) { final Map<String, Variant> updates = new HashMap<String, Variant> (); updates.put ( name, value ); update ( null, updates ); } }
protected Variant process ( Variant value ) { final Map<String, Variant> primaryAttributes = new HashMap<String, Variant> ( this.primaryAttributes ); for ( final ChainProcessEntry entry : getChainCopy () ) { if ( entry.getWhen ().contains ( IODirection.OUTPUT ) ) { final Variant newValue = entry.getWhat ().process ( value, primaryAttributes ); if ( newValue != null ) { value = newValue; } } } this.secondaryAttributes.set ( null, primaryAttributes ); return value; }
/** * Update the value of this data item * * @param value * the new value */ public synchronized void updateData ( Variant value, final Map<String, Variant> attributes, final AttributeMode mode ) { if ( this.value == null || !this.value.equals ( value ) ) { this.value = value; } else { value = null; } this.attributes.update ( value, attributes, mode ); }
@Override protected void process () { Variant newSecondaryValue = Variant.valueOf ( this.primaryValue ); final Map<String, Variant> newAttributes = new HashMap<String, Variant> ( this.primaryAttributes ); for ( final ChainProcessEntry entry : getChainCopy () ) { if ( entry.getWhen ().contains ( IODirection.INPUT ) ) { final Variant newValue = entry.getWhat ().process ( newSecondaryValue, newAttributes ); if ( newValue != null ) { newSecondaryValue = newValue; } } } Variant newValue = null; if ( !this.secondaryValue.equals ( newSecondaryValue ) ) { newValue = this.secondaryValue = Variant.valueOf ( newSecondaryValue ); } this.secondaryAttributes.set ( newValue, newAttributes ); }
@Override protected Map<String, Variant> getCacheAttributes () { return this.secondaryAttributes.get (); }
public DataItemInputCommon ( final String name ) { super ( name ); this.attributes = new AttributeManager ( this ); }
@Override public NotifyFuture<WriteAttributeResults> startSetAttributes ( final Map<String, Variant> attributes, final OperationParameters operationParameters ) { final WriteAttributeResults writeAttributeResults = new WriteAttributeResults (); this.attributes.update ( null, attributes ); for ( final Map.Entry<String, Variant> entry : attributes.entrySet () ) { writeAttributeResults.put ( entry.getKey (), WriteAttributeResult.OK ); } return new InstantFuture<WriteAttributeResults> ( writeAttributeResults ); }
@Override public Map<String, Variant> getAttributes () { return this.attributes.get (); }
public DataItemBaseChained ( final DataItemInformation dataItemInformation, final Executor executor ) { super ( dataItemInformation ); this.executor = executor; this.primaryAttributes = new HashMap<String, Variant> (); this.secondaryAttributes = new AttributeManager ( this ); }
@Override protected Map<String, Variant> getCacheAttributes () { return this.attributes.get (); }
protected MemoryDataItem ( final String name, final EnumSet<IODirection> ioDirection ) { super ( new DataItemInformationBase ( name, ioDirection ) ); this.attributes = new AttributeManager ( this ); }
@Override public Map<String, Variant> getAttributes () { return this.secondaryAttributes.get (); }
@Override protected Map<String, Variant> getCacheAttributes () { return this.attributes.get (); }