void setMemo ( String production , int position , int line , final MemoEntry stackElement ) { Map < String , MemoEntry > map = memo . get ( position ) ; if ( map == null ) { map = new HashMap < String , MemoEntry > ( ) ; memo . put ( position , map ) ; map . put ( production , stackElement ) ; } else { if ( map . containsKey ( production ) ) { throw new RuntimeException ( "We should not set a memo twice. Modifying is needed afterwards." ) ; } map . put ( production , stackElement ) ; } }
This method puts memozation elements into the buffer . It is designed in a way that entries once set are not changed anymore . This is needed not to break references!