/*
 This file is part of the software framework JStatCom, 
 a library for building applications for data based analysis.

 Copyright (C) 2000-2005  Markus Kraetzig

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

 This library 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
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 USA
 */

package com.jstatcom.model;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * This enumeration contains all existing SymbolEvent types, that
 * a SymbolListener can be registered to. If new data types are
 * to be added, this class needs to be extended.
 * 
 * @author Markus Kraetzig 
 */
public class SymbolEventTypes {

    private final String name;

    private static final List typeList = new ArrayList();

    /**
     * Fired if the underlying Symbol changed from empty to not
     * empty or vice versa.
     */
    public static final SymbolEventTypes EMPTY_STATE = new SymbolEventTypes(
            "EMPTY_STATE");

    /**
     * Fired if the values in underlying data object of Symbol
     * have changed.
     */
    public static final SymbolEventTypes VALUE_CHANGED = new SymbolEventTypes(
            "VALUE_CHANGED");

    /**
     * Fired if the respective Symbol gets a new reference to a
     * data object.
     */
    /*
     * public static final SymbolEventTypes REF_CHANGED = new
     * SymbolEventTypes("REF_CHANGED");
     */

    /**
     * SymbolEventTypes constructor.
     */
    protected SymbolEventTypes(String name) {
        this.name = name;
        typeList.add(this);
    }

    /**
     * Gets an iterator over all available types.
     * 
     * @return type iterator
     */
    public static final Iterator iterator() {
        return typeList.iterator();
    }

    /**
     * Override prevention method to enforce a.equals(b) if and
     * only if a==b.
     * 
     * @param o
     *            object to compare with
     * @return true if equal, false otherwise
     */
    public final boolean equals(Object o) {
        return super.equals(o);
    }

    /**
     * Override prevention method invokes super method.
     * 
     * @return hash code
     */
    public final int hashCode() {
        return super.hashCode();
    }

    /**
     * Gets string representation of this object.
     * 
     * @return a string
     */
    public final String toString() {
        return name;
    }
}
 

Ads help maintain this website.