-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
BuildTools
committed
Sep 29, 2023
1 parent
ee28e16
commit 69af078
Showing
6 changed files
with
118 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/me/paultristanwagner/modelchecking/ltl/formula/LTLImplicationFormula.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package me.paultristanwagner.modelchecking.ltl.formula; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import static me.paultristanwagner.modelchecking.util.Symbol.IMPLICATION_SYMBOL; | ||
|
||
public class LTLImplicationFormula extends LTLFormula { | ||
|
||
private final LTLFormula left; | ||
private final LTLFormula right; | ||
|
||
private LTLImplicationFormula(LTLFormula left, LTLFormula right) { | ||
this.left = left; | ||
this.right = right; | ||
} | ||
|
||
public static LTLImplicationFormula implies(LTLFormula left, LTLFormula right) { | ||
return new LTLImplicationFormula(left, right); | ||
} | ||
|
||
@Override | ||
public List<LTLFormula> getAllSubformulas() { | ||
List<LTLFormula> subformulas = new ArrayList<>(); | ||
subformulas.add(this); | ||
subformulas.addAll(left.getAllSubformulas()); | ||
subformulas.addAll(right.getAllSubformulas()); | ||
return subformulas; | ||
} | ||
|
||
public LTLFormula getLeft() { | ||
return left; | ||
} | ||
|
||
public LTLFormula getRight() { | ||
return right; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "(" + left + " " + IMPLICATION_SYMBOL + " " + right + ")"; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
LTLImplicationFormula that = (LTLImplicationFormula) o; | ||
return Objects.equals(left, that.left) && Objects.equals(right, that.right); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(left, right); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters