mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Genericized the VS* suite of classes, reducing redundancy.
Added a <state> element for variables in TV files. Added a Trick 13 to Trick 15 TV file converter. Updated .gitignore files. fixes #21
This commit is contained in:
parent
1dc020a47c
commit
d41e7cb937
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,4 +9,5 @@ lib_Darwin_*
|
|||||||
*.tab.c
|
*.tab.c
|
||||||
*.tab.h
|
*.tab.h
|
||||||
*.swp
|
*.swp
|
||||||
|
*.dox
|
||||||
Makefile_jsc_dirs
|
Makefile_jsc_dirs
|
||||||
|
42
bin/convert_tv_file
Executable file
42
bin/convert_tv_file
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
arguments = sys.argv[1:]
|
||||||
|
if len(arguments) == 0:
|
||||||
|
print 'A utility script for converting TV files from Trick 13 to Trick 15.'
|
||||||
|
print 'usage: convert_tv_file <files>'
|
||||||
|
else:
|
||||||
|
types = (
|
||||||
|
('Boolean', 'boolean'),
|
||||||
|
('Byte', 'byte'),
|
||||||
|
('Double', 'double'),
|
||||||
|
('Enumeration', 'string'),
|
||||||
|
('Float', 'float'),
|
||||||
|
('Integer', 'int'),
|
||||||
|
('Long', 'long'),
|
||||||
|
('Short', 'short'),
|
||||||
|
('String', 'string')
|
||||||
|
)
|
||||||
|
|
||||||
|
for file in arguments:
|
||||||
|
print 'Converting ' + file
|
||||||
|
tree = ET.parse(file)
|
||||||
|
root = tree.getroot()
|
||||||
|
|
||||||
|
for variable in root.findall('variable'):
|
||||||
|
for type in types:
|
||||||
|
value = variable.find('tv' + type[0])
|
||||||
|
if value is not None:
|
||||||
|
value = value.find('value')
|
||||||
|
value.set('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance')
|
||||||
|
value.set('xmlns:xs', 'http://www.w3.org/2001/XMLSchema')
|
||||||
|
value.set('xsi:type', 'xs:' + type[1])
|
||||||
|
break
|
||||||
|
|
||||||
|
if file.endswith('.tv'):
|
||||||
|
file = file[:-3]
|
||||||
|
newFile = file + '_15.tv'
|
||||||
|
tree.write(newFile)
|
||||||
|
print 'Converted to ' + newFile
|
2
docs/.gitignore
vendored
Normal file
2
docs/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
html
|
||||||
|
trick.tag
|
1
doxygen/.gitignore
vendored
Normal file
1
doxygen/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
warning_msgs
|
@ -1,37 +1,18 @@
|
|||||||
package trick.common.utils.vs;
|
package trick.common.utils.vs;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
public class VSBoolean extends VSValue<Boolean> {
|
||||||
|
|
||||||
@XmlRootElement
|
protected VSBoolean() {
|
||||||
public class VSBoolean extends VSValue {
|
this(false);
|
||||||
|
|
||||||
private static final long serialVersionUID = 3720173025885361193L;
|
|
||||||
|
|
||||||
public boolean value;
|
|
||||||
|
|
||||||
public VSBoolean() {}
|
|
||||||
|
|
||||||
public VSBoolean(boolean value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getValue() {
|
public VSBoolean(boolean value) {
|
||||||
return value;
|
super(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromVariableServer(String string) {
|
public void fromVariableServer(String string) {
|
||||||
value = Integer.parseInt(string.trim()) != 0;
|
setValue(Integer.parseInt(string.trim()) != 0);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toVariableServer() {
|
|
||||||
return value ? "1" : "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return Boolean.toString(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,38 +2,19 @@ package trick.common.utils.vs;
|
|||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
public class VSByte extends VSValue<Byte> {
|
||||||
|
|
||||||
@XmlRootElement
|
protected VSByte() {
|
||||||
public class VSByte extends VSValue {
|
this((byte)0);
|
||||||
|
|
||||||
private static final long serialVersionUID = 8405472938103497097L;
|
|
||||||
|
|
||||||
public byte value;
|
|
||||||
|
|
||||||
public VSByte() {}
|
|
||||||
|
|
||||||
public VSByte(byte value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getValue() {
|
public VSByte(byte value) {
|
||||||
return value;
|
super(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromVariableServer(String string) {
|
public void fromVariableServer(String string) {
|
||||||
value = new BigInteger(string.trim(), 10).byteValue();
|
setValue(new BigInteger(string.trim(), 10).byteValue());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toVariableServer() {
|
|
||||||
return Byte.toString(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return Byte.toString(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,23 @@
|
|||||||
package trick.common.utils.vs;
|
package trick.common.utils.vs;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
public class VSDouble extends VSValue<Double> {
|
||||||
|
|
||||||
@XmlRootElement
|
protected VSDouble() {
|
||||||
public class VSDouble extends VSValue {
|
this(0);
|
||||||
|
|
||||||
private static final long serialVersionUID = -2895628958106970334L;
|
|
||||||
|
|
||||||
public double value;
|
|
||||||
|
|
||||||
public VSDouble() {}
|
|
||||||
|
|
||||||
public VSDouble(double value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getValue() {
|
public VSDouble(double value) {
|
||||||
return value;
|
super(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromVariableServer(String string) {
|
public void fromVariableServer(String string) {
|
||||||
value = Double.parseDouble(string.trim());
|
setValue(Double.parseDouble(string.trim()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toVariableServer() {
|
public String toVariableServer() {
|
||||||
return Double.toString(value);
|
return toString();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return Double.toString(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,18 @@
|
|||||||
package trick.common.utils.vs;
|
package trick.common.utils.vs;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
public class VSFloat extends VSValue<Float> {
|
||||||
|
|
||||||
@XmlRootElement
|
protected VSFloat() {
|
||||||
public class VSFloat extends VSValue {
|
this(0);
|
||||||
|
|
||||||
private static final long serialVersionUID = -4629816234119061148L;
|
|
||||||
|
|
||||||
public float value;
|
|
||||||
|
|
||||||
public VSFloat() {}
|
|
||||||
|
|
||||||
public VSFloat(float value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getValue() {
|
public VSFloat(float value) {
|
||||||
return value;
|
super(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromVariableServer(String string) {
|
public void fromVariableServer(String string) {
|
||||||
value = Float.parseFloat(string.trim());
|
setValue(Float.parseFloat(string.trim()));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toVariableServer() {
|
|
||||||
return Float.toString(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return Float.toString(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,38 +2,19 @@ package trick.common.utils.vs;
|
|||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
public class VSInteger extends VSValue<Integer> {
|
||||||
|
|
||||||
@XmlRootElement
|
protected VSInteger() {
|
||||||
public class VSInteger extends VSValue {
|
this(0);
|
||||||
|
|
||||||
private static final long serialVersionUID = 1314788741378939173L;
|
|
||||||
|
|
||||||
public int value;
|
|
||||||
|
|
||||||
public VSInteger() {}
|
|
||||||
|
|
||||||
public VSInteger(int value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public VSInteger(int value) {
|
||||||
return value;
|
super(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromVariableServer(String string) {
|
public void fromVariableServer(String string) {
|
||||||
value = new BigInteger(string.trim(), 10).intValue();
|
setValue(new BigInteger(string.trim(), 10).intValue());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toVariableServer() {
|
|
||||||
return Integer.toString(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return Integer.toString(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,38 +2,19 @@ package trick.common.utils.vs;
|
|||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
public class VSLong extends VSValue<Long> {
|
||||||
|
|
||||||
@XmlRootElement
|
protected VSLong() {
|
||||||
public class VSLong extends VSValue {
|
this(0);
|
||||||
|
|
||||||
private static final long serialVersionUID = -7792501925528852232L;
|
|
||||||
|
|
||||||
public long value;
|
|
||||||
|
|
||||||
public VSLong() {}
|
|
||||||
|
|
||||||
public VSLong(long value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getValue() {
|
public VSLong(long value) {
|
||||||
return value;
|
super(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromVariableServer(String string) {
|
public void fromVariableServer(String string) {
|
||||||
value = new BigInteger(string.trim(), 10).longValue();
|
setValue(new BigInteger(string.trim(), 10).longValue());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toVariableServer() {
|
|
||||||
return Long.toString(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return Long.toString(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,38 +2,19 @@ package trick.common.utils.vs;
|
|||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
public class VSShort extends VSValue<Short> {
|
||||||
|
|
||||||
@XmlRootElement
|
protected VSShort() {
|
||||||
public class VSShort extends VSValue {
|
this((short)0);
|
||||||
|
|
||||||
private static final long serialVersionUID = 5431648313760456676L;
|
|
||||||
|
|
||||||
public short value;
|
|
||||||
|
|
||||||
public VSShort() {}
|
|
||||||
|
|
||||||
public VSShort(short value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getValue() {
|
public VSShort(short value) {
|
||||||
return value;
|
super(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromVariableServer(String string) {
|
public void fromVariableServer(String string) {
|
||||||
value = new BigInteger(string.trim(), 10).shortValue();
|
setValue(new BigInteger(string.trim(), 10).shortValue());
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toVariableServer() {
|
|
||||||
return Short.toString(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return Short.toString(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,21 @@
|
|||||||
package trick.common.utils.vs;
|
package trick.common.utils.vs;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
public class VSString extends VSValue<String> {
|
||||||
|
|
||||||
@XmlRootElement
|
protected VSString() {}
|
||||||
public class VSString extends VSValue {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 2238385297450301960L;
|
|
||||||
|
|
||||||
public String value;
|
|
||||||
|
|
||||||
public VSString() {}
|
|
||||||
|
|
||||||
public VSString(String value) {
|
public VSString(String value) {
|
||||||
this.value = value;
|
super(value);
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fromVariableServer(String string) {
|
public void fromVariableServer(String string) {
|
||||||
value = string;
|
setValue(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toVariableServer() {
|
public String toVariableServer() {
|
||||||
return "\"" + value + "\"";
|
return "\"" + super.toVariableServer() + "\"";
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,37 @@
|
|||||||
package trick.common.utils.vs;
|
package trick.common.utils.vs;
|
||||||
|
|
||||||
public abstract class VSValue implements VariableServerFluent, Cloneable {
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@XmlRootElement
|
||||||
|
public abstract class VSValue<T> implements VariableServerFluent, Cloneable {
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
private T value;
|
||||||
|
|
||||||
|
protected VSValue() {}
|
||||||
|
|
||||||
|
protected VSValue(T value) {
|
||||||
|
setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setValue(T value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toVariableServer() {
|
||||||
|
return toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VSValue clone() {
|
public VSValue clone() {
|
||||||
|
@ -9,7 +9,6 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlElementRef;
|
import javax.xml.bind.annotation.XmlElementRef;
|
||||||
import javax.xml.bind.annotation.XmlElementRefs;
|
|
||||||
|
|
||||||
import trick.common.utils.VariableServerConnection;
|
import trick.common.utils.VariableServerConnection;
|
||||||
|
|
||||||
@ -20,34 +19,22 @@ import trick.common.utils.VariableServerConnection;
|
|||||||
*/
|
*/
|
||||||
public class Variable<T extends VariableServerFluent> implements Serializable, Cloneable {
|
public class Variable<T extends VariableServerFluent> implements Serializable, Cloneable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4529167759720494026L;
|
|
||||||
|
|
||||||
/** possible states */
|
/** possible states */
|
||||||
public enum State {Unknown, Invalid, Valid};
|
public enum State {Unknown, Invalid, Valid};
|
||||||
|
|
||||||
/** name */
|
/** name */
|
||||||
@XmlElement(required = true)
|
|
||||||
public final String name;
|
public final String name;
|
||||||
|
|
||||||
/** value */
|
/** value */
|
||||||
@XmlElementRefs({
|
@XmlElementRef(type=VSValue.class)
|
||||||
@XmlElementRef(type=VSValue.class),
|
|
||||||
@XmlElementRef(type=VSBoolean.class),
|
|
||||||
@XmlElementRef(type=VSByte.class),
|
|
||||||
@XmlElementRef(type=VSDouble.class),
|
|
||||||
@XmlElementRef(type=VSFloat.class),
|
|
||||||
@XmlElementRef(type=VSInteger.class),
|
|
||||||
@XmlElementRef(type=VSLong.class),
|
|
||||||
@XmlElementRef(type=VSShort.class),
|
|
||||||
@XmlElementRef(type=VSString.class)
|
|
||||||
})
|
|
||||||
public final T value;
|
public final T value;
|
||||||
|
|
||||||
/** units */
|
/** units */
|
||||||
String units;
|
private String units;
|
||||||
|
|
||||||
/** state */
|
/** state */
|
||||||
State state = State.Unknown;
|
@XmlElement
|
||||||
|
private State state = State.Unknown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
@ -80,30 +67,6 @@ public class Variable<T extends VariableServerFluent> implements Serializable, C
|
|||||||
value = null;
|
value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* sets this <code>Variable</code>'s value to <code>value</code>
|
|
||||||
*
|
|
||||||
* @param value the value to be set, expressed in Variable Server format
|
|
||||||
*/
|
|
||||||
public void setValue(String value) {
|
|
||||||
if (value.equals("BAD_REF")) {
|
|
||||||
state = State.Invalid;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.value.fromVariableServer(value);
|
|
||||||
state = State.Valid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* sets this <code>Variable</code>'s units to <code>units</code>
|
|
||||||
*
|
|
||||||
* @param units the units to be set
|
|
||||||
*/
|
|
||||||
public void setUnits(String units) {
|
|
||||||
this.units = units;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* commands the Variable Server to set the variable's value to <code>value</code>
|
* commands the Variable Server to set the variable's value to <code>value</code>
|
||||||
*
|
*
|
||||||
@ -145,6 +108,69 @@ public class Variable<T extends VariableServerFluent> implements Serializable, C
|
|||||||
sendUnitsToVariableServer(units, variableServerConnection);
|
sendUnitsToVariableServer(units, variableServerConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets this <code>Variable</code>'s value to <code>value</code>
|
||||||
|
*
|
||||||
|
* @param value the value to be set, expressed in Variable Server format
|
||||||
|
*/
|
||||||
|
public void setValue(String value) {
|
||||||
|
if (value.equals("BAD_REF")) {
|
||||||
|
state = State.Invalid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.value.fromVariableServer(value);
|
||||||
|
state = State.Valid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the value
|
||||||
|
*
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
public T getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets this <code>Variable</code>'s units to <code>units</code>
|
||||||
|
*
|
||||||
|
* @param units the units to be set
|
||||||
|
*/
|
||||||
|
public void setUnits(String units) {
|
||||||
|
this.units = units;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the units
|
||||||
|
*
|
||||||
|
* @return the units
|
||||||
|
*/
|
||||||
|
public String getUnits() {
|
||||||
|
return units;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* provided for JAXB compatibility
|
||||||
|
*/
|
||||||
|
private void setState(State state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the state
|
||||||
|
*
|
||||||
|
* @return the state
|
||||||
|
*/
|
||||||
|
public State getState() {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equality among <code>Variable</code>s requires only that their names
|
* Equality among <code>Variable</code>s requires only that their names
|
||||||
* be equal as implemented by <code>String.equals</code>.
|
* be equal as implemented by <code>String.equals</code>.
|
||||||
@ -169,43 +195,6 @@ public class Variable<T extends VariableServerFluent> implements Serializable, C
|
|||||||
return name.hashCode();
|
return name.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the value
|
|
||||||
*
|
|
||||||
* @return the value
|
|
||||||
*/
|
|
||||||
public T getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the state
|
|
||||||
*
|
|
||||||
* @return the state
|
|
||||||
*/
|
|
||||||
public State getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the name
|
|
||||||
*
|
|
||||||
* @return the name
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* returns the units
|
|
||||||
*
|
|
||||||
* @return the units
|
|
||||||
*/
|
|
||||||
@XmlElement(required = true)
|
|
||||||
public String getUnits() {
|
|
||||||
return units;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Variable<T> clone() {
|
public Variable<T> clone() {
|
||||||
@ -220,9 +209,4 @@ public class Variable<T extends VariableServerFluent> implements Serializable, C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class VariableTracker extends SwingWorker<Void, String[]> {
|
|||||||
*/
|
*/
|
||||||
public void add(Variable variable) throws IOException {
|
public void add(Variable variable) throws IOException {
|
||||||
if (variables.add(variable)) {
|
if (variables.add(variable)) {
|
||||||
variableServerConnection.add(variable.name, variable.units);
|
variableServerConnection.add(variable.name, variable.getUnits());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class VariableTracker extends SwingWorker<Void, String[]> {
|
|||||||
* @param variable the variable to stop tracking
|
* @param variable the variable to stop tracking
|
||||||
*/
|
*/
|
||||||
public void remove(Variable variable) throws IOException {
|
public void remove(Variable variable) throws IOException {
|
||||||
variableServerConnection.remove(variable.getName());
|
variableServerConnection.remove(variable.name);
|
||||||
variables.remove(variable);
|
variables.remove(variable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ public class StripChart extends JXPanel {
|
|||||||
settingsPanel = new JXPanel(new GridBagLayout()) {{
|
settingsPanel = new JXPanel(new GridBagLayout()) {{
|
||||||
|
|
||||||
final ValueAxis domainAxis = plot.getDomainAxis();
|
final ValueAxis domainAxis = plot.getDomainAxis();
|
||||||
domainAxis.setLabel(domainVariable.getName());
|
domainAxis.setLabel(domainVariable.name);
|
||||||
|
|
||||||
final JRadioButton allRadioButton = new JRadioButton(new AbstractAction() {
|
final JRadioButton allRadioButton = new JRadioButton(new AbstractAction() {
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ public class StripChartManager {
|
|||||||
Double.parseDouble(variable.getValue().toVariableServer());
|
Double.parseDouble(variable.getValue().toVariableServer());
|
||||||
}
|
}
|
||||||
catch (NumberFormatException numberFormatException) {
|
catch (NumberFormatException numberFormatException) {
|
||||||
throw new IllegalArgumentException(variable.getName() + " cannot be parsed as a double.\n" +
|
throw new IllegalArgumentException(variable.name + " cannot be parsed as a double.\n" +
|
||||||
numberFormatException, numberFormatException);
|
numberFormatException, numberFormatException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,42 +121,11 @@ import trick.tv.VariableTable.Position;
|
|||||||
*/
|
*/
|
||||||
public class TVApplication extends RunTimeTrickApplication implements VariableListener {
|
public class TVApplication extends RunTimeTrickApplication implements VariableListener {
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
private enum Mode {ALL, STRIP, FIXED};
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
private enum VariableType {FIXED, FLOATING, CHARACTER, STRING, BOOLEAN, ENUMERATION, UNKNOWN};
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
private enum Format {
|
|
||||||
|
|
||||||
DECIMAL("Decimal"),
|
|
||||||
OCTAL("Octal"),
|
|
||||||
HEXIDECIMAL("Hexidecimal"),
|
|
||||||
BOOLEAN("Boolean"),
|
|
||||||
ENUMERATION("Enumeration"),
|
|
||||||
STRING("String"),
|
|
||||||
CHARACTER("Character"),
|
|
||||||
UNKNOWN("Unknown");
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
private Format(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** simulation time tic value */
|
/** simulation time tic value */
|
||||||
double timeTicValue;
|
double timeTicValue;
|
||||||
|
|
||||||
/** simulation time tic count */
|
/** simulation time tic count */
|
||||||
VSLong timeTicCount = new VSLong();
|
VSLong timeTicCount = new VSLong(0);
|
||||||
|
|
||||||
/** simulation time */
|
/** simulation time */
|
||||||
protected Variable<TVDouble> simulationTime =
|
protected Variable<TVDouble> simulationTime =
|
||||||
@ -1262,7 +1231,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
@SuppressWarnings("unchecked") // I know what I'm doing.
|
@SuppressWarnings("unchecked") // I know what I'm doing.
|
||||||
protected void addVariable(Variable<? extends TrickViewFluent> variable, boolean applyDefaults) {
|
protected void addVariable(Variable<? extends TrickViewFluent> variable, boolean applyDefaults) {
|
||||||
// TV relies on time_tics being the first tracked variable, so don't let users manipulate it.
|
// TV relies on time_tics being the first tracked variable, so don't let users manipulate it.
|
||||||
if (!variable.getName().equals("trick_sys.sched.time_tics")) {
|
if (!variable.name.equals("trick_sys.sched.time_tics")) {
|
||||||
try {
|
try {
|
||||||
if (applyDefaults || variable.getValue().getFormat() == null) {
|
if (applyDefaults || variable.getValue().getFormat() == null) {
|
||||||
variable.getValue().setFormat(Enum.valueOf(variable.getValue().getFormatClass(),
|
variable.getValue().setFormat(Enum.valueOf(variable.getValue().getFormatClass(),
|
||||||
@ -1769,83 +1738,12 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
*/
|
*/
|
||||||
protected void openFile(File file, boolean display, boolean set) {
|
protected void openFile(File file, boolean display, boolean set) {
|
||||||
try {
|
try {
|
||||||
openFileAsBinary(file, display, set);
|
restoreState((TVBean)unmarshaller.unmarshal(new StreamSource(file), TVBean.class).getValue(), display, set);
|
||||||
}
|
}
|
||||||
catch (Exception binaryException) {
|
catch (Exception exception) {
|
||||||
try {
|
JOptionPane.showMessageDialog(getMainFrame(), exception,
|
||||||
restoreState((TVBean)unmarshaller.unmarshal(new StreamSource(file), TVBean.class).getValue(), display, set);
|
"Failed to Restore State", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
exception.printStackTrace(System.err);
|
||||||
catch (Exception exception) {
|
|
||||||
JOptionPane.showMessageDialog(getMainFrame(), exception,
|
|
||||||
"Failed to Restore State", JOptionPane.ERROR_MESSAGE);
|
|
||||||
exception.printStackTrace(System.err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gets the value of the first descendent of the specified element with the specified tag name
|
|
||||||
*
|
|
||||||
* @return the value of the first descendent of the specified element with the specified tag name, or null
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
String getElementValue(Element element, String tag) {
|
|
||||||
NodeList nodeList = element.getElementsByTagName(tag);
|
|
||||||
if (nodeList.getLength() > 0) {
|
|
||||||
Node node = nodeList.item(0).getFirstChild();
|
|
||||||
if (node != null) {
|
|
||||||
return node.getNodeValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* attempts to open the file a binary serialization, displaying and setting the variable as specified
|
|
||||||
*
|
|
||||||
* @param file the file to be opened
|
|
||||||
* @param display whether or not to replace the current variable table contents with those in the file
|
|
||||||
* @param set whether or not to send the values in the file to the Variable Server
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked") // readObject returns an Object which must be cast
|
|
||||||
@Deprecated
|
|
||||||
protected void openFileAsBinary(File file, boolean display, boolean set)
|
|
||||||
throws IOException, ClassNotFoundException {
|
|
||||||
ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(file));
|
|
||||||
|
|
||||||
ArrayList<Variable<TrickViewFluent>> variables =
|
|
||||||
(ArrayList<Variable<TrickViewFluent>>)objectInputStream.readObject();
|
|
||||||
|
|
||||||
if (display) {
|
|
||||||
removeAllStripCharts();
|
|
||||||
removeAllVariables();
|
|
||||||
for (Variable<TrickViewFluent> variable : variables) {
|
|
||||||
addVariable(variable);
|
|
||||||
}
|
|
||||||
setCyclePeriod(((Double)objectInputStream.readObject()).doubleValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (set && getConnectionState()) {
|
|
||||||
try {
|
|
||||||
for (Variable variable : variables) {
|
|
||||||
variable.sendValueToVariableServer(variableServerConnection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException ioException) {
|
|
||||||
disconnect(ioException);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (display) {
|
|
||||||
try {
|
|
||||||
for (StripChart stripChart : stripChartManager.loadStripCharts(objectInputStream)) {
|
|
||||||
launchStripChart(stripChart, (Rectangle)objectInputStream.readObject());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IllegalArgumentException illegalArgumentException) {
|
|
||||||
JOptionPane.showMessageDialog(getMainFrame(), illegalArgumentException,
|
|
||||||
"Strip Chart Error", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1883,7 +1781,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
|
|
||||||
Variable domainVariable = simulationTime;
|
Variable domainVariable = simulationTime;
|
||||||
for (Variable variable : tvBean.variables) {
|
for (Variable variable : tvBean.variables) {
|
||||||
if (variable.getName().equals(stripChartBean.domainVariable)) {
|
if (variable.name.equals(stripChartBean.domainVariable)) {
|
||||||
domainVariable = variable;
|
domainVariable = variable;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1892,7 +1790,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
ArrayList<Variable> plottedVariables = new ArrayList<Variable>();
|
ArrayList<Variable> plottedVariables = new ArrayList<Variable>();
|
||||||
for (String plottedVariable : stripChartBean.plottedVariables) {
|
for (String plottedVariable : stripChartBean.plottedVariables) {
|
||||||
for (Variable variable : tvBean.variables) {
|
for (Variable variable : tvBean.variables) {
|
||||||
if (variable.getName().equals(plottedVariable)) {
|
if (variable.name.equals(plottedVariable)) {
|
||||||
plottedVariables.add(variable);
|
plottedVariables.add(variable);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2126,7 +2024,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
|
|
||||||
for (Variable variable : pendingVariables) {
|
for (Variable variable : pendingVariables) {
|
||||||
// If any variables are indexable, launch the dialog.
|
// If any variables are indexable, launch the dialog.
|
||||||
if (pattern.matcher(variable.getName()).find()) {
|
if (pattern.matcher(variable.name).find()) {
|
||||||
northPanel.removeAll();
|
northPanel.removeAll();
|
||||||
for (Variable<TrickViewFluent> var : pendingVariables) {
|
for (Variable<TrickViewFluent> var : pendingVariables) {
|
||||||
northPanel.add(new VariablePanel(var));
|
northPanel.add(new VariablePanel(var));
|
||||||
@ -2186,7 +2084,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
public VariablePanel(Variable<TrickViewFluent> variable) {
|
public VariablePanel(Variable<TrickViewFluent> variable) {
|
||||||
super(new GridBagLayout());
|
super(new GridBagLayout());
|
||||||
this.variable = variable;
|
this.variable = variable;
|
||||||
matcher = pattern.matcher(variable.getName());
|
matcher = pattern.matcher(variable.name);
|
||||||
add(new JXButton(new AbstractAction() {
|
add(new JXButton(new AbstractAction() {
|
||||||
{
|
{
|
||||||
putValue(NAME, "Remove");
|
putValue(NAME, "Remove");
|
||||||
@ -2204,7 +2102,7 @@ public class TVApplication extends RunTimeTrickApplication implements VariableLi
|
|||||||
}));
|
}));
|
||||||
add(Box.createHorizontalStrut(5));
|
add(Box.createHorizontalStrut(5));
|
||||||
|
|
||||||
segments = pattern.split(variable.getName());
|
segments = pattern.split(variable.name);
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
int arraySize = Integer.parseInt(matcher.group());
|
int arraySize = Integer.parseInt(matcher.group());
|
||||||
indices.add(arraySize == 0 ? new IndexTextField() : new DoubleComboBox(arraySize));
|
indices.add(arraySize == 0 ? new IndexTextField() : new DoubleComboBox(arraySize));
|
||||||
|
@ -85,9 +85,9 @@ public class TVBean {
|
|||||||
public StripChartBean() {}
|
public StripChartBean() {}
|
||||||
|
|
||||||
public StripChartBean(StripChart stripChart) {
|
public StripChartBean(StripChart stripChart) {
|
||||||
domainVariable = stripChart.getDomainVariable().getName();
|
domainVariable = stripChart.getDomainVariable().name;
|
||||||
for (Variable variable : stripChart.getPlottedVariables()) {
|
for (Variable variable : stripChart.getPlottedVariables()) {
|
||||||
plottedVariables.add(variable.getName());
|
plottedVariables.add(variable.name);
|
||||||
}
|
}
|
||||||
mode = stripChart.getMode();
|
mode = stripChart.getMode();
|
||||||
fixedAutoRange = stripChart.getFixedAutoRange();
|
fixedAutoRange = stripChart.getFixedAutoRange();
|
||||||
|
@ -23,7 +23,7 @@ public class TVBoolean extends VSBoolean implements TrickViewFluent<TVBoolean.Fo
|
|||||||
|
|
||||||
Boolean {
|
Boolean {
|
||||||
public String format(boolean value) {
|
public String format(boolean value) {
|
||||||
return java.lang.Boolean.toString(value);
|
return value ? "True" : "False";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ public class TVBoolean extends VSBoolean implements TrickViewFluent<TVBoolean.Fo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return format.format(value);
|
return format.format(getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
static class BooleanRenderer extends JCheckBox implements TableCellRenderer {
|
static class BooleanRenderer extends JCheckBox implements TableCellRenderer {
|
||||||
|
@ -118,11 +118,13 @@ public class TVByte extends VSByte implements TrickViewFluent<TVByte.Format> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public boolean unsigned = false;
|
public final boolean unsigned;
|
||||||
|
|
||||||
Format format = Format.Decimal;
|
Format format = Format.Decimal;
|
||||||
|
|
||||||
public TVByte() {}
|
public TVByte() {
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
public TVByte(boolean unsigned) {
|
public TVByte(boolean unsigned) {
|
||||||
this.unsigned = unsigned;
|
this.unsigned = unsigned;
|
||||||
@ -130,6 +132,7 @@ public class TVByte extends VSByte implements TrickViewFluent<TVByte.Format> {
|
|||||||
|
|
||||||
public TVByte(byte value) {
|
public TVByte(byte value) {
|
||||||
super(value);
|
super(value);
|
||||||
|
unsigned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<Format> getFormatClass() {
|
public Class<Format> getFormatClass() {
|
||||||
@ -154,12 +157,12 @@ public class TVByte extends VSByte implements TrickViewFluent<TVByte.Format> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toVariableServer() {
|
public String toVariableServer() {
|
||||||
return Format.Decimal.format(value, unsigned);
|
return Format.Decimal.format(getValue(), unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return format.format(value, unsigned);
|
return format.format(getValue(), unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public class TVDouble extends VSDouble implements TrickViewFluent<TVDouble.Forma
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return format.format(value);
|
return format.format(getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,18 +18,13 @@ import trick.common.utils.vs.VSValue;
|
|||||||
import trick.sie.utils.SieEnumeration;
|
import trick.sie.utils.SieEnumeration;
|
||||||
|
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
public class TVEnumeration extends VSValue implements TrickViewFluent<TVEnumeration.Format> {
|
public class TVEnumeration extends VSValue<String> implements TrickViewFluent<TVEnumeration.Format> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4708597538833537404L;
|
|
||||||
|
|
||||||
@XmlType(name = "")
|
@XmlType(name = "")
|
||||||
public enum Format {
|
public enum Format {
|
||||||
|
|
||||||
Enumeration {
|
Enumeration {
|
||||||
public String format(String value, SieEnumeration enumeration) {
|
public String format(String value, SieEnumeration enumeration) {
|
||||||
if (enumeration == null) {
|
|
||||||
return "<error, reload me>";
|
|
||||||
}
|
|
||||||
for (String key : enumeration.pairs.keySet()) {
|
for (String key : enumeration.pairs.keySet()) {
|
||||||
if (enumeration.pairs.get(key).equals(value)) {
|
if (enumeration.pairs.get(key).equals(value)) {
|
||||||
return key;
|
return key;
|
||||||
@ -43,9 +38,6 @@ public class TVEnumeration extends VSValue implements TrickViewFluent<TVEnumerat
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(required = true)
|
|
||||||
public String value;
|
|
||||||
|
|
||||||
@XmlElement(required = true)
|
@XmlElement(required = true)
|
||||||
@XmlIDREF
|
@XmlIDREF
|
||||||
public final SieEnumeration enumeration;
|
public final SieEnumeration enumeration;
|
||||||
@ -93,15 +85,15 @@ public class TVEnumeration extends VSValue implements TrickViewFluent<TVEnumerat
|
|||||||
|
|
||||||
public TVEnumeration(SieEnumeration enumeration, String value) {
|
public TVEnumeration(SieEnumeration enumeration, String value) {
|
||||||
this.enumeration = enumeration;
|
this.enumeration = enumeration;
|
||||||
this.value = value;
|
setValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fromVariableServer(String string) {
|
public void fromVariableServer(String string) {
|
||||||
value = string;
|
setValue(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toVariableServer() {
|
public String toVariableServer() {
|
||||||
return value;
|
return getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<Format> getFormatClass() {
|
public Class<Format> getFormatClass() {
|
||||||
@ -128,13 +120,9 @@ public class TVEnumeration extends VSValue implements TrickViewFluent<TVEnumerat
|
|||||||
return enumeration;
|
return enumeration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return format.format(value, enumeration);
|
return format.format(getValue(), enumeration);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public class TVFloat extends VSFloat implements TrickViewFluent<TVFloat.Format>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return format.format(value);
|
return format.format(getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -99,11 +99,13 @@ public class TVInteger extends VSInteger implements TrickViewFluent<TVInteger.Fo
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public boolean unsigned = false;
|
public final boolean unsigned;
|
||||||
|
|
||||||
Format format = Format.Decimal;
|
Format format = Format.Decimal;
|
||||||
|
|
||||||
public TVInteger() {}
|
public TVInteger() {
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
public TVInteger(boolean unsigned) {
|
public TVInteger(boolean unsigned) {
|
||||||
this.unsigned = unsigned;
|
this.unsigned = unsigned;
|
||||||
@ -111,6 +113,7 @@ public class TVInteger extends VSInteger implements TrickViewFluent<TVInteger.Fo
|
|||||||
|
|
||||||
public TVInteger(int value) {
|
public TVInteger(int value) {
|
||||||
super(value);
|
super(value);
|
||||||
|
unsigned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<Format> getFormatClass() {
|
public Class<Format> getFormatClass() {
|
||||||
@ -135,12 +138,12 @@ public class TVInteger extends VSInteger implements TrickViewFluent<TVInteger.Fo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toVariableServer() {
|
public String toVariableServer() {
|
||||||
return Format.Decimal.format(value, unsigned);
|
return Format.Decimal.format(getValue(), unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return format.format(value, unsigned);
|
return format.format(getValue(), unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -100,11 +100,13 @@ public class TVLong extends VSLong implements TrickViewFluent<TVLong.Format> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public boolean unsigned = false;
|
public final boolean unsigned;
|
||||||
|
|
||||||
Format format = Format.Decimal;
|
Format format = Format.Decimal;
|
||||||
|
|
||||||
public TVLong() {}
|
public TVLong() {
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
public TVLong(boolean unsigned) {
|
public TVLong(boolean unsigned) {
|
||||||
this.unsigned = unsigned;
|
this.unsigned = unsigned;
|
||||||
@ -112,6 +114,7 @@ public class TVLong extends VSLong implements TrickViewFluent<TVLong.Format> {
|
|||||||
|
|
||||||
public TVLong(long value) {
|
public TVLong(long value) {
|
||||||
super(value);
|
super(value);
|
||||||
|
unsigned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<Format> getFormatClass() {
|
public Class<Format> getFormatClass() {
|
||||||
@ -136,12 +139,12 @@ public class TVLong extends VSLong implements TrickViewFluent<TVLong.Format> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toVariableServer() {
|
public String toVariableServer() {
|
||||||
return Format.Decimal.format(value, unsigned);
|
return Format.Decimal.format(getValue(), unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return format.format(value, unsigned);
|
return format.format(getValue(), unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -99,11 +99,13 @@ public class TVShort extends VSShort implements TrickViewFluent<TVShort.Format>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public boolean unsigned = false;
|
public final boolean unsigned;
|
||||||
|
|
||||||
Format format = Format.Decimal;
|
Format format = Format.Decimal;
|
||||||
|
|
||||||
public TVShort() {}
|
public TVShort() {
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
public TVShort(boolean unsigned) {
|
public TVShort(boolean unsigned) {
|
||||||
this.unsigned = unsigned;
|
this.unsigned = unsigned;
|
||||||
@ -111,6 +113,7 @@ public class TVShort extends VSShort implements TrickViewFluent<TVShort.Format>
|
|||||||
|
|
||||||
public TVShort(short value) {
|
public TVShort(short value) {
|
||||||
super(value);
|
super(value);
|
||||||
|
unsigned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class<Format> getFormatClass() {
|
public Class<Format> getFormatClass() {
|
||||||
@ -135,12 +138,12 @@ public class TVShort extends VSShort implements TrickViewFluent<TVShort.Format>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toVariableServer() {
|
public String toVariableServer() {
|
||||||
return Format.Decimal.format(value, unsigned);
|
return Format.Decimal.format(getValue(), unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return format.format(value, unsigned);
|
return format.format(getValue(), unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class TVString extends VSString implements TrickViewFluent<TVString.Forma
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return format.format(value);
|
return format.format(getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ public class VariableTable extends JXTable {
|
|||||||
Variable<? extends TrickViewFluent> variable = variables.get(rowIndex);
|
Variable<? extends TrickViewFluent> variable = variables.get(rowIndex);
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return variable.getName();
|
return variable.name;
|
||||||
case 1:
|
case 1:
|
||||||
switch (variable.getState()) {
|
switch (variable.getState()) {
|
||||||
case Invalid:
|
case Invalid:
|
||||||
|
@ -1,177 +1,134 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||||
|
|
||||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
<xs:element name="vsValue" type="vsValue"/>
|
||||||
targetNamespace="trick.tv"
|
|
||||||
xmlns="trick.tv"
|
|
||||||
elementFormDefault="qualified">
|
|
||||||
|
|
||||||
<xs:complexType name="bounds">
|
<xs:complexType name="title">
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
|
<xs:element name="text" type="xs:string"/>
|
||||||
|
<xs:element name="font" type="font"/>
|
||||||
|
<xs:element name="rgb" type="xs:int"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
<xs:element name="lower">
|
<xs:complexType name="font">
|
||||||
<xs:simpleType>
|
<xs:sequence>
|
||||||
<xs:restriction base="xs:decimal" />
|
<xs:element name="name" type="xs:string"/>
|
||||||
</xs:simpleType>
|
<xs:element name="style" type="xs:int"/>
|
||||||
</xs:element>
|
<xs:element name="size" type="xs:int"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
<xs:element name="upper">
|
<xs:complexType name="range">
|
||||||
<xs:simpleType>
|
<xs:sequence>
|
||||||
<xs:restriction base="xs:decimal" />
|
<xs:element name="lower" type="xs:double"/>
|
||||||
</xs:simpleType>
|
<xs:element name="upper" type="xs:double"/>
|
||||||
</xs:element>
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
</xs:sequence>
|
<xs:complexType name="axis">
|
||||||
</xs:complexType>
|
<xs:sequence>
|
||||||
|
<xs:element name="label" type="xs:string"/>
|
||||||
|
<xs:element name="font" type="font"/>
|
||||||
|
<xs:element name="rgb" type="xs:int"/>
|
||||||
|
<xs:element name="areTickMarksVisible" type="xs:boolean"/>
|
||||||
|
<xs:element name="areTickLabelsVisible" type="xs:boolean"/>
|
||||||
|
<xs:element name="tickLabelFont" type="font"/>
|
||||||
|
<xs:element name="tickLabelRgb" type="xs:int"/>
|
||||||
|
<xs:element name="range" type="range"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
<!-- The root element, representing an instance of Trick View. -->
|
<xs:complexType name="bounds">
|
||||||
<xs:element name="trickview">
|
<xs:sequence>
|
||||||
|
<xs:element name="x" type="xs:int"/>
|
||||||
|
<xs:element name="y" type="xs:int"/>
|
||||||
|
<xs:element name="width" type="xs:int"/>
|
||||||
|
<xs:element name="height" type="xs:int"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="stripChart">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="domainVariable" type="xs:string"/>
|
||||||
|
<xs:element name="plottedVariable" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
|
||||||
|
<xs:element name="mode" type="mode"/>
|
||||||
|
<xs:element name="fixedAutoRange" type="xs:double"/>
|
||||||
|
<xs:element name="areLinesVisible" type="xs:boolean"/>
|
||||||
|
<xs:element name="arePointsVisible" type="xs:boolean"/>
|
||||||
|
<xs:element name="isLegendVisible" type="xs:boolean"/>
|
||||||
|
<xs:element name="areSettingsVisible" type="xs:boolean"/>
|
||||||
|
<xs:element name="isAntiAliased" type="xs:boolean"/>
|
||||||
|
<xs:element name="isBackgroundSet" type="xs:boolean"/>
|
||||||
|
<xs:element name="backgroundRgb" type="xs:int"/>
|
||||||
|
<xs:element name="title" type="title" minOccurs="0"/>
|
||||||
|
<xs:element name="isHorizontal" type="xs:boolean"/>
|
||||||
|
<xs:element name="outlineRgb" type="xs:int"/>
|
||||||
|
<xs:element name="plotBackgroundRgb" type="xs:int"/>
|
||||||
|
<xs:element name="domainAxis" type="axis"/>
|
||||||
|
<xs:element name="rangeAxis" type="axis"/>
|
||||||
|
<xs:element name="bounds" type="bounds"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="tvBean">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="cyclePeriod" type="xs:double"/>
|
||||||
|
<xs:element name="variable" type="variable" minOccurs="0" maxOccurs="unbounded"/>
|
||||||
|
<xs:element name="stripChart" type="stripChart" minOccurs="0" maxOccurs="unbounded"/>
|
||||||
|
<xs:element name="enumeration" type="enumeration" minOccurs="0" maxOccurs="unbounded"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="variable">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="name" type="xs:string" minOccurs="0"/>
|
||||||
|
<xs:element ref="vsValue"/>
|
||||||
|
<xs:element name="state" type="state" minOccurs="0"/>
|
||||||
|
<xs:element name="units" type="xs:string" minOccurs="0"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="vsValue" abstract="true">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="value" type="xs:anyType" minOccurs="0"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="enumeration">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="name" type="xs:ID"/>
|
||||||
|
<xs:element name="pairs">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
|
<xs:element name="entry" minOccurs="0" maxOccurs="unbounded">
|
||||||
<!-- Determines if variables are automatically set when loaded. -->
|
<xs:complexType>
|
||||||
<xs:element name="set" type="xs:boolean" minOccurs="0"/>
|
<xs:sequence>
|
||||||
|
<xs:element name="key" minOccurs="0" type="xs:string"/>
|
||||||
<!-- Period at which variables are updated. -->
|
<xs:element name="value" minOccurs="0" type="xs:string"/>
|
||||||
<xs:element name="cycle" minOccurs="0">
|
</xs:sequence>
|
||||||
<xs:simpleType>
|
</xs:complexType>
|
||||||
<xs:restriction base="xs:decimal">
|
</xs:element>
|
||||||
<xs:minInclusive value="0"/>
|
</xs:sequence>
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<!-- Represents a single variable in the Variable Table. -->
|
|
||||||
<xs:element name="variable" minOccurs="0" maxOccurs="unbounded">
|
|
||||||
<xs:complexType>
|
|
||||||
<xs:sequence>
|
|
||||||
|
|
||||||
<xs:element name="name" type="xs:string"/>
|
|
||||||
|
|
||||||
<xs:element name="value" type="xs:string"/>
|
|
||||||
|
|
||||||
<xs:element name="units" type="xs:string"/>
|
|
||||||
|
|
||||||
<xs:element name="format">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:string">
|
|
||||||
<xs:enumeration value="Decimal"/>
|
|
||||||
<xs:enumeration value="Octal"/>
|
|
||||||
<xs:enumeration value="Hexidecimal"/>
|
|
||||||
<xs:enumeration value="Boolean"/>
|
|
||||||
<xs:enumeration value="Enumeration"/>
|
|
||||||
<xs:enumeration value="String"/>
|
|
||||||
<xs:enumeration value="Character"/>
|
|
||||||
<xs:enumeration value="Unknown"/>
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<xs:element name="type">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:string">
|
|
||||||
<xs:enumeration value="FIXED"/>
|
|
||||||
<xs:enumeration value="FLOATING"/>
|
|
||||||
<xs:enumeration value="CHARACTER"/>
|
|
||||||
<xs:enumeration value="STRING"/>
|
|
||||||
<xs:enumeration value="BOOLEAN"/>
|
|
||||||
<xs:enumeration value="ENUMERATION"/>
|
|
||||||
<xs:enumeration value="UNKNOWN"/>
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<xs:element name="enumeration" type="xs:string" minOccurs="0"/>
|
|
||||||
|
|
||||||
</xs:sequence>
|
|
||||||
</xs:complexType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<!-- Represents a Stripchart's state. -->
|
|
||||||
<xs:element name="stripchart" minOccurs="0" maxOccurs="unbounded">
|
|
||||||
<xs:complexType>
|
|
||||||
<xs:sequence>
|
|
||||||
|
|
||||||
<xs:element name="title" type="xs:string"/>
|
|
||||||
|
|
||||||
<xs:element name="dependentVariable" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
|
|
||||||
|
|
||||||
<xs:element name="domainVariable" type="xs:string"/>
|
|
||||||
|
|
||||||
<xs:element name="mode">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:string">
|
|
||||||
<xs:enumeration value="ALL"/>
|
|
||||||
<xs:enumeration value="STRIP"/>
|
|
||||||
<xs:enumeration value="FIXED"/>
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<xs:element name="axes" minOccurs="0">
|
|
||||||
<xs:complexType>
|
|
||||||
<xs:sequence>
|
|
||||||
<xs:element name="domain" type="bounds"/>
|
|
||||||
<xs:element name="range" type="bounds"/>
|
|
||||||
</xs:sequence>
|
|
||||||
</xs:complexType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<xs:element name="scrollWidth">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:decimal">
|
|
||||||
<xs:minInclusive value="0"/>
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<xs:element name="lines" type="xs:boolean"/>
|
|
||||||
|
|
||||||
<xs:element name="points" type="xs:boolean"/>
|
|
||||||
|
|
||||||
<xs:element name="legend" type="xs:boolean"/>
|
|
||||||
|
|
||||||
<xs:element name="bounds" minOccurs="0">
|
|
||||||
<xs:complexType>
|
|
||||||
<xs:sequence>
|
|
||||||
|
|
||||||
<xs:element name="x">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:decimal" />
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<xs:element name="y">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:decimal" />
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<xs:element name="width">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:decimal">
|
|
||||||
<xs:minInclusive value="0"/>
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
<xs:element name="height">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:decimal">
|
|
||||||
<xs:minInclusive value="0"/>
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
</xs:sequence>
|
|
||||||
</xs:complexType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
</xs:sequence>
|
|
||||||
</xs:complexType>
|
|
||||||
</xs:element>
|
|
||||||
|
|
||||||
</xs:sequence>
|
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:simpleType name="mode">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="All"/>
|
||||||
|
<xs:enumeration value="Strip"/>
|
||||||
|
<xs:enumeration value="Fixed"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
|
|
||||||
|
<xs:simpleType name="state">
|
||||||
|
<xs:restriction base="xs:string">
|
||||||
|
<xs:enumeration value="Unknown"/>
|
||||||
|
<xs:enumeration value="Invalid"/>
|
||||||
|
<xs:enumeration value="Valid"/>
|
||||||
|
</xs:restriction>
|
||||||
|
</xs:simpleType>
|
||||||
</xs:schema>
|
</xs:schema>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user