public void add(E item){
  pos=(pos + 1) % size;
  if (data.size() <= pos) {
    data.add(item);
  }
 else {
    data.set(pos,item);
  }
  if (start == -1) {
    start=0;
  }
 else   if (pos == start) {
    start=(start + 1) % size;
  }
  end=pos;
}

public void add ( E item ) { pos = ( pos + 1 ) % size ; if ( data . size ( ) <= pos ) { data . add ( item ) ; } else { data . set ( pos , item ) ; } if ( start == - 1 ) { start = 0 ; } else if ( pos == start ) { start = ( start + 1 ) % size ; } end = pos ; }
moves the position forward and adds an element at that position , removing any elements after it ( if present ) . if the history is full , it replaces the oldest element .
