1 | /**
|
---|
2 | * SPointer.java
|
---|
3 | * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
|
---|
4 | *
|
---|
5 | * This program is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | package org.expeditee.simple;
|
---|
20 |
|
---|
21 | public class SPointer<T> extends SVariable<T> {
|
---|
22 |
|
---|
23 | public static final String framePrefix = SVariable.prefix + "fp"
|
---|
24 | + SVariable.separator;
|
---|
25 |
|
---|
26 | public static final String itemPrefix = SVariable.prefix + "ip"
|
---|
27 | + SVariable.separator;
|
---|
28 |
|
---|
29 | public static final String filePrefix = SVariable.prefix + "f"
|
---|
30 | + SVariable.separator;
|
---|
31 |
|
---|
32 | public static final String associationPrefix = SVariable.prefix + "ap"
|
---|
33 | + SVariable.separator;
|
---|
34 |
|
---|
35 | public SPointer(String name, T value) {
|
---|
36 | super(name, value);
|
---|
37 | }
|
---|
38 |
|
---|
39 | public void setValue(T newValue) {
|
---|
40 | value_ = newValue;
|
---|
41 | }
|
---|
42 |
|
---|
43 | @Override
|
---|
44 | public String stringValue() {
|
---|
45 | return value_.toString();
|
---|
46 | }
|
---|
47 |
|
---|
48 | @Override
|
---|
49 | public void setValue(SVariable<T> v) throws Exception {
|
---|
50 | if (v instanceof SPointer) {
|
---|
51 | setValue(v.getValue());
|
---|
52 | return;
|
---|
53 | }
|
---|
54 | throw new Exception("Can not set pointer variable with primitive");
|
---|
55 | }
|
---|
56 | }
|
---|