-
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.
Merge pull request #164 from JLLeitschuh/fix/webcamSourceSelect
Source Refactor with MultiImageFileSource
- Loading branch information
Showing
31 changed files
with
1,112 additions
and
184 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(); | ||
} |
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
Oops, something went wrong.