Ставить задачи

Я разместил весь конструктор, чтобы вы, ребята, могли все это увидеть. Но главный вопрос, который у меня сейчас возникает, - это Enqueue и wordToIntQueue. Я использую Eclipse и с кодом я получаю ошибки с постановкой в ​​очередь и инициализацией wordToIntQueue. Есть какие нибудь идеи как это исправить? Я работал над этим некоторое время и не могу понять это.

    public WordNet(String synsets, String hypernyms) {
    if (synsets == null || hypernyms == null) {
        throw new NullPointerException("Arguments cannot be null.");
    }

    In synset = new In(synsets);
    In hypernym = new In(hypernyms);
    int vertices = 0;

    w_i = new SeparateChainingHashST<>();
    i_w = new SeparateChainingHashST<>();

    while (synset.hasNextLine()) {
        String[] lines = synset.readLine().split(",");
        String[] words = lines[1].split(" ");
        Integer val = Integer.valueOf(lines[0]);
        i_w.put(Integer.valueOf(lines[0]), lines[1]);
        vertices++;

        for (int i = 0; i < words.length; i++) {
            Queue<Integer> wordToIntQueue = w_i.get(words[i]);

            if (wordToIntQueue != null) {
                if (!contains(wordToIntQueue, val)) {
                    wordToIntQueue.enqueue(val);
                }
            } else {
                wordToIntQueue = new Queue<>();
                wordToIntQueue.enqueue(val);
                w_i.put(words[i], wordToIntQueue);
            }
        }
    }

    dg = new Digraph(vertices);

    while (hypernym.hasNextLine()) {
        String[] line = hypernym.readLine().split(",");
        for (int i = 1; i < line.length; i++) {
            dg.addEdge(Integer.parseInt(line[0]), Integer.parseInt(line[i]));
        }
    }
    sap = new SAP(dg);
}

0 ответов

Другие вопросы по тегам