public static void batchRelateAll( ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) { InstanceList instances = modelRoot.getInstanceList(InstanceStateMachine_c.class); synchronized (instances) { Iterator<NonRootModelElement> cursor = instances.iterator(); while (cursor.hasNext()) { final InstanceStateMachine_c inst = (InstanceStateMachine_c) cursor.next(); inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots); } } }
private static InstanceStateMachine_c findInstanceStateMachineInstance( ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) { InstanceList instances = modelRoot.getInstanceList(InstanceStateMachine_c.class); synchronized (instances) { for (int i = 0; i < instances.size(); ++i) { InstanceStateMachine_c x = (InstanceStateMachine_c) instances.get(i); if (test == null || test.evaluate(x)) { if (x.ensureLoaded(loadComponent)) return x; } } } return null; }
public static InstanceStateMachine_c resolveInstance( ModelRoot modelRoot, java.util.UUID p_m_sm_id, java.util.UUID p_m_obj_id) { InstanceList instances = modelRoot.getInstanceList(InstanceStateMachine_c.class); InstanceStateMachine_c source = null; synchronized (instances) { Object[] key = {p_m_sm_id}; source = (InstanceStateMachine_c) instances.get(key); if (source != null && !modelRoot.isCompareRoot()) { source.convertFromProxy(); source.batchUnrelate(); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. source.m_sm_id = IdAssigner.preprocessUUID(p_m_sm_id); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. source.m_obj_id = IdAssigner.preprocessUUID(p_m_obj_id); return source; } } // there is no instance matching the id InstanceStateMachine_c new_inst = new InstanceStateMachine_c(modelRoot, p_m_sm_id, p_m_obj_id); return new_inst; }
public static InstanceStateMachine_c[] InstanceStateMachineInstances( ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) { if (loadComponent) { PersistenceManager.ensureAllInstancesLoaded(modelRoot, InstanceStateMachine_c.class); } InstanceList instances = modelRoot.getInstanceList(InstanceStateMachine_c.class); Vector matches = new Vector(); synchronized (instances) { for (int i = 0; i < instances.size(); ++i) { InstanceStateMachine_c x = (InstanceStateMachine_c) instances.get(i); if (test == null || test.evaluate(x)) { if (x.ensureLoaded(loadComponent)) matches.add(x); } } if (matches.size() > 0) { InstanceStateMachine_c[] ret_set = new InstanceStateMachine_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new InstanceStateMachine_c[0]; } } }
// end declare accessors public static void checkClassConsistency(ModelRoot modelRoot) { Ooaofooa.log.println( ILogger.OPERATION, "Instance State Machine", //$NON-NLS-1$ " Operation entered: Instance State Machine::checkClassConsistency"); //$NON-NLS-1$ if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$ return; } InstanceStateMachine_c[] objs = InstanceStateMachine_c.InstanceStateMachineInstances(modelRoot, null, false); for (int i = 0; i < objs.length; i++) { objs[i].checkConsistency(); } }
public static InstanceStateMachine_c InstanceStateMachineInstance( ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) { InstanceStateMachine_c result = findInstanceStateMachineInstance(modelRoot, test, loadComponent); if (result == null && loadComponent) { List pmcs = PersistenceManager.findAllComponents(modelRoot, InstanceStateMachine_c.class); for (int i = 0; i < pmcs.size(); i++) { PersistableModelComponent component = (PersistableModelComponent) pmcs.get(i); if (!component.isLoaded()) { try { component.load(new NullProgressMonitor()); result = findInstanceStateMachineInstance(modelRoot, test, loadComponent); if (result != null) return result; } catch (Exception e) { CorePlugin.logError("Error Loading component", e); } } } } if (result != null && loadComponent) { result.loadProxy(); } return result; }
public static InstanceStateMachine_c createProxy( ModelRoot modelRoot, java.util.UUID p_m_sm_id, java.util.UUID p_m_obj_id, 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(InstanceStateMachine_c.class); InstanceStateMachine_c new_inst = null; synchronized (instances) { Object[] key = {p_m_sm_id}; new_inst = (InstanceStateMachine_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(); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. new_inst.m_sm_id = IdAssigner.preprocessUUID(p_m_sm_id); // pre-process the uuid so that we re-use null uuid instance rather then creating a new one. new_inst.m_obj_id = IdAssigner.preprocessUUID(p_m_obj_id); } } 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 InstanceStateMachine_c(modelRoot, p_m_sm_id, p_m_obj_id); new_inst.m_contentPath = contentPath; new_inst.setComponent(null); } return new_inst; }
public boolean checkConsistency() { Ooaofooa.log.println( ILogger.OPERATION, "Instance State Machine", //$NON-NLS-1$ " Operation entered: Instance State Machine::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 InstanceStateMachine_c_test39208_c implements ClassQueryInterface_c { InstanceStateMachine_c_test39208_c(java.util.UUID p39209) { m_p39209 = p39209; } private java.util.UUID m_p39209; public boolean evaluate(Object candidate) { InstanceStateMachine_c selected = (InstanceStateMachine_c) candidate; boolean retval = false; retval = (selected.getSm_id().equals(m_p39209)); return retval; } } InstanceStateMachine_c[] objs39207 = InstanceStateMachine_c.InstanceStateMachineInstances( modelRoot, new InstanceStateMachine_c_test39208_c(getSm_id())); if (((objs39207.length) == 0)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Instance State Machine", //$NON-NLS-1$ "Consistency: Object: Instance State Machine: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs39207.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Instance State Machine: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39207.length), e); } retval = false; } if (((objs39207.length) > 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Instance State Machine", //$NON-NLS-1$ "Consistency: Object: Instance State Machine: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39207.length) + " SM_ID: " + "Not Printable"); //$NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Instance State Machine: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39207.length) + " SM_ID: " + "Not Printable", e); //$NON-NLS-1$ } retval = false; } // Instance State Machine is a subtype in association: rel.Numb = 517 // The supertype class is: State Machine class StateMachine_c_test39213_c implements ClassQueryInterface_c { StateMachine_c_test39213_c(java.util.UUID p39214) { m_p39214 = p39214; } private java.util.UUID m_p39214; public boolean evaluate(Object candidate) { StateMachine_c selected = (StateMachine_c) candidate; boolean retval = false; retval = (selected.getSm_id().equals(m_p39214)); return retval; } } StateMachine_c[] objs39212 = StateMachine_c.StateMachineInstances(modelRoot, new StateMachine_c_test39213_c(getSm_id())); if (((objs39212.length) != 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Instance State Machine", //$NON-NLS-1$ "Consistency: Object: Instance State Machine: Association: 517: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs39212.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Instance State Machine: Association: 517: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39212.length), e); } retval = false; } // Instance State Machine is a referring class in association: rel.Numb = 518 // The participating class is: Model Class class ModelClass_c_test39216_c implements ClassQueryInterface_c { ModelClass_c_test39216_c(java.util.UUID p39217) { m_p39217 = p39217; } private java.util.UUID m_p39217; public boolean evaluate(Object candidate) { ModelClass_c selected = (ModelClass_c) candidate; boolean retval = false; retval = (selected.getObj_id().equals(m_p39217)); return retval; } } ModelClass_c[] objs39215 = ModelClass_c.ModelClassInstances(modelRoot, new ModelClass_c_test39216_c(getObj_id())); // The participant is unconditional // The multiplicity of the participant is one if (((objs39215.length) != 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Instance State Machine", //$NON-NLS-1$ "Consistency: Object: Instance State Machine: Association: 518: Cardinality of a participant is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39215.length) + " Obj_ID: " + "Not Printable"); //$NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Instance State Machine: Association: 518: Cardinality of a participant is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39215.length) + " Obj_ID: " + "Not Printable", e); //$NON-NLS-1$ } retval = false; } return retval; }
public boolean evaluate(Object candidate) { InstanceStateMachine_c selected = (InstanceStateMachine_c) candidate; boolean retval = false; retval = (selected.getSm_id().equals(m_p39209)); return retval; }