annotate src/uk/ac/qmul/eecs/depic/patterns/SequenceEvent.java @ 4:473da40f3d39 tip

added html formatting to Daw/package-info.java
author Fiore Martin <f.martin@qmul.ac.uk>
date Thu, 25 Feb 2016 17:50:09 +0000
parents 629262395647
children
rev   line source
f@0 1 /*
f@0 2 Cross-Modal DAW Prototype - Prototype of a simple Cross-Modal Digital Audio Workstation.
f@0 3
f@0 4 Copyright (C) 2015 Queen Mary University of London (http://depic.eecs.qmul.ac.uk/)
f@0 5
f@0 6 This program is free software: you can redistribute it and/or modify
f@0 7 it under the terms of the GNU General Public License as published by
f@0 8 the Free Software Foundation, either version 3 of the License, or
f@0 9 (at your option) any later version.
f@0 10
f@0 11 This program is distributed in the hope that it will be useful,
f@0 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
f@0 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f@0 14 GNU General Public License for more details.
f@0 15
f@0 16 You should have received a copy of the GNU General Public License
f@0 17 along with this program. If not, see <http://www.gnu.org/licenses/>.
f@0 18 */
f@0 19 package uk.ac.qmul.eecs.depic.patterns;
f@0 20
f@0 21 import java.util.EventObject;
f@0 22
f@1 23 /**
f@1 24 *
f@1 25 * An event in a sequence. Objects of this type are passed to the listeners of a sequence when it get changed.
f@1 26 *
f@1 27 */
f@0 28 public class SequenceEvent extends EventObject{
f@0 29 private static final long serialVersionUID = 1L;
f@0 30
f@1 31 /**
f@1 32 *
f@1 33 * Type of events in a sequence
f@1 34 *
f@1 35 */
f@0 36 public enum What {
f@0 37 VALUE_ADDED,
f@0 38 VALUE_REMOVED,
f@0 39 VALUE_CHANGED,
f@0 40 END_CHANGED,
f@0 41 BEGIN_CHANGED
f@0 42 };
f@0 43 private Sequence.Value value;
f@0 44 private SequenceEvent.What what;
f@0 45
f@0 46 public SequenceEvent(Sequence seq,Sequence.Value val, What what){
f@0 47 super(seq);
f@0 48 this.value = val;
f@0 49 this.what = what;
f@0 50 }
f@0 51
f@0 52 public What getWhat(){
f@0 53 return what;
f@0 54 }
f@0 55
f@0 56 @Override
f@0 57 public Sequence getSource(){
f@0 58 return (Sequence)super.getSource();
f@0 59 }
f@0 60
f@0 61 /**
f@0 62 * If the event concerns a particular value, it returns a reference to that value.
f@0 63 * If the event concerns the whole sequence it returns {@code null}.
f@0 64 *
f@0 65 * @return a reference to the value, or {@code null} if the event concerns no value
f@0 66 */
f@0 67 public Sequence.Value getValue(){
f@0 68 return value;
f@0 69 }
f@0 70 }