mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
refactor inheritance graphs slightly
This commit is contained in:
parent
f8d34d7f46
commit
957365ab91
@ -40,7 +40,7 @@ public abstract class AbstractEvent implements LuckPermsEvent {
|
||||
return this.api;
|
||||
}
|
||||
|
||||
public void setApi(LuckPermsApi api) {
|
||||
void setApi(LuckPermsApi api) {
|
||||
this.api = api;
|
||||
}
|
||||
}
|
||||
|
@ -41,4 +41,16 @@ public interface Graph<N> {
|
||||
*/
|
||||
Iterable<? extends N> successors(N node);
|
||||
|
||||
/**
|
||||
* Returns an iterable which will traverse this graph using the specified algorithm starting
|
||||
* at the given node.
|
||||
*
|
||||
* @param algorithm the algorithm to use when traversing
|
||||
* @param startNode the start node in the inheritance graph
|
||||
* @return an iterable
|
||||
*/
|
||||
default Iterable<N> traverse(TraversalAlgorithm algorithm, N startNode) {
|
||||
return GraphTraversers.traverseUsing(algorithm, this, startNode);
|
||||
}
|
||||
|
||||
}
|
@ -26,8 +26,6 @@
|
||||
package me.lucko.luckperms.common.inheritance;
|
||||
|
||||
import me.lucko.luckperms.common.graph.Graph;
|
||||
import me.lucko.luckperms.common.graph.GraphTraversers;
|
||||
import me.lucko.luckperms.common.graph.TraversalAlgorithm;
|
||||
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
|
||||
/**
|
||||
@ -35,16 +33,4 @@ import me.lucko.luckperms.common.model.PermissionHolder;
|
||||
*/
|
||||
public interface InheritanceGraph extends Graph<PermissionHolder> {
|
||||
|
||||
/**
|
||||
* Returns an iterable which will traverse this inheritance graph using the
|
||||
* specified algorithm starting at the given node.
|
||||
*
|
||||
* @param algorithm the algorithm to use when traversing
|
||||
* @param startNode the start node in the inheritance graph
|
||||
* @return an iterable
|
||||
*/
|
||||
default Iterable<PermissionHolder> traverse(TraversalAlgorithm algorithm, PermissionHolder startNode) {
|
||||
return GraphTraversers.traverseUsing(algorithm, this, startNode);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,8 +26,6 @@
|
||||
package me.lucko.luckperms.sponge.service.inheritance;
|
||||
|
||||
import me.lucko.luckperms.common.graph.Graph;
|
||||
import me.lucko.luckperms.common.graph.GraphTraversers;
|
||||
import me.lucko.luckperms.common.graph.TraversalAlgorithm;
|
||||
import me.lucko.luckperms.sponge.service.calculated.CalculatedSubject;
|
||||
|
||||
/**
|
||||
@ -35,16 +33,4 @@ import me.lucko.luckperms.sponge.service.calculated.CalculatedSubject;
|
||||
*/
|
||||
public interface SubjectInheritanceGraph extends Graph<CalculatedSubject> {
|
||||
|
||||
/**
|
||||
* Returns an iterable which will traverse this inheritance graph using the
|
||||
* specified algorithm starting at the given node.
|
||||
*
|
||||
* @param algorithm the algorithm to use when traversing
|
||||
* @param startNode the start node in the inheritance graph
|
||||
* @return an iterable
|
||||
*/
|
||||
default Iterable<CalculatedSubject> traverse(TraversalAlgorithm algorithm, CalculatedSubject startNode) {
|
||||
return GraphTraversers.traverseUsing(algorithm, this, startNode);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user