Exemple #1
0
        private void writeFst(ObjectOutputStream objectOutputStream)
        {
            this.writeStringMap(objectOutputStream, this.isyms);
            this.writeStringMap(objectOutputStream, this.osyms);
            objectOutputStream.writeInt(this.states.indexOf(this.start));
            objectOutputStream.writeObject(this.semiring);
            objectOutputStream.writeInt(this.states.size());
            HashMap hashMap = new HashMap(this.states.size(), 1f);
            int     i;

            for (i = 0; i < this.states.size(); i++)
            {
                State state = (State)this.states.get(i);
                objectOutputStream.writeInt(state.getNumArcs());
                objectOutputStream.writeFloat(state.getFinalWeight());
                objectOutputStream.writeInt(state.getId());
                hashMap.put(state, Integer.valueOf(i));
            }
            i = this.states.size();
            for (int j = 0; j < i; j++)
            {
                State state2  = (State)this.states.get(j);
                int   numArcs = state2.getNumArcs();
                for (int k = 0; k < numArcs; k++)
                {
                    Arc arc = state2.getArc(k);
                    objectOutputStream.writeInt(arc.getIlabel());
                    objectOutputStream.writeInt(arc.getOlabel());
                    objectOutputStream.writeFloat(arc.getWeight());
                    objectOutputStream.writeInt(((Integer)hashMap.get(arc.getNextState())).intValue());
                }
            }
        }