Coverage details for edu.uci.ics.jung.utils.GeneralUtils

LineHitsSource
1 /*
2 * Copyright (c) 2003, the JUNG Project and the Regents of the University
3 * of California
4 * All rights reserved.
5 *
6 * This software is open-source under the BSD license; see either
7 * "license.txt" or
8 * http://jung.sourceforge.net/license.txt for a description.
9 */
10 package edu.uci.ics.jung.utils;
11  
12 import java.util.regex.Pattern;
13  
14 /**
15  * Contains general-purpose utility functions.
16  *
17  * @author Scott White
18  * @author Joshua O'Madadhain
19  */
200public class GeneralUtils {
21     private static final int K = 10; // M==1024
22     private static final int INT_SIZE = 32;
23     private static final int KnuthsAValue = (int) 2654435769L;
24     
2572    private static final Pattern IS_NUMERIC = Pattern.compile("\\d*\\.?\\d*");
26     
27     public static int hash(int value)
28     {
299307080        return (value * KnuthsAValue) >>> (INT_SIZE - K);
30     }
31     
32     public static boolean isNumeric(String s)
33     {
340        return s.length() > 0 && IS_NUMERIC.matcher(s).matches();
35     }
36 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.