當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector.elementAt方法代碼示例

本文整理匯總了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;
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:22,代碼來源:Whitespace.java

示例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));
        }
    }
}
 
開發者ID:addertheblack,項目名稱:myster,代碼行數:25,代碼來源:FileInfoListerThread.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:XSDHandler.java

示例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;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:Obj.java

示例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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:27,代碼來源:SnmpIndex.java

示例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;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:23,代碼來源:PCMtoPCMCodec.java

示例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 );
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:IDLGenerator.java

示例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++;
    }
}
 
開發者ID:openaudible,項目名稱:openaudible,代碼行數:15,代碼來源:TreePath.java

示例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);
}
 
開發者ID:arodchen,項目名稱:MaxSim,代碼行數:8,代碼來源:WinGammaPlatform.java

示例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));
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:14,代碼來源:ChannelSftp.java

示例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());
        }
    }
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:39,代碼來源:DatabaseManager.java

示例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);
            }
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:XSDHandler.java

示例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;
}
 
開發者ID:addertheblack,項目名稱:myster,代碼行數:12,代碼來源:MultiSourceHashSearch.java

示例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);
    }
 
開發者ID:RJMillerLab,項目名稱:ibench,代碼行數:55,代碼來源:Hom.java

示例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;
    }
}
 
開發者ID:souhaib100,項目名稱:MARF-for-Android,代碼行數:54,代碼來源:TransitionTable.java


注:本文中的java.util.Vector.elementAt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。