-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: add idea code styles * refactor: rename NbtUtilsTest -> AllayNbtUtilsTest * refactor: DAG and fix plugin load for dependency * feat: implement entity and blockentity serializer
- Loading branch information
CoolLoong
authored
Mar 8, 2024
1 parent
0971b25
commit b37bedf
Showing
31 changed files
with
1,189 additions
and
449 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
13 changes: 0 additions & 13 deletions
13
Allay-API/src/main/java/org/allaymc/api/datastruct/dag/CycleFoundException.java
This file was deleted.
Oops, something went wrong.
133 changes: 0 additions & 133 deletions
133
Allay-API/src/main/java/org/allaymc/api/datastruct/dag/DAG.java
This file was deleted.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
Allay-API/src/main/java/org/allaymc/api/datastruct/dag/DAGCycleException.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,45 @@ | ||
/* | ||
* Copyright 2009 Stephen Winnall, CH-8143 Stallikon. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "Licence"); | ||
* you may not use this file except in compliance with the Licence. | ||
* You may obtain a copy of the Licence at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the Licence is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the Licence for the specific language governing permissions and | ||
* limitations under the Licence. | ||
* | ||
*/ | ||
|
||
/* | ||
* All matters arising in law from the use of this software are subject | ||
* exclusively to the jurisdiction and venue of the courts located in | ||
* Zurich, Switzerland. See | ||
* | ||
* http://www.vimia.org/licences/JURISDICTION-1.0 | ||
* | ||
*/ | ||
|
||
package org.allaymc.api.datastruct.dag; | ||
|
||
/** | ||
* This exception is thrown if a loop occurs in the DAG graph. | ||
* | ||
* @author steve | CoolLoong | ||
*/ | ||
public class DAGCycleException extends Exception { | ||
/** | ||
* Constructs an instance of <code>DAGCycleException</code> with | ||
* the specified detail message and details of objects causing the cycle. | ||
* | ||
* @param before the before object | ||
* @param after the following object | ||
*/ | ||
public DAGCycleException(Object before, Object after) { | ||
super("(before: " + before + " - after: " + after + ")"); | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
Allay-API/src/main/java/org/allaymc/api/datastruct/dag/DirectedAcyclicGraph.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,77 @@ | ||
/* | ||
* Copyright 2009 Stephen Winnall, CH-8143 Stallikon. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "Licence"); | ||
* you may not use this file except in compliance with the Licence. | ||
* You may obtain a copy of the Licence at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the Licence is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the Licence for the specific language governing permissions and | ||
* limitations under the Licence. | ||
* | ||
*/ | ||
|
||
/* | ||
* All matters arising in law from the use of this software are subject | ||
* exclusively to the jurisdiction and venue of the courts located in | ||
* Zurich, Switzerland. See | ||
* | ||
* http://www.vimia.org/licences/JURISDICTION-1.0 | ||
*/ | ||
package org.allaymc.api.datastruct.dag; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
/** | ||
* DirectedAcyclicGraph is an implementation of a <a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph">directed acyclic graph</a> | ||
* that conforms to {@link Set}. | ||
* | ||
* @param <B> Node type. | ||
*/ | ||
public interface DirectedAcyclicGraph<B> extends Set<B> { | ||
|
||
/** | ||
* set the parent node of the "after" node as the "before" node. | ||
* <p> | ||
* Note that before set, you need to call the {@link Set#add(Object)} method to add nodes. | ||
* <p> | ||
* If the node specified in the parameter is not in the graph, it will throw an {@link IllegalArgumentException} | ||
* | ||
* @param before the before node | ||
* @param after the after node | ||
* @throws DAGCycleException if a cycle occurs, this exception will be thrown | ||
*/ | ||
void setBefore(B before, B after) throws DAGCycleException; | ||
|
||
/** | ||
* If the node specified in the parameter is not in the graph, it will throw an {@link IllegalArgumentException} | ||
* | ||
* @param member a node | ||
* @return all parent nodes of this node. Note that if this node is not in the graph, an {@link NullPointerException} will be thrown. | ||
*/ | ||
Set<B> getBefore(B member); | ||
|
||
/** | ||
* If the node specified in the parameter is not in the graph, it will throw an {@link IllegalArgumentException} | ||
* | ||
* @param before the before node | ||
* @param after the after node | ||
* @return Whether the "before" node is a parent node of the "after" node. | ||
*/ | ||
boolean isBefore(B before, B after); | ||
|
||
/** | ||
* @return The result of topological sorting of this directed acyclic graph (DAG). | ||
*/ | ||
List<B> getSortedList(); | ||
|
||
/** | ||
* If the node specified in the parameter is null, it will throw an {@link NullPointerException} | ||
*/ | ||
boolean add(B member); | ||
} |
Oops, something went wrong.