📄 player.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: PLayer.java
package com.huawei.insa2.comm;
import java.util.*;
// Referenced classes of package com.huawei.insa2.comm:
// PEvent, PEventListener, PException, PMessage
public abstract class PLayer
{
public static final int maxId = 0x3b9aca00;
protected int id;
protected int nextChildId;
protected PLayer parent;
private HashMap children;
private List listeners;
protected PLayer(PLayer theParent)
{
if(theParent != null)
{
id = ++theParent.nextChildId;
if(theParent.nextChildId >= 0x3b9aca00)
theParent.nextChildId = 0;
if(theParent.children == null)
theParent.children = new HashMap();
theParent.children.put(new Integer(id), this);
parent = theParent;
}
}
public abstract void send(PMessage pmessage)
throws PException;
public void onReceive(PMessage message)
{
int childId = getChildId(message);
if(childId == -1)
{
PLayer child = createChild();
child.onReceive(message);
fireEvent(new PEvent(2, this, child));
} else
{
PLayer child = (PLayer)children.get(new Integer(getChildId(message)));
if(child == null)
fireEvent(new PEvent(64, this, message));
else
child.onReceive(message);
}
}
public PLayer getParent()
{
return parent;
}
public int getChildNumber()
{
if(children == null)
return 0;
else
return children.size();
}
protected PLayer createChild()
{
throw new UnsupportedOperationException("Not implement");
}
protected int getChildId(PMessage message)
{
throw new UnsupportedOperationException("Not implement");
}
public void close()
{
if(parent == null)
{
throw new UnsupportedOperationException("Not implement");
} else
{
parent.children.remove(new Integer(id));
return;
}
}
public void addEventListener(PEventListener l)
{
if(listeners == null)
listeners = new ArrayList();
listeners.add(l);
}
public void removeEventListener(PEventListener l)
{
listeners.remove(l);
}
protected void fireEvent(PEvent e)
{
if(listeners == null)
return;
for(Iterator i = listeners.iterator(); i.hasNext(); ((PEventListener)i.next()).handle(e));
}
static
{
maxId = 0x3b9aca00;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -