/* * Copyright 2009 Wishnu Prasetya. * * This file is part of T2. * T2 is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License (GPL) as published by the * Free Software Foundation; either version 3 of the License, or any * later version. * * T2 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. * * A copy of the GNU General Public License can be found in T2 distribution. * If it is missing, see http://www.gnu.org/licenses. */ package Sequenic.T2ext.Instrumenter; import java.util.*; /** * Represent a path through a CFG, as observed from injected sensors. * * @author Wishnu Prasetya * */ public class ObservedPath { /** * The unique name of the target method. This name is assigned when * the method was instrumented. */ String methodUname ; long runID ; /** * The nodes in the path. Each node will be just represented by its ID * (this is what we get from a sensor). */ LinkedList nodes = new LinkedList() ; /** * The same path represented as a list of edges. */ LinkedList> edges = new LinkedList>() ; public ObservedPath(String mname, long runid) { methodUname = mname; runID = runid; } public void extend(int nodeId){ if (nodes.isEmpty()) { nodes.add(nodeId) ; return ; } Integer lastNode = nodes.getLast() ; nodes.add(nodeId) ; edges.add(new Edge(lastNode,nodeId)) ; } public void clear() { nodes.clear() ; edges.clear() ; } public String getMethodUname() { return methodUname; } public LinkedList getNodes() { return nodes; } }