Dead
[official-gcc.git] / gomp-20050608-branch / libjava / classpath / javax / sound / sampled / LineEvent.java
blob7bba2cd1d96d3074f899c92ce9d0d45ecbea5382
1 /*
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.sound.sampled;
41 import java.util.EventObject;
43 // FIXME: attempts to serialize this should fail
45 /**
46 * This class holds information about a state change of a Line.
47 * @since 1.3
49 public class LineEvent extends EventObject
51 /**
52 * This class represents the kinds of state changes that can occur
53 * to a Line. The standard states are availabe as static instances.
54 * @since 1.3
56 public static class Type
58 /** An event of this type is posted when a Line closes. */
59 public static final Type CLOSE = new Type("close");
61 /** An event of this type is posted when a Line opens. */
62 public static final Type OPEN = new Type("open");
64 /** An event of this type is posted when a Line starts. */
65 public static final Type START = new Type("start");
67 /** An event of this type is posted when a Line stops. */
68 public static final Type STOP = new Type("stop");
70 private String name;
72 /**
73 * Create a new type with the indicated name.
74 * @param name the name
76 protected Type(String name)
78 this.name = name;
81 public final boolean equals(Object o)
83 return super.equals(o);
86 public final int hashCode()
88 return super.hashCode();
91 /**
92 * Return the name of this Type.
94 public String toString()
96 return name;
100 private Type type;
101 private long framePosition;
102 private Line line;
105 * Create a new LineEvent with the indicated line, type, and frame position.
106 * @param line the line
107 * @param type the type of the event
108 * @param pos the frame position
110 public LineEvent(Line line, Type type, long pos)
112 super(line);
113 this.line = line;
114 this.type = type;
115 this.framePosition = pos;
119 * Return the frame position associated with this event.
121 public long getFramePosition()
123 return framePosition;
127 * Return the Line associated with this event.
129 public Line getLine()
131 return line;
135 * Return the Type associated with this event.
137 public Type getType()
139 return type;
143 * Return a description of this event.
145 public String toString()
147 return ("type=" + type + "; framePosition=" + framePosition
148 + "line=" + line);