01: package field;
02:
03: public class RenameFieldTest {
04: private String simple;
05: private int code;
06: public double height;
07: public static final int CODE_ON = 0;
08: public static final int CODE_OFF = 1;
09: private UsesFieldTest childObject;
10:
11: public RenameFieldTest() {
12: simple = "ample";
13: code = 52;
14: height = 321.12;
15: }
16:
17: public RenameFieldTest(int code) {
18: simple = "ample";
19: this .code = code;
20: height = 321.12;
21: }
22:
23: public String getSimple() {
24: return simple;
25: }
26:
27: public void setCode(int code) {
28: this .code = code;
29: }
30:
31: public int getCode() {
32: return this .code;
33: }
34:
35: public void setCodeAlt(int changed) {
36: code = changed;
37: }
38:
39: public void debugPrint() {
40: System.out.println("String: " + simple.toString() + " "
41: + simple());
42: }
43:
44: public boolean equals(Object other) {
45: if (other instanceof RenameFieldTest) {
46: RenameFieldTest rft = (RenameFieldTest) other;
47: return rft.code == this .code;
48: }
49:
50: return false;
51: }
52:
53: public double getVolume() {
54: return height * this .height * height;
55: }
56:
57: void usesField(UsesFieldTest anObject) {
58: anObject.simple = "";
59: }
60:
61: void upCasts(RenameFieldTest objectToDownCast) {
62: ((InheritFieldTest) objectToDownCast).anOtherMember = "";
63: ((InheritFieldTest) objectToDownCast).simple = "";
64: }
65:
66: void downCasts(InheritFieldTest objectToDownCast) {
67: ((RenameFieldTest) objectToDownCast).simple = "";
68: }
69:
70: void linkedField(RenameFieldTest linkedObject) {
71: linkedObject.childObject.simple = "";
72: }
73:
74: }
|