public State <TData, TOffset> Add(FeatureStruct input, FeatureStruct output, bool replace, State <TData, TOffset> target) { CheckFrozen(); if (_isFsa) { throw new InvalidOperationException("Outputs are not valid on acceptors."); } if (input != null && !input.IsFrozen) { throw new ArgumentException("The input must be immutable.", "input"); } if (output != null && !output.IsFrozen) { throw new ArgumentException("The output must be immutable.", "output"); } Output <TData, TOffset> outputAction; if (input == null) { outputAction = new InsertOutput <TData, TOffset>(output); } else if (output == null) { outputAction = new RemoveOutput <TData, TOffset>(); } else if (replace) { outputAction = new ReplaceOutput <TData, TOffset>(output); } else { outputAction = new PriorityUnionOutput <TData, TOffset>(output); } return(AddInternal(new Arc <TData, TOffset>(_state, new Input(input, 1), outputAction.ToEnumerable(), target))); }
public bool Equals(RemoveOutput <TData, TOffset> other) { return(other != null); }