/** * add all the sameScanWifi that in tempSameScanWifiVector into wifis * if their was an ellement from the same scan it units them, * else it add it to the end of the vector * @param dataBase * @param tempDataBase */ public static void unit(Vector<sameScanWifi> dataBase, Vector<sameScanWifi> tempDataBase) { // TODO Auto-generated method stub for(int i=0;i<tempDataBase.size();i++){ boolean add=false; for(int j=0;j<dataBase.size();j++){ if(tempDataBase.elementAt(i).compare(dataBase.elementAt(j))){ dataBase.elementAt(j).insert(tempDataBase.elementAt(i)); add=true; break; } } if(!add){ dataBase.add(tempDataBase.elementAt(i)); } } }
public void refreshList() { clearTable(); Vector services = null ; try { services = vv.lookupAsString(regServerURL); } catch( Exception e ) { System.err.println("---------------------------------------------"); e.printStackTrace(); JOptionPane.showMessageDialog(this, e.toString(), "Error", JOptionPane.INFORMATION_MESSAGE ); } for ( int i = 0 ; services != null && i < services.size() ; i++ ) { Service s = (Service) services.elementAt(i); addServer( s ); } buyList.removeAllItems(); purchasePanel.setEnabled( false ); refreshButton.setEnabled( true ); registerButton.setEnabled( true ); enableButtons(); }
private final void writeDeleteableFiles(Vector files) throws IOException { OutputStream output = directory.createFile("deleteable.new"); try { output.writeInt(files.size()); for (int i = 0; i < files.size(); i++) output.writeString((String)files.elementAt(i)); } finally { output.close(); } directory.renameFile("deleteable.new", "deletable"); }
public Vector toMessageString() throws ProtocolException { if (userId == null || userId.equals("") || password == null || password.equals("")) { throw new ProtocolException("UserId or password not specified"); } String msg = version + " " + RestConstantsZ.ACTION_UPDATEORDERSTATUS + " " + userId + " " + password + " " + orderId + " " + status; if (hasResponseMessageNumbers()) { msg += " " + getResponseMessageNumbers(); } else { msg += " " + MessageUtil.DUMMY; } if (isDev) { msg += " d"; } return MessageUtil.split(msg, msgId); }
@Override public synchronized void addDatastoreListener(DatastoreListener l) { @SuppressWarnings("unchecked") Vector<DatastoreListener> v = datastoreListeners == null ? new Vector<DatastoreListener>(2) : (Vector<DatastoreListener>) datastoreListeners.clone(); if (!v.contains(l)) { v.addElement(l); datastoreListeners = v; } }
/** * Gets a listing of known, shared file types. Types returned here are not * gurenteed to contain any files, only that the type is known and has a * "shared" of true. (Myster allows the users the option of not sharing a * type. Types that aren't shared are still known by the FileManager but are * not shared and so don't appear here.) * * @return a String[] of shared Myster file types. */ public MysterType[] getFileTypeListing() { //This routine uses the old vector copied to an array trick, since the // number of shared Items is not known until later //so the list is put into a vector intialy then copied to an array. Vector workinglist = new Vector(filelist.length); //since the size of // the final vector // will always be <= // filelist.length. for (int i = 0; i < filelist.length; i++) { if (filelist[i].isShared()) workinglist.addElement(filelist[i].getType()); } MysterType[] array = new MysterType[workinglist.size()]; for (int i = 0; i < array.length; i++) { array[i] = ((MysterType) (workinglist.elementAt(i))); } return array; }
private void createSnmpRequestHandler(SnmpAdaptorServer server, int id, DatagramSocket s, DatagramPacket p, SnmpMibTree tree, Vector<SnmpMibAgent> m, InetAddressAcl a, SnmpPduFactory factory, SnmpUserDataFactory dataFactory, MBeanServer f, ObjectName n) { final SnmpRequestHandler handler = new SnmpRequestHandler(this, id, s, p, tree, m, a, factory, dataFactory, f, n); threadService.submitTask(handler); }
/** * Returns a list of GroupCellKeyAndData which contains contains data for each group cell. The * data in this list represents data series ready to be plotted, i.e. aggregated etc. It does * not contain data tables, but double[] arrays for each SeriesUsageType and each Dimension. * * Since the generation of this list is usually quite expensive, implementations are strongly * encouraged to provide a caching mechanism. */ public GroupCellSeriesData getSeriesDataForAllGroupCells() { synchronized (this) { if (cachedSeriesDataForAllGroupCells == null) { Vector<PlotDimension> dimensions = new Vector<PlotDimension>(); for (Entry<PlotDimension, DefaultDimensionConfig> dimensionEntry : plotInstance .getCurrentPlotConfigurationClone().getDefaultDimensionConfigs().entrySet()) { PlotDimension d = dimensionEntry.getKey(); if (d == PlotDimension.DOMAIN || d == PlotDimension.VALUE) { throw new RuntimeException("This should not happen!"); } dimensions.add(d); } cachedSeriesDataForAllGroupCells = recursivelyGetSeriesDataForAllGroupCells(dimensions, 0, null, null); } } return cachedSeriesDataForAllGroupCells; }
/** * Sets type of the class linked to the specific key. Type of class is represented by * an int number whose value is contained in <code>JMODELConstants</code>. * */ @Override public synchronized void setClassType(int type, Object key) { // If a class type changes, resets its reference station int old = getClassType(key); super.setClassType(type, key); // If type has changed sets ref station to first found source if class is open if (old != type) { setClassRefStation(key, null); if (type == CLASS_TYPE_OPEN) { Vector stations = this.getStationKeys(); for (int i = 0; i < stations.size(); i++) { if (this.getStationType(stations.get(i)).equals(STATION_TYPE_SOURCE)) { setClassRefStation(key, stations.get(i)); break; } } } } }
/** * Classifies an input file, given a model * @param args optional: input file, model file and the output file */ public static void main(String[] args) { loadLabelMappings("data/models/sentiment_label_mappings.tsv"); modelFile = "data/models/sentiment_model.svm"; testFile = "dev.tsv"; predictionFile = "sentiment_test_predictions.tsv"; positiveGazeteerFile = "data/dictionaries/positive"; negativeGazeteerFile = "data/dictionaries/negative"; if (args.length == 3) { testFile = args[0]; modelFile = args[1]; predictionFile = args[2]; } Vector<FeatureExtractor> features = loadFeatureExtractors(); Model model = loadModel(modelFile); classifyTestSet(testFile, model, features, predictionFile, "sentiment"); }
/** * @return */ private void setupManagerDepartments(HttpServletRequest request) throws Exception{ Vector<LabelValueBean> labelValueDepts = new Vector<LabelValueBean>(); for (Department d: Department.getUserDepartments(sessionContext.getUser())) { labelValueDepts.add( new LabelValueBean( d.getDeptCode() + "-" + d.getName(), d.getUniqueId().toString() ) ); } if (labelValueDepts.size() == 1) request.setAttribute("deptId", labelValueDepts.get(0).getValue()); request.setAttribute(Department.DEPT_ATTR_NAME,labelValueDepts); }
/** * Construct a JList that displays the elements in the specified * Vector. This constructor just delegates to the ListModel * constructor. */ public ListPane(final Vector listData) { this( new AbstractListModel() { public int getSize() { return listData.size(); } public Object getElementAt(int i) { return listData.elementAt(i); } } ); }
public static void removeProjectHistory(Project prj) { Vector list = new Vector(); String id; for (int i = 0; i < _list.size(); i++) { id = (((HistoryItem) _list.elementAt(i)).getProject()).getID(); if (id.equals(prj.getID())) { list.add(_list.elementAt(i)); p--; if (_list.elementAt(i).equals(prev)) { if (p > 0) prev = _list.get(p - 1); else prev = null; } } } if (!list.isEmpty()) { _list.removeAll(list); if (p < 0) { p = 0; } _list.setSize(p); next = null; historyBackAction.update(); historyForwardAction.update(); } }
/** * TODO: Namespace doesn't give information giving multiple prefixes for * the same namespaceURI. */ public java.util.Iterator getPrefixes(String namespaceURI) { if (namespaceURI == null) { throw new IllegalArgumentException("URI can't be null."); } else { Vector vector = ((NamespaceSupport) fNamespaceContext).getPrefixes(namespaceURI.intern()); return vector.iterator(); } }
public FormatFileWriter(Vector<Object> names, Vector comments, Vector delimiters, Vector regExprs, int[] types, String name, Vector defualts, Vector replaces) { File fileN = new File(name); try { BufferedWriter writer = new BufferedWriter(new FileWriter(fileN)); writer.write(new String(names.size() + "\n")); for (int i = 0; i < names.size(); i++) { writer.write((String) names.get(i) + "\n"); writer.write(Integer.toString(types[i]) + "\n"); writer.write("1\n"); writer.write((String) comments.get(i) + "\n"); writer.write((String) delimiters.get(i) + "\n"); writer.write((String) regExprs.get(i) + "\n"); writer.write((String) defualts.get(i) + "\n"); writer.write((String) replaces.get(i) + "\n"); } writer.close(); } catch (IOException e) { System.err.println("Errore nella creazione del file di salvataggio del formato"); e.printStackTrace(); } }
/** * Search user-defined configs for SimpleItypeConfig with the given id * @param httpSession Session object containing user-defined configs * @param id Id of the target config * @param indx Stores the row number of the config element that has the match * @return null if not found, SimpleItypeConfig object if found */ private SimpleItypeConfig search(String id, Vector indx, boolean clearErrorFlags) { // Read user defined config Vector sp = (Vector) sessionContext.getAttribute(SimpleItypeConfig.CONFIGS_ATTR_NAME); // No subparts if(sp==null || sp.size()==0) return null; SimpleItypeConfig result = null; // Loop through itypes for(int i=0; i<sp.size(); i++) { SimpleItypeConfig sic = (SimpleItypeConfig) sp.elementAt(i); indx.clear(); indx.addElement(""+i); if (clearErrorFlags) sic.setHasError(false); // Recursively process each itype config result = searchR(sic, id, clearErrorFlags); if(result!=null) break; } if (clearErrorFlags) sessionContext.setAttribute(SimpleItypeConfig.CONFIGS_ATTR_NAME, sp); return result; }
public Point2D getPoint(int rowIndex) { Vector row = (Vector)allRows.get(rowIndex); if( row.get(latCol)==null || row.get(lonCol)==null)return null; Point2D.Double p = new Point2D.Double( ((Double)row.get(lonCol)).doubleValue(), ((Double)row.get(latCol)).doubleValue() ); return p; }
public FrameChange(final float[] framePoints) { float minScore = 100.0f; float maxScore = -100.0f; pointDeltas = new Vector<PointChange>(framePoints.length / KEYPOINT_STEP); for (int i = 0; i < framePoints.length; i += KEYPOINT_STEP) { final float x1 = framePoints[i + 0] * DOWNSAMPLE_FACTOR; final float y1 = framePoints[i + 1] * DOWNSAMPLE_FACTOR; final boolean wasFound = framePoints[i + 2] > 0.0f; final float x2 = framePoints[i + 3] * DOWNSAMPLE_FACTOR; final float y2 = framePoints[i + 4] * DOWNSAMPLE_FACTOR; final float score = framePoints[i + 5]; final int type = (int) framePoints[i + 6]; minScore = Math.min(minScore, score); maxScore = Math.max(maxScore, score); pointDeltas.add(new PointChange(x1, y1, x2, y2, score, type, wasFound)); } this.minScore = minScore; this.maxScore = maxScore; }
public static void init() { if (isInited) return; // complain isInited = true; menuItems = new Vector(); menuItems.addElement(new MysterMenuItemFactory("Cycle Windows", new CycleWindowsHandler(), KeyEvent.VK_1)); menuItems.addElement(new MysterMenuItemFactory("Stack Windows", new StackWindowsHandler())); menuItems.addElement(new MysterMenuItemFactory("-", new NullAction())); finalMenu = new Vector(); MysterMenuBar.addMenu(new MysterMenuFactory("Windows", finalMenu) { @Override public JMenu makeMenu(JFrame frame) { return getCorrectWindowsMenu(frame); } }); updateMenu(); }
public static Map<Integer, List<LexLocation>> getHitLocations(File file) { Map<Integer, List<LexLocation>> map = new HashMap<Integer, List<LexLocation>>(); for (LexLocation l: allLocations) { if (l.executable && l.hits > 0 && l.file.equals(file)) { List<LexLocation> list = map.get(l.startLine); if (list == null) { list = new Vector<LexLocation>(); map.put(l.startLine, list); } list.add(l); } } return map; }
public LearnerProgressBatchDTO(Vector<LearnerProgress> progress, int batchSize, int numAllLearnerProgress) { this.learnerProgressList = progress; this.batchSize = batchSize; this.numAllLearnerProgress = numAllLearnerProgress; // integer division truncates, so convert to floating point first. double batchSizeAsDouble = batchSize; double numAllLearnerProgressAsDouble = numAllLearnerProgress; double numBatchesDouble = numAllLearnerProgressAsDouble / batchSizeAsDouble; numBatchesDouble = Math.ceil(numBatchesDouble); numBatches = (int) numBatchesDouble; if (numBatches < 1) { numBatches = 1; } }
@SuppressWarnings("deprecation") public void show(Event e) { target = (Component)e.target; // Get menus from the target. Vector<MenuItem> targetItemVector = getMenuTargetItems(); if (targetItemVector != null) { reloadItems(targetItemVector); //Fix for 6287092: JCK15a: api/java_awt/interactive/event/EventTests.html#EventTest0015 fails, mustang Point tl = target.getLocationOnScreen(); Point pt = new Point(tl.x + e.x, tl.y + e.y); //Fixed 6266513: Incorrect key handling in XAWT popup menu //No item should be selected when showing popup menu if (!ensureCreated()) { return; } Dimension dim = getDesiredSize(); //Fix for 6267162: PIT: Popup Menu gets hidden below the screen when opened //near the periphery of the screen, XToolkit Rectangle bounds = getWindowBounds(pt, dim); reshape(bounds); xSetVisible(true); toFront(); selectItem(null, false); grabInput(); } }
/** * Initialize the buffer */ void beginEdits(int offset, int length) { this.offset = offset; this.length = length; this.endOffset = offset + length; pos = offset; if (changes == null) { changes = new Vector<ElemChanges>(); } else { changes.removeAllElements(); } if (path == null) { path = new Stack<ElemChanges>(); } else { path.removeAllElements(); } fracturedParent = null; fracturedChild = null; offsetLastIndex = offsetLastIndexOnReplace = false; }
/** * Returns the agent start arguments. * @return the agent start arguments */ @XmlTransient public Vector<AgentStartArguments> getAgentStartArguments() { if (this.agentVector==null) { this.agentVector = new Vector<AgentStartArguments>(); } return agentVector; }
@Override public boolean loopAction(String fileName) throws JLIException, jxthrowable { if (output==null) output = new Vector<String>(); output.add(fileName); return false; }
/** * Parse a list of identifiers. */ Vector<String> parseIdentifierList(boolean lower) throws IOException { Vector<String> elems = new Vector<>(); skipSpace(); switch (ch) { case '(': ch = in.read(); skipParameterSpace(); while (parseNameToken(lower)) { elems.addElement(getString(0)); skipParameterSpace(); if (ch == '|') { ch = in.read(); skipParameterSpace(); } } expect(')'); skipParameterSpace(); break; default: if (!parseIdentifier(lower)) { error("expected", "identifier"); break; } elems.addElement(getString(0)); skipParameterSpace(); break; } return elems; }
public void addShape(shapeImg img){ if(Shapes == null){ Shapes = new Vector<shapeImg>(2); } Shapes.add(img); }
public ExamConflictStatisticsInfo getConflictStatisticsSubInfo(Vector variables) { ExamConflictStatisticsInfo ret = new ExamConflictStatisticsInfo(); for (Enumeration e=variables.elements();e.hasMoreElements();) { Exam exam = (Exam)e.nextElement(); CBSVariable var = (CBSVariable)iVariables.get(exam.getId()); if (var!=null) ret.iVariables.put(exam.getId(),var); } return ret; }
public Collection getNotesForPeriod(CalendarDate startDate, CalendarDate endDate) { Vector v = new Vector(); Elements yrs = _root.getChildElements("year"); for (int yi = 0; yi < yrs.size(); yi++) { Year y = new Year(yrs.get(yi)); if ((y.getValue() >= startDate.getYear()) && (y.getValue() <= endDate.getYear())) { Vector months = y.getMonths(); for (int mi = 0; mi < months.size(); mi++) { Month m = (Month) months.get(mi); if (!((y.getValue() == startDate.getYear()) && (m.getValue() < startDate.getMonth())) || !((y.getValue() == endDate.getYear()) && (m.getValue() > endDate.getMonth()))) { Vector days = m.getDays(); for (int di = 0; di < days.size(); di++) { Day d = (Day) days.get(di); if (!((m.getValue() == startDate.getMonth()) && (d.getValue() < startDate.getDay())) || !((m.getValue() == endDate.getMonth()) && (d.getValue() > endDate.getDay()))) { Vector ns = d.getNotes(); for(int ni = 0; ni < ns.size(); ni++) { NoteElement n = (NoteElement) ns.get(ni); v.add(new NoteImpl(n.getElement(), _project)); } } } } } } } return v; }
private void renderDebug(final Canvas canvas) { if (!isDebug()) { return; } final Bitmap copy = cropCopyBitmap; if (copy != null) { final Matrix matrix = new Matrix(); final float scaleFactor = 2; matrix.postScale(scaleFactor, scaleFactor); matrix.postTranslate( canvas.getWidth() - copy.getWidth() * scaleFactor, canvas.getHeight() - copy.getHeight() * scaleFactor); canvas.drawBitmap(copy, matrix, new Paint()); final Vector<String> lines = new Vector<String>(); if (classifier != null) { String statString = classifier.getStatString(); String[] statLines = statString.split("\n"); for (String line : statLines) { lines.add(line); } } lines.add("Frame: " + previewWidth + "x" + previewHeight); lines.add("Crop: " + copy.getWidth() + "x" + copy.getHeight()); lines.add("View: " + canvas.getWidth() + "x" + canvas.getHeight()); lines.add("Rotation: " + sensorOrientation); lines.add("Inference time: " + lastProcessingTimeMs + "ms"); borderedText.drawLines(canvas, 10, canvas.getHeight() - 10, lines); } }
public Vector toMessageString() throws ProtocolException { if (userId == null || userId.equals("") || password == null || password.equals("")) { throw new ProtocolException("UserId or password not specified"); } String msg = MessageHeader.VERSION03 + " " + RestConstantsZ.ACTION_GETINVENTORY + " " + userId + " " + password; if (onlyStock) { msg += " 1"; } else { msg += " 0"; } if (kid != null) // VERSION03 feature { msg += " " + kid; } else { msg += " " + MessageUtil.DUMMY; } if (hasResponseMessageNumbers()) { msg += " " + getResponseMessageNumbers(); } else { msg += " " + MessageUtil.DUMMY; } if (isDev) { msg += " d"; } return MessageUtil.split(msg, msgId); }
/** * Takes a vector of WhitespaceRule objects and generates a predicate * method. This method returns the translets default action for handling * whitespace text-nodes: * - USE_PREDICATE (run the method generated by this method) * - STRIP_SPACE (always strip whitespace text-nodes) * - PRESERVE_SPACE (always preserve whitespace text-nodes) */ public static int translateRules(Vector rules, ClassGenerator classGen) { // Get the core rules in prioritized order final int defaultAction = prioritizeRules(rules); // The rules vector may be empty after prioritising if (rules.size() == 0) { compileDefault(defaultAction,classGen); return defaultAction; } // Now - create a predicate method and sequence through rules... compilePredicate(rules, defaultAction, classGen); // Return with the translets required action ( return USE_PREDICATE; }
/** * Return the signature of the current method */ private String getMethodSignature(Vector argsType) { final StringBuffer buf = new StringBuffer(_className); buf.append('.').append(_fname.getLocalPart()).append('('); int nArgs = argsType.size(); for (int i = 0; i < nArgs; i++) { final Type intType = (Type)argsType.elementAt(i); buf.append(intType.toString()); if (i < nArgs - 1) buf.append(", "); } buf.append(')'); return buf.toString(); }
public GridderZW(int gridSize, int numGrids, int nLevel, Projection proj, String dirName) throws IOException { gridder = null; this.gridSize = gridSize; this.proj = proj; this.nLevel = nLevel; this.dir = new File(dirName + "/zw"); path = dir.getPath(); if(!dir.exists()) { if(!dir.mkdirs()) throw new IOException( "\n** could not create "+ dirName); // System.out.println(dir.getPath() +" created"); } else if( !dir.isDirectory() ) { throw new IOException("\n** open error:\t"+ dirName +" not a directory"); } cruiseDir = new File(dir, "cruises"); if( !cruiseDir.exists()) cruiseDir.mkdirs(); grid = new XGrid_ZW[numGrids]; readOrder = new int[numGrids]; for( int i=0 ; i<numGrids ; i++) { readOrder[i] = -1; grid[i] = null; } tiles = new Vector(); wrap = false; }
@Override public Collection<String> getHeaders(String name) { Enumeration<String> enumeration = getCoyoteResponse().getMimeHeaders().values(name); Vector<String> result = new Vector<String>(); while (enumeration.hasMoreElements()) { result.addElement(enumeration.nextElement()); } return result; }
private void fetchColumns() { Vector temp = new Vector(20); Vector tempType = new Vector(20); try { if (cConn == null) { return; } if (dbmeta == null) { dbmeta = cConn.getMetaData(); } ResultSet colList = dbmeta.getColumns(null, null, tableName, "%"); while (colList.next()) { temp.addElement(colList.getString("COLUMN_NAME")); tempType.addElement(new Short(colList.getShort("DATA_TYPE"))); } colList.close(); } catch (SQLException e) { ZaurusEditor.printStatus("SQL Exception: " + e.getMessage()); } columns = new String[temp.size()]; temp.copyInto(columns); columnTypes = new short[temp.size()]; for (int i = 0; i < columnTypes.length; i++) { columnTypes[i] = ((Short) tempType.elementAt(i)).shortValue(); } }
/** * Removes a gate listener */ @Override public synchronized void removeFeatureMapListener(FeatureMapListener l) { if (mapListeners != null && mapListeners.contains(l)) { @SuppressWarnings("unchecked") Vector<FeatureMapListener> v = (Vector<FeatureMapListener>) mapListeners.clone(); v.removeElement(l); mapListeners = v; } }
private void fetchPrimaryKeys() { Vector temp = new Vector(20); try { if (cConn == null) { return; } if (dbmeta == null) { dbmeta = cConn.getMetaData(); } ResultSet colList = dbmeta.getPrimaryKeys(null, null, tableName); while (colList.next()) { temp.addElement(colList.getString("COLUMN_NAME")); } colList.close(); } catch (SQLException e) { ZaurusEditor.printStatus("SQL Exception: " + e.getMessage()); } primaryKeys = new String[temp.size()]; temp.copyInto(primaryKeys); pkColIndex = new int[primaryKeys.length]; for (int i = 0; i < primaryKeys.length; i++) { pkColIndex[i] = this.getColIndex(primaryKeys[i]); } // end of for (int i=0; i<primaryKeys.length; i++) }
private static void checkNSRecurseCheckCardinality(Vector children, int min1, int max1, SubstitutionGroupHandler dSGHandler, XSParticleDecl wildcard, int min2, int max2, boolean checkWCOccurrence) throws XMLSchemaException { // check Occurrence ranges if (checkWCOccurrence && !checkOccurrenceRange(min1,max1,min2,max2)) { throw new XMLSchemaException("rcase-NSRecurseCheckCardinality.2", new Object[]{ Integer.toString(min1), max1==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(max1), Integer.toString(min2), max2==SchemaSymbols.OCCURRENCE_UNBOUNDED?"unbounded":Integer.toString(max2)}); } // Check that each member of the group is a valid restriction of the wildcard int count = children.size(); try { for (int i = 0; i < count; i++) { XSParticleDecl particle1 = (XSParticleDecl)children.elementAt(i); particleValidRestriction(particle1, dSGHandler, wildcard, null, false); } } // REVISIT: should we really just ignore original cause of this error? // how can we report it? catch (XMLSchemaException e) { throw new XMLSchemaException("rcase-NSRecurseCheckCardinality.1", null); } }
@Override public List<INIdentifierPattern> findIdentifiers() { List<INIdentifierPattern> list = new Vector<INIdentifierPattern>(); for (INPattern p: plist) { list.addAll(p.findIdentifiers()); } return list; }