private void calculateLR0KernelItemSets ( ) { for ( int stateId = 0 ; stateId < lr0ItemSetCollection . getStateNumber ( ) ; stateId ++ ) { LR0ItemSet lr0ItemSet = lr0ItemSetCollection . getItemSet ( stateId ) ; Set < LR1Item > lr1Items = new LinkedHashSet < LR1Item > ( ) ; for ( LR0Item lr0Item : lr0ItemSet . getKernelItems ( ) ) { LR1Item lr1Item = new LR1Item ( lr0Item . getProduction ( ) , lr0Item . getPosition ( ) , DUMMY_TERMINAL ) ; lr1Items . add ( lr1Item ) ; } itemSetCollection . add ( new LR1ItemSet ( lr1Items ) ) ; } }
This method takes all item sets from LR0StateTransitionGraph and makes them to a LR1ItemSet containing only kernel items .