/*
 * This file is released under terms of BSD license
 * See LICENSE file for more information
 */

package cx2x.xcodeml.xnode;

/**
 * The Xintent represents the possible value for the intent attribute in XcodeML
 * intermediate representation.
 * <p>
 * Possible value are: in, out, inout
 *
 * @author clementval
 */
public enum Xintent {
  IN,
  OUT,
  INOUT,
  NONE;

  /**
   * Convert string value to enum.
   *
   * @param value String value.
   * @return Corresponding enum value.
   */
  public static Xintent fromString(String value) {
    if(value == null) {
      return NONE;
    }
    switch(value) {
      case Xname.INTENT_IN:
        return IN;
      case Xname.INTENT_OUT:
        return OUT;
      case Xname.INTENT_INOUT:
        return INOUT;
    }
    return NONE;
  }

  /**
   * Convert current enum to String value.
   *
   * @return Corresponding String value.
   */
  public String toString() {
    switch(this) {
      case IN:
        return Xname.INTENT_IN;
      case OUT:
        return Xname.INTENT_OUT;
      case INOUT:
        return Xname.INTENT_INOUT;
      default:
        return "";
    }
  }
}

@@ -340,14 +340,22 @@
 t %7B%0A
+  NONE,%0A
   IN,%0A
-
   OU
@@ -368,21 +368,67 @@
 NOUT,%0A  
-NONE;
+ANY; // Represents any intent as well as no intent.
 %0A%0A  /**%0A
@@ -656,24 +656,38 @@
 switch(value
+.toLowerCase()
 ) %7B%0A      ca
@@ -1187,16 +1187,16 @@
 urn %22%22;%0A
-
     %7D%0A  
@@ -1196,11 +1196,985 @@
    %7D%0A  %7D
+%0A%0A  /**%0A   * Check if it is an in intent.%0A   *%0A   * @return True if IN or INOUT. False otherwise.%0A   */%0A  public boolean isIntentIn() %7B%0A    return this == IN %7C%7C this == INOUT;%0A  %7D%0A%0A  /**%0A   * Check if it is an out intent.%0A   *%0A   * @return True if OUT or INOUT. False otherwise.%0A   */%0A  public boolean isIntentOut() %7B%0A    return this == OUT %7C%7C this == INOUT;%0A  %7D%0A%0A  /**%0A   * Check whether an intent is specified%0A   *%0A   * @return True if IN, OUT or INOUT. False otherwise.%0A   */%0A  public boolean isIntent() %7B%0A    return isIntentIn() %7C%7C isIntentOut();%0A  %7D%0A%0A%0A  /**%0A   * Check if intent is compatible with the given one.%0A   *%0A   * @param intent Intent to check with.%0A   * @return True if intents are compatible.%0A   */%0A  public boolean isCompatible(Xintent intent) %7B%0A    return intent != null && (this == ANY %7C%7C (intent == ANY)%0A        %7C%7C (isIntentIn() && intent.isIntentIn())%0A        %7C%7C (isIntentOut() && intent.isIntentOut())%0A        %7C%7C (this == NONE && intent == NONE));%0A%0A  %7D
 %0A%7D%0A

Add methods to check compatibility between different intent