public static ComponentInComponent_c[] getManyCN_CICsOnR4202( Component_c target, ClassQueryInterface_c test, boolean loadComponent) { if (target == null) return new ComponentInComponent_c[0]; ModelRoot modelRoot = target.getModelRoot(); Vector matches = new Vector(); synchronized (target.backPointer_CanNestComponentInComponentCanNest_R4202) { for (int i = 0; i < target.backPointer_CanNestComponentInComponentCanNest_R4202.size(); ++i) { ComponentInComponent_c source = (ComponentInComponent_c) target.backPointer_CanNestComponentInComponentCanNest_R4202.get(i); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } if (matches.size() > 0) { ComponentInComponent_c[] ret_set = new ComponentInComponent_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new ComponentInComponent_c[0]; } }
public static InformalArgument_c[] getManyMSG_IAsOnR1013( MessageArgument_c[] targets, ClassQueryInterface_c test, boolean loadComponent) { if (targets == null || targets.length == 0 || targets[0] == null) return new InformalArgument_c[0]; ModelRoot modelRoot = targets[0].getModelRoot(); InstanceList instances = modelRoot.getInstanceList(InformalArgument_c.class); Vector matches = new Vector(); for (int i = 0; i < targets.length; i++) { InformalArgument_c source = (InformalArgument_c) targets[i].backPointer_IsSubtypeInformalArgumentIsSubtype_R1013; if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } 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 ElementInMove_c[] getManyGD_EIMsOnR25( Model_c target, ClassQueryInterface_c test, boolean loadComponent) { if (target == null) return new ElementInMove_c[0]; ModelRoot modelRoot = target.getModelRoot(); Vector matches = new Vector(); synchronized (target.backPointer_IsMovingElementInMoveIsMoving_R25) { for (int i = 0; i < target.backPointer_IsMovingElementInMoveIsMoving_R25.size(); ++i) { ElementInMove_c source = (ElementInMove_c) target.backPointer_IsMovingElementInMoveIsMoving_R25.get(i); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } if (matches.size() > 0) { ElementInMove_c[] ret_set = new ElementInMove_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new ElementInMove_c[0]; } }
public static ElementInMove_c[] getManyGD_EIMsOnR25( GraphicalElement_c[] targets, ClassQueryInterface_c test, boolean loadComponent) { if (targets == null || targets.length == 0 || targets[0] == null) return new ElementInMove_c[0]; ModelRoot modelRoot = targets[0].getModelRoot(); InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class); Vector matches = new Vector(); for (int i = 0; i < targets.length; i++) { synchronized (targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25) { for (int j = 0; j < targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25.size(); ++j) { ElementInMove_c source = (ElementInMove_c) targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25.get(j); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } } if (matches.size() > 0) { ElementInMove_c[] ret_set = new ElementInMove_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new ElementInMove_c[0]; } }
public static DescriptionQuery_c[] getManySQU_DEsOnR9600( Query_c[] targets, ClassQueryInterface_c test, boolean loadComponent) { if (targets == null || targets.length == 0 || targets[0] == null) return new DescriptionQuery_c[0]; ModelRoot modelRoot = targets[0].getModelRoot(); InstanceList instances = modelRoot.getInstanceList(DescriptionQuery_c.class); Vector matches = new Vector(); for (int i = 0; i < targets.length; i++) { DescriptionQuery_c source = (DescriptionQuery_c) targets[i].backPointer_IsSubtypeDescriptionQueryIsSubtype_R9600; if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } if (matches.size() > 0) { DescriptionQuery_c[] ret_set = new DescriptionQuery_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new DescriptionQuery_c[0]; } }
public Matrix matrix(boolean centered) { String[] genes = genes(); Matrix matrix = new Matrix(genes.length, coefs.size()); for (int j = 0; j < coefs.size(); j++) { Map<String, Double> values = coefs.get(j).geneValues(args.compare); double sum = 0.0; for (int i = 0; i < genes.length; i++) { Double value = values.get(genes[i]); if (value != null) { matrix.set(i, j, value); sum += value; } else { matrix.set(i, j, 0.0); } } if (centered) { sum /= (double) genes.length; for (int i = 0; i < genes.length; i++) { matrix.set(i, j, matrix.get(i, j) - sum); } } } return matrix; }
public static BridgeInvocation_c[] getManyACT_BRGsOnR674( Bridge_c[] targets, ClassQueryInterface_c test, boolean loadComponent) { if (targets == null || targets.length == 0 || targets[0] == null) return new BridgeInvocation_c[0]; ModelRoot modelRoot = targets[0].getModelRoot(); InstanceList instances = modelRoot.getInstanceList(BridgeInvocation_c.class); Vector matches = new Vector(); for (int i = 0; i < targets.length; i++) { synchronized (targets[i].backPointer_BridgeInvocation_R674) { for (int j = 0; j < targets[i].backPointer_BridgeInvocation_R674.size(); ++j) { BridgeInvocation_c source = (BridgeInvocation_c) targets[i].backPointer_BridgeInvocation_R674.get(j); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } } if (matches.size() > 0) { BridgeInvocation_c[] ret_set = new BridgeInvocation_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new BridgeInvocation_c[0]; } }
public static AssignToMember_c[] getManyACT_AIsOnR603( Statement_c[] targets, ClassQueryInterface_c test, boolean loadComponent) { if (targets == null || targets.length == 0 || targets[0] == null) return new AssignToMember_c[0]; ModelRoot modelRoot = targets[0].getModelRoot(); InstanceList instances = modelRoot.getInstanceList(AssignToMember_c.class); Vector matches = new Vector(); for (int i = 0; i < targets.length; i++) { AssignToMember_c source = (AssignToMember_c) targets[i].backPointer_IsSubtypeAssignToMemberIsSubtype_R603; if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } if (matches.size() > 0) { AssignToMember_c[] ret_set = new AssignToMember_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new AssignToMember_c[0]; } }
public static ComponentInComponent_c[] getManyCN_CICsOnR4202( Component_c[] targets, ClassQueryInterface_c test, boolean loadComponent) { if (targets == null || targets.length == 0 || targets[0] == null) return new ComponentInComponent_c[0]; ModelRoot modelRoot = targets[0].getModelRoot(); InstanceList instances = modelRoot.getInstanceList(ComponentInComponent_c.class); Vector matches = new Vector(); for (int i = 0; i < targets.length; i++) { synchronized (targets[i].backPointer_CanNestComponentInComponentCanNest_R4202) { for (int j = 0; j < targets[i].backPointer_CanNestComponentInComponentCanNest_R4202.size(); ++j) { ComponentInComponent_c source = (ComponentInComponent_c) targets[i].backPointer_CanNestComponentInComponentCanNest_R4202.get(j); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } } if (matches.size() > 0) { ComponentInComponent_c[] ret_set = new ComponentInComponent_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new ComponentInComponent_c[0]; } }
public void save(File f) throws IOException { PrintStream ps = new PrintStream(new FileOutputStream(f)); String[] genes = genes(); Vector<Map<String, Double>> maps = new Vector<Map<String, Double>>(); for (int j = 0; j < coefs.size(); j++) { maps.add(coefs.get(j).geneValues(args.compare)); } ps.print("gene"); for (int i = 0; i < coefs.size(); i++) { ps.print(" " + keys.get(i)); } ps.println(); for (int i = 0; i < genes.length; i++) { ps.print(String.format("%s", genes[i])); for (int j = 0; j < coefs.size(); j++) { Map<String, Double> map = maps.get(j); Double value = map.containsKey(genes[i]) ? map.get(genes[i]) : null; ps.print(String.format(" %s", value != null ? String.format("%.2f", value) : "N/A")); } ps.println(); } ps.println(); ps.close(); }
public static TransientValueReference_c[] getManyV_TVLsOnR801( Value_c[] targets, ClassQueryInterface_c test, boolean loadComponent) { if (targets == null || targets.length == 0 || targets[0] == null) return new TransientValueReference_c[0]; ModelRoot modelRoot = targets[0].getModelRoot(); InstanceList instances = modelRoot.getInstanceList(TransientValueReference_c.class); Vector matches = new Vector(); for (int i = 0; i < targets.length; i++) { TransientValueReference_c source = (TransientValueReference_c) targets[i].backPointer_IsSubtypeTransientValueReferenceIsSubtype_R801; if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } if (matches.size() > 0) { TransientValueReference_c[] ret_set = new TransientValueReference_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new TransientValueReference_c[0]; } }
// keyboard discovery code private void _mapKey(char charCode, int keyindex, boolean shift, boolean altgraph) { log("_mapKey: " + charCode); // if character is not in map, add it if (!charMap.containsKey(new Integer(charCode))) { log("Notified: " + (char) charCode); KeyEvent event = new KeyEvent( applet(), 0, 0, (shift ? KeyEvent.SHIFT_MASK : 0) + (altgraph ? KeyEvent.ALT_GRAPH_MASK : 0), ((Integer) vkKeys.get(keyindex)).intValue(), (char) charCode); charMap.put(new Integer(charCode), event); log("Mapped char " + (char) charCode + " to KeyEvent " + event); if (((char) charCode) >= 'a' && ((char) charCode) <= 'z') { // put shifted version of a-z in automatically int uppercharCode = (int) Character.toUpperCase((char) charCode); event = new KeyEvent( applet(), 0, 0, KeyEvent.SHIFT_MASK + (altgraph ? KeyEvent.ALT_GRAPH_MASK : 0), ((Integer) vkKeys.get(keyindex)).intValue(), (char) uppercharCode); charMap.put(new Integer(uppercharCode), event); log("Mapped char " + (char) uppercharCode + " to KeyEvent " + event); } } }
public static final void fireEvent(GenericEvent e, Method m, Vector listeners) throws PropertyVetoException { Object[] snapshot = null; synchronized (listeners) { snapshot = new Object[listeners.size()]; listeners.copyInto(snapshot); } // leighd 04/14/99 - modified for event debugging if (gDebugEvents) Engine.debugLog("Event : " + e.toString()); Object params[] = new Object[] {e}; for (int i = 0; i < snapshot.length; i++) { if ((e instanceof Consumable) && ((Consumable) e).isConsumed()) { // leighd 04/14/99 // note that we don't catch the consumption of the // event until we've passed through the loop again, // so we reference i-1 if (gDebugEvents) Engine.debugLog("Consumed By : " + snapshot[i - 1]); return; } try { m.invoke(snapshot[i], params); } catch (IllegalAccessException iae) { iae.printStackTrace(); } catch (InvocationTargetException ite) { Throwable t = ite.getTargetException(); if (t instanceof PropertyVetoException) throw ((PropertyVetoException) t); else t.printStackTrace(); } } }
public static BridgeInvocation_c[] getManyACT_BRGsOnR674( Bridge_c target, ClassQueryInterface_c test, boolean loadComponent) { if (target == null) return new BridgeInvocation_c[0]; ModelRoot modelRoot = target.getModelRoot(); Vector matches = new Vector(); synchronized (target.backPointer_BridgeInvocation_R674) { for (int i = 0; i < target.backPointer_BridgeInvocation_R674.size(); ++i) { BridgeInvocation_c source = (BridgeInvocation_c) target.backPointer_BridgeInvocation_R674.get(i); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } if (matches.size() > 0) { BridgeInvocation_c[] ret_set = new BridgeInvocation_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new BridgeInvocation_c[0]; } }
public static DataTypeInPackage_c[] getManyS_DIPsOnR39( DataTypePackage_c target, ClassQueryInterface_c test, boolean loadComponent) { if (target == null) return new DataTypeInPackage_c[0]; ModelRoot modelRoot = target.getModelRoot(); Vector matches = new Vector(); synchronized (target.backPointer_ContainsDataTypeInPackageContains_R39) { for (int i = 0; i < target.backPointer_ContainsDataTypeInPackageContains_R39.size(); ++i) { DataTypeInPackage_c source = (DataTypeInPackage_c) target.backPointer_ContainsDataTypeInPackageContains_R39.get(i); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } if (matches.size() > 0) { DataTypeInPackage_c[] ret_set = new DataTypeInPackage_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new DataTypeInPackage_c[0]; } }
public Vector getAssociatedLevelLists() { Vector levelLists = new Vector(); Vector endPts = CollectionHelper.makeVector("Keyword"); Hashtable keywordParents = oncotcap.Oncotcap.getDataSource() .getParentTree( "Keyword", endPts, CollectionHelper.makeVector(this), TreeDisplayModePanel.ROOT); // Take each of the parents and get the associated level lists if (keywordParents.size() <= 0) return levelLists; Hashtable levelListsHashtable = oncotcap.Oncotcap.getDataSource() .getInstanceTree( "EnumLevelList", new Vector(), makeLevelListFilter(keywordParents), TreeDisplayModePanel.ROOT); for (Enumeration e = keywordParents.keys(); e.hasMoreElements(); ) { System.out.println("Keyword.getAssociatedLevelLists: " + e.nextElement()); } // Collect all the level lists from the hashtable Vector selectedItems = CollectionHelper.makeVector(keyword); for (Enumeration e = levelListsHashtable.keys(); e.hasMoreElements(); ) { Object obj = e.nextElement(); if (obj instanceof EnumLevelList) { levelLists.addElement(obj); } } return levelLists; }
public static ComponentResultSet_c[] getManyPE_CRSsOnR8007( Component_c target, ClassQueryInterface_c test, boolean loadComponent) { if (target == null) return new ComponentResultSet_c[0]; ModelRoot modelRoot = target.getModelRoot(); Vector matches = new Vector(); synchronized (target.backPointer_HoldsComponentResultSetHolds_R8007) { for (int i = 0; i < target.backPointer_HoldsComponentResultSetHolds_R8007.size(); ++i) { ComponentResultSet_c source = (ComponentResultSet_c) target.backPointer_HoldsComponentResultSetHolds_R8007.get(i); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } if (matches.size() > 0) { ComponentResultSet_c[] ret_set = new ComponentResultSet_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new ComponentResultSet_c[0]; } }
public static DataTypeInPackage_c[] getManyS_DIPsOnR39( DataType_c[] targets, ClassQueryInterface_c test, boolean loadComponent) { if (targets == null || targets.length == 0 || targets[0] == null) return new DataTypeInPackage_c[0]; ModelRoot modelRoot = targets[0].getModelRoot(); InstanceList instances = modelRoot.getInstanceList(DataTypeInPackage_c.class); Vector matches = new Vector(); for (int i = 0; i < targets.length; i++) { synchronized (targets[i].backPointer_IsContainedInDataTypeInPackageIsContainedIn_R39) { for (int j = 0; j < targets[i].backPointer_IsContainedInDataTypeInPackageIsContainedIn_R39.size(); ++j) { DataTypeInPackage_c source = (DataTypeInPackage_c) targets[i].backPointer_IsContainedInDataTypeInPackageIsContainedIn_R39.get(j); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } } if (matches.size() > 0) { DataTypeInPackage_c[] ret_set = new DataTypeInPackage_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new DataTypeInPackage_c[0]; } }
public static InstanceStateMachine_c[] getManySM_ISMsOnR518( ModelClass_c[] targets, ClassQueryInterface_c test, boolean loadComponent) { if (targets == null || targets.length == 0 || targets[0] == null) return new InstanceStateMachine_c[0]; ModelRoot modelRoot = targets[0].getModelRoot(); if (loadComponent) { // Containment Relation PersistableModelComponent[] pmcs = new PersistableModelComponent[targets.length]; for (int i = 0; i < targets.length; i++) { pmcs[i] = targets[i].getPersistableComponent(); } PersistenceManager.ensureAllChildInstancesLoaded( pmcs, modelRoot, InstanceStateMachine_c.class); } InstanceList instances = modelRoot.getInstanceList(InstanceStateMachine_c.class); Vector matches = new Vector(); for (int i = 0; i < targets.length; i++) { InstanceStateMachine_c source = (InstanceStateMachine_c) targets[i].backPointer_InstanceStateMachine_R518; if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } 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]; } }
public static TransientValueReference_c[] getManyV_TVLsOnR805( Variable_c target, ClassQueryInterface_c test, boolean loadComponent) { if (target == null) return new TransientValueReference_c[0]; ModelRoot modelRoot = target.getModelRoot(); Vector matches = new Vector(); synchronized (target.backPointer_TransientValueReference_R805) { for (int i = 0; i < target.backPointer_TransientValueReference_R805.size(); ++i) { TransientValueReference_c source = (TransientValueReference_c) target.backPointer_TransientValueReference_R805.get(i); if (source != null && (test == null || test.evaluate(source))) { matches.add(source); } } } if (matches.size() > 0) { TransientValueReference_c[] ret_set = new TransientValueReference_c[matches.size()]; matches.copyInto(ret_set); return ret_set; } else { return new TransientValueReference_c[0]; } }
public void remove(int index) { if (activeEditors.size() == 0) return; // it can get a bit excitable about removing element 0 ... PluggableEditor ed = (PluggableEditor) activeEditors.remove(index); ed.unload(); super.remove(index); }
public void addJavaLibraries() { final Vector<String> packages = JavaEnvUtils.getJrePackages(); final Enumeration<String> e = packages.elements(); while (e.hasMoreElements()) { final String packageName = e.nextElement(); this.addSystemPackageRoot(packageName); } }
/** * Not all editors are capable of displaying new entries. This whips through and removes all * editors that can't. */ private void trimNonNewEntryEditors() { int size = activeEditors.size(); for (int i = size - 1; i >= 0; i--) { if (((DataSink) activeEditors.get(i)).canCreateEntry() == false) { remove(i); } } suggestTableEditor(); // use table editor as default for new entries... }
/** * Remove the first null element found in the specified vector. Return true if a null element was * found and removed. Return false if a null element was not found. */ private boolean removeNullElement(Vector v) { for (int i = 0; i < v.size(); i++) { if (v.elementAt(i) == null) { v.removeElementAt(i); return true; } } return false; }
protected void fireHPubReqCompleteEvent(RequestCompleteEvent evt) { Vector currentListenerList = null; synchronized (this) { currentListenerList = (Vector) listenerList.clone(); } for (int i = 0; i < currentListenerList.size(); i++) { HPubReqCompleteListener listener = (HPubReqCompleteListener) currentListenerList.elementAt(i); listener.hPubReqComplete(evt); } }
/** * When this class is loaded, preload the cache with a few items which we think will often be * needed. This can avoid the necessity of running a belief network context in simple problems. */ static { System.err.println("PiHelperLoader.static: preload the helper cache."); helper_cache = new Hashtable(); Vector seq = new Vector(); seq.addElement(riso.distributions.ConditionalDiscrete.class); seq.addElement(riso.distributions.Discrete.class); helper_cache.put( new HelperCacheKey("pi", seq), riso.distributions.computes_pi.ConditionalDiscrete_Discrete.class); seq = new Vector(); seq.addElement(riso.distributions.Discrete.class); helper_cache.put( new HelperCacheKey("lambda", seq), riso.distributions.computes_lambda.Discrete.class); seq = new Vector(); seq.addElement(riso.distributions.AbstractDistribution.class); seq.addElement(riso.distributions.AbstractDistribution.class); helper_cache.put( new HelperCacheKey("pi_message", seq), riso.distributions.computes_pi_message.AbstractDistribution_AbstractDistribution.class); seq = new Vector(); seq.addElement(riso.distributions.ConditionalDiscrete.class); seq.addElement(riso.distributions.Discrete.class); seq.addElement(riso.distributions.Discrete.class); helper_cache.put( new HelperCacheKey("lambda_message", seq), riso.distributions.computes_lambda_message.ConditionalDiscrete_Discrete_Discrete.class); seq = new Vector(); seq.addElement(riso.distributions.ConditionalDiscrete.class); seq.addElement(riso.distributions.Discrete.class); helper_cache.put( new HelperCacheKey("lambda_message", seq), riso.distributions.computes_lambda_message.ConditionalDiscrete_Discrete_.class); seq = new Vector(); seq.addElement(riso.distributions.Discrete.class); seq.addElement(riso.distributions.Discrete.class); helper_cache.put( new HelperCacheKey("posterior", seq), riso.distributions.computes_posterior.Discrete_Discrete.class); System.err.println("PiHelperLoader.static: helper_cache.size(): " + helper_cache.size()); }
/** If a purpose written pluggable editor is available, switch to that, */ public boolean suggestPluggableEditor() { for (int i = activeEditors.size() - 1; i >= 0; i--) { // try to set to the first 'user written' pluggable editor // that can be found... PluggableEditor ed = (PluggableEditor) activeEditors.get(i); if ((ed != templateDisplay) && (ed != tableDisplay)) { setCurrentEditor(ed); return true; } } return false; }
private Vector getChildren(Keyword keyword, Vector allKids) { allKids.addElement(keyword); // System.out.println("Addtoallkids " + keyword + " " + allKids ); Vector children = keyword.getChildren(); if (children != null) { Iterator i = children.iterator(); while (i.hasNext()) { Keyword child = (Keyword) i.next(); getChildren(child, allKids); } } return allKids; }
/** * This can be used to register Swing components that may be used by sub editors to affect the * outside environment. */ public void registerComponents( JMenuBar menu, JToolBar buttons, JTree tree, JPopupMenu treeMenu, JFrame jxplorer) { registerMenu = menu; registerButtons = buttons; registerTree = tree; registerTreeMenu = treeMenu; registerJX = jxplorer; // reset the sub editors as well. for (int i = 0; i < activeEditors.size(); i++) { ((PluggableEditor) activeEditors.get(i)) .registerComponents(menu, buttons, tree, treeMenu, jxplorer); } }
public static Vector getClassFieldsValues(Object classFile) { Vector ret = new Vector(); try { Field[] fields = classFile.getClass().getDeclaredFields(); for (int loop = 0; loop < fields.length; loop++) { ret.addElement(fields[loop].getInt(classFile)); } } catch (Exception d) { d.printStackTrace(); Miscellaneous.exit(); } return ret; }