1 17 package org.eclipse.emf.ecore.sdo.util; 18 19 import org.eclipse.emf.ecore.EStructuralFeature; 20 import org.eclipse.emf.ecore.sdo.EProperty; 21 import org.eclipse.emf.ecore.util.FeatureMap; 22 import org.eclipse.emf.ecore.util.FeatureMapUtil; 23 24 import commonj.sdo.Property; 25 26 29 public class BasicESequence implements ESequence 30 { 31 protected FeatureMap.Internal featureMap; 32 33 public BasicESequence(FeatureMap.Internal featureMap) 34 { 35 this.featureMap = featureMap; 36 } 37 38 public FeatureMap featureMap() 39 { 40 return featureMap; 41 } 42 43 public int size() 44 { 45 return featureMap.size(); 46 } 47 48 public Property getProperty(int index) 49 { 50 return SDOUtil.adaptProperty(featureMap.getEStructuralFeature(index)); 51 } 52 53 public Object getValue(int index) 54 { 55 return featureMap.getValue(index); 56 } 57 58 public Object setValue(int index, Object value) 59 { 60 return featureMap.setValue(index, value); 61 } 62 63 protected EStructuralFeature getEStructuralFeature(String propertyName) 64 { 65 return featureMap.getEObject().eClass().getEStructuralFeature(propertyName); 66 } 67 68 protected EStructuralFeature getEStructuralFeature(int propertyIndex) 69 { 70 return featureMap.getEObject().eClass().getEStructuralFeature(propertyIndex); 71 } 72 73 public boolean add(String propertyName, Object value) 74 { 75 return featureMap.add(getEStructuralFeature(propertyName), value); 76 } 77 78 public boolean add(int propertyIndex, Object value) 79 { 80 return featureMap.add(getEStructuralFeature(propertyIndex), value); 81 } 82 83 public boolean add(Property property, Object value) 84 { 85 return featureMap.add(((EProperty)property).getEStructuralFeature(), value); 86 } 87 88 public void add(int index, String propertyName, Object value) 89 { 90 featureMap.add(index, getEStructuralFeature(propertyName), value); 91 } 92 93 public void add(int index, int propertyIndex, Object value) 94 { 95 featureMap.add(index, getEStructuralFeature(propertyIndex), value); 96 } 97 98 public void add(int index, Property property, Object value) 99 { 100 featureMap.add(index, ((EProperty)property).getEStructuralFeature(), value); 101 } 102 103 public void add(String text) 104 { 105 FeatureMapUtil.addText(featureMap, text); 106 } 107 108 public void add(int index, String text) 109 { 110 FeatureMapUtil.addText(featureMap, index, text); 111 } 112 113 public void remove(int index) 114 { 115 featureMap.remove(index); 116 } 117 118 public void move(int toIndex, int fromIndex) 119 { 120 featureMap.move(toIndex, fromIndex); 121 } 122 123 public String toString() 124 { 125 return featureMap.toString(); 126 } 127 } 128 | Popular Tags |