head	1.6;
access;
symbols;
locks; strict;
comment	@# @;


1.6
date	2001.08.03.02.35.55;	author dlr;	state Exp;
branches;
next	1.5;

1.5
date	2001.08.01.04.36.09;	author dlr;	state Exp;
branches;
next	1.4;

1.4
date	2001.08.01.04.29.53;	author dlr;	state Exp;
branches;
next	1.3;

1.3
date	2001.07.31.20.58.11;	author dlr;	state Exp;
branches;
next	1.2;

1.2
date	2001.07.31.20.47.00;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2001.07.31.01.12.18;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.6
log
@Serialization does not appear to get along with non-Serializable
references, even when the type of the object referenced *does*
implement the Serializable interface.
@
text
@/* ================================================================
 * Copyright (c) 2001 CollabNet.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by CollabNet <http://www.collab.net/>."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 *
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@@@collab.net.
 *
 * 5. Products derived from this software may not use the "Tigris" or
 * "Helm" names nor may "Tigris" or "Helm" appear in their names without
 * prior written permission of CollabNet.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLABNET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CollabNet.
 */

package org.tigris.helm.event;

import org.tigris.helm.tool.cluster.ClusteredSingletonService;

/**
 * Event indicating that an cluster-singleton election should occur.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 */
public class SingletonElectionEvent extends ClusterEvent
{
    private float bid = ClusteredSingletonService.NO_BID;

    public SingletonElectionEvent(float bid)
    {
        this.bid = bid;
    }

    /**
     * Returns the electoral bid, or
     * <code>ClusteredSingletonService.NO_BID</code> if none.  Use
     * this method instead of {@@link java.util.EventObject#getSource()}.
     */
    public float getBid()
    {
        return bid;
    }

    public final short getType()
    {
        return ELECTION_EVENT;
    }
}
@


1.5
log
@Override the EventType getType() interface implemented in super class.
@
text
@d58 2
d62 1
a62 1
        super(new Float(bid));
d72 1
a72 4
        Object obj = getSource();
        return (obj instanceof Float ?
                ((Float) obj).floatValue() :
                ClusteredSingletonService.NO_BID);
@


1.4
log
@Employed constant.
@
text
@d70 3
a72 3
        Object src = getSource();
        return (src instanceof Float ?
                ((Float) src).floatValue() :
d74 5
@


1.3
log
@Corrected compile-time error.
@
text
@d49 2
d64 3
a66 2
     * Returns the electoral bid, or <code>-1L</code> if none.
     * Use this method instead of {@@link java.util.EventObject#getSource()}.
d71 3
a73 1
        return (src instanceof Float ? ((Float) src).floatValue() : -1L);
@


1.2
log
@Added method to retrieve the election bid.
@
text
@d62 1
a62 1
     * Returns the electoral bid 
d68 1
a68 1
        return (src instanceof Float ? ((Float) src).floatValue() : null);
@


1.1
log
@Event indicating that an cluster-singleton election should occur.
@
text
@d56 1
a56 1
    public SingletonElectionEvent(Object source)
d58 11
a68 1
        super(source);
@

