www.sdmetrics.com

sdmetrics.app
Class ProjectSettings

java.lang.Object
  |
  +--sdmetrics.app.ProjectSettings

public class ProjectSettings
extends java.lang.Object

Class to store project settings for XMI and XML source files, filter settings. This class has methods to set and get the URIs for the project files, whether to use default project files, and the filter settings.

To calculate a set of metrics, create an instance of this class, fill its fields with the file(s) and filter settings you want to process, and pass it to a Controller object. The class has methods to instruct the controller to


Constructor Summary
ProjectSettings()
          Constructor.
ProjectSettings(sdmetrics.util.MyParameters ap)
          Read project settings from persistent application parameters.
 
Method Summary
 java.lang.String getCustomProjectFileConfig()
          Return the name of the custom project file configuration to use.
 java.lang.String[] getFilters()
          Return the list of design element filters.
 java.lang.String getMetaModel()
          Return the URI of the metamodel definition file to use.
 java.lang.String getMetricsFile()
          Return the URI of the metrics definition file to use.
 java.lang.String getRuleFilterString()
          Obtain the design rule filter string for design rule checking.
 java.lang.String getXMISource()
          Return the URI of the XMI source file to analyze.
 java.lang.String getXMITrans()
          Return the URI of the XMI transformation file to use.
 boolean inCalculation()
          Return the flag indicating if links to rejected elements (not shown in the output) should be taken into account during metric calculation.
 void inCalculation(boolean b)
          Set the flag indicating if links to rejected elements (not shown in the output) should be taken into account during metric calculation.
 boolean isFilterEnabled()
          Return the flag indicating if the filter mechanism is enabled or disabled.
 boolean keepMatching()
          Return the flag indicating if elements matching a filter should be kept in the data output, or if only elements not matching any filters should be included in the output.
 void keepMatching(boolean b)
          Determines which elements are to be included in the output.
 void loadFromFile(java.lang.String filename)
          Load project settings from a file created with the SDMetrics GUI.
 void requireDesignRules()
          Request the design rules to be checked.
 void requireMetrics()
          Request the metrics to be pre-calculated.
 void requireRelMatrices()
          Request the relation matrices to be calculated.
 boolean requiresDesignRules()
          Determine if checking of design rules is required.
 boolean requiresMetrics()
          Determine if pre-calculation of metric is required.
 boolean requiresRelMatrices()
          Determine if calculation of the relation matrices is required.
 void resetMeasurementRequirements()
          Reset the measurement requirements.
 void saveToFile(java.lang.String filename)
          Save project settings to a file.
 void setDesignRuleFilter(java.lang.String s)
          Set the design rule filter for the design rule checking.
 void setFilterEnabled(boolean b)
          Set the flag indicating if the filter mechanism is enabled or disabled.
 void setFilters(java.lang.String[] s)
          Set the list of element filters to apply.
 void setMetaModel(java.lang.String s)
          Set the URI of the metamodel definition file to use.
 void setMetricsFile(java.lang.String s)
          Set the URI of the metrics definition file to use.
 void setProjectFileConfig(java.lang.String s)
          Set the name of the project file configuration entry to use.
 void setUseCustomProjectFiles(boolean b)
          Set flag indicating if a custom project files entry should be used.
 void setXMISource(java.lang.String s)
          Set the URI of the XMI source file to analyze.
 void setXMITrans(java.lang.String s)
          Set the URI of the XMI transformation file to use.
 boolean useCustomProjectFile()
          Return the flag indicating if the default project file configuration
 boolean useMetaDefault()
          Return the flag indicating if the default metamodel definition file should be used.
 void useMetaDefault(boolean b)
          Set flag indicating if the default metamodel definition file should be used.
 boolean useMetricsDefault()
          Return the flag indicating if the default metric definition file should be used.
 void useMetricsDefault(boolean b)
          Set flag indicating if the default metrics definition file should be used.
 boolean useTransDefault()
          Return the flag indicating if the default XMI transformation file should be used.
 void useTransDefault(boolean b)
          Set flag indicating if the default XMI transformation file should be used.
 void writeProjectSettings(sdmetrics.util.MyParameters ap)
          Write project settings to persistent application parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectSettings

public ProjectSettings()
Constructor.


ProjectSettings

public ProjectSettings(sdmetrics.util.MyParameters ap)
Read project settings from persistent application parameters.

Parameters:
ap - The application parameters.
Method Detail

writeProjectSettings

public void writeProjectSettings(sdmetrics.util.MyParameters ap)
Write project settings to persistent application parameters.

Parameters:
ap - The application parameters.

getCustomProjectFileConfig

public java.lang.String getCustomProjectFileConfig()
Return the name of the custom project file configuration to use.

Returns:
Name of the custom project file configuration to use.

useCustomProjectFile

public boolean useCustomProjectFile()
Return the flag indicating if the default project file configuration

Returns:
true if the default project file configuration should be used.

getXMISource

public java.lang.String getXMISource()
Return the URI of the XMI source file to analyze.

Returns:
URI of the XMI source file.

getMetaModel

public java.lang.String getMetaModel()
Return the URI of the metamodel definition file to use.

Returns:
URI of the custom metamodel definition file.

getMetricsFile

public java.lang.String getMetricsFile()
Return the URI of the metrics definition file to use.

Returns:
URI of the custom metrics definition file.

getXMITrans

public java.lang.String getXMITrans()
Return the URI of the XMI transformation file to use.

Returns:
URI of the custom XMI transformation file to use.

useMetricsDefault

public boolean useMetricsDefault()
Return the flag indicating if the default metric definition file should be used.

Returns:
true if the default metric definition should be used.

useMetaDefault

public boolean useMetaDefault()
Return the flag indicating if the default metamodel definition file should be used.

Returns:
true if the default metamodel definition file should be used.

useTransDefault

public boolean useTransDefault()
Return the flag indicating if the default XMI transformation file should be used.

Returns:
true if the default XMI transformation file should be used.

getFilters

public java.lang.String[] getFilters()
Return the list of design element filters.

Returns:
String array with the filter strings.

keepMatching

public boolean keepMatching()
Return the flag indicating if elements matching a filter should be kept in the data output, or if only elements not matching any filters should be included in the output.

Returns:
true if only matching elements are to be included in the output, false if only non-matching elements are to be included in the output.

isFilterEnabled

public boolean isFilterEnabled()
Return the flag indicating if the filter mechanism is enabled or disabled.

Returns:
true if filter is enabled, else false.

inCalculation

public boolean inCalculation()
Return the flag indicating if links to rejected elements (not shown in the output) should be taken into account during metric calculation.

Returns:
true if links to rejected elements are to be taken into account during metric calculation, false if links to rejected elements are to be ignored.

setProjectFileConfig

public void setProjectFileConfig(java.lang.String s)
Set the name of the project file configuration entry to use.

Parameters:
s - Name of the custom project file configuration.

setXMISource

public void setXMISource(java.lang.String s)
Set the URI of the XMI source file to analyze.

Parameters:
s - URI of the XMI source file to analyze.

setMetaModel

public void setMetaModel(java.lang.String s)
Set the URI of the metamodel definition file to use.

Parameters:
s - URI of the custom metamodel definition file.

setMetricsFile

public void setMetricsFile(java.lang.String s)
Set the URI of the metrics definition file to use.

Parameters:
s - URI of the custom metrics definition file.

setXMITrans

public void setXMITrans(java.lang.String s)
Set the URI of the XMI transformation file to use.

Parameters:
s - URI of the custom XMI transformation file.

setUseCustomProjectFiles

public void setUseCustomProjectFiles(boolean b)
Set flag indicating if a custom project files entry should be used.

Parameters:
b - true to use the custom project files entry, false to automatically determine a project file entry to use.

useMetricsDefault

public void useMetricsDefault(boolean b)
Set flag indicating if the default metrics definition file should be used.

Parameters:
b - true to use the default metrics definition file, false to use the custom metrics definition file.

useMetaDefault

public void useMetaDefault(boolean b)
Set flag indicating if the default metamodel definition file should be used.

Parameters:
b - true to use the default metrics definition file, false to use the custom metrics definition file.

useTransDefault

public void useTransDefault(boolean b)
Set flag indicating if the default XMI transformation file should be used.

Parameters:
b - true to use the default metrics definition file, false to use the custom metrics definition file.

setFilters

public void setFilters(java.lang.String[] s)
Set the list of element filters to apply.

Parameters:
s - Array of filter strings.

keepMatching

public void keepMatching(boolean b)
Determines which elements are to be included in the output.

Parameters:
b - true if only elements matching at least one of the filter strings are to be included in the output, false if only elements not matching any filter strings are to be included in the output.

setFilterEnabled

public void setFilterEnabled(boolean b)
Set the flag indicating if the filter mechanism is enabled or disabled.

Parameters:
b - true to enable filter mechanism.

inCalculation

public void inCalculation(boolean b)
Set the flag indicating if links to rejected elements (not shown in the output) should be taken into account during metric calculation.

Parameters:
b - true if rejected elements are to be taken into account during metric calculation.

resetMeasurementRequirements

public void resetMeasurementRequirements()
Reset the measurement requirements.


requiresMetrics

public boolean requiresMetrics()
Determine if pre-calculation of metric is required.

Returns:
true if metrics are to be pre-calculated, else false

requiresDesignRules

public boolean requiresDesignRules()
Determine if checking of design rules is required.

Returns:
true if design rules are to be checked, else false

requiresRelMatrices

public boolean requiresRelMatrices()
Determine if calculation of the relation matrices is required.

Returns:
true if relation matrices are to be calculated, else false

requireMetrics

public void requireMetrics()
Request the metrics to be pre-calculated.


requireDesignRules

public void requireDesignRules()
Request the design rules to be checked.


requireRelMatrices

public void requireRelMatrices()
Request the relation matrices to be calculated.


setDesignRuleFilter

public void setDesignRuleFilter(java.lang.String s)
Set the design rule filter for the design rule checking.

Parameters:
s - The design rule filter string.

getRuleFilterString

public java.lang.String getRuleFilterString()
Obtain the design rule filter string for design rule checking.

Returns:
The design rule filter string.

saveToFile

public void saveToFile(java.lang.String filename)
                throws java.io.FileNotFoundException
Save project settings to a file.

Parameters:
filename - URI of the file to save the settings to.
Throws:
java.io.FileNotFoundException - The file could not be opened for writing.

loadFromFile

public void loadFromFile(java.lang.String filename)
                  throws java.io.IOException
Load project settings from a file created with the SDMetrics GUI.

Parameters:
filename - of the file to load the settings from.
Throws:
java.io.IOException - The file was not found or corrupt.

www.sdmetrics.com