root / branches / Mobile_Compatible_Hito_1 / libFMap_dataFile / src / org / gvsig / data / datastores / vectorial / file / dbf / DBFFeatureID.java @ 21687
History | View | Annotate | Download (1.28 KB)
1 |
package org.gvsig.data.datastores.vectorial.file.dbf; |
---|---|
2 |
|
3 |
import java.util.HashMap; |
4 |
|
5 |
import org.gvsig.data.ReadException; |
6 |
import org.gvsig.data.vectorial.Feature; |
7 |
import org.gvsig.data.vectorial.FeatureID; |
8 |
import org.gvsig.data.vectorial.FeatureType; |
9 |
|
10 |
public class DBFFeatureID implements FeatureID{ |
11 |
protected long featureIndex; |
12 |
protected DBFStore store;
|
13 |
|
14 |
public DBFFeatureID(DBFStore store,long featureIndex) { |
15 |
this.featureIndex=featureIndex;
|
16 |
this.store=store;
|
17 |
} |
18 |
protected long getIndex(){ |
19 |
return featureIndex;
|
20 |
} |
21 |
public Feature getFeature(FeatureType featureType) throws ReadException{ |
22 |
return store.getFeatureByID(this,featureType); |
23 |
} |
24 |
public boolean equals(Object obj) { |
25 |
if (obj instanceof DBFFeatureID){ |
26 |
if (this.store != ((DBFFeatureID)obj).store){ |
27 |
return false; |
28 |
} |
29 |
return ((DBFFeatureID)obj).featureIndex==featureIndex;
|
30 |
} |
31 |
return false; |
32 |
} |
33 |
|
34 |
public int hashCode() { |
35 |
StringBuffer strBuffer= new StringBuffer(); |
36 |
strBuffer.append(this.store.hashCode());
|
37 |
strBuffer.append("[");
|
38 |
strBuffer.append(featureIndex); |
39 |
strBuffer.append("]");
|
40 |
return strBuffer.toString().hashCode();
|
41 |
} |
42 |
public HashMap toHashMap() { |
43 |
HashMap result = new HashMap(); |
44 |
result.put("featureIndex", new Long(featureIndex)); |
45 |
return result;
|
46 |
} |
47 |
|
48 |
} |