-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes Up Source Refactor according to CodeReview
- Loading branch information
1 parent
af47ce7
commit 12be42b
Showing
30 changed files
with
682 additions
and
434 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package edu.wpi.grip.core; | ||
|
||
|
||
/** | ||
* An Object that can switch its value. | ||
*/ | ||
public interface PreviousNext { | ||
|
||
/** | ||
* Perform the next action on this object. | ||
*/ | ||
void next(); | ||
|
||
/** | ||
* Perform the previous action on this object. | ||
*/ | ||
void previous(); | ||
|
||
} |
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,49 @@ | ||
package edu.wpi.grip.core; | ||
|
||
|
||
import com.google.common.eventbus.EventBus; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.TimeoutException; | ||
|
||
/** | ||
* An Object that can be stopped and started multiple times. | ||
*/ | ||
public interface StartStoppable { | ||
|
||
/** | ||
* Starts this StartStoppable | ||
* | ||
* @return Itself | ||
* @throws IOException If cleaning up some system resource fails | ||
*/ | ||
default <T extends StartStoppable> T start(EventBus eventBus) throws IOException { | ||
start(); | ||
eventBus.register(this); | ||
return (T) this; | ||
} | ||
|
||
/** | ||
* Any method that overrides this method should post a {@link edu.wpi.grip.core.events.StartedStoppedEvent} | ||
* to the {@link EventBus} if is successfully starts. | ||
* | ||
* @throws IOException If cleaning up some system resource fails | ||
*/ | ||
void start() throws IOException; | ||
|
||
/** | ||
* Any method that overrides this method should post a {@link edu.wpi.grip.core.events.StartedStoppedEvent} | ||
* to the {@link EventBus} if is successfully stops. | ||
* | ||
* @throws TimeoutException If the thread fails to stop in a timely manner | ||
* @throws IOException If cleaning up some system resource fails. | ||
*/ | ||
void stop() throws TimeoutException, IOException; | ||
|
||
/** | ||
* Used to indicate if the source is running or stopped | ||
* | ||
* @return true if this source is running | ||
*/ | ||
boolean isStarted(); | ||
} |
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
core/src/main/java/edu/wpi/grip/core/SwitchableSource.java
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
core/src/main/java/edu/wpi/grip/core/events/SourceStartedEvent.java
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
core/src/main/java/edu/wpi/grip/core/events/SourceStoppedEvent.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
core/src/main/java/edu/wpi/grip/core/events/StartedStoppedEvent.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,19 @@ | ||
package edu.wpi.grip.core.events; | ||
|
||
|
||
import edu.wpi.grip.core.StartStoppable; | ||
|
||
/** | ||
* An event that occurs when a {@link StartStoppable StartStoppable's} state changes. | ||
*/ | ||
public class StartedStoppedEvent { | ||
private final StartStoppable startStoppable; | ||
|
||
public StartedStoppedEvent(StartStoppable startStoppable) { | ||
this.startStoppable = startStoppable; | ||
} | ||
|
||
public StartStoppable getStartStoppable() { | ||
return this.startStoppable; | ||
} | ||
} |
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.