facets.core.superficial
Class SIndexing

java.lang.Object
  extended by facets.util.Tracer
      extended by facets.core.superficial.TargetCore
          extended by facets.core.superficial.SIndexing
All Implemented Interfaces:
Notifiable, Notifying, STarget, TargeterCore.TargetType, Identified, Titled

public final class SIndexing
extends TargetCore

STarget representing one or more indices into a list of items.

SIndexing represents a list of items to be exposed to user view and control in the surface, together with an index/indices into that list; application-specific mechanism and policy can be defined in a SIndexing.Coupler.


Nested Class Summary
static class SIndexing.Coupler
          Connects an SIndexing to the application.
 
Nested classes/interfaces inherited from interface facets.core.superficial.STarget
STarget.Targeted
 
Nested classes/interfaces inherited from interface facets.core.superficial.Notifying
Notifying.Impact
 
Field Summary
 SIndexing.Coupler coupler
          The Indexing.Coupler passed to the core constructor.
static java.lang.Object[] NO_INDEXABLES
          Allows an indexing to be functionally empty.
 
Fields inherited from class facets.core.superficial.TargetCore
targets
 
Fields inherited from interface facets.core.superficial.STarget
NONE
 
Constructor Summary
  SIndexing(java.lang.String title, java.lang.Object[] indexables, int index, SIndexing.Coupler coupler)
          Convenience constructor setting initial index.
  SIndexing(java.lang.String title, java.lang.Object[] indexables, java.lang.Object toIndex, SIndexing.Coupler coupler)
          Convenience constructor setting initial indexed.
protected SIndexing(java.lang.String title, java.lang.Object[] indexables, SIndexing.Coupler coupler)
          Core constructor.
  SIndexing(java.lang.String title, SIndexing.Coupler coupler)
          Convenience constructor forcing dynamic read of indexables.
 
Method Summary
protected  boolean blockNotification()
          Enables notification to be restricted to this member of the tree.
 java.lang.Object identity()
          Return an object that is as far as possible unique for the implementation.
 Notifying.Impact impact()
          Allows this Notifying to specify a default Notifying.Impact.
 int index()
          The first index into the indexables.
 java.lang.Object[] indexables()
          The items exposed to indexing.
 java.lang.Object indexed()
          The item denoted by the current index.
 java.lang.Object[] indexings()
          The indexables ordered by most recently indexed.
 int[] indices()
          The indices last set into the indexables.
 Notifiable monitor()
          The current Notifiable in the notification tree, as set with setMonitor.
protected  TypedNode[] newDebugChildren()
          Create a TypedNode[] representation of this Notifying for debug purposes.
protected static TypedNode newDebugContentNode(java.lang.String title, java.lang.Object source)
           
protected static TypedNode newDebugContentNode(java.lang.String title, java.lang.Object[] source)
           
protected static TypedNode newDebugMonitorNode(Notifiable monitor)
           
static SIndexing newDefault(java.lang.String title, java.lang.Object[] indexables, int index)
          Creates an indexing with a default coupler.
 TypedNode newGraphNode()
          Returns a descriptive node for use in debug object graph.
 void notify(Notice notice)
          Respond to the Notice passed.
 void notifyMonitor(Notifying.Impact impact)
          Call notify on the parent monitor in the notification tree, typically with itself as parameter to the Notice passed.
 void setIndex(int index)
          Sets a single index into the indexables.
 void setIndexed(java.lang.Object toSet)
          Sets the index to that of the item passed.
 void setIndices(int[] indices)
          Sets indices into the indexables.
 void setMonitor(Notifiable monitor)
          Attach the Notifying to a Notifiable parent in the notification tree.
 java.lang.String toString()
           
 
Methods inherited from class facets.core.superficial.TargetCore
elements, findMonitorOfType, isLive, join, lazyElements, newTargeter, notifiesTargeter, setElements, setLive, title, wantsFocus
 
Methods inherited from class facets.util.Tracer
trace, trace, trace, trace, trace, traceDebug, traceDebug, traceObjectText, traceOutput, traceOutputWithClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface facets.core.superficial.Notifying
impact, monitor, notifyMonitor, setMonitor
 
Methods inherited from interface facets.core.superficial.Notifiable
notify
 

Field Detail

NO_INDEXABLES

public static final java.lang.Object[] NO_INDEXABLES
Allows an indexing to be functionally empty.


coupler

public final SIndexing.Coupler coupler
The Indexing.Coupler passed to the core constructor.

Constructor Detail

SIndexing

protected SIndexing(java.lang.String title,
                    java.lang.Object[] indexables,
                    SIndexing.Coupler coupler)
Core constructor.

Declared visibly for documentation purposes only.

Parameters:
title - passed to superclass
indexables - the objects to be indexed; may not be empty but may be null in which case they are read dynamically from the coupler
coupler - supplies application-specific mechanism and policy

SIndexing

public SIndexing(java.lang.String title,
                 java.lang.Object[] indexables,
                 int index,
                 SIndexing.Coupler coupler)
Convenience constructor setting initial index.

Parameters:
index - the initial index

SIndexing

public SIndexing(java.lang.String title,
                 java.lang.Object[] indexables,
                 java.lang.Object toIndex,
                 SIndexing.Coupler coupler)
Convenience constructor setting initial indexed.

Parameters:
toIndex - the object to have the initial index

SIndexing

public SIndexing(java.lang.String title,
                 SIndexing.Coupler coupler)
Convenience constructor forcing dynamic read of indexables.

Method Detail

index

public int index()
The first index into the indexables.


indices

public int[] indices()
The indices last set into the indexables.


setIndexed

public void setIndexed(java.lang.Object toSet)
Sets the index to that of the item passed.

Complains if the item is not a member of indexables.


indexables

public java.lang.Object[] indexables()
The items exposed to indexing.

These will either have been set during construction or be read dynamically from the coupler.


setIndex

public void setIndex(int index)
Sets a single index into the indexables.


setIndices

public void setIndices(int[] indices)
Sets indices into the indexables.

Parameters:
indices - may be empty but may not be null

indexed

public java.lang.Object indexed()
The item denoted by the current index.


indexings

public java.lang.Object[] indexings()
The indexables ordered by most recently indexed.


toString

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

newDebugChildren

protected TypedNode[] newDebugChildren()
Create a TypedNode[] representation of this Notifying for debug purposes.

Overrides:
newDebugChildren in class TargetCore

newDefault

public static SIndexing newDefault(java.lang.String title,
                                   java.lang.Object[] indexables,
                                   int index)
Creates an indexing with a default coupler.

Parameters:
title - passed to core constructor
indexables - passed to core constructor
index - passed to setIndex(int)

newDebugContentNode

protected static final TypedNode newDebugContentNode(java.lang.String title,
                                                     java.lang.Object source)

newDebugContentNode

protected static final TypedNode newDebugContentNode(java.lang.String title,
                                                     java.lang.Object[] source)

newDebugMonitorNode

protected static final TypedNode newDebugMonitorNode(Notifiable monitor)

newGraphNode

public final TypedNode newGraphNode()
Returns a descriptive node for use in debug object graph.


impact

public Notifying.Impact impact()
Description copied from interface: Notifying
Allows this Notifying to specify a default Notifying.Impact.

Specified by:
impact in interface Notifying
Returns:
typically Notifying.Impact.DEFAULT

identity

public java.lang.Object identity()
Description copied from interface: Identified
Return an object that is as far as possible unique for the implementation.

This will usually be a class instance counter.

Specified by:
identity in interface Identified

monitor

public final Notifiable monitor()
The current Notifiable in the notification tree, as set with setMonitor.

Complains if no parent has been set.

Specified by:
monitor in interface Notifying

notify

public void notify(Notice notice)
Description copied from interface: Notifiable
Respond to the Notice passed.

When this method is called, the Notifiable should respond based on

Specified by:
notify in interface Notifiable

notifyMonitor

public final void notifyMonitor(Notifying.Impact impact)
Description copied from interface: Notifying
Call notify on the parent monitor in the notification tree, typically with itself as parameter to the Notice passed.

Has no effect if no monitor has been set.

This is the usual means to trigger a surface retargeting, being called by an exposing SFacet on its target.

Specified by:
notifyMonitor in interface Notifying
Parameters:
impact - suggests the level of retargeting required

blockNotification

protected boolean blockNotification()
Enables notification to be restricted to this member of the tree.

Checked by notify(Notice); default returns false.


setMonitor

public final void setMonitor(Notifiable monitor)
Description copied from interface: Notifying
Attach the Notifying to a Notifiable parent in the notification tree.

Specified by:
setMonitor in interface Notifying