Debian Codegraph @

core/java/android/gesture/GesturePoint.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2009 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
17 package android.gesture;
18
19 import java.io.DataInputStream;
20 import java.io.IOException;
21
22 /**
23 * A timed point of a gesture stroke. Multiple points form a stroke.
24 */
25
26 public class GesturePoint {
27 public final float x;
28 public final float y;
29
30 public final long timestamp;
31
32 public GesturePoint(float x, float y, long t) {
33 this.x = x;
34 this.y = y;
35 timestamp = t;
36 }
37
38 static GesturePoint deserialize(DataInputStream in) throws IOException {
39 // Read X and Y
40 final float x = in.readFloat();
41 final float y = in.readFloat();
42 // Read timestamp
43 final long timeStamp = in.readLong();
44 return new GesturePoint(x, y, timeStamp);
45 }
46
47 @Override
48 public Object clone() {
49 return new GesturePoint(x, y, timestamp);
50 }
51 }