001 /** 002 * <copyright> 003 * </copyright> 004 * 005 * $Id$ 006 */ 007 package com.hammurapi.review.impl; 008 009 import java.util.Collection; 010 011 import org.eclipse.emf.common.notify.Notification; 012 import org.eclipse.emf.common.notify.NotificationChain; 013 import org.eclipse.emf.common.util.EList; 014 import org.eclipse.emf.ecore.EClass; 015 import org.eclipse.emf.ecore.InternalEObject; 016 import org.eclipse.emf.ecore.impl.ENotificationImpl; 017 import org.eclipse.emf.ecore.impl.EObjectImpl; 018 import org.eclipse.emf.ecore.util.EObjectContainmentEList; 019 import org.eclipse.emf.ecore.util.InternalEList; 020 021 import com.hammurapi.review.Baseline; 022 import com.hammurapi.review.Repository; 023 import com.hammurapi.review.ReviewPackage; 024 025 /** 026 * <!-- begin-user-doc --> 027 * An implementation of the model object '<em><b>Repository</b></em>'. 028 * <!-- end-user-doc --> 029 * <p> 030 * The following features are implemented: 031 * <ul> 032 * <li>{@link com.hammurapi.review.impl.RepositoryImpl#getBaselines <em>Baselines</em>}</li> 033 * <li>{@link com.hammurapi.review.impl.RepositoryImpl#getName <em>Name</em>}</li> 034 * <li>{@link com.hammurapi.review.impl.RepositoryImpl#getDescription <em>Description</em>}</li> 035 * </ul> 036 * </p> 037 * 038 * @generated 039 */ 040 public class RepositoryImpl extends EObjectImpl implements Repository { 041 /** 042 * The cached value of the '{@link #getBaselines() <em>Baselines</em>}' containment reference list. 043 * <!-- begin-user-doc --> 044 * <!-- end-user-doc --> 045 * @see #getBaselines() 046 * @generated 047 * @ordered 048 */ 049 protected EList<Baseline> baselines; 050 051 /** 052 * The default value of the '{@link #getName() <em>Name</em>}' attribute. 053 * <!-- begin-user-doc --> 054 * <!-- end-user-doc --> 055 * @see #getName() 056 * @generated 057 * @ordered 058 */ 059 protected static final String NAME_EDEFAULT = null; 060 061 /** 062 * The cached value of the '{@link #getName() <em>Name</em>}' attribute. 063 * <!-- begin-user-doc --> 064 * <!-- end-user-doc --> 065 * @see #getName() 066 * @generated 067 * @ordered 068 */ 069 protected String name = NAME_EDEFAULT; 070 071 /** 072 * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. 073 * <!-- begin-user-doc --> 074 * <!-- end-user-doc --> 075 * @see #getDescription() 076 * @generated 077 * @ordered 078 */ 079 protected static final String DESCRIPTION_EDEFAULT = null; 080 081 /** 082 * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. 083 * <!-- begin-user-doc --> 084 * <!-- end-user-doc --> 085 * @see #getDescription() 086 * @generated 087 * @ordered 088 */ 089 protected String description = DESCRIPTION_EDEFAULT; 090 091 /** 092 * <!-- begin-user-doc --> 093 * <!-- end-user-doc --> 094 * @generated 095 */ 096 protected RepositoryImpl() { 097 super(); 098 } 099 100 /** 101 * <!-- begin-user-doc --> 102 * <!-- end-user-doc --> 103 * @generated 104 */ 105 @Override 106 protected EClass eStaticClass() { 107 return ReviewPackage.Literals.REPOSITORY; 108 } 109 110 /** 111 * <!-- begin-user-doc --> 112 * <!-- end-user-doc --> 113 * @generated 114 */ 115 public EList<Baseline> getBaselines() { 116 if (baselines == null) { 117 baselines = new EObjectContainmentEList<Baseline>(Baseline.class, this, ReviewPackage.REPOSITORY__BASELINES); 118 } 119 return baselines; 120 } 121 122 /** 123 * <!-- begin-user-doc --> 124 * <!-- end-user-doc --> 125 * @generated 126 */ 127 public String getName() { 128 return name; 129 } 130 131 /** 132 * <!-- begin-user-doc --> 133 * <!-- end-user-doc --> 134 * @generated 135 */ 136 public void setName(String newName) { 137 String oldName = name; 138 name = newName; 139 if (eNotificationRequired()) 140 eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.REPOSITORY__NAME, oldName, name)); 141 } 142 143 /** 144 * <!-- begin-user-doc --> 145 * <!-- end-user-doc --> 146 * @generated 147 */ 148 public String getDescription() { 149 return description; 150 } 151 152 /** 153 * <!-- begin-user-doc --> 154 * <!-- end-user-doc --> 155 * @generated 156 */ 157 public void setDescription(String newDescription) { 158 String oldDescription = description; 159 description = newDescription; 160 if (eNotificationRequired()) 161 eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.REPOSITORY__DESCRIPTION, oldDescription, description)); 162 } 163 164 /** 165 * <!-- begin-user-doc --> 166 * <!-- end-user-doc --> 167 * @generated 168 */ 169 @Override 170 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { 171 switch (featureID) { 172 case ReviewPackage.REPOSITORY__BASELINES: 173 return ((InternalEList<?>)getBaselines()).basicRemove(otherEnd, msgs); 174 } 175 return super.eInverseRemove(otherEnd, featureID, msgs); 176 } 177 178 /** 179 * <!-- begin-user-doc --> 180 * <!-- end-user-doc --> 181 * @generated 182 */ 183 @Override 184 public Object eGet(int featureID, boolean resolve, boolean coreType) { 185 switch (featureID) { 186 case ReviewPackage.REPOSITORY__BASELINES: 187 return getBaselines(); 188 case ReviewPackage.REPOSITORY__NAME: 189 return getName(); 190 case ReviewPackage.REPOSITORY__DESCRIPTION: 191 return getDescription(); 192 } 193 return super.eGet(featureID, resolve, coreType); 194 } 195 196 /** 197 * <!-- begin-user-doc --> 198 * <!-- end-user-doc --> 199 * @generated 200 */ 201 @SuppressWarnings("unchecked") 202 @Override 203 public void eSet(int featureID, Object newValue) { 204 switch (featureID) { 205 case ReviewPackage.REPOSITORY__BASELINES: 206 getBaselines().clear(); 207 getBaselines().addAll((Collection<? extends Baseline>)newValue); 208 return; 209 case ReviewPackage.REPOSITORY__NAME: 210 setName((String)newValue); 211 return; 212 case ReviewPackage.REPOSITORY__DESCRIPTION: 213 setDescription((String)newValue); 214 return; 215 } 216 super.eSet(featureID, newValue); 217 } 218 219 /** 220 * <!-- begin-user-doc --> 221 * <!-- end-user-doc --> 222 * @generated 223 */ 224 @Override 225 public void eUnset(int featureID) { 226 switch (featureID) { 227 case ReviewPackage.REPOSITORY__BASELINES: 228 getBaselines().clear(); 229 return; 230 case ReviewPackage.REPOSITORY__NAME: 231 setName(NAME_EDEFAULT); 232 return; 233 case ReviewPackage.REPOSITORY__DESCRIPTION: 234 setDescription(DESCRIPTION_EDEFAULT); 235 return; 236 } 237 super.eUnset(featureID); 238 } 239 240 /** 241 * <!-- begin-user-doc --> 242 * <!-- end-user-doc --> 243 * @generated 244 */ 245 @Override 246 public boolean eIsSet(int featureID) { 247 switch (featureID) { 248 case ReviewPackage.REPOSITORY__BASELINES: 249 return baselines != null && !baselines.isEmpty(); 250 case ReviewPackage.REPOSITORY__NAME: 251 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); 252 case ReviewPackage.REPOSITORY__DESCRIPTION: 253 return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); 254 } 255 return super.eIsSet(featureID); 256 } 257 258 /** 259 * <!-- begin-user-doc --> 260 * <!-- end-user-doc --> 261 * @generated 262 */ 263 @Override 264 public String toString() { 265 if (eIsProxy()) return super.toString(); 266 267 StringBuffer result = new StringBuffer(super.toString()); 268 result.append(" (name: "); 269 result.append(name); 270 result.append(", description: "); 271 result.append(description); 272 result.append(')'); 273 return result.toString(); 274 } 275 276 } //RepositoryImpl