Example usage for java.util Vector elementAt

List of usage examples for java.util Vector elementAt

Introduction

In this page you can find the example usage for java.util Vector elementAt.

Prototype

public synchronized E elementAt(int index) 

Source Link

Document

Returns the component at the specified index.

Usage

From source file:org.apache.axis.wsdl.toJava.JavaGeneratorFactory.java

/**
 * Method constructSignatures// ww  w .  jav  a2  s  .  co m
 *
 * @param symbolTable
 */
protected void constructSignatures(SymbolTable symbolTable) {

    Iterator it = symbolTable.getHashMap().values().iterator();

    while (it.hasNext()) {
        Vector v = (Vector) it.next();

        for (int i = 0; i < v.size(); ++i) {
            SymTabEntry entry = (SymTabEntry) v.elementAt(i);

            if (entry instanceof BindingEntry) {
                BindingEntry bEntry = (BindingEntry) entry;
                Binding binding = bEntry.getBinding();
                PortType portType = binding.getPortType();
                Iterator operations = portType.getOperations().iterator();

                while (operations.hasNext()) {
                    Operation operation = (Operation) operations.next();
                    String wsdlOpName = operation.getName();
                    OperationType type = operation.getStyle();

                    String javaOpName = getOperationJavaNameHook(bEntry, wsdlOpName); // for derived class
                    if (javaOpName == null) {
                        javaOpName = operation.getName();
                    }

                    Parameters parameters = bEntry.getParameters(operation);

                    if (OperationType.SOLICIT_RESPONSE.equals(type)) {
                        parameters.signature = "    // " + Messages.getMessage("invalidSolResp00", javaOpName);

                        System.err.println(Messages.getMessage("invalidSolResp00", javaOpName));
                    } else if (OperationType.NOTIFICATION.equals(type)) {
                        parameters.signature = "    // " + Messages.getMessage("invalidNotif00", javaOpName);

                        System.err.println(Messages.getMessage("invalidNotif00", javaOpName));
                    } else { // ONE_WAY or REQUEST_RESPONSE
                        if (parameters != null) {
                            String returnType = getReturnTypeJavaNameHook(bEntry, wsdlOpName);
                            if (returnType != null) {
                                if (parameters.returnParam != null) { // 'void' return type???
                                    parameters.returnParam.getType().setName(returnType);
                                }
                            }
                            for (int j = 0; j < parameters.list.size(); ++j) {
                                Parameter p = (Parameter) parameters.list.get(j);
                                String paramType = getParameterTypeJavaNameHook(bEntry, wsdlOpName, j);
                                if (paramType != null) {
                                    p.getType().setName(paramType);
                                }
                            }
                            parameters.signature = constructSignature(parameters, javaOpName);
                        }
                    }
                }
            }
        }
    }
}

From source file:org.jopac2.jbal.iso2709.Unimarc.java

private void addSubject(Vector<SubjectInterface> r, String tag, SubjectInterface subject) {

    Vector<Tag> v = getTags(tag);
    for (int i = 0; v != null && i < v.size(); i++) {
        SubjectInterface sub = subject.clone();
        sub.setData(v.elementAt(i));
        r.addElement(sub);/*  ww  w  . j a  va  2  s. co m*/
    }

}

From source file:presentation.webgui.vitroappservlet.StyleCreator.java

public static JFreeChart createDatasetAndChart(Model3dStylesEntry givStyleEntry) {

    Vector<String> tmpCategLabels = new Vector<String>();
    Vector<String> tmpCategColors = new Vector<String>();

    tmpCategLabels.addElement("Default");
    tmpCategColors.addElement(givStyleEntry.getGlobalColor());

    for (int i = 0; i < givStyleEntry.getSpecialCasesVec().size(); i++) {
        String tmpLabel = givStyleEntry.getSpecialCasesVec().elementAt(i).getSpecialValue();
        tmpCategLabels.addElement(tmpLabel);
        if (givStyleEntry.getSpecialCasesVec().elementAt(i).getColor1()
                .equals(Model3dStyleSpecialCase.UNDEFINEDCOLOR1)) {
            tmpCategColors.addElement(givStyleEntry.getGlobalColor()); // get the global default set
        } else//from ww w  .j a  v a2  s  .  c o m
            tmpCategColors.addElement(givStyleEntry.getSpecialCasesVec().elementAt(i).getColor1());
    }

    for (int i = 0; i < givStyleEntry.getNumericCasesVec().size(); i++) {
        String tmpLabel = "";
        if (givStyleEntry.getNumericCasesVec().elementAt(i).getFromValue().equals("")) {
            tmpLabel = "(-inf, ";
        } else
            tmpLabel = "[" + givStyleEntry.getNumericCasesVec().elementAt(i).getFromValue() + ", ";

        if (givStyleEntry.getNumericCasesVec().elementAt(i).getToValue().equals("")) {
            tmpLabel += "+inf)";
        } else
            tmpLabel += givStyleEntry.getNumericCasesVec().elementAt(i).getToValue() + ")";

        tmpCategLabels.addElement(tmpLabel);

        if (givStyleEntry.getNumericCasesVec().elementAt(i).getColor1()
                .equals(Model3dStyleNumericCase.UNDEFINEDCOLOR1)) {
            tmpCategColors.addElement(givStyleEntry.getGlobalColor()); // get the global default set
        } else
            tmpCategColors.addElement(givStyleEntry.getNumericCasesVec().elementAt(i).getColor1());
    }

    int sizeOfDataColumn = 15; //indicates the "length" of the bars in a per cent scale.
    double[][] data = { { sizeOfDataColumn } };
    String[] myCategories = { "error" };
    if (tmpCategLabels.size() > 0) {
        data = new double[1][tmpCategLabels.size()];
        myCategories = new String[tmpCategLabels.size()];
        for (int i = 0; i < tmpCategLabels.size(); i++) {
            data[0][i] = sizeOfDataColumn;
            myCategories[i] = tmpCategLabels.elementAt(i);
        }
    }
    final String[] mySeries = { "" };

    CategoryDataset dataset = DatasetUtilities.createCategoryDataset(mySeries, myCategories, data);

    JFreeChart chart = createChart(dataset, tmpCategColors, givStyleEntry);
    return chart;
}

From source file:org.apache.jetspeed.modules.actions.portlets.PsmlManagerAction.java

/**
 * Creates profile locator from a given path in the format:
 *
 *   user/<name>/<mediaType>/<language>/<country>/<page>/
 *
 *   group/ ""/*from  w  ww  .ja  v  a2  s . c  om*/
 *   role/  ""
 *
 * @param path The formatted profiler path string.
 * @param path   fully qualified .psml file name
 * @return profile locator
 */
private ProfileLocator mapFileToLocator(String path) throws Exception {
    if (logger.isDebugEnabled()) {
        logger.debug("PsmlUpdateAction.createFromPath: processing path = " + path);
    }
    ProfileLocator result = Profiler.createLocator();

    // Tokenize the file path into elements
    StringTokenizer tok = new StringTokenizer(path, File.separator);

    // Load path elements into a vector for random access
    Vector tokens = new Vector();
    while (tok.hasMoreTokens()) {
        tokens.add(tok.nextToken());
    }

    // Assume that 1st element is the profile type (user|role|group) and 2nd is the name
    if (tokens.size() > 1) {
        String type = (String) tokens.elementAt(0);
        String name = (String) tokens.elementAt(1);
        if (type.equals(Profiler.PARAM_USER)) {
            result.setUser(JetspeedSecurity.getUser(name));
        } else if (type.equals(Profiler.PARAM_GROUP)) {
            result.setGroup(JetspeedSecurity.getGroup(name));
        } else if (type.equals(Profiler.PARAM_ROLE)) {
            result.setRole(JetspeedSecurity.getRole(name));
        }
    }

    // Assume that the last element is the page name
    if (tokens.size() > 0) {
        result.setName((String) tokens.lastElement());
    }

    // Based on the number of path elements set the other profile attributes
    switch (tokens.size()) {
    case 3: // user|role|group/name/page.psml
        break;
    case 4: // user|role|group/name/media-type/page.psml
        result.setMediaType((String) tokens.elementAt(2));
        break;
    case 5: // user|role|group/name/media-type/language/page.psml
        result.setMediaType((String) tokens.elementAt(2));
        result.setLanguage((String) tokens.elementAt(3));
        break;
    case 6: // user|role|group/name/media-type/language/country/page.psml
        result.setMediaType((String) tokens.elementAt(2));
        result.setLanguage((String) tokens.elementAt(3));
        result.setCountry((String) tokens.elementAt(4));
        break;
    default:
        throw new Exception(
                "Path must contain 3 to 6 elements: [" + path + "], and the size was: " + tokens.size());
    }

    return result;
}

From source file:org.jopac2.jbal.iso2709.Unimarc.java

public Vector<String> getAuthors() {
    Vector<Tag> v = getTags("700");
    v.addAll(getTags("701"));
    v.addAll(getTags("702"));
    Vector<String> r = new Vector<String>();
    String k = "";
    if (v.size() > 0) {
        for (int i = 0; i < v.size(); i++) {
            k = "";
            k += Utils.ifExists("", v.elementAt(i).getField("a"));
            //k=v.elementAt(i).getField("a").getContent();
            k += Utils.ifExists(" ", v.elementAt(i).getField("b"));
            //k+=" "+v.elementAt(i).getField("b").getContent();
            if (!r.contains(k))
                r.addElement(k);/*from   w ww  . ja v a 2s  .c  om*/
        }
    }
    return r;
}

From source file:mypackage.State_Stream.java

private void addRowToRichList(Vector entries, int start_index) {
    // Gg?[?0??_CA?O?o^?[
    if (entries.size() == 0) {
        UiApplication.getUiApplication().invokeLater(new Runnable() {
            public void run() {
                Dialog.alert("No entries found.");
            }//from   w ww.  j ava 2s .  c om
        });
        return;
    }

    for (int i = 0; i < entries.size(); i++) {
        Entry _entry = (Entry) entries.elementAt(i);
        String title = _entry.getTitle();
        String origin_title = _entry.getOriginTitle();
        String published = _entry.getPublished();

        synchronized (UiApplication.getEventLock()) {
            _screen.addRowToRichList(i + start_index, title, origin_title, published);
        }
    }
}

From source file:org.jopac2.jbal.iso2709.Unimarc.java

public Vector<RecordInterface> getLinked(String tag) throws JOpac2Exception {
    Vector<Tag> v = getTags(tag);
    Vector<RecordInterface> r = new Vector<RecordInterface>();

    try {//from  ww w . ja v a2 s.  com
        if (v.size() > 0) { // se il vettore ha elementi, allora faro' almeno una query
            for (int i = 0; i < v.size(); i++) {
                RecordInterface not = RecordFactory.buildRecord("0", v.elementAt(i).toString().getBytes(),
                        this.getTipo(), this.getLivello());
                //ISO2709 not=ISO2709.creaNotizia(0,(String)v.elementAt(i),this.getTipo(),this.getLivello());
                if (tag.equals("410")) {
                    not.removeTags("410");
                    not.setBiblioLevel(Unimarc.LEVEL_COLLECTION);
                    Vector<Tag> d = not.getTags("200");
                    for (int j = 0; d != null && j < d.size(); j++) {
                        d.elementAt(j).removeField("v"); // l'indicazione del volume non deve essere nel record di collana
                    }
                }
                r.addElement(not);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    return r;
}

From source file:org.adl.samplerte.server.CourseService.java

/**
 * This method deletes courses.//w w w  .  j  ava  2s .c o  m
 * @param iCourses  List of courses selected to be deleted
 * @return String representation of the success of the deletion (true or false)
 */
public String deleteCourse(Vector iCourses) {
    String result = "true";
    String courseID = "";
    Connection conn;
    PreparedStatement stmtUpdateCourse;
    String sqlUpdateCourse = "UPDATE CourseInfo set Active = no where CourseID = ?";

    try {
        conn = LMSDatabaseHandler.getConnection();

        stmtUpdateCourse = conn.prepareStatement(sqlUpdateCourse);
        for (int i = 0; i < iCourses.size(); i++) {
            courseID = (String) iCourses.elementAt(i);
            if (courseID.startsWith("RE_") || (courseID.startsWith("UN_"))) {
                courseID = courseID.substring(3, courseID.length());
                synchronized (stmtUpdateCourse) {
                    stmtUpdateCourse.setString(1, courseID);
                    stmtUpdateCourse.executeUpdate();
                }
            }
        }
        stmtUpdateCourse.close();
        conn.close();

    } catch (Exception e) {
        result = "false";
        e.printStackTrace();
    }

    return result;
}

From source file:org.jopac2.jbal.iso2709.Unimarc.java

public Vector<ClassificationInterface> getClassifications() {
    Vector<ClassificationInterface> r = new Vector<ClassificationInterface>();
    Vector<Tag> t = getTags("676");
    for (int i = 0; t != null && i < t.size(); i++) {
        /**/* ww w .j  a v  a2  s. c  o m*/
         *       $a Number (not repeatable)
         *      $c Description // dedotto da sebina
         *       $v Edition (not repeatable)
         *       $z Language of edition (not repeatable)
         */
        Field num = t.elementAt(i).getField("a");
        Field desc = t.elementAt(i).getField("c");
        Field ed = t.elementAt(i).getField("v");
        Field lan = t.elementAt(i).getField("z");

        if (num != null) {
            r.addElement(new DDC(num != null ? num.getContent() : null, desc != null ? desc.getContent() : null,
                    ed != null ? ed.getContent() : null, lan != null ? lan.getContent() : null));
        }
    }
    return r;
}

From source file:org.apache.cocoon.components.source.impl.WebDAVSource.java

/**
 * Returns a enumeration of the properties
 *
 * @return Enumeration of SourceProperty
 *
 * @throws SourceException If an exception occurs.
 *//*from  www.  j av a 2 s .  c  o m*/
public SourceProperty[] getSourceProperties() throws SourceException {

    initResource(WebdavResource.NOACTION, DepthSupport.DEPTH_0);

    Vector sourceproperties = new Vector();
    Enumeration props = null;
    org.apache.webdav.lib.Property prop = null;

    try {
        Enumeration responses = this.resource.propfindMethod(0);
        while (responses.hasMoreElements()) {

            ResponseEntity response = (ResponseEntity) responses.nextElement();
            props = response.getProperties();
            while (props.hasMoreElements()) {
                prop = (Property) props.nextElement();
                SourceProperty srcProperty = new SourceProperty(prop.getElement());
                sourceproperties.addElement(srcProperty);
            }
        }

    } catch (Exception e) {
        throw new SourceException("Error getting properties", e);
    }
    SourceProperty[] sourcepropertiesArray = new SourceProperty[sourceproperties.size()];
    for (int i = 0; i < sourceproperties.size(); i++) {
        sourcepropertiesArray[i] = (SourceProperty) sourceproperties.elementAt(i);
    }
    return sourcepropertiesArray;
}