• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.chimpchat.core;
17 
18 import java.util.HashMap;
19 import java.util.Map;
20 
21 /**
22  * TouchPressType enum contains valid input for the "touch" Monkey command.
23  * When passed as a string, the "identifier" value is used.
24  */
25 public enum TouchPressType {
26     DOWN("down"), UP("up"), DOWN_AND_UP("downAndUp");
27 
28     private static final Map<String,TouchPressType> identifierToEnum =
29         new HashMap<String,TouchPressType>();
30     static {
31         for (TouchPressType type : values()) {
identifierToEnum.put(type.identifier, type)32             identifierToEnum.put(type.identifier, type);
33         }
34     }
35 
36     private String identifier;
37 
TouchPressType(String identifier)38     TouchPressType(String identifier) {
39         this.identifier = identifier;
40     }
41 
getIdentifier()42     public String getIdentifier() {
43         return identifier;
44     }
45 
fromIdentifier(String name)46     public static TouchPressType fromIdentifier(String name) {
47         return identifierToEnum.get(name);
48     }
49 }
50