1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.dbunit.ext.oracle;
23
24 import java.sql.SQLException;
25 import java.sql.Connection;
26 import oracle.jdbc.OracleTypes;
27 import oracle.sql.ORAData;
28 import oracle.sql.ORADataFactory;
29 import oracle.sql.Datum;
30 import oracle.sql.STRUCT;
31 import oracle.jpub.runtime.MutableStruct;
32
33
34
35
36
37
38
39
40
41
42 public class OracleSdoPointType implements ORAData, ORADataFactory
43 {
44 public static final String _SQL_NAME = "MDSYS.SDO_POINT_TYPE";
45 public static final int _SQL_TYPECODE = OracleTypes.STRUCT;
46
47 protected MutableStruct _struct;
48
49 protected static int[] _sqlType = { 2,2,2 };
50 protected static ORADataFactory[] _factory = new ORADataFactory[3];
51 protected static final OracleSdoPointType _OracleSdoPointTypeFactory = new OracleSdoPointType();
52
53 public static ORADataFactory getORADataFactory()
54 { return _OracleSdoPointTypeFactory; }
55
56 protected void _init_struct(boolean init)
57 { if (init) _struct = new MutableStruct(new Object[3], _sqlType, _factory); }
58 public OracleSdoPointType()
59 { _init_struct(true); }
60 public OracleSdoPointType(java.math.BigDecimal x, java.math.BigDecimal y, java.math.BigDecimal z) throws SQLException
61 { _init_struct(true);
62 setX(x);
63 setY(y);
64 setZ(z);
65 }
66
67
68 public Datum toDatum(Connection c) throws SQLException
69 {
70 return _struct.toDatum(c, _SQL_NAME);
71 }
72
73
74
75 public ORAData create(Datum d, int sqlType) throws SQLException
76 { return create(null, d, sqlType); }
77 protected ORAData create(OracleSdoPointType o, Datum d, int sqlType) throws SQLException
78 {
79 if (d == null) return null;
80 if (o == null) o = new OracleSdoPointType();
81 o._struct = new MutableStruct((STRUCT) d, _sqlType, _factory);
82 return o;
83 }
84
85 public java.math.BigDecimal getX() throws SQLException
86 { return (java.math.BigDecimal) _struct.getAttribute(0); }
87
88 public void setX(java.math.BigDecimal x) throws SQLException
89 { _struct.setAttribute(0, x); }
90
91
92 public java.math.BigDecimal getY() throws SQLException
93 { return (java.math.BigDecimal) _struct.getAttribute(1); }
94
95 public void setY(java.math.BigDecimal y) throws SQLException
96 { _struct.setAttribute(1, y); }
97
98
99 public java.math.BigDecimal getZ() throws SQLException
100 { return (java.math.BigDecimal) _struct.getAttribute(2); }
101
102 public void setZ(java.math.BigDecimal z) throws SQLException
103 { _struct.setAttribute(2, z); }
104
105 public String toString()
106 { try {
107 return "MDSYS.SDO_POINT_TYPE" + "(" +
108 getX() + "," +
109 getY() + "," +
110 getZ() +
111 ")";
112 } catch (Exception e) { return e.toString(); }
113 }
114
115 public boolean equals(Object obj)
116 {
117 if (this == obj)
118 {
119 return true;
120 }
121
122 if ((obj == null) || (! obj.getClass().equals(this.getClass())))
123 {
124 return false;
125 }
126
127 OracleSdoPointType otherObject = (OracleSdoPointType) obj;
128
129 try
130 {
131 return
132 OracleSdoHelper.objectsEqual(getX(), otherObject.getX()) &&
133 OracleSdoHelper.objectsEqual(getY(), otherObject.getY()) &&
134 OracleSdoHelper.objectsEqual(getZ(), otherObject.getZ());
135 }
136 catch (SQLException ex)
137 {
138 return false;
139 }
140 }
141
142 public int hashCode()
143 {
144 try
145 {
146 int hash = 7;
147 Object o;
148 o = getX();
149 hash = 31 * hash + (null == o ? 0 : o.hashCode());
150 o = getY();
151 hash = 31 * hash + (null == o ? 0 : o.hashCode());
152 o = getZ();
153 hash = 31 * hash + (null == o ? 0 : o.hashCode());
154 return hash;
155 }
156 catch (SQLException ex)
157 {
158 return 0;
159 }
160 }
161 }