Example usage for java.util ArrayList remove

List of usage examples for java.util ArrayList remove

Introduction

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

Prototype

public boolean remove(Object o) 

Source Link

Document

Removes the first occurrence of the specified element from this list, if it is present.

Usage

From source file:com.esri.gpt.server.openls.provider.services.poi.DirectoryProvider.java

/**
 * Parses directory request response/*from   w w w  .j a v  a2  s.c o m*/
 * @param sResponse
 * @param params
 * @throws JSONException
 */
private void parsePOIResponse(String sResponse, DirectoryParams params) throws JSONException {

    JSONObject jResponse = new JSONObject(sResponse);

    String xResponse = "<?xml version='1.0'?><response>" + org.json.XML.toString(jResponse) + "</response>";
    LOGGER.info("XML from JSON = " + xResponse);
    HashMap<String, Object> poiLocations = null;
    try {
        /*JSONObject fieldAliases = jResponse.getJSONObject("fieldAliases");
        ArrayList<String> fieldNames = new ArrayList<String>();
        Iterator<String> names = fieldAliases.keys();
        while(names.hasNext()){
           fieldNames.add(names.next());
        }*/
        JSONArray fields = null;
        try {
            fields = jResponse.getJSONArray("fields");
        } catch (JSONException e) {
            throw new OwsException("Error occured while processing request.");
        }
        if (fields == null) {
            return;
        }
        JSONArray pois = jResponse.getJSONArray("features");

        double X, Y, distance;
        ArrayList<POIContext> poiContexts = new ArrayList<POIContext>();
        for (int i = 0; i < pois.length(); i++) {

            JSONObject poi = pois.getJSONObject(i);
            JSONObject attrs = poi.getJSONObject("attributes");

            POIContext poiCtx = new POIContext();
            POI poiObj = new POI();

            POIInfoList poiInfoList = new POIInfoList();
            for (int k = 0; k < fields.length(); k++) {
                JSONObject fieldInfo = fields.getJSONObject(k);
                String field = fieldInfo.getString("name");
                String value = attrs.getString(field);
                POIInfo poiInfo = new POIInfo();
                if (field.equalsIgnoreCase("name")) {
                    poiObj.setPoiName(value);
                } else if (field.equalsIgnoreCase("objectid")) {
                    poiObj.setId(value);
                }
                poiInfo.setName(field);
                poiInfo.setValue(value);
                poiInfoList.add(poiInfo);
            }
            poiObj.setPoiAttributeList(poiInfoList);
            JSONObject geom = poi.getJSONObject("geometry");
            Point pt = null;
            if (geom != null) {
                X = Double.parseDouble(geom.getString("x"));
                Y = Double.parseDouble(geom.getString("y"));
                pt = new Point(X, Y);
                poiObj.setLocation(pt);
            }

            poiLocations = params.getPoiLocations();
            Point location = null;
            if (poiLocations != null) {
                Set<String> keys = poiLocations.keySet();
                Iterator<String> iter = keys.iterator();
                while (iter.hasNext()) {
                    String key = iter.next();
                    if (key == "nearest") {
                        location = (Point) poiLocations.get(key);
                    }
                }
            }

            if (location != null) {
                distance = DistanceCalc.getApproxMeters(location, pt);

                double dist_miles = Math.round(((Units.convert(distance, 5, 4)) * 10));

                double distance_display = dist_miles / 10;

                poiCtx.setDistance(distance_display);
            }

            poiCtx.setPoint(poiObj);

            poiContexts.add(poiCtx);
        }
        if (poiContexts.size() > 1) {
            Collections.sort(poiContexts);
            if (poiLocations.containsKey("nearest")) {
                for (int k = poiContexts.size() - 1; k > 0; k--) {
                    poiContexts.remove(k);
                }
            } else if (poiLocations.containsKey("withinDistance")) {
                double dist = Double.parseDouble((String) poiLocations.get("withinDistance"));
                for (int k = poiContexts.size() - 1; k > 0; k--) {
                    if (poiContexts.get(k).getDistance() > dist) {
                        poiContexts.remove(k);
                    }
                }
            }
        }
        params.setPoiContexts(poiContexts);

    } catch (Exception e) {
        LOGGER.severe("Caught Exception" + e.getMessage());
        e.printStackTrace();
    }
}

From source file:de.sourcestream.movieDB.controller.MovieDetails.java

/**
 * This method calculates what icons do we have.
 *
 * @param homeIcon    the first icon//  w ww.  j  ava2  s .com
 * @param trailerIcon the second icon
 * @param galleryIcon the third icon
 */
public void adjustIconsPos(CircledImageView homeIcon, CircledImageView trailerIcon,
        CircledImageView galleryIcon) {
    int iconCount[] = { homeIconCheck, trailerIconCheck, galleryIconCheck };
    ArrayList<CircledImageView> circledImageViews = new ArrayList<>();
    circledImageViews.add(homeIcon);
    circledImageViews.add(trailerIcon);
    circledImageViews.add(galleryIcon);

    for (int i = 0; i < iconCount.length; i++) {
        if (iconCount[i] == 1)
            circledImageViews.get(circledImageViews.size() - 1).setVisibility(View.INVISIBLE);
        else {
            CircledImageView temp = circledImageViews.get(0);
            switch (i) {
            case 0:
                temp.setOnClickListener(onHomeIconClick);
                temp.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.ic_home_white_24dp));
                temp.setTag(homeIconUrl);
                break;
            case 1:
                temp.setOnClickListener(onTrailerIconClick);
                temp.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.ic_videocam_white_24dp));
                break;
            case 2:
                temp.setOnClickListener(onGalleryIconClick);
                temp.setImageDrawable(
                        ContextCompat.getDrawable(activity, R.drawable.ic_photo_camera_white_24dp));
                break;

            }
            circledImageViews.remove(0);
        }

    }

}

From source file:edu.isi.misd.tagfiler.upload.FileUploadImplementation.java

/**
 * Convenience method for computing checksums and totaling the file transfer
 * size.//from  w ww . j ava 2 s.c  om
 * 
 * @param files
 *            list of the files to transfer.
 * @throws FatalException
 *             if a fatal exception occurs when computing checksums
 */
private List<FileWrapper> buildTotalSize(List<String> files) throws FatalException {
    if (files == null)
        throw new IllegalArgumentException("" + files);

    // the copy is done for performance reasons in the inner loop
    ArrayList<String> tempFiles = new ArrayList<String>(files);

    List<FileWrapper> filesList = new ArrayList<FileWrapper>();
    checksumMap = new HashMap<String, String>();
    bytesMap = new HashMap<String, Long>();
    fileNames = new ArrayList<String>();
    datasetSize = 0;

    if (target.equals(RESUME_TARGET)) {
        // check what is completed or partial done
        JSONArray array = getFilesTagValues(applet, fileUploadListener);
        if (array != null) {
            for (int i = 0; i < array.length(); i++) {
                try {
                    JSONObject obj = array.getJSONObject(i);
                    String vname = obj.getString(VNAME);
                    String cksum = null;
                    if (!obj.isNull(SHA256SUM)) {
                        cksum = obj.getString(SHA256SUM);
                    }
                    for (String filename : tempFiles) {
                        long fileSize = (new File(filename)).length();
                        String basename = DatasetUtils.getBaseName(filename, baseDirectory);
                        if (obj.getString(NAME).equals(dataset + basename)) {
                            int version = Integer.parseInt(vname.substring(vname.lastIndexOf("@") + 1));
                            if (cksum != null) {
                                checksumMap.put(basename, cksum);
                            }
                            if (!obj.isNull(CHECK_POINT_OFFSET)) {
                                long offset = obj.getLong(CHECK_POINT_OFFSET);
                                if (offset != fileSize) {
                                    // the file is partial uploaded
                                    filesList.add(new FileWrapper(filename, offset, version, fileSize));
                                } else {
                                    // upload completed for this file
                                    // initialize the tables for upload validation
                                    fileNames.add(basename);
                                    bytesMap.put(basename, fileSize);
                                    datasetSize += fileSize;
                                }
                                // for inner loop performance
                                tempFiles.remove(filename);
                            }
                            versionMap.put(filename, version);
                            break;
                        }
                    }
                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

    // add the rest of the files without check points
    for (String filename : tempFiles) {
        int version = 0;
        if (versionMap.get(filename) != null) {
            version = versionMap.get(filename);
        }
        filesList.add(new FileWrapper(filename, 0, version, (new File(filename)).length()));
    }

    // update the tables for the files that will be upload
    for (FileWrapper fileWrapper : filesList) {
        String filename = fileWrapper.getName();
        File file = new File(filename);
        if (file.exists() && file.canRead()) {
            if (file.isFile()) {
                long fileSize = file.length();
                datasetSize += fileSize;
                String basename = DatasetUtils.getBaseName(filename, baseDirectory);
                bytesMap.put(basename, fileSize);
                fileNames.add(basename);
            } else if (file.isDirectory()) {
                // do nothing
            } else {
                fileUploadListener
                        .notifyLogMessage("File '" + filename + "' is not a regular file -- skipping.");
            }
        } else {
            fileUploadListener.notifyLogMessage("File '" + filename + "' is not readible or does not exist.");
        }
    }

    return filesList;
}

From source file:com.savy3.nonequijoin.MapOutputSampler.java

/**
 * Driver for InputSampler from the command line. Configures a JobConf
 * instance and calls {@link #writePartitionFile}.
 *///from   w w  w  .jav a  2  s.c o m
public int run(String[] args) throws Exception {
    Job job = new Job(getConf());
    ArrayList<String> otherArgs = new ArrayList<String>();
    Sampler<K, V> sampler = null;

    for (int i = 0; i < args.length; ++i) {
        try {
            if ("-r".equals(args[i])) {
                job.setNumReduceTasks(Integer.parseInt(args[++i]));
            } else if ("-inFormat".equals(args[i])) {
                job.setInputFormatClass(Class.forName(args[++i]).asSubclass(InputFormat.class));
            } else if ("-keyClass".equals(args[i])) {
                job.setMapOutputKeyClass(Class.forName(args[++i]).asSubclass(WritableComparable.class));
            } else if ("-splitSample".equals(args[i])) {
                int numSamples = Integer.parseInt(args[++i]);
                int maxSplits = Integer.parseInt(args[++i]);
                if (0 >= maxSplits)
                    maxSplits = Integer.MAX_VALUE;
                sampler = new SplitSampler<K, V>(numSamples, maxSplits);
            } else if ("-splitRandom".equals(args[i])) {
                System.out.println("Random sampling");
                double pcnt = Double.parseDouble(args[++i]);
                int numSamples = Integer.parseInt(args[++i]);
                int maxSplits = Integer.parseInt(args[++i]);
                if (0 >= maxSplits)
                    maxSplits = Integer.MAX_VALUE;
                sampler = new RandomSampler<K, V>(pcnt, numSamples, maxSplits);
            } else if ("-splitInterval".equals(args[i])) {
                double pcnt = Double.parseDouble(args[++i]);
                int maxSplits = Integer.parseInt(args[++i]);
                if (0 >= maxSplits)
                    maxSplits = Integer.MAX_VALUE;
                sampler = new IntervalSampler<K, V>(pcnt, maxSplits);
            } else {
                otherArgs.add(args[i]);
            }
        } catch (NumberFormatException except) {
            System.out.println("ERROR: Integer expected instead of " + args[i]);
            return printUsage();
        } catch (ArrayIndexOutOfBoundsException except) {
            System.out.println("ERROR: Required parameter missing from " + args[i - 1]);
            return printUsage();
        }
    }
    if (job.getNumReduceTasks() <= 1) {
        System.err.println("Sampler requires more than one reducer");
        return printUsage();
    }
    if (otherArgs.size() < 2) {
        System.out.println("ERROR: Wrong number of parameters: ");
        return printUsage();
    }
    if (null == sampler) {
        sampler = new RandomSampler<K, V>(0.1, 10000, 10);
    }
    System.out.println("before paths");
    Path outf = new Path(otherArgs.remove(otherArgs.size() - 1));
    TotalOrderPartitioner.setPartitionFile(getConf(), outf);
    for (String s : otherArgs) {
        FileInputFormat.addInputPath(job, new Path(s));
    }
    MapOutputSampler.<K, V>writePartitionFile(job, sampler);

    return 0;
}

From source file:de.sourcestream.movieDB.controller.CastDetails.java

/**
 * Fired from the on More Icon click listeners. Updates the visibility of the gallery and homePage icon.
 * And creates animation for them also./*from   ww  w.ja  v a 2s  .  c o m*/
 *
 * @param visibility  visibility value
 * @param homeIcon    first icon
 * @param galleryIcon second icon
 */
public void showHideImages(int visibility, CircledImageView homeIcon, CircledImageView galleryIcon) {
    float dy[] = { 0.7f, 56.7f };
    float infoTabDy[] = { -2.4f, 53.5f };
    int currDy = 0;
    int delay = 100;
    int iconCount[] = { homeIconCheck, galleryIconCheck };
    ArrayList<CircledImageView> circledImageViews = new ArrayList<>();
    circledImageViews.add(homeIcon);
    circledImageViews.add(galleryIcon);

    if (visibility == View.VISIBLE) {
        if (currPos != 0)
            updateIconDownPos();
        else
            updateIconDownPosInInfoTab();
    } else {
        if (currPos != 0)
            updateIconUpPos();
        else
            updateIconUpPosInInfoTab();
    }

    for (int i = 0; i < iconCount.length; i++) {
        if (iconCount[i] == 1)
            circledImageViews.get(circledImageViews.size() - 1).setVisibility(View.INVISIBLE);
        else {
            CircledImageView temp = circledImageViews.get(0);
            if (visibility == View.VISIBLE) {
                if (currPos == 0)
                    createIconUpAnimation(infoTabDy[currDy], delay);
                else
                    createIconUpAnimation(dy[currDy], delay);
                temp.startAnimation(iconUpAnimation);
            } else {
                if (currPos == 0)
                    createIconDownAnimation(infoTabDy[currDy]);
                else
                    createIconDownAnimation(dy[currDy]);
                temp.startAnimation(iconDownAnimation);
            }
            currDy++;
            delay -= 50;
            temp.setVisibility(visibility);
            circledImageViews.remove(0);
        }

    }

}

From source file:com.bluexml.side.integration.buildHudson.utils.Utils.java

/**
 * Met a jour le site.xml en fonction des features. Si une feature n'est pas
 * prsente dans le site.xml, elle est ajoute et place dans la
 * catgorie 'other' (retourn par la mthode getNewCategory() )
 *//*from  www.  j a  va2  s . co  m*/
public static void updateSiteXml() {

    // chemin vers le feature.xml
    String fileSitePath = getBuildPath() + File.separator + "site.xml";
    // String fileSitePath = getFinalDirectory()+ File.separator +
    // getArchivePrefix() + File.separator+ "site.xml";
    List<String> projects = getProjects();

    // tableau qui contiendra la liste des features
    ArrayList<String> listeFeature = new ArrayList<String>();

    // on met tous les features dans le tableau

    for (int i = 0; i < projects.size(); i++) {

        if (projects.get(i).indexOf("feature") != -1) {
            if (!Application.projectsExcluded.contains(projects.get(i))) {
                listeFeature.add(projects.get(i));
            }
        }
    }

    org.jdom.Document document = null;
    Element racine;

    // On cre une instance de SAXBuilder
    SAXBuilder sxb = new SAXBuilder();

    try {
        // On cre un nouveau document JDOM avec en argument le fichier
        // XML
        document = sxb.build(new File(fileSitePath));
    } catch (Exception e) {
        e.printStackTrace();
    }

    // On initialise un nouvel lment racine avec l'lment racine
    // du
    // document.
    racine = document.getRootElement();

    // On cre une List contenant tous les noeuds "feature" de
    // l'Element racine
    List<?> listFeatures = racine.getChildren("feature");

    // On cre un Iterator sur notre liste
    Iterator<?> i = listFeatures.iterator();

    // Boucle qui permet de mettre  jour le numro de version de chaque
    // feature
    while (i.hasNext()) {
        // On recre l'Element courant  chaque tour de boucle afin de
        // pouvoir utiliser les mthodes propres aux Element comme :
        // selectionner un noeud fils, modifier du texte, etc...
        Element courant = (Element) i.next();

        // on regarde si l'lment parcouru est dans le tableau de
        // features
        if (listeFeature.contains(courant.getAttributeValue("id"))) {
            // on supprime le feature de la liste
            listeFeature.remove(courant.getAttributeValue("id"));

            // On modifie le numro de version du plugin courant
            courant.setAttribute("version", getVersionNumber(courant.getAttributeValue("id")));

            courant.setAttribute("url", "features/" + courant.getAttributeValue("id") + "_"
                    + getVersionNumber(courant.getAttributeValue("id")) + ".jar");
        }
    }

    /***********************************************************************
     * DEPRECATED PART : BEGIN
     ***********************************************************************/

    // on parcourt le tableau de feature
    // on va ajouter les features prsentes dans le tableau (et donc qui
    // ne
    // sont pas prsentes dans le site.xml) et les ajouter au site.xml

    // for (String feature : listeFeature) {
    // Element newElement = new Element("feature");
    //
    // newElement.setAttribute("url", "features/" + feature + "_"
    // + getVersionNumber(feature) + ".jar");
    // newElement.setAttribute("id", feature);
    // newElement.setAttribute("version", getVersionNumber(feature));
    //
    // Element newCategory = new Element("category");
    //
    // newCategory.setAttribute("name", "SIDE " + getNewCategory());
    //
    // newElement.addContent(newCategory);
    // racine.addContent(newElement);
    // }

    /***********************************************************************
     * DEPRECATED PART : END
     ***********************************************************************/

    // Enregistrement du fichier
    try {
        XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
        sortie.output(document, new FileOutputStream(fileSitePath));
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:org.metis.sql.SqlStmnt.java

/**
 * SqlStmnt factory used for creating a SqlStmnt object from the given SQL
 * string./*  ww w .j  a va2 s  . c om*/
 * 
 * @param wdch
 * @param sql
 * @param jdbcTemplate
 * @return
 * @throws IllegalArgumentException
 * @throws Exception
 */
public static SqlStmnt getSQLStmnt(MetisController wdch, String sql, JdbcTemplate jdbcTemplate)
        throws IllegalArgumentException, Exception {

    if (sql == null || sql.isEmpty()) {
        throw new IllegalArgumentException("getSQLTokens: sql string is null or empty");
    }

    // remove spaces that may be embedded in the field tokens. for example:
    // select * from users where first like ` string : first `
    // will get transformed to
    // select * from users where first like `string:first`
    //
    // this is done in order to ensure that the entire field token is
    // treated as one token
    //
    // remove spaces will also ensure that any ` ... ` strings are
    // surrounded by spaces, thus also ensuring the entire string is
    // treated as one token
    String sql2 = removeSpaces(sql);

    // split the sql string into tokens where the delimiter is any number of
    // white spaces. a sql statement must have at least 2 tokens
    String[] tokens = sql2.trim().split(DELIM);
    if (tokens.length < 2) {
        throw new IllegalArgumentException("Invalid SQL statement - insufficent number of tokens");
    }

    // the list that will hold the resulting SqlTokens
    ArrayList<SqlToken> tList = new ArrayList<SqlToken>();

    int pos = 1;
    Boolean isCallable = null;
    boolean isFunction = false;
    boolean pkeySet = false;
    boolean pkeyFound = false;
    // convert the string tokens to SqlTokens and tuck them into the tList.
    for (int i = 0; i < tokens.length; i++) {

        // see if its a field-token; i.e., ` ... `
        if (tokens[i].startsWith(BACK_QUOTE_STR) && tokens[i].endsWith(BACK_QUOTE_STR)) {

            // reset pkeyFound key
            pkeyFound = false;

            // extract the type:key-name:mode from the field token
            // the mode is optional and only used for callable statements

            // strip out the leading and trailing '`' chars
            String k = tokens[i].substring(1, tokens[i].length() - 1);

            // tokenize based on the ':' delimiter
            String[] tks = k.split(COLON_STR);
            if (tks.length != 2 && tks.length != 3) {
                throw new IllegalArgumentException(
                        "Invalid SQL statement - paramter [" + k + "] is not properly formatted");
            }

            // trim the tokens
            for (int j = 0; j < tks.length; j++) {
                tks[j] = tks[j].trim();
            }

            // is this a special "pkey" token?
            if (tks[0].equalsIgnoreCase(PKEY_STR)) {
                // pkey is not allowed as first token
                if (i == 0) {
                    throw new IllegalArgumentException("Invalid SQL statement - 'pkey' type field "
                            + "cannot be out param for a function");
                }
                // only one pkey is allowed
                else if (pkeySet) {
                    throw new IllegalArgumentException(
                            "Invalid SQL statement - only one 'pkey' type field " + "is allowed per statement");
                }
                pkeySet = true;
                // if the previous token is a comma and the next token
                // is also a comma or right paren, then remove the previous
                // token
                if (tList.size() > 0) {
                    // grab the previous token
                    SqlToken prevToken = tList.get(tList.size() - 1);
                    String nextTokenStr = (i != tokens.length - 1) ? tokens[i + 1] : SPACE_CHR_STR;
                    if (!prevToken.isKey() && prevToken.getValue().equals(COMMA_STR)
                            && (nextTokenStr.equals(COMMA_STR) || nextTokenStr.startsWith(RIGHT_PAREN_STR))) {
                        tList.remove(tList.size() - 1);
                    } else {
                        // if the next token is a comma, then it
                        // will be skipped
                        pkeyFound = true;
                    }
                }

                tList.add(new SqlToken(tks[0], tks[1], null, -1));

                // go on to the next token, so as not to bump the
                // pos counter. pkey field is not a bound parameter
                continue;
            }

            // if the very first token is a key:value field, then this
            // statement is a function
            // e.g., `integer:id` = call foo()
            if (i == 0) {
                isCallable = true;
                isFunction = true;
            }

            // a mode was not provided
            if (tks.length == 2) {
                // if this is the first key token, then it represents a
                // function
                if (i == 0) {
                    // this token represents the return value for a stored
                    // function, so give it an out mode since user has not
                    // provided one
                    tList.add(new SqlToken(tks[0], tks[1], "out", pos));
                }
                // if this is a call'able statement that is not a function,
                // then give it an appropriate default mode
                else if (isCallable != null && isCallable.booleanValue() && !isFunction) {
                    if (tks[0].equalsIgnoreCase(CURSOR_STR) || tks[0].equalsIgnoreCase(RSET_STR)) {
                        tList.add(new SqlToken(tks[0], tks[1], "out", pos));
                    } else {
                        tList.add(new SqlToken(tks[0], tks[1], "in", pos));
                    }
                }
                // functions cannot be given rset and cursor params
                else if (isCallable != null && isCallable.booleanValue() && isFunction) {
                    if (tks[0].equalsIgnoreCase(CURSOR_STR) || tks[0].equalsIgnoreCase(RSET_STR)) {
                        throw new IllegalArgumentException("Invalid SQL statement - rset and cursor "
                                + "params cannot be given to a function: " + sql);
                    } else {
                        tList.add(new SqlToken(tks[0], tks[1], "in", pos));
                    }
                } else {
                    tList.add(new SqlToken(tks[0], tks[1], null, pos));
                }
            }

            // a mode was provided, do some validation
            else {
                // non-callables cannot be assigned modes
                if (isCallable != null && !isCallable.booleanValue()) {
                    throw new IllegalArgumentException("Invalid SQL statement - 'mode' provided for "
                            + "this non-callable statement: " + sql);
                }
                // function params cannot have an OUT mode
                else if (isFunction
                        && (tks[2].equalsIgnoreCase(OUT_STR) || tks[2].equalsIgnoreCase(INOUT_STR))) {
                    throw new IllegalArgumentException(
                            "Invalid SQL statement - OUT 'mode' cannot be assigned to " + "function: " + sql);
                }
                // create a parameterized SqlToken
                tList.add(new SqlToken(tks[0], tks[1], tks[2], pos));
            }
            // update the param field pointer
            pos++;
        } else {

            // if the previous token was a pkey and this token is a ','
            // then skip this token
            if (pkeyFound) {
                pkeyFound = false;
                if (tokens[i].equals(COMMA_STR)) {
                    continue;
                } else if (tokens[i].startsWith(COMMA_STR)) {
                    // it may have been something like ",statfield"
                    // in which case we don't skip "statfield"
                    tokens[i] = tokens[i].substring(1);
                }
            }
            tList.add(new SqlToken(tokens[i]));
            // see if this is a stored procedure
            if (isCallable == null) {
                isCallable = new Boolean(CALL_STR.equals(tokens[i]));
            }
        }
    }
    return new SqlStmnt(wdch, sql, tList, jdbcTemplate);
}

From source file:mom.trd.opentheso.bdd.helper.RelationsHelper.java

/**
 * Cette fonction permet de rcuprer la liste de l'historique des relations
 * d'un concept  une date prcise d'un concept
 *
 * @param ds/*  w w  w.  j  av a  2  s.  co m*/
 * @param idConcept
 * @param idThesaurus
 * @param date
 * @param lang
 * @return Objet class Concept
 */
public ArrayList<Relation> getRelationHistoriqueFromDate(HikariDataSource ds, String idConcept,
        String idThesaurus, Date date, String lang) {

    Connection conn;
    Statement stmt;
    ResultSet resultSet;
    ArrayList<Relation> listRel = null;

    try {
        // Get connection from pool
        conn = ds.getConnection();
        try {
            stmt = conn.createStatement();
            try {
                String query = "select lexical_value, id_concept2, role, action, hierarchical_relationship_historique.modified, username "
                        + "from hierarchical_relationship_historique, users, preferred_term, term"
                        + " where hierarchical_relationship_historique.id_thesaurus = '" + idThesaurus + "'"
                        + " and hierarchical_relationship_historique.id_concept1=preferred_term.id_concept"
                        + " and preferred_term.id_term=term.id_term" + " and term.lang='" + lang + "'"
                        + " and term.id_thesaurus='" + idThesaurus + "'" + " and ( id_concept1 = '" + idConcept
                        + "'" + " or id_concept2 = '" + idConcept + "' )"
                        + " and hierarchical_relationship_historique.id_user=users.id_user"
                        + " and hierarchical_relationship_historique.modified <= '" + date.toString()
                        + "' order by hierarchical_relationship_historique.modified ASC";
                stmt.executeQuery(query);
                resultSet = stmt.getResultSet();
                if (resultSet != null) {
                    listRel = new ArrayList<>();

                    while (resultSet.next()) {
                        if (resultSet.getString("action").equals("DEL")) {
                            for (Relation rel : listRel) {
                                if (rel.getId_concept1().equals(resultSet.getString("lexical_value"))
                                        && rel.getId_concept2().equals(resultSet.getString("id_concept2"))
                                        && rel.getAction().equals("ADD")
                                        && rel.getId_relation().equals(resultSet.getString("role"))) {
                                    listRel.remove(rel);
                                    break;
                                }
                            }
                        } else {
                            Relation r = new Relation();
                            r.setId_relation(resultSet.getString("role"));
                            r.setId_concept1(resultSet.getString("lexical_value"));
                            r.setId_concept2(resultSet.getString("id_concept2"));
                            r.setModified(resultSet.getDate("modified"));
                            r.setIdUser(resultSet.getString("username"));
                            r.setAction(resultSet.getString("action"));
                            r.setId_thesaurus(idThesaurus);
                            listRel.add(r);
                        }

                    }
                }
            } finally {
                stmt.close();
            }
        } finally {
            conn.close();
        }
    } catch (SQLException sqle) {
        // Log exception
        log.error("Error while getting date relation historique of Concept : " + idConcept, sqle);
    }
    return listRel;
}

From source file:de.sourcestream.movieDB.controller.MovieDetails.java

/**
 * Fired from the on More Icon click listeners. Updates the visibility of the gallery and homePage icon.
 * And creates animation for them also./*from w w  w .j a  v a  2s.  c  om*/
 *
 * @param visibility  visibility value
 * @param homeIcon    first icon
 * @param galleryIcon second icon
 */
public void showHideImages(int visibility, CircledImageView homeIcon, CircledImageView trailerIcon,
        CircledImageView galleryIcon) {
    float dy[] = { 0.7f, 56.7f, 112.5f };
    float infoTabDy[] = { -2.4f, 53.5f, 109.25f };
    int currDy = 0;
    int delay = 100;
    int iconCount[] = { homeIconCheck, trailerIconCheck, galleryIconCheck };
    ArrayList<CircledImageView> circledImageViews = new ArrayList<>();
    circledImageViews.add(homeIcon);
    circledImageViews.add(trailerIcon);
    circledImageViews.add(galleryIcon);

    if (visibility == View.VISIBLE) {
        if (currPos != 0)
            updateIconDownPos();
        else
            updateIconDownPosInInfoTab();
    } else {
        if (currPos != 0)
            updateIconUpPos();
        else
            updateIconUpPosInInfoTab();
    }

    for (int i = 0; i < iconCount.length; i++) {
        if (iconCount[i] == 1)
            circledImageViews.get(circledImageViews.size() - 1).setVisibility(View.INVISIBLE);
        else {
            CircledImageView temp = circledImageViews.get(0);
            if (visibility == View.VISIBLE) {
                if (currPos == 0)
                    createIconUpAnimation(infoTabDy[currDy], delay);
                else
                    createIconUpAnimation(dy[currDy], delay);
                temp.startAnimation(iconUpAnimation);
            } else {
                if (currPos == 0)
                    createIconDownAnimation(infoTabDy[currDy]);
                else
                    createIconDownAnimation(dy[currDy]);
                temp.startAnimation(iconDownAnimation);
            }
            currDy++;
            delay -= 50;
            temp.setVisibility(visibility);
            circledImageViews.remove(0);
        }

    }

}

From source file:hudson.model.Hudson.java

/**
 * Removes a {@link Node} from Hudson.//from   w w  w.ja  va2s.  c  om
 */
public synchronized void removeNode(Node n) throws IOException {
    n.toComputer().disconnect();

    ArrayList<Node> nl = new ArrayList<Node>(this.slaves);
    nl.remove(n);
    setNodes(nl);
}