From 68b63632c44928f9619c2df978d579ca26eab59e Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sat, 1 Jul 2017 01:05:33 -0400 Subject: [PATCH] Removed functions that have been deprecated for at least one year (#551) --- wpilibc/athena/include/Counter.h | 3 +- wpilibc/athena/include/Encoder.h | 4 +- wpilibc/athena/include/Preferences.h | 3 - wpilibc/athena/include/SerialPort.h | 5 - wpilibc/athena/src/Counter.cpp | 16 -- wpilibc/athena/src/Encoder.cpp | 25 +-- wpilibc/athena/src/Preferences.cpp | 8 - wpilibc/athena/src/SerialPort.cpp | 18 +- .../src/PreferencesTest.cpp | 1 - .../edu/wpi/first/wpilibj/CameraServer.java | 34 --- .../java/edu/wpi/first/wpilibj/Counter.java | 9 +- .../edu/wpi/first/wpilibj/DigitalOutput.java | 29 --- .../java/edu/wpi/first/wpilibj/Encoder.java | 19 +- .../java/edu/wpi/first/wpilibj/PWM.java | 19 -- .../edu/wpi/first/wpilibj/Preferences.java | 10 - .../edu/wpi/first/wpilibj/PIDController.java | 22 -- .../smartdashboard/SmartDashboard.java | 202 ------------------ .../java/edu/wpi/first/wpilibj/PIDTest.java | 6 +- .../wpi/first/wpilibj/PreferencesTest.java | 1 - .../smartdashboard/SmartDashboardTest.java | 15 +- 20 files changed, 35 insertions(+), 414 deletions(-) diff --git a/wpilibc/athena/include/Counter.h b/wpilibc/athena/include/Counter.h index 643f2b2f93..11da68a483 100644 --- a/wpilibc/athena/include/Counter.h +++ b/wpilibc/athena/include/Counter.h @@ -23,6 +23,7 @@ class DigitalGlitchFilter; /** * Class for counting the number of ticks on a digital input channel. + * * This is a general purpose class for counting repetitive events. It can return * the number of counts, the period of the most recent cycle, and detect when * the signal being counted has stopped by supplying a maximum cycle time. @@ -44,8 +45,6 @@ class Counter : public SensorBase, explicit Counter(int channel); explicit Counter(DigitalSource* source); explicit Counter(std::shared_ptr source); - WPI_DEPRECATED("Use pass-by-reference instead.") - explicit Counter(AnalogTrigger* trigger); explicit Counter(const AnalogTrigger& trigger); Counter(EncodingType encodingType, DigitalSource* upSource, DigitalSource* downSource, bool inverted); diff --git a/wpilibc/athena/include/Encoder.h b/wpilibc/athena/include/Encoder.h index f4297034d5..6964e6dcc5 100644 --- a/wpilibc/athena/include/Encoder.h +++ b/wpilibc/athena/include/Encoder.h @@ -24,6 +24,7 @@ class DigitalGlitchFilter; /** * Class to read quad encoders. + * * Quadrature encoders are devices that count shaft rotation and can sense * direction. The output of the QuadEncoder class is an integer that can count * either up or down, and can go negative for reverse direction counting. When @@ -79,9 +80,6 @@ class Encoder : public SensorBase, double PIDGet() override; void SetIndexSource(int channel, IndexingType type = kResetOnRisingEdge); - WPI_DEPRECATED("Use pass-by-reference instead.") - void SetIndexSource(DigitalSource* source, - IndexingType type = kResetOnRisingEdge); void SetIndexSource(const DigitalSource& source, IndexingType type = kResetOnRisingEdge); diff --git a/wpilibc/athena/include/Preferences.h b/wpilibc/athena/include/Preferences.h index 3b1a3ca8ba..4fdc0b4225 100644 --- a/wpilibc/athena/include/Preferences.h +++ b/wpilibc/athena/include/Preferences.h @@ -50,9 +50,6 @@ class Preferences : public ErrorBase { void PutFloat(llvm::StringRef key, float value); void PutBoolean(llvm::StringRef key, bool value); void PutLong(llvm::StringRef key, int64_t value); - WPI_DEPRECATED( - "Saving is now automatically performed by the NetworkTables server.") - void Save(); bool ContainsKey(llvm::StringRef key); void Remove(llvm::StringRef key); diff --git a/wpilibc/athena/include/SerialPort.h b/wpilibc/athena/include/SerialPort.h index 7590b4f1a6..3f47e0da0b 100644 --- a/wpilibc/athena/include/SerialPort.h +++ b/wpilibc/athena/include/SerialPort.h @@ -11,7 +11,6 @@ #include "ErrorBase.h" #include "llvm/StringRef.h" -#include "support/deprecated.h" namespace frc { @@ -62,10 +61,6 @@ class SerialPort : public ErrorBase { void DisableTermination(); int GetBytesReceived(); int Read(char* buffer, int count); - WPI_DEPRECATED( - "Potential for unexpected behavior. Please use StringRef overload for " - "custom length buffers using std::string") - int Write(const std::string& buffer, int count); int Write(const char* buffer, int count); int Write(llvm::StringRef buffer); void SetTimeout(double timeout); diff --git a/wpilibc/athena/src/Counter.cpp b/wpilibc/athena/src/Counter.cpp index ca134525ca..030145eddd 100644 --- a/wpilibc/athena/src/Counter.cpp +++ b/wpilibc/athena/src/Counter.cpp @@ -87,22 +87,6 @@ Counter::Counter(int channel) : Counter(kTwoPulse) { ClearDownSource(); } -/** - * Create an instance of a Counter object. - * - * Create an instance of a simple up-Counter given an analog trigger. - * Use the trigger state output from the analog trigger. - * - * The counter will start counting immediately. - * - * @param trigger The pointer to the existing AnalogTrigger object. - */ -WPI_DEPRECATED("Use pass-by-reference instead.") -Counter::Counter(AnalogTrigger* trigger) : Counter(kTwoPulse) { - SetUpSource(trigger->CreateOutput(AnalogTriggerType::kState)); - ClearDownSource(); -} - /** * Create an instance of a Counter object. * diff --git a/wpilibc/athena/src/Encoder.cpp b/wpilibc/athena/src/Encoder.cpp index 7fad9ebb29..f48fec7584 100644 --- a/wpilibc/athena/src/Encoder.cpp +++ b/wpilibc/athena/src/Encoder.cpp @@ -222,12 +222,11 @@ void Encoder::Reset() { /** * Returns the period of the most recent pulse. * - * Returns the period of the most recent Encoder pulse in seconds. - * This method compensates for the decoding type. + * Returns the period of the most recent Encoder pulse in seconds. This method + * compensates for the decoding type. * - * @deprecated Use GetRate() in favor of this method. This returns unscaled - * periods and GetRate() scales using value from - * SetDistancePerPulse(). + * Warning: This returns unscaled periods. Use GetRate() for rates that are + * scaled using the value from SetDistancePerPulse(). * * @return Period in seconds of the most recent pulse. */ @@ -451,21 +450,7 @@ double Encoder::PIDGet() { void Encoder::SetIndexSource(int channel, Encoder::IndexingType type) { // Force digital input if just given an index m_indexSource = std::make_unique(channel); - SetIndexSource(m_indexSource.get(), type); -} - -/** - * Set the index source for the encoder. - * - * When this source is activated, the encoder count automatically resets. - * - * @param channel A digital source to set as the encoder index - * @param type The state that will cause the encoder to reset - */ -WPI_DEPRECATED("Use pass-by-reference instead.") -void Encoder::SetIndexSource(DigitalSource* source, - Encoder::IndexingType type) { - SetIndexSource(*source, type); + SetIndexSource(*m_indexSource.get(), type); } /** diff --git a/wpilibc/athena/src/Preferences.cpp b/wpilibc/athena/src/Preferences.cpp index a913ba0eb4..05a26a66ad 100644 --- a/wpilibc/athena/src/Preferences.cpp +++ b/wpilibc/athena/src/Preferences.cpp @@ -201,14 +201,6 @@ void Preferences::PutLong(llvm::StringRef key, int64_t value) { m_table->SetPersistent(key); } -/** - * This function is no longer required, as NetworkTables automatically - * saves persistent values (which all Preferences values are) periodically - * when running as a server. - * @deprecated backwards compatibility shim - */ -void Preferences::Save() {} - /** * Returns whether or not there is a key with the given name. * diff --git a/wpilibc/athena/src/SerialPort.cpp b/wpilibc/athena/src/SerialPort.cpp index 56435a9bc1..b92a500fc3 100644 --- a/wpilibc/athena/src/SerialPort.cpp +++ b/wpilibc/athena/src/SerialPort.cpp @@ -135,21 +135,6 @@ int SerialPort::Read(char* buffer, int count) { return retVal; } -/** - * Write raw bytes to the buffer. Deprecated, please use StringRef overload. Use - * Write({data, len}) to get a buffer that is shorter then the length of the - * std::string. - * - * @param buffer Pointer to the buffer to read the bytes from. If string.size() - * is less then count, only the length of string.size() will be sent. - * @param count The maximum number of bytes to write. - * @return The number of bytes actually written into the port. - */ -int SerialPort::Write(const std::string& buffer, int count) { - return Write(llvm::StringRef( - buffer.data(), std::min(static_cast(buffer.size()), count))); -} - /** * Write raw bytes to the buffer. * @@ -164,6 +149,9 @@ int SerialPort::Write(const char* buffer, int count) { /** * Write raw bytes to the buffer. * + * Use Write({data, len}) to get a buffer that is shorter than the length of the + * string. + * * @param buffer StringRef to the buffer to read the bytes from. * @return The number of bytes actually written into the port. */ diff --git a/wpilibcIntegrationTests/src/PreferencesTest.cpp b/wpilibcIntegrationTests/src/PreferencesTest.cpp index 60262fbd06..42d961b55c 100644 --- a/wpilibcIntegrationTests/src/PreferencesTest.cpp +++ b/wpilibcIntegrationTests/src/PreferencesTest.cpp @@ -76,7 +76,6 @@ TEST(PreferencesTest, WritePreferencesToFile) { preferences->PutFloat("testFilePutFloat", 0.25f); preferences->PutBoolean("testFilePutBoolean", true); preferences->PutLong("testFilePutLong", 1000000000000000000ll); - preferences->Save(); Wait(kSaveTime); diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CameraServer.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CameraServer.java index e3451e638d..057308ff01 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CameraServer.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/CameraServer.java @@ -799,38 +799,4 @@ public class CameraServer { m_sources.remove(name); } } - - /** - * Sets the size of the image to use. Use the public kSize constants to set the correct mode, or - * set it directly on a camera and call the appropriate startAutomaticCapture method. - * - * @deprecated Use setResolution on the UsbCamera returned by startAutomaticCapture() instead. - * @param size The size to use - */ - @Deprecated - public void setSize(int size) { - VideoSource source = null; - synchronized (this) { - if (m_primarySourceName == null) { - return; - } - source = m_sources.get(m_primarySourceName); - if (source == null) { - return; - } - } - switch (size) { - case kSize640x480: - source.setResolution(640, 480); - break; - case kSize320x240: - source.setResolution(320, 240); - break; - case kSize160x120: - source.setResolution(160, 120); - break; - default: - throw new IllegalArgumentException("Unsupported size: " + size); - } - } } diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Counter.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Counter.java index 5ccefd0fe6..610f809164 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Counter.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Counter.java @@ -18,10 +18,11 @@ import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable; import edu.wpi.first.wpilibj.tables.ITable; /** - * Class for counting the number of ticks on a digital input channel. This is a general purpose - * class for counting repetitive events. It can return the number of counts, the period of the most - * recent cycle, and detect when the signal being counted has stopped by supplying a maximum cycle - * time. + * Class for counting the number of ticks on a digital input channel. + * + *

This is a general purpose class for counting repetitive events. It can return the number of + * counts, the period of the most recent cycle, and detect when the signal being counted has + * stopped by supplying a maximum cycle time. * *

All counters will immediately start counting - reset() them if you need them to be zeroed * before use. diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/DigitalOutput.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/DigitalOutput.java index e14eff4671..153c358746 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/DigitalOutput.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/DigitalOutput.java @@ -90,35 +90,6 @@ public class DigitalOutput extends DigitalSource implements LiveWindowSendable { DIOJNI.pulse(m_handle, pulseLength); } - /** - * Generate a single pulse. Write a pulse to the specified digital output channel. There can only - * be a single pulse going at any time. - * - * @param channel Unused - * @param pulseLength The length of the pulse. - * @deprecated Use {@link #pulse(double)} instead. - */ - @Deprecated - @SuppressWarnings("PMD.UnusedFormalParameter") - public void pulse(final int channel, final double pulseLength) { - DIOJNI.pulse(m_handle, pulseLength); - } - - /** - * @param channel Unused - * @param pulseLength The length of the pulse. - * @deprecated Generate a single pulse. Write a pulse to the specified digital output channel. - * There can only be a single pulse going at any time. - */ - @Deprecated - @SuppressWarnings("PMD.UnusedFormalParameter") - public void pulse(final int channel, final int pulseLength) { - double convertedPulse = pulseLength / 1.0e9 * (DIOJNI.getLoopTiming() * 25); - System.err - .println("You should use the double version of pulse for portability. This is deprecated"); - DIOJNI.pulse(m_handle, convertedPulse); - } - /** * Determine if the pulse is still going. Determine if a previously started pulse is still going. * diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Encoder.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Encoder.java index 8d1736fd69..b92979fdee 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Encoder.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Encoder.java @@ -16,13 +16,14 @@ import edu.wpi.first.wpilibj.tables.ITable; import edu.wpi.first.wpilibj.util.AllocationException; /** - * Class to read quadrature encoders. Quadrature encoders are devices that count shaft rotation and - * can sense direction. The output of the Encoder class is an integer that can count either up or - * down, and can go negative for reverse direction counting. When creating Encoders, a direction - * can be supplied that inverts the sense of the output to make code more readable if the encoder is - * mounted such that forward movement generates negative values. Quadrature encoders have two - * digital outputs, an A Channel and a B Channel, that are out of phase with each other for - * direction sensing. + * Class to read quadrature encoders. + * + *

Quadrature encoders are devices that count shaft rotation and can sense direction. The output + * of the Encoder class is an integer that can count either up or down, and can go negative for + * reverse direction counting. When creating Encoders, a direction can be supplied that inverts the + * sense of the output to make code more readable if the encoder is mounted such that forward + * movement generates negative values. Quadrature encoders have two digital outputs, an A Channel + * and a B Channel, that are out of phase with each other for direction sensing. * *

All encoders will immediately start counting - reset() them if you need them to be zeroed * before use. @@ -377,8 +378,8 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW * Returns the period of the most recent pulse. Returns the period of the most recent Encoder * pulse in seconds. This method compensates for the decoding type. * - *

Warning: This returns unscaled periods and getRate() scales using value from - * setDistancePerPulse(). + *

Warning: This returns unscaled periods. Use getRate() for rates that are scaled using + * the value from setDistancePerPulse(). * * @return Period in seconds of the most recent pulse. * @deprecated Use getRate() in favor of this method. diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/PWM.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/PWM.java index 13fdc21648..a321d3072e 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/PWM.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/PWM.java @@ -92,25 +92,6 @@ public class PWM extends SensorBase implements LiveWindowSendable { PWMJNI.setPWMEliminateDeadband(m_handle, eliminateDeadband); } - /** - * Set the bounds on the PWM values. This sets the bounds on the PWM values for a particular each - * type of controller. The values determine the upper and lower speeds as well as the deadband - * bracket. - * - * @param max The Minimum pwm value - * @param deadbandMax The high end of the deadband range - * @param center The center speed (off) - * @param deadbandMin The low end of the deadband range - * @param min The minimum pwm value - * @deprecated Recommended to set bounds in ms using {@link #setBounds(double, double, double, - * double, double)} - */ - @Deprecated - public void setRawBounds(final int max, final int deadbandMax, final int center, - final int deadbandMin, final int min) { - PWMJNI.setPWMConfigRaw(m_handle, max, deadbandMax, center, deadbandMin, min); - } - /** * Set the bounds on the PWM pulse widths. This sets the bounds on the PWM values for a particular * type of controller. The values determine the upper and lower speeds as well as the deadband diff --git a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Preferences.java b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Preferences.java index 3ae9b47cd1..a5d248361e 100644 --- a/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Preferences.java +++ b/wpilibj/src/athena/java/edu/wpi/first/wpilibj/Preferences.java @@ -247,14 +247,4 @@ public class Preferences { public long getLong(String key, long backup) { return (long) m_table.getNumber(key, backup); } - - /** - * This function is no longer required, as NetworkTables automatically saves persistent values - * (which all Preferences values are) periodically when running as a server. - * - * @deprecated backwards compatibility shim - */ - @Deprecated - public void save() { - } } diff --git a/wpilibj/src/shared/java/edu/wpi/first/wpilibj/PIDController.java b/wpilibj/src/shared/java/edu/wpi/first/wpilibj/PIDController.java index 3a76874f93..3a4e452b0a 100644 --- a/wpilibj/src/shared/java/edu/wpi/first/wpilibj/PIDController.java +++ b/wpilibj/src/shared/java/edu/wpi/first/wpilibj/PIDController.java @@ -584,18 +584,6 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll return m_buf.size() != 0; } - /** - * Set the percentage error which is considered tolerable for use with OnTarget. (Input of 15.0 = - * 15 percent). - * - * @param percent error which is tolerable - * @deprecated Use {@link #setPercentTolerance} or {@link #setAbsoluteTolerance} instead. - */ - @Deprecated - public synchronized void setTolerance(double percent) { - m_tolerance = new PercentageTolerance(percent); - } - /** * Set the PID tolerance using a Tolerance object. Tolerance can be specified as a percentage of * the range or as an absolute value. The Tolerance object encapsulates those options in an @@ -681,16 +669,6 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll } } - /** - * Return true if PIDController is enabled. - * - * @deprecated Call {@link #isEnabled()} instead. - */ - @Deprecated - public synchronized boolean isEnable() { - return isEnabled(); - } - /** * Return true if PIDController is enabled. */ diff --git a/wpilibj/src/shared/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java b/wpilibj/src/shared/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java index dbaa97c096..89a138ed7c 100644 --- a/wpilibj/src/shared/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java +++ b/wpilibj/src/shared/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java @@ -9,7 +9,6 @@ package edu.wpi.first.wpilibj.smartdashboard; import java.nio.ByteBuffer; import java.util.Hashtable; -import java.util.NoSuchElementException; import java.util.Set; import edu.wpi.first.wpilibj.HLUsageReporting; @@ -18,7 +17,6 @@ import edu.wpi.first.wpilibj.Sendable; import edu.wpi.first.wpilibj.networktables.NetworkTable; import edu.wpi.first.wpilibj.networktables.NetworkTableKeyNotDefined; import edu.wpi.first.wpilibj.tables.ITable; -import edu.wpi.first.wpilibj.tables.TableKeyNotDefinedException; /** * The {@link SmartDashboard} class is the bridge between robot programs and the SmartDashboard on @@ -208,20 +206,6 @@ public class SmartDashboard { return table.setDefaultBoolean(key, defaultValue); } - /** - * Returns the boolean the key maps to. - * @param key the key to look up - * @return the value associated with the given key - * @throws TableKeyNotDefinedException if there is no value associated with - * the given key - * @deprecated This exception-raising method has been replaced by the - * default-taking method {@link #getBoolean(String, boolean)}. - */ - @Deprecated - public static boolean getBoolean(String key) throws TableKeyNotDefinedException { - return table.getBoolean(key); - } - /** * Returns the boolean the key maps to. If the key does not exist or is of * different type, it will return the default value. @@ -254,20 +238,6 @@ public class SmartDashboard { return table.setDefaultNumber(key, defaultValue); } - /** - * Returns the number the key maps to. - * @param key the key to look up - * @return the value associated with the given key - * @throws TableKeyNotDefinedException if there is no value associated with - * the given key - * @deprecated This exception-raising method has been replaced by the - * default-taking method {@link #getNumber(String, double)}. - */ - @Deprecated - public static double getNumber(String key) throws TableKeyNotDefinedException { - return table.getNumber(key); - } - /** * Returns the number the key maps to. If the key does not exist or is of * different type, it will return the default value. @@ -300,20 +270,6 @@ public class SmartDashboard { return table.setDefaultString(key, defaultValue); } - /** - * Returns the string the key maps to. - * @param key the key to look up - * @return the value associated with the given key - * @throws TableKeyNotDefinedException if there is no value associated with - * the given key - * @deprecated This exception-raising method has been replaced by the - * default-taking method {@link #getString(String, String)}. - */ - @Deprecated - public static String getString(String key) throws TableKeyNotDefinedException { - return table.getString(key); - } - /** * Returns the string the key maps to. If the key does not exist or is of * different type, it will return the default value. @@ -366,20 +322,6 @@ public class SmartDashboard { return table.setDefaultBooleanArray(key, defaultValue); } - /** - * Returns the boolean array the key maps to. - * @param key the key to look up - * @return the value associated with the given key - * @throws TableKeyNotDefinedException if there is no value associated with - * the given key - * @deprecated This exception-raising method has been replaced by the - * default-taking method {@link #getBooleanArray(String, boolean[])}. - */ - @Deprecated - public boolean[] getBooleanArray(String key) throws TableKeyNotDefinedException { - return table.getBooleanArray(key); - } - /** * Returns the boolean array the key maps to. If the key does not exist or is * of different type, it will return the default value. @@ -444,20 +386,6 @@ public class SmartDashboard { return table.setDefaultNumberArray(key, defaultValue); } - /** - * Returns the number array the key maps to. - * @param key the key to look up - * @return the value associated with the given key - * @throws TableKeyNotDefinedException if there is no value associated with - * the given key - * @deprecated This exception-raising method has been replaced by the - * default-taking method {@link #getNumberArray(String, double[])}. - */ - @Deprecated - public double[] getNumberArray(String key) throws TableKeyNotDefinedException { - return table.getNumberArray(key); - } - /** * Returns the number array the key maps to. If the key does not exist or is * of different type, it will return the default value. @@ -502,20 +430,6 @@ public class SmartDashboard { return table.setDefaultStringArray(key, defaultValue); } - /** - * Returns the string array the key maps to. - * @param key the key to look up - * @return the value associated with the given key - * @throws TableKeyNotDefinedException if there is no value associated with - * the given key - * @deprecated This exception-raising method has been replaced by the - * default-taking method {@link #getStringArray(String, String[])}. - */ - @Deprecated - public String[] getStringArray(String key) throws TableKeyNotDefinedException { - return table.getStringArray(key); - } - /** * Returns the string array the key maps to. If the key does not exist or is * of different type, it will return the default value. @@ -559,20 +473,6 @@ public class SmartDashboard { return table.setDefaultRaw(key, defaultValue); } - /** - * Returns the raw value (byte array) the key maps to. - * @param key the key to look up - * @return the value associated with the given key - * @throws TableKeyNotDefinedException if there is no value associated with - * the given key - * @deprecated This exception-raising method has been replaced by the - * default-taking method {@link #getRaw(String, byte[])}. - */ - @Deprecated - public byte[] getRaw(String key) throws TableKeyNotDefinedException { - return table.getRaw(key); - } - /** * Returns the raw value (byte array) the key maps to. If the key does not * exist or is of different type, it will return the default value. @@ -584,106 +484,4 @@ public class SmartDashboard { public static byte[] getRaw(String key, byte[] defaultValue) { return table.getRaw(key, defaultValue); } - - /* - * Deprecated Methods - */ - - /** - * Maps the specified key to the specified value in this table. - * - *

The key can not be null. The value can be retrieved by calling the get method with a key - * that is equal to the original key. - * - * @param key the key - * @param value the value - * @throws IllegalArgumentException if key is null - * @deprecated Use {@link #putNumber(java.lang.String, double) putNumber method} instead - */ - @Deprecated - public static void putInt(String key, int value) { - table.putNumber(key, value); - } - - /** - * Returns the value at the specified key. - * - * @param key the key - * @return the value - * @throws TableKeyNotDefinedException if there is no value mapped to by the key - * @throws IllegalArgumentException if the value mapped to by the key is not an int - * @throws IllegalArgumentException if the key is null - * @deprecated Use {@link #getNumber(java.lang.String) getNumber} instead - */ - @Deprecated - public static int getInt(String key) throws TableKeyNotDefinedException { - return (int) table.getNumber(key); - } - - /** - * Returns the value at the specified key. - * - * @param key the key - * @param defaultValue the value returned if the key is undefined - * @return the value - * @throws TableKeyNotDefinedException if there is no value mapped to by the key - * @throws IllegalArgumentException if the value mapped to by the key is not an int - * @throws IllegalArgumentException if the key is null - * @deprecated Use {@link #getNumber(java.lang.String, double) getNumber} instead - */ - @Deprecated - public static int getInt(String key, int defaultValue) throws TableKeyNotDefinedException { - try { - return (int) table.getNumber(key); - } catch (NoSuchElementException ex) { - return defaultValue; - } - } - - /** - * Maps the specified key to the specified value in this table. - * - *

The key can not be null. The value can be retrieved by calling the get method with a key - * that is equal to the original key. - * - * @param key the key - * @param value the value - * @throws IllegalArgumentException if key is null - * @deprecated Use{@link #putNumber(java.lang.String, double) putNumber} instead - */ - @Deprecated - public static void putDouble(String key, double value) { - table.putNumber(key, value); - } - - /** - * Returns the value at the specified key. - * - * @param key the key - * @return the value - * @throws TableKeyNotDefinedException if there is no value mapped to by the key - * @throws IllegalArgumentException if the value mapped to by the key is not a double - * @throws IllegalArgumentException if the key is null - * @deprecated Use {@link #getNumber(java.lang.String) getNumber} instead - */ - @Deprecated - public static double getDouble(String key) throws TableKeyNotDefinedException { - return table.getNumber(key); - } - - /** - * Returns the value at the specified key. - * - * @param key the key - * @param defaultValue the value returned if the key is undefined - * @return the value - * @throws IllegalArgumentException if the value mapped to by the key is not a double - * @throws IllegalArgumentException if the key is null - * @deprecated Use {@link #getNumber(java.lang.String, double) getNumber} instead. - */ - @Deprecated - public static double getDouble(String key, double defaultValue) { - return table.getNumber(key, defaultValue); - } - } diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PIDTest.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PIDTest.java index 25baa2c542..17025dec3e 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PIDTest.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PIDTest.java @@ -130,7 +130,7 @@ public class PIDTest extends AbstractComsSetup { setupOutputRange(); double setpoint = 2500.0; m_controller.setSetpoint(setpoint); - assertFalse("PID did not begin disabled", m_controller.isEnable()); + assertFalse("PID did not begin disabled", m_controller.isEnabled()); assertEquals("PID.getError() did not start at " + setpoint, setpoint, m_controller.getError(), 0); assertEquals(k_p, m_table.getNumber("p"), 0); @@ -149,11 +149,11 @@ public class PIDTest extends AbstractComsSetup { m_controller.enable(); Timer.delay(.5); assertTrue(m_table.getBoolean("enabled")); - assertTrue(m_controller.isEnable()); + assertTrue(m_controller.isEnabled()); assertThat(0.0, is(not(me.getMotor().get()))); m_controller.reset(); assertFalse(m_table.getBoolean("enabled")); - assertFalse(m_controller.isEnable()); + assertFalse(m_controller.isEnabled()); assertEquals(0, me.getMotor().get(), 0); } diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PreferencesTest.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PreferencesTest.java index c40f2966b2..fce1ce0757 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PreferencesTest.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PreferencesTest.java @@ -104,7 +104,6 @@ public class PreferencesTest extends AbstractComsSetup { assertEquals(m_pref.getFloat("checkedValueFloat", 0), 0, 0); assertFalse(m_pref.getBoolean("checkedValueBoolean", false)); addCheckedValue(); - m_pref.save(); assertEquals(m_check, m_pref.getLong("checkedValueLong", 0)); assertEquals(m_pref.getDouble("checkedValueDouble", 0), 1, 0); assertEquals(m_pref.getString("checkedValueString", ""), "checked"); diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboardTest.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboardTest.java index b5c7de6af7..d047fef2cd 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboardTest.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboardTest.java @@ -13,7 +13,6 @@ import org.junit.Test; import java.util.logging.Logger; import edu.wpi.first.wpilibj.networktables.NetworkTable; -import edu.wpi.first.wpilibj.networktables.NetworkTableKeyNotDefined; import edu.wpi.first.wpilibj.test.AbstractComsSetup; import static org.junit.Assert.assertEquals; @@ -29,9 +28,9 @@ public class SmartDashboardTest extends AbstractComsSetup { return logger; } - @Test(expected = NetworkTableKeyNotDefined.class) + @Test public void testGetBadValue() { - SmartDashboard.getString("_404_STRING_KEY_SHOULD_NOT_BE_FOUND_"); + assertEquals("", SmartDashboard.getString("_404_STRING_KEY_SHOULD_NOT_BE_FOUND_", "")); } @Test @@ -39,7 +38,7 @@ public class SmartDashboardTest extends AbstractComsSetup { String key = "testPutString"; String value = "thisIsAValue"; SmartDashboard.putString(key, value); - assertEquals(value, SmartDashboard.getString(key)); + assertEquals(value, SmartDashboard.getString(key, "")); assertEquals(value, table.getString(key)); } @@ -48,7 +47,7 @@ public class SmartDashboardTest extends AbstractComsSetup { String key = "testPutNumber"; int value = 2147483647; SmartDashboard.putNumber(key, value); - assertEquals(value, SmartDashboard.getNumber(key), 0.01); + assertEquals(value, SmartDashboard.getNumber(key, 0), 0.01); assertEquals(value, table.getNumber(key), 0.01); } @@ -57,7 +56,7 @@ public class SmartDashboardTest extends AbstractComsSetup { String key = "testPutBoolean"; boolean value = true; SmartDashboard.putBoolean(key, value); - assertEquals(value, SmartDashboard.getBoolean(key)); + assertEquals(value, SmartDashboard.getBoolean(key, !value)); assertEquals(value, table.getBoolean(key)); } @@ -66,12 +65,12 @@ public class SmartDashboardTest extends AbstractComsSetup { String key = "testReplaceString"; String valueOld = "oldValue"; SmartDashboard.putString(key, valueOld); - assertEquals(valueOld, SmartDashboard.getString(key)); + assertEquals(valueOld, SmartDashboard.getString(key, "")); assertEquals(valueOld, table.getString(key)); String valueNew = "newValue"; SmartDashboard.putString(key, valueNew); - assertEquals(valueNew, SmartDashboard.getString(key)); + assertEquals(valueNew, SmartDashboard.getString(key, "")); assertEquals(valueNew, table.getString(key)); }