KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > InstrumentedObject


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest;
5
6 public class InstrumentedObject {
7   private long longValue;
8   private boolean booleanValue;
9   private InstrumentedObject objectValue;
10   private InstrumentedObject objectValue1;
11   private InstrumentedObject objectValue2;
12
13   public InstrumentedObject(boolean sub) {
14     this.longValue = System.currentTimeMillis();
15     this.booleanValue = System.currentTimeMillis() % 2 == 0;
16     if (sub) {
17       this.objectValue = new InstrumentedObject(false);
18       this.objectValue1 = new InstrumentedObject(false);
19       this.objectValue2 = new InstrumentedObject(false);
20     }
21   }
22
23   public void accessValues() {
24     myMethod(longValue, booleanValue, objectValue, objectValue1, objectValue2);
25     if (objectValue != null) {
26       objectValue.accessValues();
27       objectValue1.accessValues();
28       objectValue2.accessValues();
29     }
30   }
31
32   public void setValues() {
33     this.longValue = System.currentTimeMillis();
34     this.booleanValue = System.currentTimeMillis() % 2 == 0;
35     this.objectValue = new InstrumentedObject(false);
36     this.objectValue1 = new InstrumentedObject(false);
37     this.objectValue2 = new InstrumentedObject(false);
38   }
39
40   private void myMethod(long longValue2, boolean booleanValue2, InstrumentedObject value, InstrumentedObject value1,
41                         InstrumentedObject value2) {
42     // doNothing
43

44   }
45 }
Popular Tags