-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generalizes grid watcher registration management code.
- Loading branch information
1 parent
fc6d121
commit eea3eee
Showing
29 changed files
with
362 additions
and
180 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...src/main/java/com/refinedmods/refinedstorage2/api/grid/operations/NoopGridOperations.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,20 @@ | ||
package com.refinedmods.refinedstorage2.api.grid.operations; | ||
|
||
import com.refinedmods.refinedstorage2.api.storage.ExtractableStorage; | ||
import com.refinedmods.refinedstorage2.api.storage.InsertableStorage; | ||
|
||
public class NoopGridOperations<T> implements GridOperations<T> { | ||
@Override | ||
public boolean extract(final T resource, | ||
final GridExtractMode extractMode, | ||
final InsertableStorage<T> destination) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean insert(final T resource, | ||
final GridInsertMode insertMode, | ||
final ExtractableStorage<T> source) { | ||
return false; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...ain/java/com/refinedmods/refinedstorage2/api/grid/watcher/GridStorageChannelProvider.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,18 @@ | ||
package com.refinedmods.refinedstorage2.api.grid.watcher; | ||
|
||
import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; | ||
import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannelType; | ||
|
||
import java.util.Set; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* Provides the {@link GridWatcherManagerImpl} with {@link StorageChannel}s. | ||
*/ | ||
@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.3") | ||
public interface GridStorageChannelProvider { | ||
Set<StorageChannelType<?>> getStorageChannelTypes(); | ||
|
||
<T> StorageChannel<T> getStorageChannel(StorageChannelType<T> type); | ||
} |
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
26 changes: 26 additions & 0 deletions
26
...pi/src/main/java/com/refinedmods/refinedstorage2/api/grid/watcher/GridWatcherManager.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,26 @@ | ||
package com.refinedmods.refinedstorage2.api.grid.watcher; | ||
|
||
import com.refinedmods.refinedstorage2.api.storage.Actor; | ||
|
||
import org.apiguardian.api.API; | ||
|
||
/** | ||
* This manager helps with attaching and detaching listeners to | ||
* {@link com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel}s. | ||
*/ | ||
@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.3") | ||
public interface GridWatcherManager { | ||
void addWatcher( | ||
GridWatcher watcher, | ||
Class<? extends Actor> actorType, | ||
GridStorageChannelProvider storageChannelProvider | ||
); | ||
|
||
void attachAll(GridStorageChannelProvider storageChannelProvider); | ||
|
||
void removeWatcher(GridWatcher watcher, GridStorageChannelProvider storageChannelProvider); | ||
|
||
void detachAll(GridStorageChannelProvider storageChannelProvider); | ||
|
||
void activeChanged(boolean active); | ||
} |
75 changes: 40 additions & 35 deletions
75
.../network/impl/node/grid/GridWatchers.java → .../grid/watcher/GridWatcherManagerImpl.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
3 changes: 1 addition & 2 deletions
3
...pl/node/grid/GridWatcherRegistration.java → ...grid/watcher/GridWatcherRegistration.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
2 changes: 1 addition & 1 deletion
2
...efinedstorage2/api/grid/package-info.java → ...orage2/api/grid/watcher/package-info.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
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
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
Oops, something went wrong.