Revision 20469 trunk/libraries/libDataSource/src/org/gvsig/data/vectorial/DefaultFeatureType.java

View differences:

DefaultFeatureType.java
1 1
package org.gvsig.data.vectorial;
2 2

  
3
import java.lang.reflect.Array;
4 3
import java.text.DateFormat;
5 4
import java.util.ArrayList;
6 5
import java.util.Iterator;
......
133 132
		return super.add(arg0);
134 133
	}
135 134

  
135
	public boolean addWithoutOrdinal(Object arg0) {
136
		int max=((IFeatureAttributeDescriptor)arg0).ordinal();
137
		if (count<max){
138
			count=max;
139
		}
140
		return super.add(arg0);
141
	}
142

  
136 143
	public IFeatureType cloneFeatureType() {
137 144
		DefaultFeatureType newFType = (DefaultFeatureType) this.newFeatureType();
138 145
		if (this.allSRS != null){
......
153 160
		}
154 161
		Iterator iter = this.iterator();
155 162
		while (iter.hasNext()){
156
			newFType.add(((IFeatureAttributeDescriptor)iter.next()).cloneAttribute());
163
			newFType.addWithoutOrdinal(((IFeatureAttributeDescriptor)iter.next()).cloneAttribute());
157 164
		}
158 165
		newFType.count=this.count;
159 166
		return newFType;
......
167 174
	public Object get(String name){
168 175
		return this.get(this.getFieldIndex(name));
169 176
	}
177
	public int getCount() {
178
		return count;
179
	}
180
	public IFeatureAttributeDescriptor getByOrder(int i) {
181
		Iterator iterator=this.iterator();
182
		while (iterator.hasNext()) {
183
			IFeatureAttributeDescriptor fad = (IFeatureAttributeDescriptor) iterator.next();
184
			if (i==fad.ordinal()){
185
				return fad;
186
			}
187
		}
188
		return null;
189
	}
170 190
}

Also available in: Unified diff