/*
 * DirectedAcyclicWordGraph.java
 *
 * Copyright (C) 2017 [ A Legge Up ] <stephen@aleggeup.com>
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

package com.aleggeup.confagrid.words;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class DirectedAcyclicWordGraph {

    private final WordList wordList;
    private final int verticies;
    private final List<List<Integer>> adjacentVerticies;
    private final int[] indegrees;

    private int edges;

    public DirectedAcyclicWordGraph(final WordList wordList) {
        this.wordList = wordList;
        verticies = wordList.size();
        edges = 0;
        adjacentVerticies = new ArrayList<List<Integer>>();
        indegrees = new int[verticies];

        for (int i = 0; i < verticies; ++i) {
            adjacentVerticies.add(new ArrayList<Integer>());
        }
    }

    protected void addEdgesFromPhrase(final Phrase phrase) {
        Word tail = null;
        for (final Iterator<Word> iterator = phrase.iterator(); iterator.hasNext();) {
            final Word word = iterator.next();
            if (tail == null) {
                tail = word;
            } else {
                addEdge(tail, word);
                tail = word;
            }
        }
    }

    protected void addEdge(final Word tail, final Word head) {
        final int tailId = wordList.getWordId(tail);
        final int headId = wordList.getWordId(head);
        if (!adjacentVerticies.get(tailId).contains(Integer.valueOf(headId))) {
            adjacentVerticies.get(tailId).add(Integer.valueOf(headId));
            ++indegrees[headId];
            ++edges;
        }
    }

    public int getVerticiesCount() {
        return verticies;
    }

    public int getEdgesCount() {
        return edges;
    }
}

@@ -442,32 +442,37 @@
 al int verticies
+Count
 ;%0A    private fi
@@ -571,16 +571,21 @@
 nt edges
+Count
 ;%0A%0A    p
@@ -693,16 +693,21 @@
 erticies
+Count
  = wordL
@@ -731,16 +731,21 @@
    edges
+Count
  = 0;%0A  
@@ -839,16 +839,21 @@
 erticies
+Count
 %5D;%0A%0A    
@@ -885,16 +885,21 @@
 erticies
+Count
 ; ++i) %7B
@@ -1746,24 +1746,29 @@
      ++edges
+Count
 ;%0A        %7D%0A
@@ -1831,24 +1831,29 @@
 rn verticies
+Count
 ;%0A    %7D%0A%0A   
@@ -1902,16 +1902,21 @@
 rn edges
+Count
 ;%0A    %7D%0A

Change variable names to match getters