added comments when exception is thrown in Track
This commit is contained in:
		
							parent
							
								
									e2c6b5cb49
								
							
						
					
					
						commit
						64996f4b93
					
				|  | @ -115,7 +115,7 @@ public class Track implements TrackSpecification { | ||||||
|                 char possibleCarChar = line.charAt(xPosition); |                 char possibleCarChar = line.charAt(xPosition); | ||||||
|                 if (!allSpaceTypesAsChar.contains(possibleCarChar)) { |                 if (!allSpaceTypesAsChar.contains(possibleCarChar)) { | ||||||
|                     if (usedSymbolForCar.contains(possibleCarChar)) { |                     if (usedSymbolForCar.contains(possibleCarChar)) { | ||||||
|                         throw new InvalidTrackFormatException(); |                         throw new InvalidTrackFormatException("More than one car on track!"); | ||||||
|                     } |                     } | ||||||
|                     usedSymbolForCar.add(possibleCarChar); |                     usedSymbolForCar.add(possibleCarChar); | ||||||
|                     cars.add(new Car(possibleCarChar, new PositionVector(xPosition, yPosition))); |                     cars.add(new Car(possibleCarChar, new PositionVector(xPosition, yPosition))); | ||||||
|  | @ -143,12 +143,12 @@ public class Track implements TrackSpecification { | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (finishLine.size() == 0) { |         if (finishLine.size() == 0) { | ||||||
|             throw new InvalidTrackFormatException(); |             throw new InvalidTrackFormatException("No finish line found!"); | ||||||
|         } |         } | ||||||
|         finishTyp = getSpaceType(finishLine.get(0)); |         finishTyp = getSpaceType(finishLine.get(0)); | ||||||
|         for (PositionVector positionVector : finishLine) { |         for (PositionVector positionVector : finishLine) { | ||||||
|             if (getSpaceType(positionVector) != finishTyp) { |             if (getSpaceType(positionVector) != finishTyp) { | ||||||
|                 throw new InvalidTrackFormatException(); |                 throw new InvalidTrackFormatException("Inconsistent finish line found!"); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue