📄 and.java
字号:
package test2;
public class AND extends NonLeaf{
public AND()
{
super("*");
}
public C_Event work(NonLeaf n,Node n1)//n父结点;n1子结点 chronic
{
C_Event ce=null;
Node n2;
if(n1==n.getlchild()){
n2=n.getrchild();
}else n2=n.getlchild();
NonLeaf p1,p2;
Leaf q1,q2;
if(n1.getisleaf() && n2.getisleaf())
{
q1=(Leaf)n1;
q2=(Leaf)n2;
//
if(q2.getevents().size()==0)
{
q1.getevents().removeLast();
return ce;
}
else{
ce=new C_Event(q1.getevents().removeLast(),q2.getevents().removeFirst(),n);
}
}else{
if(!n1.getisleaf() && n2.getisleaf())
{
p1=(NonLeaf)n1;
q2=(Leaf)n2;
if(q2.getevents().size()==0)
{
p1.getmid_result().removeLast();
return ce;
}
else{
ce=new C_Event(q2.getevents().removeFirst(),p1.getmid_result().removeLast(),n);
}
}else{
if(n1.getisleaf() && !n2.getisleaf())
{
q1=(Leaf)n1;
p2=(NonLeaf)n2;
if(!p2.getoperator().equals("!")){
if(p2.getmid_result().size()==0)
{
q1.getevents().removeLast();
return ce;
}
else{
ce=new C_Event(q1.getevents().removeLast(),p2.getmid_result().removeFirst(),n);
}}else{
if(p2.getmid_result().size()==0)
{
ce=new C_Event(q1.getevents().removeLast(),n);
}
else{
q1.getevents().removeLast();
return ce;
}
}
}else{
p1=(NonLeaf)n1;
p2=(NonLeaf)n2;
if(!p2.getoperator().equals("!")){
if(p2.getmid_result().size()==0)
{
p1.getmid_result().removeLast();
return ce;
}
else{
ce=new C_Event(p1.getmid_result().removeLast(),p2.getmid_result().removeFirst(),n);
}
}
else{
if(p2.getmid_result().size()==0)
{
ce=new C_Event(p1.getmid_result().removeLast(),n);
}
else{
p1.getmid_result().removeLast();
return ce;
}
}
}
}
}
return ce;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -