KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > PairOfObjects


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3;
7
8
9 /**
10  * Two objects in one ;-) As good as simple.
11  *
12  * <hr>
13  * <table width="100%" border="0">
14  * <tr>
15  * <td width="24%"><b>Filename</b></td><td width="76%">PairOfObjects.java</td>
16  * </tr>
17  * <tr>
18  * <td width="24%"><b>Author</b></td><td width="76%">Guy Zürcher (gzuercher@raptus.com)</td>
19  * </tr>
20  * <tr>
21  * <td width="24%"><b>Date</b></td><td width="76%">6th of August 2000</td>
22  * </tr>
23  * </table>
24  * <hr>
25  * <table width="100%" border="0">
26  * <tr>
27  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
28  * </tr>
29  * <tr>
30  * <td width="24%">2000-08-06/gz/td><td width="76%">created.</td>
31  * </tr>
32  * </table>
33  * <hr>
34  */

35 public class PairOfObjects extends Object JavaDoc
36 {
37   ///////////////////////////////////////////////////////// Attributes
38

39   /**
40    * first object
41    */

42   protected Object JavaDoc one = null;
43
44   /**
45    * second object
46    */

47   protected Object JavaDoc two = null;
48
49   ///////////////////////////////////////////////////////// Associations
50

51   ///////////////////////////////////////////////////////// Operations
52

53   /**
54    * Default constructor creates an "invalid" PairOfObjects
55    */

56   public PairOfObjects()
57   {
58   }
59
60   /**
61    * Call it the "convenience constructor" .... ;-)
62    */

63   public PairOfObjects(Object JavaDoc one, Object JavaDoc two)
64   {
65       setObjects(one, two);
66   }
67
68   /**
69    * Change the object one
70    *
71    * @param one a reference to object one
72    */

73   public void setObjectOne(Object JavaDoc one)
74   {
75       this.one = one;
76   }
77
78   /**
79    * Change the object two
80    *
81    * @param two a reference to object two
82    */

83   public void setObjectTwo(Object JavaDoc two)
84   {
85       this.two = two;
86   }
87
88   /**
89    * Change both objects at once
90    *
91    * @param one a reference to object one
92    * @param two a reference to object two
93    */

94   public void setObjects(Object JavaDoc one, Object JavaDoc two)
95   {
96       this.one = one; this.two = two;
97   }
98
99   /**
100    * Return the object one
101    *
102    * @return object one (can be NULL)
103    */

104   public Object JavaDoc getObjectOne()
105   {
106       return one;
107   }
108
109   /**
110    * Return the object two
111    *
112    * @return object two (can be NULL)
113    */

114   public Object JavaDoc getObjectTwo()
115   {
116       return two;
117   }
118
119   /**
120    * Set both objects to NULL (loose their references).
121    */

122   public void reset()
123   {
124       one = null;
125       two = null;
126   }
127
128   /**
129    * Query if the PairOfObjects is valid.
130    *
131    * @return true if object one and object two are not null, or
132    * false if they are
133    */

134   public boolean isValid()
135   {
136       return ((one != null) && (two != null));
137   }
138
139 }
140
141 /* end class PairOfObjects */
142
Popular Tags