private void deleteState ( MutableState state ) { if ( state . getId ( ) == this . start . getId ( ) ) { throw new IllegalArgumentException ( "Cannot delete start state." ) ; } // we're going to "compact" all of the nulls out and remap state ids at the end this . states . set ( state . getId ( ) , null ) ; if ( isUsingStateSymbols ( ) ) { stateSymbols . remove ( state . getId ( ) ) ; } // this state won't be incoming to any of its arc's targets anymore for ( MutableArc mutableArc : state . getArcs ( ) ) { mutableArc . getNextState ( ) . removeIncomingState ( state ) ; } // delete arc's with nextstate equal to stateid for ( MutableState inState : state . getIncomingStates ( ) ) { Iterator < MutableArc > iter = inState . getArcs ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { MutableArc arc = iter . next ( ) ; if ( arc . getNextState ( ) == state ) { iter . remove ( ) ; } } } }
Deletes a state ;