fun merge(state: LR1State): LR1State? { val items: HashSet<LR1Item> = HashSet<LR1Item>() for (item1 in items) { var newItem: LR1Item = item1 val item2: LR1Item = state.getItemByLR0Kernel(item1.getLR0Kernel()) newItem = newItem.merge(item2) items.add(newItem) } return LR1State(items) }
Merges this state with the given one and returns the result . Only works , if both states have equal LR ( 0 ) kernels .