Examples of Comparator


Examples of ca.coolman.util.Comparator

   */
  protected void readResponse(InputStream input) throws IOException {
    Result result = Result.fromContent(input, Result.JSON);
    Vector tweets = result.getAsArray("/root");
    if (tweets.size() > 0) {
      final Comparator cmp = new StringComparator();
      for (Enumeration e = tweets.elements(); e.hasMoreElements(); ) {
        Result tweet = Result.fromContent((Hashtable)e.nextElement());
        String id = tweet.getAsString("id_str");
        if ((since_id == null) || cmp.compare(id, since_id) > 0) {
          // this is currently causing twitter to response with no tweets.
          //setSinceId(id);
        }
        if ((max_id == null) || cmp.compare(id, max_id) < 0) {
          // first glance you'd think max_id/since_id is backwards, but
          // read the
          // twitter page noted at the top of this class.
          setMaxId(id);
        }
View Full Code Here

Examples of ch.njol.skript.classes.Comparator

      } else {
        Skript.error("Can't compare " + f(first) + " with " + f(second) + (third == null ? "" : " and " + f(third)), ErrorQuality.NOT_AN_EXPRESSION);
        return false;
      }
    }
    @SuppressWarnings("rawtypes")
    final Comparator comp = this.comp;
    if (comp != null) {
      if (third == null) {
        if (!relation.isEqualOrInverse() && !comp.supportsOrdering()) {
          Skript.error("Can't test " + f(first) + " for being '" + relation + "' " + f(second), ErrorQuality.NOT_AN_EXPRESSION);
          return false;
        }
      } else {
        if (!comp.supportsOrdering()) {
          Skript.error("Can't test " + f(first) + " for being 'between' " + f(second) + " and " + f(third), ErrorQuality.NOT_AN_EXPRESSION);
          return false;
        }
      }
    }
View Full Code Here

Examples of com.crawljax.oraclecomparator.Comparator

  }

  @Test
  public void testDateOracle() {

    Comparator oracle = new DateComparator();

    /* dates with days */
    compareTwoDomsWithComparatorEqual("<HTML>Monday 15 march 1998</HTML>",
            "<HTML>Tuesday 13 december 2005</HTML>", oracle);
    compareTwoDomsWithComparatorEqual("<HTML>Monday 1 feb '98</HTML>",
View Full Code Here

Examples of com.daveayan.mirage.comparator.Comparator

  }
 
  private boolean compareObjects(Object objectLeft, Object objectRight) {
    Iterator<Comparator> iter = list_of_comparators.iterator();
    while(iter.hasNext()) {
      Comparator c = iter.next();
      if(c.canCompare(objectLeft, objectRight, this)) {
        return c.compare(objectLeft, objectRight, this);
      }
    }
   
//    return default_comparator.compare(objectLeft, objectRight, this);
    return false;
View Full Code Here

Examples of com.jclark.xsl.util.Comparator

        this.expr = expr;
    }

    public Comparator instantiate(Node node, final ExprContext context)
    {
        return new Comparator() {
                public int compare(Object o1, Object o2) {
                    return cmp.compare(getKey(o1), getKey(o2));
                }
                private String getKey(Object obj) {
                    try {
View Full Code Here

Examples of daveayan.mirage.comparator.Comparator

  }
 
  private boolean compareObjects(Object objectLeft, Object objectRight) {
    Iterator<Comparator> iter = list_of_comparators.iterator();
    while(iter.hasNext()) {
      Comparator c = iter.next();
      if(c.canCompare(objectLeft, objectRight, this)) {
        return c.compare(objectLeft, objectRight, this);
      }
    }
   
//    return default_comparator.compare(objectLeft, objectRight, this);
    return false;
View Full Code Here

Examples of java.util.Comparator

        if (allAppenders != null) {
            //
            // this list has to guarantee the order in which elements are added
            //
            List uniqueList = new LinkedList();
            Comparator cmp = new LogDestinationComparator(all);

            Collections.sort(allAppenders, cmp);
            for (int i = 0; i < allAppenders.size(); i++) {
                LogDestination dest = (LogDestination) allAppenders.get(i);
                if (Collections.binarySearch(uniqueList, dest, cmp) < 0) {
View Full Code Here

Examples of java.util.Comparator

    public List getLogSources() {
        List sources = new LinkedList();

        List allAppenders = getAllLogDestinations();
        if (allAppenders != null) {
            Comparator cmp = new LogSourceComparator();

            Collections.sort(allAppenders, cmp);
            for (int i = 0; i < allAppenders.size(); i++) {
                LogDestination dest = (LogDestination) allAppenders.get(i);
                if (Collections.binarySearch(sources, dest, cmp) < 0) {
View Full Code Here

Examples of java.util.Comparator

            seriesList.add(ser);
        }

        if (useTop) {
            // sorting stats by the avg value to identify the top series
            Collections.sort(seriesList, new Comparator() {
                public int compare(Object o1, Object o2) {
                    Series s1 = (Series) o1;
                    Series s2 = (Series) o2;
                    return s1.avg == s2.avg ? s1.key.compareTo(s2.key) : (s1.avg > s2.avg ? -1 : 1);
                }
            });

            // keeping only the top series in the list
            for (ListIterator i = seriesList.listIterator(getTop()); i.hasNext();) {
                i.next();
                i.remove();
            }
        }

        // sorting the remaining series by name
        Collections.sort(seriesList, new Comparator() {
            public int compare(Object o1, Object o2) {
                return (((Series)o1).key).compareTo(((Series)o2).key);
            }
        });
View Full Code Here

Examples of java.util.Comparator

    try {
      plugins = core.getPluginManager().getPluginInterfaces();
     
      Arrays.sort(
          plugins,
        new Comparator()
      {
            public int
        compare(
          Object o1,
          Object o2)
            {
              return(((PluginInterface)o1).getPluginName().compareTo(((PluginInterface)o2).getPluginName()));
            }
      });
    } catch(final Exception e) {
     
      Debug.printStackTrace(e);
    }
    
      // one "plugin" can have multiple interfaces. We need to group by their id
   
    Map  pid_map = new HashMap();
   
    for(int i = 0 ; i < plugins.length ; i++){
     
        PluginInterface plugin = plugins[i];
               
        String  pid   = plugin.getPluginID();
       
        ArrayList  pis = (ArrayList)pid_map.get( pid );
       
        if ( pis == null ){
         
          pis = new ArrayList();
         
          pid_map.put( pid, pis );
        }
       
        pis.add( plugin );
    }
   
    ArrayList[]  pid_list = new ArrayList[pid_map.size()];
   
    pid_map.values().toArray( pid_list );
 
    Arrays.sort(
        pid_list,
        new Comparator()
      {
            public int
        compare(
          Object o1,
          Object o2)
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.