if (state == null) {
return null;
}
ArrayList<CircuitState> path = new ArrayList<CircuitState>();
CircuitState current = state;
CircuitState parent = current.getParentState();
while (parent != null && parent != state) {
path.add(current);
current = parent;
parent = current.getParentState();
}