OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [javax/] [sound/] [sampled/] [LineEvent.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/*
2
   Copyright (C) 2005 Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
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.
10
 
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.
15
 
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.
20
 
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.
25
 
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. */
37
 
38
 
39
package javax.sound.sampled;
40
 
41
import java.util.EventObject;
42
 
43
// FIXME: attempts to serialize this should fail
44
 
45
/**
46
 * This class holds information about a state change of a Line.
47
 * @since 1.3
48
 */
49
public class LineEvent extends EventObject
50
{
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
55
   */
56
  public static class Type
57
  {
58
    /** An event of this type is posted when a Line closes.  */
59
    public static final Type CLOSE = new Type("close");
60
 
61
    /** An event of this type is posted when a Line opens.  */
62
    public static final Type OPEN = new Type("open");
63
 
64
    /** An event of this type is posted when a Line starts.  */
65
    public static final Type START = new Type("start");
66
 
67
    /** An event of this type is posted when a Line stops.  */
68
    public static final Type STOP = new Type("stop");
69
 
70
    private String name;
71
 
72
    /**
73
     * Create a new type with the indicated name.
74
     * @param name the name
75
     */
76
    protected Type(String name)
77
    {
78
      this.name = name;
79
    }
80
 
81
    public final boolean equals(Object o)
82
    {
83
      return super.equals(o);
84
    }
85
 
86
    public final int hashCode()
87
    {
88
      return super.hashCode();
89
    }
90
 
91
    /**
92
     * Return the name of this Type.
93
     */
94
    public String toString()
95
    {
96
      return name;
97
    }
98
  }
99
 
100
  private Type type;
101
  private long framePosition;
102
  private Line line;
103
 
104
  /**
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
109
   */
110
  public LineEvent(Line line, Type type, long pos)
111
  {
112
    super(line);
113
    this.line = line;
114
    this.type = type;
115
    this.framePosition = pos;
116
  }
117
 
118
  /**
119
   * Return the frame position associated with this event.
120
   */
121
  public long getFramePosition()
122
  {
123
    return framePosition;
124
  }
125
 
126
  /**
127
   * Return the Line associated with this event.
128
   */
129
  public Line getLine()
130
  {
131
    return line;
132
  }
133
 
134
  /**
135
   * Return the Type associated with this event.
136
   */
137
  public Type getType()
138
  {
139
    return type;
140
  }
141
 
142
  /**
143
   * Return a description of this event.
144
   */
145
  public String toString()
146
  {
147
    return ("type=" + type + "; framePosition=" + framePosition
148
            + "line=" + line);
149
  }
150
}

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.