KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > performance > simulate > type > AbstractSimulatedType


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.performance.simulate.type;
5
6 import com.tc.util.Assert;
7
8 public abstract class AbstractSimulatedType implements SimulatedType {
9   
10   /**
11    * @param percentUnique - approximate percentage of unique object values
12    */

13   public Object JavaDoc clone(int percentUnique) {
14     Assert.assertTrue(percentUnique >= 0);
15     Assert.assertTrue(percentUnique <= 100);
16     long randomValue = Math.round(Math.floor(100 * Math.random()));
17     if (percentUnique >= randomValue + 1) return cloneUnique();
18     return clone();
19   }
20   
21   public abstract Object JavaDoc clone();
22   
23   public abstract Object JavaDoc cloneUnique();
24   
25   public abstract Class JavaDoc getType();
26 }
27
Popular Tags