1 package org.sat4j.pb.tools;
2
3 public class StringNegator implements INegator {
4
5 public static final INegator instance = new StringNegator();
6
7 private StringNegator() {
8 // no access to constructor
9 }
10
11 public boolean isNegated(Object thing) {
12 if (thing instanceof String)
13 return ((String) thing).startsWith("-");
14 return false;
15 }
16
17 public Object unNegate(Object thing) {
18 if (isNegated(thing))
19 return ((String) thing).substring(1);
20 return thing;
21 }
22 }