1 20 21 package org.apache.derby.impl.drda; 22 23 27 final class Pkgnamcsn { 28 29 private final String rdbnam; 30 31 private final String rdbcolid; 32 33 private final String pkgid; 34 35 private final int pkgsn; 36 37 private final ConsistencyToken pkgcnstkn; 38 39 41 private Object statementKey = null; 42 43 52 Pkgnamcsn(String rdbnam, String rdbcolid, String pkgid, 53 int pkgsn, ConsistencyToken pkgcnstkn) { 54 this.rdbnam = rdbnam; 55 this.rdbcolid = rdbcolid; 56 this.pkgid = pkgid; 57 this.pkgsn = pkgsn; 58 this.pkgcnstkn = pkgcnstkn; 59 } 60 61 66 public String getRdbnam() { 67 return rdbnam; 68 } 69 70 75 public String getRdbcolid() { 76 return rdbcolid; 77 } 78 79 84 public String getPkgid() { 85 return pkgid; 86 } 87 88 93 public int getPkgsn() { 94 return pkgsn; 95 } 96 97 102 public ConsistencyToken getPkgcnstkn() { 103 return pkgcnstkn; 104 } 105 106 111 public String toString() { 112 return super.toString() + "(\"" + rdbnam + "\", \"" + 113 rdbcolid + "\", \"" + pkgid + "\", " + pkgsn + 114 ", " + pkgcnstkn + ")"; 115 } 116 117 130 public Object getStatementKey() { 131 if (statementKey == null) { 132 statementKey = new StatementKey(); 133 } 134 return statementKey; 135 } 136 137 148 private final class StatementKey { 149 150 private int hash = 0; 151 158 public boolean equals(Object obj) { 159 if (StatementKey.this == obj) { 160 return true; 161 } else if (obj instanceof StatementKey) { 162 return ((StatementKey) obj).isKeyFor(Pkgnamcsn.this); 163 } else { 164 return false; 165 } 166 } 167 172 public int hashCode() { 173 if (hash == 0) { 174 hash = 175 rdbnam.hashCode() ^ 176 rdbcolid.hashCode() ^ 177 pkgid.hashCode() ^ 178 pkgsn; 179 } 180 return hash; 181 } 182 190 private boolean isKeyFor(Pkgnamcsn p) { 191 return 192 rdbnam.equals(p.rdbnam) && 193 rdbcolid.equals(p.rdbcolid) && 194 pkgid.equals(p.pkgid) && 195 pkgsn == p.pkgsn; 196 } 197 } 198 } 199 | Popular Tags |