Commit 8dc09b54 authored by Dominique Marcadet's avatar Dominique Marcadet

small changes to clean/update

parent 51b20621
......@@ -36,53 +36,54 @@ import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole;
public class AnyLNValidator {
private String lnClass;
private HashMap< String, DataObject > doMap;
private HashMap< String, DOIValidator > cdcMap;
private String lnClassName;
private HashMap< String, DataObject > dataObjectMap;
private HashMap< String, DOIValidator > doiValidatorMap;
public AnyLNValidator( LNClass lnClass ) {
this.lnClass = lnClass.getName();
this.doMap = new HashMap<>(); // link between DOI (name) and its respective DataObject
this.cdcMap = new HashMap<>(); // link between CDC (name) and its respective DOIValidator
this.lnClassName = lnClass.getName();
this.dataObjectMap = new HashMap<>(); // link between DOI (name) and its respective DataObject
this.doiValidatorMap = new HashMap<>(); // link between CDC (name) and its respective DOIValidator
generateValidators( doMap, cdcMap, lnClass );
generateValidators( lnClass );
// LNClass hierarchy taken into account
AbstractLNClass parent = lnClass.getRefersToAbstractLNClass();
while( parent != null ) {
generateValidators( doMap, cdcMap, parent );
generateValidators( parent );
parent = parent.getRefersToAbstractLNClass();
}
}
private void generateValidators( HashMap< String, DataObject > doMap, HashMap< String, DOIValidator > cdcMap, AnyLNClass lnClass ) {
private void generateValidators( AnyLNClass lnClass ) {
for( DataObject dObj : lnClass.getDataObject() ) {
doMap.put( dObj.getName(), dObj );
dataObjectMap.put( dObj.getName(), dObj );
if( dObj.getRefersToCDC() != null ) {
if( ! cdcMap.containsKey( dObj.getRefersToCDC().getName() )) {
cdcMap.put( dObj.getRefersToCDC().getName(), new DOIValidator( dObj.getRefersToCDC() ));
if( ! doiValidatorMap.containsKey( dObj.getRefersToCDC().getName() )) {
doiValidatorMap.put( dObj.getRefersToCDC().getName(), new DOIValidator( dObj.getRefersToCDC() ));
}
}
}
}
public boolean validateLN( AnyLN ln, DiagnosticChain diagnostics ) {
public boolean validateAnyLN( AnyLN anyLN, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] validateAnyLN( " + anyLN.getLnClass() + " )" );
boolean res = true;
HashSet< String > checkedDO = new HashSet<>();
for( DOI doi : ln.getDOI() ) {
AbstractRiseClipseConsole.getConsole().verbose( "validateDOI( " + doi.getName() + " )" );
for( DOI doi : anyLN.getDOI() ) {
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] validateDOI( " + doi.getName() + " )" );
// Test if DOI is a possible DOI in this LN
if( ! doMap.containsKey( doi.getName() ) ) {
if( ! dataObjectMap.containsKey( doi.getName() ) ) {
diagnostics.add( new BasicDiagnostic(
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DO " + doi.getName() + " in LN at line " + ln.getLineNumber() + " not found in LNClass " + ln.getLnClass(),
new Object[] { ln } ));
"[NSD] DO " + doi.getName() + " in AnyLN at line " + anyLN.getLineNumber() + " not found in LNClass " + anyLN.getLnClass(),
new Object[] { anyLN } ));
continue;
}
......@@ -97,15 +98,15 @@ public class AnyLNValidator {
}
// Verify all necessary DOI were present
if( ! doMap.values().stream()
.map( x -> checkCompulsory( ln, x, checkedDO, diagnostics ))
if( ! dataObjectMap.values().stream()
.map( x -> checkCompulsory( anyLN, x, checkedDO, diagnostics ))
.reduce( ( a, b ) -> a && b ).get() ) {
diagnostics.add( new BasicDiagnostic(
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"LN at line " + ln.getLineNumber() + " does not contain all mandatory DO from class " + ln.getLnClass(),
new Object[] { ln } ));
"[NSD] AnyLN at line " + anyLN.getLineNumber() + " does not contain all mandatory DO from class " + anyLN.getLnClass(),
new Object[] { anyLN } ));
res = false;
}
return res;
......@@ -119,7 +120,7 @@ public class AnyLNValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DO " + dataObject.getName() + " is missing in LN at line " + ln.getLineNumber(),
"[NSD] DO " + dataObject.getName() + " is missing in LN at line " + ln.getLineNumber(),
new Object[] { ln } ));
return false;
}
......@@ -132,7 +133,7 @@ public class AnyLNValidator {
}
private boolean updateCompulsory( DOI doi, HashSet< String > checkedDO, DiagnosticChain diagnostics ) {
switch( doMap.get( doi.getName() ).getPresCond() ) {
switch( dataObjectMap.get( doi.getName() ).getPresCond() ) {
case "M":
case "O":
if( checkedDO.contains( doi.getName() )) {
......@@ -140,7 +141,7 @@ public class AnyLNValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DO " + doi + " cannot appear more than once in LN at line " + doi.getParentAnyLN().getLineNumber(),
"[NSD] DO " + doi + " cannot appear more than once in LN at line " + doi.getParentAnyLN().getLineNumber(),
new Object[] { doi } ));
return false;
}
......@@ -151,23 +152,22 @@ public class AnyLNValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DO " + doi + " is forbidden in LN at line " + doi.getParentAnyLN().getLineNumber(),
"[NSD] DO " + doi + " is forbidden in LN at line " + doi.getParentAnyLN().getLineNumber(),
new Object[] { doi } ));
return false;
default:
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: AnyLNValidator.updateCompulsory( " + doMap.get( doi.getName() ).getPresCond() + " )" );
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: AnyLNValidator.updateCompulsory( " + dataObjectMap.get( doi.getName() ).getPresCond() + " )" );
break;
}
return true;
}
private boolean validateDOI( DOI doi, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "found DO " + doi.getName() + " in LNClass " + lnClass );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] found DO " + doi.getName() + " in LNClass " + lnClassName );
// DOIValidator validates DOI content
String cdc = doMap.get( doi.getName() ).getRefersToCDC().getName();
return cdcMap.get( cdc ).validateDOI( doi, diagnostics );
String cdc = dataObjectMap.get( doi.getName() ).getRefersToCDC().getName();
return doiValidatorMap.get( cdc ).validateDOI( doi, diagnostics );
}
}
......@@ -35,15 +35,15 @@ import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole;
public class DOIValidator {
private String cdc;
private HashMap< String, DataAttribute > daMap;
private String cdcName;
private HashMap< String, DataAttribute > dataAttributeMap;
public DOIValidator( CDC cdc ) {
this.cdc = cdc.getName();
this.daMap = new HashMap<>(); // link between DAI (name) and its respective DataAttribute
this.cdcName = cdc.getName();
this.dataAttributeMap = new HashMap<>(); // link between DAI (name) and its respective DataAttribute
for( DataAttribute da : cdc.getDataAttribute() ) {
this.daMap.put( da.getName(), da );
this.dataAttributeMap.put( da.getName(), da );
}
}
......@@ -52,16 +52,16 @@ public class DOIValidator {
HashSet< String > checkedDA = new HashSet<>();
for( DAI dai : doi.getDAI() ) {
AbstractRiseClipseConsole.getConsole().verbose( "validateDAI( " + dai.getName() + " ) (line" + dai.getLineNumber() + ")" );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] validateDAI( " + dai.getName() + " ) (line " + dai.getLineNumber() + ")" );
// Test if DAI is a possible DAI in this DOI
if( ! daMap.containsKey( dai.getName() ) ) {
if( ! dataAttributeMap.containsKey( dai.getName() ) ) {
diagnostics.add( new BasicDiagnostic(
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DAI " + dai.getName() + " (line" + dai.getLineNumber() + ") not found in CDC",
new Object[] { doi, cdc } ));
"[NSD] DAI " + dai.getName() + " (line " + dai.getLineNumber() + ") not found in CDC",
new Object[] { doi, cdcName } ));
res = false;
continue;
}
......@@ -77,15 +77,15 @@ public class DOIValidator {
}
// Verify all necessary DAI were present
if( ! daMap.values().stream()
if( ! dataAttributeMap.values().stream()
.map( x -> checkCompulsory( doi, x, checkedDA, diagnostics ) )
.reduce( ( a, b ) -> a && b ).get() ) {
diagnostics.add( new BasicDiagnostic(
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DOI (line " + doi.getLineNumber() + ") does not contain all mandatory DA from CDC ",
new Object[] { doi, cdc } ));
"[NSD] DOI (line " + doi.getLineNumber() + ") does not contain all mandatory DA from CDC",
new Object[] { doi, cdcName } ));
res = false;
}
return res;
......@@ -99,20 +99,20 @@ public class DOIValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DA " + da.getName() + " not found in DOI (line " + doi.getLineNumber() + ")",
"[NSD] DA " + da.getName() + " not found in DOI (line " + doi.getLineNumber() + ")",
new Object[] { da } ));
return false;
}
break;
default:
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: DOIValidator.checkCompulsory( " + da.getPresCond() + " )" );
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: DOIValidator.checkCompulsory( presCond: " + da.getPresCond() + " )" );
break;
}
return true;
}
public boolean updateCompulsory( DAI dai, HashSet< String > checked, DiagnosticChain diagnostics ) {
switch( daMap.get( dai.getName() ).getPresCond() ) {
switch( dataAttributeMap.get( dai.getName() ).getPresCond() ) {
case "M":
case "O":
if( checked.contains( dai.getName() ) ) {
......@@ -120,7 +120,7 @@ public class DOIValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DAI " + dai.getName() + " (line " + dai.getLineNumber() + ") cannot appear more than once",
"[NSD] DAI " + dai.getName() + " (line " + dai.getLineNumber() + ") cannot appear more than once",
new Object[] { dai } ));
return false;
}
......@@ -133,11 +133,11 @@ public class DOIValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DAI " + dai.getName() + " (line " + dai.getLineNumber() + ") is forbidden",
"[NSD] DAI " + dai.getName() + " (line " + dai.getLineNumber() + ") is forbidden",
new Object[] { dai } ));
return false;
default:
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: DOIValidator.updateCompulsory( " + daMap.get( dai.getName() ).getPresCond() + " )" );
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: DOIValidator.updateCompulsory( presCond: " + dataAttributeMap.get( dai.getName() ).getPresCond() + " )" );
break;
}
return true;
......@@ -145,10 +145,10 @@ public class DOIValidator {
public boolean validateDAI( DAI dai, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "found DA " + dai.getName() + " in CDC " + cdc );
AbstractRiseClipseConsole.getConsole().verbose( "found DA " + dai.getName() + " in CDC " + cdcName );
// DataAttributes that are BASIC have a BasicType which describes allowed Val of DA
DataAttribute da = daMap.get( dai.getName() );
DataAttribute da = dataAttributeMap.get( dai.getName() );
if( da.getTypeKind().getName().equals( "BASIC" ) ) {
for( Val val : dai.getVal() ) {
if( ! validateVal( val.getValue(), da.getType() )) {
......@@ -156,14 +156,17 @@ public class DOIValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"Val " + val.getValue() + " (" + dai.getLineNumber() + ") of DA " + dai.getName() + " is not of type " + da.getType(),
"[NSD] Val " + val.getValue() + " (" + dai.getLineNumber() + ") of DA " + dai.getName() + " is not of type " + da.getType(),
new Object[] { dai, val } ));
return false;
}
AbstractRiseClipseConsole.getConsole().verbose( "Val " + val.getValue() + " (" + dai.getLineNumber() + ") of DA " + dai.getName() +
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] Val " + val.getValue() + " (" + dai.getLineNumber() + ") of DA " + dai.getName() +
" is of type " + da.getType() );
}
}
else {
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: DOIValidator.validateDAI( kind: " + da.getTypeKind().getName() + " )" );
}
return true;
}
......
......@@ -34,38 +34,38 @@ import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole;
public class DOValidator {
private String cdc;
private HashMap< String, DataAttribute > daMap;
private String cdcName;
private HashMap< String, DataAttribute > dataAttributeMap;
public DOValidator( CDC cdc ) {
this.cdc = cdc.getName();
this.daMap = new HashMap<>(); // link between DAI (name) and its respective DataAttribute
this.cdcName = cdc.getName();
this.dataAttributeMap = new HashMap<>(); // link between DAI (name) and its respective DataAttribute
for( DataAttribute da : cdc.getDataAttribute() ) {
this.daMap.put( da.getName(), da );
this.dataAttributeMap.put( da.getName(), da );
}
}
public boolean validateDO( DO do_, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "validateDO( " + do_.getName() + " )" );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] validateDO( " + do_.getName() + " )" );
boolean res = true;
HashSet< String > checkedDA = new HashSet<>();
if( do_.getRefersToDOType() == null ) {
AbstractRiseClipseConsole.getConsole().warning( "validateDO: DO " + do_.getName() + " has no RefersToDOType" );
AbstractRiseClipseConsole.getConsole().warning( "[NSD] validateDO: DO " + do_.getName() + " has no RefersToDOType" );
}
else {
for( DA da : do_.getRefersToDOType().getDA() ) {
AbstractRiseClipseConsole.getConsole().verbose( "validateDO on DA " + da.getName() + " (line" + da.getLineNumber() + ")" );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] validateDO on DA " + da.getName() + " (line " + da.getLineNumber() + ")" );
// Test if DA is a possible DA in this DO
if( ! daMap.containsKey( da.getName() ) ) {
if( ! dataAttributeMap.containsKey( da.getName() ) ) {
diagnostics.add( new BasicDiagnostic(
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DA " + da.getName() + " (line" + da.getLineNumber() + ") not found in CDC",
new Object[] { do_, cdc } ));
"[NSD] DA " + da.getName() + " (line " + da.getLineNumber() + ") not found in CDC",
new Object[] { do_, cdcName } ));
res = false;
continue;
}
......@@ -76,15 +76,15 @@ public class DOValidator {
}
// Verify all necessary DA were present
if( ! daMap.values().stream()
if( ! dataAttributeMap.values().stream()
.map( x -> checkCompulsory( do_, x, checkedDA, diagnostics ) )
.reduce( ( a, b ) -> a && b ).get() ) {
diagnostics.add( new BasicDiagnostic(
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DO (line " + do_.getLineNumber() + ") does not contain all mandatory DA from CDC ",
new Object[] { do_, cdc } ));
"[NSD] DO (line " + do_.getLineNumber() + ") does not contain all mandatory DA from CDC",
new Object[] { do_, cdcName } ));
res = false;
}
return res;
......@@ -98,20 +98,20 @@ public class DOValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DA " + da.getName() + " not found in DO (line " + do_.getLineNumber() + ")",
"[NSD] DA " + da.getName() + " not found in DO (line " + do_.getLineNumber() + ")",
new Object[] { da } ));
return false;
}
break;
default:
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: DOValidator.checkCompulsory( " + da.getPresCond() + " )" );
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: DOValidator.checkCompulsory( presCond: " + da.getPresCond() + " )" );
break;
}
return true;
}
public boolean updateCompulsory( DA da, HashSet< String > checked, DiagnosticChain diagnostics ) {
switch( daMap.get( da.getName() ).getPresCond() ) {
switch( dataAttributeMap.get( da.getName() ).getPresCond() ) {
case "M":
case "O":
if( checked.contains( da.getName() ) ) {
......@@ -119,7 +119,7 @@ public class DOValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DA " + da.getName() + " (line " + da.getLineNumber() + ") cannot appear more than once",
"[NSD] DA " + da.getName() + " (line " + da.getLineNumber() + ") cannot appear more than once",
new Object[] { da } ));
return false;
}
......@@ -132,11 +132,11 @@ public class DOValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DA " + da.getName() + " (line " + da.getLineNumber() + ") is forbidden",
"[NSD] DA " + da.getName() + " (line " + da.getLineNumber() + ") is forbidden",
new Object[] { da } ));
return false;
default:
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: DOIValidator.updateCompulsory( " + daMap.get( da.getName() ).getPresCond() + " )" );
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: DOValidator.updateCompulsory( presCond: " + dataAttributeMap.get( da.getName() ).getPresCond() + " )" );
break;
}
return true;
......
......@@ -36,52 +36,53 @@ import fr.centralesupelec.edf.riseclipse.util.AbstractRiseClipseConsole;
public class LNodeTypeValidator {
private String lnClass;
private HashMap< String, DataObject > doMap;
private HashMap< String, DOValidator > cdcMap;
private String lnClassName;
private HashMap< String, DataObject > dataObjectMap;
private HashMap< String, DOValidator > doValidatorMap;
public LNodeTypeValidator( LNClass lnClass ) {
this.lnClass = lnClass.getName();
this.doMap = new HashMap<>(); // link between DOI (name) and its respective DataObject
this.cdcMap = new HashMap<>(); // link between CDC (name) and its respective DOIValidator
this.lnClassName = lnClass.getName();
this.dataObjectMap = new HashMap<>(); // link between DOI (name) and its respective DataObject
this.doValidatorMap = new HashMap<>(); // link between CDC (name) and its respective DOIValidator
generateValidators( doMap, cdcMap, lnClass );
generateValidators( lnClass );
// LNClass hierarchy taken into account
AbstractLNClass parent = lnClass.getRefersToAbstractLNClass();
while( parent != null ) {
generateValidators( doMap, cdcMap, parent );
generateValidators( parent );
parent = parent.getRefersToAbstractLNClass();
}
}
private void generateValidators( HashMap< String, DataObject > doMap, HashMap< String, DOValidator > cdcMap, AnyLNClass lnClass ) {
private void generateValidators( AnyLNClass lnClass ) {
for( DataObject dObj : lnClass.getDataObject() ) {
doMap.put( dObj.getName(), dObj );
dataObjectMap.put( dObj.getName(), dObj );
if( dObj.getRefersToCDC() != null ) {
if( ! cdcMap.containsKey( dObj.getRefersToCDC().getName() )) {
cdcMap.put( dObj.getRefersToCDC().getName(), new DOValidator( dObj.getRefersToCDC() ));
if( ! doValidatorMap.containsKey( dObj.getRefersToCDC().getName() )) {
doValidatorMap.put( dObj.getRefersToCDC().getName(), new DOValidator( dObj.getRefersToCDC() ));
}
}
}
}
public boolean validateLNodeType( LNodeType lNodeType, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] validateLNodeType( " + lNodeType.getId() + " )" );
boolean res = true;
HashSet< String > checkedDO = new HashSet<>();
for( DO do_ : lNodeType.getDO() ) {
AbstractRiseClipseConsole.getConsole().verbose( "validateDOI( " + do_.getName() + " )" );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] validateDO( " + do_.getName() + " )" );
// Test if DOI is a possible DOI in this LN
if( ! doMap.containsKey( do_.getName() ) ) {
if( ! dataObjectMap.containsKey( do_.getName() ) ) {
diagnostics.add( new BasicDiagnostic(
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DO " + do_.getName() + " in LN at line " + lNodeType.getLineNumber() + " not found in LNClass " + lNodeType.getLnClass(),
"[NSD] DO " + do_.getName() + " in LN at line " + lNodeType.getLineNumber() + " not found in LNClass " + lNodeType.getLnClass(),
new Object[] { lNodeType } ));
continue;
}
......@@ -97,14 +98,14 @@ public class LNodeTypeValidator {
}
// Verify all necessary DOI were present
if( ! doMap.values().stream()
if( ! dataObjectMap.values().stream()
.map( x -> checkCompulsory( lNodeType, x, checkedDO, diagnostics ))
.reduce( ( a, b ) -> a && b ).get() ) {
diagnostics.add( new BasicDiagnostic(
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"LNodeType at line " + lNodeType.getLineNumber() + " does not contain all mandatory DO from class " + lNodeType.getLnClass(),
"[NSD] LNodeType at line " + lNodeType.getLineNumber() + " does not contain all mandatory DO from class " + lNodeType.getLnClass(),
new Object[] { lNodeType } ));
res = false;
}
......@@ -119,7 +120,7 @@ public class LNodeTypeValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DO " + dataObject.getName() + " is missing in LN at line " + lNodeType.getLineNumber(),
"[NSD] DO " + dataObject.getName() + " is missing in LN at line " + lNodeType.getLineNumber(),
new Object[] { lNodeType } ));
return false;
}
......@@ -132,7 +133,7 @@ public class LNodeTypeValidator {
}
private boolean updateCompulsory( DO do_, HashSet< String > checkedDO, DiagnosticChain diagnostics ) {
switch( doMap.get( do_.getName() ).getPresCond() ) {
switch( dataObjectMap.get( do_.getName() ).getPresCond() ) {
case "M":
case "O":
if( checkedDO.contains( do_.getName() )) {
......@@ -140,7 +141,7 @@ public class LNodeTypeValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DO " + do_ + " cannot appear more than once in LN at line " + do_.getParentLNodeType().getLineNumber(),
"[NSD] DO " + do_ + " cannot appear more than once in LN at line " + do_.getParentLNodeType().getLineNumber(),
new Object[] { do_ } ));
return false;
}
......@@ -151,23 +152,22 @@ public class LNodeTypeValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"DO " + do_ + " is forbidden in LN at line " + do_.getParentLNodeType().getLineNumber(),
"[NSD] DO " + do_ + " is forbidden in LN at line " + do_.getParentLNodeType().getLineNumber(),
new Object[] { do_ } ));
return false;
default:
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: AnyLNValidator.updateCompulsory( " + doMap.get( do_.getName() ).getPresCond() + " )" );
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: AnyLNValidator.updateCompulsory( " + dataObjectMap.get( do_.getName() ).getPresCond() + " )" );
break;
}
return true;
}
private boolean validateDO( DO do_, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "found DO " + do_.getName() + " in LNClass " + lnClass );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] found DO " + do_.getName() + " in LNClass " + lnClassName );
// DOIValidator validates DOI content
String cdc = doMap.get( do_.getName() ).getRefersToCDC().getName();
return cdcMap.get( cdc ).validateDO( do_, diagnostics );
String cdc = dataObjectMap.get( do_.getName() ).getRefersToCDC().getName();
return doValidatorMap.get( cdc ).validateDO( do_, diagnostics );
}
}
......@@ -69,9 +69,9 @@ public class NsdEObjectValidator implements EValidator {
}
private HashMap< String, LNodeTypeValidator > generateLNodeTypeValidators( LNClass lnClass ) {
HashMap< String, LNodeTypeValidator > lNodeTypeMap = new HashMap<>();
lNodeTypeMap.put( lnClass.getName(), new LNodeTypeValidator( lnClass ));
return lNodeTypeMap;
HashMap< String, LNodeTypeValidator > lntMap = new HashMap<>();
lntMap.put( lnClass.getName(), new LNodeTypeValidator( lnClass ));
return lntMap;
}
@Override
......@@ -100,7 +100,7 @@ public class NsdEObjectValidator implements EValidator {
@Override
public Boolean defaultCase( EObject object ) {
AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: NsdEObjectValidator.validate( " + object.eClass().getName() + " )" );
//AbstractRiseClipseConsole.getConsole().info( "NOT IMPLEMENTED: NsdEObjectValidator.validate( " + object.eClass().getName() + " )" );
return true;
}
......@@ -119,8 +119,7 @@ public class NsdEObjectValidator implements EValidator {
}
private boolean validateAnyLN( AnyLN ln, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "" );
AbstractRiseClipseConsole.getConsole().verbose( "NsdEObjectValidator.validateLN( " + ln.getLnClass() + " )" );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] NsdEObjectValidator.validateAnyLN( " + ln.getLnClass() + " )" );
// Check that LN has valid LNClass
if( ! this.anyLNValidatorMap.containsKey( ln.getLnClass() )) {
......@@ -128,33 +127,32 @@ public class NsdEObjectValidator implements EValidator {
Diagnostic.ERROR,
RiseClipseValidatorSCL.DIAGNOSTIC_SOURCE,
0,
"LNClass " + ln.getLnClass() + " not found in NSD files for LN at line " + ln.getLineNumber(),
"[NSD] LNClass " + ln.getLnClass() + " not found for AnyLN at line " + ln.getLineNumber(),
new Object[] { ln } ));
return false;
}
AbstractRiseClipseConsole.getConsole().verbose( "found LNClass " + ln.getLnClass() + " in NSD files for LN at line " + ln.getLineNumber() );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] found LNClass " + ln.getLnClass() + " for AnyLN at line " + ln.getLineNumber() );
// AnyLNValidator validates LN content
return anyLNValidatorMap.get( ln.getLnClass() ).validateLN( ln, diagnostics );
return anyLNValidatorMap.get( ln.getLnClass() ).validateAnyLN( ln, diagnostics );
}
protected Boolean validateLNodeType( LNodeType lNodeType, DiagnosticChain diagnostics ) {
AbstractRiseClipseConsole.getConsole().verbose( "" );
AbstractRiseClipseConsole.getConsole().verbose( "NsdEObjectValidator.validateLNodeType( " + lNodeType.getLnClass() + " )" );
AbstractRiseClipseConsole.getConsole().verbose( "[NSD] NsdEObjectValidator.validateLNodeType( " + lNodeType.getLnClass() + " )" );
// Check that LN has valid LNClass
// Check that LNodeType has valid LNClass
if( ! this.anyLNValidatorMap.containsKey( lNodeType.getLnClass() )) {