org.eclipse.elk.graph.impl.ElkPropertyToValueMapEntryImpl Maven / Gradle / Ivy
/**
* Copyright (c) 2016 Kiel University and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.elk.graph.impl;
import org.eclipse.elk.graph.ElkGraphPackage;
import org.eclipse.elk.graph.properties.IProperty;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.BasicEMap;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
/**
*
* An implementation of the model object 'Elk Property To Value Map Entry'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.elk.graph.impl.ElkPropertyToValueMapEntryImpl#getTypedKey Key}
* - {@link org.eclipse.elk.graph.impl.ElkPropertyToValueMapEntryImpl#getTypedValue Value}
*
*
* @generated
*/
public class ElkPropertyToValueMapEntryImpl extends MinimalEObjectImpl.Container implements BasicEMap.Entry,Object> {
/**
* The cached value of the '{@link #getTypedKey() Key}' attribute.
*
*
* @see #getTypedKey()
* @generated
* @ordered
*/
protected IProperty> key;
/**
* The default value of the '{@link #getTypedValue() Value}' attribute.
*
*
* @see #getTypedValue()
* @generated
* @ordered
*/
protected static final Object VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getTypedValue() Value}' attribute.
*
*
* @see #getTypedValue()
* @generated
* @ordered
*/
protected Object value = VALUE_EDEFAULT;
/**
*
*
* @generated
*/
protected ElkPropertyToValueMapEntryImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ElkGraphPackage.Literals.ELK_PROPERTY_TO_VALUE_MAP_ENTRY;
}
/**
*
*
* @generated
*/
public IProperty> getTypedKey() {
return key;
}
/**
*
*
* @generated
*/
public void setTypedKey(IProperty> newKey) {
IProperty> oldKey = key;
key = newKey;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__KEY, oldKey, key));
}
/**
*
*
* @generated
*/
public Object getTypedValue() {
return value;
}
/**
*
*
* @generated
*/
public void setTypedValue(Object newValue) {
Object oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__VALUE, oldValue, value));
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__KEY:
return getTypedKey();
case ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__VALUE:
return getTypedValue();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__KEY:
setTypedKey((IProperty>)newValue);
return;
case ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__VALUE:
setTypedValue(newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__KEY:
setTypedKey((IProperty>)null);
return;
case ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__VALUE:
setTypedValue(VALUE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__KEY:
return key != null;
case ElkGraphPackage.ELK_PROPERTY_TO_VALUE_MAP_ENTRY__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated NOT
*/
@Override
public String toString() {
if (eIsProxy())
return super.toString();
StringBuilder result = new StringBuilder();
result.append(key != null ? key.getId() : "null")
.append(" -> ")
.append(String.valueOf(value));
return result.toString();
}
/**
*
*
* @generated
*/
protected int hash = -1;
/**
*
*
* @generated
*/
public int getHash() {
if (hash == -1) {
Object theKey = getKey();
hash = (theKey == null ? 0 : theKey.hashCode());
}
return hash;
}
/**
*
*
* @generated
*/
public void setHash(int hash) {
this.hash = hash;
}
/**
*
*
* @generated
*/
public IProperty> getKey() {
return getTypedKey();
}
/**
*
*
* @generated
*/
public void setKey(IProperty> key) {
setTypedKey(key);
}
/**
*
*
* @generated
*/
public Object getValue() {
return getTypedValue();
}
/**
*
*
* @generated
*/
public Object setValue(Object value) {
Object oldValue = getValue();
setTypedValue(value);
return oldValue;
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
public EMap, Object> getEMap() {
EObject container = eContainer();
return container == null ? null : (EMap, Object>)container.eGet(eContainmentFeature());
}
} //ElkPropertyToValueMapEntryImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy