|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * Adapter for location interface |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracebuilder.utils; |
|
20 |
|
21 import com.nokia.tracebuilder.source.SourceLocationInterface; |
|
22 |
|
23 /** |
|
24 * Location interface implementation |
|
25 * |
|
26 */ |
|
27 class SimpleLocation implements SourceLocationInterface { |
|
28 |
|
29 /** |
|
30 * Location offset |
|
31 */ |
|
32 private int offset; |
|
33 |
|
34 /** |
|
35 * Location length |
|
36 */ |
|
37 private int length; |
|
38 |
|
39 /** |
|
40 * Deleted flag |
|
41 */ |
|
42 private boolean deleted; |
|
43 |
|
44 /** |
|
45 * Constructor |
|
46 * |
|
47 * @param offset |
|
48 * location offset |
|
49 * @param length |
|
50 * location length |
|
51 */ |
|
52 SimpleLocation(int offset, int length) { |
|
53 this.offset = offset; |
|
54 this.length = length; |
|
55 } |
|
56 |
|
57 /* |
|
58 * (non-Javadoc) |
|
59 * |
|
60 * @see com.nokia.tracebuilder.source.SourceLocationInterface#delete() |
|
61 */ |
|
62 public void delete() { |
|
63 deleted = true; |
|
64 } |
|
65 |
|
66 /* |
|
67 * (non-Javadoc) |
|
68 * |
|
69 * @see com.nokia.tracebuilder.source.SourceLocationInterface#getLength() |
|
70 */ |
|
71 public int getLength() { |
|
72 return length; |
|
73 } |
|
74 |
|
75 /* |
|
76 * (non-Javadoc) |
|
77 * |
|
78 * @see com.nokia.tracebuilder.source.SourceLocationInterface#getOffset() |
|
79 */ |
|
80 public int getOffset() { |
|
81 return offset; |
|
82 } |
|
83 |
|
84 /* |
|
85 * (non-Javadoc) |
|
86 * |
|
87 * @see com.nokia.tracebuilder.source.SourceLocationInterface#isDeleted() |
|
88 */ |
|
89 public boolean isDeleted() { |
|
90 return deleted; |
|
91 } |
|
92 |
|
93 /* |
|
94 * (non-Javadoc) |
|
95 * |
|
96 * @see com.nokia.tracebuilder.source.SourceLocationInterface#setLength(int) |
|
97 */ |
|
98 public void setLength(int length) { |
|
99 this.length = length; |
|
100 } |
|
101 |
|
102 /* |
|
103 * (non-Javadoc) |
|
104 * |
|
105 * @see com.nokia.tracebuilder.source.SourceLocationInterface#setOffset(int) |
|
106 */ |
|
107 public void setOffset(int offset) { |
|
108 this.offset = offset; |
|
109 } |
|
110 |
|
111 } |