Class AbstractIndexBasedConstraintConverter
- java.lang.Object
-
- de.rwth.swc.coffee4j.engine.converter.constraints.AbstractIndexBasedConstraintConverter
-
- All Implemented Interfaces:
IndexBasedConstraintConverter
- Direct Known Subclasses:
SimpleCartesianProductConstraintConverter
,TupleBasedConstraintConverter
public abstract class AbstractIndexBasedConstraintConverter extends Object implements IndexBasedConstraintConverter
Abstract class providing functionality and fields commonly used by all different types of converters.
-
-
Constructor Summary
Constructors Constructor Description AbstractIndexBasedConstraintConverter(List<Parameter> parameters)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TupleList
convert(Constraint constraint, int lastId)
Converts the constraint to aTupleList
by using the index based schema explained inModelConverter
.List<TupleList>
convert(List<Constraint> constraints, int lastId)
Converts all constraints toTupleList
s by using the index based schema explained inModelConverter
.protected abstract TupleList
convertedConstraint(Constraint constraint, it.unimi.dsi.fastutil.objects.Object2IntMap<String> parameterIdMap, it.unimi.dsi.fastutil.ints.Int2ObjectMap<Parameter> idToParameterMap, int id)
template method implemented by sub-classes to convert the givenConstraint
into aTupleList
.
-
-
-
Method Detail
-
convert
public List<TupleList> convert(List<Constraint> constraints, int lastId)
Description copied from interface:IndexBasedConstraintConverter
Converts all constraints toTupleList
s by using the index based schema explained inModelConverter
. The constraints need to be converted in order.- Specified by:
convert
in interfaceIndexBasedConstraintConverter
- Parameters:
constraints
- allConstraint
s which need to be converted. Must not benull
but can be emptylastId
- last id that has been assigned.- Returns:
- the converted constraints in the same order as the given constraints
-
convert
public TupleList convert(Constraint constraint, int lastId)
Description copied from interface:IndexBasedConstraintConverter
Converts the constraint to aTupleList
by using the index based schema explained inModelConverter
.- Specified by:
convert
in interfaceIndexBasedConstraintConverter
- Parameters:
constraint
-Constraint
that needs to be converted. Must not benull
.lastId
- last id that has been assigned.- Returns:
- the converted
Constraint
.
-
convertedConstraint
protected abstract TupleList convertedConstraint(Constraint constraint, it.unimi.dsi.fastutil.objects.Object2IntMap<String> parameterIdMap, it.unimi.dsi.fastutil.ints.Int2ObjectMap<Parameter> idToParameterMap, int id)
template method implemented by sub-classes to convert the givenConstraint
into aTupleList
.- Parameters:
constraint
- constraint to be converted.parameterIdMap
- map from parameter name to Id.idToParameterMap
- map from Id toParameter
.id
- id to assign.- Returns:
- converted constraint.
-
-