public static < S , I , T > void findCharacterizingSet ( UniversalDeterministicAutomaton < S , I , T , ? , ? > automaton , Collection < ? extends I > inputs , S state , Collection < ? super Word < I > > result ) { Object prop = automaton . getStateProperty ( state ) ; List < S > currentBlock = new ArrayList <> ( ) ; boolean multipleStateProps = false ; for ( S s : automaton ) { if ( Objects . equals ( s , state ) ) { continue ; } Object sProp = automaton . getStateProperty ( s ) ; if ( ! Objects . equals ( sProp , prop ) ) { multipleStateProps = true ; } else { currentBlock . add ( s ) ; } } if ( multipleStateProps ) { result . add ( Word . epsilon ( ) ) ; } while ( ! currentBlock . isEmpty ( ) ) { Iterator < S > it = currentBlock . iterator ( ) ; Word < I > suffix = null ; while ( it . hasNext ( ) && suffix == null ) { S s = it . next ( ) ; suffix = Automata . findSeparatingWord ( automaton , state , s , inputs ) ; } if ( suffix == null ) { return ; } result . add ( suffix ) ; List < Object > trace = buildTrace ( automaton , state , suffix ) ; List < S > nextBlock = new ArrayList <> ( ) ; while ( it . hasNext ( ) ) { S s = it . next ( ) ; if ( checkTrace ( automaton , s , suffix , trace ) ) { nextBlock . add ( s ) ; } } currentBlock = nextBlock ; } }
Computes a characterizing set for a specified state in the given automaton .