edu.washington.cs.supple.render
Class DefaultSimilarityCostFunction

java.lang.Object
  extended byedu.washington.cs.supple.render.DefaultSimilarityCostFunction
All Implemented Interfaces:
SimilarityCostFunction

public class DefaultSimilarityCostFunction
extends java.lang.Object
implements SimilarityCostFunction

Author:
anthonyw To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code and Comments

Field Summary
protected  float dataLayoutWeight
           
protected  float dataTypeWeight
           
static float DEFAULT_VAR_WEIGHT
           
protected  float domainRangeWeight
           
protected  float orientationWeight
           
protected  float relativeAlignmentWeight
           
protected  float sizeFlexibilityWeight
           
protected  float visualContextChangeWeight
           
 
Constructor Summary
DefaultSimilarityCostFunction()
          Default Constructor
DefaultSimilarityCostFunction(float commonWeights)
          Partially-Customizable Constructor
DefaultSimilarityCostFunction(float orientationWeight, float dataLayoutWeight, float domainRangeWeight, float dataTypeWeight, float sizeFlexibilityWeight, float relativeAlignmentWeight, float visualContextChangeWeight)
          Fully Weighted Customizable Constructor
 
Method Summary
protected static float abs(float value)
           
 float getDataLayoutWeight()
           
 float getDataTypeWeight()
           
 float getDomainRangeWeight()
           
 float getOrientationWeight()
           
 float getRelativeAlignmentWeight()
           
 float getSimilarityCost(RenderedUi ui, Widget widget)
          Gives the cost for a widget based on the similarity to a reference rendering.
 float getSimilarityCost(RenderedUi ui, WidgetProperties properties)
           
 Matrix getSimilarityCostMatrix(RenderedUi ui, WidgetProperties properties)
           
 Matrix getSimilarityCostMatrixHelper(WidgetProperties wp1, WidgetProperties wp2)
          Helper for similarity cost function, returns a matrix instead of the sum
 float getSizeFlexibilityWeight()
           
 float getVisualContextChangeWeight()
           
 void setBasicWidgetWeight(float orientationWeight, float dataLayoutWeight, float domainRangeWeight, float dataTypeWeight, float sizeFlexibilityWeight)
          Manually set or reset the basic widget property weights after initialization of object
 void setContainerWidgetWeight(float orientationWeight, float relativeAlignmentWeight, float visualContextChangeWeight)
          Manually set or reset the container widget property weights after initialization of object
 void setDataLayoutWeight(float dataLayoutWeight)
           
 void setDataTypeWeight(float dataTypeWeight)
           
 void setDomainRangeWeight(float domainRangeWeight)
           
 void setOrientationWeight(float orientationWeight)
           
 void setRelativeAlignmentWeight(float relativeAlignmentWeight)
           
 void setSizeFlexibilityWeight(float sizeFlexibilityWeight)
           
 void setVisualContextChangeWeight(float visualContextChangeWeight)
           
protected  void setWeightHelper(float orientationWeight, float dataLayoutWeight, float domainRangeWeight, float dataTypeWeight, float sizeFlexibilityWeight, float relativeAlignmentWeight, float visualContextChangeWeight)
          Constructor Helper
protected  float similarityCostHelper(WidgetProperties wp1, WidgetProperties wp2)
          Helper for similarity cost function
 java.lang.String toString()
          String representation of this similarity cost function
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_VAR_WEIGHT

public static final float DEFAULT_VAR_WEIGHT
See Also:
Constant Field Values

orientationWeight

protected float orientationWeight

dataLayoutWeight

protected float dataLayoutWeight

domainRangeWeight

protected float domainRangeWeight

dataTypeWeight

protected float dataTypeWeight

sizeFlexibilityWeight

protected float sizeFlexibilityWeight

relativeAlignmentWeight

protected float relativeAlignmentWeight

visualContextChangeWeight

protected float visualContextChangeWeight
Constructor Detail

DefaultSimilarityCostFunction

public DefaultSimilarityCostFunction()
Default Constructor


DefaultSimilarityCostFunction

public DefaultSimilarityCostFunction(float commonWeights)
Partially-Customizable Constructor


DefaultSimilarityCostFunction

public DefaultSimilarityCostFunction(float orientationWeight,
                                     float dataLayoutWeight,
                                     float domainRangeWeight,
                                     float dataTypeWeight,
                                     float sizeFlexibilityWeight,
                                     float relativeAlignmentWeight,
                                     float visualContextChangeWeight)
Fully Weighted Customizable Constructor

Parameters:
orientationWeight -
dataLayoutWeight -
domainRangeWeight -
dataTypeWeight -
sizeFlexibilityWeight -
Method Detail

setBasicWidgetWeight

public void setBasicWidgetWeight(float orientationWeight,
                                 float dataLayoutWeight,
                                 float domainRangeWeight,
                                 float dataTypeWeight,
                                 float sizeFlexibilityWeight)
Manually set or reset the basic widget property weights after initialization of object

Specified by:
setBasicWidgetWeight in interface SimilarityCostFunction
Parameters:
orientationWeight -
dataLayoutWeight -
domainRangeWeight -
dataTypeWeight -
sizeFlexibilityWeight -

setContainerWidgetWeight

public void setContainerWidgetWeight(float orientationWeight,
                                     float relativeAlignmentWeight,
                                     float visualContextChangeWeight)
Manually set or reset the container widget property weights after initialization of object

Specified by:
setContainerWidgetWeight in interface SimilarityCostFunction
Parameters:
orientationWeight -
relativeAlignmentWeight -
visualContextChangeWeight -

setWeightHelper

protected void setWeightHelper(float orientationWeight,
                               float dataLayoutWeight,
                               float domainRangeWeight,
                               float dataTypeWeight,
                               float sizeFlexibilityWeight,
                               float relativeAlignmentWeight,
                               float visualContextChangeWeight)
Constructor Helper

Parameters:
orientationWeight -
dataLayoutWeight -
domainRangeWeight -
dataTypeWeight -
sizeFlexibilityWeight -

getSimilarityCost

public float getSimilarityCost(RenderedUi ui,
                               WidgetProperties properties)
Specified by:
getSimilarityCost in interface SimilarityCostFunction
Returns:
the similarity cost between the widget and its match in ui

getSimilarityCost

public float getSimilarityCost(RenderedUi ui,
                               Widget widget)
Description copied from interface: SimilarityCostFunction
Gives the cost for a widget based on the similarity to a reference rendering. If the reference rendering is null or inappropriate (for different UI), this method returns 0.

Specified by:
getSimilarityCost in interface SimilarityCostFunction
Parameters:
ui - reference rendering
widget - the widget to be evaluated
Returns:
the similarity cost between the widget and its match in ui

similarityCostHelper

protected float similarityCostHelper(WidgetProperties wp1,
                                     WidgetProperties wp2)
Helper for similarity cost function


getSimilarityCostMatrix

public Matrix getSimilarityCostMatrix(RenderedUi ui,
                                      WidgetProperties properties)
Returns:
the similarity cost matrix between the widget and its match in ui

getSimilarityCostMatrixHelper

public Matrix getSimilarityCostMatrixHelper(WidgetProperties wp1,
                                            WidgetProperties wp2)
Helper for similarity cost function, returns a matrix instead of the sum

Returns:
1 by k matrix containing the unweights differences of two widgets in the UIs

abs

protected static float abs(float value)

getDataLayoutWeight

public float getDataLayoutWeight()
Returns:
Returns the dataLayoutWeight.

setDataLayoutWeight

public void setDataLayoutWeight(float dataLayoutWeight)
Parameters:
dataLayoutWeight - The dataLayoutWeight to set.

getDataTypeWeight

public float getDataTypeWeight()
Returns:
Returns the dataTypeWeight.

setDataTypeWeight

public void setDataTypeWeight(float dataTypeWeight)
Parameters:
dataTypeWeight - The dataTypeWeight to set.

getDomainRangeWeight

public float getDomainRangeWeight()
Returns:
Returns the domainRangeWeight.

setDomainRangeWeight

public void setDomainRangeWeight(float domainRangeWeight)
Parameters:
domainRangeWeight - The domainRangeWeight to set.

getOrientationWeight

public float getOrientationWeight()
Returns:
Returns the orientationWeight.

setOrientationWeight

public void setOrientationWeight(float orientationWeight)
Parameters:
orientationWeight - The orientationWeight to set.

getSizeFlexibilityWeight

public float getSizeFlexibilityWeight()
Returns:
Returns the sizeFlexibilityWeight.

setSizeFlexibilityWeight

public void setSizeFlexibilityWeight(float sizeFlexibilityWeight)
Parameters:
sizeFlexibilityWeight - The sizeFlexibilityWeight to set.

getRelativeAlignmentWeight

public float getRelativeAlignmentWeight()
Returns:
Returns the relativeAlignmentWeight.

setRelativeAlignmentWeight

public void setRelativeAlignmentWeight(float relativeAlignmentWeight)
Parameters:
relativeAlignmentWeight - The relativeAlignmentWeight to set.

getVisualContextChangeWeight

public float getVisualContextChangeWeight()
Returns:
Returns the visualContextChangeWeight.

setVisualContextChangeWeight

public void setVisualContextChangeWeight(float visualContextChangeWeight)
Parameters:
visualContextChangeWeight - The visualContextChangeWeight to set.

toString

public java.lang.String toString()
String representation of this similarity cost function