public static void batchRelateAll( ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) { InstanceList instances = modelRoot.getInstanceList(InformalArgument_c.class); synchronized (instances) { Iterator<NonRootModelElement> cursor = instances.iterator(); while (cursor.hasNext()) { final InformalArgument_c inst = (InformalArgument_c) cursor.next(); inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots); } } }
private static InformalArgument_c findInformalArgumentInstance( ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) { InstanceList instances = modelRoot.getInstanceList(InformalArgument_c.class); synchronized (instances) { for (int i = 0; i < instances.size(); ++i) { InformalArgument_c x = (InformalArgument_c) instances.get(i); if (test == null || test.evaluate(x)) { if (x.ensureLoaded(loadComponent)) return x; } } } return null; }
public static InformalArgument_c resolveInstance(ModelRoot modelRoot, java.util.UUID p_m_arg_id) { InstanceList instances = modelRoot.getInstanceList(InformalArgument_c.class); InformalArgument_c source = null; synchronized (instances) { Object[] key = {p_m_arg_id}; source = (InformalArgument_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_arg_id = IdAssigner.preprocessUUID(p_m_arg_id); return source; } } // there is no instance matching the id InformalArgument_c new_inst = new InformalArgument_c(modelRoot, p_m_arg_id); return new_inst; }
public static InformalArgument_c[] InformalArgumentInstances( ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) { if (loadComponent) { PersistenceManager.ensureAllInstancesLoaded(modelRoot, InformalArgument_c.class); } InstanceList instances = modelRoot.getInstanceList(InformalArgument_c.class); Vector matches = new Vector(); synchronized (instances) { for (int i = 0; i < instances.size(); ++i) { InformalArgument_c x = (InformalArgument_c) instances.get(i); if (test == null || test.evaluate(x)) { if (x.ensureLoaded(loadComponent)) matches.add(x); } } if (matches.size() > 0) { InformalArgument_c[] ret_set = new InformalArgument_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new InformalArgument_c[0]; } } }
public static InformalArgument_c InformalArgumentInstance( ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) { InformalArgument_c result = findInformalArgumentInstance(modelRoot, test, loadComponent); if (result == null && loadComponent) { List pmcs = PersistenceManager.findAllComponents(modelRoot, InformalArgument_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 = findInformalArgumentInstance(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; }
// end declare accessors public static void checkClassConsistency(ModelRoot modelRoot) { Ooaofooa.log.println( ILogger.OPERATION, "Informal Argument", //$NON-NLS-1$ " Operation entered: Informal Argument::checkClassConsistency"); //$NON-NLS-1$ if (Boolean.valueOf(System.getenv("PTC_MCC_ENABLED")) == false) { // $NON-NLS-1$ return; } InformalArgument_c[] objs = InformalArgument_c.InformalArgumentInstances(modelRoot, null, false); for (int i = 0; i < objs.length; i++) { objs[i].checkConsistency(); } }
public static InformalArgument_c createProxy( ModelRoot modelRoot, java.util.UUID p_m_arg_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(InformalArgument_c.class); InformalArgument_c new_inst = null; synchronized (instances) { Object[] key = {p_m_arg_id}; new_inst = (InformalArgument_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_arg_id = IdAssigner.preprocessUUID(p_m_arg_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 InformalArgument_c(modelRoot, p_m_arg_id); new_inst.m_contentPath = contentPath; } return new_inst; }
public boolean evaluate(Object candidate) { InformalArgument_c selected = (InformalArgument_c) candidate; boolean retval = false; retval = (selected.getArg_id().equals(m_p39588)); return retval; }
public boolean checkConsistency() { Ooaofooa.log.println( ILogger.OPERATION, "Informal Argument", //$NON-NLS-1$ " Operation entered: Informal Argument::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 InformalArgument_c_test39587_c implements ClassQueryInterface_c { InformalArgument_c_test39587_c(java.util.UUID p39588) { m_p39588 = p39588; } private java.util.UUID m_p39588; public boolean evaluate(Object candidate) { InformalArgument_c selected = (InformalArgument_c) candidate; boolean retval = false; retval = (selected.getArg_id().equals(m_p39588)); return retval; } } InformalArgument_c[] objs39586 = InformalArgument_c.InformalArgumentInstances( modelRoot, new InformalArgument_c_test39587_c(getArg_id())); if (((objs39586.length) == 0)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Informal Argument", //$NON-NLS-1$ "Consistency: Object: Informal Argument: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs39586.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Informal Argument: Cardinality of an identifier is zero. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39586.length), e); } retval = false; } if (((objs39586.length) > 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Informal Argument", //$NON-NLS-1$ "Consistency: Object: Informal Argument: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39586.length) + " Arg_ID: " + "Not Printable"); //$NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Informal Argument: Cardinality of an identifier is greater than 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39586.length) + " Arg_ID: " + "Not Printable", e); //$NON-NLS-1$ } retval = false; } // Informal Argument is a subtype in association: rel.Numb = 1013 // The supertype class is: Message Argument class MessageArgument_c_test39592_c implements ClassQueryInterface_c { MessageArgument_c_test39592_c(java.util.UUID p39593) { m_p39593 = p39593; } private java.util.UUID m_p39593; public boolean evaluate(Object candidate) { MessageArgument_c selected = (MessageArgument_c) candidate; boolean retval = false; retval = (selected.getArg_id().equals(m_p39593)); return retval; } } MessageArgument_c[] objs39591 = MessageArgument_c.MessageArgumentInstances( modelRoot, new MessageArgument_c_test39592_c(getArg_id())); if (((objs39591.length) != 1)) { if (CorePlugin.getDefault().isDebugging()) { Ooaofooa.log.println( ILogger.CONSISTENCY, "Informal Argument", //$NON-NLS-1$ "Consistency: Object: Informal Argument: Association: 1013: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " + Integer.toString(objs39591.length)); // $NON-NLS-1$ } else { Exception e = new Exception(); CorePlugin.logError( "Consistency: Object: Informal Argument: Association: 1013: Cardinality of a supertype is not equal to 1. " //$NON-NLS-1$ + "Actual Value: " //$NON-NLS-1$ + Integer.toString(objs39591.length), e); } retval = false; } return retval; }