Example usage for java.util Vector size

List of usage examples for java.util Vector size

Introduction

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

Prototype

public synchronized int size() 

Source Link

Document

Returns the number of components in this vector.

Usage

From source file:com.adito.boot.CommandRunner.java

/**
 * Constructor. The first argument supplied must be the name of the command
 * (if it is on the system path) or the full path the command. Any command
 * arguments should be supplied as further elements.
 * //from   w ww .  j av  a 2 s.  c o  m
 * @param arguments
 */
public CommandRunner(Vector arguments) {
    this.arguments = new String[arguments.size()];
    arguments.copyInto(this.arguments);
}

From source file:com.ss.language.model.gibblda.Document.java

public Document(Vector<Integer> doc, String rawStr) {
    this.length = doc.size();
    storeDoc(doc);
}

From source file:eionet.gdem.qa.ListQAScriptsMethodTest.java

/**
 * Tests that the result of listQAScripts method contains the right data as defined in seed xml file.
 *//*from w w w. j a va 2s  .  c om*/
@Test
public void testListConversionsXSDResult() throws Exception {

    XQueryService qm = new XQueryService();

    Vector listQaResult = qm.listQAScripts("http://cdrtest.eionet.eu.int/xmlexports/dir9243eec/schema.xsd");
    assertTrue(listQaResult.size() == 1);
    Vector resultQuery = (Vector) listQaResult.get(0);

    assertEquals(resultQuery.get(0), String.valueOf(Constants.JOB_VALIDATION));
    assertEquals(resultQuery.get(2), "");
    assertEquals(resultQuery.get(3), String.valueOf(ListQueriesMethod.VALIDATION_UPPER_LIMIT));
}

From source file:com.ss.language.model.gibblda.Document.java

/**
 * ?//from  ww w  . j a va  2  s  . co  m
 * 
 * @param words
 */
private void storeDoc(Vector<Integer> words) {
    if (words.size() > 0) {
        docId = nextDocId();
        StringBuilder wordIds = new StringBuilder();
        Map<Integer, Integer> maps = new LinkedHashMap<Integer, Integer>();
        for (Integer wordId : words) {
            if (wordId != null) {
                wordIds.append(wordId);
                wordIds.append(",");
                Integer times = maps.get(wordId);
                if (times == null) {
                    times = 1;
                } else {
                    times += 1;
                }
                maps.put(wordId, times);
            }
        }
        LuceneDataAccess.save(DOC_PRE + docId, wordIds.substring(0, wordIds.length() - 1));
        // ???
        LDACmdOption option = LDACmdOption.curOption.get();
        File file = null;
        if (option.eachwords != null && option.eachwords.trim().length() > 0) {
            file = new File(option.dir + File.separator + option.eachwords);
            StringBuffer sb = new StringBuffer();
            for (Integer wordId : maps.keySet()) {
                sb.append(wordId);
                sb.append(":");
                sb.append(maps.get(wordId));
                sb.append(", ");
            }
            String line = sb.length() > 0 ? sb.substring(0, sb.length() - 2) : sb.toString();
            line += IOUtils.LINE_SEPARATOR;
            try {
                FileUtils.write(file, line, "UTF-8", true);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:grafix.graficos.ConstrutorGrafico.java

private XYPlot[] gerarTodosOsPlotsExtras() {
    Vector<EixoExtra> eixosExtras = janela.getConfiguracoesJanela().getEixosExtras();
    XYPlot[] plots = new XYPlot[eixosExtras.size()];
    for (int i = 0; i < plots.length; i++) {
        plots[i] = eixosExtras.get(i).getPlot(janela);
    }/*from  w ww. jav a 2 s  . c om*/
    return plots;
}

From source file:net.sf.jdmf.util.MathCalculator.java

/**
 * Calculates the centroid of all given points in a nD space (assumes that
 * all points have n coordinates). Each coordinate of the centroid is a mean
 * of all values of the same coordinate of each point.
 * //w  ww  . jav  a 2  s. c  o  m
 * @param points all points
 * @return the centroid of all given points
 */
public Vector<Double> calculateCentroid(List<Vector<Double>> points) {
    List<Mean> coordinateMeans = new ArrayList<Mean>();

    for (int i = 0; i < points.get(0).size(); ++i) {
        coordinateMeans.add(new Mean());
    }

    for (Vector<Double> point : points) {
        for (int i = 0; i < point.size(); ++i) {
            coordinateMeans.get(i).increment(point.get(i));
        }
    }

    Vector<Double> centroid = new Vector<Double>();

    for (Mean mean : coordinateMeans) {
        centroid.add(mean.getResult());
    }

    return centroid;
}

From source file:com.alfaariss.oa.profile.aselect.binding.protocol.cgi.CGIResponse.java

/**
 * Sets the supplied parameter with the supplied value.
 * Supports <code>String<code> and <code>Vector</code> objects as value.
 * The parameter names must be unique.//  www .  j  a va 2 s.  c  o m
 * @see IResponse#setParameter(java.lang.String, java.lang.Object)
 */
public void setParameter(String sName, Object oValue) throws BindingException {
    try {
        sName = URLEncoder.encode(sName, ASelectProcessor.CHARSET);

        if (_sbResponse.length() > 0)
            _sbResponse.append("&");

        if (oValue instanceof Vector) {
            StringBuffer sbEncName = new StringBuffer(sName);
            sbEncName.append(CGIBinding.ENCODED_BRACES);
            sbEncName.append("=");

            if (_sbResponse.indexOf(sbEncName.toString()) > -1) {
                _logger.error("The response already contains an array parameter with name: " + sName);
                throw new BindingException(SystemErrors.ERROR_INTERNAL);
            }

            Vector vValues = (Vector) oValue;
            for (int i = 0; i < vValues.size(); i++) {
                if (i > 0)
                    _sbResponse.append("&");
                _sbResponse.append(sbEncName.toString());
                _sbResponse.append(URLEncoder.encode((String) vValues.get(i), ASelectProcessor.CHARSET));
            }
        } else {
            if (_sbResponse.indexOf(sName + "=") > -1) {
                _logger.error("The response already contains a parameter with name: " + sName);
                throw new BindingException(SystemErrors.ERROR_INTERNAL);
            }

            _sbResponse.append(sName);
            _sbResponse.append("=");
            _sbResponse.append(URLEncoder.encode((String) oValue, ASelectProcessor.CHARSET));
        }
    } catch (BindingException e) {
        throw e;
    } catch (Exception e) {
        StringBuffer sbError = new StringBuffer("Internal error while setting parameter '");
        sbError.append(sName);
        sbError.append("' with value:");
        sbError.append(oValue);
        _logger.fatal(sbError.toString(), e);
        throw new BindingException(SystemErrors.ERROR_INTERNAL);
    }
}

From source file:com.orange.atk.graphAnalyser.GraphMarker.java

/**
* Calculate marker legend position depending of the maximum legend
*///w  w w  .j  av a  2  s .  c  o m

public void setMarkerPosition() {
    Vector<Action> listActions = Vectaction;
    for (int i = 0; i < listActions.size(); i++) {
        Action action = listActions.get(i); //remove 
        double XvalueStart = ((double) (action.getStartTime().getTime()));
        double XvalueEnd = ((double) (action.getEndTime().getTime()));

        action.setAnnotation(XvalueStart, color);
        action.setMarker(XvalueStart, XvalueEnd, color);

    }
}

From source file:com.orange.atk.graphAnalyser.GraphMarker.java

/**
 * remove marker/*from ww  w.  ja va2 s  .  c o m*/
 */
public void removeMarker() {
    Vector<Action> listActions = Vectaction;
    int size = listActions.size();

    for (int i = 0; i < size; i++) {
        Action action = listActions.get(i);
        if (action.getMarker() != null)
            xyplot.removeDomainMarker(action.getMarker());
        else
            Logger.getLogger(this.getClass())
                    .debug("Erreur ActionName:" + action.getActionName() + " Remove MsgType "
                            + action.getMsgType() + " StartTime " + action.getStartTime() + " EndTime "
                            + action.getEndTime());
        if (action.getAnnotation() != null)
            xyplot.removeAnnotation(action.getAnnotation());
        else
            Logger.getLogger(this.getClass())
                    .debug("Erreur ActionName:" + action.getActionName() + "Remove MsgType "
                            + action.getMsgType() + " StartTime " + action.getStartTime() + " EndTime "
                            + action.getEndTime());
    }
    isActivate = false;

}

From source file:com.k42b3.kadabra.handler.Ssh.java

public Item[] getFiles(String path) throws Exception {
    logger.info(basePath + "/" + path);

    Vector list = channel.ls(basePath + "/" + path);
    Item[] items = new Item[list.size()];

    for (int i = 0; i < list.size(); i++) {
        LsEntry entry = (LsEntry) list.get(i);

        if (entry.getAttrs().isDir()) {
            items[i] = new Item(entry.getFilename(), Item.DIRECTORY);
        } else {//w  w  w .  ja  v a  2 s .  c  o m
            byte[] content = this.getContent(path + "/" + entry.getFilename());
            String md5 = DigestUtils.md5Hex(Kadabra.normalizeContent(content));

            items[i] = new Item(entry.getFilename(), Item.FILE, md5);
        }
    }

    return items;
}