Package ru.ispras.fortress.solver
Class SolverBase
- java.lang.Object
-
- ru.ispras.fortress.solver.SolverBase
-
- All Implemented Interfaces:
Solver
- Direct Known Subclasses:
BoolectorSolver
,Cvc4Solver
,Z3Solver
public abstract class SolverBase extends java.lang.Object implements Solver
TheSolverBase
class implements basic functionality of solver representation.
-
-
Constructor Summary
Constructors Constructor Description SolverBase(java.lang.String name, java.lang.String description, java.util.Set<ConstraintKind> supportedKinds, boolean isGeneric, java.lang.String envVarName)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addCustomOperation(Function function)
Register a custom operation that extends the functionality of the solver.boolean
addCustomOperation(FunctionTemplate template)
Register a custom operation that extends the functionality of the solver.protected void
addStandardOperation(StandardOperation id, java.lang.String text)
java.lang.String
getDescription()
Returns the description of the solver.java.lang.String
getName()
Returns the name of the solver.java.util.Map<java.lang.Enum<?>,SolverOperation>
getOperations()
java.lang.String
getSolverPath()
Returns the path to the external solver executable used by the current solver object.boolean
isGeneric()
Returns true if the solver is generic and false if it is custom.boolean
isSupported(ConstraintKind kind)
Check whether the specified constraint kind is supported by the solver.void
setSolverPath(java.lang.String value)
Sets the path to the external solver executable used by the current solver object.protected void
supportedKindCheck(ConstraintKind kind)
-
-
-
Constructor Detail
-
SolverBase
public SolverBase(java.lang.String name, java.lang.String description, java.util.Set<ConstraintKind> supportedKinds, boolean isGeneric, java.lang.String envVarName)
Default constructor.- Parameters:
name
- The solver name.description
- The solver descriptor.supportedKinds
- The supported kinds of constraints.isGeneric
- The generic object flag.envVarName
- The name of environment variable.
-
-
Method Detail
-
supportedKindCheck
protected final void supportedKindCheck(ConstraintKind kind)
-
getName
public final java.lang.String getName()
Description copied from interface:Solver
Returns the name of the solver.
-
getDescription
public final java.lang.String getDescription()
Description copied from interface:Solver
Returns the description of the solver.- Specified by:
getDescription
in interfaceSolver
- Returns:
- solver description.
-
isSupported
public final boolean isSupported(ConstraintKind kind)
Description copied from interface:Solver
Check whether the specified constraint kind is supported by the solver.- Specified by:
isSupported
in interfaceSolver
- Parameters:
kind
- Constraint kind.- Returns:
- true if the constraint kind is supported or false otherwise.
-
isGeneric
public final boolean isGeneric()
Description copied from interface:Solver
Returns true if the solver is generic and false if it is custom.
-
getOperations
public final java.util.Map<java.lang.Enum<?>,SolverOperation> getOperations()
-
addCustomOperation
public final boolean addCustomOperation(Function function)
Description copied from interface:Solver
Register a custom operation that extends the functionality of the solver. The operation is implemented in terms of existing operations and represents a function.- Specified by:
addCustomOperation
in interfaceSolver
- Parameters:
function
- Object describing the semantics and syntax of the function.- Returns:
true
if no such operation has been previously registered orfalse
otherwise.
-
addCustomOperation
public final boolean addCustomOperation(FunctionTemplate template)
Description copied from interface:Solver
Register a custom operation that extends the functionality of the solver. The operation is implemented in terms of existing operation and represents a family of functions derived from the same template. Functions share the same logic, but may operate on different data types.- Specified by:
addCustomOperation
in interfaceSolver
- Parameters:
template
- Function template that describes the semantics and syntax of a family of similar functions.- Returns:
true
if no such operation has been previously registered orfalse
otherwise.
-
addStandardOperation
protected final void addStandardOperation(StandardOperation id, java.lang.String text)
-
getSolverPath
public java.lang.String getSolverPath()
Description copied from interface:Solver
Returns the path to the external solver executable used by the current solver object.- Specified by:
getSolverPath
in interfaceSolver
- Returns:
- Path
-
setSolverPath
public void setSolverPath(java.lang.String value)
Description copied from interface:Solver
Sets the path to the external solver executable used by the current solver object.- Specified by:
setSolverPath
in interfaceSolver
- Parameters:
value
- Path
-
-