CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

FileLine
nl/tudelft/goal/unreal/translators/RotationTranslator.java61
nl/tudelft/goal/unreal/translators/VelocityTranslator.java63
			String message = String.format("A velocity needs to start with %s, not: %s in %s.", VELOCITY_KEYWORD,
					f.getName(), f);
			throw new TranslationException(message);
		}
		List<Parameter> parameters = f.getParameters();

		// Check number of parameters
		if (parameters.size() != 3) {
			String message = String.format("Expected exactly 3 parameters when parsing %s", f);
			throw new TranslationException(message);
		}

		// Check type of parameters
		for (Parameter parameter : parameters) {
			if (!(parameter instanceof Numeral)) {
				String message = String.format("All arguments of %s should be numerical.", f);
				throw new TranslationException(message);
			}
		}

		// Transform to location.
		double[] c = new double[3];
		for (int i = 0; i < c.length; i++) {
			Parameter parameter = parameters.get(i);
			c[i] = ((Numeral) parameter).getValue().doubleValue();
		}
		return new Velocity(c[0], c[1], c[2]);