edu.washington.cs.supple.render
Class AbstractFactoredCostFunction

java.lang.Object
  extended byedu.washington.cs.supple.render.AbstractFactoredCostFunction
All Implemented Interfaces:
java.lang.Cloneable, FactoredCostFunction, java.io.Serializable
Direct Known Subclasses:
BlankFactoredCostFunction, DavesFactoredCostFunction, DesktopFactoredCostFunction, JingJingsFactoredCostFunction

public abstract class AbstractFactoredCostFunction
extends java.lang.Object
implements FactoredCostFunction, java.lang.Cloneable, java.io.Serializable

Author:
kgajos Abstract implementation of the factored cost function
See Also:
Serialized Form

Field Summary
protected  java.util.ArrayList factors
           
protected  java.util.Hashtable lookup
           
protected  Trace trace
           
 
Constructor Summary
AbstractFactoredCostFunction(Trace trace)
           
 
Method Summary
 java.lang.Object clone()
           
 Factor getFactorByName(java.lang.String name)
          Lets you retrieve a factor by its name
 java.util.Collection getFactors()
          Returns all factors
 java.util.Collection getFactors(java.util.Collection widgets)
          Returns relevant factors
 java.util.Collection getFactors(SuppleType type, UiObject uiObject, java.util.Collection descriptors)
          Returns relevant factors
 java.util.Collection getFactors(SuppleType type, UiObject uiObject, WidgetDescriptor descriptor)
          Returns relevant factors
 java.util.Collection getFactors(Widget widget)
          Returns relevant factors
protected abstract  void init()
          Initializes the cost function (to be overriden by children)
 java.lang.String prettyPrint()
           
 void setState(FactoredCostFunctionState state)
           
protected  void updateLookupTable()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factors

protected java.util.ArrayList factors

lookup

protected java.util.Hashtable lookup

trace

protected Trace trace
Constructor Detail

AbstractFactoredCostFunction

public AbstractFactoredCostFunction(Trace trace)
Method Detail

init

protected abstract void init()
Initializes the cost function (to be overriden by children)


getFactors

public java.util.Collection getFactors()
Description copied from interface: FactoredCostFunction
Returns all factors

Specified by:
getFactors in interface FactoredCostFunction

getFactors

public java.util.Collection getFactors(java.util.Collection widgets)
Description copied from interface: FactoredCostFunction
Returns relevant factors

Specified by:
getFactors in interface FactoredCostFunction
Parameters:
widgets - a collection of widgets for which we want to find factors

getFactors

public java.util.Collection getFactors(SuppleType type,
                                       UiObject uiObject,
                                       java.util.Collection descriptors)
Description copied from interface: FactoredCostFunction
Returns relevant factors

Specified by:
getFactors in interface FactoredCostFunction
Parameters:
type -
uiObject -
descriptors - a collection of widget descriptors for which we want to find factors (all descriptors are for widgets for the same ui object)
Returns:

getFactors

public java.util.Collection getFactors(Widget widget)
Description copied from interface: FactoredCostFunction
Returns relevant factors

Specified by:
getFactors in interface FactoredCostFunction
Parameters:
widget - a widget for which we want to find factors

getFactors

public java.util.Collection getFactors(SuppleType type,
                                       UiObject uiObject,
                                       WidgetDescriptor descriptor)
Description copied from interface: FactoredCostFunction
Returns relevant factors

Specified by:
getFactors in interface FactoredCostFunction
Parameters:
type -
uiObject -
descriptor - descriptor of a widget for which we want to find factors
Returns:

getFactorByName

public Factor getFactorByName(java.lang.String name)
Description copied from interface: FactoredCostFunction
Lets you retrieve a factor by its name

Specified by:
getFactorByName in interface FactoredCostFunction
Parameters:
name - factor's name
Returns:
factor (or null, if none found by this name)

setState

public void setState(FactoredCostFunctionState state)
Specified by:
setState in interface FactoredCostFunction

updateLookupTable

protected void updateLookupTable()

clone

public java.lang.Object clone()
Specified by:
clone in interface FactoredCostFunction

prettyPrint

public java.lang.String prettyPrint()
Specified by:
prettyPrint in interface FactoredCostFunction