Commit | Line | Data |
---|---|---|
cb8c854e | 1 | /******************************************************************************* |
60ae41e1 | 2 | * Copyright (c) 2012, 2014 Ericsson |
cb8c854e FC |
3 | * |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
a3db8436 AM |
13 | package org.eclipse.linuxtools.tmf.core.trace.location; |
14 | ||
032ecd45 | 15 | import java.nio.ByteBuffer; |
cb8c854e | 16 | |
cb8c854e | 17 | /** |
83f4e378 FC |
18 | * A concrete implementation of TmfLocation based on Long:s |
19 | * | |
20 | * @author Francois Chouinard | |
a3db8436 | 21 | * @since 3.0 |
cb8c854e | 22 | */ |
d62bb185 | 23 | public final class TmfLongLocation extends TmfLocation { |
cb8c854e | 24 | |
0126a8ca AM |
25 | /** |
26 | * Constructor | |
27 | * | |
28 | * @param locationInfo | |
29 | * The concrete location | |
30 | */ | |
31 | public TmfLongLocation(long locationInfo) { | |
32 | super(Long.valueOf(locationInfo)); | |
33 | } | |
34 | ||
1e1bef82 | 35 | /** |
83f4e378 FC |
36 | * The normal constructor |
37 | * | |
38 | * @param locationInfo the concrete location | |
1e1bef82 | 39 | */ |
83f4e378 FC |
40 | public TmfLongLocation(final Long locationInfo) { |
41 | super(locationInfo); | |
cb8c854e FC |
42 | } |
43 | ||
1e1bef82 | 44 | /** |
83f4e378 FC |
45 | * The copy constructor |
46 | * | |
1e1bef82 FC |
47 | * @param other the other location |
48 | */ | |
83f4e378 | 49 | public TmfLongLocation(final TmfLongLocation other) { |
5976d44a | 50 | super(other.getLocationInfo()); |
cb8c854e FC |
51 | } |
52 | ||
032ecd45 MAL |
53 | /** |
54 | * Construct the location from the ByteBuffer. | |
55 | * | |
56 | * @param bufferIn | |
57 | * the buffer to read from | |
58 | * | |
59 | * @since 3.0 | |
60 | */ | |
61 | public TmfLongLocation(ByteBuffer bufferIn) { | |
0126a8ca | 62 | this(bufferIn.getLong()); |
032ecd45 MAL |
63 | } |
64 | ||
577ee847 FC |
65 | @Override |
66 | public Long getLocationInfo() { | |
67 | return (Long) super.getLocationInfo(); | |
68 | } | |
69 | ||
032ecd45 MAL |
70 | /** |
71 | * @since 3.0 | |
72 | */ | |
73 | @Override | |
74 | public void serialize(ByteBuffer bufferOut) { | |
75 | bufferOut.putLong(getLocationInfo().longValue()); | |
76 | } | |
77 | ||
cb8c854e | 78 | } |