Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.metacosm.framework.random
Class UniformDistributionLaw  view UniformDistributionLaw download UniformDistributionLaw.java

java.lang.Object
  extended byorg.metacosm.framework.random.UniformDistributionLaw
All Implemented Interfaces:
DistributionLaw, org.metacosm.framework.persistence.Persistent, java.io.Serializable
Direct Known Subclasses:
TranslatedUniformDistributionLaw

public class UniformDistributionLaw
extends java.lang.Object
implements DistributionLaw

Uniform distribution law for basic numeric types (Byte, Boolean, Double, Float, Int, Long, Short)


Field Summary
protected  int intMax
           
protected  java.lang.Class type
           
 
Constructor Summary
UniformDistributionLaw(java.lang.Class type)
          Constructor for a uniform distribution law.
UniformDistributionLaw(java.lang.Class type, int max)
          Constructor for a uniform distribution law.
 
Method Summary
 void load(java.io.InputStream is)
          Loads from the stream.
 java.lang.Object nextValue()
           
 void save(java.io.OutputStream os)
          Saves on the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected java.lang.Class type

intMax

protected int intMax
Constructor Detail

UniformDistributionLaw

public UniformDistributionLaw(java.lang.Class type)
Constructor for a uniform distribution law. Domains are [MIN_VALUE, MAX_VALUE] for given type, except for Float and Double which are [0.0, 1.0[.


UniformDistributionLaw

public UniformDistributionLaw(java.lang.Class type,
                              int max)
Constructor for a uniform distribution law. Domains are [0, max[ with max < type.MAX_VALUE and max < Integer.MAX_VALUE;

Method Detail

nextValue

public java.lang.Object nextValue()
Specified by:
nextValue in interface DistributionLaw

save

public void save(java.io.OutputStream os)
          throws java.io.IOException
Description copied from interface: org.metacosm.framework.persistence.Persistent
Saves on the stream.

Specified by:
save in interface org.metacosm.framework.persistence.Persistent

load

public void load(java.io.InputStream is)
          throws java.io.IOException
Description copied from interface: org.metacosm.framework.persistence.Persistent
Loads from the stream.

Specified by:
load in interface org.metacosm.framework.persistence.Persistent