// Path: src/main/java/net/bitdroid/network/messages/Message.java
// public abstract class Message extends Event {
// 	public abstract EventType getType();
// 
// 	/**
// 	 * @return the command
// 	 */
// 	public abstract String getCommand();
// 	private int payloadSize;
// 
// 	public int getPayloadSize() {
// 		return payloadSize;
// 	}
// 
// 	public void setPayloadSize(int size) {
// 		this.payloadSize = size;
// 	}
// 
// 	public abstract void read(LittleEndianInputStream in) throws IOException;
// 	public abstract void toWire(LittleEndianOutputStream leos) throws IOException;
// 
// }


import net.bitdroid.network.messages.Message;
/**
 * Copyright 2011 Christian Decker
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * This file is part the BitDroidNetwork Project.
 */
package net.bitdroid.network;


/**
 * @author cdecker
 *
 */
public class Event {
	/**
	 * Indicates that apropriate actions have been taken to respond to the event.
	 */
	private boolean handled = false;

	/**
	 * Should this be false the reactor will stop notifying event listeners.
	 */
	private boolean propagate = true;
	private EventType type;
	private PeerInfo origin;


	public static enum EventType {
		INCOMING_CONNECTION_TYPE,
		OUTGOING_CONNECTION_TYPE,
		FAILED_CONNECTION_TYPE,
		DISCONNECTED_TYPE,
		VERSION_TYPE,
		VERACK_TYPE,
		ADDR_TYPE,
		BLOCK_TYPE,
		GET_ADDR_TYPE,
		GET_DATA_TYPE,
		INVENTORY_TYPE,
		PING_TYPE,
		TRANSACTION_TYPE,
		UNKNOWN_TYPE,
		PART_TYPE // Used to indicate that the message is not a standalone message.
	};

	public Event(PeerInfo origin, EventType type){
		setOrigin(origin);
		setType(type);
	}

	public Event(){}

// Path: src/main/java/net/bitdroid/network/messages/Message.java
// public abstract class Message extends Event {
// 	public abstract EventType getType();
// 
// 	/**
// 	 * @return the command
// 	 */
// 	public abstract String getCommand();
// 	private int payloadSize;
// 
// 	public int getPayloadSize() {
// 		return payloadSize;
// 	}
// 
// 	public void setPayloadSize(int size) {
// 		this.payloadSize = size;
// 	}
// 
// 	public abstract void read(LittleEndianInputStream in) throws IOException;
// 	public abstract void toWire(LittleEndianOutputStream leos) throws IOException;
// 
// }


// Path: src/main/java/net/bitdroid/network/Event.java
import net.bitdroid.network.messages.Message;

/**
 * Copyright 2011 Christian Decker
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * This file is part the BitDroidNetwork Project.
 */
package net.bitdroid.network;


/**
 * @author cdecker
 *
 */
public class Event {
	/**
	 * Indicates that apropriate actions have been taken to respond to the event.
	 */
	private boolean handled = false;

	/**
	 * Should this be false the reactor will stop notifying event listeners.
	 */
	private boolean propagate = true;
	private EventType type;
	private PeerInfo origin;


	public static enum EventType {
		INCOMING_CONNECTION_TYPE,
		OUTGOING_CONNECTION_TYPE,
		FAILED_CONNECTION_TYPE,
		DISCONNECTED_TYPE,
		VERSION_TYPE,
		VERACK_TYPE,
		ADDR_TYPE,
		BLOCK_TYPE,
		GET_ADDR_TYPE,
		GET_DATA_TYPE,
		INVENTORY_TYPE,
		PING_TYPE,
		TRANSACTION_TYPE,
		UNKNOWN_TYPE,
		PART_TYPE // Used to indicate that the message is not a standalone message.
	};

	public Event(PeerInfo origin, EventType type){
		setOrigin(origin);
		setType(type);
	}

	public Event(){}

	public Event(PeerInfo o, EventType type, Message m){