I have two classes. One is a Phrase class,
import java.util.List;
import java.util.ArrayList;
@SuppressWarnings("unchecked")
public class Phrase
{
List<String> papers = new ArrayList();
String name = "";
boolean multiple = false;
public Phrase(String name, List list)
{
this.name = name;
this.papers = list;
if(list.size() > 1)
{
multiple = true;
}
}
public Phrase(String name, String pName)
{
this.name = name;
this.papers.add(pName);
multiple = false;
}
public void addPaper(String paper)
{
papers.add(paper);
multiple = true;
}
public String getPhrase()
{
return name;
}
public List<String> getPapers()
{
return papers;
}
}
The Other is a KeyedLinkedList.
public class KeyedLinkedList<K,Phrase>
{
private KeyNode first;
private int size;
private class KeyNode
{
K key;
Phrase value;
KeyNode previous;
KeyNode next;
public KeyNode(K key, Phrase value, KeyNode previous, KeyNode next)
{
this.key = key;
this.value = value;
this.previous = previous;
this.next = next;
}
}
public int size()
{
return size;
}
public boolean put(K key, Phrase val)
{
if(isEmpty())
{
first = new KeyNode(key, val, null, null);
first.next = first;
first.previous = first;
size++;
return true;
}
KeyNode temp = first;
if(temp.key.equals(key))
{
//****ERROR LOCATION****//
temp.value.addPaper(val.getPapers().get(0));
//****ERROR LOCATION****//
if(temp.value.getPapers().size() < 3)
return false;
return true;
}
temp = temp.next;
while(temp != first)
{
if(temp.key.equals(key))
{
temp.value.addPaper(val.getPapers().get(0));
if(temp.value.getPapers().size() < 3)
return false;
return true;
}
temp = temp.next;
}
temp.previous.next = new KeyNode(key, val, temp.previous.next, first);
first.previous = temp.previous.next;
size++;
return true;
}
}
When I compile this I get the error: "Can't find symbol - method getPapers()"
I obviously have the getPapers() method in my Phrase class and val in the parameters is a Phrase object. I am wondering what I need to do to fix this problem. The error occurs half way through the put method.