Package org.apache.commons.collections15.bag

Examples of org.apache.commons.collections15.bag.HashBag


      public String transform(String input) {
        return "<html><center>Vertex<p>"+input;
      }}}));
    vv.getRenderContext().setVertexShapeTransformer(vlasr);
    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.red));
    vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.yellow));
    vv.getRenderContext().setEdgeStrokeTransformer(new ConstantTransformer(new BasicStroke(2.5f)));
   
    // customize the renderer
    vv.getRenderer().setVertexRenderer(new GradientVertexRenderer<String,StringBuffer>(Color.gray, Color.white, true));
    vv.getRenderer().setVertexLabelRenderer(vlasr);
View Full Code Here


      else if (object instanceof Enumeration)
         return new EnumerationIterator( (Enumeration) object);
      else if (object instanceof Collection)
         return ((Collection)object).iterator();
      else if (object.getClass().isArray())
         return new ArrayIterator(object);
      else
         return new SingletonIterator(object);
   }
View Full Code Here

      else if (object instanceof List)
         return (List) object;
      else if (object instanceof Collection)
         return new ArrayList((Collection)object);
      else if (object.getClass().isArray())
         return toList(new ArrayIterator(object), context);
      else
         return Arrays.asList( object);
        
   }
View Full Code Here

      if (object == null)
         return EmptyIterator.getInstance();
      else if (object instanceof Iterator)
         return (Iterator) object;
      else if (object instanceof Enumeration)
         return new EnumerationIterator( (Enumeration) object);
      else if (object instanceof Collection)
         return ((Collection)object).iterator();
      else if (object.getClass().isArray())
         return new ArrayIterator(object);
      else
View Full Code Here

        
   }

   public Enumeration toEnumeration(Object objects, InvocationContext context)
   {
      return new IteratorEnumeration(toIterator(objects, context));
   }
View Full Code Here

      else if (object instanceof Collection)
         return ((Collection)object).iterator();
      else if (object.getClass().isArray())
         return new ArrayIterator(object);
      else
         return new SingletonIterator(object);
   }
View Full Code Here

  @SuppressWarnings("unchecked")
  private List<InfoSaison> preMergeInfosSaison(
      final List<InfoSaison> infosSaison1,
      final List<InfoSaison> infosSaison2)
  {
    final MultiKeyMap mkMap = new MultiKeyMap();

    preMergeInfosSaison(infosSaison1, mkMap);
    preMergeInfosSaison(infosSaison2, mkMap);

    return new Vector<InfoSaison>(mkMap.values());
  }
View Full Code Here

     * Override to return a map other than HashMap as the confirmed map.
     *
     * @return a map that is known to be valid
     */
    public MultiMap makeConfirmedMap() {
        return new MultiHashMap();
    }
View Full Code Here

  }

  //loads the files and removes words which occur less than 5 tims
  public void loadProgram() throws FileNotFoundException
  {
    Bag wordBag = new HashBag();

    //Load all the medical files in the directory
    File[] fileList = new File(recordsDir).listFiles();
    for (int i = 0; i<fileList.length; i++) {
      loadFile(fileList[i].toString(), wordBag);
    }

    //dump bag into frequent who appear in 5 or more medical records
    for (Object obj : wordBag.uniqueSet()) {
      if (wordBag.getCount(obj) > 4){
        frequent.add((String)obj);
      }
    }

  }
View Full Code Here



    //put entries in bag to get count
    String entryBuilder;
    Bag <String> bagOfEntries = new <String>HashBag();
    for (ArrayList<String> temp : output)
    {
      entryBuilder = "";
      for (String tempWord : temp)
      {
        String scrap = tempWord + " ";
        entryBuilder += scrap;
      }
      bagOfEntries.add(entryBuilder);
    }

    //make a map with values - count and keys - string and sort by frequency
    Map<String, Integer> frequentWords = new <String, Integer>HashMap();
    for (String pattern : bagOfEntries.uniqueSet()) {
      frequentWords.put(pattern, bagOfEntries.getCount(pattern));
    }
    Map.Entry<String, Integer>[] entries = frequentWords.entrySet().toArray(new Map.Entry[0]);
    Arrays.sort(entries, new Comparator<Map.Entry<String, Integer>>() {
        public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
          return o2.getValue().compareTo(o1.getValue());
View Full Code Here

TOP

Related Classes of org.apache.commons.collections15.bag.HashBag

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.