public void addRS(RollingStock rs){
  setNumberRS(getNumberRS() + 1);
  if (rs.getClass() == Car.class) {
    setNumberCars(getNumberCars() + 1);
  }
 else   if (rs.getClass() == Engine.class) {
    setNumberEngines(getNumberEngines() + 1);
  }
  setUsedLength(getUsedLength() + rs.getTotalLength());
}

public void addRS ( RollingStock rs ) { setNumberRS ( getNumberRS ( ) + 1 ) ; if ( rs . getClass ( ) == Car . class ) { setNumberCars ( getNumberCars ( ) + 1 ) ; } else if ( rs . getClass ( ) == Engine . class ) { setNumberEngines ( getNumberEngines ( ) + 1 ) ; } setUsedLength ( getUsedLength ( ) + rs . getTotalLength ( ) ) ; }
adds rolling stock to a specific location .
