org.simantics.databoard.accessor.impl
Class ChangeSet

java.lang.Object
  extended by org.simantics.databoard.accessor.impl.ChangeSet
All Implemented Interfaces:
Accessor.Listener

public class ChangeSet
extends java.lang.Object
implements Accessor.Listener

ChangeSet is a collection of a modification events. ChangeSet can be applied to an accessor, or captured from an accessor. To capture a change set add the ChangeSet instance as a listener to the accessor. ChangeSet does not capture non-modification events.

Author:
Toni Kalajainen
See Also:
ModificationEvent

Field Summary
 java.util.List<Event> events
           
 
Constructor Summary
ChangeSet()
           
 
Method Summary
 void addEvent(Event event)
           
 void addEvents(java.util.Collection<Event> events)
           
 void clear()
           
 java.util.List<Event> getAndClearEvents()
          Returns events and clears change set.
 java.util.List<Event> getEvents()
          Get a snapshot of events.
 boolean isEmpty()
           
 void onEvents(java.util.Collection<Event> events)
          Notify the listener on a new event
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

events

public java.util.List<Event> events
Constructor Detail

ChangeSet

public ChangeSet()
Method Detail

addEvent

public void addEvent(Event event)

addEvents

public void addEvents(java.util.Collection<Event> events)

getAndClearEvents

public java.util.List<Event> getAndClearEvents()
Returns events and clears change set.

Returns:
the list of events

isEmpty

public boolean isEmpty()

getEvents

public java.util.List<Event> getEvents()
Get a snapshot of events.

Returns:
a copy of events

onEvents

public void onEvents(java.util.Collection<Event> events)
Description copied from interface: Accessor.Listener
Notify the listener on a new event

Specified by:
onEvents in interface Accessor.Listener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clear

public void clear()