Skip to content

Commit

Permalink
generate code with last EMF
Browse files Browse the repository at this point in the history
  • Loading branch information
marcadetd committed Apr 15, 2022
1 parent 7661c8c commit 4de4859
Show file tree
Hide file tree
Showing 21 changed files with 537 additions and 535 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
** are made available under the terms of the Eclipse Public License v2.0
** which accompanies this distribution, and is available at
** https://www.eclipse.org/legal/epl-v20.html
**
**
** This file is part of the RiseClipse tool
**
**
** Contributors:
** Computer Science Department, CentraleSupélec
** EDF R&D
Expand All @@ -26,14 +26,10 @@

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.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
Expand Down Expand Up @@ -826,7 +822,7 @@ public boolean isSetRefersToEnumType() {
@Override
public EList< Val > getVal() {
if( val == null ) {
val = new EObjectContainmentWithInverseEList.Unsettable< Val >( Val.class, this,
val = new EObjectContainmentWithInverseEList.Unsettable< >( Val.class, this,
SclPackage.ABSTRACT_DATA_ATTRIBUTE__VAL, SclPackage.VAL__PARENT_ABSTRACT_DATA_ATTRIBUTE );
}
return val;
Expand Down Expand Up @@ -975,7 +971,7 @@ public boolean isSetRefersToDAType() {
@Override
public EList< FCDA > getReferredByFCDA() {
if( referredByFCDA == null ) {
referredByFCDA = new EObjectWithInverseEList.Unsettable.ManyInverse< FCDA >( FCDA.class, this,
referredByFCDA = new EObjectWithInverseEList.Unsettable.ManyInverse< >( FCDA.class, this,
SclPackage.ABSTRACT_DATA_ATTRIBUTE__REFERRED_BY_FCDA,
SclPackage.FCDA__REFERS_TO_ABSTRACT_DATA_ATTRIBUTE );
}
Expand Down Expand Up @@ -1010,7 +1006,7 @@ public boolean isSetReferredByFCDA() {
@Override
public EList< ExtRef > getReferredByExtRef() {
if( referredByExtRef == null ) {
referredByExtRef = new EObjectWithInverseEList.Unsettable< ExtRef >( ExtRef.class, this,
referredByExtRef = new EObjectWithInverseEList.Unsettable< >( ExtRef.class, this,
SclPackage.ABSTRACT_DATA_ATTRIBUTE__REFERRED_BY_EXT_REF,
SclPackage.EXT_REF__REFERS_TO_ABSTRACT_DATA_ATTRIBUTE );
}
Expand Down Expand Up @@ -1097,7 +1093,7 @@ public boolean isSetName() {
@Override
public EList< DAI > getReferredByDAI() {
if( referredByDAI == null ) {
referredByDAI = new EObjectWithInverseEList.Unsettable< DAI >( DAI.class, this,
referredByDAI = new EObjectWithInverseEList.Unsettable< >( DAI.class, this,
SclPackage.ABSTRACT_DATA_ATTRIBUTE__REFERRED_BY_DAI,
SclPackage.DAI__REFERS_TO_ABSTRACT_DATA_ATTRIBUTE );
}
Expand Down Expand Up @@ -1132,7 +1128,7 @@ public boolean isSetReferredByDAI() {
@Override
public EList< SDI > getReferredBySDI() {
if( referredBySDI == null ) {
referredBySDI = new EObjectWithInverseEList.Unsettable< SDI >( SDI.class, this,
referredBySDI = new EObjectWithInverseEList.Unsettable< >( SDI.class, this,
SclPackage.ABSTRACT_DATA_ATTRIBUTE__REFERRED_BY_SDI,
SclPackage.SDI__REFERS_TO_ABSTRACT_DATA_ATTRIBUTE );
}
Expand Down Expand Up @@ -1490,14 +1486,14 @@ protected void doBuildExplicitLinks( @NonNull IRiseClipseConsole console ) {

if( ( getType() == null ) || getType().isEmpty() ) {
console.warning( EXPLICIT_LINK_CATEGORY, getLineNumber(),
messagePrefix, "type is missing" );
messagePrefix, "type is missing" );
return;
}

DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) {
console.warning( EXPLICIT_LINK_CATEGORY, getLineNumber(),
messagePrefix, "DataTypeTemplates is missing" );
messagePrefix, "DataTypeTemplates is missing" );
return;
}

Expand All @@ -1513,14 +1509,14 @@ protected void doBuildExplicitLinks( @NonNull IRiseClipseConsole console ) {

if( res.size() != 1 ) {
console.warning( EXPLICIT_LINK_CATEGORY, getLineNumber(),
messagePrefix, (( res.size() == 0 ) ? "cannot find" : "found several" ),
" EnumType( id = ", getType(), " )" );
messagePrefix, ( ( res.size() == 0 ) ? "cannot find" : "found several" ),
" EnumType( id = ", getType(), " )" );
return;
}
setRefersToEnumType( res.get( 0 ) );
console.notice( EXPLICIT_LINK_CATEGORY, getLineNumber(),
"AbstractDataAttribute refers to EnumType( id = ", getType(), " ) on line ",
getRefersToEnumType().getLineNumber() );
"AbstractDataAttribute refers to EnumType( id = ", getType(), " ) on line ",
getRefersToEnumType().getLineNumber() );
}
else if( "Struct".equals( getBType() ) ) {

Expand All @@ -1534,14 +1530,14 @@ else if( "Struct".equals( getBType() ) ) {

if( res.size() != 1 ) {
console.warning( EXPLICIT_LINK_CATEGORY, getLineNumber(),
messagePrefix, (( res.size() == 0 ) ? "cannot find" : "found several" ),
" DAType( id = ", getType(), " )" );
messagePrefix, ( ( res.size() == 0 ) ? "cannot find" : "found several" ),
" DAType( id = ", getType(), " )" );
return;
}
setRefersToDAType( res.get( 0 ) );
console.notice( EXPLICIT_LINK_CATEGORY, getLineNumber(),
"AbstractDataAttribute refers to EnumType( id = ", getType(), " ) on line ",
getRefersToDAType().getLineNumber() );
console.notice( EXPLICIT_LINK_CATEGORY, getLineNumber(),
"AbstractDataAttribute refers to EnumType( id = ", getType(), " ) on line ",
getRefersToDAType().getLineNumber() );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
** are made available under the terms of the Eclipse Public License v2.0
** which accompanies this distribution, and is available at
** https://www.eclipse.org/legal/epl-v20.html
**
**
** This file is part of the RiseClipse tool
**
**
** Contributors:
** Computer Science Department, CentraleSupélec
** EDF R&D
Expand All @@ -20,6 +20,22 @@
*/
package fr.centralesupelec.edf.riseclipse.iec61850.scl.impl;

import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

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.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jdt.annotation.NonNull;

import fr.centralesupelec.edf.riseclipse.iec61850.scl.AnyLN;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.Association;
import fr.centralesupelec.edf.riseclipse.iec61850.scl.ClientLN;
Expand All @@ -41,22 +57,6 @@
import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole;
import fr.centralesupelec.edf.riseclipse.util.IRiseClipseConsole;

import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

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.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jdt.annotation.NonNull;

/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Any LN</b></em>'.
Expand Down Expand Up @@ -729,7 +729,7 @@ public boolean isSetInputs() {
@Override
public EList< Log > getLog() {
if( log == null ) {
log = new EObjectContainmentWithInverseEList.Unsettable< Log >( Log.class, this, SclPackage.ANY_LN__LOG,
log = new EObjectContainmentWithInverseEList.Unsettable< >( Log.class, this, SclPackage.ANY_LN__LOG,
SclPackage.LOG__PARENT_ANY_LN );
}
return log;
Expand Down Expand Up @@ -763,7 +763,7 @@ public boolean isSetLog() {
@Override
public EList< DOI > getDOI() {
if( doi == null ) {
doi = new EObjectContainmentWithInverseEList.Unsettable< DOI >( DOI.class, this, SclPackage.ANY_LN__DOI,
doi = new EObjectContainmentWithInverseEList.Unsettable< >( DOI.class, this, SclPackage.ANY_LN__DOI,
SclPackage.DOI__PARENT_ANY_LN );
}
return doi;
Expand Down Expand Up @@ -797,7 +797,7 @@ public boolean isSetDOI() {
@Override
public EList< ReportControl > getReportControl() {
if( reportControl == null ) {
reportControl = new EObjectContainmentWithInverseEList.Unsettable< ReportControl >( ReportControl.class,
reportControl = new EObjectContainmentWithInverseEList.Unsettable< >( ReportControl.class,
this, SclPackage.ANY_LN__REPORT_CONTROL, SclPackage.REPORT_CONTROL__PARENT_ANY_LN );
}
return reportControl;
Expand Down Expand Up @@ -831,7 +831,7 @@ public boolean isSetReportControl() {
@Override
public EList< LogControl > getLogControl() {
if( logControl == null ) {
logControl = new EObjectContainmentWithInverseEList.Unsettable< LogControl >( LogControl.class, this,
logControl = new EObjectContainmentWithInverseEList.Unsettable< >( LogControl.class, this,
SclPackage.ANY_LN__LOG_CONTROL, SclPackage.LOG_CONTROL__PARENT_ANY_LN );
}
return logControl;
Expand Down Expand Up @@ -865,7 +865,7 @@ public boolean isSetLogControl() {
@Override
public EList< DataSet > getDataSet() {
if( dataSet == null ) {
dataSet = new EObjectContainmentWithInverseEList.Unsettable< DataSet >( DataSet.class, this,
dataSet = new EObjectContainmentWithInverseEList.Unsettable< >( DataSet.class, this,
SclPackage.ANY_LN__DATA_SET, SclPackage.DATA_SET__PARENT_ANY_LN );
}
return dataSet;
Expand Down Expand Up @@ -899,7 +899,7 @@ public boolean isSetDataSet() {
@Override
public EList< ClientLN > getReferredByClientLN() {
if( referredByClientLN == null ) {
referredByClientLN = new EObjectWithInverseEList.Unsettable< ClientLN >( ClientLN.class, this,
referredByClientLN = new EObjectWithInverseEList.Unsettable< >( ClientLN.class, this,
SclPackage.ANY_LN__REFERRED_BY_CLIENT_LN, SclPackage.CLIENT_LN__REFERS_TO_ANY_LN );
}
return referredByClientLN;
Expand Down Expand Up @@ -933,7 +933,7 @@ public boolean isSetReferredByClientLN() {
@Override
public EList< LogControl > getReferredByLogControl() {
if( referredByLogControl == null ) {
referredByLogControl = new EObjectWithInverseEList.Unsettable< LogControl >( LogControl.class, this,
referredByLogControl = new EObjectWithInverseEList.Unsettable< >( LogControl.class, this,
SclPackage.ANY_LN__REFERRED_BY_LOG_CONTROL, SclPackage.LOG_CONTROL__REFERS_TO_ANY_LN );
}
return referredByLogControl;
Expand Down Expand Up @@ -967,7 +967,7 @@ public boolean isSetReferredByLogControl() {
@Override
public EList< Association > getReferredByAssociation() {
if( referredByAssociation == null ) {
referredByAssociation = new EObjectWithInverseEList.Unsettable< Association >( Association.class, this,
referredByAssociation = new EObjectWithInverseEList.Unsettable< >( Association.class, this,
SclPackage.ANY_LN__REFERRED_BY_ASSOCIATION, SclPackage.ASSOCIATION__REFERS_TO_ANY_LN );
}
return referredByAssociation;
Expand Down Expand Up @@ -1001,7 +1001,7 @@ public boolean isSetReferredByAssociation() {
@Override
public EList< IEDName > getReferredByIEDName() {
if( referredByIEDName == null ) {
referredByIEDName = new EObjectWithInverseEList.Unsettable< IEDName >( IEDName.class, this,
referredByIEDName = new EObjectWithInverseEList.Unsettable< >( IEDName.class, this,
SclPackage.ANY_LN__REFERRED_BY_IED_NAME, SclPackage.IED_NAME__REFERS_TO_ANY_LN );
}
return referredByIEDName;
Expand Down Expand Up @@ -1035,7 +1035,7 @@ public boolean isSetReferredByIEDName() {
@Override
public EList< LNode > getReferredByLNode() {
if( referredByLNode == null ) {
referredByLNode = new EObjectWithInverseEList.Unsettable< LNode >( LNode.class, this,
referredByLNode = new EObjectWithInverseEList.Unsettable< >( LNode.class, this,
SclPackage.ANY_LN__REFERRED_BY_LNODE, SclPackage.LNODE__REFERS_TO_ANY_LN );
}
return referredByLNode;
Expand Down Expand Up @@ -1068,7 +1068,8 @@ public boolean isSetReferredByLNode() {
*/
@Override
public LDevice getParentLDevice() {
AbstractRiseClipseConsole.getConsole().emergency( EXPLICIT_LINK_CATEGORY, getLineNumber(), "AnyLNImpl.getParentLDevice() called" );
AbstractRiseClipseConsole.getConsole().emergency( EXPLICIT_LINK_CATEGORY, getLineNumber(),
"AnyLNImpl.getParentLDevice() called" );
return null;
}

Expand All @@ -1080,14 +1081,14 @@ public LDevice getParentLDevice() {
@Override
public String getNamespace() {
//@formatter:off

// The attribute lnNs shall be a DataAttribute of the name plate NamPlt of a logical node.
//
// 1. AnyLN.DOI["NamPlt"].DAI["lnNs"].value if present
// 2. AnyLN.LNodeType.namespace if not null
// 3. AnyLN.ParentLDevice.ldNs otherwise


List< DOI > namPltDoi =
getDOI()
.stream()
Expand Down Expand Up @@ -1517,13 +1518,13 @@ protected void doBuildExplicitLinks( @NonNull IRiseClipseConsole console ) {

if( ( getLnType() == null ) || getLnType().isEmpty() ) {
console.warning( EXPLICIT_LINK_CATEGORY, getLineNumber(),
messagePrefix, "lnType is missing" );
messagePrefix, "lnType is missing" );
return;
}
DataTypeTemplates dtt = SclUtilities.getSCL( this ).getDataTypeTemplates();
if( dtt == null ) {
console.warning( EXPLICIT_LINK_CATEGORY, getLineNumber(),
messagePrefix, "DataTypeTemplates is missing" );
messagePrefix, "DataTypeTemplates is missing" );
return;
}

Expand All @@ -1535,19 +1536,19 @@ protected void doBuildExplicitLinks( @NonNull IRiseClipseConsole console ) {

if( res.size() != 1 ) {
console.warning( EXPLICIT_LINK_CATEGORY, getLineNumber(),
messagePrefix, (( res.size() == 0 ) ? "cannot find" : "found several" ),
" LNodeType( id = ", getLnType(), " )" );
messagePrefix, ( ( res.size() == 0 ) ? "cannot find" : "found several" ),
" LNodeType( id = ", getLnType(), " )" );
return;
}
setRefersToLNodeType( res.get( 0 ) );
console.notice( EXPLICIT_LINK_CATEGORY, getLineNumber(),
"AnyLN on line ", getLineNumber(), " refers to LNodeType( id = ", getLnType(),
" ) on line ", getRefersToLNodeType().getLineNumber() );
"AnyLN on line ", getLineNumber(), " refers to LNodeType( id = ", getLnType(),
" ) on line ", getRefersToLNodeType().getLineNumber() );

if( ( getLnClass() != null ) && !getLnClass().equals( getRefersToLNodeType().getLnClass() )) {
if( ( getLnClass() != null ) && !getLnClass().equals( getRefersToLNodeType().getLnClass() ) ) {
console.warning( EXPLICIT_LINK_CATEGORY, getLineNumber(),
messagePrefix, "lnClass in LNodeType( id = ", getLnType(), " ) is ",
getRefersToLNodeType().getLnClass(), " and not ", getLnClass() );
messagePrefix, "lnClass in LNodeType( id = ", getLnType(), " ) is ",
getRefersToLNodeType().getLnClass(), " and not ", getLnClass() );
}
}

Expand Down
Loading

0 comments on commit 4de4859

Please sign in to comment.