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 | ||
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.core.trace.location; |
a3db8436 | 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 | |
cb8c854e | 21 | */ |
d62bb185 | 22 | public final class TmfLongLocation extends TmfLocation { |
cb8c854e | 23 | |
0126a8ca AM |
24 | /** |
25 | * Constructor | |
26 | * | |
27 | * @param locationInfo | |
28 | * The concrete location | |
29 | */ | |
30 | public TmfLongLocation(long locationInfo) { | |
31 | super(Long.valueOf(locationInfo)); | |
32 | } | |
33 | ||
1e1bef82 | 34 | /** |
83f4e378 FC |
35 | * The normal constructor |
36 | * | |
37 | * @param locationInfo the concrete location | |
1e1bef82 | 38 | */ |
83f4e378 FC |
39 | public TmfLongLocation(final Long locationInfo) { |
40 | super(locationInfo); | |
cb8c854e FC |
41 | } |
42 | ||
1e1bef82 | 43 | /** |
83f4e378 FC |
44 | * The copy constructor |
45 | * | |
1e1bef82 FC |
46 | * @param other the other location |
47 | */ | |
83f4e378 | 48 | public TmfLongLocation(final TmfLongLocation other) { |
5976d44a | 49 | super(other.getLocationInfo()); |
cb8c854e FC |
50 | } |
51 | ||
032ecd45 MAL |
52 | /** |
53 | * Construct the location from the ByteBuffer. | |
54 | * | |
55 | * @param bufferIn | |
56 | * the buffer to read from | |
032ecd45 MAL |
57 | */ |
58 | public TmfLongLocation(ByteBuffer bufferIn) { | |
0126a8ca | 59 | this(bufferIn.getLong()); |
032ecd45 MAL |
60 | } |
61 | ||
577ee847 FC |
62 | @Override |
63 | public Long getLocationInfo() { | |
64 | return (Long) super.getLocationInfo(); | |
65 | } | |
66 | ||
032ecd45 MAL |
67 | @Override |
68 | public void serialize(ByteBuffer bufferOut) { | |
69 | bufferOut.putLong(getLocationInfo().longValue()); | |
70 | } | |
71 | ||
cb8c854e | 72 | } |