public void removeConstraint ( final int idx ) { //If the constraint being is a parent of another correct the other constraint's parent accordingly FieldConstraint constraintToRemove = this . constraints [ idx ] ; if ( constraintToRemove instanceof SingleFieldConstraint ) { final SingleFieldConstraint sfc = ( SingleFieldConstraint ) constraintToRemove ; FieldConstraint parent = sfc . getParent ( ) ; for ( FieldConstraint child : this . constraints ) { if ( child instanceof SingleFieldConstraint ) { SingleFieldConstraint sfcChild = ( SingleFieldConstraint ) child ; if ( sfcChild . getParent ( ) == constraintToRemove ) { sfcChild . setParent ( parent ) ; break ; } } } } final FieldConstraint [ ] newList = new FieldConstraint [ this . constraints . length - 1 ] ; int newIdx = 0 ; for ( int i = 0 ; i < this . constraints . length ; i ++ ) { if ( i != idx ) { newList [ newIdx ] = this . constraints [ i ] ; newIdx ++ ; } } this . constraints = newList ; }
at this point in time .