aboutsummaryrefslogtreecommitdiffstats
path: root/ajde/testdata/figures-coverage/figures/primitives/planar/Point.java
blob: d389be386ba79f57d6fdad31b69342271053419e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package figures.primitives.planar;

import figures.*;
import java.util.Collection;

public class Point implements FigureElement {

    static int xx = -1;
    private int x;
    private int y;
    transient int currVal = 0;
    public static String name;  

    { 
	y = -1;
    }

    static {
	xx = -10;
    }

    int c; int b; int a; 
    {
        x = 0;
        y = 0;
    }

    static {
        Point.name = "2-Dimensional Point";
    }

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    int getCurrVal() {
	return currVal;
    }

    /**
     * @see Figure#moves
     */
    public int getX() { return x; }

    public int getY() { return y; }

    public void setX(int x) { this.x = x; }

    public void setY(int x) { this.y = x; }

    public void incrXY(int dx, int dy) {
        setX(getX() + dx);
        setY(getY() + dy);
    }
    public void check(int dx, int dy) 
	throws ArithmeticException, PointBoundsException {
	if (dx < 0 || dy < 0) throw new PointBoundsException();
    }
}

class PointBoundsException extends Exception { }

class BoundedPoint extends Point { 
    public BoundedPoint(int x, int y) { super(x, y); }
}

class StrictlyBoundedPoint extends BoundedPoint { 
    public StrictlyBoundedPoint(int x, int y) { super(x, y); }
}