Package org.candle.decompiler.intermediate.code.loop

Source Code of org.candle.decompiler.intermediate.code.loop.ContinuousWhileIntermediate

package org.candle.decompiler.intermediate.code.loop;

import java.io.IOException;
import java.io.StringWriter;

import org.apache.bcel.generic.InstructionHandle;
import org.candle.decompiler.intermediate.code.AbstractIntermediate;
import org.candle.decompiler.intermediate.code.BlockRange;
import org.candle.decompiler.intermediate.code.BlockSerializable;
import org.candle.decompiler.intermediate.expression.BooleanLiteral;
import org.candle.decompiler.intermediate.expression.Expression;
import org.candle.decompiler.intermediate.visitor.IntermediateVisitor;

public class ContinuousWhileIntermediate extends AbstractIntermediate implements BlockSerializable {
 
  private Expression expression;
 
  public ContinuousWhileIntermediate(InstructionHandle instruction) {
    super(instruction);
    this.expression = new BooleanLiteral(instruction, true);
    this.blockRange = new BlockRange();
  }

  private final BlockRange blockRange;

  @Override
  public String toString() {
    StringWriter sw = new StringWriter();
    try {
      this.expression.write(sw);
    } catch (IOException e) {
      e.printStackTrace();
    }
    return "While: "+sw.toString();
  }
 
  @Override
  public void accept(IntermediateVisitor visitor) {
    visitor.visitAbstractIntermediate(this);
    visitor.visitContinuousWhileIntermediate(this);
  }

  public BlockRange getBlockRange() {
    return blockRange;
  }
}
TOP

Related Classes of org.candle.decompiler.intermediate.code.loop.ContinuousWhileIntermediate

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.