Package dk.brics.string.java

Source Code of dk.brics.string.java.AssertionBranch

package dk.brics.string.java;

import dk.brics.string.intermediate.Method;
import dk.brics.string.intermediate.Nop;
import dk.brics.string.intermediate.Statement;

/**
* A subgraph containing assertions. The only statements allowed are assertions and nop statements.
* @author Asger
*
*/
public class AssertionBranch {
    private Statement first;
    private Statement last;
   
    /**
     * Creates a non-empty branch of assertions.
     * @param first first statement
     * @param last last statement
     */
    public AssertionBranch(Statement first, Statement last) {
        assert first != null;
        assert last != null;
       
        this.first = first;
        this.last = last;
    }
   
    /**
     * Creates an empty branch.
     */
    public AssertionBranch(Method method) {
        first = last = new Nop();
        method.addStatement(first);
    }
   
    public boolean isEmpty() {
        return first == null;
    }
   
    /**
     * The first statement. Never null.
     */
    public Statement getFirst() {
        return first;
    }
    /**
     * The last statement. Never null.
     */
    public Statement getLast() {
        return last;
    }
}
TOP

Related Classes of dk.brics.string.java.AssertionBranch

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.