//AUTOMATICALLY GENERATED BY genfields.pl.
//DO NOT EDIT!!!!

package vrml.field;
import vrml.*;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;

public class MFTime extends MField {
    public MFTime() {
    }

    public MFTime(double[] value) {
        this(value.length, value);
    }

    public MFTime(int size, double[] value) {
        for (int i = 0; i < size; i++)
            __vect.addElement(new ConstSFTime(value[i]));
    }

    public void getValue(double[] value) {
        __updateRead();
        int size = __vect.size();
        for (int i = 0; i < size; i++) {
            ConstSFTime sfTime = (ConstSFTime) __vect.elementAt(i);
            value[i] = sfTime.value;
        }
    }

    public double get1Value(int index) {
        __update1Read(index);
        return ((ConstSFTime) __vect.elementAt(index)).getValue();
    }

    public void setValue(double[] value) {
        setValue(value.length, value);
    }

    public void setValue(int size, double[] value) {
        __vect.clear();
        for (int i = 0; i < size; i++)
            __vect.addElement(new ConstSFTime(value[i]));
        __updateWrite();
    }

    public void set1Value(int index, double value) {
        __set1Value(index, new ConstSFTime(value));
    }

    public void set1Value(int index, SFTime sfTime) {
        sfTime.__updateRead();
        __set1Value(index, new ConstSFTime(sfTime.value));
    }

    public void set1Value(int index, ConstSFTime sfTime) {
        __set1Value(index, sfTime);
    }

    public void addValue(double value) {
        __addValue(new ConstSFTime(value));
    }

    public void addValue(SFTime sfTime) {
        sfTime.__updateRead();
        __addValue(new ConstSFTime(sfTime.value));
    }

    public void addValue(ConstSFTime sfTime) {
        __addValue(sfTime);
    }

    public void insertValue(int index, double value) {
        __insertValue(index, new ConstSFTime(value));
    }

    public void insertValue(int index, SFTime sfTime) {
        sfTime.__updateRead();
        __insertValue(index, new ConstSFTime(sfTime.value));
    }

    public void insertValue(int index, ConstSFTime sfTime) {
        __insertValue(index, sfTime);
    }

    public String toString() {
        __updateRead();
        StringBuffer sb = new StringBuffer("[");
        int size = __vect.size();
        for (int i = 0; i < size; i++) {
            if (i > 0) sb.append(", ");
            sb.append(__vect.elementAt(i));
        }
        return sb.append("]").toString();
    }

    public void __fromPerl(BufferedReader in)  throws IOException {
        __vect.clear();
	String lenline = in.readLine();
	//System.out.println ("__fromPerl, read in length as " + lenline);
        //int len = Integer.parseInt(in.readLine());
	int len = Integer.parseInt(lenline);
        for (int i = 0; i < len; i++) {
            ConstSFTime sf = new ConstSFTime();
            sf.__fromPerl(in);
            __vect.addElement(sf);
        }
    }

    public void __toPerl(PrintWriter out)  throws IOException {
        StringBuffer sb = new StringBuffer("");
        int size = __vect.size();
	//out.print(size);
        for (int i = 0; i < size; i++) {
            ((ConstSFTime) __vect.elementAt(i)).__toPerl(out);
	    if (i != (size-1)) out.print (", ");
	}
	//out.println();
    }
    //public void setOffset(String offs) { this.offset = offs; } //JAS2
    //public String getOffset() { return this.offset; } //JAS2
}