SmartFrog 3.10.000

org.smartfrog.sfcore.reference
Class ApplyReference

java.lang.Object
  extended by org.smartfrog.sfcore.reference.Reference
      extended by org.smartfrog.sfcore.reference.ApplyReference
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Copying

public class ApplyReference
extends Reference
implements Copying, java.lang.Cloneable, java.io.Serializable

The subclass of Reference that is a function application. The structure of the classes is historical, in that function applications were added much later. A different structure would have been prefereable - an abstract class indicating some object that resolves in a context, with specializations that are link references and apply references. However unfortunately for backward compatility reasons this is not possible. Consequently ApplyReference impements the entire gamut of the reference behaviour, inlcuding having parts, which is not relevant to a function applicaiton. It should override these methods and generate some form of run-time exception - this has not been implemented.

The function application reference resolves by evaluating hte refeences it contains, then evaluating the funciton. If

See Also:
Serialized Form

Field Summary
protected  ComponentDescription comp
           
 
Fields inherited from class org.smartfrog.sfcore.reference.Reference
data, eager, inc, initCap, ref
 
Constructor Summary
ApplyReference(ComponentDescription comp)
           
 
Method Summary
 java.lang.Object clone()
          Makes a clone of the reference.
 java.lang.Object copy()
          Returns a copy of the reference, by cloning itself and the function part
 boolean equals(java.lang.Object ref)
          Checks if this and given reference are equal.
 int hashCode()
          Returns the hashcode for this reference.
 java.lang.Object resolve(ReferenceResolver rr, int index)
          Resolves this apply reference by applying the function - unless this is data..
 java.lang.Object resolve(RemoteReferenceResolver rr, int index)
          Resolves this apply reference by applying the function - unless this is data..
 java.lang.String toString()
          Returns string representation of the reference.
 
Methods inherited from class org.smartfrog.sfcore.reference.Reference
addElement, addElements, clone, elementAt, elements, firstElement, fromString, getData, getEager, lastElement, removeElement, setData, setEager, setElementAt, size
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

comp

protected ComponentDescription comp
Constructor Detail

ApplyReference

public ApplyReference(ComponentDescription comp)
Method Detail

copy

public java.lang.Object copy()
Returns a copy of the reference, by cloning itself and the function part

Specified by:
copy in interface Copying
Overrides:
copy in class Reference
Returns:
copy of reference
See Also:
Copying

clone

public java.lang.Object clone()
Makes a clone of the reference. The inside ref holder is cloned, but the contained component is NOT.

Specified by:
clone in interface Copying
Overrides:
clone in class Reference
Returns:
clone of reference

equals

public boolean equals(java.lang.Object ref)
Checks if this and given reference are equal. Two references are considered to be equal if the component they wrap are ==

Overrides:
equals in class Reference
Parameters:
ref - to be compared
Returns:
true if equal, false if not

hashCode

public int hashCode()
Returns the hashcode for this reference. Hash code for reference is made out of the sum of the parts hashcodes

Overrides:
hashCode in class Reference
Returns:
integer hashcode

resolve

public java.lang.Object resolve(ReferenceResolver rr,
                                int index)
                         throws SmartFrogResolutionException
Resolves this apply reference by applying the function - unless this is data..

Overrides:
resolve in class Reference
Parameters:
rr - ReferenceResolver to be used for resolving this reference
index - index of first referencepart to start resolving at
Returns:
value found on resolving this function
Throws:
SmartFrogResolutionException - if reference failed to resolve

resolve

public java.lang.Object resolve(RemoteReferenceResolver rr,
                                int index)
                         throws SmartFrogResolutionException
Resolves this apply reference by applying the function - unless this is data..

Overrides:
resolve in class Reference
Parameters:
rr - ReferenceResolver to be used for resolving this reference
index - index of first referencepart to start resolving at
Returns:
value found on resolving this function
Throws:
SmartFrogResolutionException - if reference failed to resolve

toString

public java.lang.String toString()
Returns string representation of the reference. Overrides Object.toString.

Overrides:
toString in class Reference
Returns:
String representing the reference

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP