Skip to content

Commit

Permalink
Created javdocs for alerts.
Browse files Browse the repository at this point in the history
Signed-off-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
  • Loading branch information
thenetworkgrinch committed Jan 18, 2024
1 parent 5fbb2d0 commit 195f20e
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/main/java/swervelib/telemetry/Alert.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,25 @@
public class Alert
{

/**
* Group of the alert.
*/
private static Map<String, SendableAlerts> groups = new HashMap<String, SendableAlerts>();

/**
* Type of the Alert to raise.
*/
private final AlertType type;
/**
* Activation state of alert.
*/
private boolean active = false;
/**
* When the alert was raised.
*/
private double activeStartTime = 0.0;
/**
* Text of the alert.
*/
private String text;

/**
Expand Down Expand Up @@ -89,6 +103,8 @@ public Alert(String group, String text, AlertType type)
/**
* Sets whether the alert should currently be displayed. When activated, the alert text will also be sent to the
* console.
*
* @param active Set the alert as active and report it to the driver station.
*/
public void set(boolean active)
{
Expand Down Expand Up @@ -119,6 +135,8 @@ public void set(boolean active)

/**
* Updates current alert text.
*
* @param text The text for the alert.
*/
public void setText(String text)
{
Expand Down Expand Up @@ -182,11 +200,22 @@ public static enum AlertType
INFO
}

/**
* Sendable alert for advantage scope.
*/
private static class SendableAlerts implements Sendable
{

/**
* Alert list for sendable.
*/
public final List<Alert> alerts = new ArrayList<>();

/**
* Get alerts based off of type.
* @param type Type of alert to fetch.
* @return Active alert strings.
*/
public String[] getStrings(AlertType type)
{
Predicate<Alert> activeFilter = (Alert x) -> x.type == type && x.active;
Expand Down

0 comments on commit 195f20e

Please sign in to comment.