Word.java:
public class Word
{
private String word;
private int count;
private Font font;
private int x;
private int y;
public void draw()
{
font.tellQuickdraw();
System.out.println("text \"" + word + "\" " +
x + " " + y);
}
}
{
private String word;
private int count;
private Font font;
private int x;
private int y;
public void draw()
{
font.tellQuickdraw();
System.out.println("text \"" + word + "\" " +
x + " " + y);
}
}
Font.java:
public class Font
{
private String name;
private String style;
private int size;
public void tellQuickdraw()
{
}
}
{
private String name;
private String style;
private int size;
public void tellQuickdraw()
{
}
}
Document.java:
import java.util.LinkedList;
public class Document
{
private String name;
private LinkedList<Word> words;
public void draw()
{
for (Word currentWord : words)
{
currentWord.draw();
}
}
public void read(String[] args)
{
for (int i = 0; i < args.length; i++)
{
if (words.contains(args[i]))
{
// get the word from the list
int index = words.indexOf(args[i]);
Word wordFromList = words.get(index);
// TODO: update the word
}
else
{
// create the word
Word word = new Word();
// add it to the list
words.add(word);
}
}
}
}
public class Document
{
private String name;
private LinkedList<Word> words;
public void draw()
{
for (Word currentWord : words)
{
currentWord.draw();
}
}
public void read(String[] args)
{
for (int i = 0; i < args.length; i++)
{
if (words.contains(args[i]))
{
// get the word from the list
int index = words.indexOf(args[i]);
Word wordFromList = words.get(index);
// TODO: update the word
}
else
{
// create the word
Word word = new Word();
// add it to the list
words.add(word);
}
}
}
}
MainProgram.java:
public class MainProgram
{
public static void main(String[] args)
{
Document theDocument = new Document();
theDocument.read(args);
}
}
{
public static void main(String[] args)
{
Document theDocument = new Document();
theDocument.read(args);
}
}