Last change
on this file since 4 was 4, checked in by davidb, 16 years ago |
Starting source code to Expeditee
|
File size:
1.2 KB
|
Line | |
---|
1 | package org.expeditee.simple;
|
---|
2 |
|
---|
3 | public abstract class SPrimitive<T> extends SVariable<T> {
|
---|
4 |
|
---|
5 | public SPrimitive(String name, T value) {
|
---|
6 | super(name, value);
|
---|
7 | }
|
---|
8 |
|
---|
9 | public SPrimitive(T value) {
|
---|
10 | super(null, value);
|
---|
11 | }
|
---|
12 |
|
---|
13 | public SPrimitive() {
|
---|
14 | super();
|
---|
15 | }
|
---|
16 |
|
---|
17 | public Long integerValue() throws Exception {
|
---|
18 | throw new Exception("Can not convert " + this.getClass().getName()
|
---|
19 | + " to Integer");
|
---|
20 | }
|
---|
21 |
|
---|
22 | public Boolean booleanValue() throws Exception {
|
---|
23 | throw new Exception("Can not convert " + this.getClass().getName()
|
---|
24 | + " to Boolean");
|
---|
25 | }
|
---|
26 |
|
---|
27 | public Double doubleValue() throws Exception {
|
---|
28 | throw new Exception("Can not convert " + this.getClass().getName()
|
---|
29 | + " to Real");
|
---|
30 | }
|
---|
31 |
|
---|
32 | public Character characterValue() throws Exception {
|
---|
33 | throw new Exception("Can not convert " + this.getClass().getName()
|
---|
34 | + " to Character");
|
---|
35 | }
|
---|
36 |
|
---|
37 | public abstract void setValue(SPrimitive v) throws Exception;
|
---|
38 |
|
---|
39 | @Override
|
---|
40 | public void setValue(SVariable<T> v) throws Exception {
|
---|
41 | if (v instanceof SPrimitive) {
|
---|
42 | setValue((SPrimitive<?>) v);
|
---|
43 | return;
|
---|
44 | }
|
---|
45 | throw new Exception("Can not set primitive variable with pointer");
|
---|
46 | }
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Sets the value of the primitive using a string.
|
---|
50 | *
|
---|
51 | * @param s
|
---|
52 | * @throws Exception
|
---|
53 | */
|
---|
54 | public abstract void parse(String s) throws Exception;
|
---|
55 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.