public final int cmp(Value rValue)
public int cmp(Value rValue)
  public final int cmp(Value rValue)  {    // This is tricky: implemented according to Table 15-5 of    // http://us2.php.net/manual/en/language.operators.comparison.php        Value lVal = this.toValue();    Value rVal = rValue.toValue();    if (lVal instanceof StringValue && rVal instanceof NullValue)      return ((StringValue)lVal).cmpString(StringValue.EMPTY);    if (lVal instanceof NullValue && rVal instanceof StringValue)      return StringValue.EMPTY.cmpString((StringValue)rVal);    if (lVal instanceof StringValue && rVal instanceof StringValue)      return ((StringValue)lVal).cmpString((StringValue)rVal);    if (lVal instanceof NullValue || lVal instanceof BooleanValue ||	rVal instanceof NullValue || rVal instanceof BooleanValue) {      boolean thisBool = toBoolean();      boolean rBool    = rValue.toBoolean();      if (!thisBool && rBool) return -1;      if (thisBool && !rBool) return 1;      return 0;    }    // XXX: check if values belong to same class; if not, incomparable    if (lVal instanceof ObjectValue && rVal instanceof ObjectValue)      return ((ObjectValue)lVal).cmpObject((ObjectValue)rVal);    if ((lVal instanceof StringValue || lVal instanceof NumberValue ||	 lVal instanceof ResourceValue) &&	(rVal instanceof StringValue || rVal instanceof NumberValue ||	 rVal instanceof ResourceValue))      return NumberValue.compareNum(lVal, rVal);    if (lVal instanceof ArrayValue && rVal instanceof ArrayValue)      ((ArrayValue)lVal).compareArray((ArrayValue)rVal);    if (lVal instanceof ArrayValue) return 1;    if (rVal instanceof ArrayValue) return -1;    if (lVal instanceof ObjectValue) return 1;    if (rVal instanceof ObjectValue) return -1;    // XXX: proper default case?    throw new RuntimeException("values are incomparable: " +			       lVal + " <=> " + rVal);  }