📄 traceable.java
字号:
package jns.trace;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
public abstract class Traceable
{
/**
List of Trace objects that are listening to us.
*/
Vector m_traces = null;
public Traceable()
{
m_traces = new Vector();
}
public void attach(Trace trace)
{
m_traces.addElement(trace);
}
public void detach(Trace trace)
{
}
/**
Used by subclasses to send events to a Trace object. This gets rid of
lots of if/else code by making the decision if anyone is listening
in here.
*/
protected void sendEvent(Event event)
{
Enumeration e = m_traces.elements();
while(e.hasMoreElements())
{
Trace trace = (Trace) e.nextElement();
try
{
trace.handleEvent(event);
}
catch(IOException xept)
{
System.out.println("ERROR: An I/O exception occured while writing" +
" an event!");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -