-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathPointer.java
More file actions
51 lines (45 loc) · 966 Bytes
/
Pointer.java
File metadata and controls
51 lines (45 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package uk.ac.bristol.star.cdf.record;
/**
* Keeps track of a file offset.
*
* @author Mark Taylor
* @since 18 Jun 2013
*/
public class Pointer {
private long value_;
/**
* Constructor.
*
* @param value initial value
*/
public Pointer( long value ) {
value_ = value;
}
/**
* Returns this pointer's current value.
*
* @return value
*/
public long get() {
return value_;
}
/**
* Returns this pointer's current value and increments it by a given step.
*
* @param increment amount to increase value by
* @return pre-increment value
*/
public long getAndIncrement( int increment ) {
long v = value_;
value_ += increment;
return v;
}
/**
* Sets this pointer's current value.
*
* @param value new value
*/
public void set( long value ) {
value_ = value;
}
}