All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.wensiqun.asmsupport.client.block.IF Maven / Gradle / Ivy

/**    
 *  Asmsupport is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see .
 */
package cn.wensiqun.asmsupport.client.block;

import cn.wensiqun.asmsupport.client.def.Param;
import cn.wensiqun.asmsupport.client.def.ParamPostern;
import cn.wensiqun.asmsupport.core.block.control.condition.KernelIF;
import cn.wensiqun.asmsupport.standard.block.branch.IIF;

public abstract class IF extends ProgramBlock implements IIF {

	public IF(Param condition) {
		targetBlock = new KernelIF(ParamPostern.getTarget(condition)) {
			@Override
			public void body() {
				IF.this.body();
			}
		};
	}
	
	@Override
	public ElseIF elseif(ElseIF elseif) {
	    elseif.cursor = cursor;
	    elseif.parent = parent;
        cursor.setPointer(elseif.targetBlock);
        
		targetBlock.elseif(elseif.targetBlock);
		
		cursor.setPointer(parent.targetBlock);
		
		return elseif;
	}
	
	@Override
	public Else else_(Else els) {
	    els.cursor = cursor;
	    els.parent = parent;
        cursor.setPointer(els.targetBlock);
        
		targetBlock.else_(els.targetBlock);
        
        cursor.setPointer(parent.targetBlock);
        
		return els;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy