refactor inheritance graphs slightly

This commit is contained in:
Luck 2018-04-20 14:00:50 +01:00
parent f8d34d7f46
commit 957365ab91
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
4 changed files with 13 additions and 29 deletions

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}