facets.util
Interface Stateful

All Superinterfaces:
java.io.Serializable, Titled
All Known Implementing Classes:
AvatarViewWorks, DataNode, ExceptionNode, FileNode, HtmlContent, HtmlView, ListView, PlaneViewWorks, SelectionView, StatefulCore, TableView, TextTreeView, TextView, TreeView, TypedNode, ValueNode, ZoomPanViewWorks

public interface Stateful
extends java.io.Serializable, Titled

Has state that can be set, copied and checked for deep equality.

Stateful encapsulates management of an object whose state may change, defining methods for


Method Summary
 Stateful copyState()
          Create a copy of the Stateful.
 void setState(java.lang.Object src)
          Set state based on src.
 boolean stateEquals(Stateful s)
          Does the other Stateful have the same state?
 java.lang.Object stateStamp()
          Return a value guaranteeing that any instance with the same value has the same state.
 java.lang.Object updateStateStamp()
          Create a new value for return by stateStamp().
 
Methods inherited from interface facets.util.Titled
title
 

Method Detail

setState

void setState(java.lang.Object src)
Set state based on src.

Parameters:
src - must be non-null and interpretable by the implementation as state information; it will usually be another instance of the Stateful's class.

copyState

Stateful copyState()
Create a copy of the Stateful.

Return one of:


stateEquals

boolean stateEquals(Stateful s)
Does the other Stateful have the same state?

Allows deep checking to be implemented where doing so in Object.equals(Object) is too expensive.

Parameters:
s - to compare

updateStateStamp

java.lang.Object updateStateStamp()
Create a new value for return by stateStamp().

Returns:
the new value

stateStamp

java.lang.Object stateStamp()
Return a value guaranteeing that any instance with the same value has the same state.