package org.nwapw.abacus.lexing.pattern; public class PatternChain { public PatternNode head; public PatternNode tail; public PatternChain(PatternNode head, PatternNode tail){ this.head = head; this.tail = tail; } public PatternChain(PatternNode node){ this(node, node); } public PatternChain(){ this(null); } public void append(PatternChain other){ if(other.head == null || tail == null) { this.head = other.head; this.tail = other.tail; } else { tail.outputStates.add(other.head); tail = other.tail; } } public void append(PatternNode node){ if(tail == null){ head = tail = node; } else { tail.outputStates.add(node); tail = node; } } }