com.azalient.api.b.parameters
Interface IDivision

All Superinterfaces:
IRecord, ITypeSet, RecordR, RecordRW, RecordW, SortableData, StoreRecordRW

public interface IDivision
extends ITypeSet

A group of types, each of which has an associated "share" of the total. A division is used to generate people or vehicles of the given types in proportion to the specification of shares.


Field Summary
static IDivision[] ZERO
          A static zero-length array, created for convenience, and to save memory
 
Fields inherited from interface com.azalient.api.a.tables.IRecord
DELETED, KEY_SEP, KEY_SEP_CHAR
 
Method Summary
 void equalizeShares()
          Set all shares to be an equal fraction of 100%
 void normalizeShares()
          Multiply all shares by the same factor so that they sum to 100% (1.0)
 IType randomType(double p)
          Given a random variable between 0 and 1, return a type from this division.
 IType randomType(double p, int maxFriends)
          Given a random variable between 0 and 1, return a type from this division.
 IVehicleType randomType(double p, IRouter router, ILink origin, IZone destination, IBehaviour behaviour)
          Given a random variable between 0 and 1, return a vehicle type from this division.
 double share(IType type)
          Returns the share [0.0, 1.0] in this division for the given type.
 void share(IType type, double share, boolean normalize)
          Sets the share [0.0, 1.0] in this division for the given type, and optionally, normalizes all shares so that they sum to 1.0.
 
Methods inherited from interface com.azalient.api.b.parameters.ITypeSet
add, contains, count, logical, logical, mode, remove, standard, type
 
Methods inherited from interface com.azalient.api.file.StoreRecordRW
canRename, rename, store
 
Methods inherited from interface com.azalient.api.file.RecordR
extraSet, finished, isApplicable, isEditable, set
 
Methods inherited from interface com.azalient.api.a.tables.IRecord
name
 
Methods inherited from interface com.azalient.api.file.RecordW
extraCols, extraGet, extraGetB, extraGetD, extraGetI, extraGetS, extraGetT, get, isVolatile
 

Field Detail

ZERO

static final IDivision[] ZERO
A static zero-length array, created for convenience, and to save memory

Method Detail

share

double share(IType type)
Returns the share [0.0, 1.0] in this division for the given type.


share

void share(IType type,
           double share,
           boolean normalize)
Sets the share [0.0, 1.0] in this division for the given type, and optionally, normalizes all shares so that they sum to 1.0. If several shares are to be set in succession, then normalize should be false, and be called separately after all shares have been set.


normalizeShares

void normalizeShares()
Multiply all shares by the same factor so that they sum to 100% (1.0)


equalizeShares

void equalizeShares()
Set all shares to be an equal fraction of 100%


randomType

IType randomType(double p)
Given a random variable between 0 and 1, return a type from this division. Will always return a type, unless this division is empty


randomType

IType randomType(double p,
                 int maxFriends)
Given a random variable between 0 and 1, return a type from this division. Will always return a type, unless this division is empty


randomType

IVehicleType randomType(double p,
                        IRouter router,
                        ILink origin,
                        IZone destination,
                        IBehaviour behaviour)
Given a random variable between 0 and 1, return a vehicle type from this division. There must be a valid route for the type for the given origin/destination Returns null, if no suitable type found