Examples of TreeSet


Examples of java.util.TreeSet

            if (this.single_content != null) {
                if (!this.auto_order) {
                    this.contents = new ArrayList();
                }
                else {
                    this.contents = new TreeSet(CONTENT_COMPARATOR);
                }
                this.contents.add(this.single_content);
                this.single_content = null;
            }
        }
View Full Code Here

Examples of java.util.TreeSet

        if (mode == this.auto_order) return;
        this.auto_order = mode;
        if (this.contents == null) return;
        Collection previous_contents = contents;
        if (this.auto_order) {
            this.contents = new TreeSet(CONTENT_COMPARATOR);
            this.contents.addAll(previous_contents);
        }
        else {
            this.contents = new ArrayList(previous_contents);
        }
View Full Code Here

Examples of java.util.TreeSet

     * the server.
     */
    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

Examples of java.util.TreeSet

    }

    SearchCollection scol = new SearchCollection();
    ArrayList list = scol.getSearchCollection(powerEditString);

    Set globalSet = new TreeSet();

    StringBuffer newsb = new StringBuffer();
    newsb.append(" And ( 1 =1 ");
    String searchClause = "";

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

      String srecord = (String)list.get(i);
      SearchRecord aa = new SearchRecord(this.dataSource);
      aa.setPowerString(srecord);
      String tableName = aa.getTable();
      if (tableName != null)
        tableName = tableName.trim();
      String columnName = aa.getColumn();
      if (columnName != null)
        columnName = columnName.trim();

      String condition = aa.getCondition();
      if (condition != null)
        condition = condition.trim();

      String criteria = aa.getCriteria();
      if (criteria != null)
        criteria = criteria.trim();

      String join = aa.getJoin();
      if (join == null)
        join = "AND";

      //      String target = "Entity";
      //      String source = "Address";

      String source = tableName;
      HashMap map = mdir.getQuryData(target, source);
      searchClause = searchClause + (String)map.get("Search");
      Set tablesName = (Set)map.get("Table");

      Object[] objArray = tablesName.toArray();
      for (int j = 0; j < objArray.length; j++)
      {
        globalSet.add((String)objArray[j]);
      }

      String cl = " " + join + " " + tableName + "." + columnName;
      if (condition.equalsIgnoreCase("begins with"))
      {
        cl = cl + "  like  '" + criteria + "%'";
      } else if (condition.equalsIgnoreCase("ends with")) {
        cl = cl + "  like  '%" + criteria + "'";
      } else if (condition.equalsIgnoreCase("contains")) {
        cl = cl + "  like  '%" + criteria + "%'";
      } else if (condition.equalsIgnoreCase("equals")) {
        cl = cl + "  =  '" + criteria + "'";
      } else if (condition.equalsIgnoreCase("less than")) {
        cl = cl + "  <  '" + criteria + "'";
      } else if (condition.equalsIgnoreCase("greater than")) {
        cl = cl + "  <  '" + criteria + "'";
      }
      newsb.append(cl);
    }// end of for
    newsb.append(" ) ");
    String finalSql = " Select " + primaryType + " from ";
    Object[] objArray = globalSet.toArray();
    for (int j = 0; j < objArray.length; j++)
    {
      finalSql = finalSql + " " + (String)objArray[j];
      if (j < objArray.length - 1)
      {
View Full Code Here

Examples of java.util.TreeSet

      else if (clazz.isAssignableFrom(Set.class))
        return new HashSet();
      else if (clazz.isAssignableFrom(Queue.class))
        return new ArrayDeque();
      else if (clazz.isAssignableFrom(SortedSet.class))
        return new TreeSet();
      else if (clazz.isAssignableFrom(BlockingQueue.class))
        return new LinkedBlockingDeque();
      else
        return null;
    } else {
View Full Code Here

Examples of java.util.TreeSet

   *         the HashMap.
   */
  public static ArrayList buildSelectOptionList(HashMap map)
  {
    ArrayList optionList = new ArrayList();
    TreeSet keySet = new TreeSet(map.keySet());
    Iterator keyIterator = keySet.iterator();
    // prepend an empty 0 label to the top of each OptionList
    optionList.add(new LabelValueBean("-- Select --", "0"));
    while (keyIterator.hasNext()) {
      Number key = (Number) keyIterator.next();
      String value = (String) map.get(key);
View Full Code Here

Examples of java.util.TreeSet

        globalReplaceForm.set("conditionList", conditionList);

        // Get all the appropriate field lists and stick them on the formbean
        // The fieldList (ArrayList of LabelValueBean) will be stored in a
        // HashMap with the key being the (Number)tableId
        TreeSet keySet = new TreeSet(tableMap.keySet());
        Iterator keyIterator = keySet.iterator();
        allFields = new HashMap();
        while(keyIterator.hasNext())
        {
          Number key = (Number)keyIterator.next();
          // iterate the tables and get all the field lists
View Full Code Here

Examples of java.util.TreeSet

        globalReplaceForm.set("conditionList", conditionList);

        // Get all the appropriate field lists and stick them on the formbean
        // The fieldList (ArrayList of LabelValueBean) will be stored in a
        // HashMap with the key being the (Number)tableId
        TreeSet keySet = new TreeSet(tableMap.keySet());
        Iterator keyIterator = keySet.iterator();
        allFields = new HashMap();
        while (keyIterator.hasNext()) {
          Number key = (Number)keyIterator.next();
          // iterate the tables and get all the field lists
          // stick them in a hashmap of arraylists on the form bean.
View Full Code Here

Examples of java.util.TreeSet

      advancedSearchForm.set("conditionList", conditionList);

      // Get all the appropriate field lists and stick them on the formbean
      // The fieldList (ArrayList of LabelValueBean) will be stored in a
      // HashMap with the key being the (Number)tableId
      TreeSet keySet = new TreeSet(tableMap.keySet());
      Iterator keyIterator = keySet.iterator();
      allFields = new HashMap();
      while (keyIterator.hasNext()) {
        Number key = (Number)keyIterator.next();
        // iterate the tables and get all the field lists
        // stick them in a hashmap of arraylists on the form bean.
View Full Code Here

Examples of java.util.TreeSet

    }
  }

  @Test
  public void testIsSet() throws Exception {
    Object[] values = new Object[] { new TreeSet(), new HashSet(), new HashSet() };
    for (int i = 0; i < values.length; i++) {
      assertTrue(CollectionUtils.isSet(values[i].getClass()));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.