CPD Results

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

Duplications

File Project Line
org/universAAL/ontology/shape/Path.java universAAL Ontology Physical World 146
org/universAAL/ontology/shape/Polygon.java universAAL Ontology Physical World 172
		Point[] points = getPoints();
		double max[] = { Double.MAX_VALUE, Double.MIN_VALUE, Double.MAX_VALUE, Double.MIN_VALUE, Double.MAX_VALUE,
				Double.MIN_VALUE };
		for (int i = 0; i < points.length; i++) {
			if (max[0] > points[i].getX())
				max[0] = points[i].getX();
			if (max[1] < points[i].getX())
				max[1] = points[i].getX();
			if (max[2] > points[i].getY())
				max[2] = points[i].getY();
			if (max[3] < points[i].getY())
				max[3] = points[i].getY();
			if (max[4] > points[i].getZ())
				max[4] = points[i].getZ();
			if (max[5] < points[i].getZ())
				max[5] = points[i].getZ();
		}
		return new Box(max[1] - max[0], max[3] - max[2], max[5] - max[4],
				new OriginedMetric((float) (max[0] + (max[1] - max[0]) / 2f), (float) (max[2] + (max[3] - max[2]) / 2f),
						(float) (max[4] + (max[5] - max[4]) / 2f), (Place) getCenter().getContainingLocation()));
	}

	public boolean contains(Point p) {
File Project Line
org/universAAL/ontology/location/address/Address.java universAAL Ontology Physical World 269
org/universAAL/ontology/location/address/PhysicalAddress.java universAAL Ontology Physical World 297
		if (this.getCityPlace() != null) {
			cities.append(this.getCityPlace());
		}
		if (this.getCityQuarter() != null) {
			if (cities.length() > 0)
				cities.append(", ");
			cities.append(this.getCityQuarter());
		}
		if (this.getCityRegion() != null) {
			if (cities.length() > 0)
				cities.append(", ");
			cities.append(this.getCityRegion());
		}
		if (this.getCity() != null) {
			if (cities.length() > 0)
				cities.append(", ");
			cities.append(this.getCity());
		}
		if (cities.length() > 0)
			cities.append("\n");
		if (this.getRegion() != null) {
			cities.append(this.getRegion());
		}
		if (this.getState() != null) {
			if (cities.length() > 0)
				cities.append(", ");
			cities.append(this.getState());
		}
		if (this.getCountry() != null) {
			if (cities.length() > 0)
				cities.append(", ");
			cities.append(this.getCountry());
		}
		if (this.getPostalCode() != null)
File Project Line
org/universAAL/ontology/profile/ProfileOntology.java universAAL Ontology Profiling 231
org/universAAL/ontology/vcard/VCardOntology.java universAAL Ontology Profiling 205
				PersonalInformationSubprofile.PROP_GENDER, Gender.MY_URI, 1, 1));
		oci.addDatatypeProperty(VCard.PROP_BDAY).setFunctional();
		oci.addRestriction(MergedRestriction.getAllValuesRestrictionWithCardinality(VCard.PROP_BDAY,
				TypeMapper.getDatatypeURI(XMLGregorianCalendar.class), 1, 1));
		oci.addObjectProperty(VCard.PROP_EMAIL);
		oci.addRestriction(MergedRestriction.getAllValuesRestriction(VCard.PROP_EMAIL, Email.MY_URI));
		oci.addDatatypeProperty(VCard.PROP_FN).setFunctional();
		oci.addRestriction(MergedRestriction.getAllValuesRestrictionWithCardinality(VCard.PROP_FN,
				TypeMapper.getDatatypeURI(String.class), 1, 1));
		oci.addObjectProperty(VCard.PROP_N).setFunctional();
		oci.addRestriction(MergedRestriction.getAllValuesRestrictionWithCardinality(VCard.PROP_N, Name.MY_URI, 1, 1));
		oci.addObjectProperty(VCard.PROP_ORG);
		oci.addRestriction(MergedRestriction.getAllValuesRestriction(VCard.PROP_ORG, Organization.MY_URI));
		oci.addObjectProperty(VCard.PROP_PHOTO);
		oci.addObjectProperty(VCard.PROP_TEL);
		oci.addRestriction(MergedRestriction.getAllValuesRestriction(VCard.PROP_TEL, Tel.MY_URI));
		oci.addObjectProperty(VCard.PROP_URL);
File Project Line
org/universAAL/ontology/shape/ConeSegment.java universAAL Ontology Physical World 179
org/universAAL/ontology/shape/LineSegment.java universAAL Ontology Physical World 149
		Point invDir = new Point((float) (1f / dir.getX()), (float) (1f / dir.getY()), (float) (1f / dir.getZ()),
				new CoordinateSystem());

		boolean signDirX = invDir.getX() < 0;
		boolean signDirY = invDir.getY() < 0;
		boolean signDirZ = invDir.getZ() < 0;

		Point center = box.getCenter().getInHigherCoordinateSystem(common);

		// TODO: is the association between width, depth, height and x,y,z right
		// at this place?
		double[] min = { center.getX() - box.getWidth() / 2f, center.getY() - box.getDepth() / 2f,
				center.getZ() - box.getHeight() / 2f };
		double[] max = { center.getX() + box.getWidth() / 2f, center.getY() + box.getDepth() / 2f,
				center.getZ() + box.getHeight() / 2f };

		double[] bbox;
		bbox = signDirX ? max : min;
		double tmin = (bbox[0] - start.getX()) * invDir.getX();
File Project Line
org/universAAL/ontology/shape/ConeSegment.java universAAL Ontology Physical World 136
org/universAAL/ontology/shape/LineSegment.java universAAL Ontology Physical World 105
	}

	public float getDistanceTo(Shape shape) {
		if (shape == null)
			throw new IllegalArgumentException();
		if (shape instanceof Sphere) {
			float dist = getDistanceTo(((Sphere) shape).getCenter());
			dist -= ((Sphere) shape).getRadius();
			if (dist < 0)
				return Point.INTERSECTING;
			else
				return dist;
		}
		if (shape instanceof Box) {
			Point start = getStart();
			Point end = getEnd();
			Point dir = new Point(end.getX() - start.getX(), end.getY() - start.getY(), end.getZ() - start.getZ(),
					start.getCoordinateSystem());
			return distanceRay(start, dir, (Box) shape, 0, 1);
		}
		return Point.NOT_COMPUTABLE_DISTANCE;
	}

	/**
	 * Cone radius at position t
	 *
	 * @param t
	 *            a value between 0 and 1
	 * @return
	 */
	private float radiusAt(float t) {
File Project Line
org/universAAL/ontology/multimedia/Stereoset.java universAAL Ontology Multimedia Devices 47
org/universAAL/ontology/multimedia/TV.java universAAL Ontology Multimedia Devices 50
	public Stereoset(String uri, Boolean isOnProg, Boolean isOnComm) {
		super(uri);

		if ((isOnProg == null) || (isOnComm == null))
			throw new IllegalArgumentException();

		props.put(PROP_IS_ON_PROG, isOnProg);
		props.put(PROP_IS_ON_COMM, isOnComm);
	}

	public String getClassURI() {
		return MY_URI;
	}

	public Boolean isOnComm() {
		return (Boolean) props.get(PROP_IS_ON_COMM);
	}

	public Boolean isOnProg() {
		return (Boolean) props.get(PROP_IS_ON_PROG);
	}

	public void setOnProg(Boolean b) {
		if (b != null)
			props.put(PROP_IS_ON_PROG, b);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.persona.ontology.ManagedIndividual#getPropSerializationType(java.
	 * lang.String)
	 */
	public int getPropSerializationType(String propURI) {
		return PROP_SERIALIZATION_FULL;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see org.persona.ontology.ManagedIndividual#isWellFormed()
	 */
	public boolean isWellFormed() {
		return props.containsKey(PROP_IS_ON_PROG) && props.containsKey(PROP_IS_ON_COMM);
	}
}
File Project Line
org/universAAL/ontology/shape/Path.java universAAL Ontology Physical World 162
org/universAAL/ontology/shape/Polyhedron.java universAAL Ontology Physical World 145
		}
		return new Box(max[1] - max[0], max[3] - max[2], max[5] - max[4],
				new OriginedMetric((float) (max[0] + (max[1] - max[0]) / 2f), (float) (max[2] + (max[3] - max[2]) / 2f),
						(float) (max[4] + (max[5] - max[4]) / 2f), (Place) getCenter().getContainingLocation()));
	}

	public boolean contains(Point p) {
		return false;
	}
}
File Project Line
org/universAAL/ontology/shape/Polygon.java universAAL Ontology Physical World 188
org/universAAL/ontology/shape/Polyhedron.java universAAL Ontology Physical World 145
		}
		return new Box(max[1] - max[0], max[3] - max[2], max[5] - max[4],
				new OriginedMetric((float) (max[0] + (max[1] - max[0]) / 2f), (float) (max[2] + (max[3] - max[2]) / 2f),
						(float) (max[4] + (max[5] - max[4]) / 2f), (Place) getCenter().getContainingLocation()));
	}

	/**
	 * accuracy limited to 4 digits after the dot
	 *
	 */
	public boolean contains(Point p) {
File Project Line
org/universAAL/ontology/drools/ConsequenceProperty.java universAAL Ontology Drools 57
org/universAAL/ontology/drools/FactProperty.java universAAL Ontology Drools 58
	public ConsequenceProperty(String uri, String key, String value) {
		super(uri);
		props.put(PROP_HAS_KEY, key);
		props.put(PROP_HAS_VALUE, value);
	}

	public int getPropSerializationType(String propURI) {
		return PROP_SERIALIZATION_FULL;
	}

	public boolean isWellFormed() {
		// TODO
		return true;
	}

	public String getKey() {
		return (String) props.get(PROP_HAS_KEY);
	}

	public void setKey(String str) {
		props.put(PROP_HAS_KEY, str);
	}

	public String getValue() {
		return (String) props.get(PROP_HAS_VALUE);
	}

	public void setValue(String str) {
		props.put(PROP_HAS_VALUE, str);
	}

	public String getClassURI() {
		return MY_URI;
	}

}
File Project Line
org/universAAL/ontology/shape/ConeSegment.java universAAL Ontology Physical World 102
org/universAAL/ontology/shape/LineSegment.java universAAL Ontology Physical World 78
	}

	public Point getStart() {
		return getPoints()[0];
	}

	public Point getEnd() {
		return getPoints()[1];
	}

	public float getDistanceTo(Point point) {
		if (point == null)
			throw new IllegalArgumentException();
		CoordinateSystem common = CoordinateSystem.findCommonParentSystem(point.getCoordinateSystem(),
				this.getLocalCoordinateSystem());
		double[] a = getStart().getInHigherCoordinateSystem(common).get3DCoordinates();
		double[] b = getEnd().getInHigherCoordinateSystem(common).get3DCoordinates();
		JgclPoint3D c = new JgclCartesianPoint3D(point.getInHigherCoordinateSystem(common).get3DCoordinates());
File Project Line
org/universAAL/ontology/security/SessionManagementService.java universAAL Ontology Security 102
org/universAAL/ontology/security/SessionManagementService.java universAAL Ontology Security 138
				new String[] { PROP_USER, SecurityOntology.PROP_SESSION, DeviceBoundSession.PROP_BOUNDED_DEVICE }, d);
		ServiceResponse sres = new DefaultServiceCaller(mc).call(sreq);
		if (sres == null || !sres.getCallStatus().equals(CallStatus.succeeded)) {
			// By default assume there is no session.
			return false;
		}
		List users = sres.getOutput(usrsOut, true);
		boolean found = false;
		Iterator it = users.iterator();
		while (!found && it.hasNext()) {
			found = ((Resource) it.next()).getURI().equals(u.getURI());
		}
		return found;
	}