This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
jgraph/KeyedItem.java

38 lines
567 B
Java

public abstract class KeyedItem
{
private Comparable searchKey;
public KeyedItem(Comparable key)
{
searchKey = key;
} // end constructor
public Comparable getKey()
{
return searchKey;
} // end getKey
public String toString()
{
return searchKey.toString();
}
} // end KeyedItem
/*
How to use:
public class CD extends KeyedItem
{
//title not present here
String artist;
...
public CD(String title, String artist, double price, int tracks)
{
super(title);
this.artist=artist;
...
}
}
*/