static int [ ] offsets ( final ISeq < ? extends FlatTree < ? extends Op < ? > , ? > > nodes ) { final int [ ] offsets = new int [ nodes . size ( ) ] ; int offset = 1 ; for ( int i = 0 ; i < offsets . length ; ++ i ) { final Op < ? > op = nodes . get ( i ) . getValue ( ) ; offsets [ i ] = op . isTerminal ( ) ? - 1 : offset ; offset += op . arity ( ) ; } return offsets ; }
Create the offset array for the given nodes . The offsets are calculated using the arity of the stored operations .