metricsOverlay.augmentationStrategies
Class AugmentationStrategy

java.lang.Object
  extended by metricsOverlay.augmentationStrategies.AugmentationStrategy
Direct Known Subclasses:
BgLineStrategy, BgSectionStrategy, ForcedDisplayStrategy, MarginBarStrategy, MarginChipStrategy, MarginIconStrategy, UnderlineStrategy

public abstract class AugmentationStrategy
extends java.lang.Object

This abstract class provides the required methods for a display strategy.

Version:
26/8/2009
Author:
Matthew Harward

Constructor Summary
AugmentationStrategy()
           
 
Method Summary
abstract  void dispose()
          Subclasses should override this method
 boolean isActive()
          Returns whether the display strategy is active or not.
static org.eclipse.swt.graphics.Color parseColor(java.lang.String val)
          This method takes in a string and parses it into an SWT compatible colour.
 void setActive(boolean active)
          Sets this display strategy as active.
 void update(MetricFile mf, Mapping mm)
          This class updates the display strategy, it should be overriden by subclasses.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AugmentationStrategy

public AugmentationStrategy()
Method Detail

update

public void update(MetricFile mf,
                   Mapping mm)
This class updates the display strategy, it should be overriden by subclasses. super must be called at the start if the method

Parameters:
mf - the metric file describing the current file and the metrics to be applied.
mm - the name of the current mapping this display strategy belongs to.

setActive

public void setActive(boolean active)
Sets this display strategy as active.

Parameters:
active - if true, the display strategy is set to active, else inactive.

isActive

public boolean isActive()
Returns whether the display strategy is active or not.

Returns:
true if active, else false.

parseColor

public static org.eclipse.swt.graphics.Color parseColor(java.lang.String val)
This method takes in a string and parses it into an SWT compatible colour. The input string should take the form of {255, 255, 255}. This method is flexible enough to take any input string, as long as it contains 3 separate numbers of between 0-255. If the number provided is not separated, each section will be greedily assumed to be 3 digits in length, i.e. "245211001232349" will produce Color {245, 211, 1}. This means that this method is able to parse the toString method of org.eclipse.swt.graphics.Color

Parameters:
val - the entered string
Returns:
the parsed colour if successful, or null

dispose

public abstract void dispose()
Subclasses should override this method