Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisMatt committed Nov 7, 2023
1 parent e2366a0 commit d5f6412
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public void onTreeElementRemoved(TreeElement element) {
for(TreeNode node : trans.getParents()){
//only if the last case of a case rule will be deleted
if (rule instanceof CaseRule && node.getChildren().isEmpty()) {
System.out.println("TRANSISTION UNLOCKING");
//System.out.println("TRANSISTION UNLOCKING");
CaseRule caseRule = (CaseRule)rule;
//set dependent elements to be modifiable by ancestors (if not dependent on others)
List<TreeNode> ancestors = node.getAncestors();
Expand All @@ -337,7 +337,7 @@ public void onTreeElementRemoved(TreeElement element) {
PuzzleElement oldElement = ancestor.getParent().getBoard().getPuzzleElement(pelement);
oldElement.setCasesDepended(oldElement.getCasesDepended() - 1);
Point loc = ((GridCell)oldElement).getLocation();
System.out.println("("+loc.x+","+loc.y+") to "+oldElement.getCasesDepended());
//System.out.println("("+loc.x+","+loc.y+") to "+oldElement.getCasesDepended());
if (oldElement.getCasesDepended() == 0) {
//set modifiable if started modifiable
boolean modifiable = tree.getRootNode().getBoard().getPuzzleElement(oldElement).isModifiable();
Expand Down Expand Up @@ -435,7 +435,7 @@ private void removeTreeNode(TreeNode node) {
if(!children.isEmpty()){
Rule rule = children.get(0).getRule();
if (rule instanceof CaseRule){
System.out.println("NODE UNLOCKING");
//System.out.println("NODE UNLOCKING");
CaseRule caseRule = (CaseRule)rule;
//set dependent elements to be modifiable by ancestors (if not dependent on others)
List<TreeNode> ancestors = node.getAncestors();
Expand All @@ -445,7 +445,7 @@ private void removeTreeNode(TreeNode node) {
PuzzleElement oldElement = ancestor.getParent().getBoard().getPuzzleElement(pelement);
oldElement.setCasesDepended(oldElement.getCasesDepended() - 1);
Point loc = ((GridCell)oldElement).getLocation();
System.out.println("("+loc.x+","+loc.y+") to "+oldElement.getCasesDepended());
//System.out.println("("+loc.x+","+loc.y+") to "+oldElement.getCasesDepended());
if (oldElement.getCasesDepended() == 0) {
//set modifiable if started modifiable
boolean modifiable = tree.getRootNode().getBoard().getPuzzleElement(oldElement).isModifiable();
Expand Down Expand Up @@ -505,7 +505,7 @@ private void addTreeNode(TreeNode node) {
PuzzleElement oldElement = ancestor.getParent().getBoard().getPuzzleElement(element);
oldElement.setCasesDepended(oldElement.getCasesDepended()+1);
Point loc = ((GridCell)oldElement).getLocation();
System.out.println("("+loc.x+","+loc.y+") to "+oldElement.getCasesDepended());
//System.out.println("("+loc.x+","+loc.y+") to "+oldElement.getCasesDepended());
oldElement.setModifiable(false);
}
}
Expand All @@ -528,7 +528,7 @@ private void addTreeTransition(TreeTransition trans) {
//if transition is a new case rule, lock dependent ancestor elements
Rule rule = trans.getRule();
if(rule instanceof CaseRule && parent.getChildren().size()==1){
System.out.println("TRANSITION LOCKING");
//System.out.println("TRANSITION LOCKING");
CaseRule caseRule = (CaseRule)rule;

List<TreeNode> ancestors = parent.getAncestors();
Expand All @@ -538,7 +538,7 @@ private void addTreeTransition(TreeTransition trans) {
PuzzleElement oldElement = ancestor.getParent().getBoard().getPuzzleElement(element);
oldElement.setCasesDepended(oldElement.getCasesDepended()+1);
Point loc = ((GridCell)oldElement).getLocation();
System.out.println("("+loc.x+","+loc.y+") to "+oldElement.getCasesDepended());
//System.out.println("("+loc.x+","+loc.y+") to "+oldElement.getCasesDepended());
oldElement.setModifiable(false);
}
}
Expand Down

0 comments on commit d5f6412

Please sign in to comment.