mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-05 10:19:53 -08:00
Add a new function to add children into collection.
This commit is contained in:
parent
02141d8df0
commit
ac3087fc3f
|
@ -1,14 +1,13 @@
|
|||
package org.nwapw.abacus.lexing.pattern;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class LinkNode<T> extends PatternNode<T> {
|
||||
|
||||
@Override
|
||||
public void addInto(ArrayList<PatternNode<T>> into) {
|
||||
for(PatternNode<T> node : outputStates){
|
||||
node.addInto(into);
|
||||
}
|
||||
public void addInto(Collection<PatternNode<T>> into) {
|
||||
addOutputsInto(into);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.nwapw.abacus.lexing.pattern;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class PatternNode<T> {
|
||||
|
@ -19,8 +20,12 @@ public class PatternNode<T> {
|
|||
return '\0';
|
||||
}
|
||||
|
||||
public void addInto(ArrayList<PatternNode<T>> into){
|
||||
public void addInto(Collection<PatternNode<T>> into){
|
||||
into.add(this);
|
||||
}
|
||||
|
||||
public void addOutputsInto(Collection<PatternNode<T>> into){
|
||||
outputStates.forEach(e -> e.addInto(into));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user