public static void batchRelateAll( ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) { InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class); synchronized (instances) { Iterator<NonRootModelElement> cursor = instances.iterator(); while (cursor.hasNext()) { final Graphnode_c inst = (Graphnode_c) cursor.next(); inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots); } } }
/** * Simluates a mouse move over the northwest corner of the "Disk Request" class. Returns the * location over which the move was simulated. */ protected Point doMouseMoveOverNWCornerOfDiskRequestClass() { Shape_c shape = CanvasTestUtils.getModelClassShape(modelRoot, "Disk Request"); Graphnode_c node = Graphnode_c.getOneDIM_NDOnR19(shape); Graphelement_c elem = Graphelement_c.getOneDIM_GEOnR301(node); Point corner = new Point((int) elem.getPositionx(), (int) elem.getPositiony()); CanvasTestUtils.doMouseMove(corner.x, corner.y); return corner; }
// end declare accessors public static void checkClassConsistency(ModelRoot modelRoot) { Ooaofooa.log.println( ILogger.OPERATION, "GraphNode", //$NON-NLS-1$ " Operation entered: GraphNode::checkClassConsistency"); //$NON-NLS-1$ if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$ return; } Graphnode_c[] objs = Graphnode_c.GraphnodeInstances(modelRoot, null, false); for (int i = 0; i < objs.length; i++) { objs[i].checkConsistency(); } }
public static Graphnode_c createProxy( ModelRoot modelRoot, float p_m_width, float p_m_height, java.util.UUID p_m_elementid, String p_contentPath, IPath p_localPath) { ModelRoot resolvedModelRoot = ModelRoot.findModelRoot(modelRoot, p_contentPath, p_localPath); // if a model root was not resolved it is most likely // due to a missing file of the proxy, defualt back to // the original model root if (resolvedModelRoot != null) modelRoot = resolvedModelRoot; InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class); Graphnode_c new_inst = null; synchronized (instances) { Object[] key = {p_m_elementid}; new_inst = (Graphnode_c) instances.get(key); } String contentPath = PersistenceUtil.resolveRelativePath(p_localPath, new Path(p_contentPath)); if (modelRoot.isNewCompareRoot()) { // for comparisons we do not want to change // the content path contentPath = p_contentPath; } if (new_inst != null && !modelRoot.isCompareRoot()) { PersistableModelComponent pmc = new_inst.getPersistableComponent(); if (pmc == null) { // dangling reference, redo this instance new_inst.batchUnrelate(); new_inst.m_width = p_m_width; new_inst.m_height = p_m_height; // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. new_inst.m_elementid = IdAssigner.preprocessUUID(p_m_elementid); } } if (new_inst == null) { // there is no instance matching the id, create a proxy // if the resource doesn't exist then this will be a dangling reference new_inst = new Graphnode_c(modelRoot, p_m_width, p_m_height, p_m_elementid); new_inst.m_contentPath = contentPath; } return new_inst; }
public static Graphnode_c resolveInstance( ModelRoot modelRoot, float p_m_width, float p_m_height, java.util.UUID p_m_elementid) { InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class); Graphnode_c source = null; synchronized (instances) { Object[] key = {p_m_elementid}; source = (Graphnode_c) instances.get(key); if (source != null && !modelRoot.isCompareRoot()) { source.convertFromProxy(); source.batchUnrelate(); source.m_width = p_m_width; source.m_height = p_m_height; // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. source.m_elementid = IdAssigner.preprocessUUID(p_m_elementid); return source; } } // there is no instance matching the id Graphnode_c new_inst = new Graphnode_c(modelRoot, p_m_width, p_m_height, p_m_elementid); return new_inst; }
public boolean evaluate(Object candidate) { Graphnode_c selected = (Graphnode_c) candidate; boolean retval = false; retval = (selected.getElementid().equals(m_p21774)); return retval; }
public boolean checkConsistency() { Ooaofooa.log.println( ILogger.OPERATION, "GraphNode", //$NON-NLS-1$ " Operation entered: GraphNode::checkConsistency"); //$NON-NLS-1$ if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$ return true; } ModelRoot modelRoot = getModelRoot(); boolean retval = true; class Graphnode_c_test21773_c implements ClassQueryInterface_c { Graphnode_c_test21773_c(java.util.UUID p21774) { m_p21774 = p21774; } private java.util.UUID m_p21774; public boolean evaluate(Object candidate) { Graphnode_c selected = (Graphnode_c) candidate; boolean retval = false; retval = (selected.getElementid().equals(m_p21774)); return retval; } } Graphnode_c[] objs21772 = Graphnode_c.GraphnodeInstances(modelRoot, new Graphnode_c_test21773_c(getElementid())); if (((objs21772.length) == 0)) { if (CanvasPlugin.getDefault().isDebugging()) { Ooaofgraphics.log.println( ILogger.CONSISTENCY, "GraphNode", //$NON-NLS-1$ "Consistency: Object: GraphNode: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs21772.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CanvasPlugin.logError( "Consistency: Object: GraphNode: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs21772.length), e); } retval = false; } if (((objs21772.length) > 1)) { if (CanvasPlugin.getDefault().isDebugging()) { Ooaofgraphics.log.println( ILogger.CONSISTENCY, "GraphNode", //$NON-NLS-1$ "Consistency: Object: GraphNode: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs21772.length) + " elementId: " + "Not Printable"); //$NON-NLS-1$ } else { Exception e = new Exception(); CanvasPlugin.logError( "Consistency: Object: GraphNode: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs21772.length) + " elementId: " + "Not Printable", e); //$NON-NLS-1$ } retval = false; } // GraphNode is a subtype in association: rel.Numb = 301 // The supertype class is: GraphElement class Graphelement_c_test21778_c implements ClassQueryInterface_c { Graphelement_c_test21778_c(java.util.UUID p21779) { m_p21779 = p21779; } private java.util.UUID m_p21779; public boolean evaluate(Object candidate) { Graphelement_c selected = (Graphelement_c) candidate; boolean retval = false; retval = (selected.getElementid().equals(m_p21779)); return retval; } } Graphelement_c[] objs21777 = Graphelement_c.GraphelementInstances( modelRoot, new Graphelement_c_test21778_c(getElementid())); if (((objs21777.length) != 1)) { if (CanvasPlugin.getDefault().isDebugging()) { Ooaofgraphics.log.println( ILogger.CONSISTENCY, "GraphNode", //$NON-NLS-1$ "Consistency: Object: GraphNode: Association: 301: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs21777.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CanvasPlugin.logError( "Consistency: Object: GraphNode: Association: 301: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs21777.length), e); } retval = false; } // Supertype: rel.Numb = 19 int objs21780 = 0; // Subtype Object: Shape class Shape_c_test21781_c implements ClassQueryInterface_c { Shape_c_test21781_c(java.util.UUID p21782) { m_p21782 = p21782; } private java.util.UUID m_p21782; public boolean evaluate(Object candidate) { Shape_c selected = (Shape_c) candidate; boolean retval = false; retval = (selected.getElementid().equals(m_p21782)); return retval; } } Shape_c[] objs21783 = Shape_c.ShapeInstances(modelRoot, new Shape_c_test21781_c(getElementid())); objs21780 = objs21780 + objs21783.length; // Subtype Object: Floating Text class FloatingText_c_test21784_c implements ClassQueryInterface_c { FloatingText_c_test21784_c(java.util.UUID p21785) { m_p21785 = p21785; } private java.util.UUID m_p21785; public boolean evaluate(Object candidate) { FloatingText_c selected = (FloatingText_c) candidate; boolean retval = false; retval = (selected.getElementid().equals(m_p21785)); return retval; } } FloatingText_c[] objs21786 = FloatingText_c.FloatingTextInstances( modelRoot, new FloatingText_c_test21784_c(getElementid())); objs21780 = objs21780 + objs21786.length; if (objs21780 != 1) { if (CanvasPlugin.getDefault().isDebugging()) { Ooaofgraphics.log.println( ILogger.CONSISTENCY, "GraphNode", //$NON-NLS-1$ "Consistency: Object: GraphNode: Association: 19: Cardinality of subtype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs21780)); // $NON-NLS-1$ } else { Exception e = new Exception(); CanvasPlugin.logError( "Consistency: Object: GraphNode: Association: 19: Cardinality of subtype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs21780), e); } retval = false; } return retval; }