package caida.otter; import java.awt.*; /*********************************************************************** * ValuesGroup written 02/19/98 * by Bradley Huffaker * Cooperative Association for Internet Data Analysis * version 1.0 * * Goal: To keep track of a Title and fields for each value group * Also used as key for values into each nodes hash of values. * ************************************************************************ ************************************************************************ By accessing this software, VALUESGROUP, you are duly informed of and agree to be bound by the conditions described below in this notice: This software product, VALUESGROUP, is developed by Bradley Huffaker, and copyrighted(C) 1998 by the University of California, San Diego (UCSD), with all rights reserved. UCSD administers the NSF grant to CAIDA, number NCR-9711092, under which this code was developed. There is no charge for VALUESGROUP software. You can redistribute it and/or modify it under the terms of the GNU General Public License, v. 2 dated June 1991 which is incorporated by reference herein. VALUESGROUP is distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that the use of it will not infringe on any third party's intellectual property rights. You should have received a copy of the GNU GPL along with the VALUESGROUP program. Copies can also be obtained from http://www.gnu.org/copyleft/gpl.html or by writing to University of California, San Diego SDSC/CAIDA 9500 Gilman Dr., MS-0505 La Jolla, CA 92093 - 0505 USA Or contact INFO@CAIDA.ORG ***********************************************************************/ public class ValuesGroup { String title; int type; static final int DOUBLE = 0; static final int STRING = 1; int num_fields; int selected = 0; // Where the first column is the title for the column // and the secound is any attributes String[] fields; String[] attr; public ValuesGroup(String title_input, int type_input, int num_fields_input) { title = title_input; type = type_input; num_fields = num_fields_input; } public ValuesGroup(String title_input, int type_input, String[] fields_input) { this(title_input, type_input, fields_input.length); fields = fields_input; } public void setTitle(String string) { title = string; } public String getTitle() { return title; } public void setType(int input) { type = input; } public int getType() { return type; } public void setFields(String[] fields_input) { if (fields_input == null) return; if (fields == null || fields_input.length != num_fields) { fields = new String[fields_input.length]; attr = new String[fields_input.length]; } for (int i=0; i < num_fields; i++) fields[i] = fields_input[i]; } public String[] getFields() { return fields; } public String getCurrentField() { if (fields == null) return ""; else return fields[selected]; } public void setAttr(String[] attr_input) { if (attr_input == null || attr_input.length != num_fields) return; for (int i=0; i < num_fields; i++) attr[i] = attr_input[i]; } public int getNumFields() { return num_fields; } public void setNumFields(int num_fields_input) { if (fields != null) { int shortest = num_fields; if (shortest > num_fields_input) shortest = num_fields_input; String[] temp = new String[shortest]; for(int index=0;index < shortest; index++) temp[index] = fields[index]; fields = temp; temp = new String[shortest]; for(int index=0;index < shortest; index++) temp[index] = attr[index]; attr = temp; } num_fields = num_fields_input; } public void setSelected(int index) { selected = index; } public int getSelected() { return selected; } }