Remove networktables2.type Java custom container types. (#214)

This commit is contained in:
Peter Johnson
2017-08-04 20:24:36 -05:00
committed by GitHub
parent d910b0b2a2
commit 4b8ef57a99
5 changed files with 0 additions and 108 deletions

View File

@@ -1,7 +1,6 @@
package edu.wpi.first.wpilibj.networktables;
import edu.wpi.first.wpilibj.tables.*;
import edu.wpi.first.wpilibj.networktables2.type.*;
import java.io.*;
import java.nio.ByteBuffer;
import java.util.*;
@@ -797,12 +796,6 @@ public class NetworkTable implements ITable, IRemote {
return NetworkTablesJNI.putDoubleArray(pathWithSep + key, toNative((Number[])value));
else if (value instanceof String[])
return NetworkTablesJNI.putStringArray(pathWithSep + key, (String[])value);
else if (value instanceof BooleanArray)
return NetworkTablesJNI.putBooleanArray(pathWithSep + key, toNative((Boolean[])((ArrayData)value).getDataArray()));
else if (value instanceof NumberArray)
return NetworkTablesJNI.putDoubleArray(pathWithSep + key, toNative((Double[])((ArrayData)value).getDataArray()));
else if (value instanceof StringArray)
return NetworkTablesJNI.putStringArray(pathWithSep + key, (String[])((ArrayData)value).getDataArray());
else
throw new IllegalArgumentException("Value of type " + value.getClass().getName() + " cannot be put into a table");
}

View File

@@ -1,50 +0,0 @@
package edu.wpi.first.wpilibj.networktables2.type;
/**
* @deprecated Use ArrayList instead.
*/
@Deprecated
public class ArrayData {
private Object[] data = new Object[0];
protected Object getAsObject(int index) {
return data[index];
}
protected void _set(int index, Object value) {
data[index] = value;
}
protected void _add(Object value) {
setSize(size() + 1);
data[size() - 1] = value;
}
public void remove(int index) {
if (index < 0 || index >= size())
throw new IndexOutOfBoundsException();
if (index < size() - 1)
System.arraycopy(data, index + 1, data, index, size() - index - 1);
setSize(size() - 1);
}
public void setSize(int size) {
if (size == data.length)
return;
Object[] newArray = new Object[size];
if (size < data.length)
System.arraycopy(data, 0, newArray, 0, size);
else {
System.arraycopy(data, 0, newArray, 0, data.length);
for (int i = data.length; i < newArray.length; ++i)
newArray[i] = null;
}
data = newArray;
}
public int size() {
return data.length;
}
public Object[] getDataArray() {
return data;
}
public void setDataArray(Object[] value) {
data = value;
}
}

View File

@@ -1,17 +0,0 @@
package edu.wpi.first.wpilibj.networktables2.type;
/**
* @deprecated Use {@literal ArrayList<Boolean>} instead.
*/
@Deprecated
public class BooleanArray extends ArrayData {
public boolean get(int index) {
return ((Boolean)getAsObject(index)).booleanValue();
}
public void set(int index, boolean value) {
_set(index, value?Boolean.TRUE:Boolean.FALSE);
}
public void add(boolean value) {
_add(value?Boolean.TRUE:Boolean.FALSE);
}
}

View File

@@ -1,17 +0,0 @@
package edu.wpi.first.wpilibj.networktables2.type;
/**
* @deprecated Use {@literal ArrayList<Double>} instead.
*/
@Deprecated
public class NumberArray extends ArrayData {
public double get(int index) {
return ((Double)getAsObject(index)).doubleValue();
}
public void set(int index, double value) {
_set(index, new Double(value));
}
public void add(double value) {
_add(new Double(value));
}
}

View File

@@ -1,17 +0,0 @@
package edu.wpi.first.wpilibj.networktables2.type;
/**
* @deprecated Use {@literal ArrayList<String>} instead.
*/
@Deprecated
public class StringArray extends ArrayData {
public String get(int index) {
return ((String)getAsObject(index));
}
public void set(int index, String value) {
_set(index, value);
}
public void add(String value) {
_add(value);
}
}