Source code: com/port80/graph/dot/impl/DotPoint.java
1 //
2 // Copyright(c) 2002, Chris Leung
3 //
4
5 package com.port80.graph.dot.impl;
6
7 import java.awt.geom.*;
8 import com.port80.util.sprint;
9
10 /** Wrapper of a dynamic allocated array of DotPoint.
11 */
12 public class DotPoint extends Point2D {
13 double x;
14 double y;
15 public DotPoint() {}
16 public DotPoint(double x, double y) {
17 this.x = x;
18 this.y = y;
19 }
20 public DotPoint(IntPoint p) {
21 this.x = (double)p.x;
22 this.y = (double)p.y;
23 }
24 public DotPoint(DotPoint p) {
25 this.x = p.x;
26 this.y = p.y;
27 }
28 public double getX() {
29 return x;
30 }
31 public double getY() {
32 return y;
33 }
34 public void setLocation(double x, double y) {
35 this.x = x;
36 this.y = y;
37 }
38 public String toString() {
39 return sprint.f("%.1ff,%.1ff").a(x).a(y).end();
40 }
41 public String toString(String format) {
42 return sprint.f(format).a(x).a(y).end();
43 }
44 }
45