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.ku.brc.specify.datamodel.Appraisal.java

@Override
@Transient//from w  w w. ja  v a  2s . co  m
public Integer getParentId() {
    if (accession != null) {
        parentTblId = Accession.getClassTableId();
        return accession.getId();
    }

    Vector<Object> ids = BasicSQLUtils.querySingleCol(
            "SELECT CollectionObjectID FROM collectionobject WHERE AppraisalID = " + appraisalId);
    if (ids.size() == 1) {
        parentTblId = CollectionObject.getClassTableId();
        return (Integer) ids.get(0);
    }
    parentTblId = null;
    return null;
}

From source file:de.nrw.hbz.regal.sync.Syncer.java

void dele(String pidFile) {
    Vector<String> pids;
    pids = readPidlist(pidFile);//from   w ww  .j  a  v  a  2 s.c  o m
    int size = pids.size();
    for (int i = 0; i < size; i++) {
        logger.info((i + 1) + " / " + size);
        String pid = pids.get(i);
        ingester.delete(pid);
        logger.info((i + 1) + "/" + size + " " + pid + " deleted!\n");
    }
}

From source file:gsn.http.A3DWebServiceImpl.java

public String[] getSensorInfo(String sensor) {

    VSensorConfig sensorConfig = Mappings.getVSensorConfig(sensor);

    Vector<String> sensorInfo = new Vector<String>();

    for (DataField df : sensorConfig.getOutputStructure())
        sensorInfo.add(df.getName() + ":" + df.getType());

    String v_sensor_info[] = new String[sensorInfo.size()];
    for (int i = 0; i < sensorInfo.size(); i++)
        v_sensor_info[i] = sensorInfo.get(i);

    return v_sensor_info;
}

From source file:net.sf.jabref.exporter.layout.LayoutEntry.java

public LayoutEntry(StringInt si, final String classPrefix_) {
    type = si.i;/*from  w w w.  j a  v  a  2  s. c  o  m*/
    classPrefix = classPrefix_;

    if (type == LayoutHelper.IS_LAYOUT_TEXT) {
        text = si.s;
    } else if (type == LayoutHelper.IS_SIMPLE_FIELD) {
        text = si.s.trim();
    } else if ((type == LayoutHelper.IS_FIELD_START) || (type == LayoutHelper.IS_FIELD_END)) {
        // Do nothing
    } else if (type == LayoutHelper.IS_OPTION_FIELD) {
        Vector<String> v = new Vector<>();
        WSITools.tokenize(v, si.s, "\n");

        if (v.size() == 1) {
            text = v.get(0);
        } else {
            text = v.get(0).trim();

            option = LayoutEntry.getOptionalLayout(v.get(1), classPrefix);
            // See if there was an undefined formatter:
            for (LayoutFormatter anOption : option) {
                if (anOption instanceof NotFoundFormatter) {
                    String notFound = ((NotFoundFormatter) anOption).getNotFound();

                    if (invalidFormatter == null) {
                        invalidFormatter = new ArrayList<>();
                    }
                    invalidFormatter.add(notFound);
                }
            }

        }
    }
}

From source file:edu.ku.brc.specify.conversion.CollectionInfo.java

/**
 * @param oldDBConn//from w w w  .ja v a2  s  . com
 * @return
 */
public static Vector<CollectionInfo> getCollectionInfoList(final Connection oldDBConn,
        final boolean doSkipCheck) {
    //collectionInfoList.clear();
    if (collectionInfoList.isEmpty()) {

        String hostTaxonID = "SELECT Count(tn.TaxonomicUnitTypeID) FROM habitat h "
                + "INNER JOIN taxonname tn ON h.HostTaxonID = tn.TaxonNameID WHERE tn.TaxonomyTypeId = ";

        /*String sql = "SELECT cot.CollectionObjectTypeID, cot.CollectionObjectTypeName, csd.CatalogSeriesDefinitionID, csd.CatalogSeriesID FROM collectionobjecttype cot " +
                 "INNER JOIN catalogseriesdefinition csd on " + 
                 "csd.ObjectTypeId = cot.CollectionObjectTypeId WHERE cot.Category = 'Biological' ORDER BY cot.CollectionObjectTypeID, csd.CatalogSeriesID";
        */

        String catSeriesSQL = "SELECT SeriesName, CatalogSeriesPrefix, Remarks, LastEditedBy FROM catalogseries WHERE CatalogSeriesID = ";

        String cntTaxonName = "SELECT COUNT(TaxonNameID) FROM taxonname WHERE TaxonName IS NOT NULL AND TaxonomyTypeId = ";

        String colObjCountPerCatSeriesSQL = "SELECT COUNT(cc.CatalogSeriesID) " + //, cc.CatalogSeriesID, cs.SeriesName " +
                "FROM collectionobjectcatalog cc INNER JOIN catalogseries cs ON cc.CatalogSeriesID = cs.CatalogSeriesID "
                + "WHERE cs.CatalogSeriesID = %d GROUP BY cs.CatalogSeriesID";

        String colObjDetCountPerCatSeriesSQL = "SELECT COUNT(cc.CatalogSeriesID) "
                + "FROM determination d INNER JOIN collectionobject co ON d.BiologicalObjectID = co.CollectionObjectID "
                + "INNER JOIN collectionobjectcatalog cc ON co.CollectionObjectID = cc.CollectionObjectCatalogID "
                + "WHERE cc.CatalogSeriesID = %d AND d.TaxonNameID IS NOT NULL GROUP BY cc.CatalogSeriesID";

        String colObjCatSeriesSQL = "SELECT cot.CollectionObjectTypeID, cot.CollectionObjectTypeName, csd.CatalogSeriesDefinitionID, csd.CatalogSeriesID FROM collectionobjecttype cot "
                + "INNER JOIN catalogseriesdefinition csd on csd.ObjectTypeId = cot.CollectionObjectTypeId "
                + "WHERE cot.Category = 'Biological' ORDER BY cot.CollectionObjectTypeID, csd.CatalogSeriesID";

        Statement stmt = null;

        try {
            pw = new PrintWriter(String.format("sql_%d.log", pwPassCnt++));

            log.debug(colObjCatSeriesSQL);
            logSQL("ColObj Cat Series", colObjCatSeriesSQL);

            HashSet<Integer> taxonTypeIdHash = new HashSet<Integer>();

            stmt = oldDBConn.createStatement();
            ResultSet rs = stmt.executeQuery(colObjCatSeriesSQL);
            while (rs.next()) {
                CollectionInfo info = new CollectionInfo(oldDBConn);

                Integer colObjTypeID = rs.getInt(1);
                pw.println(String.format(
                        "%d ================================================================================",
                        colObjTypeID));

                System.err.println("ColObjType: " + colObjTypeID);

                info.setColObjTypeId(colObjTypeID);
                info.setColObjTypeName(rs.getString(2));
                info.setCatSeriesDefId(rs.getInt(3));
                info.setCatSeriesId(rs.getInt(4));

                String sql = String.format(colObjCountPerCatSeriesSQL, info.getCatSeriesId());
                log.debug(sql);
                logSQL("ColObj Count Per Cat Series", sql);

                int colObjCnt = BasicSQLUtils.getCountAsInt(oldDBConn, sql);
                info.setColObjCnt(colObjCnt);

                sql = String.format(colObjDetCountPerCatSeriesSQL, info.getCatSeriesId());
                log.debug(sql);
                logSQL("ColObj Count Determinations Per Cat Series", sql);

                info.setColObjDetTaxCnt(BasicSQLUtils.getCountAsInt(oldDBConn, sql));

                sql = catSeriesSQL + info.getCatSeriesId();
                log.debug(sql);
                logSQL("Cat Series", sql);

                Vector<Object[]> rows = BasicSQLUtils.query(oldDBConn, sql);
                if (rows != null && rows.size() == 1) {
                    Object[] row = rows.get(0);

                    info.setCatSeriesName((String) row[0]);
                    info.setCatSeriesPrefix((String) row[1]);
                    info.setCatSeriesRemarks((String) row[2]);
                    info.setCatSeriesLastEditedBy((String) row[3]);

                } else {
                    log.error("Error getting CollectionInfo for CollectionObjectTypeID: " + rs.getInt(1)
                            + " number of CatlogSeries: " + rows.size());
                }

                if (!doSkipCheck) {
                    String detSQLStr = "SELECT ct.TaxonomyTypeID, (select distinct relatedsubtypevalues FROM usysmetacontrol c "
                            + "LEFT JOIN usysmetafieldsetsubtype fst ON fst.fieldsetsubtypeid = c.fieldsetsubtypeid "
                            + "WHERE objectid = 10290 AND ct.taxonomytypeid = c.relatedsubtypevalues) AS DeterminationTaxonType "
                            + "FROM collectiontaxonomytypes ct WHERE ct.biologicalobjecttypeid = "
                            + info.getColObjTypeId();
                    log.debug(detSQLStr);
                    logSQL("Checking USYS data", detSQLStr);

                    Vector<Object[]> detRows = BasicSQLUtils.query(oldDBConn, detSQLStr);
                    for (Object[] row : detRows) {
                        Integer txnTypeId = (Integer) row[0];
                        String detTxnTypes = (String) row[1];
                        if (detTxnTypes == null) {
                            detTxnTypes = Integer.toString(txnTypeId);
                        }

                        if (StringUtils.isNotEmpty(detTxnTypes)) {
                            String txNameSQL = "SELECT TaxonomyTypeName FROM taxonomytype WHERE TaxonomyTypeID = ";
                            logSQL("Getting Taxon Type Name", txNameSQL + txnTypeId);

                            if (StringUtils.contains(detTxnTypes, ',')) {
                                StringBuilder sb = new StringBuilder();
                                String[] toks = StringUtils.split(detTxnTypes, ',');

                                String dtName = BasicSQLUtils.querySingleObj(oldDBConn, txNameSQL + txnTypeId);
                                sb.append(String.format(
                                        "Warning - There are %d DeterminationTaxonTypes for TaxonObjectType %d (%s) they are:\n",
                                        toks.length, txnTypeId, dtName));
                                for (String id : toks) {
                                    logSQL("Getting Taxon Type Name", txNameSQL + id);
                                    String name = BasicSQLUtils.querySingleObj(oldDBConn, txNameSQL + id);
                                    sb.append(id);
                                    sb.append(" - ");
                                    sb.append(name);
                                    sb.append("\n");
                                }
                                sb.append(
                                        "\nThis database will need to be fixed by hand before it can be converted.");
                                UIRegistry.showError(sb.toString());
                                System.exit(0);
                                askForFix = true;
                                return null;

                            } else if (StringUtils.isNumeric(detTxnTypes.trim())) {
                                Integer txnType = Integer.parseInt(detTxnTypes);
                                if (!txnType.equals(txnTypeId)) {
                                    String tName = BasicSQLUtils.querySingleObj(oldDBConn, txNameSQL + txnType);
                                    String dtName = BasicSQLUtils.querySingleObj(oldDBConn,
                                            txNameSQL + txnTypeId);
                                    StringBuilder sb = new StringBuilder();
                                    sb.append(String.format(
                                            "Warning - The TaxonObjectType %d (%s) in the DeterminationTaxonTypes field\ndoesn't match the actual TaxonObjectType %d (%s)",
                                            txnType, tName, txnTypeId, dtName));
                                    UIRegistry.showError(sb.toString());
                                    askForFix = true;
                                    return null;
                                }
                            }
                        }
                    }
                }

                /*info.setDeterminationTaxonType(detTxnTypeStr);
                for (Integer id : info.getDetTaxonTypeIdList())
                {
                log.debug("ID: "+id);
                }*/

                // This represents a mapping from what would be the Discipline (Biological Object Type) to the Taxonomic Root
                sql = String.format(
                        "SELECT tt.TaxonomyTypeID, tt.TaxonomyTypeName, tt.KingdomID, tn.TaxonNameID, tn.TaxonName, tu.TaxonomicUnitTypeID FROM taxonomytype AS tt "
                                + "INNER JOIN taxonomicunittype AS tu ON tt.TaxonomyTypeID = tu.TaxonomyTypeID "
                                + "INNER JOIN taxonname AS tn ON tu.TaxonomyTypeID = tn.TaxonomyTypeID "
                                + "INNER JOIN collectiontaxonomytypes AS ct ON tn.TaxonomyTypeID = ct.TaxonomyTypeID "
                                + "WHERE tu.RankID =  0 AND tn.RankID =  0 AND ct.BiologicalObjectTypeID = %d "
                                + "ORDER BY ct.BiologicalObjectTypeID ASC",
                        info.getColObjTypeId());
                log.debug(sql);
                logSQL("Taxon -> Coll Taxon Types", sql);

                rows = BasicSQLUtils.query(oldDBConn, sql);
                if (rows != null) {
                    Object[] row = rows.get(0);

                    int taxonomyTypeID = (Integer) row[0];

                    info.setTaxonomyTypeId(taxonomyTypeID);
                    info.setTaxonomyTypeName((String) row[1]);
                    info.setKingdomId((Integer) row[2]);
                    info.setTaxonNameId((Integer) row[3]);
                    info.setTaxonName((String) row[4]);
                    info.setTaxonomicUnitTypeID((Integer) row[5]);

                    info.setTaxonNameCnt(BasicSQLUtils.getCountAsInt(oldDBConn, cntTaxonName + taxonomyTypeID));

                    log.debug("TaxonomyTypeName: " + info.getTaxonomyTypeName() + "  TaxonName: "
                            + info.getTaxonName() + "  TaxonomyTypeId: " + info.getTaxonomyTypeId());

                    sql = hostTaxonID + taxonomyTypeID;
                    log.debug(sql);
                    Vector<Object> ttNames = BasicSQLUtils.querySingleCol(oldDBConn, sql);
                    if (ttNames != null && ttNames.size() > 0 && ((Long) ttNames.get(0)) > 0) {
                        info.setSrcHostTaxonCnt((Long) ttNames.get(0));
                    } else {
                        info.setSrcHostTaxonCnt(0);
                    }

                    taxonTypeIdHash.add(taxonomyTypeID);

                } else {
                    log.error("Error getting CollectionInfo for CollectionObjectTypeID: " + rs.getInt(1));
                }

                collectionInfoList.add(info);
                //System.out.println(info.toString());
            }
            rs.close();

            // Here we figure out whether a Taxon Tree that is used by HostTaxonID is associated with a Collection.
            String sql = "SELECT DISTINCT tt.TaxonomyTypeID, tt.TaxonomyTypeName FROM habitat AS h "
                    + "INNER JOIN taxonname AS tn ON h.HostTaxonID = tn.TaxonNameID "
                    + "INNER JOIN taxonomytype AS tt ON tn.TaxonomyTypeID = tt.TaxonomyTypeID";
            logSQL("Check for HostID", sql);

            Vector<Integer> txTypeIds = BasicSQLUtils.queryForInts(oldDBConn, sql);

            HashSet<Integer> txnTypeIdHashSet = new HashSet<Integer>();
            for (Integer txTypId : txTypeIds) {
                Boolean hasColInfo = false;
                for (CollectionInfo colInfo : collectionInfoList) {
                    if (colInfo.getTaxonomyTypeId().equals(txTypId)) {
                        hasColInfo = true;
                    }
                }

                if (!hasColInfo) {
                    txnTypeIdHashSet.add(txTypId);
                }
            }

            // These TaxonTypeIds do not have CollectionInfo
            for (Iterator<Integer> iter = txnTypeIdHashSet.iterator(); iter.hasNext();) {
                Integer taxonomyTypeID = iter.next();
                System.out.println(taxonomyTypeID);

                sql = "SELECT tt.TaxonomyTypeName, tn.TaxonName, tt.KingdomID, tn.TaxonNameID, tn.TaxonomicUnitTypeID FROM taxonomytype AS tt "
                        + "INNER JOIN taxonomicunittype AS tut ON tt.TaxonomyTypeID = tut.TaxonomyTypeID "
                        + "INNER JOIN taxonname AS tn ON tt.TaxonomyTypeID = tn.TaxonomyTypeID AND tut.TaxonomicUnitTypeID = tn.TaxonomicUnitTypeID "
                        + "WHERE tt.TaxonomyTypeID =  " + taxonomyTypeID + " AND tn.RankID =  0";
                log.debug(sql);
                logSQL("Get TaxonTypeName etc from TaxonomyTypeID and RankID = 0", sql);

                Vector<Object[]> rows = BasicSQLUtils.query(oldDBConn, sql);
                if (rows.size() != 1) {
                    String msg = "There should only be '1' TaxonTypeName for  TaxonomyTypeID:" + taxonomyTypeID;
                    log.error(msg);
                    UIRegistry.showError(msg);
                    continue;
                }

                CollectionInfo colInfo = new CollectionInfo(oldDBConn);

                String taxonTypeName = (String) rows.get(0)[0];
                String taxonRootName = (String) rows.get(0)[1];
                if (StringUtils.isEmpty(taxonRootName)) {
                    taxonRootName = taxonTypeName;
                }

                //colInfo.setColObjTypeId();
                colInfo.setColObjTypeName(taxonRootName);
                //colInfo.setCatSeriesDefId(rs.getInt(3));
                //colInfo.setCatSeriesId(rs.getInt(4));

                colInfo.setCatSeriesName(taxonRootName);
                colInfo.setCatSeriesPrefix("");
                colInfo.setCatSeriesRemarks("");
                colInfo.setCatSeriesLastEditedBy("");

                colInfo.setColObjCnt(1);
                colInfo.setColObjDetTaxCnt(1);

                colInfo.setTaxonomyTypeId(taxonomyTypeID);
                colInfo.setTaxonomyTypeName(taxonTypeName);
                colInfo.setKingdomId((Integer) rows.get(0)[2]);
                colInfo.setTaxonNameId((Integer) rows.get(0)[3]);
                colInfo.setTaxonName(taxonRootName);
                colInfo.setTaxonomicUnitTypeID((Integer) rows.get(0)[4]);

                colInfo.setTaxonNameCnt(BasicSQLUtils.getCountAsInt(oldDBConn, cntTaxonName + taxonomyTypeID));

                colInfo.setSrcHostTaxonCnt(0);

                collectionInfoList.add(colInfo);
            }

            // Do All
            /*String sqlAllTx = "SELECT cot.CollectionObjectTypeID, cot.CollectionObjectTypeName, tt.TaxonomyTypeID, tt.TaxonomyTypeName, tt.KingdomID, tn.TaxonNameID, tn.TaxonName, tn.TaxonomicUnitTypeID " + 
                          "FROM collectionobjecttype AS cot " +
                          "INNER JOIN collectiontaxonomytypes as ctt ON cot.CollectionObjectTypeID = ctt.BiologicalObjectTypeID " + 
                          "INNER JOIN taxonomytype as tt ON ctt.TaxonomyTypeID = tt.TaxonomyTypeID " + 
                          "INNER JOIN taxonname as tn ON tt.TaxonomyTypeID = tn.TaxonomyTypeID " + 
                          "WHERE  cot.Category = 'Biological' AND tn.ParentTaxonNameID IS NULL";
                    
            log.debug(sqlAllTx);
            Vector<Object[]> rows = BasicSQLUtils.query(oldDBConn, sqlAllTx);
            for (Object[] row : rows)
            {
            int taxonomyTypeID = (Integer)row[2];
            if (taxonTypeIdHash.get(taxonomyTypeID) == null)
            {
                CollectionInfo info = new CollectionInfo(oldDBConn);
                        
                info.setColObjTypeId((Integer)row[0]);
                info.setColObjTypeName((String)row[1]);
                info.setCatSeriesDefId(null);
                info.setCatSeriesId(null);
                info.setCatSeriesName("");
                info.setCatSeriesPrefix("");
                info.setCatSeriesRemarks("");
                info.setCatSeriesLastEditedBy("");
                        
                info.setTaxonomyTypeId(taxonomyTypeID);
                info.setTaxonomyTypeName((String)row[3]);
                info.setKingdomId((Integer)row[4]);
                info.setTaxonNameId((Integer)row[5]);
                info.setTaxonName((String)row[6]);
                        
                info.setTaxonomicUnitTypeID((Integer)row[7]);
                        
                info.setTaxonNameCnt(BasicSQLUtils.getCountAsInt(oldDBConn, cntTaxonName + taxonomyTypeID));
                        
                Vector<Object> ttNames = BasicSQLUtils.querySingleCol(oldDBConn, hostTaxonID + taxonomyTypeID);
                if (ttNames != null && ttNames.size() > 0 && ((Long)ttNames.get(0)) > 0)
                {
                    info.setSrcHostTaxonCnt((Long)ttNames.get(0));
                } else
                {
                    info.setSrcHostTaxonCnt(0);
                }
                        
                taxonTypeIdHash.put(taxonomyTypeID, true);
                        
                collectionInfoList.add(info);
            }
            }*/

            dump();

        } catch (Exception ex) {
            ex.printStackTrace();
            try {
                if (stmt != null) {
                    stmt.close();
                }
            } catch (Exception e) {
            }

        } finally {
            if (pw != null)
                pw.close();
        }
    }

    Collections.sort(collectionInfoList);

    return collectionInfoList;
}

From source file:gsn.http.A3DWebServiceImpl.java

public String[] getSensors() {
    Iterator<VSensorConfig> vsIterator = Mappings.getAllVSensorConfigs();

    Vector<String> sensors = new Vector<String>();

    while (vsIterator.hasNext()) {
        VSensorConfig sensorConfig = vsIterator.next();
        sensors.add(sensorConfig.getName());
    }/*from  w  w w . j a  v a 2s. co  m*/
    String v_sensors[] = new String[sensors.size()];
    for (int i = 0; i < sensors.size(); i++)
        v_sensors[i] = sensors.get(i);

    return v_sensors;
}

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

/** Process a Vector of TradeUpdate objects. Send out both the invalid updates and
 *  the valid offer book updates. Return an array of Responses, one corresponding
 *  to each tradeUpdate object */
public Response[] sendTradeUpdates(int periodNum, Vector tradeUpdates) {
    Response[] responses = new Response[tradeUpdates.size()];

    for (int i = 0; i < tradeUpdates.size(); i++) {
        TradeUpdate tupdate = (TradeUpdate) tradeUpdates.get(i);
        int type = tupdate.getType();
        int client = tupdate.getClient();

        if (type == TradeUpdate.INVALID_OFFER_UPDATE) {
            String msg = tupdate.getErrorMsg();
            String code = tupdate.getCode();

            responses[i] = sendInvalidOfferUpdate(client, periodNum, msg, code);
        } else {/* w ww  .  j  ava2s. com*/
            responses[i] = sendOfferBookUpdate(client, tupdate);
        }
    }
    return responses;
}

From source file:com.alvermont.terraj.util.ui.HiddenTableModel.java

/**
 * Add a new set of column values to this table, initialized from a vector
 * of values.//from   w  w  w. ja v a  2 s  .c o  m
 *
 * @param name The name of the column
 * @param columnClass The <code>Class</code> that items in this column will be
 * @param values The values to be assigned in the new column, row by row
 */
protected void addColumnValue(String name, Class columnClass, Vector values) {
    this.columnNames.add(name);
    this.columnsVisible.add(Boolean.TRUE);
    this.columnClasses.add(columnClass);

    for (int r = 0; r < this.data.size(); ++r) {
        final List<Object> l = this.data.get(r);

        l.add(values.get(r));
    }

    fireTableChanged(new TableModelEvent(this));
}

From source file:edu.umn.natsrl.evaluation.ContourPlotter.java

private boolean createContourPlot() {

    if (chart != null) {
        return true;
    }//from   www .j  av a 2 s. c o m

    if (this.cv == null || this.ncv == 0 || this.colors == null) {
        return false;
    }

    String date = null;
    Vector<EvaluationResult> results = (Vector<EvaluationResult>) this.eval.getResult().clone();

    if (results.size() > 2) {
        date = "  [average of " + (results.size() - 1) + " days]";
    } else {
        date = "  [" + results.get(0).getName() + "]";
    }

    final String title = section.getName() + date;
    final String xAxisLabel = "";
    final String yAxisLabel = "";
    final String zAxisLabel = "";

    this.xAxis = new NumberAxis(xAxisLabel);
    this.yAxis = new NumberAxis(yAxisLabel);
    this.zColorBar = new ColorBar(zAxisLabel);

    if (this.xAxis instanceof NumberAxis) {
        ((NumberAxis) this.xAxis).setAutoRangeIncludesZero(false);
    }

    this.yAxis.setAutoRangeIncludesZero(false);

    this.yAxis.setStreetName(this.streetNames);
    ((NumberAxis) this.xAxis).setTime(this.plotTimes);
    ((NumberAxis) this.zColorBar.getAxis()).setColor(cv, unit);
    ((NumberAxis) this.xAxis).setLowerMargin(0.0);
    ((NumberAxis) this.xAxis).setUpperMargin(0.0);

    this.yAxis.setLowerMargin(0.0);
    this.yAxis.setUpperMargin(0.0);
    this.xAxis.setRange(0, numX - 1);
    this.yAxis.setRange(0, numY - 1);
    this.zColorBar.getAxis().setTickMarksVisible(true);

    final ContourDataset data = createDataset();
    //        for(Number n : data.getZValues()) {
    //            System.out.println("Data=" + n);
    //        }
    final ContourPlot plot = new ContourPlot(data, this.xAxis, this.yAxis, this.zColorBar, ncv);

    plot.SetContourValue(cv, ncv, colors, numX, numY);
    plot.setDataAreaRatio(ratio);

    chart = new JFreeChart(title, null, plot, false);
    chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 0, 1000, Color.white));

    return true;
}

From source file:Ventanas.VentanaVerGrafico.java

private CategoryDataset createCategoryDataset(Vector items) {
    int size = items.size();
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    {/*from  w ww. ja  va2 s  .  com*/
        botonVolverVerGrafica = new JButton();
        this.getContentPane().add(botonVolverVerGrafica);
        botonVolverVerGrafica.setText("Volver");
        botonVolverVerGrafica.setBounds(300, 512, 97, 30);
        botonVolverVerGrafica.addActionListener(this);
    }
    for (int i = 0; i < size; i++) {
        Vector item = (Vector) items.get(i);
        String series1 = "N entradas+salidas";
        String series2 = "N articulos E+S";
        String series3 = "Tiempo Trabajado(Minutos)";
        int rowcount = item.size();
        for (int cuenta = 0; cuenta < rowcount; cuenta++) {
            dataset.addValue(Integer.parseInt("" + item.get(1)), series1, "" + item.get(0));
            dataset.addValue(Integer.parseInt("" + item.get(2)), series2, "" + item.get(0));
            dataset.addValue(Integer.parseInt("" + item.get(3)), series3, "" + item.get(0));
        }
    }
    return dataset;
}