public static Point of(double x, double y) { return new Point(x, y); }
public static Point of(double x, double y) { return new Point(x, y); }
/** * Returns a new point translated by the given offset, which must be positive. */ public Point translate(double dx, double dy) { if (dx < 0 || dy < 0) { throw new IllegalArgumentException("Both offset coordinates must be positive"); } return new Point(x + dx, y + dy); }
/** * Returns a new point translated by the given offset, which must be positive. */ public Point translate(double dx, double dy) { if (dx < 0 || dy < 0) { throw new IllegalArgumentException("Both offset coordinates must be positive"); } return new Point(x + dx, y + dy); }
public static Point of(int x, int y) { return new Point(new Integer(x).doubleValue(), new Integer(y).doubleValue()); }
public static Point of(int x, int y) { return new Point(new Integer(x).doubleValue(), new Integer(y).doubleValue()); }
private Map<String, Edge> readEdgesBySequenceFlowId(XmlElement planeElement) { Map<String, Edge> edges = new HashMap<>(); for (XmlElement edgeElement: planeElement.removeElements(BPMN_DI_URI, "BPMNEdge")) { startElement(edgeElement); List<Point> edgeWaypoints = new ArrayList<>(); for (XmlElement pointElement: edgeElement.removeElements(OMG_DI_URI, "waypoint")) { startElement(pointElement); double x = Double.valueOf(currentXml.removeAttribute(OMG_DI_URI, "x")); double y = Double.valueOf(currentXml.removeAttribute(OMG_DI_URI, "y")); edgeWaypoints.add(new Point(x, y)); endElement(); } String id = currentXml.removeAttribute(BPMN_DI_URI, "id"); String sequenceFlowId = currentXml.removeAttribute(BPMN_DI_URI, "bpmnElement"); Edge edge = new Edge().id(id).transitionId(sequenceFlowId).dockers(edgeWaypoints); edges.put(sequenceFlowId, edge); endElement(); } return edges; } }
double width = Double.valueOf(currentXml.removeAttribute(OMG_DC_URI, "width")); double height = Double.valueOf(currentXml.removeAttribute(OMG_DC_URI, "height")); node.bounds(new Bounds(new Point(x, y), width, height));
@Test public void testCreateEmptyPoint() { Point p = new Point(); assertEquals(0.0, p.x, 0.0); assertEquals(0.0, p.y, 0.0); }
@Test public void testCreatePoint() { Point p = new Point(2.0, 3.0); assertEquals(2.0, p.x, 0.0); assertEquals(3.0, p.y, 0.0); Point p2 = Point.of(2.0, 3.0); assertEquals(2.0, p2.x, 0.0); assertEquals(3.0, p2.y, 0.0); assertEquals(p, p2); assertEquals(p.hashCode(), p2.hashCode()); Point p3 = Point.of(2, 3); assertEquals(2.0, p2.x, 0.0); assertEquals(3.0, p2.y, 0.0); assertEquals(p, p3); assertEquals(p.hashCode(), p2.hashCode()); }