arcgissamples\scenario\map\IdentifyInfo.java
/* Copyright 2010 ESRI * * All rights reserved under the copyright laws of the United States * and applicable international laws, treaties, and conventions. * * You may freely redistribute and use this sample code, with or * without modification, provided you include the original copyright * notice and use restrictions. * * See the use restrictions. * */ package arcgissamples.scenario.map; import java.util.Comparator; import java.util.TreeMap; /**Data structure for storing identify results * Identify results are stored as follows: * <Layer 1> <field1> <keys> <values> * <field2> <keys> <values> * .... * * <layer 2> <field1> <keys> <values> * <field2> <keys> <values> * .... */ public class IdentifyInfo { String layerName; TreeMap<String, LayerData> table = new TreeMap<String, LayerData>(new Comparator<Object>() { public int compare(Object o1, Object o2) { return o1.toString().compareToIgnoreCase(o2.toString()); } }); public void setLayerData(String layerName, String keys[] , Object values[] , Object idFieldValue){ LayerData data = new LayerData(); data.keys = keys; data.values = values; data.idFieldValue = idFieldValue; if(idFieldValue != null) table.put(idFieldValue.toString(), data); } public java.util.TreeMap getLayerData() { return table; } public LayerData getFirstData() { LayerData data = (LayerData) table.get(table.firstKey()); return data; } public LayerData getIdFieldData(Object idField) { return (LayerData)table.get(idField); } public class LayerData { public Object idFieldValue; public String keys []; public Object values[]; } public String toString() { return layerName; } }