public abstract class Utilities extends Presentable implements EnvironmentConstants, AgentConstants
Agent
and Experiment
, so that its functions can be called without any
prefixing from any code written by the user within those subclasses.Modifier and Type | Field and Description |
---|---|
static int |
AM
Value of the
getAmPm(Date) method indicating the
period of the day from midnight to just before noon. |
static int |
APRIL
Value of the
getMonth(Date) method indicating the
fourth month of the year in the Gregorian and Julian calendars. |
static int |
AUGUST
Value of the
getMonth(Date) method indicating the
eighth month of the year in the Gregorian and Julian calendars. |
static CustomDistribution.InterpolationType |
CUSTOM_DISTRIBUTION_INTERPOLATION_LINEAR |
static CustomDistribution.InterpolationType |
CUSTOM_DISTRIBUTION_INTERPOLATION_NONE |
static CustomDistribution.InterpolationType |
CUSTOM_DISTRIBUTION_INTERPOLATION_STEP |
static int |
DECEMBER
Value of the
getMonth(Date) method indicating the
twelfth month of the year in the Gregorian and Julian calendars. |
static int |
FEBRUARY
Value of the
getMonth(Date) method indicating the
second month of the year in the Gregorian and Julian calendars. |
static int |
FRIDAY
Value of the
getDayOfWeek(Date) method indicating
Friday. |
static double |
infinity
A constant holding the positive infinity of type
double . |
static int |
JANUARY
Value of the
getMonth(Date) method indicating the
first month of the year in the Gregorian and Julian calendars. |
static int |
JULY
Value of the
getMonth(Date) method indicating the
seventh month of the year in the Gregorian and Julian calendars. |
static int |
JUNE
Value of the
getMonth(Date) method indicating the
sixth month of the year in the Gregorian and Julian calendars. |
static LengthUnits |
LENGTH_UNIT_CENTIMETER |
static LengthUnits |
LENGTH_UNIT_FOOT |
static LengthUnits |
LENGTH_UNIT_INCH |
static LengthUnits |
LENGTH_UNIT_KILOMETER |
static LengthUnits |
LENGTH_UNIT_METER |
static LengthUnits |
LENGTH_UNIT_MILE |
static int |
MARCH
Value of the
getMonth(Date) method indicating the
third month of the year in the Gregorian and Julian calendars. |
static int |
MAY
Value of the
getMonth(Date) method indicating the
fifth month of the year in the Gregorian and Julian calendars. |
static int |
MONDAY
Value of the
getDayOfWeek(Date) method indicating
Monday. |
static int |
NOVEMBER
Value of the
getMonth(Date) method indicating the
eleventh month of the year in the Gregorian and Julian calendars. |
static int |
OCTOBER
Value of the
getMonth(Date) method indicating the
tenth month of the year in the Gregorian and Julian calendars. |
static int |
PM
Value of the
getAmPm(Date) method indicating the period
of the day from noon to just before midnight. |
static int |
SATURDAY
Value of the
getDayOfWeek(Date) method indicating
Saturday. |
static int |
SEPTEMBER
Value of the
getMonth(Date) method indicating the
ninth month of the year in the Gregorian and Julian calendars. |
static int |
SUNDAY
Value of the
getDayOfWeek(Date) method indicating
Sunday. |
static int |
THURSDAY
Value of the
getDayOfWeek(Date) method indicating
Thursday. |
static long |
TIME_UNIT_DAY
One of the possible time units.
|
static long |
TIME_UNIT_HOUR
One of the possible time units.
|
static long |
TIME_UNIT_MILLISECOND
One of the possible time units.
|
static long |
TIME_UNIT_MINUTE
One of the possible time units.
|
static long |
TIME_UNIT_MONTH
One of the possible time units.
|
static long |
TIME_UNIT_SECOND
One of the possible time units.
|
static long |
TIME_UNIT_WEEK
One of the possible time units.
|
static long |
TIME_UNIT_YEAR
One of the possible time units.
|
static int |
TUESDAY
Value of the
getDayOfWeek(Date) method indicating
Tuesday. |
static int |
UNDECIMBER
Value of the
getMonth(Date) method indicating the
thirteenth month of the year. |
static int |
WEDNESDAY
Value of the
getDayOfWeek(Date) method indicating
Wednesday. |
ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ARROW_FILLED, ARROW_NONE, ARROW_THIN, CAD_ANTIALIASING, CAD_INVERTED, LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_SOLID, SHAPE_DRAW_2D, SHAPE_DRAW_2D3D, SHAPE_DRAW_3D
LAYOUT_ARRANGED, LAYOUT_RANDOM, LAYOUT_RING, LAYOUT_SPRING_MASS, LAYOUT_USER_DEFINED, NEIGHBORHOOD_EUCLIDEAN, NEIGHBORHOOD_MOORE, NETWORK_ALL_IN_RANGE, NETWORK_RANDOM, NETWORK_RING_LATTICE, NETWORK_SCALE_FREE, NETWORK_SMALL_WORLD, NETWORK_USER_DEFINED
AGENT_ORIENTATION_FRONT, AGENT_ORIENTATION_LEFT, AGENT_ORIENTATION_REAR, AGENT_ORIENTATION_RIGHT, ALL, ALL_CONNECTED, ALL_NEIGHBORS, AREA_ACCESS_RESTRICTION_BY_CAPACITY, AREA_ACCESS_RESTRICTION_BY_CONDITION, AREA_ACCESS_RESTRICTION_BY_SCHEDULE, AREA_ACCESS_RESTRICTION_BY_THROUGHPUT, AREA_ACCESS_RESTRICTION_MANUAL, CENTIMETER, CONVEYOR_CUSTOM_STATION_AGENT_LOCATION_CENTER, CONVEYOR_CUSTOM_STATION_AGENT_LOCATION_NEAR_CONVEYOR, CONVEYOR_CUSTOM_STATION_AGENT_LOCATION_RANDOM, CONVEYOR_SIMPLE_STATION_DELAY_TYPE_MANUAL, CONVEYOR_SIMPLE_STATION_DELAY_TYPE_TIMEOUT, CONVEYOR_TYPE_BELT, CONVEYOR_TYPE_CELL, CONVEYOR_TYPE_ROLLER, CUBIC_METER, CUBIC_METER_PER_SECOND, CUSTOM_COLOR_SCHEME, DAY, DEG_PER_SECOND, DEGREE, DENSITY_VALUE_MAX, DENSITY_VALUE_MEAN, EAST, ESCALATOR_STAY_ALL, ESCALATOR_WALK_ALL, ESCALATOR_WALK_ON_LEFT_SIDE, ESCALATOR_WALK_ON_RIGHT_SIDE, EVENT_TIMEOUT_MODE_CYCLIC, EVENT_TIMEOUT_MODE_ONCE, EVENT_TIMEOUT_MODE_USER, EXCEEDED_QUEUE_CROWD_ROUND_AT_THE_END, EXCEEDED_QUEUE_EXTEND_TO_THE_FREE_SPACE, EXT_AGENT_CONTINUOUS, EXT_AGENT_DISCRETE, EXT_AGENT_GIS, EXT_AGENT_INTERACTIVE, EXT_AGENT_NETWORK, EXT_ENTITY, EXT_ENVIRONMENT_CONTINUOUS, EXT_ENVIRONMENT_DISCRETE, EXT_ENVIRONMENT_GIS, EXT_ENVIRONMENT_INTERACTIVE, EXT_SPACE, FLOW_STATISTICS_BOTH, FLOW_STATISTICS_LEFT, FLOW_STATISTICS_RIGHT, FOOT, FPM, FPS, FPS_SQ, HOUR, INCH, JIB_CRANE_CAT_HEAD, JIB_CRANE_FLAT_TOP, JIB_CRANE_INDUSTRIAL, JIB_CRANE_MOVEMENT_CONCURRENT, JIB_CRANE_MOVEMENT_STEP_BY_STEP, KILOGRAM, KILOGRAM_PER_SECOND, KILOMETER, KN, KPH, LIFT_PLATFORM_FLAT, LIFT_PLATFORM_ROLLER, LIFT_SELECTION_MODE_COMPARISON, LIFT_SELECTION_MODE_FIFO, LIFT_SELECTION_MODE_PRIORITY, LINEAR_COLOR_SCHEME, LITER, LITER_PER_SECOND, LOGARITHMIC_COLOR_SCHEME, METER, MILE, MILLIMETER, MILLISECOND, MINUTE, MONTH, MPH, MPS, MPS_SQ, NAUTICAL_MILE, NORTH, NORTHEAST, NORTHWEST, OBJECT_3D_INTERNAL_LIGHTING_GLOBAL, OBJECT_3D_INTERNAL_LIGHTING_INSIDE, OBJECT_3D_INTERNAL_LIGHTING_OFF, OBJECT_3D_XYZ_AXIS_ORDER, OBJECT_3D_YZX_AXIS_ORDER, OBJECT_3D_ZXY_AXIS_ORDER, OIL_BARREL, OIL_BARREL_PER_SECOND, OVERHEAD_CRANE_BRIDGE, OVERHEAD_CRANE_GANTRY, OVERHEAD_CRANE_GIRDER_DOUBLE_TIE, OVERHEAD_CRANE_GIRDER_SINGLE_FLAT, OVERHEAD_CRANE_MOVEMENT_CONCURRENT, OVERHEAD_CRANE_MOVEMENT_INDEPENDENT_HOIST, OVERHEAD_CRANE_MOVEMENT_STEP_BY_STEP, PALLET_RACK_LEFT_TO_RIGHT, PALLET_RACK_NO_DIRECTION, PALLET_RACK_RIGHT_TO_LEFT, PALLET_RACK_SINGLE_AISLE_LEFT, PALLET_RACK_SINGLE_AISLE_RIGHT, PALLET_RACK_TWO_AISLES, PALLET_RACK_TWO_PALLET_RACKS, PARKING_LOT_PARALLEL, PARKING_LOT_PERPENDICULAR, PATH_CONVEYOR, PATH_DASHEDLINE, PATH_LINE, PATH_RAILROAD, PATH_ROAD, PEDESTRIAN_MAP_TYPE, PER_DAY, PER_HOUR, PER_MILLISECOND, PER_MINUTE, PER_MONTH, PER_SECOND, PER_WEEK, PER_YEAR, POSITION_CHOICE_ARRANGED, POSITION_CHOICE_BY_ATTRACTORS, POSITION_CHOICE_RANDOM, RAD_PER_SECOND, RADIAN, RAILWAY_SWITCH_ALL_TO_ALL, RAILWAY_SWITCH_DOUBLE_SLIP, RAILWAY_SWITCH_SINGLE_SLIP, RANDOM, RANDOM_CONNECTED, RANDOM_NEIGHBOR, ROAD_LEFT_HAND, ROAD_LINE_DOUBLE, ROAD_LINE_DOUBLE_DASHED, ROAD_LINE_SINGLE, ROAD_LINE_SINGLE_DASHED, ROAD_RIGHT_HAND, RPM, SECOND, SERVICE_GROUP_BEHAVIOR_DEPENDS_ON_INCOMING_GROUP, SERVICE_GROUP_BEHAVIOR_SAME_FOR_ALL_GROUPS, SERVICE_GROUP_INDIVIDUAL_SERVING, SERVICE_GROUP_ONE_MEMBER_IS_SERVED_OTHERS_WAIT_IN_AREA, SERVICE_GROUP_ONE_MEMBER_IS_SERVED_OTHERS_WAIT_IN_QUEUE, SERVICE_QUEUE_CLOSEST_NON_EMPTY, SERVICE_QUEUE_CLOSEST_STRICT, SERVICE_QUEUE_CUSTOM, SERVICE_QUEUE_LONGEST, SERVICE_QUEUE_NEXT_ROUND_ROBIN, SERVICE_QUEUE_PRIORITY, SERVICE_TYPE_LINEAR, SERVICE_TYPE_POINT, SIGNAL_GREEN, SIGNAL_NONE, SIGNAL_RED, SIGNAL_YELLOW, SIMPLE_STATION_LOADING_MODE_AFTER_UNLOADING, SIMPLE_STATION_LOADING_MODE_SIMULTANEOUS_WITH_UNLOADING, SIMPLE_STATION_PROCESSING_WHEN_AGENT_ENTERS, SIMPLE_STATION_PROCESSING_WHEN_CAPACITY_FULL, SOUTH, SOUTHEAST, SOUTHWEST, SPACE_CONTINUOUS, SPACE_CONTINUOUS_2D, SPACE_DISCRETE, SPACE_DISCRETE_2D, SPACE_GIS, SPACE_UNDEFINED, SQ_CENTIMETER, SQ_FOOT, SQ_INCH, SQ_KILOMETER, SQ_METER, SQ_MILE, SQ_MILLIMETER, SQ_NAUTICAL_MILE, SQ_YARD, TON, TON_PER_SECOND, TRANSPORTER_MAP_TYPE, TURN, TURN_STATION_MODE_ANGLE, TURN_STATION_MODE_ORIENTATION, WALL_FILL_HATCHING, WALL_FILL_NONE, WALL_FILL_SOLID, WEEK, WEST, WINDOW_3D_NAVIGATION_FULL, WINDOW_3D_NAVIGATION_LIMITED_TO_Z_ABOVE_ZERO, WINDOW_3D_NAVIGATION_NONE, WINDOW_3D_NAVIGATION_ROTATION_ONLY, YARD, YEAR
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static java.util.Date |
addToDate(java.util.Date date,
int timeUnit,
double amount)
Returns the date, which will be after the given
amount
of timeUnit s from the given datee.g. |
static java.util.Date |
addToDate(java.util.Date date,
TimeUnits timeUnit,
double amount)
Returns the date, which will be after the given
amount
of timeUnit s from the given datee.g. |
static double |
atan2fast(double y,
double x)
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
|
int |
bernoulli(double p)
Generates a sample of the Bernoulli distribution, i.e. 1 with
probability
p and 0 with probability 1 - p . |
static int |
bernoulli(double p,
java.util.Random r)
Generates a sample of the Bernoulli distribution
using the specified random number generator.
|
double |
beta(double p,
double q)
Generates a sample of the Beta distribution with
min
set to 0 and max set to 1 . |
double |
beta(double p,
double q,
double min,
double max)
Generates a sample of the Beta distribution.
|
double |
beta(double min,
double max,
double p,
double q,
double shift,
double stretch)
Generates a sample of truncated Beta distribution.
|
static double |
beta(double min,
double max,
double p,
double q,
double shift,
double stretch,
java.util.Random r)
Generates a sample of truncated Beta distribution
using the specified random number generator.
|
static double |
beta(double p,
double q,
double min,
double max,
java.util.Random r)
Generates a sample of the Beta distribution
using the specified random number generator.
|
int |
binomial(double p)
Generates a sample of the Binomial distribution with
n set
to 1 . |
double |
binomial(double min,
double max,
double p,
double n,
double shift,
double stretch)
Generates a sample of truncated Binomial distribution.
|
static double |
binomial(double min,
double max,
double p,
double n,
double shift,
double stretch,
java.util.Random r)
Generates a sample of truncated Binomial distribution
using the specified random number generator.
|
int |
binomial(double p,
int n)
Generates a sample of the Binomial distribution.
|
static int |
binomial(double p,
int n,
java.util.Random r)
Generates a sample of the Binomial distribution
using the specified random number generator.
|
static java.lang.String |
briefInfoOn(java.lang.Object object)
Returns a brief one-line textual information on the given object.
|
<RT> RT |
castNumberTypes(java.lang.Number number,
java.lang.Class<RT> returnType) |
<RT> RT |
castTypes(java.lang.Object result,
java.lang.Class<RT> returnType)
Makes both implicit and explicit casts
returnType might be equal to Object.class, then convertation will be done only based on result type
like Timestamp -> Date
|
java.lang.Object |
castTypesBack(java.lang.Object value) |
double |
cauchy(double lambda)
Generates a sample of the Cauchy distribution with
theta
set to 0 . |
double |
cauchy(double lambda,
double theta)
Generates a sample of the Cauchy distribution.
|
static double |
cauchy(double lambda,
double theta,
java.util.Random r)
Generates a sample of the Cauchy distribution
using the specified random number generator.
|
double |
chi2(double nu)
Generates a sample of the Chi Squared distribution with
min
set to 0 . |
double |
chi2(double nu,
double min)
Generates a sample of the Chi Squared distribution.
|
static double |
chi2(double nu,
double min,
java.util.Random r)
Generates a sample of the Chi Squared distribution
using the specified random number generator.
|
static void |
copyToClipboard(java.util.List<java.util.List<java.lang.Object>> table)
Deprecated.
|
static void |
copyToClipboard(java.util.List<java.util.List<java.lang.Object>> table,
java.util.List<java.lang.Integer> sqlTypes) |
void |
copyToClipboard(java.lang.String text)
Copies the given text to the system clipboard
Due to the security policy of the browser, the actual copying may be preceded by a prompt. |
TableElementDatabaseBuilder |
createTableElementDatabaseBuilder() |
static float[] |
createTrajectoryGIS(double lonFrom,
double latFrom,
double lonTo,
double latTo,
int numberOfSegments)
Deprecated.
|
static java.net.URL |
createURL_xjal(java.lang.String url)
Creates an
URL object from the String representation |
java.util.Date |
date()
Returns the current model date with respect to the start time/date and the
model time unit.
|
double |
dateToTime(java.util.Date d)
Converts the given date to model time with respect to the start date,
start time and model time unit settings
|
double |
day()
Returns a time value equal to 24-hour day according to the current time unit setting.
|
DeleteQuery |
deleteFrom(<any> table)
Returns DeleteQuery that allows to build queries by chaining calls
|
static double |
difference(DataSet ds1,
DataSet ds2)
Difference function which is always not-negative and reflects difference
between 2 given data sets in their common arguments range
|
static double |
difference(DataSet ds,
TableFunction f)
Difference function which is always not-negative and reflects difference
between given data set and table function in their common arguments range
|
static double |
differenceInCalendarUnits(TimeUnits timeUnit,
java.util.Date date1,
java.util.Date date2)
Returns the difference
(date2 - date1)
between two dates in the given time units. |
double |
differenceInCalendarUnits(TimeUnits timeUnit,
double time1,
double time2)
Returns the difference
(time2 - time1)
between two model dates (corresponding to the given model times)
in the given time units. |
static double |
differenceInDateUnits(int timeUnit,
java.util.Date date1,
java.util.Date date2)
Deprecated.
|
double |
differenceInDateUnits(int timeUnit,
double time1,
double time2)
Deprecated.
|
static double |
differenceInDateUnits(TimeUnits timeUnit,
java.util.Date date1,
java.util.Date date2)
Deprecated.
please use
differenceInCalendarUnits(TimeUnits, Date, Date) instead |
double |
differenceInDateUnits(TimeUnits timeUnit,
double time1,
double time2)
Deprecated.
please use
differenceInCalendarUnits(TimeUnits, double, double) instead |
static double |
dirToAngle(CellDirection dir)
Returns the angle value corresponding to the given direction
|
static java.util.Date |
dropTime(java.util.Date date)
This utility method drops time-of-the-day information and returns
the
date with the time 00:00:00.000 |
double |
erlang(double beta,
int m)
Generates a sample of the Erlang distribution with
min
set to 0. |
double |
erlang(double beta,
int m,
double min)
Generates a sample of the Erlang distribution.
|
static double |
erlang(double beta,
int m,
double min,
java.util.Random r)
Generates a sample of the Erlang distribution
using the specified random number generator.
|
java.lang.RuntimeException |
error(java.lang.String errorText)
Signals an error during the model run by throwing a RuntimeException
with errorText preceded by the agent full name.
|
java.lang.RuntimeException |
error(java.lang.String errorTextFormat,
java.lang.Object... args)
The same as
error(String) but allows error format syntax like
in String.format(String, Object...) method |
abstract java.lang.RuntimeException |
error(java.lang.Throwable cause,
java.lang.String errorText)
Signals an error during the model run by throwing a RuntimeException
with errorText preceded by the agent full name.
|
java.lang.RuntimeException |
error(java.lang.Throwable cause,
java.lang.String errorTextFormat,
java.lang.Object... args)
The same as
error(String) but allows error format syntax like
in String.format(String, Object...) method |
java.lang.RuntimeException |
errorInModel(java.lang.String errorText)
Signals an model logic error during the model run by throwing a ModelException
with errorText preceded by the agent full name.
|
java.lang.RuntimeException |
errorInModel(java.lang.String errorTextFormat,
java.lang.Object... args)
The same as
errorInModel(String) but allows error format syntax like
in String.format(String, Object...) methodThis method differs from error() in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. |
abstract java.lang.RuntimeException |
errorInModel(java.lang.Throwable cause,
java.lang.String errorText)
Signals an model logic error during the model run by throwing a ModelException
with errorText preceded by the agent full name.
|
java.lang.RuntimeException |
errorInModel(java.lang.Throwable cause,
java.lang.String errorTextFormat,
java.lang.Object... args)
The same as
errorInModel(String) but allows error format syntax like
in String.format(String, Object...) methodThis method differs from error() in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. |
void |
executeAction(java.lang.String code,
java.lang.Object... argDescriptors)
Executes action.
|
<T> T |
executeExpression(java.lang.Class<T> returnType,
java.lang.String code,
java.lang.Object... argDescriptors)
Executes/evaluates the given code, e.g.
|
<T> T |
executeExpression(java.lang.String code,
java.lang.Object... argDescriptors)
Executes/evaluates the given code, e.g.
|
int |
executeStatement(java.lang.String sql,
java.lang.Object... params)
Executes insert, delete and update statements in AnyLogic database with given sql query string and parameters
|
double |
exponential()
Generates a sample of the Exponential distribution with
lambda set to 1 and min set to
0 . |
double |
exponential(double lambda)
Generates a sample of the Exponential distribution with
min set to 0 . |
double |
exponential(double lambda,
double min)
Generates a sample of the Exponential distribution.
|
double |
exponential(double min,
double max,
double shift,
double stretch)
Generates a sample of truncated Exponential distribution.
|
static double |
exponential(double min,
double max,
double shift,
double stretch,
java.util.Random r)
Generates a sample of truncated Exponential distribution
using the specified random number generator.
|
static double |
exponential(double lambda,
double min,
java.util.Random r)
Generates a sample of the Exponential distribution
using the specified random number generator.
|
static java.lang.String |
findExistingFile(java.lang.String filePath)
This method is internal and shouldn't be called by user.
|
static java.lang.String |
format(boolean value)
Formats a boolean value
|
static java.lang.String |
format(char value)
Formats a character to
String |
static java.lang.String |
format(java.util.Date date)
Formats a date using the default AnyLogic formatter
|
static java.lang.String |
format(double value)
Formats a double value using the default AnyLogic formatter
|
static java.lang.String |
format(double value,
IUnits<?> units)
Formats a double value with units, using the default AnyLogic formatter
|
static java.lang.String |
format(int value)
Formats an integer value using the default AnyLogic formatter
|
static java.lang.String |
format(long value)
Formats a long value using the default AnyLogic formatter
|
static java.lang.String |
formatAmountUnits(double value,
AmountUnits units)
Converts value to required units and turns it into String
|
static java.lang.String |
formatDayOfWeek(int dayOfWeek,
boolean fullName)
Returns the full or short name of the weekday
|
static java.lang.String |
formatFlowRateUnits(double value,
FlowRateUnits units)
Converts value to required units and turns it into String
|
static java.lang.String |
formatGeoHeading(double radians)
Formats given heading angle (measured in radians CW,
starting from North direction)
as human-readable geographical heading (azimuth).
|
static java.lang.String |
formatLatitude(double degrees)
Formats latitude
|
static java.lang.String |
formatLengthUnits(double value,
LengthUnits units)
Converts value to required units and turns it into String
|
static java.lang.String |
formatLengthUnits(LengthUnits unit,
boolean fullName)
Returns the full or short name of the length units
|
static java.lang.String |
formatLongitude(double degrees)
Formats longitude
|
static java.lang.String |
formatMonth(int month,
boolean fullName)
Returns the full or short name of the month
|
static java.lang.String |
formatSpeedUnits(double value,
SpeedUnits units)
Converts value to required units and turns it into String
|
java.lang.String |
formatTimeInterval(double dt)
Returns a string representation of a given time interval, according
to the current time unit settings, in the form 123 days 21h 0'56".
|
static double |
gamma_frac(double a,
java.util.Random r) |
double |
gamma(double alpha,
double beta)
Generates a sample of the Gamma distribution with
min set
to 0 . |
double |
gamma(double alpha,
double beta,
double min)
Generates a sample of the Gamma distribution.
|
double |
gamma(double min,
double max,
double alpha,
double shift,
double stretch)
Generates a sample of truncated Gamma distribution.
|
static double |
gamma(double min,
double max,
double alpha,
double shift,
double stretch,
java.util.Random r)
Generates a sample of truncated Gamma distribution
using the specified random number generator.
|
static double |
gamma(double alpha,
double beta,
double min,
java.util.Random r)
Generates a sample of the Gamma distribution
using the specified random number generator.
|
static double |
gammaLog(double x)
Returns the natural logarithm of the gamma function of
x :ln(Γ(x)) . |
int |
geometric(double p)
Generates a sample of the Geometric distribution.
|
static int |
geometric(double p,
java.util.Random r)
Generates a sample of the Geometric distribution
using the specified random number generator.
|
int |
getAmPm()
|
static int |
getAmPm(java.util.Date date)
|
static java.lang.String |
getCanonicalPath(java.io.File file)
This method is internal and shouldn't be called by user.
|
java.sql.Connection |
getDatabaseConnection()
Returns connection to AnyLogic database
|
static java.util.Date |
getDateWithTimeNextTo(java.util.Date date,
int hourOfDay,
int minute,
int second)
Returns the date which the next date after the given
date
and has the specified time (in the default time zone) |
int |
getDayOfMonth()
Returns the day of the month of the current model date with respect to the start time/date and the model time unit.
|
static int |
getDayOfMonth(java.util.Date date)
Returns the day of the month of the given
date . |
int |
getDayOfWeek()
Returns the day of the week of the current model date with respect to the start time/date and the model time unit.
|
static int |
getDayOfWeek(java.util.Date date)
Returns the day of the week of the given
date . |
static int |
getDayOfYear(java.util.Date date)
Returns the day of the year of the given
date . |
java.util.Random |
getDefaultRandomGenerator()
Retrieves the random number generator used by all probability
distributions by default, i.e. if no particular generator is
specified in the call to a probability distribution function.
|
static double |
getDistance(double x1,
double y1,
double x2,
double y2)
Returns the distance between two given points
(x1, y1) and (x2, y2) |
static double |
getDistance(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Returns the distance between two given points
(x1, y1, z1) and (x2, y2, z2) |
static double |
getDistanceFromPointToLine(double x1,
double y1,
double x2,
double y2,
double px,
double py)
Returns the distance from a point to a line.
|
static double |
getDistanceFromPointToLineSq(double x1,
double y1,
double x2,
double y2,
double px,
double py)
Returns the square of the distance from a point to a line.
|
static double |
getDistanceFromPointToSegment(double x1,
double y1,
double x2,
double y2,
double px,
double py)
Returns the distance from a point to a line segment.
|
static double |
getDistanceFromPointToSegment(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double px,
double py,
double pz)
Returns the distance from a point to a line segment.
|
static double |
getDistanceFromPointToSegmentSq(double x1,
double y1,
double x2,
double y2,
double px,
double py)
Returns the square of the distance from a point to a line segment.
|
static double |
getDistanceFromPointToSegmentSq(double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double px,
double py,
double pz)
Returns the square of the distance from a point to a line segment.
|
static double |
getDistanceGIS(double latitude1,
double longitude1,
double latitude2,
double longitude2)
Returns the distance measured in meters between two given points
|
static double |
getDistanceGIS(double latitude1,
double longitude1,
double latitude2,
double longitude2,
LengthUnits units)
Returns the distance measured in meters between two given points
|
static double |
getDistanceSq(double x1,
double y1,
double x2,
double y2)
Returns the square of the distance between two given points
(x1, y1) and (x2, y2) . |
static double |
getDistanceSq(double x1,
double y1,
double z1,
double x2,
double y2,
double z2)
Returns the square of the distance between two given points
(x1, y1, z1) and (x2, y2, z2) . |
static java.lang.String |
getFullName(Agent agent)
Returns the name of the agent prefixed by the path from
the top-level agent to this one.
|
int |
getHour()
Returns the hour of the morning or afternoon of the current model date with respect to the start time/date and the model time unit.
|
static int |
getHour(java.util.Date date)
Returns the hour of the morning or afternoon of the given
date . |
int |
getHourOfDay()
Returns the hour of day of the current model date with respect to the start time/date and the model time unit.
|
static int |
getHourOfDay(java.util.Date date)
Returns the hour of day of the given
date . |
static double |
getLength(double dx,
double dy)
Returns the length of the vector
(dx, dy) |
static double |
getLength(double dx,
double dy,
double dz)
Returns the length of the vector
(dx, dy, dz) |
static double |
getLengthSq(double dx,
double dy)
Returns the square of length of the vector
(dx, dy) |
static double |
getLengthSq(double dx,
double dy,
double dz)
Returns the square of length of the vector
(dx, dy, dz) |
int |
getMillisecond()
Returns the millisecond within the second of the current model date with respect to the start time/date and the model time unit.
|
static int |
getMillisecond(java.util.Date date)
Returns the millisecond within the second of the given
date . |
int |
getMinute()
Returns the minute within the hour of the current model date with respect to the start time/date and the model time unit.
|
static int |
getMinute(java.util.Date date)
Returns the minute within the hour of the given
date . |
int |
getMonth()
Returns the month of the current model date with respect to the start time/date and the model time unit.
|
static int |
getMonth(java.util.Date date)
Returns the month of the given
date . |
static java.lang.String |
getName(Agent agent)
Returns the name of the agent or
null if
the given agent is null. |
static Point |
getNearestPointOnSegment(Point out,
double x1,
double y1,
double x2,
double y2,
double px,
double py)
Finds a point on a segment that is closest to a given point.
|
static Point |
getNearestPointOnSegment(Point out,
double x1,
double y1,
double z1,
double x2,
double y2,
double z2,
double px,
double py,
double pz)
Finds a point on a segment that is closest to a given point.
|
static int |
getPerformanceParallelWorkersCount_xjal()
Returns number of processors (threads) when running parallel
(multi-thread) experiments (with multiple runs) and some other
features supporting parallel execution.
|
<T> T |
getRandom(java.util.Collection<T> collection)
Same as
#randomFrom(Collection) |
static <T> T |
getRandom(java.util.Collection<T> collection,
java.util.Random r)
Same as
#randomFrom(Collection, Random) |
<T> T |
getResult(boolean cached,
boolean mustBeUnique,
java.lang.Class<T> returnType,
java.lang.String sql,
java.lang.Object... params)
This method is internal and shouldn't be called by user.
|
int |
getSecond()
Returns the second within the minute of the current model date with respect to the start time/date and the model time unit.
|
static int |
getSecond(java.util.Date date)
Returns the second within the minute of the given
date . |
double |
getTime()
Deprecated.
Use
time() instead |
double |
getTimeoutToNextTime(int hourOfDay,
int minute,
int second)
Returns timeout, in model time units, to the nearest date
which will have the specified in-day time (in the default time zone)
|
int |
getYear()
Returns the year of the current model date with respect to the start time/date and the model time unit.
|
static int |
getYear(java.util.Date date)
Returns the year of the given
date . |
double |
gumbel1(double a,
double b)
Generates a sample of the Type I Gumbel distribution.
|
static double |
gumbel1(double a,
double b,
java.util.Random r)
Generates a sample of the Type I Gumbel distribution
using the specified random number generator.
|
double |
gumbel2(double a,
double b)
Generates a sample of the Type II Gumbel distribution.
|
static double |
gumbel2(double a,
double b,
java.util.Random r)
Generates a sample of the Type II Gumbel distribution
using the specified random number generator.
|
double |
hour()
Returns a time value equal to one hour according to the
current time unit setting.
|
int |
hypergeometric(int ss,
int dn,
int ps)
Generates a sample of the Hypergeometric distribution.
|
static int |
hypergeometric(int ss,
int dn,
int ps,
java.util.Random r)
Generates a sample of the Hypergeometric distribution
using the specified random number generator.
|
void |
initializeRadians(double lat,
double lon)
Initialize this Geo with to represent coordinates.
|
InsertQuery |
insertInto(<any> table)
Returns InsertQuery that allows to build queries by chaining calls
|
static java.lang.String |
inspectOf(java.lang.Object object)
Returns a textual info on the object that can be displayed in the multi-line
Inspect window.
|
static java.lang.String |
inspectOfLink_xjal(java.lang.Object object)
This method is internal and shouldn't be called by user.
|
static boolean |
isFinite(double v)
Returns
true if the given value is finite (not +/-infinity or NaN) |
static boolean |
isLineIntersectingLine(double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
double x4,
double y4)
Tests if the line segment from
(x1,y1) to (x2,y2)
intersects the line segment from (x3,y3) to (x4,y4) . |
static boolean |
isLineIntersectingRectangle(double x1,
double y1,
double x2,
double y2,
double rx,
double ry,
double rw,
double rh)
Check if the line intersects the given rectangle
|
boolean |
isLoggingClassToDB(LoggingType loggingType)
Returns
true if this agent type with all
internals may log their data/changes/activity to AnyLogic built-in database
(logging options are configurable in the properties of Database / Log in the Projects tree
inside AnyLogic) |
boolean |
isLoggingToDB(LoggingType loggingType)
Returns
true if this agent and its internals may log their
data/changes/activity to AnyLogic built-in database (logging options are
configurable in the properties of Database / Log in the Projects tree
inside AnyLogic) |
static boolean |
isPointInsideRay(double x1,
double y1,
double x2,
double y2,
double px,
double py)
Tests if the specified point is inside the given ray.
|
static boolean |
isPointInsideRectangle(double rx,
double ry,
double rw,
double rh,
double px,
double py)
Tests if the specified point is inside the given rectangle.
|
static boolean |
isPointInsideSegment(double x1,
double y1,
double x2,
double y2,
double px,
double py)
Tests if the specified point is inside the given segment.
|
static boolean |
isPointOnTheSameLine(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Tests if the three point lie on the same line
|
static boolean |
isRayIntersectingSegment(double rx1,
double ry1,
double rx2,
double ry2,
double sx1,
double sy1,
double sx2,
double sy2)
Tests if the ray from
(rx1,ry1) in direction to (rx2,ry2)
intersects the line segment from (lx1,ly1) to (lx2,ly2) . |
static int[] |
joinArrays_xjal(boolean replaceAlways,
boolean replaceWithNotEmpty,
int[] a1,
int[] a2)
This method is internal and isn't intended to be called by user (may be removed in future releases)
|
double |
laplace(double phi,
double theta)
Generates a sample of the Laplace distribution.
|
static double |
laplace(double phi,
double theta,
java.util.Random r)
Generates a sample of the Laplace distribution
using the specified random number generator.
|
static java.lang.String |
layoutTypeToString(LayoutType layoutType)
Deprecated.
please use
LayoutType.formatName() instead |
static double |
limit(double min,
double x,
double max)
Returns x if it is within [min,max] interval, otherwise returns the closest
bound.
|
static int |
limit(int min,
int x,
int max)
Returns x if it is within [min,max] interval, otherwise returns the closest
bound.
|
static double |
limitMax(double x,
double max)
Returns x if it is less or equal to max, otherwise returns max.
|
static int |
limitMax(int x,
int max)
Returns x if it is less or equal to max, otherwise returns max.
|
static double |
limitMin(double min,
double x)
Returns x if it is greater or equal to min, otherwise returns min.
|
static int |
limitMin(int min,
int x)
Returns x if it is greater or equal to min, otherwise returns min.
|
int |
logarithmic(double theta)
Generates a sample of the Logarithmic distribution.
|
static int |
logarithmic(double theta,
java.util.Random r)
Generates a sample of the Logarithmic distribution
using the specified random number generator.
|
double |
logistic(double beta,
double alpha)
Generates a sample of the Logistic distribution.
|
static double |
logistic(double beta,
double alpha,
java.util.Random r)
Generates a sample of the Logistic distribution
using the specified random number generator.
|
double |
lognormal(double mu,
double sigma,
double min)
Generates a sample of the Lognormal distribution.
|
static double |
lognormal(double mu,
double sigma,
double min,
java.util.Random r)
Generates a sample of the Lognormal distribution
using the specified random number generator.
|
void |
logToDB(DataSet dataSet,
java.lang.String name)
Writes the given element to the corresponding log table of model database.
|
void |
logToDB(HistogramData histogramData,
java.lang.String name)
Writes the given element to the corresponding log table of model database.
|
void |
logToDB(StatisticsContinuous statistics,
java.lang.String name)
Writes the given element to the corresponding log table of model database.
|
void |
logToDB(StatisticsDiscrete statistics,
java.lang.String name)
Writes the given element to the corresponding log table of model database.
|
double |
millisecond()
Returns a time value equal to one millisecond according to the
current time unit setting.
|
double |
minute()
Returns a time value equal to one minute according to the
current time unit setting.
|
double |
month()
Returns a time value equal to 30 days according to the current time unit setting.
|
int |
negativeBinomial(double p,
double n)
Generates a sample of the Negative Binomial distribution.
|
double |
negativeBinomial(double min,
double max,
double p,
double n,
double shift,
double stretch)
Generates a sample of truncated Negative Binomial distribution.
|
static double |
negativeBinomial(double min,
double max,
double p,
double n,
double shift,
double stretch,
java.util.Random r)
Generates a sample of truncated Negative Binomial distribution
using the specified random number generator.
|
static int |
negativeBinomial(double p,
double n,
java.util.Random r)
Generates a sample of the Negative Binomial distribution
using the specified random number generator.
|
double |
normal()
Generates a sample of the Normal distribution with
mean set
to 0 and sigma set to 1 . |
double |
normal(double sigma)
Generates a sample of the Normal distribution with
mean set
to 0 . |
double |
normal(double sigma,
double mean)
Generates a sample of the Normal distribution.
|
double |
normal(double min,
double max,
double shift,
double stretch)
Generates a sample of truncated Normal distribution.
|
static double |
normal(double min,
double max,
double shift,
double stretch,
java.util.Random r)
Generates a sample of truncated Normal distribution
using the specified random number generator.
|
static double |
normal(double sigma,
double mean,
java.util.Random r)
Generates a sample of the Normal distribution
using the specified random number generator.
|
double |
pareto(double alpha)
Generates a sample of the Pareto distribution with
min set
to 1 . |
double |
pareto(double alpha,
double min)
Generates a sample of the Pareto distribution.
|
static double |
pareto(double alpha,
double min,
java.util.Random r)
Generates a sample of the Pareto distribution
using the specified random number generator.
|
double |
pert(double min,
double max,
double mode)
Generates a sample of the PERT distribution.
|
static double |
pert(double min,
double max,
double mode,
java.util.Random r)
Generates a sample of the PERT distribution
using the specified random number generator.
|
int |
poisson(double lambda)
Generates a sample of the Poisson distribution.
|
double |
poisson(double min,
double max,
double mean,
double shift,
double stretch)
Generates a sample of truncated Poisson distribution.
|
static double |
poisson(double min,
double max,
double mean,
double shift,
double stretch,
java.util.Random r)
Generates a sample of truncated Poisson distribution
using the specified random number generator.
|
static int |
poisson(double lambda,
java.util.Random r)
Generates a sample of the Poisson distribution
using the specified random number generator.
|
static void |
prepareBeforeExperimentStart_xjal(java.lang.Class<?> experimentClass)
This method is internal and isn't intended to be called by user (may be removed in future releases)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.Object... params) |
double |
pulse(double startTime,
double pulseWidth)
Returns
1 , starting at startTime , and lasting
for interval pulseWidth ; 0 is returned at all other times. |
double |
pulseTrain(double startTime,
double pulseWidth,
double timeBetweenPulses,
double endTime)
Returns
1 , starting at startTime , and lasting for
interval pulseWidth and then repeats this pattern every
timeBetweenPulses time until endTime ;
0 is returned at all other times. |
static double |
quantum(double value,
double quantizer)
Returns the number smaller (by absolute value)
than or equal to
value that is an
integer multiple of quantizer . |
double |
ramp(double slope,
double startTime,
double endTime)
Returns
0 until the startTime and then slopes upward
until endTime and then holds constant. |
double |
random()
Generates a random value uniformly distributed on the interval [0,1),
the upper bound is not included.
|
java.awt.Color |
randomColor()
Returns random standard color, one of possible 140 standard colors
|
boolean |
randomFalse(double p)
Generates
false with the given probability p . |
static boolean |
randomFalse(double p,
java.util.Random r)
Generates
false with the given probability p
using the specified random number generator. |
<T extends java.lang.Enum<T>> |
randomFrom(java.lang.Class<T> enumeration)
Returns the randomly chosen enumeration constant.
|
static <T extends java.lang.Enum<T>> |
randomFrom(java.lang.Class<T> enumeration,
java.util.Random r)
Returns the randomly chosen enumeration constant.
|
<T> T |
randomFrom(java.lang.Iterable<T> collection)
Returns the randomly chosen element of the given collection.
|
static <T> T |
randomFrom(java.lang.Iterable<T> collection,
java.util.Random r)
Returns the randomly chosen element of the given collection.
|
<T> T |
randomFrom(T[] array)
Returns the randomly chosen element of the given array.
|
static <T> T |
randomFrom(T[] array,
java.util.Random r)
Returns the randomly chosen element of the given array.
|
<T> T |
randomlyCreate(java.lang.Class<? extends T>... classes)
Creates a randomly chosen object using one of the given constructors.
|
static <T> T |
randomlyCreate(java.util.Random r,
java.lang.Class<? extends T>... classes)
Creates a randomly chosen object using one of the given constructors.
|
static <T> T |
randomlyCreate(java.util.Random r,
java.util.function.Supplier<? extends T>... constructors)
Creates a randomly chosen object using one of the given constructors.
|
<T> T |
randomlyCreate(java.util.function.Supplier<? extends T>... constructors)
Creates a randomly chosen object using one of the given constructors.
|
boolean |
randomTrue(double p)
Generates
true with the given probability p . |
static boolean |
randomTrue(double p,
java.util.Random r)
Generates
true with the given probability p
using the specified random number generator. |
<T> T |
randomWhere(java.lang.Iterable<T> collection,
java.util.function.Predicate<T> condition)
Returns the randomly chosen element of the given collection which
meets the given condition.
|
static <T> T |
randomWhere(java.lang.Iterable<T> collection,
java.util.function.Predicate<T> condition,
java.util.Random r)
Returns the randomly chosen element of the given collection which
meets the given condition.
|
<T> T |
randomWhere(T[] array,
java.util.function.Predicate<T> condition)
Returns the randomly chosen element of the given array which
meets the given condition.
|
static <T> T |
randomWhere(T[] array,
java.util.function.Predicate<T> condition,
java.util.Random r)
Returns the randomly chosen element of the given array which
meets the given condition.
|
double |
rayleigh(double sigma)
Generates a sample of the Rayleigh distribution with
min
set to 0 . |
double |
rayleigh(double sigma,
double min)
Generates a sample of the Rayleigh distribution.
|
static double |
rayleigh(double sigma,
double min,
java.util.Random r)
Generates a sample of the Rayleigh distribution
using the specified random number generator.
|
static double |
roundToDecimal(double v,
int nDecimalDigits)
Rounds the value to the given precision.
|
static int |
roundToInt(double v)
Returns
int closest to the given value. |
double |
second()
Returns a time value equal to one second according to the
current time unit setting.
|
int |
selectAndDoForEach(java.util.function.Consumer<ResultSet> action,
java.lang.String sql,
java.lang.Object... params)
Perform some action with each of results for the given sql and params.
|
double[] |
selectArrayOfDouble(java.lang.String sql,
java.lang.Object... params)
Returns the array of numbers from the first column returned by the
given sql and params.
|
int[] |
selectArrayOfInt(java.lang.String sql,
java.lang.Object... params)
Returns the array of numbers from the first column returned by the
given sql and params.
|
boolean |
selectExists(boolean cached,
java.lang.String sql,
java.lang.Object... params)
Returns
true if the given sql and params returns at least one result
This function caches its results, to speed up default behavior
Use selectExists(false, sql, params) to get non cached result every time |
boolean |
selectExists(java.lang.String sql,
java.lang.Object... params)
Returns
true if the given sql and params returns at least one result
This function caches its results, to speed up default behavior
Use selectExists(false, sql, params) to get non cached result every time |
<T> T |
selectFirstValue(boolean cached,
java.lang.Class<T> returnType,
java.lang.String sql,
java.lang.Object... params)
Returns first result for given sql and params or null if no result is found
This function caches its results, to speed up default behavior
Use selectFirstValue(false, returnType, sql, params) to get non cached result every time
|
<T> T |
selectFirstValue(boolean cached,
java.lang.String sql,
java.lang.Object... params)
Returns first result for given sql and params or null if no result is found
|
<T> T |
selectFirstValue(java.lang.Class<T> returnType,
java.lang.String sql,
java.lang.Object... params)
Returns first result for given sql and params or null if no result is found
This function caches its results, to speed up default behavior
Use selectFirstValue(false, returnType, sql, params) to get non cached result every time
|
<T> T |
selectFirstValue(java.lang.String sql,
java.lang.Object... params)
Returns first result for given sql and params or null if no result is found
This function caches its results, to speed up default behavior
Use selectFirstValue(false, sql, params) to get non cached result every time
|
SelectQuery |
selectFrom(<any> table)
Returns SelectQuery that allows to build queries by chaining calls
|
ResultSet |
selectResultSet(java.lang.String sql,
java.lang.Object... params)
Get the results as a result set object for the given sql and params
|
TableFunction |
selectTableFunction(TableFunction tableFunction,
java.lang.String sql,
java.lang.Object... params)
Executes the given SELECT query which should return data in 2 columns:
the first column contains arguments numbers,
the second column contains values numbers.
|
<T> T |
selectUniqueValue(boolean cached,
java.lang.Class<T> returnType,
java.lang.String sql,
java.lang.Object... params)
Returns an unique result for given sql and params
This function caches its results, to speed up default behavior
Use selectUniqueValue(false, returnType, sql, params) to get non cached result every time
|
<T> T |
selectUniqueValue(boolean cached,
java.lang.String sql,
java.lang.Object... params)
Returns an unique result for given sql and params
This function caches its results, to speed up default behavior
Use selectUniqueValue(false, sql, params) to get non cached result every time
|
<T> T |
selectUniqueValue(java.lang.Class<T> returnType,
java.lang.String sql,
java.lang.Object... params)
Returns an unique result for given sql and params
This function caches its results, to speed up default behavior
Use selectUniqueValue(false, returnType, sql, params) to get non cached result every time
|
<T> T |
selectUniqueValue(java.lang.String sql,
java.lang.Object... params)
Returns an unique result for given sql and params
This function caches its results, to speed up default behavior
Use selectUniqueValue(false, sql, params) to get non cached result every time
|
<T> java.util.List<T> |
selectValues(java.lang.Class<T> returnType,
java.lang.String sql,
java.lang.Object... params)
List the results for given sql and params
Given sql query must return single column
An empty list is returned for no results
|
<T> java.util.List<T> |
selectValues(java.lang.String sql,
java.lang.Object... params)
List the results for given sql and params
Given sql query must return single column
An empty list is returned for no results
|
void |
setDefaultRandomGenerator(java.util.Random r)
Sets the random number generator used by all probability
distributions by default, i.e. if no particular generator is
specified in the call to a probability distribution function.
|
void |
shuffle(java.util.List<?> list)
Randomly permutes the specified list.
|
<T> T |
sqlGetObject(java.sql.ResultSet rs,
int index,
java.lang.Class<T> returnType)
Gets values from ResultSet in given position
|
<T> T |
sqlGetObject(ResultSet rs,
int index,
java.lang.Class<T> returnType)
Gets values from AnyLogic wrapper for ResultSet in given position
|
<T> T |
sqlGetObject(java.sql.ResultSet rs,
java.lang.String columnLabel,
java.lang.Class<T> returnType)
Gets values from ResultSet in given position
|
<T> T |
sqlGetObject(ResultSet rs,
java.lang.String columnLabel,
java.lang.Class<T> returnType)
Gets values from AnyLogic wrapper for ResultSet in given position
|
void |
sqlSetObject(java.sql.PreparedStatement st,
int index,
java.lang.Object object)
Sets parameter for preparedStatement in given index position with given value
|
static double |
sqr(double v)
Returns the square of the given value (
v2 ) |
double |
step(double height,
double stepTime)
Returns
0 until the stepTime and then returns height |
double |
time()
Returns the current model (logical) time.
|
double |
time(TimeUnits units)
Returns the current model (logical) time.
|
java.util.Date |
timeToDate(double t)
Converts the given model time to date with respect to the start date,
start time and model time unit settings, null if the time is infinity.
|
static java.util.Date |
toDate(int year,
int month,
int day)
Returns the date in the default time zone with given field values and the time set to a midnight.
|
static java.util.Date |
toDate(int year,
int month,
int day,
int hourOfDay,
int minute,
int second)
Returns the date in the default time zone with given field values.
|
static java.util.Date |
toDate(java.lang.String dateFormat,
java.lang.String text)
Parses the date from the given string using date format pattern.
|
static long |
toDateInMillis(int year,
int month,
int day,
int hourOfDay,
int minute,
int second)
Same as
toDate(int, int, int, int, int, int) but returns the date
in its milliseconds representation (see Date.getTime() ), i.e. |
static double |
toLatitude(int degrees,
int minutes,
double seconds,
boolean northOrSouth)
Converts latitude from human-readable format (e.g. 59° 56' 0" North)
to format used in the model
|
static double |
toLongitude(int degrees,
int minutes,
double seconds,
boolean eastOrWest)
Converts longitude from human-readable format (e.g. 30° 20' 0" East)
to format used in the model
|
double |
toModelRate(double value,
RateUnits units)
Converts the given rate (in rate units) to units based on model time units (used e.g. in basic API of events)
|
double |
toModelTime(double value,
TimeUnits units)
Converts the given timeout (in units) to model time units (used e.g. in basic API of events)
|
double |
toRateUnits(double modelRateValue,
RateUnits units)
Converts the rate (in units based on model time units) to the given units
|
static java.lang.String |
toStringAlignedNameValues(int minNameLength,
java.lang.Object... nameValueRows) |
double |
toTimeout(int timeUnit,
double amount)
Deprecated.
|
double |
toTimeout(TimeUnits timeUnit,
double amount)
Deprecated.
please use
toTimeoutInCalendar(TimeUnits, double)
instead |
double |
toTimeoutInCalendar(TimeUnits timeUnit,
double amount)
Returns timeout, in model time units, which equals to the given
amount
of timeUnit s from current model datee.g. |
double |
toTimeUnits(double modelTimeValue,
TimeUnits units)
Converts the timeout (in model time units) to the given units
|
static void |
trace(java.lang.Object o)
Prints a string representation of an object to the standard output stream.
|
static void |
trace(java.lang.String textFormat,
java.lang.Object... args)
The same as
trace(Object) but allows text format syntax like
in String.format(String, Object...) method |
static void |
traceln()
Prints a line delimiter to the standard output stream.
|
static void |
traceln(java.awt.Color color,
java.lang.Object o)
Prints a string representation of an object with a line delimiter at the end
to the standard output stream.
|
static void |
traceln(java.awt.Color color,
java.lang.String textFormat,
java.lang.Object... args)
The same as
traceln(Object) but allows text format syntax like
in String.format(String, Object...) method. |
static void |
traceln(java.lang.Object o)
Prints a string representation of an object with a line delimiter at the end
to the standard output stream.
|
static void |
traceln(java.lang.String textFormat,
java.lang.Object... args)
The same as
traceln(Object) but allows text format syntax like
in String.format(String, Object...) method |
void |
traceToDB(java.lang.Object o)
Prints a string representation of an object with a line delimiter at the end
to the standard output stream.
|
void |
traceToDB(java.lang.String textFormat,
java.lang.Object... args)
The same as
traceln(Object) but allows text format syntax like
in String.format(String, Object...) method |
double |
triangular(double min,
double max)
Generates a sample of the Triangular distribution with
mode set to (min + max)/2 . |
double |
triangular(double min,
double max,
double mode)
Generates a sample of the Triangular distribution.
|
double |
triangular(double min,
double max,
double left,
double mode,
double right)
Generates a sample of truncated Triangular distribution.
|
static double |
triangular(double min,
double max,
double left,
double mode,
double right,
java.util.Random r)
Generates a sample of truncated Triangular distribution
using the specified random number generator.
|
static double |
triangular(double min,
double max,
double mode,
java.util.Random r)
Generates a sample of the Triangular distribution
using the specified random number generator.
|
double |
triangularAV(double average,
double variability)
Generates a sample of the Triangular distribution with
mode
set to average . |
static double |
triangularAV(double average,
double variability,
java.util.Random r)
Generates a sample of the Triangular distribution with
mode
set to average . |
int |
uniform_discr(int max)
Generates a sample of the Discrete Uniform distribution in the interval
[0, max], both 0 and max included!
|
int |
uniform_discr(int min,
int max)
Generates a sample of the Discrete Uniform distribution on the interval
[min, max], both min and max included!
|
static int |
uniform_discr(int min,
int max,
java.util.Random r)
Generates a sample of the Discrete Uniform distribution on the interval
[min, max] using the specified random number generator, both 0 and max included!
|
double |
uniform_pos()
Generates a positive random value uniformly distributed on the
interval (0,1).
|
static double |
uniform_pos(java.util.Random r)
Generates a positive random value uniformly distributed on the
interval (0,1),
using the specified random number generator.
|
double |
uniform()
Generates a random value uniformly distributed on the interval [0,1),
the upper bound is not included.
|
double |
uniform(double max)
Generates a sample of the Uniform distribution on the interval [0, max).
|
double |
uniform(double min,
double max)
Generates a sample of the Uniform distribution on the interval
[min, max).
|
static double |
uniform(double min,
double max,
java.util.Random r)
Generates a sample of the Uniform distribution on the interval
[min, max) using the specified random number generator.
|
static double |
uniform(java.util.Random r)
Generates a random value uniformly distributed on the interval [0,1),
using the specified random number generator.
|
UpdateQuery |
update(<any> table)
Returns UpdateQuery that allows to build queries by chaining calls
|
abstract void |
warning(java.lang.String warningText)
Signals a warning during the model run with warningText preceded by the agent full name.
|
abstract void |
warning(java.lang.String warningTextFormat,
java.lang.Object... args)
Signals a warning during the model run with warningText preceded by the agent full name.
|
double |
week()
Returns a time value equal to one week according to the
current time unit setting.
|
double |
weibull(double beta,
double alpha)
Generates a sample of the Weibull distribution with
min set to 0 . |
double |
weibull(double alpha,
double beta,
double min)
Generates a sample of the Weibull distribution.
|
double |
weibull(double min,
double max,
double alpha,
double shift,
double stretch)
Generates a sample of truncated Weibull distribution.
|
static double |
weibull(double min,
double max,
double alpha,
double shift,
double stretch,
java.util.Random r)
Generates a sample of truncated Weibull distribution
using the specified random number generator.
|
static double |
weibull(double alpha,
double beta,
double min,
java.util.Random r)
Generates a sample of the Weibull distribution
using the specified random number generator.
|
static double |
xidz(double a,
double b,
double x)
Tries to divide the first argument by the second.
|
double |
year()
Returns a time value equal to 365 days according to the current time unit setting.
|
static double |
zidz(double a,
double b)
Tries to divide the first argument by the second.
|
createElementDescriptors, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, getElementDesciptors, getElementProperty, getEngine, getExperiment, getExperimentHost, getModelElementsShape, getPresentation, getPresentationShape, getShapeControlDefaultValueBoolean, getShapeControlDefaultValueDouble, getShapeControlDefaultValueInt, getShapeControlDefaultValueString, getViewAreas, iconContains, onSelectionChanged_xjal, onShapeClick, onShapeGroupDraw, presentationContains, readCustomData, updateShapeDynamicProperties, writeCustomData
public static final int SUNDAY
getDayOfWeek(Date)
method indicating
Sunday.public static final int MONDAY
getDayOfWeek(Date)
method indicating
Monday.public static final int TUESDAY
getDayOfWeek(Date)
method indicating
Tuesday.public static final int WEDNESDAY
getDayOfWeek(Date)
method indicating
Wednesday.public static final int THURSDAY
getDayOfWeek(Date)
method indicating
Thursday.public static final int FRIDAY
getDayOfWeek(Date)
method indicating
Friday.public static final int SATURDAY
getDayOfWeek(Date)
method indicating
Saturday.public static final int JANUARY
getMonth(Date)
method indicating the
first month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int FEBRUARY
getMonth(Date)
method indicating the
second month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int MARCH
getMonth(Date)
method indicating the
third month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int APRIL
getMonth(Date)
method indicating the
fourth month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int MAY
getMonth(Date)
method indicating the
fifth month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int JUNE
getMonth(Date)
method indicating the
sixth month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int JULY
getMonth(Date)
method indicating the
seventh month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int AUGUST
getMonth(Date)
method indicating the
eighth month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int SEPTEMBER
getMonth(Date)
method indicating the
ninth month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int OCTOBER
getMonth(Date)
method indicating the
tenth month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int NOVEMBER
getMonth(Date)
method indicating the
eleventh month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int DECEMBER
getMonth(Date)
method indicating the
twelfth month of the year in the Gregorian and Julian calendars.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Values@AnyLogicLegacyAPI public static final int UNDECIMBER
getMonth(Date)
method indicating the
thirteenth month of the year. Although GregorianCalendar
does not use this value, lunar calendars do.getMonth(Date)
,
getMonth()
,
Engine.getMonth()
,
Constant Field Valuespublic static final int AM
getAmPm(Date)
method indicating the
period of the day from midnight to just before noon.getAmPm(Date)
,
getAmPm()
,
Engine.getAmPm()
,
Constant Field Valuespublic static final int PM
getAmPm(Date)
method indicating the period
of the day from noon to just before midnight.getAmPm(Date)
,
getAmPm()
,
Engine.getAmPm()
,
Constant Field Valuespublic static final double infinity
double
.-infinity
@AnyLogicLegacyAPI public static final long TIME_UNIT_MILLISECOND
@AnyLogicLegacyAPI public static final long TIME_UNIT_SECOND
@AnyLogicLegacyAPI public static final long TIME_UNIT_MINUTE
@AnyLogicLegacyAPI public static final long TIME_UNIT_HOUR
@AnyLogicLegacyAPI public static final long TIME_UNIT_DAY
@AnyLogicLegacyAPI public static final long TIME_UNIT_WEEK
@AnyLogicLegacyAPI public static final long TIME_UNIT_MONTH
@AnyLogicLegacyAPI public static final long TIME_UNIT_YEAR
public static final LengthUnits LENGTH_UNIT_CENTIMETER
public static final LengthUnits LENGTH_UNIT_INCH
public static final LengthUnits LENGTH_UNIT_METER
public static final LengthUnits LENGTH_UNIT_FOOT
public static final LengthUnits LENGTH_UNIT_KILOMETER
public static final LengthUnits LENGTH_UNIT_MILE
public static final CustomDistribution.InterpolationType CUSTOM_DISTRIBUTION_INTERPOLATION_NONE
public static final CustomDistribution.InterpolationType CUSTOM_DISTRIBUTION_INTERPOLATION_STEP
public static final CustomDistribution.InterpolationType CUSTOM_DISTRIBUTION_INTERPOLATION_LINEAR
public java.lang.RuntimeException error(java.lang.String errorText)
errorText
- the text describing the error that will be displayed.throw error("my message");
public java.lang.RuntimeException error(java.lang.String errorTextFormat, java.lang.Object... args)
error(String)
but allows error format syntax like
in String.format(String, Object...)
methoderror(String)
,
String.format(String, Object...)public java.lang.RuntimeException errorInModel(java.lang.String errorText)
error()
in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. Examples
are 'entity was unable to leave flowchart block because subsequent block was busy',
'insufficient capacity of pallet rack' etc.errorText
- the text describing the error that will be displayed.throw errorInModel("my message");
public java.lang.RuntimeException errorInModel(java.lang.String errorTextFormat, java.lang.Object... args)
errorInModel(String)
but allows error format syntax like
in String.format(String, Object...)
methoderror()
in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. Examples
are 'entity was unable to leave flowchart block because subsequent block was busy',
'insufficient capacity of pallet rack' etc.public abstract java.lang.RuntimeException error(java.lang.Throwable cause, java.lang.String errorText)
cause
- the cause (which will be saved for more detailed message), may be null
errorText
- the text describing the error that will be displayed.throw error("my message");
public java.lang.RuntimeException error(java.lang.Throwable cause, java.lang.String errorTextFormat, java.lang.Object... args)
error(String)
but allows error format syntax like
in String.format(String, Object...)
methodcause
- the cause (which will be saved for more detailed message), may be null
error(String)
,
String.format(String, Object...)public abstract java.lang.RuntimeException errorInModel(java.lang.Throwable cause, java.lang.String errorText)
error()
in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. Examples
are 'entity was unable to leave flowchart block because subsequent block was busy',
'insufficient capacity of pallet rack' etc.cause
- the cause (which will be saved for more detailed message), may be null
errorText
- the text describing the error that will be displayed.throw errorInModel("my message");
public java.lang.RuntimeException errorInModel(java.lang.Throwable cause, java.lang.String errorTextFormat, java.lang.Object... args)
errorInModel(String)
but allows error format syntax like
in String.format(String, Object...)
methoderror()
in the way of displaying error message:
model logic errors are 'softer' than other errors, they use to happen in the models
and signal the modeler that model might need some parameters adjustments. Examples
are 'entity was unable to leave flowchart block because subsequent block was busy',
'insufficient capacity of pallet rack' etc.cause
- the cause (which will be saved for more detailed message), may be null
errorInModel(String)
,
String.format(String, Object...)public abstract void warning(java.lang.String warningText)
AnyLogicRuntimePreferences.setEnableWarnings(Boolean)
.warningText
, only the first 10 of them are displayed.
warningText
occur, all the subsequent warnings (including new occurrences of those in the first 1000) will stop displaying.
warningText
(e.g. listing names of agents), it could be better to use warning(String, Object...)
.
warningText
- the text describing the warning that will be displayed.public abstract void warning(java.lang.String warningTextFormat, java.lang.Object... args)
String.format(String, Object...)
method.AnyLogicRuntimePreferences.setEnableWarnings(Boolean)
.warningTextFormat
, only the first 10 of them are displayed.
args
- AnyLogic will take care to display only 10
first warnings of each warning type.
warningTextFormat
occur, all the subsequent warnings (including new occurrences of those in the first 1000) will stop displaying.
warningTextFormat
(e.g. listing names of agents), use args
instead.
warning(String)
,
String.format(String, Object...)public SelectQuery selectFrom(<any> table)
table
- to select frompublic InsertQuery insertInto(<any> table)
table
- to insert intopublic DeleteQuery deleteFrom(<any> table)
table
- to delete frompublic UpdateQuery update(<any> table)
table
- to update@AnyLogicInternalCodegenAPI public boolean isLoggingToDB(LoggingType loggingType)
true
if this agent and its internals may log their
data/changes/activity to AnyLogic built-in database (logging options are
configurable in the properties of Database / Log in the Projects tree
inside AnyLogic)loggingType
- type of loggingtrue
if logged, false otherwise@AnyLogicInternalAPI public boolean isLoggingClassToDB(LoggingType loggingType)
true
if this agent type with all
internals may log their data/changes/activity to AnyLogic built-in database
(logging options are configurable in the properties of Database / Log in the Projects tree
inside AnyLogic)loggingType
- type of loggingtrue
if logged, false otherwisepublic boolean selectExists(java.lang.String sql, java.lang.Object... params)
true
if the given sql and params returns at least one result
This function caches its results, to speed up default behavior
Use selectExists(false, sql, params) to get non cached result every timesql
- string containing select queryparams
- array containing select query paramspublic boolean selectExists(boolean cached, java.lang.String sql, java.lang.Object... params)
true
if the given sql and params returns at least one result
This function caches its results, to speed up default behavior
Use selectExists(false, sql, params) to get non cached result every timecached
- if true, then this method will try to use cached values to avoid database accesssql
- string containing select queryparams
- array containing select query paramspublic <T> T selectFirstValue(java.lang.String sql, java.lang.Object... params)
sql
- string containing select queryparams
- array containing select query paramspublic <T> T selectUniqueValue(java.lang.String sql, java.lang.Object... params)
sql
- string containing select queryparams
- array containing select query paramsjava.lang.RuntimeException
- if there is no matching results or more than one matching resultpublic <T> T selectFirstValue(java.lang.Class<T> returnType, java.lang.String sql, java.lang.Object... params)
returnType
- type required to be returned by this functionsql
- string containing select queryparams
- array containing select query paramspublic <T> T selectUniqueValue(java.lang.Class<T> returnType, java.lang.String sql, java.lang.Object... params)
returnType
- type required to be returned by this functionsql
- string containing select queryparams
- array containing select query paramsjava.lang.RuntimeException
- if there is no matching results or more than one matching resultpublic <T> T selectFirstValue(boolean cached, java.lang.String sql, java.lang.Object... params)
cached
- if true, then this method will try to use cached values to avoid database accesssql
- string containing select queryparams
- array containing select query paramspublic <T> T selectUniqueValue(boolean cached, java.lang.String sql, java.lang.Object... params)
cached
- if true, then this method will try to use cached values to avoid database accesssql
- string containing select queryparams
- array containing select query paramsjava.lang.RuntimeException
- if there is no matching results or more than one matching resultpublic <T> T selectFirstValue(boolean cached, java.lang.Class<T> returnType, java.lang.String sql, java.lang.Object... params)
cached
- if true, then this method will try to use cached values to avoid database accessreturnType
- type required to be returned by this functionsql
- string containing select queryparams
- array containing select query paramspublic <T> T selectUniqueValue(boolean cached, java.lang.Class<T> returnType, java.lang.String sql, java.lang.Object... params)
cached
- if true, then this method will try to use cached values to avoid database accessreturnType
- type required to be returned by this functionsql
- string containing select queryparams
- array containing select query paramsjava.lang.RuntimeException
- if there is no matching results or more than one matching result@AnyLogicInternalAPI public <T> T getResult(boolean cached, boolean mustBeUnique, java.lang.Class<T> returnType, java.lang.String sql, java.lang.Object... params)
public <T> java.util.List<T> selectValues(java.lang.String sql, java.lang.Object... params)
sql
- string containing select queryparams
- array containing select query paramspublic <T> java.util.List<T> selectValues(java.lang.Class<T> returnType, java.lang.String sql, java.lang.Object... params)
returnType
- required type of elements returned by this functionsql
- string containing select queryparams
- array containing select query paramspublic double[] selectArrayOfDouble(java.lang.String sql, java.lang.Object... params)
sql
- string containing select queryparams
- array containing select query paramspublic int[] selectArrayOfInt(java.lang.String sql, java.lang.Object... params)
sql
- string containing select queryparams
- array containing select query paramspublic ResultSet selectResultSet(java.lang.String sql, java.lang.Object... params)
sql
- string containing select queryparams
- array containing select query paramspublic int selectAndDoForEach(java.util.function.Consumer<ResultSet> action, java.lang.String sql, java.lang.Object... params)
selectAndDoForEach( rs -> myCollection.add( rs.getString(1) ), "SELECT name FROM parts_table WHERE priority = ?", "high" );
action
- what to do with each record (use get... methods of the given result set)sql
- string containing select queryparams
- array containing select query paramspublic int executeStatement(java.lang.String sql, java.lang.Object... params)
sql
- string containing statementparams
- array containing statement paramspublic TableFunction selectTableFunction(TableFunction tableFunction, java.lang.String sql, java.lang.Object... params)
tableFunction
- the table function to fillsql
- string containing statementparams
- array containing statement paramspublic java.sql.Connection getDatabaseConnection()
@AnyLogicInternalAPI public TableElementDatabaseBuilder createTableElementDatabaseBuilder()
public void sqlSetObject(java.sql.PreparedStatement st, int index, java.lang.Object object)
st
- PreparedStatementindex
- of given parameter in queryobject
- parameter valuepublic <T> T sqlGetObject(java.sql.ResultSet rs, java.lang.String columnLabel, java.lang.Class<T> returnType)
rs
- ResultSet with selected valuescolumnLabel
- name of columnreturnType
- type that will be returnedpublic <T> T sqlGetObject(ResultSet rs, java.lang.String columnLabel, java.lang.Class<T> returnType)
rs
- AnyLogic wrapper for ResultSet with selected valuescolumnLabel
- name of columnreturnType
- type that will be returnedpublic <T> T sqlGetObject(java.sql.ResultSet rs, int index, java.lang.Class<T> returnType)
st
- PreparedStatement built with prepareStatement(String sql) methodindex
- of given parameter in queryreturnType
- type that will be returnedpublic <T> T sqlGetObject(ResultSet rs, int index, java.lang.Class<T> returnType)
rs
- AnyLogic wrapper for ResultSet with selected valuesindex
- of resultreturnType
- type that will be returnedpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.Object... params) throws java.sql.SQLException
java.sql.SQLException
@AnyLogicInternalAPI public <RT> RT castTypes(java.lang.Object result, java.lang.Class<RT> returnType)
public java.lang.Object castTypesBack(java.lang.Object value)
@AnyLogicInternalAPI public <RT> RT castNumberTypes(java.lang.Number number, java.lang.Class<RT> returnType)
public void executeAction(java.lang.String code, java.lang.Object... argDescriptors)
code
- the source codeargDescriptors
- array of pairs: argName1, argValue1, argName2, argValue2, ...public <T> T executeExpression(java.lang.String code, java.lang.Object... argDescriptors)
executeExpression( "exponential( 10 )" )
.executeExpression( "agent.getName() + index", "agent", agent, "index", i - 1 )
code
- java code of expression / actionargDescriptors
- array of pairs: argName1, argValue1, argName2, argValue2, ...public <T> T executeExpression(java.lang.Class<T> returnType, java.lang.String code, java.lang.Object... argDescriptors)
executeExpression( "exponential( 10 )" )
.executeExpression( "agent.getName() + index", "agent", agent, "index", i - 1 )
returnType
- return-type of expression, may be void.class
- for actionscode
- java code of expression / actionargDescriptors
- array of pairs: argName1, argValue1, argName2, argValue2, ...public double time()
public double time(TimeUnits units)
units
- the time units@Deprecated public double getTime()
time()
insteadpublic java.util.Date date()
public java.util.Date timeToDate(double t)
t
- the model timepublic double dateToTime(java.util.Date d)
d
- the date to convertpublic static int getMillisecond(java.util.Date date)
date
.date
- the date for which millisecond is returneddate
public static int getSecond(java.util.Date date)
date
.date
- the date for which second is returneddate
public static int getMinute(java.util.Date date)
date
.date
- the date for which minute is returneddate
public static int getHour(java.util.Date date)
date
.date
- the date for which hour is returneddate
getAmPm(Date)
,
getHourOfDay(Date)
public static int getAmPm(java.util.Date date)
date
is before (AM
)
or after (PM
) noon.PM
.date
- the date for AM/PM information is returnedAM
or PM
depending on the hour of
the given date
getHour(Date)
,
getHourOfDay(Date)
public static int getHourOfDay(java.util.Date date)
date
.date
- the date for which hour of day is returneddate
getHour(Date)
,
getAmPm(Date)
public static int getDayOfWeek(java.util.Date date)
date
.date
- the date for which day of the week is returneddate
public static int getDayOfMonth(java.util.Date date)
date
.date
- the date for which day of the month is returneddate
public static int getDayOfYear(java.util.Date date)
date
.date
- the date for which day of the year is returneddate
public static int getMonth(java.util.Date date)
date
.JANUARY
which is 0; the last depends on the number of
months in a year.date
- the date for which month is returneddate
public static int getYear(java.util.Date date)
date
.date
- the date for which year is returneddate
public int getMillisecond()
public int getSecond()
public int getMinute()
public int getHour()
getAmPm(Date)
,
getHourOfDay(Date)
public int getAmPm()
AM
)
or after (PM
) noon.PM
.AM
or PM
depending on the hour of
the current model date with respect to the start time/date and the model time unitgetHour(Date)
,
getHourOfDay(Date)
public int getHourOfDay()
getHour(Date)
,
getAmPm(Date)
public int getDayOfWeek()
public int getDayOfMonth()
public int getMonth()
JANUARY
which is 0; the last depends on the number of
months in a year.public int getYear()
@Deprecated public double toTimeout(int timeUnit, double amount)
amount
of timeUnit
s from current model datetoTimeout( DAY, 1 )
returns timeout in model time units from
date()
to the ( date()
+ 1 day )
day()
which will always return timeout for 24 hours and may result in events
scheduled at 7:00 or 9:00timeUnit
- time unit, possible values:Calendar.YEAR
Calendar.MONTH
Calendar#WEEK
Calendar#DAY
Calendar.HOUR
Calendar.MINUTE
Calendar.SECOND
Calendar.MILLISECOND
amount
- the number of time units (may be negative -
in this case result will be also negative)amount
of timeUnit
s@Deprecated public double toTimeout(TimeUnits timeUnit, double amount)
toTimeoutInCalendar(TimeUnits, double)
insteadpublic double toTimeoutInCalendar(TimeUnits timeUnit, double amount)
amount
of timeUnit
s from current model datetoTimeout( DAY, 1 )
returns timeout in model time units from
date()
to the ( date()
+ 1 day )
day()
which will always return timeout for 24 hours and may result in events
scheduled at 7:00 or 9:00timeUnit
- time unit, possible values:amount
- the number of time units (may be negative -
in this case result will be also negative)amount
of timeUnit
spublic double getTimeoutToNextTime(int hourOfDay, int minute, int second)
hourOfDay
- the hour of day (using 24-hour clock)minute
- the minutesecond
- the secondpublic static java.util.Date addToDate(java.util.Date date, TimeUnits timeUnit, double amount)
amount
of timeUnit
s from the given dateaddToDate( DAY, 1 )
returns the 'tomorrow' date:
( date + 1 day )
timeUnit
- time unit, possible values:date
- the base dateamount
- the number of time units (may be negative -
in this case the returned date will be in the past relative to the given date
)amount
of timeUnit
s
to the given date
@AnyLogicLegacyAPI public static java.util.Date addToDate(java.util.Date date, int timeUnit, double amount)
amount
of timeUnit
s from the given dateaddToDate( DAY, 1 )
returns the 'tomorrow' date:
( date + 1 day )
timeUnit
- time unit, possible values:Calendar.YEAR
Calendar.MONTH
Calendar#WEEK
Calendar#DAY
Calendar.HOUR
Calendar.MINUTE
Calendar.SECOND
Calendar.MILLISECOND
date
- the base dateamount
- the number of time units (may be negative -
in this case the returned date will be in the past relative to the given date
)amount
of timeUnit
s
to the given date
@Deprecated public static double differenceInDateUnits(TimeUnits timeUnit, java.util.Date date1, java.util.Date date2)
differenceInCalendarUnits(TimeUnits, Date, Date)
insteadpublic static double differenceInCalendarUnits(TimeUnits timeUnit, java.util.Date date1, java.util.Date date2)
(date2 - date1)
between two dates in the given time units.date1
to obtain date2
timeUnit
- the time units for difference computation, possible values:date1
- the first datedate2
- the second date(date2 - date1)
in the given time units@Deprecated public static double differenceInDateUnits(int timeUnit, java.util.Date date1, java.util.Date date2)
(date2 - date1)
between two dates in the given time units.date1
to obtain date2
timeUnit
- the time units for difference computation, possible values:Calendar.YEAR
Calendar.MONTH
Calendar#WEEK
Calendar#DAY
Calendar.HOUR
Calendar.MINUTE
Calendar.SECOND
Calendar.MILLISECOND
date1
- the first datedate2
- the second date(date2 - date1)
in the given time units@Deprecated public double differenceInDateUnits(TimeUnits timeUnit, double time1, double time2)
differenceInCalendarUnits(TimeUnits, double, double)
insteadpublic double differenceInCalendarUnits(TimeUnits timeUnit, double time1, double time2)
(time2 - time1)
between two model dates (corresponding to the given model times)
in the given time units.time1
to obtain time2
timeUnit
- the time units for difference computation, possible values:time1
- the first model timetime2
- the second model time(time2 - time1)
in the given date units@Deprecated public double differenceInDateUnits(int timeUnit, double time1, double time2)
(time2 - time1)
between two model dates (corresponding to the given model times)
in the given time units.time1
to obtain time2
timeUnit
- the time units for difference computation, possible values:Calendar.YEAR
Calendar.MONTH
Calendar#WEEK
Calendar#DAY
Calendar.HOUR
Calendar.MINUTE
Calendar.SECOND
Calendar.MILLISECOND
time1
- the first model timetime2
- the second model time(time2 - time1)
in the given date unitspublic static java.util.Date dropTime(java.util.Date date)
date
with the time 00:00:00.000
date
- the datedate
with the time 00:00:00.000
public static void trace(java.lang.Object o)
o
- the object to printpublic static void trace(java.lang.String textFormat, java.lang.Object... args)
trace(Object)
but allows text format syntax like
in String.format(String, Object...)
methodtrace(Object)
,
String.format(String, Object...)public static void traceln()
public static void traceln(java.lang.Object o)
o
- the object to printpublic static void traceln(java.lang.String textFormat, java.lang.Object... args)
traceln(Object)
but allows text format syntax like
in String.format(String, Object...)
methodtraceln(Object)
,
String.format(String, Object...)public static void traceln(java.awt.Color color, java.lang.Object o)
color
- the color to print with, or null
for the default coloro
- the object to printpublic static void traceln(java.awt.Color color, java.lang.String textFormat, java.lang.Object... args)
traceln(Object)
but allows text format syntax like
in String.format(String, Object...)
method.
Uses the given color in the model's Developer panel console.color
- the color to print with, or null
for the default colortraceln(Object)
,
String.format(String, Object...)public void logToDB(StatisticsContinuous statistics, java.lang.String name)
#onDestroy()
methodpublic void logToDB(StatisticsDiscrete statistics, java.lang.String name)
#onDestroy()
methodpublic void logToDB(DataSet dataSet, java.lang.String name)
#onDestroy()
methodpublic void logToDB(HistogramData histogramData, java.lang.String name)
#onDestroy()
methodpublic void traceToDB(java.lang.Object o)
o
- the object to printpublic void traceToDB(java.lang.String textFormat, java.lang.Object... args)
traceln(Object)
but allows text format syntax like
in String.format(String, Object...)
methodtraceln(Object)
,
String.format(String, Object...)public void setDefaultRandomGenerator(java.util.Random r)
Random.nextDouble()
and
Random.nextGaussian()
methods of the specified random
number generator are called.r
- new random number generator.getDefaultRandomGenerator()
public java.util.Random getDefaultRandomGenerator()
setDefaultRandomGenerator(java.util.Random)
public double uniform()
@AnyLogicInternalAPI public double random()
uniform()
function (has the same logic) instead,
for not to get in confusion with Math.random()
function (the latter
shouldn't be used in models because it doesn't utilize random number generator
of Engine and will result in not reproducible model runs).public static double uniform(java.util.Random r)
r
- the random number generator.public double uniform_pos()
public static double uniform_pos(java.util.Random r)
r
- the random number generator.public double uniform(double max)
uniform(0, max)
.
For more details see uniform(double,double)
.max
- the maximum x value (excluded from the interval).public double uniform(double min, double max)
The Uniform distribution is a continuous distribution bounded on both sides, i.e. the sample lays in the interval [min,max). The probability density does not depend on the value of x. It is a special case of the Beta distribution. It is frequently called rectangular distribution (see Johnson et al).
The Uniform distribution is used to represent a random variable with constant likelihood of being in any small interval between min and max. Note that the probability of max value is 0; the max point never occurs.
min
- the minimum x value (included into the interval).max
- the maximum x value (excluded from the interval).public static double uniform(double min, double max, java.util.Random r)
uniform(double,double)
.min
- the minimum x value (included into the interval).max
- the maximum x value (excluded from the interval).r
- the random number generator.public int uniform_discr(int max)
uniform_discr(0, max)
.
For more details see uniform_discr(int,int)
.max
- the maximum x value (included into the interval).public int uniform_discr(int min, int max)
The Discrete Uniform distribution is a discrete distribution bounded on [min, max] with constant probability at every value on or between the bounds. Sometimes called the discrete rectangular distribution, it arises when an event can have a finite and equally probable number of outcomes.
min
- the minimum x value (included into the interval).max
- the maximum x value (also included into the interval).public static int uniform_discr(int min, int max, java.util.Random r)
uniform_discr(int,int)
.min
- the minimum x value (included into the interval).max
- the maximum x value (also included into the interval).r
- the random number generator.public java.awt.Color randomColor()
public boolean randomTrue(double p)
true
with the given probability p
.
Is equivalent to uniform() < p
.
The probability of false
is 1 - p
correspondingly.p
- the probability of true
.true
with probability p
,
false
with probability 1 - p
.randomFalse(double)
,
bernoulli(double)
public static boolean randomTrue(double p, java.util.Random r)
true
with the given probability p
using the specified random number generator.randomTrue(double)
p
- the probability of true
.r
- the random number generator.true
with probability p
,
false
with probability 1 - p
.randomFalse(double, Random)
,
bernoulli(double, Random)
public boolean randomFalse(double p)
false
with the given probability p
.
Is equivalent to uniform() >= p
.
The probability of true
is 1 - p
correspondingly.p
- the probability of false
.false
with probability p
,
true
with probability 1 - p
randomTrue(double)
,
bernoulli(double)
public static boolean randomFalse(double p, java.util.Random r)
false
with the given probability p
using the specified random number generator.randomFalse(double)
p
- the probability of false
.r
- the random number generator.false
with probability p
,
true
with probability 1 - p
randomTrue(double, Random)
,
bernoulli(double, Random)
@AnyLogicLegacyAPI public <T> T getRandom(java.util.Collection<T> collection)
#randomFrom(Collection)
@AnyLogicLegacyAPI public static <T> T getRandom(java.util.Collection<T> collection, java.util.Random r)
#randomFrom(Collection, Random)
public <T> T randomFrom(java.lang.Iterable<T> collection)
null
.collection.get( uniform_discr( collection.size() - 1 ) )
collection
- the collection to select an element fromnull
,
if collection is emptyrandomWhere(Iterable, Predicate)
public static <T> T randomFrom(java.lang.Iterable<T> collection, java.util.Random r)
randomFrom(Iterable)
collection
- the collection to select an element fromr
- the random number generator.null
,
if collection is emptypublic <T> T randomWhere(java.lang.Iterable<T> collection, java.util.function.Predicate<T> condition)
null
.collection
- the collection to select an element fromcondition
- the condition to testnull
,
if collection is emptyrandomFrom(Iterable)
public static <T> T randomWhere(java.lang.Iterable<T> collection, java.util.function.Predicate<T> condition, java.util.Random r)
randomWhere(Iterable, Predicate)
collection
- the collection to select an element fromcondition
- the condition to testr
- the random number generator.null
,
if collection is emptypublic <T> T randomFrom(T[] array)
array[ uniform_discr( array.length - 1 ) ]
array
- the array to select an element fromnull
,
if the array is emptyrandomWhere(Object[], Predicate)
public static <T> T randomFrom(T[] array, java.util.Random r)
#randomFrom(T[])
array
- the array to select an element fromr
- the random number generatornull
,
if the array is emptypublic <T> T randomWhere(T[] array, java.util.function.Predicate<T> condition)
array
- the array to select an element fromcondition
- the condition to testnull
,
if the array is emptyrandomFrom(Object[])
public static <T> T randomWhere(T[] array, java.util.function.Predicate<T> condition, java.util.Random r)
#randomFrom(T[])
array
- the array to select an element fromcondition
- the condition to testr
- the random number generatornull
,
if the array is emptypublic <T extends java.lang.Enum<T>> T randomFrom(java.lang.Class<T> enumeration)
NullPointerException
if the given class is null
or not an enumeration classenumeration
- the enumeration classr
- the random number generatorpublic static <T extends java.lang.Enum<T>> T randomFrom(java.lang.Class<T> enumeration, java.util.Random r)
NullPointerException
if the given class is null
or not an enumeration classenumeration
- the enumeration classr
- the random number generatorpublic <T> T randomlyCreate(java.util.function.Supplier<? extends T>... constructors)
randomlyCreate( OpenCar::new, BoxCar::new, HopperCar::new )
constructors
- constructors or other functions / lambda expressions which return object instancesnull
if there are no constructors providedpublic <T> T randomlyCreate(java.lang.Class<? extends T>... classes)
randomlyCreate( OpenCar.class, BoxCar.class, HopperCar.class )
classes
- object classesnull
if there are no classes providedpublic static <T> T randomlyCreate(java.util.Random r, java.util.function.Supplier<? extends T>... constructors)
randomlyCreate( myRandom, OpenCar::new, BoxCar::new, HopperCar::new )
constructors
- constructors or other functions / lambda expressions which return object instancesnull
if there are no constructors providedpublic static <T> T randomlyCreate(java.util.Random r, java.lang.Class<? extends T>... classes)
randomlyCreate( myRandom, OpenCar.class, BoxCar.class, HopperCar.class )
classes
- object classesnull
if there are no classes providedpublic void shuffle(java.util.List<?> list)
list
- the list to be shuffled.public int bernoulli(double p)
p
and 0 with probability 1 - p
.p
- the probability of 1.public static int bernoulli(double p, java.util.Random r)
bernoulli(double)
.p
- the probability of 1.r
- the random number generator.public double beta(double p, double q)
min
set to 0
and max
set to 1
.
Is equivalent to beta(p, q, 0, 1)
.
For more details see beta(double,double,double,double)
.p
- the lower shape parameter > 0.q
- the upper shape parameter > 0.public double beta(double p, double q, double min, double max)
The Beta distribution is a continuous distribution that has both upper and lower finite bounds. Because many real situations can be bounded in this way, the Beta distribution can be used empirically to estimate the actual distribution before much data is available. Even when data is available, the Beta distribution should fit most data in a reasonable fashion, although it may not be the best fit. The Uniform distribution is a special case of the Beta distribution with p, q = 1.
The Beta distribution can approach zero or infinity at either of its bounds, with p controlling the lower bound and q controlling the upper bound. Values of p, q < 1 cause the Beta distribution to approach infinity at that bound. Values of p, q > 1 cause the Beta distribution to be finite at that bound.
Beta distributions have many, many uses. As summarized in Johnson et al Beta distributions have been used to model distributions of hydrologic variables, logarithm of aerosol sizes, activity time in PERT analysis, isolation data in photovoltaic system analysis, porosity / void ratio of soil, phase derivatives in communication theory, size of progeny in Escherchia Coli, dissipation rate in breakage models, proportions in gas mixtures, steady-state reflectivity, clutter and power of radar signals, construction duration, particle size, tool wear, and others. Many of these uses occur because of the doubly bounded nature of the Beta distribution.
p
- the lower shape parameter > 0.q
- the upper shape parameter > 0.min
- the minimum x value.max
- the maximum x value.public double beta(double min, double max, double p, double q, double shift, double stretch)
beta(p, q, 0, 1)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.beta(double, double, double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".p
- the lower shape parameter > 0. Also known as alpha
parameterq
- the upper shape parameter > 0. Also known as beta
parametershift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedpublic static double beta(double p, double q, double min, double max, java.util.Random r)
beta(double,double,double,double)
.p
- the lower shape parameter > 0.q
- the upper shape parameter > 0.min
- the minimum x value.max
- the maximum x value.r
- the random number generator.public static double beta(double min, double max, double p, double q, double shift, double stretch, java.util.Random r)
beta(p, q, 0, 1)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.beta(double, double, double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".p
- the lower shape parameter > 0. Also known as alpha
parameterq
- the upper shape parameter > 0. Also known as beta
parametershift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedr
- the random number generator.public int binomial(double p)
n
set
to 1
.
Is equivalent to binomial(p, 1)
.
For more details see binomial(double,int)
.p
- the p
parameter of the Binomial distribution, i.e.
the probability of the event occurrence.public int binomial(double p, int n)
p
- the probability of the event occurrence.n
- the number of trials.public double binomial(double min, double max, double p, double n, double shift, double stretch)
binomial(p, n)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.binomial(double, int)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".p
- the probability of the event occurrence.n
- the number of trials. If n
is not an
integer it will be rounded to the nearest integer.shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedpublic static int binomial(double p, int n, java.util.Random r)
p
- the probability of the event occurrence.n
- the number of trials.r
- the random number generator.public static double binomial(double min, double max, double p, double n, double shift, double stretch, java.util.Random r)
binomial(p, n)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.binomial(double, int)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".p
- the probability of the event occurrence.n
- the number of trials. If n
is not an
integer it will be rounded to the nearest integer.shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedr
- the random number generator.public double cauchy(double lambda)
theta
set to 0
.
Is equivalent to cauchy(lambda, 0)
.
For more details see cauchy(double,double)
.lambda
- the scaling parameter > 0.public double cauchy(double lambda, double theta)
The Cauchy distribution is an unbounded continuous distribution that has a sharp central peak but significantly broad tails. The tails are much heavier than the tails of the Normal distribution.
The Cauchy distribution can be used to represent the ratio of two equally distributed parameters in certain cases, e.g. the ratio of two normal parameters. This distribution has no finite moments because of its extensive tails. Thus it can also be used to generate wildly divergent data a long as the data has a central tendency.
lambda
- the scaling parameter > 0.theta
- the mode, or central peak position.public static double cauchy(double lambda, double theta, java.util.Random r)
cauchy(double,double)
.lambda
- the scaling parameter > 0.theta
- the mode, or central peak position.r
- the random number generator.public double chi2(double nu)
min
set to 0
.
Is equivalent to chi2(nu, 0)
.
For more details see chi2(double,double)
nu
- the shape parameter.public double chi2(double nu, double min)
The Chi Squared is a continuous distribution bounded on the lower side. Note that the Chi Squared distribution is a subset of the Gamma distribution with beta=2 and alpha=nμ/2. Like the Gamma distribution, it has three distinct regions. For nμ=2, the Chi Squared distribution reduces to the Exponential distribution, starting at a finite value at minimum x and decreasing monotonically thereafter. For nμ<2, the Chi Squared distribution tends to infinity at minimum x and decreases monotonically for increasing x. For nμ>2, the Chi Squared distribution is 0 at minimum x, peaks at a value that depends on nμ, decreasing monotonically thereafter.
Because the Chi Squared distribution does not have a scaling parameter, its utilization is somewhat limited. Frequently, this distribution will try to represent data with a clustered distribution with nμ less than 2. However, it can be viewed as the distribution of the sum of squares of independent unit normal variables with nμ degrees of freedom and is used in many statistical tests.
Examples of each of the regions of the Chi Squared distribution are shown above. Note that the peak of the distribution moves away from the minimum value for increasing nu, but with a much broader distribution.
nu
- the shape parameter.min
- the minimum x value.public static double chi2(double nu, double min, java.util.Random r)
chi2(double,double)
.nu
- the shape parameter.min
- the minimum x value.r
- the random number generator.public double erlang(double beta, int m)
min
set to 0.
Is equivalent to erlang(beta, m, 0)
.
For more details see erlang(double,int,double)
/beta
- the scale factor > 0.m
- the shape factor (positive integer).public double erlang(double beta, int m, double min)
The Erlang distribution is a continuous distribution bounded on the lower side. It is a special case of the Gamma distribution where the parameter, m, is restricted to a positive integer. As such, the Erlang distribution has no region where F(x) tends to infinity at the minimum value of x [m<1], but does have a special case at m=1, where it reduces to the Exponential distribution.
The Erlang distribution has been used extensively in reliability and in queuing theory, thus in discrete event simulation, because it can be viewed as the sum of m exponentially distributed random variables, each with mean beta.
beta
- the scale factor > 0.m
- the shape factor (positive integer).min
- the minimum x value.public static double erlang(double beta, int m, double min, java.util.Random r)
erlang(double,int,double)
.beta
- the scale factor > 0.m
- the shape factor (positive integer).min
- the minimum x value.r
- the random number generator.public double exponential()
lambda
set to 1
and min
set to
0
.
Is equivalent to exponential(1, 0)
.
For more details see exponential(double,double)
public double exponential(double lambda)
min
set to 0
.
Is equivalent to exponential(lambda, 0)
.
For more details see exponential(double,double)
.lambda
- the shape parameter.public double exponential(double lambda, double min)
The Exponential distribution is a continuous distribution bounded on the lower side. It's shape is always the same, starting at a finite value at the minimum and continuously decreasing at larger x. The Exponential distribution decreases rapidly for increasing x.
The Exponential distribution is frequently used to represent the time between random occurrences, such as the time between arrivals at a specific location in a queuing model or the time between failures in reliability models. It has also been used to represent the services times of a specific operation. Further, it serves as an explicit manner in which the time dependence on noise may be treated. As such, these models are making explicit use of the lack of history dependence of the exponential distribution; it has the same set of probabilities when shifted in time. Even when Exponential models are known to be inadequate to describe the situation, their mathematical tractability provides a good starting point. Later, a more complex distribution such as Erlang or Weibull may be investigated.
lambda
- the shape parameter.min
- the minimum x value.public double exponential(double min, double max, double shift, double stretch)
exponential(1, 0)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.exponential(double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedpublic static double exponential(double lambda, double min, java.util.Random r)
exponential(double,double)
.lambda
- the shape parameter.min
- the minimum x value.r
- the random number generator.public static double exponential(double min, double max, double shift, double stretch, java.util.Random r)
exponential(1, 0)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.exponential(double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedr
- the random number generator.public double gamma(double alpha, double beta)
min
set
to 0
.
Is equivalent to gamma(alpha, beta, 0)
.
For more details see gamma(double,double,double)
.alpha
- the shape parameter > 0.beta
- the scale parameter > 0.public double gamma(double alpha, double beta, double min)
The Gamma distribution is a continuous distribution bounded at the lower side. It has three distinct regions. For alpha=1, the Gamma distribution reduces to the Exponential distribution, starting at a finite value at minimum x and decreasing monotonically thereafter. For alpha<1, the Gamma distribution tends to infinity at minimum x and decreases monotonically for increasing x. For alpha>1, the Gamma distribution is 0 at minimum x, peaks at a value that depends on both alpha and beta, decreasing monotonically thereafter. If alpha is restricted to positive integers, the Gamma distribution is reduced to the Erlang distribution.
Note that the Gamma distribution also reduces to the Chi Squared distribution for min=0, beta=2, and alpha=nμ/2. It can then be viewed as the distribution of the sum of squares of independent unit normal variables, with nμ degrees of freedom and is used in many statistical tests.
The Gamma distribution can also be used to approximate the Normal distribution, for large alpha, while maintaining its strictly positive values of x [actually (x-min)].
The Gamma distribution has been used to represent lifetimes, lead times, personal income data, a population about a stable equilibrium, interarrival times, and service times. In particular, it can represent lifetime with redundancy (see Johnson, Shooman).
Examples of each of the regions of the Gamma distribution are shown above. Note the peak of the distribution moving away from the minimum value for increasing alpha, but with a much broader distribution.
alpha
- the shape parameter > 0.beta
- the scale parameter > 0.min
- the minimum x value.public double gamma(double min, double max, double alpha, double shift, double stretch)
gamma(alpha, 1, 0)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.gamma(double, double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".alpha
- the shape parameter > 0. Also known as order.
If less than 1, then 1 will be used.shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedpublic static double gamma(double alpha, double beta, double min, java.util.Random r)
gamma(double,double,double)
.alpha
- the shape parameter > 0.beta
- the scale parameter > 0.min
- the minimum x value.r
- the random number generator.public static double gamma_frac(double a, java.util.Random r)
public static double gamma(double min, double max, double alpha, double shift, double stretch, java.util.Random r)
gamma(alpha, 1, 0)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.gamma(double, double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".alpha
- the shape parameter > 0. Also known as order.
If less than 1, then 1 will be used.shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedr
- the random number generator.public int geometric(double p)
The Geometric distribution is a discrete distribution bounded at 0 and unbounded on the high side. It is a special case of the Negative Binomial distribution. In particular, it is the direct discrete analog for the continuous Exponential distribution. The Geometric distribution has no history dependence, its probability at any value being independent of a shift along the axis.
Generated sample has the distribution of the number X of trials
needed to get one success. Returned values are { 1, 2, 3, ... }.
If you need 'geometric' in terms of "number of failures before
the 1st success", please use the expression
geometric( p ) - 1
.
The Geometric distribution has been used for inventory demand, marketing survey returns, a ticket control problem, and meteorological models.
p
- the probability of occurrence.public static int geometric(double p, java.util.Random r)
geometric(double)
.p
- the probability of occurrence.r
- the random number generator.public int hypergeometric(int ss, int dn, int ps)
The Hypergeometric distribution is a discrete distribution bounded by [0,s]. It describes the number of defects, x, in a sample of size s from a population of size N which has m total defects. The ratio of m/N = p is sometimes used rather than m to describe the probability of a defect. Note that defects may be interpreted as successes, in which case x is the number of failures until (s-x) successes. The sample is taken without replacement.
The Hypergeometric distribution is used to describe sampling from a population where an estimate of the total number of defects is desired. It has also been used to estimate the total population of species from a tagged subset. However, estimates of all three parameters from a data set are notoriously fickle and error prone, so use of these parameters to estimate a physical quantity without specifying at least one of the parameters is not recommended. (see Johnson et. al.1)
ss
- the sample size.dn
- the number of defects in the population.ps
- the size of the population.public static int hypergeometric(int ss, int dn, int ps, java.util.Random r)
hypergeometric(int,int,int)
.ss
- the sample size.dn
- the number of defects in the population.ps
- the size of the population.public double gumbel1(double a, double b)
p(x) = a b exp(-(b exp(-ax) + ax))
a
- the 'a' parameterb
- the 'b' parameterpublic static double gumbel1(double a, double b, java.util.Random r)
gumbel1(double,double)
.a
- the 'a' parameterb
- the 'b' parameterr
- the random number generator.public double gumbel2(double a, double b)
p(x) = b a x^-(a+1) exp(-b x^-a))
a
- the 'a' parameterb
- the 'b' parameterpublic static double gumbel2(double a, double b, java.util.Random r)
gumbel2(double,double)
.a
- the 'a' parameterb
- the 'b' parameterr
- the random number generator.public double laplace(double phi, double theta)
The Laplace distribution, sometimes called the double exponential distribution, is an unbounded continuous distribution that has a very sharp central peak, located at theta. The distribution scales with phi.
The Laplace distribution can be used to describe the difference of two independent, and equally distributed, exponentials. It is also used in error analysis. (see Johnson et.al.1)
phi
- the scaling parameter.theta
- the mode, or central peak position.public static double laplace(double phi, double theta, java.util.Random r)
laplace(double,double)
.phi
- the scaling parameter.theta
- the mode, or central peak position.r
- the random number generator.public int logarithmic(double theta)
The Logarithmic distribution is a discrete distribution bounded by [1,...]. Theta is related to the sample size and the mean.
The Logarithmic distribution is used to describe the diversity of a sample, that is, how many of a given type of thing are contained in a sample of things. For instance, this distribution has been used to describe the number of individuals of a given species in a sampling of mosquitoes, or the number of parts of a given type in a sampling of inventory. (see Johnson et.al.1)
theta
- the shape/scale parameter 0public static int logarithmic(double theta, java.util.Random r)
logarithmic(double)
.theta
- the shape/scale parameter 0r
- the random number generator.public double logistic(double beta, double alpha)
The Logistic distribution is an unbounded continuous distribution which is symmetrical about its mean [and shift parameter], alpha. The shape of the Logistic distribution is very much like the Normal distribution, except that the Logistic distribution has broader tails.
The Logistic function is most often used a growth model: for populations, for weight gain, for business failure, etc. The Logistic distribution can be can be used to test for the suitability of such a model, with transformation to get back to the minimum and maximum values for the Logistic function. Occasionally, the Logistic function is used in place of the Normal function where exceptional cases play a larger role.(see Johnson et. al.1)
beta
- the scale parameter > 0.alpha
- the shift parameter.public static double logistic(double beta, double alpha, java.util.Random r)
logistic(double,double)
.beta
- the scale parameter > 0.alpha
- the shift parameter.r
- the random number generator.public double lognormal(double mu, double sigma, double min)
The Lognormal distribution is a continuous distribution bounded on the lower side. It is always 0 at minimum x, rising to a peak that depends on both mu and sigma, then decreasing monotonically for increasing x.
By definition, the natural logarithm of a Lognormal random variable is a Normal random variable. Its parameters are usually given in terms of this included Normal.
The Lognormal distribution can also be used to approximate the Normal distribution, for small sigma, while maintaining its strictly positive values of x [actually (x-min)].
The Lognormal distribution is used in many different areas including the distribution of particle size in naturally occurring aggregates, dust concentration in industrial atmospheres, the distribution of minerals present in low, concentrations, duration of sickness absence, physicians' consultant time, lifetime distributions in reliability, distribution of income, employee retention, and many applications modeling weight, height, etc.(see Johnson et. al.1)
mu
- the mean of the included Normal.sigma
- the standard deviation of the included Normal.min
- the minimum x value.public static double lognormal(double mu, double sigma, double min, java.util.Random r)
lognormal(double,double,double)
.mu
- the mean of the included Normal.sigma
- the standard deviation of the included Normal.min
- the minimum x value.r
- the random number generator.public int negativeBinomial(double p, double n)
The Negative Binomial distribution is a discrete distribution bounded on the low side at 0 and unbounded on the high side. The Negative Binomial distribution reduces to the Geometric Distribution for n = 1. The Negative Binomial distribution gives the total number of trials, x, to get k events (failures...), each with the constant probability, p, of occurring.
The Negative Binomial distribution has many uses; some occur because it provides a good approximation for the sum or mixing of other discrete distributions. By itself, it is used to model accident statistics, birth-and-death processes, market research and consumer expenditure, lending library data, biometrical data, and many others. (see Johnson et. al.1)
p
- the probability of event (in the interval (0,1)).n
- the number of desired events.public double negativeBinomial(double min, double max, double p, double n, double shift, double stretch)
negativeBinomial(p, n)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.negativeBinomial(double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".p
- the probability of the event occurrence.n
- the number of trials. If n
is not an
integer it will be rounded to the nearest integer.shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedpublic static int negativeBinomial(double p, double n, java.util.Random r)
negativeBinomial(double,double)
.p
- the probability of event (in the interval (0,1)).n
- the number of desired events.r
- the random number generator.public static double negativeBinomial(double min, double max, double p, double n, double shift, double stretch, java.util.Random r)
negativeBinomial(p, n)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.negativeBinomial(double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".p
- the probability of the event occurrence.n
- the number of trials. If n
is not an
integer it will be rounded to the nearest integer.shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedr
- the random number generator.public double normal()
mean
set
to 0
and sigma
set to 1
.
Is equivalent to normal(1, 0)
.
For more details see normal(double,double)
.public double normal(double sigma)
mean
set
to 0
.
Is equivalent to normal(sigma, 0)
.
For more details see normal(double,double)
sigma
- the shape parameter = standard deviation.public double normal(double sigma, double mean)
The Normal distribution is an unbounded continuous distribution. It is sometimes called a Gaussian distribution or the bell curve. Because of its property of representing an increasing sum of small, independent errors, the Normal distribution finds many, many uses in statistics. It is wrongly used in many situations. Possibly, the most important test in the fitting of analytical distributions is the elimination of the Normal distribution as a possible candidate.
The Normal distribution is used as an approximation for the Binomial distribution when the values of n, p are in the appropriate range. The Normal distribution is frequently used to represent symmetrical data, but suffers from being unbounded in both directions. If the data is known to have a lower bound, it may be better represented by suitable parameterization of the Lognormal, Weibull or Gamma distributions. If the data is known to have both upper and lower bounds, the Beta distribution can be used, although much work has been done on truncated Normal distributions.
sigma
- the shape parameter = standard deviation.mean
- the shift parameter = mean value.public double normal(double min, double max, double shift, double stretch)
normal(1, 0)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.normal(double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the right = mean valuestretch
- the stretch parameter that indicates how much the
distribution will be stretched = standard deviationpublic static double normal(double sigma, double mean, java.util.Random r)
normal(double,double)
sigma
- the shape parameter = standard deviation.mean
- the shift parameter = mean value.r
- the random number generator.public static double normal(double min, double max, double shift, double stretch, java.util.Random r)
normal(1, 0)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.normal(double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the right = mean valuestretch
- the stretch parameter that indicates how much the
distribution will be stretched = standard deviationr
- the random number generator.public double pareto(double alpha)
min
set
to 1
.
Is equivalent to pareto(alpha, 1)
.
For more details see pareto(double,double)
alpha
- the scale parameter > 0.public double pareto(double alpha, double min)
The Pareto distribution is a continuous distribution bounded on the lower side. It has a finite value at the minimum x and decreases monotonically for increasing x. A Pareto random variable is the exponential of an Exponential random variable, and possesses many of the same characteristics.
The Pareto distribution has, historically, been used to represent the income distribution of a society. It is also used to model many empirical phenomena with very long right tails, such as city population sizes, occurrence of natural resources, stock price fluctuations, size of firms, brightness of comets, and error clustering in communication circuits.
The shape of the Pareto curve changes slowly with alpha, but the tail of the distribution increases dramatically with decreasing alpha.
alpha
- the scale parameter > 0.min
- the minimum x value.public static double pareto(double alpha, double min, java.util.Random r)
pareto(double,double)
.alpha
- the scale parameter > 0.min
- the minimum x value.r
- the random number generator.public double pert(double min, double max, double mode)
The PERT distribution is a continuous distribution bounded on both sides. Being an alternative distribution to the Triangular, it has the same three inputs, Minimum, Most Likely, and Maximum, but is a smooth curve that puts less emphasis on extreme values.
The PERT distribution is often used in risk analysis applications, e.g. in Monte Carlo simulations to assess cost and project duration risks.
min
- the minimum x value.max
- the maximum x value.mode
- the most likely x value.public static double pert(double min, double max, double mode, java.util.Random r)
pert(double, double, double)
min
- the minimum x value.mode
- the most likely x value.max
- the maximum x value.r
- the random number generator.public int poisson(double lambda)
The Poisson distribution is a discrete distribution bounded at 0 on the low side and unbounded on the high side. The Poisson distribution is a limiting form of the Hypergeometric distribution.
The Poisson distribution finds frequent use because it represents the infrequent occurrence of events whose rate is constant. This includes many types of events in time or space such as arrivals of telephone calls, defects in semiconductor manufacturing, defects in all aspects of quality control, molecular distributions, stellar distributions, geographical distributions of plants, shot noise, etc. It is an important starting point in queuing theory and reliability theory. Note that the time between arrivals (defects) is Exponentially distributed, which makes this distribution a particularly convenient starting point even when the process is more complex.
The Poisson distribution peaks near lambda and falls off rapidly on either side.
lambda
- the rate of occurrence.public double poisson(double min, double max, double mean, double shift, double stretch)
poisson(mean)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.poisson(double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".mean
- the mean value for the distribution = rate of event occurrenceshift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedpublic static int poisson(double lambda, java.util.Random r)
poisson(double)
.lambda
- the rate of occurrence.r
- the random number generator.public static double poisson(double min, double max, double mean, double shift, double stretch, java.util.Random r)
poisson(mean)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.poisson(double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".mean
- the mean value for the distribution = rate of event occurrenceshift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the stretch parameter that indicates how much the
distribution will be stretchedr
- the random number generator.public double rayleigh(double sigma)
min
set to 0
.
Is equivalent to rayleigh(sigma, 0)
.
For more details see rayleigh(double,double)
sigma
- the scale parameter > 0.public double rayleigh(double sigma, double min)
The Rayleigh distribution is a continuous distribution bounded on the lower side. It is a special case of the Weibull distribution with alpha =2 and beta/sqrt(2) =sigma. Because of the fixed shape parameter, the Rayleigh distribution does not change shape although it can be scaled.
The Rayleigh distribution is frequently used to represent lifetimes because its hazard rate increases linearly with time, e.g. the lifetime of vacuum tubes. This distribution also finds application in noise problems in communications.
sigma
- the scale parameter > 0.min
- the minimum x value.public static double rayleigh(double sigma, double min, java.util.Random r)
rayleigh(double,double)
sigma
- the scale parameter > 0.min
- the minimum x value.r
- the random number generator.public double triangularAV(double average, double variability)
mode
set to average
.triangular( average * (1 - variability), average * (1 + variability) )
. For more details see triangular(double,double,double)
.average
- the most likely x valuevariability
- the percent [0...1] of average
representing the
half of distribution range, where the generated sample fallspublic static double triangularAV(double average, double variability, java.util.Random r)
mode
set to average
.triangular( average * (1 - variability), average * (1 + variability) )
. For more details see triangular(double, double, double, Random)
.
Uses the specified random number generator.average
- the most likely x valuevariability
- the percent [0...1] of average
representing the
half of distribution range, where the generated sample fallsr
- the random number generator.public double triangular(double min, double max)
mode
set to (min + max)/2
.
Is equivalent to triangular(min, (min + max)/2, max)
.
For more details see triangular(double,double,double)
.min
- the minimum x value.max
- the maximum x value.public double triangular(double min, double max, double mode)
The Triangular distribution is a continuous distribution bounded on both sides.
The Triangular distribution is often used when no or little data is available; it is rarely an accurate representation of a data set. However, it is employed as the functional form of regions for fuzzy logic due to its ease of use.
The Triangular distribution can take on very skewed forms including negative skewness. For the exceptional cases where the mode is either the min or max, the Triangular distribution becomes a right triangle.
min
- the minimum x value.max
- the maximum x value.mode
- the most likely x value.public double triangular(double min, double max, double left, double mode, double right)
triangular(left, right, mode)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.triangular(double, double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".left
- the minimum x value for triangular distribution.mode
- the most likely x value for triangular distribution.right
- the maximum x value for triangular distribution.public static double triangular(double min, double max, double mode, java.util.Random r)
triangular(double,double,double)
.min
- the minimum x value.max
- the maximum x value.mode
- the most likely x value.r
- the random number generator.public static double triangular(double min, double max, double left, double mode, double right, java.util.Random r)
triangular(left, right, mode)
is stretched by
stretch
coefficient, then shifted to the right
by shift
, after that it is truncated to fit in
[min, max]
interval. Truncation is performed by discarding
every sample outside this interval and taking subsequent try.triangular(double, double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".left
- the minimum x value for triangular distribution.mode
- the most likely x value for triangular distribution.right
- the maximum x value for triangular distribution.r
- the random number generator.public double weibull(double beta, double alpha)
min
set to 0
.
Is equivalent to weibull(alpha, beta, 0)
.
For more details see weibull(double,double,double)
.beta
- the scale parameter > 0.alpha
- the shape parameter > 0.public double weibull(double alpha, double beta, double min)
The Weibull distribution is a continuous distribution bounded on the lower side. Because it provides one of the limiting distributions for extreme values, it is also referred to as the Frechet distribution and the Weibull-Gnedenko distribution.
Like the Gamma distribution, it has three distinct regions. For alpha=1, beta=1/lambda the Weibull distribution is reduced to the Exponential distribution, starting at a finite value at minimum x and decreasing monotonically thereafter. For alpha<1, the Weibull distribution tends to infinity at minimum x and decreases monotonically for increasing x. for alpha>1, the Weibull distribution is 0 at minimum x, peaks at a value that depends on both alpha and beta, decreasing monotonically thereafter. Uniquely, the Weibull distribution has negative skewness for alpha>3.6.
The Weibull distribution can also be used to approximate the Normal distribution for alpha=3.6, while maintaining its strictly positive values of x [actually (x-min)], although the kurtosis is slightly smaller than 3, the Normal value.
The Weibull distribution derived its popularity from its use to model the strength of materials, and has since been used to model just about everything. In particular, the Weibull distribution is used to represent wearout lifetimes in reliability, wind speed, rainfall intensity, health related issues, germination, duration of industrial stoppages, migratory systems, and thunderstorm data.
alpha
- the shape parameter > 0.beta
- the scale parameter > 0.min
- the minimum x value.public double weibull(double min, double max, double alpha, double shift, double stretch)
weibull(alpha, stretch, 0)
is shifted to the right by shift
and then truncated
to fit in [min, max]
interval.
Truncation is performed by discarding every sample outside
this interval and taking subsequent try.weibull(double, double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".alpha
- the shape parameter > 0.shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the scale parameter.public static double weibull(double alpha, double beta, double min, java.util.Random r)
weibull(double,double,double)
.alpha
- the shape parameter > 0.beta
- the scale parameter > 0.min
- the minimum x value.r
- the random number generator.public static double weibull(double min, double max, double alpha, double shift, double stretch, java.util.Random r)
weibull(alpha, stretch, 0)
is shifted to the right by shift
and then truncated
to fit in [min, max]
interval.
Truncation is performed by discarding every sample outside
this interval and taking subsequent try.weibull(double, double, double)
min
- the minimum value that this function will return.
The distribution is truncated to return values above this.
If the sample (stretched and shifted) is below this value
it will be discarded and another sample will be drawn.
Use -infinity
for "No limit".max
- the maximum value that this function will return.
The distribution is truncated to return values below this.
If the sample (stretched and shifted) is bigger than this value
it will be discarded and another sample will be drawn.
Use +infinity
for "No limit".alpha
- the shape parameter > 0.shift
- the shift parameter that indicates how much the
(stretched) distribution will shifted to the rightstretch
- the scale parameter.r
- the random number generator.public static final double sqr(double v)
v2
)v
- the valuev * v
public static boolean isFinite(double v)
true
if the given value is finite (not +/-infinity or NaN)v
- the value-infinity < v && v < +infinity
public static final double getLength(double dx, double dy)
(dx, dy)
dx
- the x coordinate of the vectordy
- the y coordinate of the vector(dx, dy)
public static final double getLengthSq(double dx, double dy)
(dx, dy)
dx
- the x coordinate of the vectordy
- the y coordinate of the vector(dx, dy)
public static final double getLength(double dx, double dy, double dz)
(dx, dy, dz)
dx
- the x coordinate of the vectordy
- the y coordinate of the vectordz
- the z coordinate of the vector(dx, dy, dz)
public static final double getLengthSq(double dx, double dy, double dz)
(dx, dy, dz)
dx
- the x coordinate of the vectordy
- the y coordinate of the vectordz
- the z coordinate of the vector(dx, dy, dz)
public static final double getDistance(double x1, double y1, double x2, double y2)
(x1, y1)
and (x2, y2)
x1
- the x coordinate of the first pointy1
- the y coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second pointpublic static final double getDistanceSq(double x1, double y1, double x2, double y2)
(x1, y1)
and (x2, y2)
.getDistance()
x1
- the x coordinate of the first pointy1
- the y coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second pointpublic static final double getDistance(double x1, double y1, double z1, double x2, double y2, double z2)
(x1, y1, z1)
and (x2, y2, z2)
x1
- the x coordinate of the first pointy1
- the y coordinate of the first pointz1
- the z coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second pointz2
- the z coordinate of the second pointpublic static double getDistanceGIS(double latitude1, double longitude1, double latitude2, double longitude2)
latitude1
- the latitude of first point measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)longitude1
- the longitude of first point measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)latitude2
- the latitude of second point measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)longitude2
- the longitude of second point measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)public void initializeRadians(double lat, double lon)
lat
- latitude in radians.lon
- longitude in radians.public static double getDistanceGIS(double latitude1, double longitude1, double latitude2, double longitude2, LengthUnits units)
latitude1
- the latitude of first point measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)longitude1
- the longitude of first point measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)latitude2
- the latitude of second point measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)longitude2
- the longitude of second point measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)units
- the units of lengthpublic static final double getDistanceSq(double x1, double y1, double z1, double x2, double y2, double z2)
(x1, y1, z1)
and (x2, y2, z2)
.getDistance()
x1
- the x coordinate of the first pointy1
- the y coordinate of the first pointz1
- the z coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second pointz2
- the z coordinate of the second pointpublic static final boolean isPointOnTheSameLine(double x1, double y1, double x2, double y2, double x3, double y3)
x1
- the X coordinate of point 1y1
- the Y coordinate of point 1x2
- the X coordinate of point 2y2
- the Y coordinate of point 2x3
- the X coordinate of point 3y3
- the Y coordinate of point 3true
if 3 points lie on one line,
otherwise false
public static final boolean isPointInsideRay(double x1, double y1, double x2, double y2, double px, double py)
x1
- the x coordinate of the start point of the rayy1
- the y coordinate of the start point of the rayx2
- the x coordinate of some point belonging the rayy2
- the y coordinate of some point belonging the raypx
- the X coordinate of the point to testpy
- the Y coordinate of the point to testtrue
if the point is lying on the ray, otherwise false
public static final boolean isPointInsideSegment(double x1, double y1, double x2, double y2, double px, double py)
x1
- the x coordinate of the first point of the segmenty1
- the y coordinate of the first point of the segmentx2
- the x coordinate of the second point of the segmenty2
- the y coordinate of the second point of the segmentpx
- the X coordinate of the point to testpy
- the Y coordinate of the point to testtrue
if the point is within the segment, otherwise false
public static final boolean isPointInsideRectangle(double rx, double ry, double rw, double rh, double px, double py)
rx
- the X coordinate of top-left corner of the rectanglery
- the Y coordinate of top-left corner of the rectanglerw
- the width of the rectanglerh
- the height of the rectanglepx
- the X coordinate of the point to testpy
- the Y coordinate of the point to testtrue
if the point is within the rectangle boundary,
otherwise false
public static final boolean isLineIntersectingLine(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
(x1,y1)
to (x2,y2)
intersects the line segment from (x3,y3)
to (x4,y4)
.x1
- the X coordinate of the start point of the first specified
line segmenty1
- the Y coordinate of the start point of the first specified
line segmentx2
- the X coordinate of the end point of the first specified line
segmenty2
- the Y coordinate of the end point of the first specified line
segmentx3
- the X coordinate of the start point of the second specified
line segmenty3
- the Y coordinate of the start point of the second specified
line segmentx4
- the X coordinate of the end point of the second specified line
segmenty4
- the Y coordinate of the end point of the second specified line
segmenttrue
if the first specified line segment and the
second specified line segment intersect each other;
false
otherwise.public static final boolean isRayIntersectingSegment(double rx1, double ry1, double rx2, double ry2, double sx1, double sy1, double sx2, double sy2)
(rx1,ry1)
in direction to (rx2,ry2)
intersects the line segment from (lx1,ly1)
to (lx2,ly2)
.rx1
- the X coordinate of the start point of the rayry1
- the Y coordinate of the start point of the rayrx2
- the X coordinate of some point on the rayry2
- the Y coordinate of some point on the raysx1
- the X coordinate of the start point of the line segmentsy1
- the Y coordinate of the start point of the line segmentsx2
- the X coordinate of the end point of the segmentsy2
- the Y coordinate of the end point of the segmenttrue
if the first specified ray and the
second specified line segment intersect each other;
false
otherwise.public static final boolean isLineIntersectingRectangle(double x1, double y1, double x2, double y2, double rx, double ry, double rw, double rh)
x1
- the X coordinate of the start point of the specified liney1
- the Y coordinate of the start point of the specified linex2
- the X coordinate of the end point of the specified liney2
- the Y coordinate of the end point of the specified linerx
- the X coordinate of top-left corner of the rectanglery
- the Y coordinate of top-left corner of the rectanglerw
- the width of the rectanglerh
- the height of the rectangletrue
if the line intersects rectangle (has at least
one common point, even lying on the rectangle's boundary)public static final double getDistanceFromPointToLine(double x1, double y1, double x2, double y2, double px, double py)
x1
- the X coordinate of the start point of the specified liney1
- the Y coordinate of the start point of the specified linex2
- the X coordinate of the end point of the specified liney2
- the Y coordinate of the end point of the specified linepx
- the X coordinate of the specified point being measured against
the specified linepy
- the Y coordinate of the specified point being measured against
the specified linegetDistanceFromPointToSegment(double, double, double, double, double, double)
public static final double getDistanceFromPointToLineSq(double x1, double y1, double x2, double y2, double px, double py)
x1
- the X coordinate of the start point of the specified liney1
- the Y coordinate of the start point of the specified linex2
- the X coordinate of the end point of the specified liney2
- the Y coordinate of the end point of the specified linepx
- the X coordinate of the specified point being measured against
the specified linepy
- the Y coordinate of the specified point being measured against
the specified linegetDistanceFromPointToSegmentSq(double, double, double, double, double, double)
public static final double getDistanceFromPointToSegment(double x1, double y1, double x2, double y2, double px, double py)
x1
- the X coordinate of the start point of the specified line
segmenty1
- the Y coordinate of the start point of the specified line
segmentx2
- the X coordinate of the end point of the specified line
segmenty2
- the Y coordinate of the end point of the specified line
segmentpx
- the X coordinate of the specified point being measured against
the specified line segmentpy
- the Y coordinate of the specified point being measured against
the specified line segmentgetDistanceFromPointToLine(double, double, double, double, double, double)
public static final double getDistanceFromPointToSegmentSq(double x1, double y1, double x2, double y2, double px, double py)
x1
- the X coordinate of the start point of the specified line
segmenty1
- the Y coordinate of the start point of the specified line
segmentx2
- the X coordinate of the end point of the specified line
segmenty2
- the Y coordinate of the end point of the specified line
segmentpx
- the X coordinate of the specified point being measured against
the specified line segmentpy
- the Y coordinate of the specified point being measured against
the specified line segmentgetDistanceFromPointToLineSq(double, double, double, double, double, double)
public static final double getDistanceFromPointToSegment(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
x1
- the X coordinate of the start point of the specified line
segmenty1
- the Y coordinate of the start point of the specified line
segmentz1
- the Z coordinate of the start point of the specified line
segmentx2
- the X coordinate of the end point of the specified line
segmenty2
- the Y coordinate of the end point of the specified line
segmentz2
- the Z coordinate of the end point of the specified line
segmentpx
- the X coordinate of the specified point being measured against
the specified line segmentpy
- the Y coordinate of the specified point being measured against
the specified line segmentpz
- the Z coordinate of the specified point being measured against
the specified line segmentgetDistanceFromPointToLine(double, double, double, double, double, double)
public static final double getDistanceFromPointToSegmentSq(double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
x1
- the X coordinate of the start point of the specified line
segmenty1
- the Y coordinate of the start point of the specified line
segmentx2
- the X coordinate of the end point of the specified line
segmenty2
- the Y coordinate of the end point of the specified line
segmentpx
- the X coordinate of the specified point being measured against
the specified line segmentpy
- the Y coordinate of the specified point being measured against
the specified line segmentgetDistanceFromPointToLineSq(double, double, double, double, double, double)
public static final Point getNearestPointOnSegment(Point out, double x1, double y1, double x2, double y2, double px, double py)
out
- the point to write result to, may be null
-
in this case new Point
instance will be createdx1
- the x coordinate of the first point of the segmenty1
- the y coordinate of the first point of the segmentx2
- the x coordinate of the second point of the segmenty2
- the y coordinate of the second point of the segmentpx
- the x coordinate of the given pointpy
- the y coordinate of the given pointout
the point on segment@Deprecated public static float[] createTrajectoryGIS(double lonFrom, double latFrom, double lonTo, double latTo, int numberOfSegments)
public static final Point getNearestPointOnSegment(Point out, double x1, double y1, double z1, double x2, double y2, double z2, double px, double py, double pz)
out
- the point to write result to, may be null
-
in this case new Point
instance will be createdx1
- the x coordinate of the first point of the segmenty1
- the y coordinate of the first point of the segmentz1
- the z coordinate of the first point of the segmentx2
- the x coordinate of the second point of the segmenty2
- the y coordinate of the second point of the segmentz2
- the z coordinate of the second point of the segmentpx
- the x coordinate of the given pointpy
- the y coordinate of the given pointpz
- the z coordinate of the given pointout
the point on segmentpublic static double zidz(double a, double b)
a
- first valueb
- second valuepublic static double xidz(double a, double b, double x)
a
- first valueb
- second valuex
- defines return result in case of unsuccessful divisionpublic static double limitMin(double min, double x)
max
as explicitly
says "x is left-limited by min".min
- left boundx
- the valuepublic static int limitMin(int min, int x)
max
as explicitly
says "x is left-limited by min".min
- left boundx
- the valuepublic static double limitMax(double x, double max)
min
as explicitly
says "x is right-limited by max".x
- the valuemax
- right boundpublic static int limitMax(int x, int max)
min
as explicitly
says "x is right-limited by max".x
- the valuemax
- right boundpublic static double limit(double min, double x, double max)
min
- left boundx
- the valuemax
- right boundpublic static int limit(int min, int x, int max)
min
- left boundx
- the valuemax
- right boundpublic static double gammaLog(double x)
x
:ln(Γ(x))
.x
.n
is a positive integer, then: Γ(n) = (n - 1)!
.gammaLog
function may be useful in System Dynamics
models for computing combinatorial factors.x
- the value.ln(Γ(x))
public double step(double height, double stepTime)
0
until the stepTime
and then returns height
height
- stepTime
- 0
until the stepTime
and then returns height
public double pulse(double startTime, double pulseWidth)
1
, starting at startTime
, and lasting
for interval pulseWidth
; 0
is returned at all other times.startTime
- the pulse start timepulseWidth
- the length of pulse time interval1
for pulse (when time is within [start, start+width)
),
otherwise 0
public double pulseTrain(double startTime, double pulseWidth, double timeBetweenPulses, double endTime)
1
, starting at startTime
, and lasting for
interval pulseWidth
and then repeats this pattern every
timeBetweenPulses
time until endTime
;
0
is returned at all other times.timeBetweenPulses
is smaller than pulseWidth
then 1
will be returned between startTime
and endTime
.startTime
- the first pulse start timepulseWidth
- the length of pulse time intervaltimeBetweenPulses
- the length of time interval between starts pulsesendTime
- the end time of pulses, since this time the method returns 0
1
for pulses, 0
otherwisepublic double ramp(double slope, double startTime, double endTime)
0
until the startTime
and then slopes upward
until endTime
and then holds constant.slope
- the coefficient of returned value growth between startTime
and endTime
startTime
- the start time of the rampendTime
- the end time of the rampstartTime
, then slope
until endTime
and then constant.public static double quantum(double value, double quantizer)
value
that is an
integer multiple of quantizer
.quantizer
is less than or equal to zero, then
value
is returned unchanged.quantum(PI, 0.01)
will return 3.14
value
- quantizer
- value
public static double difference(DataSet ds, TableFunction f)
ds
- data setf
- table function with linear interpolationpublic static double difference(DataSet ds1, DataSet ds2)
ds1
- data setds2
- data setpublic static double atan2fast(double y, double x)
Math.atan2(double, double)
, instead of computation of value every time, this method uses precomputed
table of values Math.atan2(double, double)
. Therefore atan2fast
is approximately 20 times faster than
Math.atan2(double, double)
.
Average error (comparing to Math.atan2(double, double)
) is 3e-5 radians, max error is 1e-4 radians.
This Method does not accept special arguments like NaN or Infinities. It's recommended to use when you don't need extremely
high accuracy and have assurance that your arguments are finite.y
- x
- public double toModelTime(double value, TimeUnits units)
value
- the value in the given unitsunits
- unitspublic double toTimeUnits(double modelTimeValue, TimeUnits units)
modelTimeValue
- the value in model time units (used e.g. in basic API of events)units
- units@AnyLogicInternalCodegenAPI public double toModelRate(double value, RateUnits units)
value
- the value in the given unitsunits
- units@AnyLogicInternalCodegenAPI public double toRateUnits(double modelRateValue, RateUnits units)
modelRateValue
- the value in units based on model time units (used e.g. in basic API of events)units
- unitspublic double millisecond()
public double second()
public double minute()
public double hour()
public double day()
toTimeout(AgentConstants.DAY
, 1)
methodpublic double week()
public double month()
toTimeout(AgentConstants.MONTH
, 1)
methodpublic double year()
toTimeout(AgentConstants.YEAR
, 1)
methodpublic static java.lang.String briefInfoOn(java.lang.Object object)
Agent
, collections, HyperArray
, events, transitions, etc. If the
argument type is not supported, returns its defualt toString().
If the argument is null, returns null.object
- the obejct to give info on@AnyLogicInternalAPI public static java.lang.String inspectOfLink_xjal(java.lang.Object object)
public static java.lang.String inspectOf(java.lang.Object object)
object
- the object being inspectedpublic static java.lang.String getFullName(Agent agent)
null
if
the given agent is null.null
.agent
- the agent, may be null
null
public static java.lang.String getName(Agent agent)
null
if
the given agent is null.null
.agent
- the agent, may be null
null
public void copyToClipboard(java.lang.String text)
text
- the text to copy@Deprecated public static void copyToClipboard(java.util.List<java.util.List<java.lang.Object>> table)
@AnyLogicInternalAPI public static void copyToClipboard(java.util.List<java.util.List<java.lang.Object>> table, java.util.List<java.lang.Integer> sqlTypes)
public static java.lang.String format(double value)
value
- the double value to be formatted.public static java.lang.String format(double value, IUnits<?> units)
value
- the double value to be formatted.units
- unitspublic static java.lang.String format(int value)
value
- the integer value to be formatted.public static java.lang.String format(long value)
value
- the long value to be formatted.public static java.lang.String format(java.util.Date date)
date
- the date to be formatted.public static java.lang.String formatDayOfWeek(int dayOfWeek, boolean fullName)
public static java.lang.String formatMonth(int month, boolean fullName)
public static java.lang.String formatLengthUnits(LengthUnits unit, boolean fullName)
unit
- length unitsfullName
- if true
, then returns the full name
("meter", "foot", etc.), otherwise - short ("m", "ft", etc.)public static java.lang.String formatAmountUnits(double value, AmountUnits units)
value
- value in cubic meters or kilogramsunits
- required unitspublic static java.lang.String formatFlowRateUnits(double value, FlowRateUnits units)
value
- value in cubic meters per second or kilograms per secondunits
- required unitspublic static java.lang.String formatLengthUnits(double value, LengthUnits units)
value
- value in metersunits
- required unitspublic static java.lang.String formatSpeedUnits(double value, SpeedUnits units)
value
- value in meters per secondunits
- required unitspublic static java.lang.String format(boolean value)
value
- the boolean value to be formatted.public static java.lang.String format(char value)
String
value
- the character value to be formatted.public java.lang.String formatTimeInterval(double dt)
dt
- the time interval@AnyLogicInternalAPI public static java.lang.String getCanonicalPath(java.io.File file)
file
- @AnyLogicInternalAPI public static java.lang.String findExistingFile(java.lang.String filePath)
public static java.lang.String formatLongitude(double degrees)
degrees
- the longitude in decimal degreesE30°20'0"
public static java.lang.String formatLatitude(double degrees)
degrees
- the latitude in decimal degreesN59°56'0"
public static java.lang.String formatGeoHeading(double radians)
PI / 7
will be formatted as "26° NNE"
radians
- the heading angle (measured in radians CW,
starting from North direction)@Deprecated public static java.lang.String layoutTypeToString(LayoutType layoutType)
LayoutType.formatName()
insteadpublic static double dirToAngle(CellDirection dir)
dir
- the direction constantpublic static double toLatitude(int degrees, int minutes, double seconds, boolean northOrSouth)
degrees
- number of degrees, 0...90
minutes
- number of minutes (1/60
of degree),
0...59
seconds
- number of seconds (1/60
of minute),
0 <= seconds < 60
northOrSouth
- true
for North, false
for Southpublic static double toLongitude(int degrees, int minutes, double seconds, boolean eastOrWest)
degrees
- number of degrees, 0...180
minutes
- number of minutes (1/60
of degree),
0...59
seconds
- number of seconds (1/60
of minute),
0 <= seconds < 60
eastOrWest
- true
for East, false
for Westpublic static java.util.Date toDate(int year, int month, int day)
public static java.util.Date toDate(int year, int month, int day, int hourOfDay, int minute, int second)
year
- the yearmonth
- the month, is 0-based. e.g., 0 for January.day
- the day of the monthhourOfDay
- the hour of day (using 24-hour clock)minute
- the minutesecond
- the secondpublic static java.util.Date toDate(java.lang.String dateFormat, java.lang.String text)
dateFormat
- the date format pattern, for example: "MM/dd/yyyy HH:ss"
for more details see the documentation or
SimpleDateFormat
class. Here are the most used symbols.
Symbol | Date/Time Component | Examples |
---|---|---|
y |
Year | 1994 ; 94 |
M |
Month in year | June ; Jun ; 06 |
d |
Day in month | 27 |
a |
Am/pm marker | AM |
H |
Hour in day (0-23) | 17 |
h |
Hour in am/pm (1-12) | 12 |
m |
Minute in hour | 35 |
s |
Second in minute | 15 |
S |
Millisecond | 123 |
text
- the text to be parsed as a datepublic static java.util.Date getDateWithTimeNextTo(java.util.Date date, int hourOfDay, int minute, int second)
date
and has the specified time (in the default time zone)date
- the datehourOfDay
- the hour of day (using 24-hour clock)minute
- the minutesecond
- the seconddate
with the given timepublic static long toDateInMillis(int year, int month, int day, int hourOfDay, int minute, int second)
toDate(int, int, int, int, int, int)
but returns the date
in its milliseconds representation (see Date.getTime()
), i.e.
the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the date.toDate(int, int, int, int, int, int)
,
Date.getTime()
@AnyLogicInternalCodegenAPI public static java.net.URL createURL_xjal(java.lang.String url)
URL
object from the String
representationurl
- the String
to parse as a URL.URL
object@AnyLogicInternalCodegenAPI public static void prepareBeforeExperimentStart_xjal(java.lang.Class<?> experimentClass)
@AnyLogicInternalCodegenAPI public static int[] joinArrays_xjal(boolean replaceAlways, boolean replaceWithNotEmpty, int[] a1, int[] a2)
public static int roundToInt(double v)
int
closest to the given value. Unlike Math.round(double)
,
returns int
value (instead of long) which may be more convenient for some operations.(int) floor(v + 0.5)Special cases:
Integer.MIN_VALUE
, the result is
equal to the value of Integer.MIN_VALUE
.
Integer.MAX_VALUE
, the result is
equal to the value of Integer.MAX_VALUE
.v
- floating-point value to be rounded to a int
.int
value.Integer.MAX_VALUE
,
Integer.MIN_VALUE
public static double roundToDecimal(double v, int nDecimalDigits)
floor(v * 10nDecimalDigits+ 0.5) / 10nDecimalDigits
v
- floating-point value to be rounded to the given precision.nDecimalDigits
- if positive, fractional part will be affected,
if negative, integer part will be@AnyLogicLegacyAPI public static int getPerformanceParallelWorkersCount_xjal()
Runtime.getRuntime().availableProcessors()
Please note that both methods shouldn't be generally used in
the model logic because their results are inpredictable, not
reproducible and depend on the underlying machine and AnyLogic
installation@AnyLogicInternalAPI public static java.lang.String toStringAlignedNameValues(int minNameLength, java.lang.Object... nameValueRows)
Copyright © AnyLogic North America, LLC. All Rights Reserved.