@@ -29,19 +29,18 @@ public AndConstraint(Constraint left, Constraint right) {
2929 }
3030
3131 public Constraint getLeft () {
32- if (children .isEmpty ()){
32+ if (children .isEmpty ()) {
3333 throw new ParseError ("Left child can not be returned because there are no children." );
34- }
35- else {
34+ } else {
3635 return children .get (0 );
3736 }
3837 }
3938
4039 public Constraint getRight () {
41- if (children .isEmpty () || children .size () < 2 ){
42- throw new ParseError ("Right child can not be returned because there are less than two children." );;
43- }
44- else {
40+ if (children .isEmpty () || children .size () < 2 ) {
41+ throw new ParseError ("Right child can not be returned because there are less than two children." );
42+ ;
43+ } else {
4544 return children .get (children .size () - 1 );
4645 }
4746 }
@@ -53,29 +52,27 @@ public List<Constraint> getChildren() {
5352 public void setLeft (Constraint left ) {
5453 if (children .isEmpty ()) {
5554 children .add (left );
56- }
57- else {
55+ } else {
5856 children .set (0 , left );
5957 }
6058 }
6159
62- public void setRight (Constraint right ){
60+ public void setRight (Constraint right ) {
6361 if (children .size () < 2 ) {
6462 if (children .size () < 1 ) {
6563 children .add (null );
6664 }
6765 children .add (right );
68- }
69- else {
66+ } else {
7067 children .set (children .size () - 1 , right );
7168 }
7269 }
7370
7471 @ Override
7572 public String toString (boolean withSubmodels , String currentAlias ) {
76- return children .stream ()
77- .map (c -> AutomaticBrackets .enforceConstraintBracketsIfNecessary (this , c , withSubmodels , currentAlias ))
78- .collect (Collectors .joining (" & " ));
73+ return children .stream ()
74+ .map (c -> AutomaticBrackets .enforceConstraintBracketsIfNecessary (this , c , withSubmodels , currentAlias ))
75+ .collect (Collectors .joining (" & " ));
7976 }
8077
8178 @ Override
@@ -85,8 +82,8 @@ public List<Constraint> getConstraintSubParts() {
8582
8683 @ Override
8784 public void replaceConstraintSubPart (Constraint oldSubConstraint , Constraint newSubConstraint ) {
88- for (int i = 0 ; i < children .size (); i ++) {
89- if (children .get (i ) == oldSubConstraint ){
85+ for (int i = 0 ; i < children .size (); i ++) {
86+ if (children .get (i ) == oldSubConstraint ) {
9087 children .set (i , newSubConstraint );
9188 }
9289 }
@@ -101,7 +98,7 @@ public Constraint clone() {
10198 return clone ;
10299 }
103100
104- public void addChild (Constraint constraint ){
101+ public void addChild (Constraint constraint ) {
105102 if (constraint != null ) {
106103 children .add (constraint );
107104 }
@@ -111,7 +108,7 @@ public void addChild(Constraint constraint){
111108 public int hashCode (int level ) {
112109 final int prime = 31 ;
113110 int result = prime * level ;
114- for (Constraint c : children ) {
111+ for (Constraint c : children ) {
115112 result = prime * result + (c == null ? 0 : c .hashCode (1 + level ));
116113 }
117114 return result ;
@@ -132,7 +129,7 @@ public boolean equals(Object obj) {
132129 @ Override
133130 public List <VariableReference > getReferences () {
134131 List <VariableReference > references = new ArrayList <>();
135- for (Constraint c : children ){
132+ for (Constraint c : children ) {
136133 references .addAll (c .getReferences ());
137134 }
138135 return references ;
0 commit comments