summaryrefslogtreecommitdiff
path: root/submit/ast/AssignmentType.java
blob: 9dd2bdf70576c0a62808005ba486667e313470cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * Code formatter project
 * CS 4481
 */
package submit.ast;

/**
 *
 * @author edwajohn
 */
public enum AssignmentType {

  EQUALS("="), PLUS("+="), MINUS("-="), TIMES("*="), DIVIDE("/="), INC("++"), DEC("--");

  private final String value;

  private AssignmentType(String value) {
    this.value = value;
  }

  public static AssignmentType fromString(String s) {
    for (AssignmentType at : AssignmentType.values()) {
      if (at.value.equals(s)) {
        return at;
      }
    }
    throw new RuntimeException("Illegal string in AssignType.fromString()");
  }

  @Override
  public String toString() {
    return value;
  }

}