Java Code Examples for java.util.Vector
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/graphgen/.
Source file: GraphGen.java

@Override public Op[] getSourceOps(){ final Vector sources=image.getSources(); if (sources == null) { return new Op[0]; } final Set<Op> result=new HashSet<Op>(); for ( Object source : sources) { if (source instanceof RenderedImage) { result.add(getOp((RenderedImage)source)); } } return result.toArray(new Op[result.size()]); }
Example 2
From project AlbiteREADER, under directory /src/org/albite/book/model/book/.
Source file: FileBook.java

final Chapter[] loadChaptersDescriptor() throws BookException, IOException { Vector chaps=new Vector(); splitChapterIntoPieces(bookFile,(int)bookFile.fileSize(),getArchive(),(processHtmlEntities ? MAXIMUM_HTML_FILESIZE : MAXIMUM_TXT_FILESIZE),0,processHtmlEntities,chaps); Chapter[] res=new Chapter[chaps.size()]; chaps.copyInto(res); return res; }
Example 3
From project Bitcoin-Wallet-for-Android, under directory /wallet/src/com/google/zxing/multi/.
Source file: GenericMultipleBarcodeReader.java

public Result[] decodeMultiple(BinaryBitmap image,Hashtable hints) throws NotFoundException { Vector results=new Vector(); doDecodeMultiple(image,hints,results,0,0); if (results.isEmpty()) { throw NotFoundException.getNotFoundInstance(); } int numResults=results.size(); Result[] resultArray=new Result[numResults]; for (int i=0; i < numResults; i++) { resultArray[i]=(Result)results.elementAt(i); } return resultArray; }
Example 4
From project Blackberry-Sample-App, under directory /BlackberrySampleApp/src/pe/com/avances/sampleapp/dao/.
Source file: DocumentDAO.java

public Vector getAllDocuments(){ Vector documentVector=new Vector(); Document aDocument=new Document("PEN",2082.50,"Ace Peru SAC"); documentVector.addElement(aDocument); Document anotherDocument=new Document("USD",79.73,"Cargill Americas INC."); documentVector.addElement(anotherDocument); Document yetAnotherDocument=new Document("USD",119.00,"Cargill Americas INC."); documentVector.addElement(yetAnotherDocument); return documentVector; }
Example 5
/** * Returns an array of Strings, whose toString representation matches a regular expression. This method works like the Perl function of the same name. Given a regular expression of "a*b" and an array of String objects of [foo, aab, zzz, aaaab], the array of Strings returned by grep would be [aab, aaaab]. * @param search Array of Objects to search * @return Array of Strings whose toString() value matches this regular expression. */ public String[] grep(Object[] search){ Vector v=new Vector(); for (int i=0; i < search.length; i++) { String s=search[i].toString(); if (match(s)) { v.addElement(s); } } String[] ret=new String[v.size()]; v.copyInto(ret); return ret; }
Example 6
From project cameraptp, under directory /src/main/java/ste/ptp/.
Source file: DevicePropDesc.java

private Vector parseEnumeration(){ int len=nextU16(); Vector retval=new Vector(len); while (len-- > 0) retval.addElement(DevicePropValue.get(dataType,this)); return retval; }
Example 7
From project caustic, under directory /core/src/net/caustic/http/.
Source file: BasicCookieManager.java

public String[] getCookiesFor(String urlStr,Hashtable requestHeaders) throws BadURLException { Hashtable cookiesForDomain=getCookies(urlStr); final Vector result=new Vector(); Enumeration e=cookiesForDomain.keys(); while (e.hasMoreElements()) { String name=(String)e.nextElement(); result.addElement(name + "=" + cookiesForDomain.get(name)); } String[] resultAry=new String[result.size()]; result.copyInto(resultAry); return resultAry; }
Example 8
From project agile, under directory /agile-framework/src/main/java/org/apache/naming/resources/.
Source file: ResourceAttributes.java

/** * Get all attributes. */ public NamingEnumeration getAll(){ if (attributes == null) { Vector attributes=new Vector(); Date creationDate=getCreationDate(); if (creationDate != null) { attributes.addElement(new BasicAttribute(CREATION_DATE,creationDate)); attributes.addElement(new BasicAttribute(ALTERNATE_CREATION_DATE,creationDate)); } Date lastModifiedDate=getLastModifiedDate(); if (lastModifiedDate != null) { attributes.addElement(new BasicAttribute(LAST_MODIFIED,lastModifiedDate)); attributes.addElement(new BasicAttribute(ALTERNATE_LAST_MODIFIED,lastModifiedDate)); } String name=getName(); if (name != null) { attributes.addElement(new BasicAttribute(NAME,name)); } String resourceType=getResourceType(); if (resourceType != null) { attributes.addElement(new BasicAttribute(TYPE,resourceType)); attributes.addElement(new BasicAttribute(ALTERNATE_TYPE,resourceType)); } long contentLength=getContentLength(); if (contentLength >= 0) { Long contentLengthLong=new Long(contentLength); attributes.addElement(new BasicAttribute(CONTENT_LENGTH,contentLengthLong)); attributes.addElement(new BasicAttribute(ALTERNATE_CONTENT_LENGTH,contentLengthLong)); } String etag=getETag(); if (etag != null) { attributes.addElement(new BasicAttribute(ETAG,etag)); attributes.addElement(new BasicAttribute(ALTERNATE_ETAG,etag)); } return new RecyclableNamingEnumeration(attributes); } else { return attributes.getAll(); } }
Example 9
From project Anki-Android, under directory /src/com/mindprod/common11/.
Source file: StringTools.java

/** * Collapse multiple blank lines down to one. Discards lead and trail blank lines. Blank lines are lines that when trimmed have length 0. Enhanced version available in com.mindprod.common11.StringTools for JDK 1.5+. * @param lines array of lines to tidy. * @param minBlankLinesToKeep usually 1 meaning 1+ consecutive blank lines become 1, effectively collapsing runs ofblank lines down to 1. if 2, 1 blank line is removed, and 2+ consecutive blanks lines become 1, effectively undouble spacing. if zero, non-blank lines will be separated by one blank line, even if there was not one there to begin with, completely independent of preexisting blank lines, effectively double spacing.. 9999 effectively removes all blank lines. * @return array of lines with lead and trail blank lines removed, and excess blank lines collapsed down to one or 0.The results are NOT trimmed. */ public static String[] pruneExcessBlankLines(String[] lines,int minBlankLinesToKeep){ int firstNonBlankLine=lines.length; for (int i=0; i < lines.length; i++) { if (lines[i].trim().length() > 0) { firstNonBlankLine=i; break; } } int lastNonBlankLine=-1; for (int i=lines.length - 1; i > 0; i--) { if (lines[i].trim().length() > 0) { lastNonBlankLine=i; break; } } if (firstNonBlankLine > lastNonBlankLine) { return new String[0]; } Vector keep=new Vector(lastNonBlankLine - firstNonBlankLine + 1); int pendingBlankLines=0; for (int i=firstNonBlankLine; i <= lastNonBlankLine; i++) { if (lines[i].trim().length() == 0) { pendingBlankLines++; } else { if (pendingBlankLines >= minBlankLinesToKeep) { keep.add(""); } keep.add(lines[i]); pendingBlankLines=0; } } return (String[])keep.toArray(new String[keep.size()]); }
Example 10
From project BDSup2Sub, under directory /src/main/java/bdsup2sub/tools/.
Source file: QuantizeFilter.java

@SuppressWarnings("rawtypes") public OctTreeQuantizer(){ setup(256); colorList=new Vector[MAX_LEVEL + 1]; for (int i=0; i < MAX_LEVEL + 1; i++) colorList[i]=new Vector(); root=new OctTreeNode(); }
Example 11
From project bioclipse.speclipse, under directory /plugins/net.bioclipse.nmrshiftdb/src/net/bioclipse/nmrshiftdb/business/.
Source file: NmrshiftdbManager.java

public String getSpectrumTypes(String serverurl) throws BioclipseException { try { Options opts=new Options(new String[0]); opts.setDefaultURL(serverurl + "/services/NMRShiftDB"); Service service=new Service(); Call call=(Call)service.createCall(); call.setOperationName("getSpectrumTypes"); call.setTargetEndpointAddress(new URL(opts.getURL())); DocumentBuilder builder; builder=DocumentBuilderFactory.newInstance().newDocumentBuilder(); SOAPBodyElement[] input=new SOAPBodyElement[1]; Document doc=builder.newDocument(); Element cdataElem; cdataElem=doc.createElementNS(opts.getURL(),"getSpectrumTypes"); input[0]=new SOAPBodyElement(cdataElem); Vector elems=(Vector)call.invoke(input); SOAPBodyElement elem=null; Element e=null; elem=(SOAPBodyElement)elems.get(0); e=elem.getAsDOM(); return e.getFirstChild().getTextContent(); } catch ( Exception ex) { throw new BioclipseException(ex.getMessage()); } }
Example 12
From project BSPAN---Bluetooth-Sensor-Processing-for-Android, under directory /AndroidSpineServer/src/spine/.
Source file: SPINEManager.java

/** * package-scoped method called by SPINEFactory. The caller must guarantee that moteCom and platform are not null. */ SPINEManager(String moteCom,String platform){ try { MOTECOM=moteCom; PLATFORM=platform; MY_GROUP_ID=(byte)Short.parseShort(prop.getProperty(Properties.GROUP_ID_KEY),16); LOCALNODEADAPTER_CLASSNAME=prop.getProperty(PLATFORM + "_" + Properties.LOCALNODEADAPTER_CLASSNAME_KEY); URL_PREFIX=prop.getProperty(PLATFORM + "_" + Properties.URL_PREFIX_KEY); SPINEDATACODEC_PACKAGE=SPINEDATACODEC_PACKAGE_PREFIX + prop.getProperty(PLATFORM + "_" + Properties.SPINEDATACODEC_PACKAGE_SUFFIX_KEY) + "."; MESSAGE_CLASSNAME=prop.getProperty(PLATFORM + "_" + Properties.MESSAGE_CLASSNAME_KEY); SPINE_SERVICE_MESSAGE_CODEC_PACKAGE=SPINE_SERVICE_MESSAGE_CODEC_PACKAGE_PREFIX + prop.getProperty(PLATFORM + "_" + Properties.SPINEDATACODEC_PACKAGE_SUFFIX_KEY) + "."; System.setProperty(Properties.LOCALNODEADAPTER_CLASSNAME_KEY,LOCALNODEADAPTER_CLASSNAME); nodeAdapter=LocalNodeAdapter.getLocalNodeAdapter(); Vector params=new Vector(); params.addElement(MOTECOM); nodeAdapter.init(params); java.util.logging.LogManager mng=java.util.logging.LogManager.getLogManager(); Enumeration e=mng.getLoggerNames(); nodeAdapter.start(); connection=nodeAdapter.createAPSConnection(); baseStation=new Node(new Address("" + SPINEPacketsConstants.SPINE_BASE_STATION)); baseStation.setLogicalID(new Address(SPINEPacketsConstants.SPINE_BASE_STATION_LABEL)); eventDispatcher=new EventDispatcher(this); } catch ( NumberFormatException e) { exit(DEF_PROP_MISSING_MSG); } catch ( ClassNotFoundException e) { e.printStackTrace(); if (l.isLoggable(Logger.SEVERE)) l.log(Logger.SEVERE,e.getMessage()); } catch ( InstantiationException e) { e.printStackTrace(); if (l.isLoggable(Logger.SEVERE)) l.log(Logger.SEVERE,e.getMessage()); } catch ( IllegalAccessException e) { e.printStackTrace(); if (l.isLoggable(Logger.SEVERE)) l.log(Logger.SEVERE,e.getMessage()); } }
Example 13
From project alfredo, under directory /alfredo/src/test/java/com/cloudera/alfredo/server/.
Source file: TestAuthenticationFilter.java

public void testGetConfiguration() throws Exception { AuthenticationFilter filter=new AuthenticationFilter(); FilterConfig config=Mockito.mock(FilterConfig.class); Mockito.when(config.getInitParameter(AuthenticationFilter.CONFIG_PREFIX)).thenReturn(""); Mockito.when(config.getInitParameter("a")).thenReturn("A"); Mockito.when(config.getInitParameterNames()).thenReturn(new Vector(Arrays.asList("a")).elements()); Properties props=filter.getConfiguration("",config); assertEquals("A",props.getProperty("a")); config=Mockito.mock(FilterConfig.class); Mockito.when(config.getInitParameter(AuthenticationFilter.CONFIG_PREFIX)).thenReturn("foo"); Mockito.when(config.getInitParameter("foo.a")).thenReturn("A"); Mockito.when(config.getInitParameterNames()).thenReturn(new Vector(Arrays.asList("foo.a")).elements()); props=filter.getConfiguration("foo.",config); assertEquals("A",props.getProperty("a")); }
Example 14
public static int makeEvent(Vector<Statement> statements,int index){ PredicateInfo[] event=null; switch (RANDOM.nextInt(4)) { case 0: event=interaction; break; case 1: event=invoice; break; case 2: event=payment; break; case 3: event=purchase; break; } BNode bnode=ThreadVars.valueFactory.get().createBNode(); Resource context=(Resource)new RandomCustomer().makeValue(); for (int i=0; i < Defaults.EVENT_SIZE; index++, i++) { statements.set(index,event[i].makeStatement(bnode,context)); } return index; }
Example 15
From project aksunai, under directory /src/org/androidnerds/app/aksunai/data/.
Source file: ServerDbAdapter.java

public Vector<Long> getIds(){ SQLiteDatabase db=getReadableDatabase(); Vector<Long> ids=new Vector<Long>(); Cursor c=db.query(DB_TABLE,null,null,null,null,null,null); while (c.moveToNext()) { ids.add(new Long(c.getLong(0))); } c.close(); db.close(); return ids; }
Example 16
public static Vector<String> parseString(String ss){ Vector<String> ll=new Vector<String>(Arrays.asList(ss.replaceAll("'"," ").split("(\\s|,)+"))); Vector<String> result=new Vector<String>(); Pattern p=Pattern.compile("[\\p{InCombiningDiacriticalMarks}\\p{IsLm}\\p{IsSk}]+"); for ( String s : ll) { s=Normalizer.normalize(s,Normalizer.Form.NFD); s=p.matcher(s).replaceAll(""); s=s.toUpperCase(Locale.ENGLISH); s=s.replaceAll("[^A-Z]",""); result.add(s + "$"); } return result; }
Example 17
From project alljoyn_java, under directory /samples/java/addressbook/.
Source file: ContactService.java

/** * @inheritDoc Notice that DBus allows for the sending of an empty array. */ public Contact[] getContacts(String[] lastNames){ Vector<Contact> contactVec=new Vector<Contact>(); for ( String lastName : lastNames) { Contact c=contactMap.get(lastName); if (null != c) { contactVec.add(c); } } return contactVec.toArray(new Contact[0]); }
Example 18
From project android-voip-service, under directory /src/main/java/org/linphone/core/.
Source file: LinphoneCoreImpl.java

public synchronized Vector<LinphoneCallLog> getCallLogs(){ isValid(); Vector<LinphoneCallLog> logs=new Vector<LinphoneCallLog>(); for (int i=0; i < getNumberOfCallLogs(nativePtr); i++) { logs.add(new LinphoneCallLogImpl(getCallLog(nativePtr,i))); } return logs; }
Example 19
From project androidtracks, under directory /src/org/sfcta/cycletracks/.
Source file: TripUploader.java

private Vector<String> getTripData(long tripId){ Vector<String> tripData=new Vector<String>(); mDb.openReadOnly(); Cursor tripCursor=mDb.fetchTrip(tripId); String note=tripCursor.getString(tripCursor.getColumnIndex(DbAdapter.K_TRIP_NOTE)); String purpose=tripCursor.getString(tripCursor.getColumnIndex(DbAdapter.K_TRIP_PURP)); Double startTime=tripCursor.getDouble(tripCursor.getColumnIndex(DbAdapter.K_TRIP_START)); Double endTime=tripCursor.getDouble(tripCursor.getColumnIndex(DbAdapter.K_TRIP_END)); tripCursor.close(); mDb.close(); SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); tripData.add(note); tripData.add(purpose); tripData.add(df.format(startTime)); tripData.add(df.format(endTime)); return tripData; }
Example 20
From project Android_1, under directory /org.eclipse.ecf.android/src/org/eclipse/ecf/android/.
Source file: RegEx.java

Token processBackreference() throws ParseException { int refnum=this.chardata - '0'; Token tok=Token.createBackReference(refnum); this.hasBackReferences=true; if (this.references == null) this.references=new Vector<ReferencePosition>(); this.references.addElement(new ReferencePosition(refnum,this.offset - 2)); this.next(); return tok; }
Example 21
From project android_packages_apps_VoiceDialer_2, under directory /src/com/android/voicedialer/.
Source file: VoiceDialerTester.java

/** * Sweep directory of directories, listing all WAV files. */ public VoiceDialerTester(File dir){ if (false) { Log.d(TAG,"VoiceDialerTester " + dir); } Vector<File> wavDirs=new Vector<File>(); wavDirs.add(dir); Vector<File> wavFiles=new Vector<File>(); for (int i=0; i < wavDirs.size(); i++) { File d=wavDirs.get(i); for ( File f : d.listFiles()) { if (f.isFile() && f.getName().endsWith(".wav")) { wavFiles.add(f); } else if (f.isDirectory()) { wavDirs.add(f); } } } File[] fa=wavFiles.toArray(new File[wavFiles.size()]); Arrays.sort(fa); mWavFiles=new WavFile[fa.length]; for (int i=0; i < mWavFiles.length; i++) { mWavFiles[i]=new WavFile(fa[i]); } mWavDirs=wavDirs.toArray(new File[wavDirs.size()]); Arrays.sort(mWavDirs); }
Example 22
From project android_wallpaper_flowers, under directory /src/fi/harism/wallpaper/flowers/.
Source file: FlowerObjects.java

/** * Renders flower textures. */ private void renderFlowers(Vector<StructPoint> flowers,float[] color,PointF offset){ mShaderTexture.useProgram(); int uAspectRatio=mShaderTexture.getHandle("uAspectRatio"); int uOffset=mShaderTexture.getHandle("uOffset"); int uScale=mShaderTexture.getHandle("uScale"); int uRotationM=mShaderTexture.getHandle("uRotationM"); int uColor=mShaderTexture.getHandle("uColor"); int aPosition=mShaderTexture.getHandle("aPosition"); GLES20.glUniform2f(uAspectRatio,mAspectRatio.x,mAspectRatio.y); GLES20.glUniform4fv(uColor,1,color,0); GLES20.glVertexAttribPointer(aPosition,2,GLES20.GL_BYTE,false,0,mBufferTexture); GLES20.glEnableVertexAttribArray(aPosition); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D,mFlowerTextureId[0]); for ( StructPoint point : flowers) { final float rotationM[]={point.mRotationCos,point.mRotationSin,-point.mRotationSin,point.mRotationCos}; GLES20.glUniformMatrix2fv(uRotationM,1,false,rotationM,0); GLES20.glUniform2f(uOffset,point.mPosition.x - offset.x,point.mPosition.y - offset.y); GLES20.glUniform1f(uScale,point.mScale); GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP,0,4); } }
Example 23
From project andstatus, under directory /src/org/andstatus/app/account/.
Source file: MyAccount.java

/** * Initialize internal static memory Initialize User's list if it wasn't initialized yet. * @param context */ public static void initialize(){ if (mMyAccounts == null) { mMyAccounts=new Vector<MyAccount>(); defaultAccountName=MyPreferences.getDefaultSharedPreferences().getString(KEY_DEFAULT_ACCOUNT_NAME,""); android.accounts.AccountManager am=AccountManager.get(MyPreferences.getContext()); android.accounts.Account[] aa=am.getAccountsByType(AuthenticatorService.ANDROID_ACCOUNT_TYPE); for (int ind=0; ind < aa.length; ind++) { MyAccount tu=new MyAccount(aa[ind],true); mMyAccounts.add(tu); } MyLog.v(TAG,"Account list initialized, " + mMyAccounts.size() + " accounts"); } else { MyLog.v(TAG,"Already initialized, " + mMyAccounts.size() + " accounts"); } }
Example 24
/** * Initialize internal static memory Initialize User's list if it wasn't initialized yet. * @param context */ public static void initialize(){ if (mTu == null) { mTu=new Vector<TwitterUser>(); java.io.File prefsdir=new File(SharedPreferencesUtil.prefsDirectory(AndTweetPreferences.getContext())); java.io.File files[]=prefsdir.listFiles(); if (files != null) { for (int ind=0; ind < files.length; ind++) { if (files[ind].getName().startsWith(FILE_PREFIX)) { String username=files[ind].getName().substring(FILE_PREFIX.length()); int indExtension=username.indexOf("."); if (indExtension >= 0) { username=username.substring(0,indExtension); } TwitterUser tu=new TwitterUser(username); mTu.add(tu); } } } AndTweetService.v(TAG,"User's list initialized, " + mTu.size() + " users"); } else { AndTweetService.v(TAG,"Already initialized, " + mTu.size() + " users"); } }
Example 25
From project ant4eclipse, under directory /org.ant4eclipse.lib.core/src/org/ant4eclipse/lib/core/xquery/.
Source file: XQuery.java

/** * Adds the supplied value to this query. * @param newvalue The value that shall be added. */ private void addValue(String newvalue){ if (this._values == null) { this._values=new Vector<String>(); } this._values.add(newvalue); }
Example 26
public static int cleanUpCache(int ttl,int initialDelay){ int delay=initialDelay; long realTtl=ttl * 1000; long now=new Date().getTime(); Vector<Long> oldKeys=new Vector<Long>(); for ( Map.Entry<Long,CachedPassPhrase> pair : mPassPhraseCache.entrySet()) { long lived=now - pair.getValue().timestamp; if (lived >= realTtl) { oldKeys.add(pair.getKey()); } else { long nextCheck=realTtl - lived + 1000; if (nextCheck < delay) { delay=(int)nextCheck; } } } for ( long keyId : oldKeys) { mPassPhraseCache.remove(keyId); } return delay; }
Example 27
From project arastreju, under directory /arastreju.rdb/src/main/java/org/arastreju/bindings/rdb/.
Source file: RdbConnectionProvider.java

public RdbConnectionProvider(String driver,String user,String pass,String url,String table,int max_cons){ super(); this.driver=driver; this.user=user; this.pass=pass; this.url=url; this.table=table; this.max_cons=max_cons; usedCons=new Vector<Connection>(); cons=new Vector<Connection>(); }
Example 28
From project Archimedes, under directory /br.org.archimedes.extend.tests/plugin-test/br/org/archimedes/extenders/.
Source file: LineExtenderTest.java

@Before public void setUp() throws Exception { extender=new LineExtender(); referencesArray=new Vector<Element>(2); verticalWithIntersection=new Line(1,2,1,6); upReference=new Line(0,7,2,7); downReference=new Line(0,1,2,1); referencesArray.add(upReference); referencesArray.add(downReference); }
Example 29
From project ARCInputFormat, under directory /src/org/commoncrawl/util/shared/.
Source file: ArcFileReader.java

/** * construct a reader given a list of ByteBuffers */ private static InputStreamReader readerFromScanBufferList(LinkedList<ByteBuffer> buffers,Charset charset) throws IOException { Vector<InputStream> inputStreams=new Vector<InputStream>(); for ( ByteBuffer buffer : buffers) { inputStreams.add(newInputStream(buffer)); } buffers.clear(); SequenceInputStream seqInputStream=new SequenceInputStream(inputStreams.elements()); ; return new InputStreamReader(seqInputStream,charset); }
Example 30
From project arquillian-graphene, under directory /graphene-selenium/graphene-selenium-impl/src/main/java/org/jboss/arquillian/ajocado/waiting/selenium/.
Source file: DefaultSeleniumWaiting.java

/** * Waits until Retrieve's implementation doesn't retrieve value other than oldValue and this new value returns. * @param < T > type of value what we are waiting for change * @param oldValue value that we are waiting for change * @param retriever implementation of retrieving actual value * @return new retrieved value */ public <T>T waitForChangeAndReturn(final T oldValue,final SeleniumRetriever<T> retriever){ final Vector<T> vector=new Vector<T>(1); this.until(new SeleniumCondition(){ @Override public boolean isTrue(){ vector.add(0,retriever.retrieve()); if (oldValue == null) { return vector.get(0) != null; } return !oldValue.equals(vector.get(0)); } } ); return vector.get(0); }
Example 31
From project autopsy, under directory /thirdparty/pasco2/src/isi/pasco2/poller/.
Source file: DifferenceHandler.java

public void endDocument(){ if (!initialized) { initialized=true; } else { Collection<Record> deletedRecords=CollectionUtils.subtract(currentUrlRecords,newUrlRecords); Collection<Record> newRecords=CollectionUtils.subtract(newUrlRecords,currentUrlRecords); if (deletedRecords.size() > 0 || newRecords.size() > 0) { StringWriter outWriter=new StringWriter(); outWriter.write(name + "\r\n"); for ( Record rec : newRecords) { Calendar c=Calendar.getInstance(); outWriter.write("New record: (" + xsdDateFormat.format(c.getTime()) + rec.toString()+ "\r\n"); } for ( Record rec : deletedRecords) { outWriter.write("Deleted record: " + rec.toString() + "\r\n"); } System.out.println(outWriter.toString()); } currentUrlRecords=newUrlRecords; newUrlRecords=new Vector<Record>(); } }
Example 32
From project azkaban, under directory /azkaban-common/src/java/azkaban/common/utils/.
Source file: Utils.java

/** * Read in content of a file and get the last *lineCount* lines. It is equivalent to *tail* command * @param filename * @param lineCount * @param chunkSize * @return */ public static Vector<String> tail(String filename,int lineCount,int chunkSize){ try { RandomAccessFile file=new RandomAccessFile(filename,"r"); Vector<String> lastNLines=new Vector<String>(); long currPos=file.length() - 1; long startPos; byte[] byteArray=new byte[chunkSize]; while (true) { startPos=currPos - chunkSize; if (startPos <= 0) { file.seek(0); file.read(byteArray,0,(int)currPos); parseLinesFromLast(byteArray,0,(int)currPos,lineCount,lastNLines); break; } else { file.seek(startPos); if (byteArray == null) byteArray=new byte[chunkSize]; file.readFully(byteArray); if (parseLinesFromLast(byteArray,lineCount,lastNLines)) { break; } currPos=startPos; } } for (int index=lineCount; index < lastNLines.size(); index++) lastNLines.removeElementAt(index); Collections.reverse(lastNLines); return lastNLines; } catch ( Exception e) { return null; } }
Example 33
From project beam-third-party, under directory /beam-meris-veg/src/main/java/org/esa/beam/processor/baer/ui/.
Source file: BaerUi.java

/** * Retrieves the requests currently edited. */ public Vector<Request> getRequests() throws ProcessorException { Request request=new Request(); request.setType(BaerConstants.REQUEST_TYPE); request.setFile(_requestFile); getInputProduct(request); getOutputProduct(request); getParameter(request); Vector<Request> vRet=new Vector<Request>(); vRet.add(request); return vRet; }
Example 34
From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/filter/.
Source file: FilterNotifier.java

/** * DOCUMENT ME! */ public synchronized void fireFilterChange(){ final FilterEvent event=new FilterEvent(owner); final Vector<FilterListener> fls=new Vector<FilterListener>(filterListeners); final Iterator<FilterListener> it=fls.iterator(); while (it.hasNext()) { final FilterListener fl=it.next(); if (LOG.isDebugEnabled()) { LOG.debug("firing to: " + fl); } fl.filterChange(event); } }
Example 35
From project behemoth, under directory /io/src/main/java/com/digitalpebble/behemoth/io/warc/.
Source file: WarcHTMLResponseRecord.java

private HashSet<String> getMatchesOutputSet(Vector<String> tagSet,String baseURL){ HashSet<String> retSet=new HashSet<String>(); Iterator<String> vIter=tagSet.iterator(); while (vIter.hasNext()) { String thisCheckPiece=vIter.next(); Iterator<Pattern> pIter=patternSet.iterator(); boolean hasAdded=false; while (!hasAdded && pIter.hasNext()) { Pattern thisPattern=pIter.next(); Matcher matcher=thisPattern.matcher(thisCheckPiece); if (matcher.find() && (matcher.groupCount() > 0)) { String thisMatch=getNormalizedContentURL(baseURL,matcher.group(1)); if (HTTP_START_PATTERN.matcher(thisMatch).matches()) { if (!retSet.contains(thisMatch) && !baseURL.equals(thisMatch)) { retSet.add(thisMatch); hasAdded=true; } } } matcher.reset(); } } return retSet; }
Example 36
From project Binaural-Beats, under directory /src/com/ihunda/android/binauralbeat/.
Source file: BBeat.java

void initSounds(){ if (mSoundPool != null) { mSoundPool.release(); mSoundPool=null; } mSoundPool=new SoundPool(MAX_STREAMS,AudioManager.STREAM_MUSIC,0); soundWhiteNoise=mSoundPool.load(this,R.raw.whitenoise,1); soundUnity=mSoundPool.load(this,R.raw.unity,1); playingStreams=new Vector<StreamVoice>(MAX_STREAMS); playingBackground=-1; }
Example 37
From project Bio-PEPA, under directory /uk.ac.ed.inf.biopepa.core/src/uk/ac/ed/inf/biopepa/core/analysis/.
Source file: IntegerMatrix.java

/** * Constructor */ public IntegerMatrix(int rows,int cols){ numRows=rows; numCols=cols; matrix=new Vector<int[]>(rows); for (int i=0; i < numRows; i++) { matrix.add(new int[cols]); } }
Example 38
From project blueprint-namespaces, under directory /blueprint/blueprint-annotation-impl/src/main/java/org/apache/aries/blueprint/jaxb/.
Source file: Tbean.java

/** * Gets the value of the argumentOrPropertyOrAny property. <p> This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for the argumentOrPropertyOrAny property. <p> For example, to add a new item, do as follows: <pre> getArgumentOrPropertyOrAny().add(newItem); </pre> <p> Objects of the following type(s) are allowed in the list {@link Object }{@link JAXBElement }{@code <}{@link Tproperty }{@code >}{@link JAXBElement }{@code <}{@link Targument }{@code >} */ public List<Object> getArgumentOrPropertyOrAny(){ if (argumentOrPropertyOrAny == null) { argumentOrPropertyOrAny=new Vector<Object>(); } return this.argumentOrPropertyOrAny; }
Example 39
From project BMach, under directory /src/jsyntaxpane/actions/gui/.
Source file: ComboCompletionDialog.java

private void refilterList(){ String prefix=jTxtItem.getText(); Vector<String> filtered=new Vector<String>(); Object selected=jLstItems.getSelectedValue(); for ( String s : items) { if (StringUtils.camelCaseMatch(s,prefix)) { filtered.add(s); } } jLstItems.setListData(filtered); if (selected != null && filtered.contains(selected)) { jLstItems.setSelectedValue(selected,true); } else { jLstItems.setSelectedIndex(0); } }
Example 40
/** * Calculate coefficient of variation of last n results * @param anisotropyHistory list of anisotropy results, one result per iteration * @return coefficient of variation, which is standard deviation / mean. */ private double getVariance(Vector<Double> anisotropyHistory,final int n){ ListIterator<Double> iter=anisotropyHistory.listIterator(anisotropyHistory.size()); double sum=0; double sumSquares=0; int count=0; while (iter.hasPrevious()) { final double value=iter.previous(); sum+=value; count++; if (count >= n) break; } final double mean=sum / n; ListIterator<Double> itr=anisotropyHistory.listIterator(anisotropyHistory.size()); count=0; while (itr.hasPrevious()) { final double value=itr.previous(); final double a=value - mean; sumSquares+=a * a; count++; if (count >= n) break; } double stDev=Math.sqrt(sumSquares / n); double coeffVariation=stDev / mean; return coeffVariation; }
Example 41
From project bundlemaker, under directory /main/org.bundlemaker.core.ui/src/org/bundlemaker/core/ui/handler/exporter/.
Source file: ConfigurationStore.java

public void remember(String filename){ Vector<String> filenames=createVector(getHistory()); if (filenames.contains(filename)) { filenames.remove(filename); } filenames.add(0,filename); while (filenames.size() > HISTORY_LENGTH) { filenames.remove(HISTORY_LENGTH); } String[] arr=filenames.toArray(new String[filenames.size()]); IDialogSettings section=getSettingsSection(); section.put(getListTag(),arr); section.put(getPreviousTag(),filename); }
Example 42
From project byteman, under directory /agent/src/main/java/org/jboss/byteman/agent/adapter/.
Source file: ExitCheckAdapter.java

ExitCheckMethodAdapter(MethodVisitor mv,TransformContext transformContext,int access,String name,String descriptor,String signature,String[] exceptions){ super(mv,transformContext,access,name,descriptor); this.access=access; this.name=name; this.descriptor=descriptor; this.signature=signature; this.exceptions=exceptions; startLabels=new Vector<Label>(); endLabels=new Vector<Label>(); }
Example 43
From project caseconductor-platform, under directory /utest-domain-model/src/main/java/com/utest/domain/util/.
Source file: DomainUtil.java

/** * Filter child data by corresponding parent * @param allData_ * @return */ public static ConcurrentMap<String,Vector<CodeValueEntity>> filterDataByParent(final Collection<ParentDependable> allData_){ final ConcurrentMap<String,Vector<CodeValueEntity>> filteredData=new ConcurrentHashMap<String,Vector<CodeValueEntity>>(); for ( final ParentDependable child : allData_) { final String parentId=child.getParentId() + ""; Vector<CodeValueEntity> parentData=filteredData.get(parentId); if (parentData == null) { parentData=new Vector<CodeValueEntity>(); filteredData.put(parentId,parentData); } parentData.add(DomainUtil.convertToCodeValue(child)); } return filteredData; }
Example 44
From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/common/.
Source file: MessageContainer.java

public void addMessage(String message){ if (message.length() == 0) { return; } if (!receiverMap.containsKey(message)) { receiverMap.put(message,new Vector<BroadcastScript>()); this.addMessageToAdapter(message); } }
Example 45
From project ceres, under directory /ceres-jai/src/main/java/com/bc/ceres/jai/opimage/.
Source file: ExpressionCodeGenerator.java

public static ExpressionCode generate(String packageName,String className,Map<String,RenderedImage> sourceMap,int dataType,String expression){ MyNameMapper mapper=new MyNameMapper(sourceMap); CodeMapper.CodeMapping codeMapping=CodeMapper.mapCode(expression,mapper); StringBuilder codeBuilder=new StringBuilder(); codeBuilder.append(MessageFormat.format(HEAD_COMMENT,ExpressionCodeGenerator.class.getName())); codeBuilder.append(MessageFormat.format(HEAD_PART,packageName,className)); Vector<RenderedImage> sources=mapper.sources; for (int i=0; i < sources.size(); i++) { String typeName=getTypeName(sources,i); codeBuilder.append(MessageFormat.format(SRC_DEF_PART,String.valueOf(i),typeName,getCamelCase(typeName))); } String dstTypeName=getTypeName(dataType); codeBuilder.append(MessageFormat.format(DST_DEF_PART,String.valueOf(sources.size()),dstTypeName,getCamelCase(dstTypeName))); codeBuilder.append(Y_LOOP_PART); for (int i=0; i < sources.size(); i++) { codeBuilder.append(MessageFormat.format(SRC_OFFS_PART,String.valueOf(i))); } codeBuilder.append(X_LOOP_PART); for (int i=0; i < sources.size(); i++) { String typeName=getTypeName(sources,i); codeBuilder.append(MessageFormat.format(EXPR_VAR_PART,String.valueOf(i),typeName)); } codeBuilder.append(MessageFormat.format(EXPR_PART,dstTypeName,codeMapping.getMappedCode())); for (int i=0; i < sources.size(); i++) { codeBuilder.append(MessageFormat.format(SRC_PIXEL_INC_PART,String.valueOf(i))); } codeBuilder.append(FINAL_PART); return new ExpressionCode(packageName + "." + className,codeBuilder.toString(),sources); }
Example 46
From project ChkBugReport, under directory /src/com/sonyericsson/chkbugreport/doc/.
Source file: DocNode.java

public DocNode add(DocNode child){ if (mChildren == null) { mChildren=new Vector<DocNode>(); } mChildren.add(child); child.mParent=this; return this; }