1 17 package org.eclipse.emf.ecore.change; 18 19 20 import java.util.Arrays ; 21 import java.util.Collections ; 22 import java.util.List ; 23 24 import org.eclipse.emf.common.util.AbstractEnumerator; 25 26 27 36 public final class ChangeKind extends AbstractEnumerator 37 { 38 47 public static final int ADD = 0; 48 49 58 public static final int REMOVE = 1; 59 60 69 public static final int MOVE = 2; 70 71 83 public static final ChangeKind ADD_LITERAL = new ChangeKind(ADD, "ADD"); 84 85 97 public static final ChangeKind REMOVE_LITERAL = new ChangeKind(REMOVE, "REMOVE"); 98 99 111 public static final ChangeKind MOVE_LITERAL = new ChangeKind(MOVE, "MOVE"); 112 113 119 private static final ChangeKind[] VALUES_ARRAY = 120 new ChangeKind[] 121 { 122 ADD_LITERAL, 123 REMOVE_LITERAL, 124 MOVE_LITERAL, 125 }; 126 127 133 public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); 134 135 141 public static ChangeKind get(String name) 142 { 143 for (int i = 0; i < VALUES_ARRAY.length; ++i) 144 { 145 ChangeKind result = VALUES_ARRAY[i]; 146 if (result.toString().equals(name)) 147 { 148 return result; 149 } 150 } 151 return null; 152 } 153 154 160 public static ChangeKind get(int value) 161 { 162 switch (value) 163 { 164 case ADD: return ADD_LITERAL; 165 case REMOVE: return REMOVE_LITERAL; 166 case MOVE: return MOVE_LITERAL; 167 } 168 return null; 169 } 170 171 177 private ChangeKind(int value, String name) 178 { 179 super(value, name); 180 } 181 182 } | Popular Tags |