001/* 002// $Id: Graph.java 3 2009-05-11 08:11:57Z jhyde $ 003// Clapham generates railroad diagrams to represent computer language grammars. 004// Copyright (C) 2008-2009 Julian Hyde 005// 006// This program is free software; you can redistribute it and/or modify it 007// under the terms of the GNU General Public License as published by the Free 008// Software Foundation; either version 2 of the License, or (at your option) 009// any later version approved by The Eigenbase Project. 010// 011// This program is distributed in the hope that it will be useful, 012// but WITHOUT ANY WARRANTY; without even the implied warranty of 013// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014// GNU General Public License for more details. 015// 016// You should have received a copy of the GNU General Public License 017// along with this program; if not, write to the Free Software 018// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 019*/ 020package net.hydromatic.clapham.graph; 021 022/** 023 * TODO: 024 * 025 * @author jhyde 026 * @version $Id: Graph.java 3 2009-05-11 08:11:57Z jhyde $ 027 * @since Jul 30, 2008 028 */ 029public class Graph { 030 031 public Node l; // left end of graph = head 032 public Node r; // right end of graph = list of nodes to be linked to successor graph 033 public Size graphSize; 034 035 public Graph() { 036 l = null; 037 r = null; 038 } 039 040 public Graph(Node left, Node right) { 041 l = left; 042 r = right; 043 } 044 045 public Graph(Node p) { 046 l = p; 047 r = p; 048 } 049 050 public void finish(Graph g) { 051 Node p = g.r; 052 while (p != null) { 053 Node q = p.next; 054 p.next = null; 055 p = q; 056 } 057 } 058} 059 060// End Graph.java