001: // $Id: Tuple.java,v 1.1.1.1 2003/07/02 15:30:52 apopovic Exp $
002: // =====================================================================
003: //
004: // (history at end)
005: //
006:
007: package ch.ethz.prose.query;
008:
009: /**
010: * Class Tuple XXX
011: *
012: * @version $Revision: 1.1.1.1 $
013: * @author Andrei Popovici
014: */
015: public class Tuple implements java.io.Serializable {
016:
017: private static final long serialVersionUID = 3257002138218476088L;
018:
019: public Tuple(AspectSurrogate as, CrosscutSurrogate cs,
020: JoinPointRequestSurrogate js) {
021: aspectSurrogate = as;
022: crosscutSurrogate = cs;
023: jpSurrogate = js;
024: }
025:
026: public Tuple() {
027: //Tuple(null,null,null);
028: }
029:
030: AspectSurrogate aspectSurrogate;
031: CrosscutSurrogate crosscutSurrogate;
032: JoinPointRequestSurrogate jpSurrogate;
033:
034: public void setAspectSurrogate(AspectSurrogate as) {
035: aspectSurrogate = as;
036: }
037:
038: public void setCrosscutSurrogate(CrosscutSurrogate cs) {
039: crosscutSurrogate = cs;
040: }
041:
042: public void setRequestSurrogate(JoinPointRequestSurrogate jprs) {
043: jpSurrogate = jprs;
044: }
045:
046: public JoinPointRequestSurrogate getRequestSurrogate() {
047: return jpSurrogate;
048: }
049:
050: public AspectSurrogate getAspectSurrogate() {
051: return aspectSurrogate;
052: }
053:
054: public CrosscutSurrogate getCrosscutSurrogate() {
055: return crosscutSurrogate;
056: }
057:
058: public String toString() {
059: return "(" + aspectSurrogate + "," + crosscutSurrogate + ","
060: + jpSurrogate + ")\n";
061: }
062:
063: /**
064: * Indicates whether some other object is "equal to" this one. The
065: * result is <code>true</code> if and only if <code>obj</code> is
066: * not <code>null</code> and is a instance of
067: * <code>Tuple</code> and has equal contents as this
068: * object.
069: * @param obj other object with which to compare
070: * @return <code>true</code> iff <code>obj</code> is equal to this
071: * <code>Tuple</code>
072: */
073: public boolean equals(Object obj) {
074: if (obj instanceof Tuple) {
075: boolean aspBool = false, croBool = false, joiBool = false;
076: Tuple other = (Tuple) obj;
077:
078: if (other.aspectSurrogate == null)
079: aspBool = (this .aspectSurrogate == null);
080: else
081: aspBool = other.aspectSurrogate
082: .equals(this .aspectSurrogate);
083:
084: if (aspBool)
085: if (other.crosscutSurrogate == null)
086: croBool = (this .crosscutSurrogate == null);
087: else
088: croBool = other.crosscutSurrogate
089: .equals(this .crosscutSurrogate);
090:
091: if (croBool)
092: if (other.jpSurrogate == null)
093: joiBool = (this .jpSurrogate == null);
094: else
095: joiBool = other.jpSurrogate
096: .equals(this .jpSurrogate);
097:
098: return (aspBool && croBool && joiBool);
099: } else
100: return false;
101: }
102:
103: /**
104: * Returns a hashcode for this object.
105: * @return hashcode value
106: */
107: public int hashCode() {
108: int retVal = 0;
109: if (jpSurrogate != null)
110: retVal += jpSurrogate.hashCode();
111: if (aspectSurrogate != null)
112: retVal += aspectSurrogate.hashCode();
113: if (crosscutSurrogate != null)
114: retVal += crosscutSurrogate.hashCode();
115: return retVal;
116: }
117:
118: }
119:
120: //======================================================================
121: //
122: // $Log: Tuple.java,v $
123: // Revision 1.1.1.1 2003/07/02 15:30:52 apopovic
124: // Imported from ETH Zurich
125: //
126: // Revision 1.1 2003/05/20 16:05:12 popovici
127: //
128: // New QueryManager replaces functionality in AspectManager (better Soc)
129: // New 'Surrogate' classes for usage in the QueryManager
130: // The 'RemoteAspectManager' and tools modified to use the Surrogates and the QueryManager
131: //
|