001: package org.geotools.feature.iso.simple;
002:
003: import java.util.ArrayList;
004: import java.util.Collections;
005: import java.util.List;
006: import java.util.Set;
007:
008: import org.geotools.feature.iso.Types;
009: import org.geotools.feature.iso.type.AssociationDescriptorImpl;
010: import org.geotools.feature.iso.type.AssociationTypeImpl;
011: import org.geotools.feature.iso.type.FeatureCollectionTypeImpl;
012: import org.opengis.feature.simple.SimpleFeatureCollectionType;
013: import org.opengis.feature.simple.SimpleFeatureType;
014: import org.opengis.feature.type.AssociationDescriptor;
015: import org.opengis.feature.type.AssociationType;
016: import org.opengis.feature.type.AttributeDescriptor;
017: import org.opengis.feature.type.AttributeType;
018: import org.opengis.feature.type.GeometryType;
019: import org.opengis.feature.type.Name;
020: import org.opengis.util.InternationalString;
021:
022: public class SimpleFeatureCollectionTypeImpl extends
023: FeatureCollectionTypeImpl implements
024: SimpleFeatureCollectionType {
025:
026: public SimpleFeatureCollectionTypeImpl(Name name,
027: AssociationDescriptor member, Set restrictions,
028: InternationalString description) {
029: super (name, new ArrayList(), Collections.singleton(member),
030: null, null, false, restrictions, null, description);
031: }
032:
033: public SimpleFeatureCollectionTypeImpl(Name name,
034: SimpleFeatureType member, InternationalString description) {
035: super (name, Collections.EMPTY_LIST, members(member), null,
036: member.getCRS(), false, Collections.EMPTY_SET, null,
037: description);
038: }
039:
040: private static final List members(SimpleFeatureType member) {
041: AssociationType aggregation = new AssociationTypeImpl(Types
042: .typeName("contained"), member, false, false,
043: Collections.EMPTY_SET, null, null);
044:
045: AssociationDescriptor memberOf = new AssociationDescriptorImpl(
046: aggregation, Types.typeName("memberOf"), 0,
047: Integer.MAX_VALUE);
048:
049: return Collections.singletonList(memberOf);
050: }
051:
052: public SimpleFeatureType getMemberType() {
053: if (MEMBERS.isEmpty())
054: return null;
055:
056: AssociationDescriptor ad = (AssociationDescriptor) MEMBERS
057: .iterator().next();
058:
059: if (ad != null) {
060: return (SimpleFeatureType) ((AssociationType) ad.type())
061: .getReferenceType();
062: }
063: return null;
064: }
065:
066: public Set getMemberTypes() {
067: throw new UnsupportedOperationException("not implemented yet");
068: }
069:
070: public AttributeDescriptor getAttribute(String name) {
071: throw new UnsupportedOperationException("not implemented yet");
072: }
073:
074: public AttributeDescriptor getAttribute(int indedx) {
075: throw new UnsupportedOperationException("not implemented yet");
076: }
077:
078: public int getAttributeCount() {
079: throw new UnsupportedOperationException("not implemented yet");
080: }
081:
082: public List getAttributes() {
083: throw new UnsupportedOperationException("not implemented yet");
084: }
085:
086: public GeometryType getDefaultGeometryType() {
087: throw new UnsupportedOperationException("not implemented yet");
088: }
089:
090: public AttributeType getType(String name) {
091: throw new UnsupportedOperationException("not implemented yet");
092: }
093:
094: public AttributeType getType(int index) {
095: throw new UnsupportedOperationException("not implemented yet");
096: }
097:
098: public List getTypes() {
099: throw new UnsupportedOperationException("not implemented yet");
100: }
101:
102: public int indexOf(String name) {
103: throw new UnsupportedOperationException("not implemented yet");
104: }
105: }
|