Example usage for java.util Vector get

List of usage examples for java.util Vector get

Introduction

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

Prototype

public synchronized E get(int index) 

Source Link

Document

Returns the element at the specified position in this Vector.

Usage

From source file:edu.caltechUcla.sselCassel.projects.jMarkets.server.control.MonitorServ.java

/** Update the server monitors with a new client connection. This is called whenever a new
 *  client is authenticated *///from   www.  j  a v  a 2 s .  c o  m
public void updateAuthStatus(int sessionId, int id, String name, int numConnected, boolean allConnected) {
    Vector monitors = getMonitors(sessionId);
    if (monitors == null) {
        log.warn("Cannot update MonitorTransmitters with new client connection status for session " + sessionId
                + " -- that session does not exist!");
        return;
    }

    for (int i = 0; i < monitors.size(); i++) {
        MonitorTransmitter ui = (MonitorTransmitter) monitors.get(i);
        try {
            ui.connectClient(id, name);

            if (numConnected == 1)
                ui.setStartExpButtonEnabled(true);
            if (allConnected)
                ui.setAllConnected(true);
        } catch (MonitorDisconnectedException e) {
            log.error(
                    "Failed to establish connection with MonitorTransmitter -- disconnecting from failed monitor");
            disconnectMonitor(sessionId, ui);
        }
    }

}

From source file:fr.inrialpes.exmo.align.cli.WGroupEval.java

public void printHTML(Vector<Vector<Object>> result, PrintStream writer) {
    // variables for computing iterative harmonic means
    int expected = 0; // expected so far
    int foundVect[]; // found so far
    int correctFoundVect[]; // correct so far
    int correctExpVect[]; // correct so far
    long timeVect[]; // time so far
    fsize = format.length();//from w  ww  . jav  a 2s .c om
    // JE: the writer should be put out
    // JE: the h-means computation should be put out as well
    Formatter formatter = new Formatter(writer);

    // Print the header
    if (embedded != true)
        writer.println("<html><head></head><body>");
    writer.println("<table border='2' frame='sides' rules='groups'>");
    writer.println("<colgroup align='center' />");
    // for each algo <td spancol='2'>name</td>
    for (String m : listAlgo) {
        writer.println("<colgroup align='center' span='" + fsize + "' />");
    }
    // For each file do a
    writer.println("<thead valign='top'><tr><th>algo</th>");
    // for each algo <td spancol='2'>name</td>
    for (String m : listAlgo) {
        writer.println("<th colspan='" + fsize + "'>" + m + "</th>");
    }
    writer.println("</tr></thead><tbody><tr><td>test</td>");
    // for each algo <td>Prec.</td><td>Rec.</td>
    for (String m : listAlgo) {
        for (int i = 0; i < fsize; i++) {
            writer.print("<td>");
            if (format.charAt(i) == 'p') {
                writer.print("Prec.");
            } else if (format.charAt(i) == 'f') {
                writer.print("FMeas.");
            } else if (format.charAt(i) == 'o') {
                writer.print("Over.");
            } else if (format.charAt(i) == 't') {
                writer.print("Time");
            } else if (format.charAt(i) == 'r') {
                writer.print("Rec.");
            }
            writer.println("</td>");
        }
        //writer.println("<td>Prec.</td><td>Rec.</td>");
    }
    writer.println("</tr></tbody><tbody>");
    foundVect = new int[size];
    correctFoundVect = new int[size];
    correctExpVect = new int[size];
    timeVect = new long[size];
    for (int k = size - 1; k >= 0; k--) {
        foundVect[k] = 0;
        correctFoundVect[k] = 0;
        correctExpVect[k] = 0;
        timeVect[k] = 0;
    }
    // </tr>
    // For each directory <tr>
    boolean colored = false;
    for (Vector<Object> test : result) {
        double newexpected = -1.;
        if (colored == true && color != null) {
            colored = false;
            writer.println("<tr bgcolor=\"" + color + "\">");
        } else {
            colored = true;
            writer.println("<tr>");
        }
        ;
        // Print the directory <td>bla</td>
        writer.println("<td>" + (String) test.get(0) + "</td>");
        // For each record print the values <td>bla</td>
        Enumeration<Object> f = test.elements();
        f.nextElement();
        for (int k = 0; f.hasMoreElements(); k++) {
            WeightedPREvaluator eval = (WeightedPREvaluator) f.nextElement();
            if (eval != null) {
                // iterative H-means computation
                if (newexpected == -1.) {
                    newexpected = eval.getExpected();
                    expected += newexpected;
                }
                foundVect[k] += eval.getFound();
                correctFoundVect[k] += eval.getCorrectFound();
                correctExpVect[k] += eval.getCorrectExpected();
                timeVect[k] += eval.getTime();

                for (int i = 0; i < fsize; i++) {
                    writer.print("<td>");
                    if (format.charAt(i) == 'p') {
                        formatter.format("%1.2f", eval.getPrecision());
                    } else if (format.charAt(i) == 'f') {
                        formatter.format("%1.2f", eval.getFmeasure());
                    } else if (format.charAt(i) == 'o') {
                        formatter.format("%1.2f", eval.getOverall());
                    } else if (format.charAt(i) == 't') {
                        if (eval.getTime() == 0) {
                            writer.print("-");
                        } else {
                            formatter.format("%1.2f", eval.getTime());
                        }
                    } else if (format.charAt(i) == 'r') {
                        formatter.format("%1.2f", eval.getRecall());
                    }
                    writer.println("</td>");
                }
            } else { // JE 2013: will break if the previous tests are all NULL
                correctExpVect[k] += newexpected;
                // Nothing needs to be incremented for precision
                for (int i = 0; i < fsize; i++)
                    writer.print("<td>n/a</td>");
                writer.println();
            }
        }
        writer.println("</tr>");
    }
    writer.print("<tr bgcolor=\"yellow\"><td>H-mean</td>");
    // Here we are computing a sheer average.
    // While in the column results we print NaN when the returned
    // alignment is empty,
    // here we use the real values, i.e., add 0 to both correctVect and
    // foundVect, so this is OK for computing the average.
    int k = 0;
    // ???
    for (String m : listAlgo) {
        double precision = 1. - (double) correctFoundVect[k] / foundVect[k];
        double recall = 1. - (double) correctExpVect[k] / expected;
        for (int i = 0; i < fsize; i++) {
            writer.print("<td>");
            if (format.charAt(i) == 'p') {
                formatter.format("%1.2f", precision);
            } else if (format.charAt(i) == 'f') {
                formatter.format("%1.2f", 2 * precision * recall / (precision + recall));
            } else if (format.charAt(i) == 'o') {
                formatter.format("%1.2f", recall * (2 - (1 / precision)));
            } else if (format.charAt(i) == 't') {
                if (timeVect[k] == 0) {
                    writer.print("-");
                } else {
                    formatter.format("%1.2f", timeVect[k]);
                }
            } else if (format.charAt(i) == 'r') {
                formatter.format("%1.2f", recall);
            }
            writer.println("</td>");
        }
        ;
        k++;
    }
    writer.println("</tr>");
    writer.println("</tbody></table>");
    writer.println("<p><small>n/a: result alignment not provided or not readable<br />");
    writer.println("NaN: division per zero, likely due to empty alignment.</small></p>");
    if (embedded != true)
        writer.println("</body></html>");
}

From source file:com.nineteendrops.tracdrops.client.core.multicall.MulticallImpl.java

private ArrayList makeMulticall(TracProperties tracProperties) {

    ArrayList<CallElement> registeredCallElements = getMulticalls();
    if (registeredCallElements == null || registeredCallElements.size() == 0) {
        //throw new MulticallInvalidStateException(MessageUtils.getMessage("core.multicall.no.callelements"));
        MessageUtils.registerDebugLog(log, "core.multicall.no.callelements");

        return null;
    }/*from  w  ww .  j  a v a  2 s . co  m*/

    Multicall multicall = (Multicall) getTracInvocationObject(Multicall.class);

    if (log.isDebugEnabled()) {
        log.debug(MessageUtils.getMessage("core.multicall.preparing.multicall"));
        log.debug(MessageUtils.getMessage("symbol.line.separator"));
    }

    Vector tracCalls = new Vector();
    for (CallElement callElement : registeredCallElements) {
        Hashtable callToTrac = new Hashtable();
        callToTrac.put("methodName", callElement.getTracMethodName());
        callToTrac.put("params", callElement.getParameters());
        tracCalls.add(callToTrac);

        if (log.isDebugEnabled()) {

            logCallElement(callElement);
        }
    }

    Vector results = null;
    try {
        results = multicall.internalMulticall(tracCalls);
    } catch (TracException e) {
        // There was an error in the invocation
        if (isFailureInMethodExecution(e, tracProperties)) {
            dumpMulticallStack(registeredCallElements);
            throw new TracMethodExecutionException(
                    MessageUtils.registerErrorLog(log, "core.multicall.failure.method.invocation"), e);
        } else {
            throw e;
        }
    }

    ArrayList resultsFinal = new ArrayList();

    try {
        int resultOrder = 0;
        for (CallElement call : registeredCallElements) {
            ReturnDecoder returnDecoder = (ReturnDecoder) call.getReturnDecoder().newInstance();
            Object resultDecoded = returnDecoder.decode(((Object[]) results.get(resultOrder++))[0],
                    tracProperties, call.getKeptParametersForDecoder());
            resultsFinal.add(resultDecoded);
        }
    } catch (InstantiationException e) {
        throw new DecodingErrorException(MessageUtils.registerErrorLog(log,
                "core.multicall.error.decoding.return.value", e.getMessage()), e);
    } catch (IllegalAccessException e) {
        throw new DecodingErrorException(MessageUtils.registerErrorLog(log,
                "core.multicall.error.decoding.return.value", e.getMessage()), e);
    }

    return resultsFinal;
}

From source file:edu.ku.brc.specify.ui.db.ResultSetTableModel.java

/**
 * Gets the 'raw' value of the row col.//from  w  w w  .ja va2  s  .  c  o m
 * @param rowArg the row of the cell to be gotten
 * @param colArg the column of the cell to be gotten
 */
public Object getCacheValueAt(final int row, final int column) {
    if (row > -1 && row < cache.size()) {
        Vector<Object> rowArray = cache.get(row);
        if (column > -1 && column < rowArray.size()) {
            return rowArray.get(column);
        }
    }
    return null;
}

From source file:edu.ku.brc.specify.datamodel.PreparationAttribute.java

@Override
@Transient/*from w ww .j  a va 2  s.c o m*/
public Integer getParentId() {
    Vector<Object> ids = BasicSQLUtils.querySingleCol(
            "SELECT PreparationID FROM preparation WHERE PreparationAttributeID = " + preparationAttributeId);
    if (ids.size() == 1) {
        return (Integer) ids.get(0);
    }
    return null;
}

From source file:com.mysql.stresstool.RunnableClusterQueryInsert.java

public void run() {

    BufferedReader d = null;//  ww w . j av a 2 s . c  om
    Connection conn = null;

    try {
        if (jdbcUrlMap.get("dbType") != null && !((String) jdbcUrlMap.get("dbType")).equals("MySQL")) {
            conn = DriverManager.getConnection((String) jdbcUrlMap.get("dbType"), "test", "test");
        } else
            conn = DriverManager.getConnection((String) jdbcUrlMap.get("jdbcUrl"));
    } catch (SQLException ex) {
        ex.printStackTrace();
    }

    if (conn != null) {

        try {

            Statement stmt = null;
            //                ResultSet rs = null;
            //                ResultSet rs2 = null;

            conn.setAutoCommit(false);
            stmt = conn.createStatement();
            stmt.execute("SET AUTOCOMMIT=0");
            long execTime = 0;
            int pkStart = 0;
            int pkEnds = 0;
            int intDeleteInterval = 0;
            int intBlobInterval = 0;
            int intBlobIntervalLimit = StressTool.getNumberFromRandom(4).intValue();
            ThreadInfo thInfo;

            long threadTimeStart = System.currentTimeMillis();
            active = true;

            thInfo = new ThreadInfo();
            thInfo.setId(this.ID);
            thInfo.setType("insert");
            thInfo.setStatusActive(this.isActive());

            StressTool.setInfo(this.ID, thInfo);
            boolean lazy = false;
            int lazyInterval = 0;

            for (int repeat = 0; repeat <= repeatNumber; repeat++) {
                String query = null;
                ArrayList insert1 = null;
                ArrayList insert2 = null;
                int pk = 0;

                if (repeat > 0 && lazyInterval < 500) {
                    lazy = true;
                    ++lazyInterval;
                } else {
                    lazy = false;
                    lazyInterval = 0;
                }

                intBlobInterval++;
                //IMPLEMENTING lazy
                Vector v = this.getTablesValues(lazy);

                insert1 = (ArrayList<String>) v.get(0);
                insert2 = (ArrayList<String>) v.get(1);

                //                    System.out.println(insert1);
                //                    System.out.println(insert2);

                //                    pk = ((Integer) v.get(2)).intValue();

                int[] iLine = { 0, 0 };

                //                    pkStart = StressTool.getNumberFromRandom(2147483647).intValue();
                //                    pkEnds = StressTool.getNumberFromRandom(2147483647).intValue();

                try {

                    long timeStart = System.currentTimeMillis();

                    if (this.ignoreBinlog)
                        stmt.execute("SET sql_log_bin=0");

                    //                  stmt.execute("SET GLOBAL max_allowed_packet=1073741824");

                    if (dbType.equals("MySQL") && !engine.toUpperCase().equals("BRIGHTHOUSE"))
                        stmt.execute("BEGIN");
                    else
                        stmt.execute("COMMIT");
                    //                                stmt.execute("SET TRANSACTION NAME 'TEST'");
                    {
                        Iterator<String> it = insert1.iterator();
                        while (it.hasNext()) {
                            stmt.addBatch(it.next());
                        }
                    }

                    if (!this.doSimplePk) {
                        if (intBlobInterval > intBlobIntervalLimit) {
                            Iterator<String> it = insert2.iterator();
                            while (it.hasNext()) {
                                stmt.addBatch(it.next());
                            }
                            intBlobInterval = 0;

                        }
                    }

                    iLine = stmt.executeBatch();
                    stmt.clearBatch();

                    //                            System.out.println("Query1 = " + insert1);
                    //                            System.out.println("Query2 = " + insert2);
                    //                            stmt.execute("START TRANSACTION");
                    //                            stmt.execute(insert1);
                    //                            iLine = stmt.executeBatch();
                    //                            conn.commit();
                    long timeEnds = System.currentTimeMillis();
                    execTime = (timeEnds - timeStart);

                } catch (Exception sqle) {
                    conn.rollback();
                    System.out.println("FAILED QUERY1==" + insert1);
                    System.out.println("FAILED QUERY2==" + insert2);
                    sqle.printStackTrace();
                    System.exit(1);
                    //conn.close();
                    //this.setJdbcUrl(jdbcUrl);
                    //System.out.println("Query Insert TH RE-INIZIALIZING");

                } finally {
                    //                           conn.commit();
                    stmt.execute("COMMIT");
                    //                            intDeleteInterval++;
                    if (doLog) {

                        System.out.println("Query Insert TH = " + this.getID() + " Loop N = " + repeat + " "
                                + iLine[0] + "|" + ((iLine.length > 1) ? iLine[1] : 0) + " Exec Time(ms) ="
                                + execTime + " Running = " + repeat + " of " + repeatNumber + " to go ="
                                + (repeatNumber - repeat) + " Using Lazy=" + lazy);
                    }
                }
                thInfo.setExecutedLoops(repeat);
                if (sleepFor > 0 || this.getSleepWrite() > 0) {
                    if (this.getSleepWrite() > 0) {
                        Thread.sleep(getSleepWrite());
                    } else
                        Thread.sleep(sleepFor);
                }

            }

            long threadTimeEnd = System.currentTimeMillis();
            this.executionTime = (threadTimeEnd - threadTimeStart);
            //                this.setExecutionTime(executionTime);
            active = false;
            //                System.out.println("Query Insert TH = " + this.getID() + " COMPLETED!  TOTAL TIME = " + execTime + "(ms) Sec =" + (execTime/1000));

            thInfo.setExecutionTime(executionTime);
            thInfo.setStatusActive(false);
            StressTool.setInfo(this.ID, thInfo);
            return;

        } catch (Exception ex) {
            ex.printStackTrace();
            try {
                conn.close();
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    }

}

From source file:com.mysql.stresstool.RunnableSC2013QueryInsert.java

public void run() {

    BufferedReader d = null;/* w w w .j av  a  2 s  . c o  m*/
    Connection conn = null;

    try {
        if (jdbcUrlMap.get("dbType") != null && !((String) jdbcUrlMap.get("dbType")).equals("MySQL")) {
            conn = DriverManager.getConnection((String) jdbcUrlMap.get("dbType"), "test", "test");
        } else
            conn = DriverManager.getConnection((String) jdbcUrlMap.get("jdbcUrl"));
    } catch (SQLException ex) {
        ex.printStackTrace();
    }

    if (conn != null) {

        try {

            Statement stmt = null;
            //                ResultSet rs = null;
            //                ResultSet rs2 = null;

            conn.setAutoCommit(false);
            stmt = conn.createStatement();
            stmt.execute("SET AUTOCOMMIT=0");
            long execTime = 0;
            int pkStart = 0;
            int pkEnds = 0;
            int intDeleteInterval = 0;
            int intBlobInterval = 0;
            int intBlobIntervalLimit = StressTool.getNumberFromRandom(4).intValue();
            ThreadInfo thInfo;

            long threadTimeStart = System.currentTimeMillis();
            active = true;

            thInfo = new ThreadInfo();
            thInfo.setId(this.ID);
            thInfo.setType("insert");
            thInfo.setStatusActive(this.isActive());

            StressTool.setInfo(this.ID, thInfo);
            boolean lazy = false;
            int lazyInterval = 0;

            for (int repeat = 0; repeat <= repeatNumber; repeat++) {
                String query = null;
                ArrayList insert1 = null;
                ArrayList insert2 = null;
                int pk = 0;

                if (repeat > 0 && lazyInterval < 100) {
                    lazy = true;
                    ++lazyInterval;
                } else {
                    lazy = false;
                    lazyInterval = 0;
                }

                intBlobInterval++;
                //IMPLEMENTING lazy
                Vector v = this.getTablesValues(lazy);

                insert1 = (ArrayList<String>) v.get(0);
                insert2 = (ArrayList<String>) v.get(1);

                //                    System.out.println(insert1);
                //                    System.out.println(insert2);

                //                    pk = ((Integer) v.get(2)).intValue();

                int[] iLine = { 0, 0 };

                //                    pkStart = StressTool.getNumberFromRandom(2147483647).intValue();
                //                    pkEnds = StressTool.getNumberFromRandom(2147483647).intValue();

                try {

                    long timeStart = System.currentTimeMillis();

                    if (this.ignoreBinlog)
                        stmt.execute("SET sql_log_bin=0");

                    //                  stmt.execute("SET GLOBAL max_allowed_packet=1073741824");

                    if (dbType.equals("MySQL") && !engine.toUpperCase().equals("BRIGHTHOUSE"))
                        stmt.execute("BEGIN");
                    else
                        stmt.execute("COMMIT");
                    //                                stmt.execute("SET TRANSACTION NAME 'TEST'");
                    {
                        Iterator<String> it = insert1.iterator();
                        while (it.hasNext()) {
                            stmt.addBatch(it.next());
                        }
                    }

                    if (!this.doSimplePk) {
                        if (intBlobInterval > intBlobIntervalLimit) {
                            Iterator<String> it = insert2.iterator();
                            while (it.hasNext()) {
                                stmt.addBatch(it.next());
                            }
                            intBlobInterval = 0;

                        }
                    }

                    iLine = stmt.executeBatch();
                    stmt.clearBatch();

                    //                            System.out.println("Query1 = " + insert1);
                    //                            System.out.println("Query2 = " + insert2);
                    //                            stmt.execute("START TRANSACTION");
                    //                            stmt.execute(insert1);
                    //                            iLine = stmt.executeBatch();
                    //                            conn.commit();
                    long timeEnds = System.currentTimeMillis();
                    execTime = (timeEnds - timeStart);

                } catch (Exception sqle) {
                    conn.rollback();
                    System.out.println("FAILED QUERY1==" + insert1);
                    System.out.println("FAILED QUERY2==" + insert2);
                    sqle.printStackTrace();
                    System.exit(1);
                    //conn.close();
                    //this.setJdbcUrl(jdbcUrl);
                    //System.out.println("Query Insert TH RE-INIZIALIZING");

                } finally {
                    //                           conn.commit();
                    stmt.execute("COMMIT");
                    //                            intDeleteInterval++;
                    if (doLog) {

                        System.out.println("Query Insert TH = " + this.getID() + " Loop N = " + repeat + " "
                                + iLine[0] + "|" + ((iLine.length > 1) ? iLine[1] : 0) + " Exec Time(ms) ="
                                + execTime + " Running = " + repeat + " of " + repeatNumber + " to go ="
                                + (repeatNumber - repeat) + " Using Lazy=" + lazy);
                    }
                }
                thInfo.setExecutedLoops(repeat);
                if (sleepFor > 0 || this.getSleepWrite() > 0) {
                    if (this.getSleepWrite() > 0) {
                        Thread.sleep(getSleepWrite());
                    } else
                        Thread.sleep(sleepFor);
                }

            }

            long threadTimeEnd = System.currentTimeMillis();
            this.executionTime = (threadTimeEnd - threadTimeStart);
            //                this.setExecutionTime(executionTime);
            active = false;
            //                System.out.println("Query Insert TH = " + this.getID() + " COMPLETED!  TOTAL TIME = " + execTime + "(ms) Sec =" + (execTime/1000));

            thInfo.setExecutionTime(executionTime);
            thInfo.setStatusActive(false);
            StressTool.setInfo(this.ID, thInfo);
            return;

        } catch (Exception ex) {
            ex.printStackTrace();
            try {
                conn.close();
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    }

}

From source file:edu.ku.brc.specify.tasks.subpane.security.UserAgentVSQBldr.java

/**
 * @param dataMap//from  ww w.j a  v  a 2s .  c  o  m
 * @param fieldNames
 * @return
 */
@Override
public String buildSQL(final Map<String, Object> dataMap, final List<String> fieldNames) {
    Vector<Object> disciplineIds = BasicSQLUtils
            .querySingleCol("SELECT DisciplineID FROM discipline ORDER BY Name");
    if (disciplineIds.size() > 1) {
        Vector<Object> divisionNames = BasicSQLUtils
                .querySingleCol("SELECT Name FROM discipline ORDER BY Name");
        ToggleButtonChooserDlg<Object> divDlg = new ToggleButtonChooserDlg<Object>((Dialog) null,
                UIRegistry.getResourceString("SEC_PK_SRCH"), divisionNames,
                ToggleButtonChooserPanel.Type.RadioButton);
        divDlg.setUseScrollPane(true);
        divDlg.createUI();
        divDlg.getCancelBtn().setVisible(false);

        divDlg.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        UIHelper.centerAndShow(divDlg);
        int inx = divisionNames.indexOf(divDlg.getSelectedObject());
        disciplineID = (Integer) disciplineIds.get(inx);

    } else {
        disciplineID = (Integer) disciplineIds.get(0);
    }

    String searchName = cbx.getSearchName();
    if (searchName != null) {
        esTblInfo = ExpressSearchConfigCache.getTableInfoByName(searchName);
        if (esTblInfo != null) {
            String sqlStr = esTblInfo.getViewSql();
            return buildSearchString(dataMap, fieldNames,
                    StringUtils.replace(sqlStr, "DSPLNID", disciplineID.toString()));
        }
    }
    return null;
}

From source file:info.puzz.trackprofiler.gui.TrackProfilerFrame.java

private void prepareWaypontOnChart(XYPlot xyplot, Waypoint waypoint) {
    Vector positions = waypoint.getPositionsOnTrack();
    for (int i = 0; i < positions.size(); i++) {
        double position = ((Double) positions.get(i)).doubleValue();
        double elevation = waypoint.getElevation();

        if (position > 0 && waypoint.isVisible()) {

            String waypointLabel;
            if (TrackProfilerAppContext.getInstance().isWaypointLabelFromTitle()) {
                waypointLabel = waypoint.getTitle();
            } else {
                waypointLabel = waypoint.getDescription();
            }/*  w  ww  . ja v  a2  s .c o m*/

            double arrowAngle = Math.PI * 1.5;
            if (waypoint.getArrowLength() < 0) {
                arrowAngle += Math.PI;
            }

            XYPointerAnnotation xypointerannotation = new XYPointerAnnotation(waypointLabel, position,
                    elevation, arrowAngle);
            xypointerannotation.setTipRadius(3.0D);
            xypointerannotation.setBaseRadius(Math.abs(waypoint.getArrowLength()));
            xypointerannotation.setFont(GUIConstants.SANS_SERIF_11);
            xypointerannotation.setPaint(Color.blue);
            xypointerannotation.setTextAnchor(TextAnchor.BASELINE_CENTER);
            xyplot.addAnnotation(xypointerannotation);

            ValueMarker valuemarker = new ValueMarker(position);
            valuemarker.setLabelOffsetType(LengthAdjustmentType.NO_CHANGE);
            valuemarker.setStroke(new BasicStroke(1.0F));

            // TODO: u postavke da li ispisivati ovdje
            if (false) {
                valuemarker.setLabel(waypoint.getTitle());
            }

            valuemarker.setLabelFont(GUIConstants.SANS_SERIF_11);

            if (waypoint instanceof TrackExtreeme) {
                valuemarker.setPaint(Color.blue);
            } else {
                valuemarker.setPaint(new Color(220, 220, 220));
            }
            valuemarker.setLabelPaint(Color.red);
            valuemarker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
            valuemarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
            // xyplot.addRangeMarker(valuemarker);

            xyplot.addDomainMarker(valuemarker);
        }
    }
}

From source file:au.org.ala.layers.dao.ObjectDAOImpl.java

@Override
public Objects getObjectByIdAndLocation(String fid, Double lng, Double lat) {
    logger.info("Getting object info for fid = " + fid + " at loc: (" + lng + ", " + lat + ") ");
    String sql = "select o.pid, o.id, o.name, o.desc as description, o.fid as fid, f.name as fieldname, "
            + "o.bbox, o.area_km from search_objects_by_geometry_intersect(?, " + "ST_GeomFromText('POINT("
            + lng + " " + lat + ")', 4326)) o, fields f WHERE o.fid = f.id";
    List<Objects> l = jdbcTemplate.query(sql, ParameterizedBeanPropertyRowMapper.newInstance(Objects.class),
            new Object[] { fid });
    updateObjectWms(l);//from   w w w. j  ava  2 s .  c  om
    if (l == null || l.isEmpty()) {
        // get grid classes intersection
        l = new ArrayList<Objects>();
        IntersectionFile f = layerIntersectDao.getConfig().getIntersectionFile(fid);
        if (f != null && f.getClasses() != null) {
            Vector v = layerIntersectDao.samplingFull(fid, lng, lat);
            if (v != null && v.size() > 0 && v.get(0) != null) {
                Map m = (Map) v.get(0);
                int key = (int) Double.parseDouble(((String) m.get("pid")).split(":")[1]);
                GridClass gc = f.getClasses().get(key);
                if (f.getType().equals("a")
                        || !new File(f.getFilePath() + File.separator + "polygons.grd").exists()) { // class pid
                    Objects o = new Objects();
                    o.setName(gc.getName());
                    o.setFid(f.getFieldId());
                    o.setFieldname(f.getFieldName());
                    o.setPid(f.getLayerPid() + ":" + gc.getId());
                    o.setId(f.getLayerPid() + ":" + gc.getId());
                    o.setBbox(gc.getBbox());
                    o.setArea_km(gc.getArea_km());
                    o.setWmsurl(getGridClassWms(f.getLayerName(), gc));
                    l.add(o);
                } else if (f.getType().equals("b")) {//polygon pid
                    Grid g = new Grid(f.getFilePath() + File.separator + "polygons");
                    if (g != null) {
                        float[] vs = g.getValues(new double[][] { { lng, lat } });
                        String pid = f.getLayerPid() + ":" + gc.getId() + ":" + ((int) vs[0]);
                        l.add(getObjectByPid(pid));
                    }
                }
            }
        }
    }
    if (l.size() > 0) {
        return l.get(0);
    } else {
        return null;
    }
}