mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +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;
|
return this.api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApi(LuckPermsApi api) {
|
void setApi(LuckPermsApi api) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,4 +41,16 @@ public interface Graph<N> {
|
|||||||
*/
|
*/
|
||||||
Iterable<? extends N> successors(N node);
|
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;
|
package me.lucko.luckperms.common.inheritance;
|
||||||
|
|
||||||
import me.lucko.luckperms.common.graph.Graph;
|
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;
|
import me.lucko.luckperms.common.model.PermissionHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,16 +33,4 @@ import me.lucko.luckperms.common.model.PermissionHolder;
|
|||||||
*/
|
*/
|
||||||
public interface InheritanceGraph extends Graph<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;
|
package me.lucko.luckperms.sponge.service.inheritance;
|
||||||
|
|
||||||
import me.lucko.luckperms.common.graph.Graph;
|
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;
|
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> {
|
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