Example usage for java.util Vector Vector

List of usage examples for java.util Vector Vector

Introduction

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

Prototype

public Vector() 

Source Link

Document

Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.

Usage

From source file:com.instantme.model.UserEntryModel.java

public boolean fromJSONObject(JSONObject jobj, IAnimation anim) {
    boolean result = false;

    try {/*  ww w  .  j  a v  a2 s  .  c o m*/
        Vector _data = new Vector();
        JSONArray feeds = jobj.getJSONArray("data");

        if (feeds != null) {
            for (int n = 0; n < feeds.length(); n++) {
                //System.out.println("User " + n);
                JSONObject entry = feeds.getJSONObject(n);
                UserEntry ue = new UserEntry();
                ue.fromJSONObject(entry, anim);
                _data.addElement(ue);
            }
        }
        data = _data;
        result = true;

    } catch (JSONException ex) {
        ex.printStackTrace();
    }

    return result;
}

From source file:com.instantme.model.CommentEntryModel.java

public CommentEntryModel() {
    data = new Vector();
}

From source file:com.sourcesense.ant.dbdep.task.parser.ivy.vo.IvyDependencies.java

public IvyDependencies() {
    this.dependencies = new Vector();
}

From source file:Main.java

/** Returns true if these zip files act like equivalent sets.
 * The order of the zip entries is not important: if they contain
 * exactly the same contents, this returns true.
 * @param zip1 one zip file //from  www.j av  a  2 s .  co m
 * @param zip2 another zip file
 * @return true if the two zip archives are equivalent sets
 * @throws IOException
 */
public static boolean zipEquals(File zip1, File zip2) throws IOException {
    if (zip1.equals(zip2))
        return true;

    InputStream in = null;
    ZipInputStream zipIn = null;
    try {
        in = new FileInputStream(zip1);
        zipIn = new ZipInputStream(in);
        ZipEntry e = zipIn.getNextEntry();
        Vector<String> entries = new Vector<String>();
        while (e != null) {
            entries.add(e.getName());

            InputStream other = getZipEntry(zip2, e.getName());
            if (other == null) {
                return false;
            }

            if (equals(zipIn, other) == false) {
                return false;
            }
            e = zipIn.getNextEntry();
        }
        //now we've established everything in zip1 is in zip2

        //but what if zip2 has entries zip1 doesn't?
        zipIn.close();
        in.close();

        in = new FileInputStream(zip2);
        zipIn = new ZipInputStream(in);
        e = zipIn.getNextEntry();
        while (e != null) {
            if (entries.contains(e.getName()) == false) {
                return false;
            }
            e = zipIn.getNextEntry();
        }

        //the entries are exactly the same
        return true;
    } finally {
        try {
            zipIn.close();
        } catch (Throwable t) {
        }
        try {
            in.close();
        } catch (Throwable t) {
        }
    }
}

From source file:com.emr.utilities.SQLiteGetProcesses.java

@Override
protected CustomTableModel doInBackground() throws Exception {
    SQLite.setLibraryPath("lib");
    SQLiteConnection db = null;//w w w.  j a v a 2s . co m
    SQLiteStatement st = null;
    Vector data = new Vector();
    Vector columns = new Vector();
    columns.add("Name");
    columns.add("Description");
    columns.add("SelectQry");
    columns.add("DestinationTable");
    columns.add("TruncateFirst");
    columns.add("DestinationColumns");
    columns.add("ColumnsToBeMapped");
    columns.add("Delete?");

    try {
        File file = new File("sqlite/db");
        if (!file.exists()) {
            file.createNewFile();
        }
        db = new SQLiteConnection(file);
        db.open(true);
        st = db.prepare(
                "SELECT name,description,selectQry,destinationTable,truncateFirst,destinationColumns,columnsToBeMapped FROM procedures");
        Vector row;
        while (st.step()) {
            row = new Vector(5);
            row.add(st.columnString(0));
            row.add(st.columnString(1));
            row.add(st.columnString(2));
            row.add(st.columnString(3));
            row.add(st.columnString(4));
            row.add(st.columnString(5));
            row.add(st.columnString(6));
            row.add("");
            data.add(row);
        }
    } catch (Exception e) {
        System.err.println("Data Mover Error: " + e.getMessage());
        String stacktrace = org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace(e);

        error_msg = stacktrace;
    } finally {
        if (st != null)
            st.dispose();
        if (db != null)
            db.dispose();
    }
    CustomTableModel tableModel = new CustomTableModel(data, columns);

    return tableModel;
}

From source file:NumberedSet.java

/**
 * Constructs a new empty NumberedSet.
 */
public NumberedSet() {
    data = new Vector();
}

From source file:com.cladonia.xngreditor.ErrorList.java

/**
 * A list of XML Errors.
 */
public ErrorList() {
    errors = new Vector();
}

From source file:helpers.Methods.java

/**
 * This method will return the links which are in RAM and are not processed
 * by threads./*from   w w  w  .  ja va  2s.  c  om*/
 *
 * @return The list of un-fetched URLs or null if any error occur.
 */
public static synchronized Vector<WebDocument> getRemainingProfileLinks() {
    Vector<WebDocument> temp = new Vector<>();

    try {
        for (; profileCounter < links.size(); profileCounter++) {
            temp.add(links.get(profileCounter));
        }
    } catch (IndexOutOfBoundsException ex) {
        return null;
    }

    return temp;
}

From source file:at.meikel.dmrl.webapp.rest.PlayerService.java

@RequestMapping(value = { "/players" }, method = RequestMethod.GET)
@ResponseBody/* ww  w .jav  a  2s . c o  m*/
public List<Player> getAllPlayers() {
    List<Player> result = null;
    if (server != null) {
        result = server.getRankingList().getAllPlayers();
    }

    if (result == null) {
        result = new Vector<Player>();
    }

    Collections.sort(result, new Comparator<Player>() {
        @Override
        public int compare(Player p1, Player p2) {
            if (p1 == null) {
                return p2 == null ? 0 : 1;
            } else {
                if (p2 == null) {
                    return -1;
                } else {
                    return (int) Math.signum(p1.getRanglistenwert() - p2.getRanglistenwert());
                }
            }
        }
    });

    return result;
}

From source file:Main.java

private DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) {
    String curPath = dir.getPath();
    DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(curPath);
    if (curTop != null) {
        curTop.add(curDir);//from  w w  w . ja va  2s . co  m
    }
    Vector<String> ol = new Vector<String>();
    String[] tmp = dir.list();
    for (int i = 0; i < tmp.length; i++) {
        ol.addElement(tmp[i]);
    }
    Collections.sort(ol, String.CASE_INSENSITIVE_ORDER);
    File f;
    Vector<Object> files = new Vector<Object>();
    for (int i = 0; i < ol.size(); i++) {
        String thisObject = ol.elementAt(i);
        String newPath;
        if (curPath.equals(".")) {
            newPath = thisObject;
        } else {
            newPath = curPath + File.separator + thisObject;
        }
        if ((f = new File(newPath)).isDirectory()) {
            addNodes(curDir, f);
        } else {
            files.addElement(thisObject);
        }
    }
    for (int fnum = 0; fnum < files.size(); fnum++) {
        curDir.add(new DefaultMutableTreeNode(files.elementAt(fnum)));
    }
    return curDir;
}