Skip to content

Commit 3700b40

Browse files
author
Bytekeeper
committed
Additional documentation.
1 parent 210aa73 commit 3700b40

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/main/java/org/bk/ass/bt/Parallel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public enum Policy {
2222
SELECTOR
2323
}
2424

25+
/**
26+
* Initializes with the default policy {@link Policy#SEQUENCE}.
27+
*/
2528
public Parallel(TreeNode... children) {
2629
super(children);
2730
policy = Policy.SEQUENCE;

src/main/java/org/bk/ass/bt/Repeat.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,30 @@ public Repeat(Policy policy, TreeNode delegate) {
4444
this.policy = policy;
4545
}
4646

47+
/**
48+
* Initializes with the default policy {@link Policy#SEQUENCE}.
49+
*/
4750
public Repeat(TreeNode delegate) {
4851
this(Policy.SEQUENCE, delegate);
4952
}
5053

54+
/**
55+
* Initializes with the default policy {@link Policy#SEQUENCE}.
56+
*/
5157
public Repeat(int limit, TreeNode delegate) {
5258
this(Policy.SEQUENCE, limit, delegate);
5359
}
5460

61+
/**
62+
* Allows to configure a limit of repeats. After exhaustion, it will either succeed, if policy is
63+
* SEQUENCE or fail if the policy is SELECTOR.
64+
*/
5565
public Repeat(Policy policy, int limit, TreeNode delegate) {
5666
super(delegate);
5767
Objects.requireNonNull(policy, "policy must be set");
58-
if (limit < 0) throw new IllegalArgumentException("limit must be >= 0");
68+
if (limit < 0) {
69+
throw new IllegalArgumentException("limit must be >= 0");
70+
}
5971
this.remaining = this.initialLimit = limit;
6072
this.policy = policy;
6173
}

0 commit comments

Comments
 (0)