Example usage for java.util Vector add

List of usage examples for java.util Vector add

Introduction

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

Prototype

public synchronized boolean add(E e) 

Source Link

Document

Appends the specified element to the end of this Vector.

Usage

From source file:cai.flow.packets.V7_Packet.java

@SuppressWarnings("unchecked")
public Vector getDstInterfaceVector() {
    Vector v = new Vector((int) count, (int) count);

    for (Enumeration flowenum = flows.elements(); flowenum.hasMoreElements();)
        v.add(((V7_Flow) flowenum.nextElement()).getDataDstInterface());

    return v;/*ww w. j a va 2  s. c om*/
}

From source file:cai.flow.packets.V7_Packet.java

@SuppressWarnings("unchecked")
public Vector getInterfaceMatrixVector() {
    Vector v = new Vector((int) count, (int) count);

    for (Enumeration flowenum = flows.elements(); flowenum.hasMoreElements();)
        v.add(((V7_Flow) flowenum.nextElement()).getDataInterfaceMatrix());

    return v;/*from w  w w  .j a  va2  s .  c o  m*/
}

From source file:cai.flow.packets.V7_Packet.java

@SuppressWarnings("unchecked")
public Vector getProtocolVector() {
    Vector v = new Vector((int) count, (int) count);

    for (Enumeration flowenum = flows.elements(); flowenum.hasMoreElements();)
        v.add(((V7_Flow) flowenum.nextElement()).getDataProtocol());

    return v;//  ww  w  . java2 s .c  om
}

From source file:com.bailen.radioOnline.recursos.REJA.java

public Cancion[] favourites(String apiKey) throws IOException {
    HttpHeaders header = new HttpHeaders();
    header.set("Authorization", apiKey);
    HttpEntity entity = new HttpEntity(header);
    String lista = new String();
    HttpEntity<String> response;
    response = new RestTemplate().exchange("http://ceatic.ujaen.es:8075/radioapi/v2/favourites", HttpMethod.GET,
            entity, String.class, lista);

    String canc = response.getBody();
    StringTokenizer st = new StringTokenizer(canc, "[", true);
    st.nextToken();//from   w  ww .  jav a  2s  .  com
    st.nextToken();
    canc = "[" + st.nextToken();

    try {
        ObjectMapper a = new ObjectMapper();
        Item[] listilla = a.readValue(canc, Item[].class);
        Vector<Integer> ids = new Vector<>();
        for (int i = 0; i < listilla.length; ++i) {
            ids.add(listilla[i].getId());
        }
        return jamendo.canciones(ids);

    } catch (Exception e) {
        throw new IOException("no se han recibido canciones");
    }
}

From source file:controller.FAQManagerController.java

private void initData(ModelMap mm) {
    Vector data = new Vector();
    Vector column = new Vector();
    List<Faq> list = faqModel.getAll();
    if (list.size() == 0) {
        Faq f = new Faq("Auto Generate", "Auto Generate", Byte.valueOf("0"));
        faqModel.addOrUpdate(f);/*w  w  w. jav  a 2s.  co  m*/
        list.add(f);
    }

    column.add("ID");
    column.add("Question");
    column.add("Answer");
    column.add("Status");
    for (Faq f : list) {
        Vector tmp = new Vector();
        tmp.add(f.getFaqId());
        tmp.add(f.getFaqQestion());
        tmp.add(f.getFaqAnswer());
        tmp.add(f.getStatus() == 1 ? "Active" : "Non-Active");
        tmp.add("id://" + f.getFaqId());
        data.add(tmp);
    }
    mm.put("column", column);
    mm.put("data", data);

}

From source file:com.bluexml.xforms.controller.alfresco.agents.SystemAgent.java

/**
 * /*from   www  .j  a v  a  2 s  .c  o m*/
 * @param asGroups
 * @return
 */
@SuppressWarnings("unchecked")
public Set<String> getAllAuthoritiesAsGroupsOrUsers(AlfrescoTransaction transaction, boolean asGroups) {

    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("serviceName", "AuthorityDAO");
    parameters.put("methodName", "getAllAuthorities");
    Vector<Object> paramList = new Vector<Object>();
    // add parameters to the method in paramList
    if (asGroups) {
        paramList.add(AuthorityType.GROUP);
    } else {
        paramList.add(AuthorityType.USER);
    }
    parameters.put("methodParams", xstream.toXML(paramList));
    Set<String> result;
    try {
        String resultStr = controller.requestString(transaction, parameters,
                MsgId.INT_WEBSCRIPT_OPCODE_SERVICE);
        result = (Set<String>) xstream.fromXML(resultStr);
    } catch (ServletException e) {
        e.printStackTrace();
        return null;
    }
    return result;
}

From source file:com.bailen.radioOnline.recursos.REJA.java

public Cancion[] recommendations(String apiKey) throws IOException {
    HttpHeaders header = new HttpHeaders();
    header.set("Authorization", apiKey);
    HttpEntity entity = new HttpEntity(header);
    String lista = new String();
    HttpEntity<String> response;
    response = new RestTemplate().exchange("http://ceatic.ujaen.es:8075/radioapi/v2/recommendations",
            HttpMethod.GET, entity, String.class, lista);

    String canc = response.getBody();
    StringTokenizer st = new StringTokenizer(canc, "[", true);
    st.nextToken();/*from  w w  w . j a v a  2s  .  co m*/
    st.nextToken();
    canc = "[" + st.nextToken();

    try {

        ObjectMapper a = new ObjectMapper();
        itemRadios[] listilla = a.readValue(canc, itemRadios[].class);
        Vector<Integer> ids = new Vector<>();
        for (int i = 0; i < listilla.length; ++i) {
            ids.add(listilla[i].getIdItem());
        }
        return jamendo.canciones(ids);

    } catch (Exception e) {
        throw new IOException("no se han recibido canciones");
    }
}

From source file:com.bailen.radioOnline.recursos.REJA.java

public Cancion[] artistFav(String apiKey) throws IOException {
    HttpHeaders header = new HttpHeaders();
    header.set("Authorization", apiKey);
    HttpEntity entity = new HttpEntity(header);
    String lista = new String();
    HttpEntity<String> response;
    response = new RestTemplate().exchange("http://ceatic.ujaen.es:8075/radioapi/v2/favouriteArtists",
            HttpMethod.GET, entity, String.class, lista);

    String canc = response.getBody();
    StringTokenizer st = new StringTokenizer(canc, "[", true);
    st.nextToken();//from  w w w .j  a  va 2 s. c  o  m
    st.nextToken();
    canc = "[" + st.nextToken();

    try {

        ObjectMapper a = new ObjectMapper();
        Item[] listilla = a.readValue(canc, Item[].class);
        Vector<Integer> ids = new Vector<>();
        for (int i = 0; i < listilla.length; ++i) {
            ids.add(listilla[i].getId());
        }
        return jamendo.canciones(ids);

    } catch (Exception e) {
        throw new IOException("no se han recibido canciones");
    }
}

From source file:de.mpg.escidoc.services.common.util.Util.java

/**
 * Eliminates duplicates in a Vector./*from  w  w w . j a  va  2s . c  o m*/
 * @param dirtyVector as Format Vector
 * @return Vector with unique entries
 */
public static Vector<Format> getRidOfDuplicatesInVector(Vector<Format> dirtyVector) {
    Vector<Format> cleanVector = new Vector<Format>();
    Format format1;
    Format format2;

    for (int i = 0; i < dirtyVector.size(); i++) {
        boolean duplicate = false;
        format1 = (Format) dirtyVector.get(i);
        for (int x = i + 1; x < dirtyVector.size(); x++) {
            format2 = (Format) dirtyVector.get(x);
            if (isFormatEqual(format1, format2)) {
                duplicate = true;
            }
        }
        if (!duplicate) {
            cleanVector.add(format1);
        }
    }

    return cleanVector;
}

From source file:com.bailen.radioOnline.recursos.REJA.java

public Cancion[] random(String apiKey) throws IOException {
    HttpHeaders header = new HttpHeaders();
    header.set("Authorization", apiKey);
    HttpEntity entity = new HttpEntity(header);
    String lista = new String();
    HttpEntity<String> response;
    response = new RestTemplate().exchange("http://ceatic.ujaen.es:8075/radioapi/v2/random", HttpMethod.GET,
            entity, String.class, lista);

    String canc = response.getBody();
    StringTokenizer st = new StringTokenizer(canc, "[", true);
    st.nextToken();//from  www . j a v  a2  s  . c  o m
    st.nextToken();
    canc = "[" + st.nextToken();

    try {

        ObjectMapper a = new ObjectMapper();
        Item[] listilla = a.readValue(canc, Item[].class);
        Vector<Integer> ids = new Vector<>();
        for (int i = 0; i < listilla.length; ++i) {
            ids.add(listilla[i].getId());
        }
        return jamendo.canciones(ids);

    } catch (Exception e) {
        //return null;
        throw new IOException("no se han recibido canciones");
    }

}