Package io.keikai.doc.collab.utils
Class YEvent
- java.lang.Object
-
- io.keikai.doc.collab.utils.YEvent
-
- Direct Known Subclasses:
YArrayEvent,YMapEvent,YTextEvent,YXmlEvent
public class YEvent extends java.lang.ObjectYEvent describes the changes on a YType.
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractType_currentTargetThe current target on which the observe callback is called.protected AbstractType_targetThe type on which this event was created on.protected Transaction_transactionThe transaction that triggered this event.static java.lang.StringERROR_COMPUTE_CHANGES
-
Constructor Summary
Constructors Constructor Description YEvent(AbstractType target, Transaction transaction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadds(AbstractStruct struct)Check if a struct is added by this event.booleandeletes(AbstractStruct struct)Check if a struct is deleted by this event.ChangesgetChanges()Get the changes made in this event.java.util.Map<java.lang.String,Change>getKeys()Get the changes made to the keys of this event's target.java.util.List<java.lang.Object>getPath()Computes the path from the YType to the changed type.AbstractTypegetTarget()TransactiongetTransaction()voidsetCurrentTarget(AbstractType currentTarget)voidsetPath(java.util.List<java.lang.Object> path)
-
-
-
Field Detail
-
ERROR_COMPUTE_CHANGES
public static final java.lang.String ERROR_COMPUTE_CHANGES
- See Also:
- Constant Field Values
-
_target
protected final AbstractType _target
The type on which this event was created on.
-
_currentTarget
protected AbstractType _currentTarget
The current target on which the observe callback is called.
-
_transaction
protected final Transaction _transaction
The transaction that triggered this event.
-
-
Constructor Detail
-
YEvent
public YEvent(AbstractType target, Transaction transaction)
-
-
Method Detail
-
getTarget
public AbstractType getTarget()
-
setCurrentTarget
public void setCurrentTarget(AbstractType currentTarget)
-
getTransaction
public Transaction getTransaction()
-
getPath
public java.util.List<java.lang.Object> getPath()
Computes the path from the YType to the changed type.- Returns:
- The path from the root type to the target.
-
setPath
public void setPath(java.util.List<java.lang.Object> path)
-
deletes
public boolean deletes(AbstractStruct struct)
Check if a struct is deleted by this event.- Parameters:
struct- The struct to check.- Returns:
- True if the struct is deleted, false otherwise.
-
adds
public boolean adds(AbstractStruct struct)
Check if a struct is added by this event.- Parameters:
struct- The struct to check.- Returns:
- True if the struct is added, false otherwise.
-
getKeys
public java.util.Map<java.lang.String,Change> getKeys()
Get the changes made to the keys of this event's target.- Returns:
- A map of the changes made to the keys.
-
getChanges
public Changes getChanges()
Get the changes made in this event.- Returns:
- The changes made.
-
-