-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
330 additions
and
102 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
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
34 changes: 34 additions & 0 deletions
34
core/src/main/java/org/bsc/langgraph4j/state/RemoveByHash.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,34 @@ | ||
package org.bsc.langgraph4j.state; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Represents a record that implements the {@link AppenderChannel.RemoveIdentifier<T>} interface. | ||
* | ||
* @param <T> the type of the value to be associated with this RemoveByHash instance | ||
*/ | ||
public record RemoveByHash<T>(T value ) implements AppenderChannel.RemoveIdentifier<T> { | ||
/** | ||
* Compares the hash code of this object with another element at a specific index. | ||
* | ||
* @param <T> the type parameter of the element to compare with | ||
* @param element the element to compare with | ||
* @param atIndex the index of the element in the context (ignored in comparison) | ||
* @return the difference between the hash codes of this object and the given element | ||
*/ | ||
@Override | ||
public int compareTo(T element, int atIndex) { | ||
return Objects.hashCode(value) - Objects.hashCode(element); | ||
} | ||
|
||
/** | ||
* Creates a new {@code RemoveByHash} instance with the specified value. | ||
* | ||
* @param <T> the type of the value | ||
* @param value the value to store in the {@code RemoveByHash} | ||
* @return a new {@code RemoveByHash} instance | ||
*/ | ||
public static <T> RemoveByHash<T> of ( T value ) { | ||
return new RemoveByHash<>(value); | ||
} | ||
} |
Oops, something went wrong.