Return the L1 norm of a counter. <i>Implementation note:</i> The method
name favors legibility of the L over the convention of using lowercase
names for methods.

@param c
The Counter
@return Its length
351313
public static <E, C extends Counter<E>> double L1Norm(C c) {
    double sumAbs = 0.0;
    for (E key : c.keySet()) {
      double count = c.getCount(key);
      if (count != 0.0) {
        sumAbs += Math.abs(count);
      }
    }
    return sumAbs;
  }
599218
public static int countNoneZero(float[] c) {
		int count = 0;
		for (int i = 0; i < c.length; i++) {
			if (c[i] != 0.0)
				count++;
		}
		return count;
	}
983395
public String getCharLineString(int c, int l) {
    if (font[c][l] == null)
      return null;
    else {
        return new String(font[c][l]).replace(hardblank, ' ');
    }
  }
903813
@Override
	public int getMaxLength() {
		int max = 0;
		boolean found = false;
		for (Constraint c : constraints) {
			int cM = c.getMaxLength();
			if (cM != -1) {
				max += cM;
				found = true;
			}
		}
		return found ? max : -1;
	}
906520
public static final long parseLong(CharSequence cs)
    {
        if (CharSequences.startsWith(cs, "0b"))
        {
            return parseLong(cs, 2, 2, cs.length());
        }
        if (CharSequences.startsWith(cs, "0x"))
        {
            return parseLong(cs, 16, 2, cs.length());
        }
        return parseLong(cs, 10);
    }
294042
def C(self):
        '''
        

        '''
        try:
            return self._C
        except AttributeError:
            pass
        self._C = Point(0, 1)
        return self._C
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;
  }
464341
public static int countOccurrences( String s, char c )
	{
		int count = 0;
		int index = 0;
		while( true )
		{
			index = s.indexOf( c, index );
			if( index == -1 )
			{
				break;
			}
			count++;
		}
		return count;
	}
149634
public int indexOf(int c) {
        if (c < MIN_VALUE || c > MAX_VALUE) {
            throw new IllegalArgumentException("Invalid code point U+" + Utility.hex(c, 6));
        }
        int i = 0;
        int n = 0;
        for (;;) {
            int start = list[i++];
            if (c < start) {
                return -1;
            }
            int limit = list[i++];
            if (c < limit) {
                return n + c - start;
            }
            n += limit - start;
        }
    }
148632
private void normalise(char[] c) {
		for (int i = 0; i< c.length; i++) {
			if (c[i] == 12288) {
				c[i] = (char) 32;
				continue;
			}else if (c[i]> 65280&& c[i]< 65375){
				c[i] = (char) (c[i] - 65248);			
			}
			else if(c[i] > 64 && c[i] < 91){
				c[i] += 32;
			}
			else{
				char cc = l2s.get(c[i]);
				if (cc != 0) {   
					c[i] = cc;   
				} 
			} 
		}
	}
967338
long getSingleCE(int c) {
        CollationData d;
        int ce32 = getCE32(c);
        if(ce32 == Collation.FALLBACK_CE32) {
            d = base;
            ce32 = base.getCE32(c);
        } else {
            d = this;
        }
        while(Collation.isSpecialCE32(ce32)) {
            switch(Collation.tagFromCE32(ce32)) {
            case Collation.LATIN_EXPANSION_TAG:
            case Collation.BUILDER_DATA_TAG:
            case Collation.PREFIX_TAG:
            case Collation.CONTRACTION_TAG:
            case Collation.HANGUL_TAG:
            case Collation.LEAD_SURROGATE_TAG:
                throw new UnsupportedOperationException(String.format(
                        "there is not exactly one collation element for U+%04X (CE32 0x%08x)",
                        c, ce32));
            case Collation.FALLBACK_TAG:
            case Collation.RESERVED_TAG_3:
                throw new AssertionError(String.format(
                        "unexpected CE32 tag for U+%04X (CE32 0x%08x)", c, ce32));
            case Collation.LONG_PRIMARY_TAG:
                return Collation.ceFromLongPrimaryCE32(ce32);
            case Collation.LONG_SECONDARY_TAG:
                return Collation.ceFromLongSecondaryCE32(ce32);
            case Collation.EXPANSION32_TAG:
                if(Collation.lengthFromCE32(ce32) == 1) {
                    ce32 = d.ce32s[Collation.indexFromCE32(ce32)];
                    break;
                } else {
                    throw new UnsupportedOperationException(String.format(
                            "there is not exactly one collation element for U+%04X (CE32 0x%08x)",
                            c, ce32));
                }
            case Collation.EXPANSION_TAG: {
                if(Collation.lengthFromCE32(ce32) == 1) {
                    return d.ces[Collation.indexFromCE32(ce32)];
                } else {
                    throw new UnsupportedOperationException(String.format(
                            "there is not exactly one collation element for U+%04X (CE32 0x%08x)",
                            c, ce32));
                }
            }
            case Collation.DIGIT_TAG:
                // Fetch the non-numeric-collation CE32 and continue.
                ce32 = d.ce32s[Collation.indexFromCE32(ce32)];
                break;
            case Collation.U0000_TAG:
                assert(c == 0);
                // Fetch the normal ce32 for U+0000 and continue.
                ce32 = d.ce32s[0];
                break;
            case Collation.OFFSET_TAG:
                return d.getCEFromOffsetCE32(c, ce32);
            case Collation.IMPLICIT_TAG:
                return Collation.unassignedCEFromCodePoint(c);
            }
        }
        return Collation.ceFromSimpleCE32(ce32);
    }
1127815
public final int tolower(int c) {
        int props=trie.get(c);
        if(!propsHasException(props)) {
            if(getTypeFromProps(props)>=UPPER) {
                c+=getDelta(props);
            }
        } else {
            int excOffset=getExceptionsOffset(props);
            int excWord=exceptions.charAt(excOffset++);
            if(hasSlot(excWord, EXC_LOWER)) {
                c=getSlotValue(excWord, EXC_LOWER, excOffset);
            }
        }
        return c;
    }
1305313
public static final int lengthOf(WsByteBuffer[] list) {
        if (null == list) {
            return 0;
        }
        int length = 0;
        for (int i = 0; i < list.length && null != list[i]; i++) {
            length += list[i].remaining();
        }
        return length;
    }
18250
public int getWidth(int char1) {
        if (vertical)
            return 1000;
        if (fontSpecific) {
            if ((char1 & 0xff00) == 0 || (char1 & 0xff00) == 0xf000)
                return getRawWidth(char1 & 0xff, null);
            else
                return 0;
        }
        else {
            return getRawWidth(char1, encoding);
        }
    }
228370
public static boolean isLetterNumber(char c) {
		return (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || c == '_' || c == '.'
				|| c == '@' || c == '#' || c == '$' || c == '+' || c == '-';
	}
403636
function(c) {
  var numdelims = 0;
  var first_close_delims = 0;
  var char_before, char_after;
  var startpos = this.pos;

  char_before = this.pos === 0 ? '\n' :
    this.subject.charAt(this.pos - 1);

  while (this.peek() === c) {
    numdelims++;
    this.pos++;
  }

  char_after = this.peek() || '\n';

  var can_open = numdelims > 0 && numdelims <= 3 && !(/\s/.test(char_after));
  var can_close = numdelims > 0 && numdelims <= 3 && !(/\s/.test(char_before));
  if (c === '_') {
    can_open = can_open && !((/[a-z0-9]/i).test(char_before));
    can_close = can_close && !((/[a-z0-9]/i).test(char_after));
  }
  this.pos = startpos;
  return { numdelims: numdelims,
           can_open: can_open,
           can_close: can_close };
}
966440
public static <E, C extends Counter<E>> double L2Norm(C c) {
    double lenSq = 0.0;
    for (E key : c.keySet()) {
      double count = c.getCount(key);
      if (count != 0.0) {
        lenSq += (count * count);
      }
    }
    return Math.sqrt(lenSq);
  }