📄 node.java
字号:
package test;
import java.util.*;
public class Node {
protected char type;
protected byte mode=3;
protected boolean flag=false;
protected Node[] target=new Node[20];
protected boolean isleaf;
protected LinkedList<NonLeaf> parent=new LinkedList<NonLeaf>();
protected boolean l=false;
protected boolean checkflag=false;
protected double door=0.5;
public Node(char c)
{
type=c;
}
public Node(Leaf n)
{
type=n.type;
mode=n.mode;
flag=n.flag;
target=n.gettarget();
isleaf=true;
parent.addAll(n.getparent());
}
public Node(NonLeaf n)
{
type=n.type;
mode=n.mode;
flag=n.flag;
target=n.gettarget();
isleaf=false;
parent.addAll(n.getparent());
}
public boolean checkattribute(P_Event pe)
{
try{
Thread.sleep(1);
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
//System.out.println("Node "+this.type+" check attribute!");
if(pe.getAttribute()<door) return true;
else return false;
}
public boolean checkattribute(C_Event ce)
{
try{
Thread.sleep(1);
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
//System.out.println("Node"+this.type+"check attribute!");
if(ce.getel().get(0).getAttribute()<door) return true;
else return false;
}
public char gettype()
{
return type;
}
public boolean getisleaf()
{
return isleaf;
}
public boolean getflag()
{
return flag;
}
public LinkedList<NonLeaf> getparent()
{
return parent;
}
public int getmode()
{
return mode;
}
public Node [] gettarget() {
return target;
}
public void setmode(int i)
{
mode=(byte)i;
}
public void setflag()
{
flag=true;
}
public void setTarget(Node[] target) {
this.target = target;
}
public void addparent(NonLeaf n)
{
parent.addLast(n);
}
public LinkedList<NonLeaf> getlefttree()
{
LinkedList<NonLeaf> l=new LinkedList<NonLeaf>();
NonLeaf p;
for(int i=0;i<this.getparent().size();i++)
{
p=this.getparent().get(i);
if(p.getrchild()==this) l.addLast(p);
}
return l;
}
public LinkedList<NonLeaf> getrighttree()
{
LinkedList<NonLeaf> l=new LinkedList<NonLeaf>();
NonLeaf p;
for(int i=0;i<this.getparent().size();i++)
{
p=this.getparent().get(i);
if(p.getlchild()==this) l.addLast(p);
}
return l;
}
public boolean getL() {
return l;
}
public void setL() {
this.l = true;
}
public boolean getCheckflag() {
return checkflag;
}
public void setCheckflag() {
this.checkflag = true;
}
public double getDoor() {
return door;
}
public void setDoor(double door) {
this.door = door;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -