/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package structures;

import java.text.DateFormat;
import java.util.Date;
import java.util.GregorianCalendar;

/**
 *
 * @author baba
 */
public class TreeEntry {

    private String name = "";
    private String time = "";
    private boolean changeTime = false;
    private String returnString = "";

    public TreeEntry(String str) {
        name = str;
        returnString = name;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the time
     */
    public String getTime() {
        //if (isChangeTime()) {
            GregorianCalendar liftOffApollo11 = new GregorianCalendar();
            Date d = liftOffApollo11.getTime();
            DateFormat df2 = DateFormat.getTimeInstance(DateFormat.SHORT);
            time = df2.format(d);
        //}
        return time;
    }

    public String toString() {
        if (isChangeTime()) {
            returnString= name + " --- " + getTime();
            changeTime = false;
        }
        return returnString;
    }

    /**
     * @return the changeTime
     */
    public boolean isChangeTime() {
        return changeTime;
    }

    /**
     * @param changeTime the changeTime to set
     */
    public void setChangeTime(boolean changeTime) {
        this.changeTime = changeTime;
    }
}
