/** * for testing only. doubles combined by addition. */ public List sampleUniformPathFromGraph() { List list = new ArrayList(); Object node = this.getStartNode(); Set endNodes = this.getEndNodes(); while (!endNodes.contains(node)) { List<Arc> arcs = new ArrayList<>(this.getArcsBySource(node)); TransducerGraph.Arc arc = arcs.get(r.nextInt(arcs.size())); list.add(arc.getInput()); node = arc.getTargetNode(); } return list; }
public boolean removeArc(Arc a) { Object source = a.getSourceNode(); Object target = a.getTargetNode(); Object input = a.getInput();
@Override public Arc processArc(Arc a) { a = new Arc(a); a.setInput(Generics.newPair(a.getInput(), a.getOutput())); a.setOutput(null); return a; } }
@Override public Arc processArc(Arc a) { a = new Arc(a); a.setInput(Generics.newPair(a.getInput(), a.getOutput())); a.setOutput(null); return a; } }
@Override public Arc processArc(Arc a) { a = new Arc(a); Pair p = (Pair) a.getInput(); a.setInput(p.first); a.setOutput(p.second); return a; } }
public Arc processArc(Arc a) { a = new Arc(a); Pair p = (Pair) a.getInput(); a.setInput(p.first); a.setOutput(p.second); return a; } }
@Override public Arc processArc(Arc a) { a = new Arc(a); Pair p = (Pair) a.getInput(); a.setInput(p.first); a.setOutput(p.second); return a; } }
@Override public Arc processArc(Arc a) { a = new Arc(a); a.setInput(Generics.newPair(a.getInput(), a.getOutput())); a.setOutput(null); return a; } }
@Override public Arc processArc(Arc a) { a = new Arc(a); Pair p = (Pair) a.getInput(); a.setInput(p.first); a.setOutput(p.second); return a; } }
public Arc processArc(Arc a) { a = new Arc(a); a.setInput(Generics.newPair(a.getInput(), a.getOutput())); a.setOutput(null); return a; } }
Object input = arc.getInput(); String inputString = input.toString(); double output = ((Double) arc.getOutput()).doubleValue();
TransducerGraph.Arc arc = (TransducerGraph.Arc) arc1; Object newNode = arc.getSourceNode(); Comparable a = (Comparable) arc.getInput(); double k = ((Double) arc.getOutput()).doubleValue(); double newLen = length.getCount(newNode);
Object source = a.getSourceNode(); Object target = a.getTargetNode(); Object input = a.getInput(); if (source == null || target == null || input == null) { return false;
protected TransducerGraph buildMinimizedFA() { TransducerGraph minimizedFA = new TransducerGraph(); TransducerGraph unminimizedFA = getUnminimizedFA(); for (TransducerGraph.Arc arc : unminimizedFA.getArcs()) { Set<Arc> source = projectNode(arc.getSourceNode()); Set<Arc> target = projectNode(arc.getTargetNode()); try { if (minimizedFA.canAddArc(source, target, arc.getInput(), arc.getOutput())) { minimizedFA.addArc(source, target, arc.getInput(), arc.getOutput()); } } catch (Exception e) { //throw new IllegalArgumentException(); } } minimizedFA.setStartNode(projectNode(unminimizedFA.getStartNode())); for (Object o : unminimizedFA.getEndNodes()) { minimizedFA.setEndNode(projectNode(o)); } return minimizedFA; }
protected TransducerGraph buildMinimizedFA() { TransducerGraph minimizedFA = new TransducerGraph(); TransducerGraph unminimizedFA = getUnminimizedFA(); for (TransducerGraph.Arc arc : unminimizedFA.getArcs()) { Object source = projectNode(arc.getSourceNode()); Object target = projectNode(arc.getTargetNode()); try { if (minimizedFA.canAddArc(source, target, arc.getInput(), arc.getOutput())) { minimizedFA.addArc(source, target, arc.getInput(), arc.getOutput()); } } catch (Exception e) { //throw new IllegalArgumentException(); } } minimizedFA.setStartNode(projectNode(unminimizedFA.getStartNode())); for (Object o : unminimizedFA.getEndNodes()) { minimizedFA.setEndNode(projectNode(o)); } return minimizedFA; }
protected void addSplits(Block block) { Map symbolToTarget = new HashMap(); for (Object member : block.getMembers()) { for (Object o : getInverseArcs(member)) { TransducerGraph.Arc arc = (TransducerGraph.Arc) o; Object symbol = arc.getInput(); Object target = arc.getTargetNode(); Maps.putIntoValueArrayList(symbolToTarget, symbol, target); } } for (Object symbol : symbolToTarget.keySet()) { addSplit(new Split((List) symbolToTarget.get(symbol), symbol, block)); } }
protected Arc(Arc<NODE,IN,OUT> a) { this(a.getSourceNode(), a.getTargetNode(), a.getInput(), a.getOutput()); }
@Override public Arc processArc(Arc a) { a = new Arc(a); Pair p = (Pair) a.getInput(); a.setInput(p.first); a.setOutput(p.second); return a; } }
@Override public Arc processArc(Arc a) { a = new Arc(a); a.setInput(Generics.newPair(a.getInput(), a.getOutput())); a.setOutput(null); return a; } }