mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-09 10:50:42 +00:00
Step Factories
This commit is contained in:
parent
a7bcf15c99
commit
aadddee628
47
src/main/java/edu/kit/typicalc/model/step/StepFactory.java
Normal file
47
src/main/java/edu/kit/typicalc/model/step/StepFactory.java
Normal file
@ -0,0 +1,47 @@
|
||||
package edu.kit.typicalc.model.step;
|
||||
|
||||
import edu.kit.typicalc.model.Conclusion;
|
||||
import edu.kit.typicalc.model.Constraint;
|
||||
import edu.kit.typicalc.model.type.TypeAbstraction;
|
||||
|
||||
/**
|
||||
* A factory to create InferenceStep objects of a specific subclass
|
||||
*/
|
||||
public interface StepFactory {
|
||||
/**
|
||||
* Creates an AbsStep.
|
||||
* @param premise the premise of this step
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created AbsStep
|
||||
*/
|
||||
AbsStep createAbsStep(InferenceStep premise, Conclusion conclusion, Constraint constraint);
|
||||
|
||||
/**
|
||||
* Creates an AppStep.
|
||||
* @param premise1 the first premise of this step
|
||||
* @param premise2 the second premise of this step
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created AppStep
|
||||
*/
|
||||
AppStep createAppStep(InferenceStep premise1, InferenceStep premise2,
|
||||
Conclusion conclusion, Constraint constraint);
|
||||
/**
|
||||
* Creates an ConstStep.
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created ConstStep
|
||||
*/
|
||||
ConstStep createConstStep(Conclusion conclusion, Constraint constraint);
|
||||
/**
|
||||
* Creates a VarStep.
|
||||
* @param typeAbstraction the type abstraction of this step
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created AbsStep
|
||||
*/
|
||||
VarStep createVarStep(TypeAbstraction typeAbstraction, Conclusion conclusion,
|
||||
Constraint constraint);
|
||||
//TODO LetStep
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package edu.kit.typicalc.model.step;
|
||||
|
||||
import edu.kit.typicalc.model.Conclusion;
|
||||
import edu.kit.typicalc.model.Constraint;
|
||||
import edu.kit.typicalc.model.type.TypeAbstraction;
|
||||
|
||||
/**
|
||||
* A factory to create InferenceStep objects when let polymorphism is not used.
|
||||
*/
|
||||
public class StepFactoryDefault implements StepFactory {
|
||||
/**
|
||||
* Creates an AbsStepDefault.
|
||||
* @param premise the premise of this step
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created AbsStepDefault
|
||||
*/
|
||||
public AbsStepDefault createAbsStep(InferenceStep premise, Conclusion conclusion, Constraint constraint) {
|
||||
return new AbsStepDefault(premise, conclusion, constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an AppStepDefault.
|
||||
* @param premise1 the first premise of this step
|
||||
* @param premise2 the second premise of this step
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created AppStepDefault
|
||||
*/
|
||||
public AppStepDefault createAppStep(InferenceStep premise1, InferenceStep premise2,
|
||||
Conclusion conclusion, Constraint constraint) {
|
||||
return new AppStepDefault(premise1, premise2, conclusion, constraint);
|
||||
}
|
||||
/**
|
||||
* Creates an ConstStepDefault.
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created ConstStepDefault
|
||||
*/
|
||||
public ConstStepDefault createConstStep(Conclusion conclusion, Constraint constraint) {
|
||||
return new ConstStepDefault(conclusion, constraint);
|
||||
}
|
||||
/**
|
||||
* Creates a VarStepDefault.
|
||||
* @param typeAbstraction the type abstraction of this step
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created AbsStepDefault
|
||||
*/
|
||||
public VarStepDefault createVarStep(TypeAbstraction typeAbstraction, Conclusion conclusion,
|
||||
Constraint constraint) {
|
||||
return new VarStepDefault(typeAbstraction, conclusion, constraint);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package edu.kit.typicalc.model.step;
|
||||
|
||||
import edu.kit.typicalc.model.Conclusion;
|
||||
import edu.kit.typicalc.model.Constraint;
|
||||
import edu.kit.typicalc.model.type.TypeAbstraction;
|
||||
|
||||
/**
|
||||
* A factory to create InferenceStep objects when let polymorphism is used.
|
||||
*/
|
||||
public class StepFactoryWithLet implements StepFactory {
|
||||
/**
|
||||
* Creates an AbsStepWithLet.
|
||||
* @param premise the premise of this step
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created AbsStepWithLet
|
||||
*/
|
||||
public AbsStepWithLet createAbsStep(InferenceStep premise, Conclusion conclusion, Constraint constraint) {
|
||||
return new AbsStepWithLet(premise, conclusion, constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an AppStepDefault.
|
||||
* @param premise1 the first premise of this step
|
||||
* @param premise2 the second premise of this step
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created AppStepDefault
|
||||
*/
|
||||
public AppStepDefault createAppStep(InferenceStep premise1, InferenceStep premise2,
|
||||
Conclusion conclusion, Constraint constraint) {
|
||||
return new AppStepDefault(premise1, premise2, conclusion, constraint);
|
||||
}
|
||||
/**
|
||||
* Creates an ConstStepDefault.
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created ConstStepDefault
|
||||
*/
|
||||
public ConstStepDefault createConstStep(Conclusion conclusion, Constraint constraint) {
|
||||
return new ConstStepDefault(conclusion, constraint);
|
||||
}
|
||||
/**
|
||||
* Creates a VarStepWithLet.
|
||||
* @param typeAbstraction the type abstraction of this step
|
||||
* @param conclusion the conclusion of this step
|
||||
* @param constraint the constraint that can be derived from this step
|
||||
* @return the created VarStepWithLet
|
||||
*/
|
||||
public VarStepWithLet createVarStep(TypeAbstraction typeAbstraction, Conclusion conclusion,
|
||||
Constraint constraint) {
|
||||
return new VarStepWithLet(typeAbstraction, conclusion, constraint);
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ public abstract class VarStep extends InferenceStep {
|
||||
* @param constraint the constraint added in this step
|
||||
* @param typeAbstractionInPremise the type abstraction in the premise of this step
|
||||
*/
|
||||
protected VarStep(Conclusion conclusion, Constraint constraint, TypeAbstraction typeAbstractionInPremise) {
|
||||
protected VarStep(TypeAbstraction typeAbstractionInPremise, Conclusion conclusion, Constraint constraint) {
|
||||
super(conclusion, constraint);
|
||||
this.typeAbstractionInPremise = typeAbstractionInPremise;
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ public class VarStepDefault extends VarStep {
|
||||
* @param constraint the constraint added in this step
|
||||
* @param typeAbstractionInPremise the type abstraction in the premise of this step
|
||||
*/
|
||||
public VarStepDefault(Conclusion conclusion, Constraint constraint, TypeAbstraction typeAbstractionInPremise) {
|
||||
super(conclusion, constraint, typeAbstractionInPremise);
|
||||
public VarStepDefault(TypeAbstraction typeAbstractionInPremise, Conclusion conclusion, Constraint constraint) {
|
||||
super(typeAbstractionInPremise, conclusion, constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,8 +11,8 @@ public class VarStepWithLet extends VarStep {
|
||||
* @param constraint the constraint added in this step
|
||||
* @param typeAbstractionInPremise the type abstraction in the premise of this step
|
||||
*/
|
||||
public VarStepWithLet(Conclusion conclusion, Constraint constraint, TypeAbstraction typeAbstractionInPremise) {
|
||||
super(conclusion, constraint, typeAbstractionInPremise);
|
||||
public VarStepWithLet(TypeAbstraction typeAbstractionInPremise, Conclusion conclusion, Constraint constraint) {
|
||||
super(typeAbstractionInPremise, conclusion, constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user