@@ -73,15 +73,16 @@ public ParStyle(Optional<TextAlignment> alignment, Optional<Color> backgroundCol
7373
7474 @ Override
7575 public int hashCode () {
76- return Objects .hash (alignment , backgroundColor );
76+ return Objects .hash (alignment , backgroundColor , indent );
7777 }
7878
7979 @ Override
8080 public boolean equals (Object other ) {
8181 if (other instanceof ParStyle ) {
8282 ParStyle that = (ParStyle ) other ;
8383 return Objects .equals (this .alignment , that .alignment ) &&
84- Objects .equals (this .backgroundColor , that .backgroundColor );
84+ Objects .equals (this .backgroundColor , that .backgroundColor ) &&
85+ Objects .equals (this .indent , that .indent );
8586 } else {
8687 return false ;
8788 }
@@ -134,16 +135,12 @@ public ParStyle updateIndent(Indent indent) {
134135 }
135136
136137 public ParStyle increaseIndent () {
137- if ( indent .isPresent () ) indent .get ().level ++;
138- else return updateIndent ( new Indent () );
139- return this ;
138+ return updateIndent ( indent .map ( Indent ::increase ).orElseGet ( Indent ::new ) );
140139 }
141140
142141 public ParStyle decreaseIndent () {
143- if ( indent .isPresent () && --indent .get ().level == 0 ) {
144- return updateIndent ( null );
145- }
146- return this ;
142+ return updateIndent ( indent .filter ( in -> in .level > 1 )
143+ .map ( Indent ::decrease ).orElse ( null ) );
147144 }
148145
149146}
0 commit comments