. , . AnyLogic ( , , . .) , , . , , , , , , color, . . , .
, , .
, (=) , , , , . AnyLogic , , . , .
, Java, , color .
, , "Hello". - :
String greeting; Greeting = "Hello";
greeting string,
"Hello".
.
String = "";
() +, :
String name = "John";
String greeting = "Hello";
String message = "Hello" + ", " + name;
message "Hello, John".
, , . , delta 256, :
String message = "Delta = " + delta;
message, :
Delta = 256
AnyLogic, , . , . string, :
|
|
":"+((>30)?"":(>20)?"":"")
delta , , , :
String message = delta;
, . :
String message = ""+delta;
AnyLogic Java , , , : ""+. , , , .
( - , ) :
traceln(< >);
. , :
traceln(" tl, s =" + s);
- , :
tl, s = 23.99
, s 23.99. .
7.2.3. Color
Color . Java 13 :
black, blue, white, green, cyan, magenta, gray, lightGray, darkGray, orange, pink, red, yellow
,
Color, : Color.black, Color.blue, Color.white . .
AnyLogic . , .
, (. 7.3).
AnyLogic. , .
. . 7.3 , HSL RGB. HSL (Hue, Saturation, Luminosity , , ) Hue, Saturation , . Hue, Sat Lum , .
RGB , Red, Green Blue (, ), (. 7.4). 0 255 . .
|
|
, . 7.3, HSL, RGB. , Yellow RGB : (255, 255, 0).
( ) Color. ( 13 , ). , . , , , , , power threshold. : power > threshold? Color.red: Color.blue
, , , color. new color (<r>,<g>,<b>) lerpColor(<val>,colori,color2) AnyLogic.
new color (< r >, < g >, < B >) RGB. , <R>, <G> < B > 0 255 , - . - : Hue Sat, , Luminance. < r >, < g > <B> .
, color, 0 255.
, .
RGB
, : Red, Green Blue, .
ColorModel. Main Red, Green Blue . , . new Color (Red, Green, Blue). (). (Red, Green Blue) 0 255. (): ,
. , . 7.5.
, . , . colorModel0 Model Examples\Part II.
RGB
, RGB- , , , Red Green, Blue . , Blue .
|
|
colorModel1. Main , 1 256. :B++ B %= 256;
(++) , B %= 2 56 256.
, X R, Y G. X Y 1x1 , new color(x, , ), , , . . Y, . , , : X = -100, Y = 350, = 500, = 450. , , . 1, 256*256 (. 7.6).
X :
X: index % 2 56
Y: index / 256
1x1 256*256, X Y ( )
. 256 X 0 255, Y 0. 256 1, X 0 255 .
, :
new Color(index%256, index/256, )
, X < R > new color (< r >,< g >,<>), 0 255, <g>, 0 255 .
(), 0 255. . 7.7.
( ) . 7.7. ColorModel1 Model Examples\Part II.
lerpColor
:
lerpColor(<value>, color1,color2)
, color1 color2, value. value 0, coiori, value 1, color2. value 0 1 .
, , . colorModel2 . , -
|
|
. , , , 201 ( 0 200). X , Y index. , 201 , Y- 0, 1, 2,.... 200. , ( index). : lerpColor(index/200., Color.blue, Color.magenta)
(, , 200 ).
(, <Ctrl> ). lerpColor. , color.ed Color.green, Color.orange Color.gray . . (): , . , . 7.8.
, . colorModel2 Model Examples\ Part II.
AnyLogic . , . AnyLogic . AnyLogic , - Java, . , AnyLogic , , *, + . .
AnyLogic Java. Java () , , (). , N n-1, .
. . -, . :
<> < > [ ];
<> (. . , ), < > , : int count [ ];
count , " ". count , . new, : count = new [<>];
. ,
count = new [10];
count , count [] count [9], , :
count[0] = 5; count[1] = 7;
, , . , :
int count[] = new int [10];
, , :
int[ ] count;
:
int [ ] count = new int [10];
Java . , . , neighbors 4x5 :
|
|
int neighbors [] [] = new int [4] [5];
, 0, 3, 4.
:
int[][] neighbors = new int [4] [5];
( , Java) . . , . , AnyLogic. , 15.
Java vector, , . . , - . , , . , , , , Object.
vector , Java , . . Java .
, -:
Vector v = new Vector ();
. . () . AnyLogic.
, Java , . Java, - , . , . , - - , .
, . , . AnyLogic , Func AnyLogic. :
- : sqrt, sin, cos, tan, exp, log, round .; - : add, mul, inverse, transpose .; - - : uniform, exponential .
getTime, getOwner, getRoot
isStateActive . .
, x=getTime() , .
7.3.2. : ,
. AnyLogic . : (), () (). , AnyLogic, ( , , . .), . .
, , >. AnyLogic , ( ) ( ). .
, , , , , . . AnyLogic
. , .
, , . AnyLogic . , : return <>
, .