node.java

来自「RFID复杂事件处理系统的研究实验」· Java 代码 · 共 135 行

JAVA
135
字号
package test1;

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 int x=0;
	protected int y=0;
	
	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 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 int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}
	public boolean getL() {
		return l;
	}
	public void setL() {
		this.l = true;
	}	
	

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?