Skip to content

Commit e7ab40f

Browse files
authored
feat: CompactMealy clone constructor (#50)
* feat: CompactMealy clone constructor * chore: CI * fix: protected constructor
1 parent 1d54ad7 commit e7ab40f

File tree

1 file changed

+12
-0
lines changed
  • core/src/main/java/net/automatalib/automata/transducers/impl/compact

1 file changed

+12
-0
lines changed

core/src/main/java/net/automatalib/automata/transducers/impl/compact/CompactMealy.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ public CompactMealy(Alphabet<I> alphabet) {
5252
this(alphabet, DEFAULT_INIT_CAPACITY, DEFAULT_RESIZE_FACTOR);
5353
}
5454

55+
public CompactMealy(CompactMealy<I, O> other) {
56+
super(other.getInputAlphabet(), other);
57+
this.transitions = other.transitions.clone();
58+
this.outputs = other.outputs.clone();
59+
}
60+
61+
protected CompactMealy(Alphabet<I> alphabet, CompactMealy<I, O> other) {
62+
super(alphabet, other);
63+
this.transitions = other.transitions.clone();
64+
this.outputs = other.outputs.clone();
65+
}
66+
5567
@Override
5668
protected void updateTransitionStorage(Payload payload) {
5769
this.transitions = updateTransitionStorage(this.transitions, AbstractCompact.INVALID_STATE, payload);

0 commit comments

Comments
 (0)