Commit 44aba80d authored by Pietro Braghieri's avatar Pietro Braghieri

improve java documentation of tool functions

parent 91a05fdc
......@@ -48,36 +48,66 @@ public abstract class ToolFunction
protected File sessionWorkspaceDir;
public ToolFunction(String name)
protected ToolFunction(String name)
{
this.name = name;
init();
}
public String getName() {
/**
* Gets the name of the tool function
*
* @return the name
*/
public String getName()
{
return name;
}
/**
* Gets the tool name.
*
* @return the tool name
*/
public abstract String getToolName();
public String getResultFile() {
/**
* Gets the result file name
*
* @return the result file
*/
public String getResultFile()
{
return resultFile;
}
protected void setResultFile(String resultFile) {
protected void setResultFile(String resultFile)
{
this.resultFile = resultFile;
}
public File getSessionWorkspaceDir() {
/**
* Gets the session workspace dir.
*
* @return the session workspace dir
*/
public File getSessionWorkspaceDir()
{
return sessionWorkspaceDir;
}
public void setSessionWorkspaceDir(File sessionWorkspaceDir) {
/**
* Sets the session workspace dir.
*
* @param sessionWorkspaceDir the new session workspace dir
*/
public void setSessionWorkspaceDir(File sessionWorkspaceDir)
{
this.sessionWorkspaceDir = sessionWorkspaceDir;
}
public void init()
protected void init()
{
commands.clear();
timeStamp = new Date().getTime();
......@@ -86,6 +116,11 @@ public abstract class ToolFunction
setSessionWorkspaceDir(null);
}
/**
* Gets the tool commands as string.
*
* @return the commands as string
*/
public String getCommandsAsString()
{
prepareCommands();
......@@ -104,6 +139,11 @@ public abstract class ToolFunction
return buffer.toString();
}
/**
* Gets the tool commands.
*
* @return the commands
*/
public List<ToolCommand> getCommands()
{
prepareCommands();
......@@ -168,6 +208,11 @@ public abstract class ToolFunction
return buffer.toString();
}
/**
* Gets the tool function parameters.
*
* @return the list of parameters
*/
public List<ToolFunctionParameter> getParameters()
{
final List<ToolFunctionParameter> parameters = new ArrayList<ToolFunctionParameter>();
......@@ -177,6 +222,11 @@ public abstract class ToolFunction
return parameters;
}
/**
* Sets the tool function parameters.
*
* @param parameters the parameters
*/
public void setParameters(List<ToolFunctionParameter> parameters)
{
for( ToolFunctionParameter parameter : parameters )
......@@ -198,6 +248,11 @@ public abstract class ToolFunction
}
}
/**
* Validate the tool function parameters.
*
* @return true, if successful
*/
public boolean validateParameters()
{
return true;
......
......@@ -10,17 +10,38 @@
*******************************************************************************/
package eu.fbk.tools.adapter;
/**
* The Class ToolFunctionParameter.
*
* @author braghieri
*/
public class ToolFunctionParameter
{
public String name;
public String value;
public final String name;
public final String value;
public boolean isUri = false;
public ToolFunctionParameter(String name, String value) {
/**
* Instantiates a new tool function parameter.
*
* @param name the name of the parameter
* @param value the value of the parameter
*/
public ToolFunctionParameter(String name, String value)
{
this(name, value, false);
}
public ToolFunctionParameter(String name, String value, boolean isUri) {
/**
* Instantiates a new tool function parameter.
*
* @param name the name of the parameter
* @param value the value of the parameter
* @param isUri true if the parameter is an URI
*/
public ToolFunctionParameter(String name, String value, boolean isUri)
{
super();
this.name = name;
this.value = value;
......
......@@ -164,7 +164,7 @@ public abstract class ToolRunner
}
/**
* Sets the asynchronous execution.
* Sets the asynchronous execution (if supported)
*
* @param asynchronous the new asynchronous execution
*/
......@@ -174,11 +174,12 @@ public abstract class ToolRunner
}
/**
* Support asynchronous execution.
* Tells if asynchronous execution is supported
*
* @return true, if successful
*/
public boolean supportAsynchronousExecution() {
public boolean supportAsynchronousExecution()
{
return false;
}
......@@ -344,7 +345,7 @@ public abstract class ToolRunner
}
/**
* Test tool existence.
* Test the tool existence.
*
* @return true, if successful
*/
......@@ -360,7 +361,7 @@ public abstract class ToolRunner
}
/**
* Test tool execution permission.
* Test the tool execution permission.
*
* @return true, if successful
*/
......@@ -376,7 +377,7 @@ public abstract class ToolRunner
}
/**
* Test tool installation.
* Test the tool installation.
*
* @return true, if successful
*/
......
......@@ -46,6 +46,11 @@ public class CheckModel extends NuxmvFunction
this(null);
}
/**
* Instantiates the function for checking the behaviour model
*
* @param behaviourModel the behaviour model to check
*/
public CheckModel(URI behaviourModel)
{
super(FUNCTION_NAME);
......@@ -54,23 +59,48 @@ public class CheckModel extends NuxmvFunction
}
@Override
public String getToolName() {
public final String getToolName()
{
return TOOL_NAME;
}
public String getFormula() {
/**
* Gets the property expression to be validated.
*
* @return the formula
*/
public String getFormula()
{
return formula;
}
public void setFormula(String formula) {
/**
* Sets the property expression to be validated
*
* @param formula the new formula
*/
public void setFormula(String formula)
{
this.formula = formula;
}
public String getPropertyName() {
/**
* Gets the property name to be validated
*
* @return the property name
*/
public String getPropertyName()
{
return propertyName;
}
public void setPropertyName(String propertyName) {
/**
* Sets the property name to be validated
*
* @param propertyName the new property name
*/
public void setPropertyName(String propertyName)
{
this.propertyName = propertyName;
}
......@@ -231,7 +261,12 @@ public class CheckModel extends NuxmvFunction
}
}
public Set<String> getAdmittedChecks()
/**
* Gets the admitted checks.
*
* @return the admitted checks
*/
private Set<String> getAdmittedChecks()
{
final Set<String> set = new HashSet<String>();
......
......@@ -63,15 +63,26 @@ public abstract class NuxmvFunction extends ToolFunction
this(null);
}
public NuxmvFunction(String functionName)
protected NuxmvFunction(String functionName)
{
super(functionName);
}
public URI getBehaviourModel() {
/**
* Gets the behaviour model to be checked
*
* @return the behaviour model
*/
public URI getBehaviourModel()
{
return behaviourModel;
}
/**
* Sets the behaviour model to be checked
*
* @param behaviourModel the new behaviour model
*/
public void setBehaviourModel(URI behaviourModel)
{
if( behaviourModel != null && StringUtils.isBlank(behaviourModel.getScheme()) )
......@@ -84,27 +95,63 @@ public abstract class NuxmvFunction extends ToolFunction
}
}
public AlgorithmType getAlgorithmType() {
/**
* Gets the algorithm type.
*
* @return the algorithm type
*/
public AlgorithmType getAlgorithmType()
{
return algorithmType;
}
public void setAlgorithmType(AlgorithmType algorithmType) {
/**
* Sets the algorithm type.
*
* @param algorithmType the new algorithm type
*/
public void setAlgorithmType(AlgorithmType algorithmType)
{
this.algorithmType = algorithmType;
}
public CheckType getCheckType() {
/**
* Gets the check type.
*
* @return the check type
*/
public CheckType getCheckType()
{
return checkType;
}
public void setCheckType(CheckType checkType) {
/**
* Sets the check type.
*
* @param checkType the new check type
*/
public void setCheckType(CheckType checkType)
{
this.checkType = checkType;
}
public Integer getBoundLength() {
/**
* Gets the bound length.
*
* @return the bound length
*/
public Integer getBoundLength()
{
return boundLength;
}
public void setBoundLength(Integer boundLength) {
/**
* Sets the bound length.
*
* @param boundLength the new bound length
*/
public void setBoundLength(Integer boundLength)
{
this.boundLength = boundLength;
}
......
......@@ -23,6 +23,12 @@ import eu.fbk.tools.adapter.ToolRunner;
*/
public class NuxmvRunner extends ToolRunner
{
/**
* Instantiates a new nuxmv runner.
*
* @param executable the nuxmv tool executable path
*/
public NuxmvRunner(String executable)
{
super(NuxmvFunction.TOOL_NAME, executable);
......
......@@ -40,11 +40,20 @@ public class CheckContractCompositeImplementation extends OcraFunction
private Boolean skipRefinementCheck;
/**
* Instantiates the tool function for checking the contract composite implementation.
*/
public CheckContractCompositeImplementation()
{
this(null, null);
}
/**
* Instantiates the tool function for checking the contract composite implementation.
*
* @param contractModel the contract model
* @param componentsMapping the file of components mapping to their behavioral models
*/
public CheckContractCompositeImplementation(URI contractModel, URI componentsMapping)
{
super(FUNCTION_NAME);
......@@ -53,10 +62,21 @@ public class CheckContractCompositeImplementation extends OcraFunction
setComponentsMapping(componentsMapping);
}
public URI getComponentsMapping() {
/**
* Gets the file of components mapping to their behavioral models
*
* @return the components mapping
*/
public URI getComponentsMapping()
{
return componentsMapping;
}
/**
* Sets the components mapping file
*
* @param componentsMapping the new components mapping
*/
public void setComponentsMapping(URI componentsMapping)
{
if( componentsMapping != null && componentsMapping.getScheme() == null )
......@@ -69,19 +89,53 @@ public class CheckContractCompositeImplementation extends OcraFunction
}
}
public Boolean getOldSmvFormat() {
/**
* Checks if is old smv format.
*
* @return true, if is old smv format
*/
public boolean isOldSmvFormat()
{
return oldSmvFormat.booleanValue();
}
/**
* Gets the old smv format flag
*
* @return the old smv format
*/
public Boolean getOldSmvFormat()
{
return oldSmvFormat;
}
public void setOldSmvFormat(Boolean oldSmvFormat) {
/**
* Sets the old smv format flag
*
* @param oldSmvFormat the new old smv format
*/
public void setOldSmvFormat(Boolean oldSmvFormat)
{
this.oldSmvFormat = oldSmvFormat;
}
public Boolean getSkipRefinementCheck() {
/**
* Gets the skip refinement check flag
*
* @return the skip refinement check
*/
public Boolean getSkipRefinementCheck()
{
return skipRefinementCheck;
}
public void setSkipRefinementCheck(Boolean skipRefinementCheck) {
/**
* Sets the skip refinement check flag
*
* @param skipRefinementCheck the new skip refinement check
*/
public void setSkipRefinementCheck(Boolean skipRefinementCheck)
{
this.skipRefinementCheck = skipRefinementCheck;
}
......
......@@ -43,11 +43,20 @@ public class CheckContractImplementation extends OcraFunction
private Boolean oldSmvFormat;
/**
* Instantiates the tool function for checking the contract implementation.
*/
public CheckContractImplementation()
{
this(null, null);
}
/**
* Instantiates the tool function for checking the contract implementation.
*
* @param contractModel the contract model
* @param behaviourModel the behaviour model
*/
public CheckContractImplementation(URI contractModel, URI behaviourModel)
{
super(FUNCTION_NAME);
......@@ -56,14 +65,31 @@ public class CheckContractImplementation extends OcraFunction
setBehaviourModel(behaviourModel);
}
public String getComponentName() {
/**
* Gets the component name.
*
* @return the component name
*/
public String getComponentName()
{
return componentName;
}
public void setComponentName(String componentName) {
/**
* Sets the component name.
*
* @param componentName the new component name
*/
public void setComponentName(String componentName)
{
this.componentName = componentName;
}
/**
* Sets the behaviour model
*
* @param behaviourModel the new behaviour model
*/
public void setBehaviourModel(URI behaviourModel)
{
if( behaviourModel != null && StringUtils.isBlank(behaviourModel.getScheme()) )
......@@ -76,28 +102,69 @@ public class CheckContractImplementation extends OcraFunction
}
}
public URI getBehaviourModel() {
/**
* Gets the behaviour model.
*
* @return the behaviour model
*/
public URI getBehaviourModel()
{
return behaviourModel;
}
public String getContractName() {
/**
* Gets the contract name.
*
* @return the contract name
*/
public String getContractName()
{
return contractName;
}