public static void fst_copy(IGenericFst dst, IGenericFst src)
{
dst.Clear();
int n = src.nStates();
for (int i = 0; i < n; i++)
dst.NewState();
dst.SetStart(src.GetStart());
for (int i = 0; i < n; i++)
{
dst.SetAccept(i, src.GetAcceptCost(i));
Intarray targets = new Intarray(), outputs = new Intarray(), inputs = new Intarray();
Floatarray costs = new Floatarray();
src.Arcs(inputs, targets, outputs, costs, i);
int inlen = inputs.Length();
if (inlen != targets.Length())
throw new Exception("ASSERT: inputs.length() == targets.length()");
if (inlen != outputs.Length())
throw new Exception("ASSERT: inputs.length() == outputs.length()");
if (inlen != costs.Length())
throw new Exception("ASSERT: inputs.length() == costs.length()");
for (int j = 0; j < inputs.Length(); j++)
dst.AddTransition(i, targets.At1d(j), outputs.At1d(j), costs.At1d(j), inputs.At1d(j));
}
}