| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.probfunction.impl; |
| 8 | |
| 9 | import java.util.Collection; |
| 10 | |
| 11 | import org.eclipse.emf.common.notify.NotificationChain; |
| 12 | import org.eclipse.emf.common.util.EList; |
| 13 | import org.eclipse.emf.ecore.EClass; |
| 14 | import org.eclipse.emf.ecore.InternalEObject; |
| 15 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| 16 | import org.eclipse.emf.ecore.util.InternalEList; |
| 17 | |
| 18 | import de.uka.ipd.sdq.probfunction.BoxedPDF; |
| 19 | import de.uka.ipd.sdq.probfunction.ContinuousSample; |
| 20 | import de.uka.ipd.sdq.probfunction.ProbfunctionPackage; |
| 21 | |
| 22 | /** |
| 23 | * <!-- begin-user-doc --> |
| 24 | * An implementation of the model object '<em><b>Boxed PDF</b></em>'. |
| 25 | * <!-- end-user-doc --> |
| 26 | * <p> |
| 27 | * The following features are implemented: |
| 28 | * <ul> |
| 29 | * <li>{@link de.uka.ipd.sdq.probfunction.impl.BoxedPDFImpl#getSamples <em>Samples</em>}</li> |
| 30 | * </ul> |
| 31 | * </p> |
| 32 | * |
| 33 | * @generated |
| 34 | */ |
| 35 | public class BoxedPDFImpl extends ProbabilityDensityFunctionImpl implements BoxedPDF { |
| 36 | /** |
| 37 | * <!-- begin-user-doc --> |
| 38 | * <!-- end-user-doc --> |
| 39 | * @generated |
| 40 | */ |
| 41 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
| 42 | /** |
| 43 | * The cached value of the '{@link #getSamples() <em>Samples</em>}' containment reference list. |
| 44 | * <!-- begin-user-doc --> |
| 45 | * <!-- end-user-doc --> |
| 46 | * @see #getSamples() |
| 47 | * @generated |
| 48 | * @ordered |
| 49 | */ |
| 50 | protected EList<ContinuousSample> samples; |
| 51 | |
| 52 | /** |
| 53 | * <!-- begin-user-doc --> |
| 54 | * <!-- end-user-doc --> |
| 55 | * @generated |
| 56 | */ |
| 57 | protected BoxedPDFImpl() { |
| 58 | super(); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @generated |
| 65 | */ |
| 66 | @Override |
| 67 | protected EClass eStaticClass() { |
| 68 | return ProbfunctionPackage.Literals.BOXED_PDF; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @generated |
| 75 | */ |
| 76 | public EList<ContinuousSample> getSamples() { |
| 77 | if (samples == null) { |
| 78 | samples = new EObjectContainmentEList<ContinuousSample>(ContinuousSample.class, this, ProbfunctionPackage.BOXED_PDF__SAMPLES); |
| 79 | } |
| 80 | return samples; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * <!-- begin-user-doc --> |
| 85 | * <!-- end-user-doc --> |
| 86 | * @generated |
| 87 | */ |
| 88 | @Override |
| 89 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 90 | switch (featureID) { |
| 91 | case ProbfunctionPackage.BOXED_PDF__SAMPLES: |
| 92 | return ((InternalEList<?>)getSamples()).basicRemove(otherEnd, msgs); |
| 93 | } |
| 94 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | @Override |
| 103 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 104 | switch (featureID) { |
| 105 | case ProbfunctionPackage.BOXED_PDF__SAMPLES: |
| 106 | return getSamples(); |
| 107 | } |
| 108 | return super.eGet(featureID, resolve, coreType); |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * <!-- begin-user-doc --> |
| 113 | * <!-- end-user-doc --> |
| 114 | * @generated |
| 115 | */ |
| 116 | @SuppressWarnings("unchecked") |
| 117 | @Override |
| 118 | public void eSet(int featureID, Object newValue) { |
| 119 | switch (featureID) { |
| 120 | case ProbfunctionPackage.BOXED_PDF__SAMPLES: |
| 121 | getSamples().clear(); |
| 122 | getSamples().addAll((Collection<? extends ContinuousSample>)newValue); |
| 123 | return; |
| 124 | } |
| 125 | super.eSet(featureID, newValue); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * <!-- begin-user-doc --> |
| 130 | * <!-- end-user-doc --> |
| 131 | * @generated |
| 132 | */ |
| 133 | @Override |
| 134 | public void eUnset(int featureID) { |
| 135 | switch (featureID) { |
| 136 | case ProbfunctionPackage.BOXED_PDF__SAMPLES: |
| 137 | getSamples().clear(); |
| 138 | return; |
| 139 | } |
| 140 | super.eUnset(featureID); |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * <!-- begin-user-doc --> |
| 145 | * <!-- end-user-doc --> |
| 146 | * @generated |
| 147 | */ |
| 148 | @Override |
| 149 | public boolean eIsSet(int featureID) { |
| 150 | switch (featureID) { |
| 151 | case ProbfunctionPackage.BOXED_PDF__SAMPLES: |
| 152 | return samples != null && !samples.isEmpty(); |
| 153 | } |
| 154 | return super.eIsSet(featureID); |
| 155 | } |
| 156 | |
| 157 | } //BoxedPDFImpl |