private void add ( State [ ] stack , State state ) { if ( stackElements != 0 ) { System . arraycopy ( stack , 0 , stack , 1 , stackElements ) ; } stack [ 0 ] = state ; stackElements ++ ; }
Add a state as tail element . This method shifts the whole stack if the stack is not empty .