edu.washington.cs.supple.render
Class Solution

java.lang.Object
  extended byedu.washington.cs.supple.render.Solution

public class Solution
extends java.lang.Object

Author:
kgajos This class is designed to carry the results of the interface building process. Given that we now keep adding new components to a rendered interface (shortcuts, etc), a single class for collecting all of this information is warranted

Field Summary
protected  float cost
           
protected  FactorStatistics factorStatistics
           
protected  java.lang.String message
           
protected  java.awt.Dimension originalSizeConstraint
           
protected  java.util.Collection shortcuts
           
protected  Widget staticInterface
           
protected  java.util.Hashtable widgets
           
 
Constructor Summary
Solution(Widget w)
           
Solution(Widget w, java.lang.String message)
           
 
Method Summary
 float getCost()
          returns the cost of this solution
 FactorStatistics getFactorStatistics()
           
 java.lang.String getMessage()
           
 java.awt.Dimension getOriginalSizeConstraint()
           
 java.util.Collection getShortcuts()
          returns the list of shortcuts generated for this solution
 Widget getStaticInterface()
           
 Widget getStaticWidgetFor(UiObject object)
          Returns a widget for a given UI Object
 boolean hasPrimitiveShortcuts()
          Checks if the solution contains any primitive shortcuts
 boolean hasStaticInterface()
          Checks if the static interface part of the solution is set
 boolean isEquivalent(Solution s, java.util.Collection ignoreList)
          Checks if the two solutions are equivalent (assigning the same widgets to the same ui objects; it will ignore differences to ui objects listed in the ignore list, though
protected  boolean isEquivalent(Widget root, java.util.Collection ignoreList)
           
 void setCost(float f)
          sets the cost of this solution
 void setFactorStatistics(FactorStatistics factorStatistics)
           
 void setMessage(java.lang.String message)
           
 void setOriginalSizeConstraint(java.awt.Dimension originalSizeConstraint)
           
 void setShortcuts(java.util.Collection collection)
          Sets the list of shortcuts for this solution
 void setStaticInterface(Widget widget)
           
 java.util.Enumeration staticWidgetEnumeration()
          Returns an enumeration (probably not serializable) that lets you iterate over all widgets in the static part of the interface
 java.lang.String toString()
           
protected  void updateMapping()
          updates the mapping from UiObjects to widgets
protected  void updateMappingHelper(Widget widget)
          recursively builds the mapping from ui objects to widgets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cost

protected float cost

originalSizeConstraint

protected java.awt.Dimension originalSizeConstraint

staticInterface

protected Widget staticInterface

shortcuts

protected java.util.Collection shortcuts

factorStatistics

protected FactorStatistics factorStatistics

widgets

protected java.util.Hashtable widgets

message

protected java.lang.String message
Constructor Detail

Solution

public Solution(Widget w)

Solution

public Solution(Widget w,
                java.lang.String message)
Method Detail

getStaticInterface

public Widget getStaticInterface()
Returns:
the root widget of the static part of the interface

setStaticInterface

public void setStaticInterface(Widget widget)
Parameters:
widget - the root widget of the static part of the interface

updateMapping

protected void updateMapping()
updates the mapping from UiObjects to widgets


updateMappingHelper

protected void updateMappingHelper(Widget widget)
recursively builds the mapping from ui objects to widgets

Parameters:
widget - root of the current sub tree

getStaticWidgetFor

public Widget getStaticWidgetFor(UiObject object)
Returns a widget for a given UI Object

Parameters:
object - the UI Object
Returns:
corresponding widget

staticWidgetEnumeration

public java.util.Enumeration staticWidgetEnumeration()
Returns an enumeration (probably not serializable) that lets you iterate over all widgets in the static part of the interface

Returns:

hasStaticInterface

public boolean hasStaticInterface()
Checks if the static interface part of the solution is set

Returns:
true if static part of the interface is set (not null); false otherwise

getCost

public float getCost()
returns the cost of this solution

Returns:
the cost of this solution

setCost

public void setCost(float f)
sets the cost of this solution

Parameters:
f - the cost of this solution

getShortcuts

public java.util.Collection getShortcuts()
returns the list of shortcuts generated for this solution

Returns:
the list of shortcuts generated for this solution

setShortcuts

public void setShortcuts(java.util.Collection collection)
Sets the list of shortcuts for this solution

Parameters:
collection - list of shortcuts for this solution

hasPrimitiveShortcuts

public boolean hasPrimitiveShortcuts()
Checks if the solution contains any primitive shortcuts

Returns:
true if primitive shortcuts are in the solutions, false otherwise

getFactorStatistics

public FactorStatistics getFactorStatistics()
Returns:
Returns the factorStatistics.

setFactorStatistics

public void setFactorStatistics(FactorStatistics factorStatistics)
Parameters:
factorStatistics - The factorStatistics to set.

getMessage

public java.lang.String getMessage()

setMessage

public void setMessage(java.lang.String message)

getOriginalSizeConstraint

public java.awt.Dimension getOriginalSizeConstraint()

setOriginalSizeConstraint

public void setOriginalSizeConstraint(java.awt.Dimension originalSizeConstraint)

isEquivalent

public boolean isEquivalent(Solution s,
                            java.util.Collection ignoreList)
Checks if the two solutions are equivalent (assigning the same widgets to the same ui objects; it will ignore differences to ui objects listed in the ignore list, though

Parameters:
s -
ignoreList -
Returns:

isEquivalent

protected boolean isEquivalent(Widget root,
                               java.util.Collection ignoreList)

toString

public java.lang.String toString()