package netmatch.algorithm;

public class Common {
  public static final String SELF_EDGE = "[SELFEDGE]";
  public static final String STD_EDGE = "[STDEDGE]";
  public static final String ANY_LABEL = "?";
  public static final int NULL_NODE = 0xFFFF;
  public static boolean DIRECTED = true;
  public static boolean LABELED = true;
  public static int imageSize = 80;

  public static final String APPROX_GT = "?>";
  public static final String APPROX_GE = "?>=";
  public static final String APPROX_EQ = "?=";
  public static final String APPROX_LT = "?<";
  public static final String APPROX_LE = "?<=";

  public static final String GT = ">";
  public static final String GE = ">=";
  public static final String EQ = "=";
  public static final String LT = "<";
  public static final String LE = "<=";
  public static final String UNDEFINED = "UNDEFINED";

  public static final String VERSION_NUMBER = "1.0.1";

  public static boolean isApproximate(String s) {
    return s.startsWith(APPROX_GT) || s.startsWith(APPROX_GE) || s.startsWith(APPROX_EQ) || s.startsWith(APPROX_LT) || s.startsWith(APPROX_LE);
  }

  public static String isNumber(String s) {
    if(s.startsWith(GE))
      return GE;
    else if(s.startsWith(GT))
      return GT;
    else if(s.startsWith(LE))
       return LE;
    else if(s.startsWith(LT))
      return LT;
    return UNDEFINED;
  }

  public static String getNumber(String s) {
    int index = s.indexOf("=");
    if(s.charAt(1) == '=')
      return s.substring(2);
    else
      return s.substring(1);
  }
}
