docs: @Override
  	@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity", "checkstyle:nestedifdepth"})
  	protected void checkPrimitiveValidity() {
  		BusPrimitiveInvalidity invalidityReason = null;
  		if (this.roadSegments.getRoadSegmentCount() <= 0) {
  			invalidityReason = new BusPrimitiveInvalidity(
  					BusPrimitiveInvalidityType.NO_ROAD_SEGMENT_IN_ITINERARY,
  					null);
  		} else if (this.roadSegments.size() > 1) {
  			invalidityReason = new BusPrimitiveInvalidity(
  					BusPrimitiveInvalidityType.DISCONTINUOUS_PATH_IN_ITINERARY,
  					Integer.toString(this.roadSegments.size()));
  		} else if (this.validHalts.size() < 2) {
  			invalidityReason = new BusPrimitiveInvalidity(
  					BusPrimitiveInvalidityType.NOT_ENOUGH_VALID_BUS_HALTS,
  					null);
  		} else if (!this.invalidHalts.isEmpty()) {
  			invalidityReason = new BusPrimitiveInvalidity(
  					BusPrimitiveInvalidityType.INVALID_HALT_IN_ITINERARY,
  					null);
  		} else {
  			final BusNetwork busNetwork = getBusNetwork();
  			if (busNetwork == null) {
  				invalidityReason = new BusPrimitiveInvalidity(
  						BusPrimitiveInvalidityType.NO_BUS_NETWORK,
  						null);
  			} else {
  				final RoadNetwork roadNetwork = busNetwork.getRoadNetwork();
  				if (roadNetwork == null) {
  					invalidityReason = new BusPrimitiveInvalidity(
  							BusPrimitiveInvalidityType.NO_ROAD_NETWORK,
  							null);
  				} else {
  					final Iterator<RoadSegment> segmentIterator = this.roadSegments.roadSegments();
  					RoadSegment segment;
  					RoadNetwork segmentNetwork;
  					while (segmentIterator.hasNext() && invalidityReason == null) {
  						segment = segmentIterator.next();
  						segmentNetwork = segment.getRoadNetwork();
  						if (!roadNetwork.equals(segmentNetwork)) {
  							invalidityReason = new BusPrimitiveInvalidity(
  									BusPrimitiveInvalidityType.SEGMENT_OUTSIDE_ROAD_NETWORK,
  									segment.toString());
  						}
  					}
  
  					if (invalidityReason == null) {
  						BusItineraryHalt firstHalt = null;
  						BusItineraryHalt lastHalt = null;
  						final Iterator<BusItineraryHalt> iterator = this.validHalts.iterator();
  						int lastSegmentIndex = -1;
  						int idx;
  						while (iterator.hasNext() && invalidityReason == null) {
  							lastHalt = iterator.next();
  							if (firstHalt == null) {
  								firstHalt = lastHalt;
  							}
  							if (!lastHalt.isValidPrimitive()) {
  								invalidityReason = new BusPrimitiveInvalidity(
  										BusPrimitiveInvalidityType.INVALID_HALT_IN_ITINERARY,
  										lastHalt.getName());
  							} else {
  								idx = lastHalt.getRoadSegmentIndex();
  								if (idx >= lastSegmentIndex) {
  									lastSegmentIndex = idx;
  								} else {
  									invalidityReason = new BusPrimitiveInvalidity(
  											BusPrimitiveInvalidityType.INVALID_HALT_ORDER,
  											lastHalt.getName());
  								}
  							}
  						}
  						if (invalidityReason == null && (firstHalt == null
  								|| lastHalt == null || firstHalt.equals(lastHalt))) {
  							invalidityReason = new BusPrimitiveInvalidity(
  									BusPrimitiveInvalidityType.NOT_ENOUGH_VALID_BUS_HALTS,
  									null);
  						}
  						if (invalidityReason == null) {
  							assert firstHalt != null;
  							if (firstHalt.getRoadSegmentIndex() > 0) {
  								invalidityReason = new BusPrimitiveInvalidity(
  										BusPrimitiveInvalidityType.UNUSED_ROAD_SEGMENT_BEYOND_TERMINUS,
  										firstHalt.getName());
  							}
  						}
  						//check last halt from itinerary
  						if (invalidityReason == null) {
  							assert lastHalt != null;
  							if (!(lastHalt.getRoadSegmentIndex() == this.getRoadSegmentCount() - 1)) {
  								invalidityReason = new BusPrimitiveInvalidity(
  										BusPrimitiveInvalidityType.UNUSED_ROAD_SEGMENT_BEYOND_TERMINUS,
  										lastHalt.getName());
  							}
  						}
  					}
  				}
  			}
  		}
  
  
  		setPrimitiveValidity(invalidityReason);
  	}