1 24 package org.objectweb.jalisto.se.impl.meta.comparator; 25 26 27 public class StringComparator extends DefaultComparator { 28 public boolean smaller(Object candidate, Object value) { 29 return ((String ) value).compareTo((String ) candidate) < 0; 30 } 31 32 public boolean greater(Object candidate, Object value) { 33 return ((String ) value).compareTo((String ) candidate) > 0; 34 } 35 36 public boolean equal(Object candidate, Object value) { 37 return value.equals(candidate); 38 } 39 40 public boolean contains(Object candidate, Object value) { 41 return ((String ) candidate).indexOf((String ) value) != -1; 42 } 43 44 public boolean startsWith(Object candidate, Object value) { 45 return ((String ) candidate).startsWith((String ) value); 46 } 47 48 public boolean endsWith(Object candidate, Object value) { 49 return ((String ) candidate).endsWith((String ) value); 50 } 51 52 static final long serialVersionUID = -7589301687864761459L; 53 } 54 | Popular Tags |