Class UpdatableMemoryCellObserverAdapter
java.lang.Object
dev.zemco.codegame.presentation.execution.UpdatableMemoryCellObserverAdapter
- All Implemented Interfaces:
IMemoryCellObserver
Adapts existing
memory cell by observing its value when manually requested
using the updateValue() method.
Value updates are listenable to through the value property.- Author:
- Erik Zemčík
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.value.ObservableObjectValue<Integer>Property indicating last value of the observedmemory cell. -
Constructor Summary
ConstructorsConstructorDescriptionUpdatableMemoryCellObserverAdapter(int address, IMemoryCell memoryCell) Creates an instance ofUpdatableMemoryCellObserverAdapteradapting and observing an existingmemory cell. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the address of the targetmemory cellwithin the executionmemory.voidObserves the current value of the adaptedmemory celland notifies its listeners via thevalueProperty()if the value has changed.javafx.beans.value.ObservableObjectValue<Integer>Property indicating last value of the observedmemory cell.
-
Property Details
-
value
- Specified by:
valuePropertyin interfaceIMemoryCellObserver
-
-
Constructor Details
-
UpdatableMemoryCellObserverAdapter
Creates an instance ofUpdatableMemoryCellObserverAdapteradapting and observing an existingmemory cell.- Parameters:
address- address of the target memory cell within the execution memorymemoryCell- memory cell to adapt and observe- Throws:
IllegalArgumentException- ifaddressis not a positive integer or ifmemoryCellisnull
-
-
Method Details
-
updateValue
public void updateValue()Observes the current value of the adaptedmemory celland notifies its listeners via thevalueProperty()if the value has changed. -
getAddress
public int getAddress()Description copied from interface:IMemoryCellObserverReturns the address of the targetmemory cellwithin the executionmemory.- Specified by:
getAddressin interfaceIMemoryCellObserver- Returns:
- address of the
memory cell
-
valueProperty
Description copied from interface:IMemoryCellObserverProperty indicating last value of the observedmemory cell. This property will emit the observed value once the observer observes a change. This property may holdnullwhen the observedmemory cellholds no value.- Specified by:
valuePropertyin interfaceIMemoryCellObserver
-