对两个ICriterion进行 "逻辑或" 合并
@param c1 Restrictor left
@param c2 Restrictor right
@return Restrictor
768813
public static Restrictor or(Restrictor c1, Restrictor c2) {
		return new LogicRestrictor(c1, c2, RestrictType.or);
	}
874441
public static int compare (Comparable<?> c1, Comparable<?> c2)
    {
        @SuppressWarnings("unchecked") Comparable<Object> cc1 = (Comparable<Object>)c1;
        @SuppressWarnings("unchecked") Comparable<Object> cc2 = (Comparable<Object>)c2;
        return cc1.compareTo(cc2);
    }
919794
public boolean isRemoteAccessAllowed(String pRemoteHost, String pRemoteAddr) {
        return restrictor.isRemoteAccessAllowed(pRemoteHost != null ?
                                                        new String[] { pRemoteHost, pRemoteAddr } :
                                                        new String[] { pRemoteAddr });
    }
138071
private float weight(int c1, int c2, int k) {
		float w;
		float pc1 = wordProb.get(c1);
		float pc2 = wordProb.get(c2);
		float pck = wordProb.get(k);
		//新类的概率
		float pc = pc1+pc2;

		if (c1==k) {			
			float pcc1 = getProb(c1,c1);
			float pcc2 = getProb(c2,c2);
			float pcc3 = getProb(c1,c2);
			float pcc4 = getProb(c2,c1);
			float pcc = pcc1 + pcc2 + pcc3 + pcc4;
			w = clacW(pcc,pc,pc);			

		} else {

			float pcc1 = getProb(c1,k);
			float pcc2 = getProb(c2,k);

			float pcc12 = pcc1 + pcc2;			
			float p1 = clacW(pcc12,pc,pck);

			float pcc3 = getProb(k,c1);
			float pcc4 = getProb(k,c2);			
			float pcc34 = pcc3 + pcc4;			
			float p2 = clacW(pcc34,pck,pc);
			w =  p1 + p2;
		}
		return w;
	}
731304
private float weight(int c1, int c2) {
		float w;
		float pc1 = wordProb.get(c1);
		float pc2 = wordProb.get(c2);
		if (c1==c2) {
			float pcc = getProb(c1,c1);
			w =  clacW(pcc,pc1,pc2);
		} else {
			float pcc1 = getProb(c1, c2);			
			float p1= clacW(pcc1,pc1,pc2);			

			float pcc2 = getProb(c2, c1);			
			float p2 = clacW(pcc2,pc2,pc1);			
			w =  p1 + p2;
		}
		setweight(c1, c2, w);
		return w;
	}
1053534
public static <E> E argmin(Counter<E> c) {
    double min = Double.POSITIVE_INFINITY;
    E argmin = null;

    for (E key : c.keySet()) {
      double count = c.getCount(key);
      if (argmin == null || count < min) {// || (count == min &&
                                          // tieBreaker.compare(key, argmin) <
                                          // 0)) {
        min = count;
        argmin = key;
      }
    }
    return argmin;
  }
1256164
public static boolean disjoint(final Collection<?> c1, final Collection<?> c2) {
        if (isNullOrEmpty(c1) || isNullOrEmpty(c2)) {
            return true;
        }

        if (c1 instanceof Set || (c2 instanceof Set == false && c1.size() > c2.size())) {
            for (Object e : c2) {
                if (c1.contains(e)) {
                    return false;
                }
            }
        } else {
            for (Object e : c1) {
                if (c2.contains(e)) {
                    return false;
                }
            }
        }

        return true;
    }
124649
private boolean handleControl(Char c) {
        if (c instanceof Control) {
            if (c.equals(Control.DELETE)) {
                if (after.length() > 0) {
                    after = after.substring(1);
                }
            } else if (c.equals(Control.LEFT)) {
                if (before.length() > 0) {
                    after = "" + before.charAt(before.length() - 1) + after;
                    before = before.substring(0, before.length() - 1);
                }
            } else if (c.equals(Control.HOME)) {
                after = before + after;
                before = "";
            } else if (c.equals(Control.CTRL_LEFT)) {
                int cut = cutWordBefore();
                if (cut > 0) {
                    after = before.substring(cut) + after;
                    before = before.substring(0, cut);
                } else {
                    after = before + after;
                    before = "";
                }
            } else if (c.equals(Control.RIGHT)) {
                if (after.length() > 0) {
                    before = before + after.charAt(0);
                    after = after.substring(1);
                }
            } else if (c.equals(Control.END)) {
                before = before + after;
                after = "";
            } else if (c.equals(Control.CTRL_RIGHT)) {
                int cut = cutWordAfter();
                if (cut > 0) {
                    before = before + after.substring(0, cut);
                    after = after.substring(cut);
                } else {
                    before = before + after;
                    after = "";
                }
            } else if (c.equals(ALT_W)) {
                // delete word before the cursor.
                int cut = cutWordBefore();
                if (cut > 0) {
                    before = before.substring(0, cut);
                } else {
                    before = "";
                }
            } else if (c.equals(ALT_D)) {
                // delete word after the cursor.
                int cut = cutWordAfter();
                if (cut > 0) {
                    after = after.substring(cut);
                } else {
                    after = "";
                }
            } else if (c.equals(ALT_K)) {
                // delete everything after the cursor.
                after = "";
            } else if (c.equals(ALT_U)) {
                // delete everything before the cursor.
                before = "";
            } else {
                printAbove("Invalid control: " + c.asString());
                return true;
            }
            printInputLine();
            return true;
        }
        return false;
    }
986359
@SuppressWarnings("unchecked")
  public static <E, C extends Counter<E>> C union(C c1, C c2) {
    C result = (C) c1.getFactory().create();
    addInPlace(result, c1);
    addInPlace(result, c2);
    return result;
  }
235078
public static <ElementType> Ordering<Multiset.Entry<ElementType>> byElementOrdering(
      Comparator<? super ElementType> comparator) {
    return Ordering.from(comparator).onResultOf(MultisetUtils.<ElementType>elementOnly());
  }
1293404
public static function run($size, &$c1, &$c2)
    {
        if( $size > 0 )
        {
            if( $size <= $c2 )
            {
                $rate = $c2 / $size; $c2 = $size; $c1 = $c1 / $rate;
            }
            else
            {
                $rate = $size / $c2; $c2 = $size; $c1 = $c1 * $rate;
            }
        }
    }
571297
public static OtherwiseBuilder getBuilder( ConditionCol52 c ) {

        if ( c.getOperator().equals( "==" ) ) {
            return new EqualsOtherwiseBuilder();
        } else if ( c.getOperator().equals( "!=" ) ) {
            return new NotEqualsOtherwiseBuilder();
        }
        throw new IllegalArgumentException( "ConditionCol operator does not support Otherwise values" );
    }
827369
def also_restrict_to(self, restriction):
        
        if type(restriction) != list:
            restriction = [ restriction ]
        self._also_restriction = restriction
302322
private ProtectionDomain getProtectionDomain(CodeSource cs) {
        if (cs == null)
            return null;

        ProtectionDomain pd = null;
        synchronized (pdcache) {
            pd = pdcache.get(cs);
            if (pd == null) {
                PermissionCollection perms = getPermissions(cs);
                pd = new ProtectionDomain(cs, perms, this, null);
                pdcache.put(cs, pd);
                if (debug != null) {
                    debug.println(" getPermissions "+ pd);
                    debug.println("");
                }
            }
        }
        return pd;
    }
737735
protected int transition(int current, char c)
    {
        int b = current;
        int p;

        p = b + c + 1;
        if (b == check[p])
            b = base[p];
        else
            return -1;

        p = b;
        return p;
    }
731732
protected void merge(int c1, int c2) {
		int newid = lastid++;
		heads.put(c1, newid);
		heads.put(c2, newid);
		TIntFloatHashMap newpcc = new TIntFloatHashMap();
		TIntFloatHashMap inewpcc = new TIntFloatHashMap();
		TIntFloatHashMap newwcc = new TIntFloatHashMap();
		float pc1 = wordProb.get(c1);
		float pc2 = wordProb.get(c2);		
		//新类的概率
		float pc = pc1+pc2;

		float w;
		{
			float pcc1 = getProb(c1,c1);
			float pcc2 = getProb(c2,c2);
			float pcc3 = getProb(c1,c2);
			float pcc4 = getProb(c2,c1);
			float pcc = pcc1 + pcc2 + pcc3 + pcc4;
			if(pcc!=0.0f)
				newpcc.put(newid, pcc);
			w = clacW(pcc,pc,pc);
			if(w!=0.0f)
				newwcc.put(newid, w);
		}
		TIntIterator it = slots.iterator();
		while(it.hasNext()){
			int k = it.next();

			float pck = wordProb.get(k);			
			if (c1==k||c2==k) {			
				continue;
			} else {				
				float pcc1 = getProb(c1,k);
				float pcc2 = getProb(c2,k);
				float pcc12 = pcc1 + pcc2;
				if(pcc12!=0.0f)
					newpcc.put(newid, pcc12);
				float p1 = clacW(pcc12,pc,pck);

				float pcc3 = getProb(k,c1);
				float pcc4 = getProb(k,c2);			
				float pcc34 = pcc3 + pcc4;
				if(pcc34!=0.0f)
					inewpcc.put(k, pcc34);	
				float p2 = clacW(pcc34,pck,pc);
				w =  p1 + p2;
				if(w!=0.0f)
					newwcc.put(newid, w);
			}
		}

		//更新slots
		slots.remove(c1);
		slots.remove(c2);
		slots.add(newid);
		pcc.put(newid, newpcc);
		pcc.remove(c1);
		pcc.remove(c2);
		TIntFloatIterator it2 = inewpcc.iterator();
		while(it2.hasNext()){
			it2.advance();
			TIntFloatHashMap pmap = pcc.get(it2.key());
			//						if(pmap==null){
			//							pmap = new TIntFloatHashMap();
			//							pcc.put(it2.key(), pmap);
			//						}
			pmap.put(newid, it2.value());
			pmap.remove(c1);
			pmap.remove(c2);
		}


		//
		//newid 永远大于 it3.key;
		wcc.put(newid, new TIntFloatHashMap());
		wcc.remove(c1);
		wcc.remove(c2);
		TIntFloatIterator it3 = newwcc.iterator();
		while(it3.hasNext()){
			it3.advance();
			TIntFloatHashMap pmap = wcc.get(it3.key());
			pmap.put(newid, it3.value());
			pmap.remove(c1);
			pmap.remove(c2);
		}

		wordProb.remove(c1);
		wordProb.remove(c2);
		wordProb.put(newid, pc);

		//修改cluster
		Cluster cluster = new Cluster(newid, clusters.get(c1),clusters.get(c2),pc);
		clusters.put(newid, cluster);
		System.out.println("合并："+cluster.rep);
		
	}
104930
private static Pattern notChar2(final char c1, final char c2) {
    return new Pattern() {
      @Override public int match(CharSequence src, int begin, int end) {
        if (begin == end - 1) return 1;
        if (begin >= end) return MISMATCH;
        if (src.charAt(begin) == c1 && src.charAt(begin + 1) == c2) return Pattern.MISMATCH;
        return 1;
      }
    };
  }