1 // Copyright (c) 2000, 2001 Per M.A. Bothner and Brainfood Inc. 2 // This is free software; for terms and warranty disclaimer see ./COPYING. 3 4 package gnu.lists; 5 6 /** A Consumer that does nothing. */ 7 8 public class VoidConsumer extends FilterConsumer 9 { 10 public static VoidConsumer instance = new VoidConsumer(); 11 getInstance()12 public static VoidConsumer getInstance() { return instance; } 13 VoidConsumer()14 public VoidConsumer() 15 { 16 super(null); 17 skipping = true; 18 } VoidConsumer(Consumer out)19 public VoidConsumer (Consumer out) { 20 super(out); 21 skipping = true; 22 } 23 make(Consumer old)24 public static VoidConsumer make(Consumer old) { 25 return new VoidConsumer(old); 26 } 27 28 /** True if consumer is ignoring rest of element. 29 * The producer can use this information to skip ahead. */ ignoring()30 public boolean ignoring() 31 { 32 return true; 33 } 34 } 35