Package java.util

Examples of java.util.TreeSet


        this.allowManualColScale = allowManualColScale;
    }
   
    /** Returns the maximum value of all datasets.  */
    public Number getMaximumValue() {
        TreeSet ordered_values = (TreeSet)model.getOrderedValues(axis);
       
        if(ordered_values.size() == 0)
            return new Integer(1);
        else if(model.isManualScale()) {
            //System.out.println("** model.getManualMaximumValue() = "+model.getManualMaximumValue());
            return model.getManualMaximumValue();
        }
        else if(model.isAutoScale()) {
            double min = ((Number)ordered_values.first()).doubleValue();
            double max = ((Number)ordered_values.last()).doubleValue();
           
            //System.out.println("** min = "+min+"  max = "+max);
           
            if(min / max > 0.95) {
                //System.out.println("** ChartUtilities.performAutoScale(min/2, 2 * max)[1]"+ChartUtilities.performAutoScale(min/2, 2 * max)[1]);
                return new Double(ChartUtilities.performAutoScale(min/2,
                                                                  2 * max)[1]);
             }
            else {
                //System.out.println("** ChartUtilities.performAutoScale(min, max)[1]"+ChartUtilities.performAutoScale(min, max)[1]);
                return new Double(ChartUtilities.performAutoScale(min,
                                                              max)[1]);
             }
        } else
            return (Number)ordered_values.last();
    }   
View Full Code Here


            return (Number)ordered_values.last();
    }   

    /** Returns the minimum value of all datasets.  */
    public Number getMinimumValue() {
        TreeSet ordered_values = (TreeSet)model.getOrderedValues(axis);

        if(ordered_values.size() == 0)
            return new Integer(0);
        else if(model.isManualScale()) {
            //System.out.println("** model.getManualMinimumValue() = "+model.getManualMinimumValue());
            return model.getManualMinimumValue();
        }
        else if(model.isAutoScale()) {
            double min = ((Number)ordered_values.first()).doubleValue();
            double max = ((Number)ordered_values.last()).doubleValue();

            //System.out.println("** min = "+min+"  max = "+max);
           
            if(min / max > 0.95) {
                //System.out.println("** ChartUtilities.performAutoScale(min/2, 2 * max)[0]"+ChartUtilities.performAutoScale(min/2, 2 * max)[0]);
                return new Double(ChartUtilities.performAutoScale(min/2,
                                                                  2 * max)[0]);
             }
            else {
                //System.out.println("** ChartUtilities.performAutoScale(min, max)[0]"+ChartUtilities.performAutoScale(min, max)[0]);
                return new Double(ChartUtilities.performAutoScale(min,
                                                              max)[0]);
             }
        } else               
           return (Number)ordered_values.first();
    }
View Full Code Here

     */
    public ObjectChartDataModel() {
        data = new DefaultDataSet[0];
        columns = new Object[0];
       
        TreeSet set1 = new TreeSet();
        valuesbyaxis.put(new Integer(CoordSystem.FIRST_YAXIS), set1);
       
        TreeSet set2 = new TreeSet();
        valuesbyaxis.put(new Integer(CoordSystem.SECOND_YAXIS), set2);
       
        constraints1 = new DefaultChartDataModelConstraints(this, CoordSystem.FIRST_YAXIS, false);
        constraints2 = new DefaultChartDataModelConstraints(this, CoordSystem.SECOND_YAXIS, false);
    }
View Full Code Here

       
        this.columns = columns;
       
        this.data = new DefaultDataSet[data.length];
       
        TreeSet set =
            (TreeSet)valuesbyaxis.get(new Integer(CoordSystem.FIRST_YAXIS));
               
        ChartUtilities.addDataToSet(set, data);
       
        for(int i = 0; i < data.length; i++) {
View Full Code Here

       
        this.columns = columns;
       
        this.data = new DefaultDataSet[data.length];
       
        TreeSet set =
            (TreeSet)valuesbyaxis.get(new Integer(CoordSystem.FIRST_YAXIS));
       
        ChartUtilities.addDataToSet(set, numdata);
       
        for(int i = 0; i < data.length; i++) {
View Full Code Here

       
        this.columns = columns;
       
        this.data = new DefaultDataSet[data.length];
       
        TreeSet set =
            (TreeSet)valuesbyaxis.get(new Integer(CoordSystem.FIRST_YAXIS));
       
        ChartUtilities.addDataToSet(set, numdata);
       
        for(int i = 0; i < data.length; i++) {
View Full Code Here

    public ObjectChartDataModel(DataSet[] ds, Object[] columns) {
        this();
        data = ds;
        this.columns = columns;
       
        TreeSet set;
     
        HashMap map = new HashMap();
       
        for(int i = 0; i < ds.length; i++) {
            map.clear();
            Number[] numdata = new Number[columns.length];
           
            for(int j = 0; j < columns.length; j++)
                map.put(columns[j], new Double(Double.NaN));
     
            set = (TreeSet)valuesbyaxis.get(new Integer(ds[i].getYAxis()));
           
            for(int j = 0; j < ds[i].getDataSetLength(); j++) {
                map.put(ds[i].getColumnValueAt(j), ds[i].getValueAt(j));
                set.add(ds[i].getValueAt(j));
            }
         
            for(int j = 0; j < columns.length; j++) {
                numdata[j] = (Number)map.get(columns[j]);
            }
View Full Code Here

        AboutFieldTableModel modelproperties = new AboutFieldTableModel();
        jTableProperties.setModel(modelproperties);

        try {
            Enumeration props = System.getProperties().propertyNames();
            SortedSet s = new TreeSet();
            while (props.hasMoreElements()) {
                s.add((String) props.nextElement());
            }
            Iterator i = s.iterator();
            while (i.hasNext()) {
                String prop = (String) i.next();
                modelproperties.addField(new SystemInfo(prop, System
                        .getProperty(prop)));
            }
View Full Code Here

       */
      public Enumeration getLocales()
      {
         // TODO: cache result
         String al = getHeader(ACCEPT_LANGUAGE);
         TreeSet ts = new TreeSet();
         if (al != null)
         {
            // System.err.println("Accept lang:"+al);
            StringTokenizer st = new StringTokenizer(al, ";", false);
            try
            {
               while (st.hasMoreTokens())
               {
                  String langs = st.nextToken(";");
                  // System.err.println("Langs:"+langs);
                  String q = st.nextToken(";=");
                  // System.err.println("q:"+q);
                  q = st.nextToken("=,");
                  // System.err.println("q:"+q);
                  float w = 0;
                  try
                  {
                     w = Float.valueOf(q).floatValue();
                  }
                  catch (NumberFormatException nfe)
                  {
                  }
                  if (w > 0)
                  {
                     StringTokenizer lst = new StringTokenizer(langs, ", ", false);
                     while (lst.hasMoreTokens())
                     {
                        String lan = lst.nextToken();
                        int di = lan.indexOf('-');
                        if (di < 0)
                           ts.add(new LocaleWithWeight(new Locale(lan.trim()) /* 1.4 */, w));
                        else
                           ts.add(new LocaleWithWeight(new Locale(lan.substring(0, di), lan.substring(di + 1)
                                   .trim().toUpperCase()), w));
                     }
                  }
               }
            }
            catch (NoSuchElementException ncee)
            {
               // can't parse
            }
         }
         if (ts.size() == 0)
            ts.add(new LocaleWithWeight(Locale.getDefault(), 1));
         return new AcceptLocaleEnumeration(ts);
      }
View Full Code Here

        {
            // Normal persistence
            // Put the classes into a sorter so we make sure we get the initial implementations first followed
            // by any subclasses of these implementations. This is needed because when generating the schema we require
            // the subclass implementations to already have their datastore column created
            Collection classesSorted = new TreeSet(new InterfaceClassComparator());
            Iterator classesIter = classes.iterator();
            while (classesIter.hasNext())
            {
                classesSorted.add(classesIter.next());
            }

            // Return the class names (in the same order)
            String[] classNames = new String[classesSorted.size()];
            Iterator iter = classesSorted.iterator();
            int i = 0;
            while (iter.hasNext())
            {
                classNames[i++] = ((Class)iter.next()).getName();
            }
View Full Code Here

TOP

Related Classes of java.util.TreeSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.