~ubuntu-branches/ubuntu/natty/aspectj/natty

« back to all changes in this revision

Viewing changes to org.aspectj/modules/docs/dist/doc/examples/tracing/Square.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2009-10-04 16:37:23 UTC
  • mfrom: (1.1.3 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091004163723-ck4y7j7fhjxskkie
Tags: 1.6.6+dfsg-1
* New upstream release.
  - Update 02_use_gjdoc.diff patch
* Update my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 
3
 
Copyright (c) Xerox Corporation 1998-2002.  All rights reserved.
4
 
 
5
 
Use and copying of this software and preparation of derivative works based
6
 
upon this software are permitted.  Any distribution of this software or
7
 
derivative works must comply with all applicable United States export control
8
 
laws.
9
 
 
10
 
This software is made available AS IS, and Xerox Corporation makes no warranty
11
 
about the software, its performance or its conformity to any specification.
12
 
 
13
 
|<---            this code is formatted to fit into 80 columns             --->|
14
 
|<---            this code is formatted to fit into 80 columns             --->|
15
 
|<---            this code is formatted to fit into 80 columns             --->|
16
 
 
17
 
*/
18
 
 
19
 
package tracing;
20
 
 
21
 
/**
22
 
 *
23
 
 * Square is a 2D shape. It extends the TwoDShape class with the side
24
 
 * variable, and it implements TwoDShape's abstract methods for 
25
 
 * correctly computing a square's area and distance.
26
 
 *
27
 
 */
28
 
public class Square extends TwoDShape {
29
 
    protected double s;    // side
30
 
 
31
 
    /*
32
 
     * All sorts of constructors
33
 
     */
34
 
    public Square(double x, double y, double s) {
35
 
        super(x, y); this.s = s;
36
 
    }
37
 
 
38
 
    public Square(double x, double y) {
39
 
        this(x, y, 1.0);
40
 
    }
41
 
 
42
 
    public Square(double s) {
43
 
        this(0.0, 0.0, s);
44
 
    }
45
 
 
46
 
    public Square() {
47
 
        this(0.0, 0.0, 1.0);
48
 
    }
49
 
 
50
 
    /**
51
 
     * Returns the perimeter of this square
52
 
     */
53
 
    public double perimeter() {
54
 
        return 4 * s;
55
 
    }
56
 
 
57
 
    /**
58
 
     * Returns the area of this square
59
 
     */
60
 
    public double area() {
61
 
        return s*s;
62
 
    }
63
 
 
64
 
    /**
65
 
     * This method overrides the one in the superclass. It adds some
66
 
     * circle-specific information.
67
 
     */
68
 
    public String toString() {
69
 
        return ("Square side = " + String.valueOf(s) + super.toString());
70
 
    }
71
 
}