001 package edu.harvard.deas.hyperenc; 002 003 import java.util.EventObject; 004 005 /** 006 * A HyperEncryptionEvent signals a state change in a HyperCollector. The most 007 * common HyperEncryptionEvent indicates that the number of blocks or pages in a 008 * HyperStorage has changed. 009 * 010 * @see HyperEncryptionEventType 011 */ 012 public class HyperEncryptionEvent extends EventObject 013 { 014 private static final long serialVersionUID = 1L; 015 016 private final Contact contact; 017 private final Direction direction; 018 private final HyperEncryptionEventType type; 019 020 /** 021 * Create a new HyperEncryptionEvent. 022 * 023 * @param source 024 * The HyperCollector whose state change triggered this Event. 025 * @param contact 026 * The contact whose HyperStorage was affected by the state change 027 * @param direction 028 * The direction of communication for the affected HyperStorage 029 * @param type 030 * The type of event 031 */ 032 public HyperEncryptionEvent(HyperCollector source, Contact contact, 033 Direction direction, HyperEncryptionEventType type) { 034 super(source); 035 036 this.contact = contact; 037 this.direction = direction; 038 this.type = type; 039 } 040 041 /** 042 * Returns the contact whose HyperStorage caused this event. 043 * @return the contact whose HyperStorage caused this event 044 */ 045 public Contact getContact() { 046 return contact; 047 } 048 049 /** 050 * Returns the direction of the HyperStorage that caused this event. 051 * @return the direction of the HyperStorage that caused this event 052 */ 053 public Direction getDirection() { 054 return direction; 055 } 056 057 /** 058 * Returns the type of this event. 059 * @return the type of this event 060 */ 061 public HyperEncryptionEventType getType() { 062 return type; 063 } 064 }