001 /** 002 * <copyright> 003 * </copyright> 004 * 005 * $Id$ 006 */ 007 package com.hammurapi.review.impl; 008 009 import java.util.HashMap; 010 import java.util.Map; 011 012 import org.eclipse.emf.common.notify.Notification; 013 import org.eclipse.emf.common.util.BasicEList; 014 import org.eclipse.emf.common.util.EList; 015 import org.eclipse.emf.ecore.EClass; 016 import org.eclipse.emf.ecore.impl.ENotificationImpl; 017 018 import com.hammurapi.review.ReviewPackage; 019 import com.hammurapi.review.Violation; 020 021 /** 022 * <!-- begin-user-doc --> 023 * An implementation of the model object '<em><b>Violation</b></em>'. 024 * <!-- end-user-doc --> 025 * <p> 026 * The following features are implemented: 027 * <ul> 028 * <li>{@link com.hammurapi.review.impl.ViolationImpl#getMessage <em>Message</em>}</li> 029 * </ul> 030 * </p> 031 * 032 * @generated 033 */ 034 public class ViolationImpl extends ObservationImpl implements Violation { 035 /** 036 * The default value of the '{@link #getMessage() <em>Message</em>}' attribute. 037 * <!-- begin-user-doc --> 038 * <!-- end-user-doc --> 039 * @see #getMessage() 040 * @generated 041 * @ordered 042 */ 043 protected static final String MESSAGE_EDEFAULT = null; 044 045 /** 046 * The cached value of the '{@link #getMessage() <em>Message</em>}' attribute. 047 * <!-- begin-user-doc --> 048 * <!-- end-user-doc --> 049 * @see #getMessage() 050 * @generated 051 * @ordered 052 */ 053 protected String message = MESSAGE_EDEFAULT; 054 055 /** 056 * <!-- begin-user-doc --> 057 * <!-- end-user-doc --> 058 * @generated 059 */ 060 protected ViolationImpl() { 061 super(); 062 } 063 064 /** 065 * <!-- begin-user-doc --> 066 * <!-- end-user-doc --> 067 * @generated 068 */ 069 @Override 070 protected EClass eStaticClass() { 071 return ReviewPackage.Literals.VIOLATION; 072 } 073 074 /** 075 * <!-- begin-user-doc --> 076 * <!-- end-user-doc --> 077 * @generated 078 */ 079 public String getMessage() { 080 return message; 081 } 082 083 /** 084 * <!-- begin-user-doc --> 085 * <!-- end-user-doc --> 086 * @generated 087 */ 088 public void setMessage(String newMessage) { 089 String oldMessage = message; 090 message = newMessage; 091 if (eNotificationRequired()) 092 eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.VIOLATION__MESSAGE, oldMessage, message)); 093 } 094 095 private Map<String, Object> properties = new HashMap<String, Object>(); 096 097 /** 098 * <!-- begin-user-doc --> 099 * <!-- end-user-doc --> 100 * @generated 101 */ 102 public void setProperty(String name, Object value) { 103 // TODO: implement this method 104 // Ensure that you remove @generated or mark it @generated NOT 105 throw new UnsupportedOperationException(); 106 } 107 108 /** 109 * <!-- begin-user-doc --> 110 * <!-- end-user-doc --> 111 * @generated NOT 112 */ 113 public Object getProperty(String name) { 114 return properties.get(name); 115 } 116 117 /** 118 * <!-- begin-user-doc --> 119 * <!-- end-user-doc --> 120 * @generated 121 */ 122 public EList<String> getPropertyNames() { 123 // TODO: implement this method 124 // Ensure that you remove @generated or mark it @generated NOT 125 throw new UnsupportedOperationException(); 126 } 127 128 /** 129 * <!-- begin-user-doc --> 130 * <!-- end-user-doc --> 131 * @generated 132 */ 133 @Override 134 public Object eGet(int featureID, boolean resolve, boolean coreType) { 135 switch (featureID) { 136 case ReviewPackage.VIOLATION__MESSAGE: 137 return getMessage(); 138 } 139 return super.eGet(featureID, resolve, coreType); 140 } 141 142 /** 143 * <!-- begin-user-doc --> 144 * <!-- end-user-doc --> 145 * @generated 146 */ 147 @Override 148 public void eSet(int featureID, Object newValue) { 149 switch (featureID) { 150 case ReviewPackage.VIOLATION__MESSAGE: 151 setMessage((String)newValue); 152 return; 153 } 154 super.eSet(featureID, newValue); 155 } 156 157 /** 158 * <!-- begin-user-doc --> 159 * <!-- end-user-doc --> 160 * @generated 161 */ 162 @Override 163 public void eUnset(int featureID) { 164 switch (featureID) { 165 case ReviewPackage.VIOLATION__MESSAGE: 166 setMessage(MESSAGE_EDEFAULT); 167 return; 168 } 169 super.eUnset(featureID); 170 } 171 172 /** 173 * <!-- begin-user-doc --> 174 * <!-- end-user-doc --> 175 * @generated 176 */ 177 @Override 178 public boolean eIsSet(int featureID) { 179 switch (featureID) { 180 case ReviewPackage.VIOLATION__MESSAGE: 181 return MESSAGE_EDEFAULT == null ? message != null : !MESSAGE_EDEFAULT.equals(message); 182 } 183 return super.eIsSet(featureID); 184 } 185 186 /** 187 * <!-- begin-user-doc --> 188 * <!-- end-user-doc --> 189 * @generated 190 */ 191 @Override 192 public String toString() { 193 if (eIsProxy()) return super.toString(); 194 195 StringBuffer result = new StringBuffer(super.toString()); 196 result.append(" (message: "); 197 result.append(message); 198 result.append(')'); 199 return result.toString(); 200 } 201 202 } //ViolationImpl