// @(#) $Id: TwoWayList.refines-jml,v 1.8 2005/12/24 21:20:31 chalin Exp $ // Copyright (C) 1998, 1999 Iowa State University // This file is part of JML // JML 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 2, or (at your option) // any later version. // JML 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 JML; see the file COPYING. If not, write to // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // Author: Clyde Ruby package org.jmlspecs.samples.list.list3; //@ refine "TwoWayList.java"; import org.jmlspecs.samples.list.node.TwoWayNode; // FIXME: adapt this file to non-null-by-default and remove the following modifier. /*@ nullable_by_default @*/ public class TwoWayList extends E_OneWayList { // Doubly Linked List //@ protected model TwoWayNode cursorNodeTwoWay; in cursor; //@ protected represents cursorNodeTwoWay <- (TwoWayNode) cursorNode_; /*@ also @ protected code normal_behavior @ requires \same; @ accessible theListNode_; @ captures \nothing; @ callable new TwoWayNode(Object), firstEntry(); @*/ public TwoWayList(); // iteration methods // ----------------- // NEW iteration methods (for doubly linked list) // --------------------- /*@ also @ protected code normal_behavior @ requires \same; @ accessible lastNode_, cursorNode_, prevCursorNode_; @ captures \nothing; @ callable isOffFront(), isOffEnd(), lastEntry(), @ cursorNodeTwoWay.getPrevNode(); @*/ public void decrementCursor(); /*@ also @ protected code normal_behavior @ requires \same; @ accessible lastNode_; @ captures \nothing; @ callable lastNode_.getPrevNode(); @*/ public void lastEntry(); /*@ also @ protected code normal_behavior @ requires \same; @ accessible cursorNode_, length_; @ captures \nothing; @ callable isOffEnd(), isOffFront(), decrementCursor(), @ cursorNode_.getNextNode(), incrementCursor(), @ cursorNode_.removeNextNode(); @*/ public void removeEntry(); /*@ also @ protected code normal_behavior @ requires \same; @ accessible cursorNode_, length_; @ captures newEntry; @ callable isOffEnd(), decrementCursor(), @ cursorNode_.insertAfter(Object), @ incrementCursor(), cursorNode_.getNextNode(), @ super.insertAfterCursor(Object ); @*/ public void insertAfterCursor(Object newEntry); /*@ also @ protected code normal_behavior @ requires \same; @ accessible cursorNode_, length_; @ captures newEntry; @ callable isOffFront(), isOffEnd(), insertAfterCursor(Object), @ decrementCursor(), incrementCursor(); @*/ public void insertBeforeCursor(Object newEntry); /*@ also @ protected code normal_behavior @ requires \same; @ accessible theList; @ captures theListNode_.entries; @ callable new TwoWayList(TwoWayList ); @*/ public /*@ non_null @*/ Object clone(); /*@ also @ protected code normal_behavior @ requires \same; @ accessible theList; @ captures theListNode_; @ callable new TwoWayIterator(TwoWayNode); @*/ public TwoWayIterator createIterator(); // *********************************************************** // protected methods /*@ also @ protected code normal_behavior @ requires \same; @ accessible othLst.theList, theListNode_, lastNode_; @ accessible theListNode_, length_, lastNode_; @ captures othLst.theList; @ callable firstEntry(); @ callable firstEntry(), lastNode_.getNextNode(); @*/ protected TwoWayList(TwoWayList othLst); }