From 78c806eebaf5b9d50b08768062755f0044cf107f Mon Sep 17 00:00:00 2001 From: OszkarSemerath Date: Sun, 20 Aug 2017 01:55:38 +0200 Subject: Alloy Examples --- .../alloyexamples/Filesystem/impl/DirImpl.java | 165 ++++++++++ .../Filesystem/impl/FSObjectImpl.java | 194 +++++++++++ .../alloyexamples/Filesystem/impl/FileImpl.java | 36 +++ .../Filesystem/impl/FileSystemImpl.java | 205 ++++++++++++ .../Filesystem/impl/FilesystemFactoryImpl.java | 128 ++++++++ .../Filesystem/impl/FilesystemPackageImpl.java | 356 +++++++++++++++++++++ .../alloyexamples/Filesystem/impl/ModelImpl.java | 221 +++++++++++++ 7 files changed, 1305 insertions(+) create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileImpl.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl') diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java new file mode 100644 index 00000000..62df04af --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/DirImpl.java @@ -0,0 +1,165 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl; + +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Dir'. + * + *

+ * The following features are implemented: + *

+ * + * + * @generated + */ +public class DirImpl extends FSObjectImpl implements Dir { + /** + * The cached value of the '{@link #getContents() Contents}' containment reference list. + * + * + * @see #getContents() + * @generated + * @ordered + */ + protected EList contents; + + /** + * + * + * @generated + */ + protected DirImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilesystemPackage.Literals.DIR; + } + + /** + * + * + * @generated + */ + public EList getContents() { + if (contents == null) { + contents = new EObjectContainmentWithInverseEList(FSObject.class, this, FilesystemPackage.DIR__CONTENTS, FilesystemPackage.FS_OBJECT__PARENT); + } + return contents; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilesystemPackage.DIR__CONTENTS: + return ((InternalEList)(InternalEList)getContents()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilesystemPackage.DIR__CONTENTS: + return ((InternalEList)getContents()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilesystemPackage.DIR__CONTENTS: + return getContents(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilesystemPackage.DIR__CONTENTS: + getContents().clear(); + getContents().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilesystemPackage.DIR__CONTENTS: + getContents().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilesystemPackage.DIR__CONTENTS: + return contents != null && !contents.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //DirImpl diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java new file mode 100644 index 00000000..c8e73b4e --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FSObjectImpl.java @@ -0,0 +1,194 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl; + +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; + +/** + * + * An implementation of the model object 'FS Object'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl.FSObjectImpl#getParent Parent}
  • + *
+ * + * @generated + */ +public abstract class FSObjectImpl extends MinimalEObjectImpl.Container implements FSObject { + /** + * + * + * @generated + */ + protected FSObjectImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilesystemPackage.Literals.FS_OBJECT; + } + + /** + * + * + * @generated + */ + public Dir getParent() { + if (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT) return null; + return (Dir)eInternalContainer(); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetParent(Dir newParent, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newParent, FilesystemPackage.FS_OBJECT__PARENT, msgs); + return msgs; + } + + /** + * + * + * @generated + */ + public void setParent(Dir newParent) { + if (newParent != eInternalContainer() || (eContainerFeatureID() != FilesystemPackage.FS_OBJECT__PARENT && newParent != null)) { + if (EcoreUtil.isAncestor(this, newParent)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newParent != null) + msgs = ((InternalEObject)newParent).eInverseAdd(this, FilesystemPackage.DIR__CONTENTS, Dir.class, msgs); + msgs = basicSetParent(newParent, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilesystemPackage.FS_OBJECT__PARENT, newParent, newParent)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilesystemPackage.FS_OBJECT__PARENT: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetParent((Dir)otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilesystemPackage.FS_OBJECT__PARENT: + return basicSetParent(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case FilesystemPackage.FS_OBJECT__PARENT: + return eInternalContainer().eInverseRemove(this, FilesystemPackage.DIR__CONTENTS, Dir.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilesystemPackage.FS_OBJECT__PARENT: + return getParent(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilesystemPackage.FS_OBJECT__PARENT: + setParent((Dir)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilesystemPackage.FS_OBJECT__PARENT: + setParent((Dir)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilesystemPackage.FS_OBJECT__PARENT: + return getParent() != null; + } + return super.eIsSet(featureID); + } + +} //FSObjectImpl diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileImpl.java new file mode 100644 index 00000000..55cd8a23 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileImpl.java @@ -0,0 +1,36 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl; + +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.File; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage; +import org.eclipse.emf.ecore.EClass; + +/** + * + * An implementation of the model object 'File'. + * + * + * @generated + */ +public class FileImpl extends FSObjectImpl implements File { + /** + * + * + * @generated + */ + protected FileImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilesystemPackage.Literals.FILE; + } + +} //FileImpl diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java new file mode 100644 index 00000000..adf30f3a --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FileSystemImpl.java @@ -0,0 +1,205 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl; + +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +/** + * + * An implementation of the model object 'File System'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl.FileSystemImpl#getRoot Root}
  • + *
  • {@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl.FileSystemImpl#getLive Live}
  • + *
+ * + * @generated + */ +public class FileSystemImpl extends MinimalEObjectImpl.Container implements FileSystem { + /** + * The cached value of the '{@link #getRoot() Root}' containment reference. + * + * + * @see #getRoot() + * @generated + * @ordered + */ + protected Dir root; + + /** + * The cached setting delegate for the '{@link #getLive() Live}' reference list. + * + * + * @see #getLive() + * @generated + * @ordered + */ + protected EStructuralFeature.Internal.SettingDelegate LIVE__ESETTING_DELEGATE = ((EStructuralFeature.Internal)FilesystemPackage.Literals.FILE_SYSTEM__LIVE).getSettingDelegate(); + + /** + * + * + * @generated + */ + protected FileSystemImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilesystemPackage.Literals.FILE_SYSTEM; + } + + /** + * + * + * @generated + */ + public Dir getRoot() { + return root; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetRoot(Dir newRoot, NotificationChain msgs) { + Dir oldRoot = root; + root = newRoot; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilesystemPackage.FILE_SYSTEM__ROOT, oldRoot, newRoot); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setRoot(Dir newRoot) { + if (newRoot != root) { + NotificationChain msgs = null; + if (root != null) + msgs = ((InternalEObject)root).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilesystemPackage.FILE_SYSTEM__ROOT, null, msgs); + if (newRoot != null) + msgs = ((InternalEObject)newRoot).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilesystemPackage.FILE_SYSTEM__ROOT, null, msgs); + msgs = basicSetRoot(newRoot, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilesystemPackage.FILE_SYSTEM__ROOT, newRoot, newRoot)); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + public EList getLive() { + return (EList)LIVE__ESETTING_DELEGATE.dynamicGet(this, null, 0, true, false); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilesystemPackage.FILE_SYSTEM__ROOT: + return basicSetRoot(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilesystemPackage.FILE_SYSTEM__ROOT: + return getRoot(); + case FilesystemPackage.FILE_SYSTEM__LIVE: + return getLive(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilesystemPackage.FILE_SYSTEM__ROOT: + setRoot((Dir)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilesystemPackage.FILE_SYSTEM__ROOT: + setRoot((Dir)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilesystemPackage.FILE_SYSTEM__ROOT: + return root != null; + case FilesystemPackage.FILE_SYSTEM__LIVE: + return LIVE__ESETTING_DELEGATE.dynamicIsSet(this, null, 0); + } + return super.eIsSet(featureID); + } + +} //FileSystemImpl diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java new file mode 100644 index 00000000..e40b0bd1 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemFactoryImpl.java @@ -0,0 +1,128 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl; + +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.*; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class FilesystemFactoryImpl extends EFactoryImpl implements FilesystemFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static FilesystemFactory init() { + try { + FilesystemFactory theFilesystemFactory = (FilesystemFactory)EPackage.Registry.INSTANCE.getEFactory(FilesystemPackage.eNS_URI); + if (theFilesystemFactory != null) { + return theFilesystemFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new FilesystemFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public FilesystemFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case FilesystemPackage.FILE_SYSTEM: return createFileSystem(); + case FilesystemPackage.DIR: return createDir(); + case FilesystemPackage.FILE: return createFile(); + case FilesystemPackage.MODEL: return createModel(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public FileSystem createFileSystem() { + FileSystemImpl fileSystem = new FileSystemImpl(); + return fileSystem; + } + + /** + * + * + * @generated + */ + public Dir createDir() { + DirImpl dir = new DirImpl(); + return dir; + } + + /** + * + * + * @generated + */ + public File createFile() { + FileImpl file = new FileImpl(); + return file; + } + + /** + * + * + * @generated + */ + public Model createModel() { + ModelImpl model = new ModelImpl(); + return model; + } + + /** + * + * + * @generated + */ + public FilesystemPackage getFilesystemPackage() { + return (FilesystemPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static FilesystemPackage getPackage() { + return FilesystemPackage.eINSTANCE; + } + +} //FilesystemFactoryImpl diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java new file mode 100644 index 00000000..87390fee --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/FilesystemPackageImpl.java @@ -0,0 +1,356 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl; + +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.File; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemFactory; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Model; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class FilesystemPackageImpl extends EPackageImpl implements FilesystemPackage { + /** + * + * + * @generated + */ + private EClass fileSystemEClass = null; + + /** + * + * + * @generated + */ + private EClass fsObjectEClass = null; + + /** + * + * + * @generated + */ + private EClass dirEClass = null; + + /** + * + * + * @generated + */ + private EClass fileEClass = null; + + /** + * + * + * @generated + */ + private EClass modelEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage#eNS_URI + * @see #init() + * @generated + */ + private FilesystemPackageImpl() { + super(eNS_URI, FilesystemFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link FilesystemPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static FilesystemPackage init() { + if (isInited) return (FilesystemPackage)EPackage.Registry.INSTANCE.getEPackage(FilesystemPackage.eNS_URI); + + // Obtain or create and register package + FilesystemPackageImpl theFilesystemPackage = (FilesystemPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FilesystemPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FilesystemPackageImpl()); + + isInited = true; + + // Create package meta-data objects + theFilesystemPackage.createPackageContents(); + + // Initialize created meta-data + theFilesystemPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theFilesystemPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(FilesystemPackage.eNS_URI, theFilesystemPackage); + return theFilesystemPackage; + } + + /** + * + * + * @generated + */ + public EClass getFileSystem() { + return fileSystemEClass; + } + + /** + * + * + * @generated + */ + public EReference getFileSystem_Root() { + return (EReference)fileSystemEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getFileSystem_Live() { + return (EReference)fileSystemEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getFSObject() { + return fsObjectEClass; + } + + /** + * + * + * @generated + */ + public EReference getFSObject_Parent() { + return (EReference)fsObjectEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getDir() { + return dirEClass; + } + + /** + * + * + * @generated + */ + public EReference getDir_Contents() { + return (EReference)dirEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getFile() { + return fileEClass; + } + + /** + * + * + * @generated + */ + public EClass getModel() { + return modelEClass; + } + + /** + * + * + * @generated + */ + public EReference getModel_Filesystems() { + return (EReference)modelEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getModel_OtherFSObjects() { + return (EReference)modelEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public FilesystemFactory getFilesystemFactory() { + return (FilesystemFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + fileSystemEClass = createEClass(FILE_SYSTEM); + createEReference(fileSystemEClass, FILE_SYSTEM__ROOT); + createEReference(fileSystemEClass, FILE_SYSTEM__LIVE); + + fsObjectEClass = createEClass(FS_OBJECT); + createEReference(fsObjectEClass, FS_OBJECT__PARENT); + + dirEClass = createEClass(DIR); + createEReference(dirEClass, DIR__CONTENTS); + + fileEClass = createEClass(FILE); + + modelEClass = createEClass(MODEL); + createEReference(modelEClass, MODEL__FILESYSTEMS); + createEReference(modelEClass, MODEL__OTHER_FS_OBJECTS); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + dirEClass.getESuperTypes().add(this.getFSObject()); + fileEClass.getESuperTypes().add(this.getFSObject()); + + // Initialize classes, features, and operations; add parameters + initEClass(fileSystemEClass, FileSystem.class, "FileSystem", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getFileSystem_Root(), this.getDir(), null, "root", null, 1, 1, FileSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getFileSystem_Live(), this.getFSObject(), null, "live", null, 0, -1, FileSystem.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); + + initEClass(fsObjectEClass, FSObject.class, "FSObject", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getFSObject_Parent(), this.getDir(), this.getDir_Contents(), "parent", null, 0, 1, FSObject.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(dirEClass, Dir.class, "Dir", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getDir_Contents(), this.getFSObject(), this.getFSObject_Parent(), "contents", null, 0, -1, Dir.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(fileEClass, File.class, "File", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getModel_Filesystems(), this.getFileSystem(), null, "filesystems", null, 1, 1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getModel_OtherFSObjects(), this.getFSObject(), null, "otherFSObjects", null, 0, -1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http://www.eclipse.org/emf/2002/Ecore + createEcoreAnnotations(); + // org.eclipse.viatra.query.querybasedfeature + createOrgAnnotations(); + } + + /** + * Initializes the annotations for http://www.eclipse.org/emf/2002/Ecore. + * + * + * @generated + */ + protected void createEcoreAnnotations() { + String source = "http://www.eclipse.org/emf/2002/Ecore"; + addAnnotation + (this, + source, + new String[] { + "settingDelegates", "org.eclipse.viatra.query.querybasedfeature" + }); + } + + /** + * Initializes the annotations for org.eclipse.viatra.query.querybasedfeature. + * + * + * @generated + */ + protected void createOrgAnnotations() { + String source = "org.eclipse.viatra.query.querybasedfeature"; + addAnnotation + (getFileSystem_Live(), + source, + new String[] { + "patternFQN", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.live" + }); + } + +} //FilesystemPackageImpl diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java new file mode 100644 index 00000000..4c236e8e --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/src/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/Filesystem/impl/ModelImpl.java @@ -0,0 +1,221 @@ +/** + */ +package hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl; + +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FSObject; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FileSystem; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.FilesystemPackage; +import hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Model; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +/** + * + * An implementation of the model object 'Model'. + * + *

+ * The following features are implemented: + *

+ *
    + *
  • {@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl.ModelImpl#getFilesystems Filesystems}
  • + *
  • {@link hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.impl.ModelImpl#getOtherFSObjects Other FS Objects}
  • + *
+ * + * @generated + */ +public class ModelImpl extends MinimalEObjectImpl.Container implements Model { + /** + * The cached value of the '{@link #getFilesystems() Filesystems}' containment reference. + * + * + * @see #getFilesystems() + * @generated + * @ordered + */ + protected FileSystem filesystems; + + /** + * The cached value of the '{@link #getOtherFSObjects() Other FS Objects}' containment reference list. + * + * + * @see #getOtherFSObjects() + * @generated + * @ordered + */ + protected EList otherFSObjects; + + /** + * + * + * @generated + */ + protected ModelImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilesystemPackage.Literals.MODEL; + } + + /** + * + * + * @generated + */ + public FileSystem getFilesystems() { + return filesystems; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetFilesystems(FileSystem newFilesystems, NotificationChain msgs) { + FileSystem oldFilesystems = filesystems; + filesystems = newFilesystems; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilesystemPackage.MODEL__FILESYSTEMS, oldFilesystems, newFilesystems); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setFilesystems(FileSystem newFilesystems) { + if (newFilesystems != filesystems) { + NotificationChain msgs = null; + if (filesystems != null) + msgs = ((InternalEObject)filesystems).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilesystemPackage.MODEL__FILESYSTEMS, null, msgs); + if (newFilesystems != null) + msgs = ((InternalEObject)newFilesystems).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilesystemPackage.MODEL__FILESYSTEMS, null, msgs); + msgs = basicSetFilesystems(newFilesystems, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilesystemPackage.MODEL__FILESYSTEMS, newFilesystems, newFilesystems)); + } + + /** + * + * + * @generated + */ + public EList getOtherFSObjects() { + if (otherFSObjects == null) { + otherFSObjects = new EObjectContainmentEList(FSObject.class, this, FilesystemPackage.MODEL__OTHER_FS_OBJECTS); + } + return otherFSObjects; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilesystemPackage.MODEL__FILESYSTEMS: + return basicSetFilesystems(null, msgs); + case FilesystemPackage.MODEL__OTHER_FS_OBJECTS: + return ((InternalEList)getOtherFSObjects()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilesystemPackage.MODEL__FILESYSTEMS: + return getFilesystems(); + case FilesystemPackage.MODEL__OTHER_FS_OBJECTS: + return getOtherFSObjects(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilesystemPackage.MODEL__FILESYSTEMS: + setFilesystems((FileSystem)newValue); + return; + case FilesystemPackage.MODEL__OTHER_FS_OBJECTS: + getOtherFSObjects().clear(); + getOtherFSObjects().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilesystemPackage.MODEL__FILESYSTEMS: + setFilesystems((FileSystem)null); + return; + case FilesystemPackage.MODEL__OTHER_FS_OBJECTS: + getOtherFSObjects().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilesystemPackage.MODEL__FILESYSTEMS: + return filesystems != null; + case FilesystemPackage.MODEL__OTHER_FS_OBJECTS: + return otherFSObjects != null && !otherFSObjects.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //ModelImpl -- cgit v1.2.3-54-g00ecf