本文整理汇总了Java中java.util.Vector.elementAt方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.elementAt方法的具体用法?Java Vector.elementAt怎么用?Java Vector.elementAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Vector
的用法示例。
在下文中一共展示了Vector.elementAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: partition
import java.util.Vector; //导入方法依赖的package包/类
/**
* Used with quicksort method above
*/
private static int partition(Vector rules, int p, int r) {
final WhitespaceRule x = (WhitespaceRule)rules.elementAt((p+r) >>> 1);
int i = p - 1, j = r + 1;
while (true) {
while (x.compareTo((WhitespaceRule)rules.elementAt(--j)) < 0) {
}
while (x.compareTo((WhitespaceRule)rules.elementAt(++i)) > 0) {
}
if (i < j) {
final WhitespaceRule tmp = (WhitespaceRule)rules.elementAt(i);
rules.setElementAt(rules.elementAt(j), i);
rules.setElementAt(tmp, j);
}
else {
return j;
}
}
}
示例2: listDir
import java.util.Vector; //导入方法依赖的package包/类
private void listDir(RobustMML mml, KeyValue keyValue, String directory,
String prefix) {
Vector dirList = mml.list(directory);
if (dirList == null)
return;
for (int i = 0; i < dirList.size(); i++) {
String name = (String) dirList.elementAt(i);
if (name == null)
return;
String newPath = directory + name;
if (mml.isADirectory(newPath + "/")) {
keyValue.addValue(name, " ->");
listDir(mml, keyValue, newPath + "/", prefix + " ");
} else {
keyValue.addValue(prefix + ((String) dirList.elementAt(i)), mml
.get(newPath));
}
}
}
示例3: expandComponents
import java.util.Vector; //导入方法依赖的package包/类
private Vector expandComponents(XSObject[] components, Map<String, Vector> dependencies) {
Vector newComponents = new Vector();
for (int i=0; i<components.length; i++) {
if (!newComponents.contains(components[i])) {
newComponents.add(components[i]);
}
}
for (int i=0; i<newComponents.size(); i++) {
final XSObject component = (XSObject) newComponents.elementAt(i);
expandRelatedComponents(component, newComponents, dependencies);
}
return newComponents;
}
示例4: getCodebases
import java.util.Vector; //导入方法依赖的package包/类
/**
* Each value in javaCodebase contains a list of space-separated
* URLs. Each value is independent; we can pick any of the values
* so we just use the first one.
* @return an array of URL strings for the codebase
*/
private static String[] getCodebases(Attribute codebaseAttr) throws
NamingException {
if (codebaseAttr == null) {
return null;
} else {
StringTokenizer parser =
new StringTokenizer((String)codebaseAttr.get());
Vector<String> vec = new Vector<>(10);
while (parser.hasMoreTokens()) {
vec.addElement(parser.nextToken());
}
String[] answer = new String[vec.size()];
for (int i = 0; i < answer.length; i++) {
answer[i] = vec.elementAt(i);
}
return answer;
}
}
示例5: equals
import java.util.Vector; //导入方法依赖的package包/类
/**
* Compares two indexes for equality.
*
* @param index The index to compare <CODE>this</CODE> with.
*
* @return <CODE>true</CODE> if the two indexes are equal, <CODE>false</CODE> otherwise.
*/
public boolean equals(SnmpIndex index) {
if (size != index.getNbComponents())
return false;
// The two vectors have the same length.
// Compare each single element ...
//
SnmpOid oid1;
SnmpOid oid2;
Vector<SnmpOid> components= index.getComponents();
for(int i=0; i <size; i++) {
oid1= oids.elementAt(i);
oid2= components.elementAt(i);
if (oid1.equals(oid2) == false)
return false;
}
return true;
}
示例6: getTargetFormats
import java.util.Vector; //导入方法依赖的package包/类
/**
*/
public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
// filter out targetEncoding from the old getOutputFormats( sourceFormat ) method
AudioFormat[] formats = getOutputFormats( sourceFormat );
Vector newFormats = new Vector();
for(int i=0; i<formats.length; i++ ) {
if( formats[i].getEncoding().equals( targetEncoding ) ) {
newFormats.addElement( formats[i] );
}
}
AudioFormat[] formatArray = new AudioFormat[newFormats.size()];
for (int i = 0; i < formatArray.length; i++) {
formatArray[i] = (AudioFormat)(newFormats.elementAt(i));
}
return formatArray;
}
示例7: getMethodReferences
import java.util.Vector; //导入方法依赖的package包/类
/**
* Collect and filter type and array references from methods
* @param mthVec Given Vector of methods
* @param refHash Hashtable for type references
* @param spcHash Hashtable for special type references
* @param arrHash Hashtable for array references
* @param excHash Hashtable for exceptions thrown
*/
protected void getMethodReferences(
Vector mthVec,
Hashtable refHash,
Hashtable spcHash,
Hashtable arrHash,
Hashtable excHash ) {
for ( int i1 = 0; i1 < mthVec.size(); i1++ ) { //forall methods
CompoundType.Method mth = (CompoundType.Method)mthVec.elementAt( i1 );
Type[] args = mth.getArguments();
Type ret = mth.getReturnType();
getExceptions( mth,excHash ); //collect exceptions thrown
for ( int i2 = 0; i2 < args.length; i2++ ) //forall arguments
addReference( args[i2],refHash,spcHash,arrHash );
addReference( ret,refHash,spcHash,arrHash );
}
}
示例8: readObject
import java.util.Vector; //导入方法依赖的package包/类
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject();
Vector values = (Vector) s.readObject();
int indexCounter = 0;
int maxCounter = values.size();
if (indexCounter < maxCounter && values.elementAt(indexCounter).
equals("lastPathComponent")) {
lastPathComponent = values.elementAt(++indexCounter);
indexCounter++;
}
}
示例9: tagV
import java.util.Vector; //导入方法依赖的package包/类
void tagV(String name, Vector attrs) {
String s[] = new String[attrs.size()];
for (int i = 0; i < attrs.size(); i++) {
s[i] = (String) attrs.elementAt(i);
}
startTagPrim(name, s, true);
}
示例10: isUnique
import java.util.Vector; //导入方法依赖的package包/类
/**
* This method will check if the given string can be expanded to the
* unique string. If it can be expanded to mutiple files, SftpException
* will be thrown.
* @return the returned string is unquoted.
*/
private String isUnique(String path) throws SftpException, Exception{
Vector v=glob_remote(path);
if(v.size()!=1){
throw new SftpException(SSH_FX_FAILURE, path+" is not unique: "+v.toString());
}
return (String)(v.elementAt(0));
}
示例11: saveAsCsv
import java.util.Vector; //导入方法依赖的package包/类
void saveAsCsv(String filename) {
try {
File file = new File(filename);
CSVWriter writer = new CSVWriter(file, null);
String[] col = gResult.getHead();
int width = col.length;
Vector data = gResult.getData();
String[] row;
int height = data.size();
writer.writeHeader(col);
for (int i = 0; i < height; i++) {
row = (String[]) data.elementAt(i);
String[] myRow = new String[row.length];
for (int j = 0; j < row.length; j++) {
String r = row[j];
if (r.equals("(null)")) {
// null is formatted as (null)
r = "";
}
myRow[j] = r;
}
writer.writeData(myRow);
}
writer.close();
} catch (IOException e) {
throw new RuntimeException("IOError: " + e.getMessage());
}
}
示例12: updateImportListFor
import java.util.Vector; //导入方法依赖的package包/类
/**
* Namespace growth
*
* Go through the import list of a given grammar and for each imported
* grammar, check to see if the grammar bucket has a newer version.
* If a new instance is found, we update the import list with the
* newer version.
*/
private void updateImportListFor(SchemaGrammar grammar) {
Vector importedGrammars = grammar.getImportedGrammars();
if (importedGrammars != null) {
for (int i=0; i<importedGrammars.size(); i++) {
SchemaGrammar isg1 = (SchemaGrammar) importedGrammars.elementAt(i);
SchemaGrammar isg2 = fGrammarBucket.getGrammar(isg1.getTargetNamespace());
if (isg2 != null && isg1 != isg2) {
importedGrammars.set(i, isg2);
}
}
}
}
示例13: getSearchEntries
import java.util.Vector; //导入方法依赖的package包/类
private synchronized static SearchEntry[] getSearchEntries(MysterType type) {
Vector entriesVector = getEntriesForType(type);
SearchEntry[] entries = new SearchEntry[entriesVector.size()];
for (int i = 0; i < entries.length; i++) {
entries[i] = (SearchEntry) entriesVector.elementAt(i);
}
return entries;
}
示例14: tryToMap
import java.util.Vector; //导入方法依赖的package包/类
private static void tryToMap(int pos, int[] srcArr, int[] trgArr, FromClauseList fromCl, FromClauseList toCl,
Vector foundHoms)
{
// if we reached the end of the src Arr it means that we have checked
// them all so test if we have mapped something or not. If yes, then we
// report it
if (pos == srcArr.length)
{
Hom hom = new Hom();
// for (int i = 0, imax = srcArr.length; i < imax; i++)
// if (srcArr[i] != -1)
// hom.addMap(fromCl.getRelationName(i), toCl.getRelationName(srcArr[i]));
if (hom.size() != 0)
{
// we are about to insert it but before we do, let's make sure
// that there is no other one already computed that includes it.
boolean isIncludedInAnother = false;
for (int ii = 0, iimax = foundHoms.size(); ii < iimax; ii++)
{
Hom tmpHom = (Hom) foundHoms.elementAt(ii);
if (tmpHom.includes(hom))
{
isIncludedInAnother = true;
break;
}
}
// if none includes it insert it.
if (!isIncludedInAnother)
foundHoms.add(0, hom);
}
return;
}
// Get the relation you try to mapp
// String srcTbl = ((RelationalTableReference) fromCl.getRelation(pos)).getPath().getLabel();
// try to map it
for (int i = 0, imax = trgArr.length; i < imax; i++)
{
if (trgArr[i] != -1)
continue; // cannot map to this one
// String toTbl = ((RelationalTableReference) toCl.getRelation(i)).getPath().getLabel();
// if (!toTbl.equals(srcTbl))
// continue; // not compatible tables
// otherwise they can map
srcArr[pos] = i;
trgArr[i] = pos;
tryToMap(pos + 1, srcArr, trgArr, fromCl, toCl, foundHoms);
srcArr[pos] = -1;
trgArr[i] = -1;
}
// consider also the case where the pos table is not mapped at all.
srcArr[pos] = -1;
tryToMap(pos + 1, srcArr, trgArr, fromCl, toCl, foundHoms);
}
示例15: serialize
import java.util.Vector; //导入方法依赖的package包/类
/**
* Serialize in text mode. Loading is not implemented.
* TODO: migrate to MARF's dump/store mechanism.
*
* @param piOperation - 0 - LOAD, 1 - SAVE
* @return <code>true</code> if serialization was successful
*/
public boolean serialize(int piOperation) {
if (piOperation == 0) {
System.err.println("TransitionTable::serialize(LOAD) - Not implemented.");
return false;
} else {
// A row of terminals
int iTermNum = this.oTerminals.size();
System.out.print(" Terminals(" + iTermNum + "): \t");
for (int t = 0; t < iTermNum; t++) {
Terminal oTerminal = (Terminal) this.oTerminals.elementAt(t);
System.out.print("(" + oTerminal.getID() + ")" + oTerminal.getName() + "\t");
}
System.out.println();
// Non terminals and rules...
int iNonTemNum = this.oNonTerminals.size();
System.out.println("NonTerminals(" + iNonTemNum + "): \t");
for (int n = 0; n < iNonTemNum; n++) {
System.out.print(((NonTerminal) this.oNonTerminals.elementAt(n)).getName() + "\t");
for (int t = 0; t < iTermNum; t++) {
Vector oRow = (Vector) this.oTT.elementAt(n);
Object oEntry = oRow.elementAt(t);
if (oEntry instanceof Rule) {
Rule oRule = (Rule) oRow.elementAt(t);
System.out.print(oRule.toAbbrString() + "\t");
} else {
SyntaxError oSyntaxError = (SyntaxError) oEntry;
System.out.print("e\t");
Debug.debug(oSyntaxError.getMessage() + "\t");
}
}
System.out.println();
}
return true;
}
}