ifstatement.java

来自「plugin for eclipse」· Java 代码 · 共 92 行

JAVA
92
字号
/*
 * Created on May 25, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package isis.anp.nesc.ot;

import isis.anp.common.TNode;

/**
 * @author sallai
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class IfStatement extends Statement {
	Expression condition;
	Statement trueBranchStatement;
	TNode elseNode;
	Statement falseBranchStatement;
	/**
	 * @return Returns the condition.
	 */
	public Expression getCondition() {
		return condition;
	}
	/**
	 * @param condition The condition to set.
	 */
	public void setCondition(Expression condition) {
		this.condition = condition;
	}
	/**
	 * @return Returns the elseNode.
	 */
	public TNode getElseNode() {
		return elseNode;
	}
	/**
	 * @param elseNode The elseNode to set.
	 */
	public void setElseNode(TNode elseNode) {
		this.elseNode = elseNode;
	}
	/**
	 * @return Returns the falseBranchStatement.
	 */
	public Statement getFalseBranchStatement() {
		return falseBranchStatement;
	}
	/**
	 * @param falseBranchStatement The falseBranchStatement to set.
	 */
	public void setFalseBranchStatement(Statement falseBranchStatement) {
		this.falseBranchStatement = falseBranchStatement;
	}
	/**
	 * @return Returns the trueBranchStatement.
	 */
	public Statement getTrueBranchStatement() {
		return trueBranchStatement;
	}
	/**
	 * @param trueBranchStatement The trueBranchStatement to set.
	 */
	public void setTrueBranchStatement(Statement trueBranchStatement) {
		this.trueBranchStatement = trueBranchStatement;
	}
	
	public void outline(Outline o) {
		o.addTabs();
		o.append("if(");
		o.ensureSpace();
		condition.outline(o);
		o.append(")");
		o.addNewLine();
		o.incTabs();
		trueBranchStatement.outline(o);
		o.decTabs();
		if(falseBranchStatement!=null) {
		    o.addNewLine();
		    o.addTabs();
		    o.append("else");
		    o.addNewLine();
		    o.incTabs();
		    falseBranchStatement.outline(o);
		    o.decTabs();
		}
	}	
}

⌨️ 快捷键说明

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