Skip to content

Commit c006ce8

Browse files
committed
Add CharAlgebra/CharMember info to the example help classes
1 parent 10369ab commit c006ce8

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

src/main/java/example/DataTypes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class DataTypes {
4848
* Tensors
4949
*
5050
* MiscTypes
51-
* booleans, strings, rgb, argb, rationals, n-dimensional real points
51+
* booleans, characters, strings, rgb, argb, rationals, n-dimensional real points
5252
*
5353
* Some things that are worth knowing about types in Zorbage:
5454
*

src/main/java/example/MiscTypes.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import nom.bdezonia.zorbage.algebra.G;
3030
import nom.bdezonia.zorbage.datasource.IndexedDataSource;
3131
import nom.bdezonia.zorbage.type.bool.BooleanMember;
32+
import nom.bdezonia.zorbage.type.character.CharAlgebra;
33+
import nom.bdezonia.zorbage.type.character.CharMember;
3234
import nom.bdezonia.zorbage.type.character.FixedStringMember;
3335
import nom.bdezonia.zorbage.type.character.StringMember;
3436
import nom.bdezonia.zorbage.type.point.Point;
@@ -461,5 +463,55 @@ void example7() {
461463
G.STRING.trim();
462464
G.STRING.toCharArray();
463465
}
466+
467+
// Standard Java unicode 16 characters
468+
469+
void example8() {
470+
471+
CharMember ch = new CharMember("A");
472+
CharMember other = null;
473+
474+
// java ops
475+
476+
ch.equals(other);
477+
ch.hashCode();
478+
ch.toString();
479+
480+
// constructions
481+
482+
G.CHAR.construct();
483+
G.CHAR.construct(other);
484+
G.CHAR.construct("B");
485+
486+
// mathematical operations
487+
488+
G.CHAR.assign();
489+
G.CHAR.signum();
490+
G.CHAR.zero();
491+
G.CHAR.max();
492+
G.CHAR.min();
493+
G.CHAR.pred();
494+
G.CHAR.succ();
495+
496+
// comparisons
497+
498+
G.CHAR.compare();
499+
G.CHAR.isEqual();
500+
G.CHAR.isGreater();
501+
G.CHAR.isGreaterEqual();
502+
G.CHAR.isLess();
503+
G.CHAR.isLessEqual();
504+
G.CHAR.isNotEqual();
505+
G.CHAR.isZero();
506+
507+
// misc
508+
509+
CharMember bound = new CharMember();
510+
G.CHAR.maxBound().call(bound);
511+
G.CHAR.minBound().call(bound);
512+
G.CHAR.random().call(ch);
513+
CharAlgebra.reverseBytes().call(ch);
514+
CharAlgebra.valueOf().call('n');
515+
}
464516

465517
}

0 commit comments

Comments
 (0)