1 33 package net.sf.jga.fn.comparison; 34 35 import java.util.Comparator ; 36 import net.sf.jga.fn.BinaryPredicate; 37 import net.sf.jga.util.ComparableComparator; 38 39 56 57 public class GreaterEqual<T> extends BinaryPredicate<T,T>{ 58 59 static final long serialVersionUID = 8834315867722931262L; 60 61 private Comparator <? super T> _comp; 63 64 68 public GreaterEqual(Comparator <? super T> comp) { 69 if (comp == null) { 70 throw new IllegalArgumentException ("Comparator may not be null"); 71 } 72 73 _comp = comp; 74 } 75 76 80 public Comparator <? super T> getComparator() { return _comp; } 81 82 84 90 public Boolean fn(T x, T y) { 91 return Boolean.valueOf(_comp.compare(x, y) >= 0); 92 } 93 94 98 public void accept(net.sf.jga.fn.Visitor v) { 99 if (v instanceof GreaterEqual.Visitor) 100 ((GreaterEqual.Visitor)v).visit(this); 101 else 102 v.visit(this); 103 } 104 105 107 public String toString() { 108 return "GreaterEqual"; 109 } 110 111 113 116 public interface Visitor extends net.sf.jga.fn.Visitor { 117 public void visit(GreaterEqual host); 118 } 119 120 125 126 static public class Comparable<T extends java.lang.Comparable <? super T>> 127 extends GreaterEqual<T> 128 { 129 static final long serialVersionUID = 62633572749973541L; 130 public Comparable() { super(new ComparableComparator<T>()); } 131 } 132 } 133 134 | Popular Tags |