Class SameObjectPredicateFactory
java.lang.Object
fr.inria.rules.integraal.model.logicalElements.factory.impl.SameObjectPredicateFactory
- All Implemented Interfaces:
fr.inria.rules.dlgpereader.builder.api.IPredicateFactory, PredicateFactory
This factory creates Predicates.
For each call at a same method with the same parameters, the same java object will be returned. Therefore, the equality test between those objects can be restricted to java object reference comparison (==). Please make sure the terms implementations used are immutable otherwise there could be unwanted side effects.
For each call at a same method with the same parameters, the same java object will be returned. Therefore, the equality test between those objects can be restricted to java object reference comparison (==). Please make sure the terms implementations used are immutable otherwise there could be unwanted side effects.
- Author:
- Florent Tornil
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a predicate factory with identity-based caching semantics. -
Method Summary
Modifier and TypeMethodDescriptioncreateOrGetFreshPredicate(int arity) Creates a new predicate which won't be equal to another previously created predicate.createOrGetPredicate(String label, int arity) //////////////////////////////////////////////booleanforgetPredicate(String label) Forgets a previously created (non fresh) predicate.getPredicate(String label) Gets a previously created predicate.static PredicateFactoryinstance()Returns the default instance of this factory.
-
Constructor Details
-
SameObjectPredicateFactory
public SameObjectPredicateFactory()Creates a predicate factory with identity-based caching semantics.
-
-
Method Details
-
instance
Returns the default instance of this factory.- Returns:
- the default instance of this factory
-
createOrGetPredicate
//////////////////////////////////////////////- Specified by:
createOrGetPredicatein interfacefr.inria.rules.dlgpereader.builder.api.IPredicateFactory- Specified by:
createOrGetPredicatein interfacePredicateFactory- Parameters:
label- the labelarity- the arity- Returns:
- a predicate with the given label and arity
-
createOrGetFreshPredicate
Description copied from interface:PredicateFactoryCreates a new predicate which won't be equal to another previously created predicate.
The label of the predicate may already exist in some rare cases- Specified by:
createOrGetFreshPredicatein interfacePredicateFactory- Parameters:
arity- the arity- Returns:
- a fresh predicate with the given label and arity
-
forgetPredicate
Description copied from interface:PredicateFactoryForgets a previously created (non fresh) predicate.
This predicate will no longer be considered as already existing in the factory.- Specified by:
forgetPredicatein interfacePredicateFactory- Parameters:
label- the label of the previously created predicate- Returns:
- true iff such a predicate already exists in the factory, and thus forgets it.
-
getPredicate
Description copied from interface:PredicateFactoryGets a previously created predicate.
This predicate will no longer be considered as already existing in the factory.- Specified by:
getPredicatein interfacePredicateFactory- Parameters:
label- the label of the previously created predicate- Returns:
- an optional that contains the predicate if there is one
-