WatershedFIFO.java

Go to the documentation of this file.
00001 
00006 package watershed;
00007 
00008 /*
00009  * Watershed plugin
00010  *
00011  * Copyright (c) 2003 by Christopher Mei (christopher.mei@sophia.inria.fr)
00012  *
00013  * This plugin is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License version 2 
00015  * as published by the Free Software Foundation.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this plugin; if not, write to the Free Software
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025  */
00026 
00032 import java.util.LinkedList;
00033 
00039 public class WatershedFIFO {
00040         private LinkedList watershedFIFO;
00041 
00042         public WatershedFIFO() {
00043                 watershedFIFO = new LinkedList();
00044         }
00045 
00046         public void fifo_add(WatershedPixel p) {
00047                 watershedFIFO.addFirst(p);
00048         }
00049 
00050         public WatershedPixel fifo_remove() {
00051                 return (WatershedPixel) watershedFIFO.removeLast();
00052         }
00053 
00054         public boolean fifo_empty() {
00055                 return watershedFIFO.isEmpty();
00056         }
00057 
00058         public void fifo_add_FICTITIOUS() {
00059                 watershedFIFO.addFirst(new WatershedPixel());
00060         }
00061 
00062 
00063         @Override
00064         public String toString() {
00065                 StringBuffer ret = new StringBuffer();
00066                 for (int i = 0; i < watershedFIFO.size(); i++) {
00067                         ret.append(((WatershedPixel) watershedFIFO.get(i)).toString());
00068                         ret.append("\n");
00069                 }
00070                 return ret.toString();
00071         }
00072 
00073 
00074 }

Generated on Fri Nov 13 08:57:08 2009 for Theba by  doxygen 1.6.1