This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
101 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/team766/framework3/MultiFacetedMechanismWithStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.team766.framework3; | ||
|
||
import java.util.NoSuchElementException; | ||
|
||
public abstract class MultiFacetedMechanismWithStatus<S extends Record & Status> | ||
extends MultiFacetedMechanism implements StatusSource<S> { | ||
private S status = null; | ||
|
||
public final S getStatus() { | ||
if (status == null) { | ||
throw new NoSuchElementException(getName() + " has not published a status yet"); | ||
} | ||
return status; | ||
} | ||
|
||
@Override | ||
/* package */ final void publishStatus() { | ||
status = reportStatus(); | ||
StatusBus.getInstance().publishStatus(status); | ||
} | ||
|
||
protected abstract S reportStatus(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.team766.framework3; | ||
|
||
public interface StatusSource<S extends Status> { | ||
S getStatus(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/team766/framework3/SuperstructureWithStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.team766.framework3; | ||
|
||
import java.util.NoSuchElementException; | ||
|
||
public abstract class SuperstructureWithStatus<S extends Record & Status> extends Superstructure | ||
implements StatusSource<S> { | ||
private S status = null; | ||
|
||
public final S getStatus() { | ||
if (status == null) { | ||
throw new NoSuchElementException(getName() + " has not published a status yet"); | ||
} | ||
return status; | ||
} | ||
|
||
@Override | ||
/* package */ final void publishStatus() { | ||
status = reportStatus(); | ||
StatusBus.getInstance().publishStatus(status); | ||
} | ||
|
||
protected abstract S reportStatus(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.