metricsOverlay.model
Class MetricDocument

java.lang.Object
  extended by metricsOverlay.model.MetricDocument
All Implemented Interfaces:
java.lang.Comparable<MetricDocument>

public class MetricDocument
extends java.lang.Object
implements java.lang.Comparable<MetricDocument>

A metric document is a set of metric sets and there mappings, with a path that indicates the document they relate to. A metric document also includes a time stamp so its validity can be confirmed.

Version:
14/7/09
Author:
Matthew Harward

Constructor Summary
MetricDocument(org.eclipse.core.runtime.IPath fileName)
          Main constructor.
MetricDocument(java.lang.String fileName)
          Alternate constructor
 
Method Summary
 void addAugmentation(Augmentation augmentation)
           
 void addMapping(Mapping mapping)
           
 void addMetric(Metric met)
           
 int compareTo(MetricDocument o)
           
 void disableAllMappings()
           
 void enableAllMappings()
           
 java.util.Set<Augmentation> getAllAugmentations()
           
 java.util.Set<Mapping> getAllMappings()
           
 java.util.Set<Metric> getAllMetrics()
           
 Augmentation getAugmentation(java.lang.String displayName)
           
 org.eclipse.core.runtime.IPath getFileName()
           
 Mapping getMapping(java.lang.String mappingName)
           
 Metric getMetric(java.lang.String metricName)
           
 java.sql.Timestamp getTimeStamp()
           
 boolean isAugmentationNameUnique(java.lang.String name)
           
 boolean isMappingNameUnique(java.lang.String name)
           
 boolean isMetricNameUnique(java.lang.String name)
           
 int numActiveMappings()
           
 int numDeclaredMappings()
           
 int numDisplays()
           
 int numMappings()
          Counts the number of mappings that are not stubs.
 int numMetrics()
           
 void removeAugmentation(java.lang.String name)
           
 void removeMapping(java.lang.String name)
           
 void removeMetric(java.lang.String name)
           
 void setAllMappingState(MappingState mState)
           
 void setFileName(org.eclipse.core.runtime.IPath fileName)
          Sets the file name to a specific path
 void setFileNameFromString(java.lang.String fileName)
          Sets the new file name from a given string.
 void setTimeStamp(long timeInMillis)
          Sets the time stamp on this document to a particular system time
 void setTimeStamp(java.sql.Timestamp ts)
          Sets the time stamp on this document to a specific time.
 java.lang.String toString()
          Overriden toString method.
 void updateTimeStamp()
          Update the time stamp on this document to the current time.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MetricDocument

public MetricDocument(org.eclipse.core.runtime.IPath fileName)
Main constructor.

Parameters:
fileName - initialise the document with a specific path.

MetricDocument

public MetricDocument(java.lang.String fileName)
Alternate constructor

Parameters:
fileName - initialise the document with a string based path. This path needs to be in a standard path format.
Method Detail

updateTimeStamp

public void updateTimeStamp()
Update the time stamp on this document to the current time.


setTimeStamp

public void setTimeStamp(java.sql.Timestamp ts)
Sets the time stamp on this document to a specific time.

Parameters:
ts - the time stamp to be set

setTimeStamp

public void setTimeStamp(long timeInMillis)
Sets the time stamp on this document to a particular system time

Parameters:
timeInMillis - standard time in millis

getTimeStamp

public java.sql.Timestamp getTimeStamp()
Returns:
the current time stamp

getFileName

public org.eclipse.core.runtime.IPath getFileName()
Returns:
an IPath representing the documents current associated file.

setFileName

public void setFileName(org.eclipse.core.runtime.IPath fileName)
Sets the file name to a specific path

Parameters:
fileName - the new path

setFileNameFromString

public void setFileNameFromString(java.lang.String fileName)
Sets the new file name from a given string.

Parameters:
fileName - the new String in a path format

numMappings

public int numMappings()
Counts the number of mappings that are not stubs.

Returns:
the number of mappings (not including stubs)

numMetrics

public int numMetrics()

numDisplays

public int numDisplays()

numDeclaredMappings

public int numDeclaredMappings()
Returns:
returns the number of declared mappings (not including stubs)

numActiveMappings

public int numActiveMappings()
Returns:
returns the number of active mappings.

getAllMappings

public java.util.Set<Mapping> getAllMappings()
Returns:
an immutable set of mapped metrics.

getAllMetrics

public java.util.Set<Metric> getAllMetrics()

getAllAugmentations

public java.util.Set<Augmentation> getAllAugmentations()

toString

public java.lang.String toString()
Overriden toString method.

Overrides:
toString in class java.lang.Object

disableAllMappings

public void disableAllMappings()

enableAllMappings

public void enableAllMappings()

getMapping

public Mapping getMapping(java.lang.String mappingName)

getMetric

public Metric getMetric(java.lang.String metricName)

getAugmentation

public Augmentation getAugmentation(java.lang.String displayName)

addMapping

public void addMapping(Mapping mapping)

addMetric

public void addMetric(Metric met)

addAugmentation

public void addAugmentation(Augmentation augmentation)

isMappingNameUnique

public boolean isMappingNameUnique(java.lang.String name)

isAugmentationNameUnique

public boolean isAugmentationNameUnique(java.lang.String name)

isMetricNameUnique

public boolean isMetricNameUnique(java.lang.String name)

compareTo

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

setAllMappingState

public void setAllMappingState(MappingState mState)

removeAugmentation

public void removeAugmentation(java.lang.String name)

removeMapping

public void removeMapping(java.lang.String name)

removeMetric

public void removeMetric(java.lang.String name)