//# 0 errors, 55 messages
//#
/*
    //#pebbleevent.java:1:1: class: net.sourceforge.pebble.api.event.PebbleEvent
    //#pebbleevent.java:1:1: method: net.sourceforge.pebble.api.event.PebbleEvent.net.sourceforge.pebble.api.event.PebbleEvent__static_init
 * Copyright (c) 2003-2006, Simon Brown
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   - 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.
 *
 *   - Neither the name of Pebble nor the names of its contributors may
 *     be used to endorse or promote products derived from this software
 *     without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS 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 THE COPYRIGHT OWNER OR 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.
 */
package net.sourceforge.pebble.api.event;

import java.util.EventObject;

/**
 * Superclass for Pebble events.
 *
 * @author Simon Brown
 */
public abstract class PebbleEvent extends EventObject {

  /** the type of the event */
  private int type;

  /** flag to indicate whether this event has been vetoed */
  private boolean vetoed = false;

  /**
   * Creates a new instance with the specified source and type.
   *
   * @param source    the Object that created this event
   * @param type    the type of this event
   */
  public PebbleEvent(Object source, int type) {
    super(source);
    //#pebbleevent.java:56: method: void net.sourceforge.pebble.api.event.PebbleEvent.net.sourceforge.pebble.api.event.PebbleEvent(Object, int)
    //#input(void net.sourceforge.pebble.api.event.PebbleEvent(Object, int)): source
    //#input(void net.sourceforge.pebble.api.event.PebbleEvent(Object, int)): this
    //#input(void net.sourceforge.pebble.api.event.PebbleEvent(Object, int)): type
    //#output(void net.sourceforge.pebble.api.event.PebbleEvent(Object, int)): this.type
    //#output(void net.sourceforge.pebble.api.event.PebbleEvent(Object, int)): this.vetoed
    //#post(void net.sourceforge.pebble.api.event.PebbleEvent(Object, int)): this.type == type
    //#post(void net.sourceforge.pebble.api.event.PebbleEvent(Object, int)): init'ed(this.type)
    //#post(void net.sourceforge.pebble.api.event.PebbleEvent(Object, int)): this.vetoed == 0

    this.type = type;
  }
    //#pebbleevent.java:59: end of method: void net.sourceforge.pebble.api.event.PebbleEvent.net.sourceforge.pebble.api.event.PebbleEvent(Object, int)

  /**
   * Gets the type of this event.
   *
   * @return  the type as an int
   */
  public int getType() {
    return this.type;
    //#pebbleevent.java:67: method: int net.sourceforge.pebble.api.event.PebbleEvent.getType()
    //#input(int getType()): this
    //#input(int getType()): this.type
    //#output(int getType()): return_value
    //#pre[2] (int getType()): init'ed(this.type)
    //#post(int getType()): return_value == this.type
    //#post(int getType()): init'ed(return_value)
    //#pebbleevent.java:67: end of method: int net.sourceforge.pebble.api.event.PebbleEvent.getType()
  }

  /**
   * Vetos this event so that other listeners will not reveive it.
   */
  public void veto() {
    this.vetoed = true;
    //#pebbleevent.java:74: method: void net.sourceforge.pebble.api.event.PebbleEvent.veto()
    //#input(void veto()): this
    //#output(void veto()): this.vetoed
    //#post(void veto()): this.vetoed == 1
  }
    //#pebbleevent.java:75: end of method: void net.sourceforge.pebble.api.event.PebbleEvent.veto()

  /**
   * Determines whether this event has been vetoed.
   *
   * @return  true if this event has been vetoed, false otherwise
   */
  public boolean isVetoed() {
    return this.vetoed;
    //#pebbleevent.java:83: method: bool net.sourceforge.pebble.api.event.PebbleEvent.isVetoed()
    //#input(bool isVetoed()): this
    //#input(bool isVetoed()): this.vetoed
    //#output(bool isVetoed()): return_value
    //#pre[2] (bool isVetoed()): init'ed(this.vetoed)
    //#post(bool isVetoed()): return_value == this.vetoed
    //#post(bool isVetoed()): init'ed(return_value)
    //#pebbleevent.java:83: end of method: bool net.sourceforge.pebble.api.event.PebbleEvent.isVetoed()
  }

  public String toString() {
    return getClass().getName() + "/" + source + "/" + type;
    //#pebbleevent.java:87: method: String net.sourceforge.pebble.api.event.PebbleEvent.toString()
    //#input(String toString()): this
    //#input(String toString()): this.source
    //#input(String toString()): this.type
    //#output(String toString()): return_value
    //#pre[2] (String toString()): init'ed(this.source)
    //#pre[3] (String toString()): init'ed(this.type)
    //#presumption(String toString()): java.lang.Object:getClass(...)@87 != null
    //#post(String toString()): return_value != null
    //#pebbleevent.java:87: end of method: String net.sourceforge.pebble.api.event.PebbleEvent.toString()
  }

}
    //#output(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Descendant_Table[net/sourceforge/pebble/api/event/PebbleEvent]
    //#output(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Dispatch_Table.getType()I
    //#output(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Dispatch_Table.isVetoed()Z
    //#output(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Dispatch_Table.toString()Ljava/lang/String;
    //#output(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Dispatch_Table.veto()V
    //#post(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Descendant_Table[net/sourceforge/pebble/api/event/PebbleEvent] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Dispatch_Table.getType()I == &getType
    //#post(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Dispatch_Table.isVetoed()Z == &isVetoed
    //#post(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Dispatch_Table.toString()Ljava/lang/String; == &toString
    //#post(net.sourceforge.pebble.api.event.PebbleEvent__static_init): __Dispatch_Table.veto()V == &veto
    //#pebbleevent.java:: end of method: net.sourceforge.pebble.api.event.PebbleEvent.net.sourceforge.pebble.api.event.PebbleEvent__static_init
    //#pebbleevent.java:: end of class: net.sourceforge.pebble.api.event.PebbleEvent
