metricsOverlay.model.mappings
Class Mapping

java.lang.Object
  extended by metricsOverlay.model.mappings.Mapping
All Implemented Interfaces:
java.lang.Comparable<Mapping>, IEditable, INameable

public class Mapping
extends java.lang.Object
implements java.lang.Comparable<Mapping>, INameable, IEditable

This class provides a model implementation of a mapping. It holds two components, a metric and a augmentation and contains methods for interpolating between the two disjunct concepts.

Version:
2/9/2009
Author:
Matthew Harward

Constructor Summary
Mapping(java.lang.String name)
          Basic constructor.
Mapping(java.lang.String mappingName, boolean stubMapping)
          Basic constructor, can be used to create a stub mapping when little information on the mapping is know.
Mapping(java.lang.String name, Metric met, Augmentation aug, InterpolationStrategy iStrat, MappingState state, boolean editable)
          Full Constructor.
Mapping(java.lang.String mapName, java.lang.String augName, java.util.Map<java.lang.String,java.lang.String> properties)
          Deprecated. 
 
Method Summary
 void addPropertyValue(java.lang.String name, java.lang.String value)
          Deprecated. 
 boolean canChangeEditableStatus()
           
 boolean canEdit()
           
 void clearAugmentation()
          Clears an existing augmentation from this mapping.
 void clearMetric()
          Clears an existing metric from this mapping.
 int compareTo(Mapping o)
           
 Augmentation getAugmentation()
          Gets the current augmentation that is in use with this mapping.
 int getInterpolatedValue(java.lang.String value)
          This method takes whatever value has been provided to a metrics section and turns it into a value for use by the augmentation algorithm.
 InterpolationStrategy getInterpolationType()
          Gets the currently used interpolation strategy.
 MappingState getMappingState()
          Gets the current state of this mapping.
 Metric getMetric()
          Returns the metric currently belonging to this mapping.
 java.lang.String getName()
          Gets the set name of the mapping.
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          Deprecated. 
 java.lang.String getPropertyValue(java.lang.String name)
          Deprecated. 
 boolean isUsable()
          Determines if this metric is usable.
 void setAugmentation(Augmentation augmentation)
          Sets a particular augmentation to use with this mapping.
 void setEditable(boolean editable)
          If allowed, this sets the new editable status.
 void setInterpolationType(InterpolationStrategy is)
          Sets a new interpolation strategy.
 void setMappingState(MappingState state)
          Sets the current state of this mapping.
 void setMetric(Metric metric)
          Sets the metric to be used by this mapping algorithm.
 void setName(java.lang.String name)
          Sets the name of the mapping.
 java.lang.String toString()
          This toString method provides details of the mapping and the metric and augmentation it is comprised of.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Mapping

@Deprecated
public Mapping(java.lang.String mapName,
                          java.lang.String augName,
                          java.util.Map<java.lang.String,java.lang.String> properties)
Deprecated. 

Main constructor in initial development. Now deprecated.

Parameters:
mapName - the name of the mapping.
augName - the standard name for the augmentation
properties - a map describing a set of properties.

Mapping

public Mapping(java.lang.String mappingName,
               boolean stubMapping)
Basic constructor, can be used to create a stub mapping when little information on the mapping is know.

Parameters:
mappingName - the name of the mapping.
stubMapping - whether the mapping is a stub or not.

Mapping

public Mapping(java.lang.String name)
Basic constructor.

Parameters:
name - the name of the mapping.

Mapping

public Mapping(java.lang.String name,
               Metric met,
               Augmentation aug,
               InterpolationStrategy iStrat,
               MappingState state,
               boolean editable)
Full Constructor.

Parameters:
name - the name of the mapping.
Method Detail

getInterpolatedValue

public int getInterpolatedValue(java.lang.String value)
This method takes whatever value has been provided to a metrics section and turns it into a value for use by the augmentation algorithm.

Parameters:
value - the value stored by the metric section
Returns:
a interpolated value

getName

public java.lang.String getName()
Gets the set name of the mapping.

Specified by:
getName in interface INameable
Returns:
A String that is unique among this object type and provides a human readable title.

setName

public void setName(java.lang.String name)
Sets the name of the mapping.

Specified by:
setName in interface INameable
Parameters:
name - the unique name to be set.

getMappingState

public MappingState getMappingState()
Gets the current state of this mapping.


setMappingState

public void setMappingState(MappingState state)
Sets the current state of this mapping.

Parameters:
state - the new state.

getMetric

public Metric getMetric()
Returns the metric currently belonging to this mapping.

Returns:
the metric in use.

setMetric

public void setMetric(Metric metric)
Sets the metric to be used by this mapping algorithm.

Parameters:
metric - the metric to be used.

clearMetric

public void clearMetric()
Clears an existing metric from this mapping.


getAugmentation

public Augmentation getAugmentation()
Gets the current augmentation that is in use with this mapping. If no augmentation exists, this will return null.

Returns:
If it exists, the current augmentation, otherwise null.

setAugmentation

public void setAugmentation(Augmentation augmentation)
Sets a particular augmentation to use with this mapping.

Parameters:
augmentation - the augmentation to use.

clearAugmentation

public void clearAugmentation()
Clears an existing augmentation from this mapping.


getInterpolationType

public InterpolationStrategy getInterpolationType()
Gets the currently used interpolation strategy. Note, if an interpolation strategy does not exist a LinearIStrategy will be created by default.

Returns:
the current interpolation strategy.

setInterpolationType

public void setInterpolationType(InterpolationStrategy is)
Sets a new interpolation strategy.

Parameters:
is - the strategy to use.

canChangeEditableStatus

public boolean canChangeEditableStatus()
Specified by:
canChangeEditableStatus in interface IEditable
Returns:
A value to determine if the editable status may be changed.

canEdit

public boolean canEdit()
Specified by:
canEdit in interface IEditable
Returns:
A boolean value that determines if you are allowed to edit this class.

setEditable

public void setEditable(boolean editable)
Description copied from interface: IEditable
If allowed, this sets the new editable status.

Specified by:
setEditable in interface IEditable
Parameters:
editable - the new status.

isUsable

public boolean isUsable()
Determines if this metric is usable. A mapping is considered to be usable if it has a metric and an augmentation.

Returns:
true if usable, else false.

compareTo

public int compareTo(Mapping o)
Specified by:
compareTo in interface java.lang.Comparable<Mapping>

toString

public java.lang.String toString()
This toString method provides details of the mapping and the metric and augmentation it is comprised of.

Overrides:
toString in class java.lang.Object

getPropertyValue

@Deprecated
public java.lang.String getPropertyValue(java.lang.String name)
Deprecated. 

Gets the value of a property given a property name.

Parameters:
name - the name of the property to be located
Returns:
the value of the property, or null if it could not be located.

addPropertyValue

@Deprecated
public void addPropertyValue(java.lang.String name,
                                        java.lang.String value)
Deprecated. 

Adds a specific property name and value to the property table of this mapping.

Parameters:
name - the name of the property
value - the value of the property

getProperties

@Deprecated
public java.util.Map<java.lang.String,java.lang.String> getProperties()
Deprecated. 

Returns a modifiable map of properties for this mapping.

Returns:
a map of the properties.