node.java

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

JAVA
87
字号
package test1;

import java.util.*;

public class Node {
	protected char type;	
	protected boolean isleaf;
	protected LinkedList<NonLeaf> parent=new LinkedList<NonLeaf>();
	protected LinkedList<Boolean> mode=new LinkedList<Boolean>();	
	
	
	
	
	public Node(char c)
	{
		type=c;		
	}
	
		
	public char gettype()
	{
		return type;
	}
	public boolean getisleaf()
	{
		return isleaf;
	}

	public LinkedList<NonLeaf> getparent()
	{
		return parent;
	}
	
	public boolean getmode(int i)
	{
		return mode.get(i);
	}

	
	
	
	public void setmode(int i)
	{
		mode.set(i, true);
	}
		

	

	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 void addparent(NonLeaf n)
	{
		parent.addLast(n);
	}


	public LinkedList<Boolean> getMode() {
		return mode;
	}
	

}

⌨️ 快捷键说明

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