Java Code Examples for java.util.Date.hashCode()

The following are Jave code examples for showing how to use hashCode() of the java.util.Date class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: neoscada   File: RandomHttpExporter.java   View Source Code Vote up 6 votes
public List<DataPoint> getData ( final String item, final String type, final Date from, final Date to, final Integer number )
{
    final List<DataPoint> result = new ArrayList<DataPoint> ();
    final int seed = item.hashCode () + type.hashCode () + from.hashCode () + to.hashCode () + number.hashCode ();
    final Random rndData = new Random ( seed );
    final Random rndQuality = new Random ( seed * 13 );
    final Random rndManual = new Random ( seed * 17 );
    final double[] d = genTimeSeriesData ( rndData, number );
    final double[] q = genTimeSeriesMeta ( rndQuality, number );
    final double[] m = genTimeSeriesMeta ( rndManual, number );
    final double delta = ( to.getTime () - from.getTime () ) / (double)number;
    for ( int i = 0; i < d.length; i++ )
    {
        final DataPoint dp = new DataPoint ();
        dp.setValue ( d[i] );
        dp.setQuality ( q[i] );
        dp.setManual ( m[i] );
        dp.setTimestamp ( new Date ( Math.round ( from.getTime () + i * delta ) ) );
        result.add ( dp );
    }
    return result;
}
 
Example 2
Project: pgsqlblocks   File: DBBlocksJournalProcess.java   View Source Code Vote up 5 votes
@Override
public int hashCode() {
    Date xactStart = process.getQuery().getXactStart();
    int result = 31 * process.getPid();
    result = 31 * result + (xactStart != null ? xactStart.hashCode() : 0);
    result = childrenHashCode(result, process.getChildren());
    return result;
}