/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ public Enumeration listOptions() { Vector newVector = new Vector(2); newVector.addElement( new Option( "\tNumber of folds used for cross validation (default 10).", "X", 1, "-X <number of folds>")); newVector.addElement( new Option( "\tClassifier parameter options.\n" + "\teg: \"N 1 5 10\" Sets an optimisation parameter for the\n" + "\tclassifier with name -N, with lower bound 1, upper bound\n" + "\t5, and 10 optimisation steps. The upper bound may be the\n" + "\tcharacter 'A' or 'I' to substitute the number of\n" + "\tattributes or instances in the training data,\n" + "\trespectively. This parameter may be supplied more than\n" + "\tonce to optimise over several classifier options\n" + "\tsimultaneously.", "P", 1, "-P <classifier parameter>")); Enumeration enu = super.listOptions(); while (enu.hasMoreElements()) { newVector.addElement(enu.nextElement()); } return newVector.elements(); }
/** * Writes data to given socket * * @param id a Socket * @throws IOException */ public void writeData(Socket id) throws IOException { // checkSanity(); if (_hdr != null) _hdr.writeData(id); if (_clientHandle != null) _clientHandle.writeData(id); if (_context != null) _context.writeData(id); for (Enumeration e = _clientSIs.elements(); e.hasMoreElements(); ) { COPSClientSI clientSI = (COPSClientSI) e.nextElement(); clientSI.writeData(id); } // Display any local decisions for (Enumeration e = _decisions.keys(); e.hasMoreElements(); ) { COPSContext context = (COPSContext) e.nextElement(); Vector v = (Vector) _decisions.get(context); context.writeData(id); for (Enumeration ee = v.elements(); e.hasMoreElements(); ) { COPSLPDPDecision decision = (COPSLPDPDecision) ee.nextElement(); decision.writeData(id); } } if (_integrity != null) _integrity.writeData(id); }
public void drawSVG() { Enumeration en = drawListeners.elements(); while (en.hasMoreElements()) { ((SVGViewerDrawListener) en.nextElement()).beginDraw(); } try { raster.setCamera(); en = rasterTransformListeners.elements(); while (en.hasMoreElements()) { SVGViewerRasterTransformListener l = (SVGViewerRasterTransformListener) en.nextElement(); l.rasterTransformed(); } raster.update(); en = rasterUpdateListeners.elements(); while (en.hasMoreElements()) { SVGViewerRasterUpdateListener l = (SVGViewerRasterUpdateListener) en.nextElement(); l.rasterUpdated(); } raster.sendPixels(); logger.debug("Draw svg finalizado"); } catch (Exception e) { e.printStackTrace(); logger.error(e); } finally { en = drawListeners.elements(); while (en.hasMoreElements()) { ((SVGViewerDrawListener) en.nextElement()).endDraw(); } } }
/** * Write an object textual description in the output stream * * @param os an OutputStream * @throws IOException */ public void dump(OutputStream os) throws IOException { _hdr.dump(os); if (_clientHandle != null) _clientHandle.dump(os); if (_context != null) _context.dump(os); for (Enumeration e = _clientSIs.elements(); e.hasMoreElements(); ) { COPSClientSI clientSI = (COPSClientSI) e.nextElement(); clientSI.dump(os); } // Display any local decisions for (Enumeration e = _decisions.keys(); e.hasMoreElements(); ) { COPSContext context = (COPSContext) e.nextElement(); Vector v = (Vector) _decisions.get(context); context.dump(os); for (Enumeration ee = v.elements(); e.hasMoreElements(); ) { COPSLPDPDecision decision = (COPSLPDPDecision) ee.nextElement(); decision.dump(os); } } if (_integrity != null) { _integrity.dump(os); } }
public String toString() { String roles_image = ""; for (Enumeration e = myRoles.elements(); e.hasMoreElements(); ) { roles_image = roles_image + "/" + (String) e.nextElement(); } String relations_image = ""; for (Enumeration e = mySupportRelations.elements(); e.hasMoreElements(); ) { relations_image = relations_image + "/" + (SupportRelation) e.nextElement(); } return "#<Organization " + myName + " " + myUIC + " " + myUTC + " " + mySRC + " " + mySuperior + " " + myEchelon + " " + myAgency + " " + myService + " " + myNomenclature + " " + myPrototype + " " + roles_image + " " + relations_image + ">"; }
/** * Creates the <ant> task configured to run a specific target. * * @param directory : if not null the directory where the build should run * @return the ant task, configured with the explicit properties and references necessary to run * the sub-build. */ private Ant createAntTask(File directory) { Ant ant = (Ant) getProject().createTask("ant"); ant.setOwningTarget(getOwningTarget()); ant.setTaskName(getTaskName()); ant.init(); if (target != null && target.length() > 0) { ant.setTarget(target); } if (output != null) { ant.setOutput(output); } if (directory != null) { ant.setDir(directory); } ant.setInheritAll(inheritAll); for (Enumeration i = properties.elements(); i.hasMoreElements(); ) { copyProperty(ant.createProperty(), (Property) i.nextElement()); } for (Enumeration i = propertySets.elements(); i.hasMoreElements(); ) { ant.addPropertyset((PropertySet) i.nextElement()); } ant.setInheritRefs(inheritRefs); for (Enumeration i = references.elements(); i.hasMoreElements(); ) { ant.addReference((Ant.Reference) i.nextElement()); } return ant; }
/** Generate output JAR-file and packages */ public void outputToJar() throws IOException { // create the manifest final Manifest manifest = new Manifest(); final java.util.jar.Attributes atrs = manifest.getMainAttributes(); atrs.put(java.util.jar.Attributes.Name.MANIFEST_VERSION, "1.2"); final Map map = manifest.getEntries(); // create manifest Enumeration classes = _bcelClasses.elements(); final String now = (new Date()).toString(); final java.util.jar.Attributes.Name dateAttr = new java.util.jar.Attributes.Name("Date"); while (classes.hasMoreElements()) { final JavaClass clazz = (JavaClass) classes.nextElement(); final String className = clazz.getClassName().replace('.', '/'); final java.util.jar.Attributes attr = new java.util.jar.Attributes(); attr.put(dateAttr, now); map.put(className + ".class", attr); } final File jarFile = new File(_destDir, _jarFileName); final JarOutputStream jos = new JarOutputStream(new FileOutputStream(jarFile), manifest); classes = _bcelClasses.elements(); while (classes.hasMoreElements()) { final JavaClass clazz = (JavaClass) classes.nextElement(); final String className = clazz.getClassName().replace('.', '/'); jos.putNextEntry(new JarEntry(className + ".class")); final ByteArrayOutputStream out = new ByteArrayOutputStream(2048); clazz.dump(out); // dump() closes it's output stream out.writeTo(jos); } jos.close(); }
public void printDelegatedMethod(PrintWriter ps) { ps.print("\tpublic " + opTypeSpec.toString() + " " + name + "("); Enumeration e = paramDecls.elements(); if (e.hasMoreElements()) ((ParamDecl) e.nextElement()).print(ps); for (; e.hasMoreElements(); ) { ps.print(", "); ((ParamDecl) e.nextElement()).print(ps); } ps.print(")"); raisesExpr.print(ps); ps.println(Environment.NL + "\t{"); if (opAttribute == NO_ATTRIBUTE && !(opTypeSpec.typeSpec() instanceof VoidTypeSpec)) { ps.print("\t\treturn "); } ps.print("_delegate." + name + "("); e = paramDecls.elements(); if (e.hasMoreElements()) ps.print(((ParamDecl) e.nextElement()).simple_declarator); for (; e.hasMoreElements(); ) { ps.print(","); ps.print(((ParamDecl) e.nextElement()).simple_declarator); } ps.println(");"); ps.println("\t}" + Environment.NL); }
/** * Reads the form definition object from the supplied stream. * * <p>Requires that the instance has been set to a prototype of the instance that should be used * for deserialization. * * @param dis - the stream to read from. * @throws IOException * @throws InstantiationException * @throws IllegalAccessException */ public void readExternal(DataInputStream dis, PrototypeFactory pf) throws IOException, DeserializationException { setID(ExtUtil.readInt(dis)); setName(ExtUtil.nullIfEmpty(ExtUtil.readString(dis))); setTitle((String) ExtUtil.read(dis, new ExtWrapNullable(String.class), pf)); setChildren((Vector) ExtUtil.read(dis, new ExtWrapListPoly(), pf)); setInstance((FormInstance) ExtUtil.read(dis, FormInstance.class, pf)); setLocalizer((Localizer) ExtUtil.read(dis, new ExtWrapNullable(Localizer.class), pf)); Vector vcond = (Vector) ExtUtil.read(dis, new ExtWrapList(Condition.class), pf); for (Enumeration e = vcond.elements(); e.hasMoreElements(); ) addTriggerable((Condition) e.nextElement()); Vector vcalc = (Vector) ExtUtil.read(dis, new ExtWrapList(Recalculate.class), pf); for (Enumeration e = vcalc.elements(); e.hasMoreElements(); ) addTriggerable((Recalculate) e.nextElement()); finalizeTriggerables(); outputFragments = (Vector) ExtUtil.read(dis, new ExtWrapListPoly(), pf); submissionProfiles = (Hashtable<String, SubmissionProfile>) ExtUtil.read(dis, new ExtWrapMap(String.class, SubmissionProfile.class)); }
/** ensure that non-Manual components of flow_tuple have equal dataRanges symmetric about 0.0 */ public static void equalizeFlow(Vector mapVector, DisplayTupleType flow_tuple) throws VisADException, RemoteException { double[] range = new double[2]; double low = Double.MAX_VALUE; double hi = -Double.MAX_VALUE; boolean anyAuto = false; Enumeration maps = mapVector.elements(); while (maps.hasMoreElements()) { ScalarMap map = ((ScalarMap) maps.nextElement()); DisplayRealType dtype = map.getDisplayScalar(); DisplayTupleType tuple = dtype.getTuple(); if (flow_tuple.equals(tuple) && !map.isManual && !map.badRange()) { anyAuto = true; low = Math.min(low, map.dataRange[0]); hi = Math.max(hi, map.dataRange[1]); } } if (!anyAuto) return; hi = Math.max(hi, -low); low = -hi; maps = mapVector.elements(); while (maps.hasMoreElements()) { ScalarMap map = ((ScalarMap) maps.nextElement()); DisplayRealType dtype = map.getDisplayScalar(); DisplayTupleType tuple = dtype.getTuple(); if (flow_tuple.equals(tuple) && !map.isManual && !map.badRange()) { map.setRange(null, low, hi, false); } } }
boolean hasMember(String user, Dictionary context, Vector visited) { // System.out.print( name + "-Group.hasMember user: "******" visited: " + visited ); // for the case where user is a group if (name.equals(user)) { return true; } if (visited.contains(this)) { return false; // throw new IllegalStateException( "UserAdmin database loops: " + // name + " points back to itself."); } visited.addElement(this); for (Enumeration en = reqMembers.elements(); en.hasMoreElements(); ) { RoleImpl member = (RoleImpl) en.nextElement(); if (!member.hasMember(user, context, visited)) { return false; } } for (Enumeration en = basicMembers.elements(); en.hasMoreElements(); ) { RoleImpl member = (RoleImpl) en.nextElement(); if (member.hasMember(user, context, visited)) { return true; } } return false; }
/** * Set the message length, base on the set of objects it contains * * @throws COPSException */ protected void setMsgLength() throws COPSException { short len = 0; if (_clientHandle != null) len += _clientHandle.getDataLength(); if (_context != null) len += _context.getDataLength(); for (Enumeration e = _clientSIs.elements(); e.hasMoreElements(); ) { COPSClientSI clientSI = (COPSClientSI) e.nextElement(); len += clientSI.getDataLength(); } // Display any local decisions for (Enumeration e = _decisions.keys(); e.hasMoreElements(); ) { COPSContext context = (COPSContext) e.nextElement(); Vector v = (Vector) _decisions.get(context); len += context.getDataLength(); for (Enumeration ee = v.elements(); e.hasMoreElements(); ) { COPSLPDPDecision decision = (COPSLPDPDecision) ee.nextElement(); len += decision.getDataLength(); } } if (_integrity != null) { len += _integrity.getDataLength(); } _hdr.setMsgLength((int) len); }
/** * Determines whether a point is in the collection by intersecting the lists of rectangles that * the point projects into horizontally and vertically, and then determining if the point lies in * one of the rectangles in the intersection. * * @param p the point to test * @return a Rectangle that contains p if it is contained by any Rectangle, otherwise null */ public Rectangle contains(Point p) { // if no rectangles are in collection answer is null if (this.treeHoriz == null || this.treeVert == null) { return null; } ThreadedBinaryTree<Double, Vector<Rectangle>> tbtHorizProj = this.treeHoriz.findNearest(new Double(p.getY())); ThreadedBinaryTree<Double, Vector<Rectangle>> tbtVertProj = this.treeVert.findNearest(new Double(p.getX())); // if no tree node is <= this point the return null if (tbtHorizProj == null || tbtVertProj == null) { return null; } // check for intersection between two lists; if non-empty check // for contains Vector<Rectangle> vHoriz = tbtHorizProj.getValue(); Vector<Rectangle> vVert = tbtVertProj.getValue(); for (Enumeration<Rectangle> e = vHoriz.elements(); e.hasMoreElements(); ) { Rectangle r = e.nextElement(); for (Enumeration<Rectangle> f = vVert.elements(); f.hasMoreElements(); ) { Rectangle s = f.nextElement(); if (r == s) { if (s.contains(p)) { return s; } } } } return null; }
/** * Gets a list of addresses bound to this network interface. * * @return the address list of the represented network interface. */ public Enumeration<InetAddress> getInetAddresses() { /* * create new vector from which Enumeration to be returned can be * generated set the initial capacity to be the number of addresses for * the network interface which is the maximum required size */ /* * return an empty enumeration if there are no addresses associated with * the interface */ if (addresses == null) { return new Vector<InetAddress>(0).elements(); } /* * for those configuration that support the security manager we only * return addresses for which checkConnect returns true */ Vector<InetAddress> accessibleAddresses = new Vector<InetAddress>(addresses.length); /* * get the security manager. If one does not exist just return the full * list */ SecurityManager security = System.getSecurityManager(); if (security == null) { return (new Vector<InetAddress>(Arrays.asList(addresses))).elements(); } /* * ok security manager exists so check each address and return those * that pass */ for (InetAddress element : addresses) { if (security != null) { try { /* * since we don't have a port in this case we pass in * NO_PORT */ String hostName = element.getHostName(); if (hostName.contains("::")) { hostName = getFullFormOfCompressedIPV6Address(hostName); } security.checkConnect(hostName, CHECK_CONNECT_NO_PORT); accessibleAddresses.add(element); } catch (SecurityException e) { } } } Enumeration<InetAddress> theAccessibleElements = accessibleAddresses.elements(); if (theAccessibleElements.hasMoreElements()) { return accessibleAddresses.elements(); } return new Vector<InetAddress>(0).elements(); }
public void parse(Reader rdr) { // parse the source for all its information parseSource(rdr); // then go over the class names and match any possible to the imports Enumeration enum = names.elements(); OUT: while(enum.hasMoreElements()) { String name = (String)enum.nextElement(); Enumeration enum2 = imports.elements(); while(enum2.hasMoreElements()) { String imp = (String)enum2.nextElement(); if(classMatch(name,imp,false)) { continue OUT; } } unfound.addElement(name); } Vector names2 = unfound; unfound = new Vector(); // then look in the wildcard entrys and fix them to not be wildcards enum = names2.elements(); OUT: while(enum.hasMoreElements()) { String name = (String)enum.nextElement(); Enumeration enum2 = imports.elements(); while(enum2.hasMoreElements()) { String imp = (String)enum2.nextElement(); if(classMatch(name,imp,true)) { continue OUT; } } unfound.addElement(name); } names2 = unfound; unfound = new Vector(); // then go hunting for any left. enum = names2.elements(); OUT: while(enum.hasMoreElements()) { String name = (String)enum.nextElement(); Enumeration enum2 = imports2.elements(); while(enum2.hasMoreElements()) { String imp = (String)enum2.nextElement(); if(classMatch(name,imp+".*",true)) { String str = name; if(!"".equals(imp)) { str = imp+"."+name; } fixed.addElement(str); continue OUT; } } unfound.addElement(name); } }
private void buildInheritanceTree() { for (Enumeration e = nds.elements(); e.hasMoreElements(); ) { setRelations((CgenNode) e.nextElement()); } if (Flags.cgen_debug) { for (Enumeration e = nds.elements(); e.hasMoreElements(); ) System.out.println(e.nextElement()); } }
/** * Fills a SubtreeFrame with info about the subtree. Used to display info when user right clicks * on an existing subtree. */ public void buildSubtreeFrame(SubtreeFrame sFrame) { // Clear visited flag on all vertices in the tree // and determine the layer number of the root node int highestLayer = 100; Enumeration edges = m_edgeList.elements(); while (edges.hasMoreElements()) { TreeEdge edge = (TreeEdge) edges.nextElement(); edge.getDestVertex().setVisited(false); edge.getSourceVertex().setVisited(false); if (edge.getSourceVertex().getLayer() < highestLayer) { highestLayer = edge.getSourceVertex().getLayer(); } } // Create list of premises and conclusion and assign // to text areas in the dialog Vector premiseList = new Vector(); String conclusion = ""; String criticalQuestions = ""; edges = m_edgeList.elements(); while (edges.hasMoreElements()) { TreeEdge edge = (TreeEdge) edges.nextElement(); TreeVertex source = edge.getSourceVertex(); TreeVertex dest = edge.getDestVertex(); if (!source.getVisited()) { if (source.getLayer() == highestLayer) { conclusion += (String) source.getLabel(); } else { premiseList.add((String) source.getLabel()); } source.setVisited(true); } if (!dest.getVisited()) { premiseList.add((String) dest.getLabel()); dest.setVisited(true); } } sFrame.setPremisesText(premiseList); sFrame.setConclusionText(conclusion); sFrame.loadArgTypeCombo(); // Assign the correct argument type to the combo box for (int index = 0; index < sFrame.selectArgumentCombo.getItemCount(); index++) { if (m_argumentType.getName().equals(sFrame.selectArgumentCombo.getItemAt(index))) { sFrame.selectArgumentCombo.setSelectedIndex(index); sFrame.selectArgumentCombo.setEditable(false); break; } } // Construct list of critical questions // Enumeration quesList = m_argumentType.getCriticalQuestions().elements(); // while (quesList.hasMoreElements()) { // criticalQuestions += (String)quesList.nextElement() + // "\r\n _____________________________ \r\n"; // } sFrame.updateTextBoxes(); }
void remove() { super.remove(); for (Enumeration en = basicMembers.elements(); en.hasMoreElements(); ) { RoleImpl role = (RoleImpl) en.nextElement(); role.basicMemberOf.removeElement(this); } for (Enumeration en = reqMembers.elements(); en.hasMoreElements(); ) { RoleImpl role = (RoleImpl) en.nextElement(); role.reqMemberOf.removeElement(this); } }
@Override public String toString() { String returned = ""; for (Enumeration e = nodes.elements(); e.hasMoreElements(); ) { returned += ((Node) e.nextElement()).toString() + "\n"; } for (Enumeration e = edges.elements(); e.hasMoreElements(); ) { returned += ((Edge) e.nextElement()).toString() + "\n"; } return returned; }
protected Vector alphaBetaHelper(int depth, Position p, boolean player, float alpha, float beta) { if (GameSearch.DEBUG) System.out.println("alphaBetaHelper(" + depth + "," + p + "," + alpha + "," + beta + ")"); if (reachedMaxDepth(p, depth)) { /** * In min-max search the evaluation work is done while backing up. the search proceeds to a * leaf node, and then return a vector for the leaf. its first coordinate is the position * evaluation of the position at the leaf node, the second element of the vector is the board * position at the the leaf node. */ Vector v = new Vector(2); float value = positionEvaluation(p, player); v.addElement(new Float(value)); v.addElement(null); if (GameSearch.DEBUG) { System.out.println(" alphaBetaHelper: mx depth at " + depth + ", value=" + value); } return v; } Vector best = new Vector(); // we have all the possible moves. Position[] moves = possibleMoves(p, player); for (int i = 0; i < moves.length; i++) { // we are calling recursively alpha-beta prunning for each possible moves Vector v2 = alphaBetaHelper(depth + 1, moves[i], !player, -beta, -alpha); float value = -((Float) v2.elementAt(0)).floatValue(); if (value > beta) { if (GameSearch.DEBUG) System.out.println(" ! ! ! value=" + value + ", beta=" + beta); beta = value; best = new Vector(); best.addElement(moves[i]); Enumeration enum2 = v2.elements(); enum2.nextElement(); // skip previous value while (enum2.hasMoreElements()) { Object o = enum2.nextElement(); if (o != null) best.addElement(o); } } /** * Use the alpha-beta cutoff test to abort search if we found a move that proves that the * previous move in the move chain was dubious */ if (beta >= alpha) { break; } } Vector v3 = new Vector(); v3.addElement(new Float(beta)); Enumeration enum2 = best.elements(); while (enum2.hasMoreElements()) { v3.addElement(enum2.nextElement()); } return v3; }
/** * Merge changes from the source to the target object. Make the necessary removals and adds and * map key modifications. */ private void mergeChangesIntoObjectWithoutOrder( Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager) { EISCollectionChangeRecord sdkChangeRecord = (EISCollectionChangeRecord) changeRecord; ContainerPolicy cp = this.getContainerPolicy(); AbstractSession session = mergeManager.getSession(); Object targetCollection = null; if (sdkChangeRecord.getOwner().isNew()) { targetCollection = cp.containerInstance(sdkChangeRecord.getAdds().size()); } else { targetCollection = this.getRealCollectionAttributeValueFromObject(target, session); } Vector removes = sdkChangeRecord.getRemoves(); Vector adds = sdkChangeRecord.getAdds(); Vector changedMapKeys = sdkChangeRecord.getChangedMapKeys(); synchronized (targetCollection) { for (Enumeration stream = removes.elements(); stream.hasMoreElements(); ) { Object removeElement = this.buildRemovedElementFromChangeSet(stream.nextElement(), mergeManager); Object targetElement = null; for (Object iter = cp.iteratorFor(targetCollection); cp.hasNext(iter); ) { targetElement = cp.next(iter, session); if (this.compareElements(targetElement, removeElement, session)) { break; // matching element found - skip the rest of them } } if (targetElement != null) { // a matching element was found, remove it cp.removeFrom(targetElement, targetCollection, session); } } for (Enumeration stream = adds.elements(); stream.hasMoreElements(); ) { Object addElement = this.buildAddedElementFromChangeSet(stream.nextElement(), mergeManager); cp.addInto(addElement, targetCollection, session); } for (Enumeration stream = changedMapKeys.elements(); stream.hasMoreElements(); ) { Object changedMapKeyElement = this.buildAddedElementFromChangeSet(stream.nextElement(), mergeManager); Object originalElement = ((UnitOfWorkImpl) session).getOriginalVersionOfObject(changedMapKeyElement); cp.removeFrom(originalElement, targetCollection, session); cp.addInto(changedMapKeyElement, targetCollection, session); } } // reset the attribute to allow for set method to re-morph changes if the collection is not // being stored directly this.setRealAttributeValueInObject(target, targetCollection); }
public void GenJCov(Environment env) { try { File outFile = env.getcovFile(); if (outFile.exists()) { DataInputStream JCovd = new DataInputStream(new BufferedInputStream(new FileInputStream(outFile))); String CurrLine = null; boolean first = true; String Class; CurrLine = JCovd.readLine(); if ((CurrLine != null) && CurrLine.startsWith(JcovMagicLine)) { // this is a good Jcov file while ((CurrLine = JCovd.readLine()) != null) { if (CurrLine.startsWith(JcovClassLine)) { first = true; for (Enumeration e = SourceClassList.elements(); e.hasMoreElements(); ) { String clsName = CurrLine.substring(JcovClassLine.length()); int idx = clsName.indexOf(' '); if (idx != -1) { clsName = clsName.substring(0, idx); } Class = (String) e.nextElement(); if (Class.compareTo(clsName) == 0) { first = false; break; } } } if (first) // re-write old class TmpCovTable.addElement(CurrLine); } } JCovd.close(); } PrintStream CovFile = new PrintStream(new DataOutputStream(new FileOutputStream(outFile))); CovFile.println(JcovMagicLine); for (Enumeration e = TmpCovTable.elements(); e.hasMoreElements(); ) { CovFile.println(e.nextElement()); } CovFile.close(); } catch (FileNotFoundException e) { System.out.println("ERROR: " + e); } catch (IOException e) { System.out.println("ERROR: " + e); } }
/** * Remove supplied objects from current selection * * @param objects : objects to remove from selection, as a Vector of FlexoModelObject */ public void removeFromSelected(Vector<? extends FlexoModelObject> objects) { if (objects == null || objects.isEmpty()) { return; } for (Enumeration<SelectionListener> e = _selectionListeners.elements(); e.hasMoreElements(); ) { SelectionListener sl = e.nextElement(); sl.fireBeginMultipleSelection(); } internallyRemoveFromSelected(objects); for (Enumeration<SelectionListener> e = _selectionListeners.elements(); e.hasMoreElements(); ) { SelectionListener sl = e.nextElement(); sl.fireEndMultipleSelection(); } updateInspectorManagement(); }
private void getNewNodes() { Vector levelNodes = new Vector(); Vector nextLevelNodes = new Vector(); Vector passedNodes = new Vector(); levelNodes.add(centerNode.name); for (int level = 0; level <= Config.navigationDepth; level++) { for (Enumeration e = levelNodes.elements(); e.hasMoreElements(); ) { String nodeName = (String) e.nextElement(); if (!passedNodes.contains(nodeName)) { passedNodes.add(nodeName); Node node = graph.nodeFromName(nodeName); if (node == null) { node = xmlReader.getNode(nodeName); graph.add(node); } node.passed = true; Set linkSet = node.links.keySet(); for (Iterator it = linkSet.iterator(); it.hasNext(); ) { String neighbourName = (String) it.next(); if (!passedNodes.contains(neighbourName) && !levelNodes.contains(neighbourName)) { nextLevelNodes.add(neighbourName); } } } } levelNodes = nextLevelNodes; nextLevelNodes = new Vector(); } }
protected void finished() { logger.log(LogService.LOG_DEBUG, "Here is OcdHandler():finished()"); // $NON-NLS-1$ if (!_isParsedDataValid) return; if (_ad_vector.size() == 0) { // Schema defines at least one AD is required. _isParsedDataValid = false; logger.log( LogService.LOG_ERROR, NLS.bind( MetaTypeMsg.MISSING_ELEMENT, new Object[] { AD, OCD, elementId, _dp_url, _dp_bundle.getBundleId(), _dp_bundle.getSymbolicName() })); return; } // OCD gets all parsed ADs. Enumeration<AttributeDefinitionImpl> adKey = _ad_vector.elements(); while (adKey.hasMoreElements()) { AttributeDefinitionImpl ad = adKey.nextElement(); _ocd.addAttributeDefinition(ad, ad._isRequired); } _ocd.setIcons(icons); _parent_OCDs_hashtable.put(_refID, _ocd); }
/** * Takes a table of nodes and adds a weighted score to each node score in the table. A vector of * nodes that we want to be near is also taken as an argument. Here are the rules for scoring: If * a node is two away from a node in the desired set of nodes it gets 100. Otherwise it gets 0. * * @param board the game board * @param nodesIn the table of nodes to evaluate: Hashtable<Integer,Integer> * @param nodeSet the set of desired nodes * @param weight the score multiplier */ protected void bestSpot2AwayFromANodeSet( SOCBoard board, Hashtable nodesIn, Vector nodeSet, int weight) { Enumeration nodesInEnum = nodesIn.keys(); // <Integer> while (nodesInEnum.hasMoreElements()) { Integer nodeCoord = (Integer) nodesInEnum.nextElement(); int node = nodeCoord.intValue(); int score = 0; final int oldScore = ((Integer) nodesIn.get(nodeCoord)).intValue(); Enumeration nodeSetEnum = nodeSet.elements(); while (nodeSetEnum.hasMoreElements()) { int target = ((Integer) nodeSetEnum.nextElement()).intValue(); if (node == target) { break; } else if (board.isNode2AwayFromNode(node, target)) { score = 100; } } /** multiply by weight */ score *= weight; nodesIn.put(nodeCoord, new Integer(oldScore + score)); // log.debug("BS2AFANS -- put node "+Integer.toHexString(node)+" with old score "+oldScore+" + // new score "+score); } }
@Override public Enumeration getApplets() { // Just yields this applet. Vector v = new Vector(); v.addElement(applet); return v.elements(); }
/** * Constructor. The first time an RJavaClassLoader is created, it is cached as the primary loader. * * @param path path of the rJava package * @param libpath lib sub directory of the rJava package */ public RJavaClassLoader(String path, String libpath) { super(new URL[] {}); // respect rJava.debug level String rjd = System.getProperty("rJava.debug"); if (rjd != null && rjd.length() > 0 && !rjd.equals("0")) verbose = true; if (verbose) System.out.println("RJavaClassLoader(\"" + path + "\",\"" + libpath + "\")"); if (primaryLoader == null) { primaryLoader = this; if (verbose) System.out.println(" - primary loader"); } else { if (verbose) System.out.println(" - NOT primrary (this=" + this + ", primary=" + primaryLoader + ")"); } libMap = new HashMap /*<String,UnixFile>*/(); classPath = new Vector /*<UnixFile>*/(); classPath.add(new UnixDirectory(path + "/java")); rJavaPath = path; rJavaLibPath = libpath; /* load the rJava library */ UnixFile so = new UnixFile(rJavaLibPath + "/rJava.so"); if (!so.exists()) so = new UnixFile(rJavaLibPath + "/rJava.dll"); if (so.exists()) libMap.put("rJava", so); /* load the jri library */ UnixFile jri = new UnixFile(path + "/jri/libjri.so"); String rarch = System.getProperty("r.arch"); if (rarch != null && rarch.length() > 0) { UnixFile af = new UnixFile(path + "/jri" + rarch + "/libjri.so"); if (af.exists()) jri = af; else { af = new UnixFile(path + "/jri" + rarch + "/jri.dll"); if (af.exists()) jri = af; } } if (!jri.exists()) jri = new UnixFile(path + "/jri/libjri.jnilib"); if (!jri.exists()) jri = new UnixFile(path + "/jri/jri.dll"); if (jri.exists()) { libMap.put("jri", jri); if (verbose) System.out.println(" - registered JRI: " + jri); } /* if we are the primary loader, make us the context loader so projects that rely on the context loader pick us */ if (primaryLoader == this) Thread.currentThread().setContextClassLoader(this); if (verbose) { System.out.println("RJavaClassLoader initialized.\n\nRegistered libraries:"); for (Iterator entries = libMap.keySet().iterator(); entries.hasNext(); ) { Object key = entries.next(); System.out.println(" " + key + ": '" + libMap.get(key) + "'"); } System.out.println("\nRegistered class paths:"); for (Enumeration e = classPath.elements(); e.hasMoreElements(); ) System.out.println(" '" + e.nextElement() + "'"); System.out.println("\n-- end of class loader report --"); } }
/** * Callback when user selects menu item (find it by comparing menu id's) * * <p>Param menuId = the id of the selected item */ public boolean onSelected(int menuId) { for (Enumeration enu = mVector.elements(); enu.hasMoreElements(); ) { TrayIconPopupItem item = (TrayIconPopupItem) enu.nextElement(); if (item.onSelected(menuId)) return true; } return false; }
/** Reset for new run. */ public void reset() { releaseDTMXRTreeFrags(); // These couldn't be disposed of earlier (see comments in release()); zap them now. if (m_rtfdtm_stack != null) for (java.util.Enumeration e = m_rtfdtm_stack.elements(); e.hasMoreElements(); ) m_dtmManager.release((DTM) e.nextElement(), true); m_rtfdtm_stack = null; // drop our references too m_which_rtfdtm = -1; if (m_global_rtfdtm != null) m_dtmManager.release(m_global_rtfdtm, true); m_global_rtfdtm = null; m_dtmManager = DTMManager.newInstance( com.sun.org.apache.xpath.internal.objects.XMLStringFactoryImpl.getFactory(), m_useServicesMechanism); m_saxLocations.removeAllElements(); m_axesIteratorStack.removeAllElements(); m_contextNodeLists.removeAllElements(); m_currentExpressionNodes.removeAllElements(); m_currentNodes.removeAllElements(); m_iteratorRoots.RemoveAllNoClear(); m_predicatePos.removeAllElements(); m_predicateRoots.RemoveAllNoClear(); m_prefixResolvers.removeAllElements(); m_prefixResolvers.push(null); m_currentNodes.push(DTM.NULL); m_currentExpressionNodes.push(DTM.NULL); m_saxLocations.push(null); }