/** *######################################################################### * * A component of the Gatherer application, part of the Greenstone digital * library suite from the New Zealand Digital Library Project at the * University of Waikato, New Zealand. * *

* * Author: John Thompson, Greenstone Digital Library, University of Waikato * *

* * Copyright (C) 1999 New Zealand Digital Library Project * *

* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * *

* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * *

* * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *######################################################################## */ package org.greenstone.gatherer.gems; public class Attribute implements Comparable { public String language = null; public String name = null; public String value = null; public String text = null; private boolean language_specific = false; public Attribute(String name, String value) { this.name = name; this.value = value; } public Attribute(String name, String language, String value) { this.language = language; this.language_specific = true; this.name = name; this.value = value; } public int compareTo(Object other) { return toString().compareTo(other.toString()); } public boolean equals(Object other) { return toString().equals(other.toString()); } public String get(int column) { switch(column) { case 0: return name; case 1: if(language_specific) { return language; } default: return value; } } public String toString() { if(text == null) { if(language_specific) { text = name + " [" + language + "] = " + value; } else { text = name + " = " + value; } } return text; } }