RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
TunableBase.java
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5package org.wpilib.tunable;
6
8@SuppressWarnings("PMD.AbstractClassWithoutAbstractMethod")
9public abstract class TunableBase {
10 private final TunableConfig m_config;
11 private final boolean m_supportsChangeNotification;
12
17 protected boolean m_changed;
18
24 protected TunableBase(TunableConfig config) {
25 this(config, false);
26 }
27
38 m_config = config;
39 m_supportsChangeNotification = supportsChangeNotification;
40 }
41
48 public boolean isRobust() {
49 return m_config != null && m_config.isRobust();
50 }
51
58 public String getProperties() {
59 return m_config == null ? "{}" : m_config.getProperties();
60 }
61
68 return m_config;
69 }
70
76 public boolean hasChanged() {
77 return m_changed;
78 }
79
85 public boolean supportsChangeNotification() {
86 return m_supportsChangeNotification;
87 }
88
90 protected void markChanged() {
91 if (!m_changed) {
92 m_changed = true;
93 if (m_supportsChangeNotification) {
94 TunableRegistry.notifyChanged(this);
95 }
96 }
97 }
98
100 public void resetChanged() {
101 m_changed = false;
102 }
103}
TunableBase(TunableConfig config, boolean supportsChangeNotification)
TunableBase(TunableConfig config)