use of verdict.vdm.vdm_model.ComponentInstance in project VERDICT by ge-high-assurance.
the class VDMInstrumentor method retrieve_cmp_impl.
// protected ComponentImpl retrieve_cmp_impl(ComponentType componentType) {
// ComponentImpl componentImpl = null;
// for (ComponentImpl cImpl : vdm_model.getComponentImpl()) {
// ComponentType cmpType = cImpl.getType();
// if (cmpType.getId().equalsIgnoreCase(componentType.getId())) {
// componentImpl = cImpl;
// }
// }
// return componentImpl;
// }
protected ComponentImpl retrieve_cmp_impl(String componentID) {
ComponentImpl componentImpl = null;
BlockImpl blockImpl = null;
for (ComponentImpl cImpl : vdm_model.getComponentImpl()) {
if (cImpl.getBlockImpl() != null) {
blockImpl = cImpl.getBlockImpl();
for (ComponentInstance cmpInstance : blockImpl.getSubcomponent()) {
ComponentImpl impl = cmpInstance.getImplementation();
ComponentType enumType = null;
if (impl != null) {
enumType = impl.getType();
} else {
enumType = cmpInstance.getSpecification();
}
if (componentID.equals(enumType.getId())) {
componentImpl = cImpl;
return cImpl;
}
}
}
}
return componentImpl;
}
use of verdict.vdm.vdm_model.ComponentInstance in project VERDICT by ge-high-assurance.
the class VDM2Lustre method retrieve_block.
protected BlockImpl retrieve_block(ComponentImpl compImpl) {
BlockImpl blockImpl = null;
String cmpID = compImpl.getType().getId();
for (ComponentImpl cmpImpl : vdm_model.getComponentImpl()) {
if (cmpImpl.getBlockImpl() != null) {
blockImpl = cmpImpl.getBlockImpl();
for (ComponentInstance cmpInstance : blockImpl.getSubcomponent()) {
ComponentImpl impl = cmpInstance.getImplementation();
ComponentType enumType = null;
if (impl != null) {
enumType = impl.getType();
} else {
enumType = cmpInstance.getSpecification();
}
if (cmpID.equals(enumType.getId())) {
return blockImpl;
}
}
}
}
return blockImpl;
}
use of verdict.vdm.vdm_model.ComponentInstance in project VERDICT by ge-high-assurance.
the class VDM2Lustre method ignoreConnection.
// Ignore Connection or Marked Ports.
private boolean ignoreConnection(Connection con) {
ConnectionEnd srcConnection = con.getSource();
ComponentType srcType = null;
ConnectionEnd destConnection = con.getDestination();
ComponentType destType = null;
Port srcPort = srcConnection.getComponentPort();
if (srcPort == null) {
CompInstancePort compPort = srcConnection.getSubcomponentPort();
// System.out.println(">>>>>>>>" + con.getName());
srcPort = compPort.getPort();
ComponentInstance srcCompInstance = compPort.getSubcomponent();
srcType = srcCompInstance.getSpecification();
if (srcType == null) {
ComponentImpl compImpl = srcCompInstance.getImplementation();
srcType = compImpl.getType();
}
}
Port destPort = destConnection.getComponentPort();
if (destPort == null) {
CompInstancePort compPort = destConnection.getSubcomponentPort();
destPort = compPort.getPort();
ComponentInstance destCompInstance = compPort.getSubcomponent();
destType = destCompInstance.getSpecification();
if (destType == null) {
ComponentImpl compImpl = destCompInstance.getImplementation();
destType = compImpl.getType();
}
}
if (this.marked_ports.contains(srcPort) || this.marked_ports.contains(destPort)) {
System.out.println("Ignore Port Connection:" + con.getName());
return true;
}
if (this.marked_types.contains(srcType) || this.marked_types.contains(destType)) {
System.out.println("Ignore Instance Connection:" + con.getName());
return true;
}
return false;
}
Aggregations