Class MaybeCharAt


  • public class MaybeCharAt
    extends PrimitiveFunction
    Get the character at a given index in a string, returning Nothing if the index is out of bounds.
    • Constructor Summary

      Constructors 
      Constructor Description
      MaybeCharAt()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.function.Function<java.lang.String,​Optional<java.lang.Integer>> apply​(java.lang.Integer index)
      Returns a function that retrieves the character at the given index.
      static Optional<java.lang.Integer> apply​(java.lang.Integer index, java.lang.String s)
      Get the character at the given index in the string.
      protected java.util.function.Function<java.util.List<Term>,​java.util.function.Function<InferenceContext,​java.util.function.Function<Graph,​Either<Error_,​Term>>>> implementation()
      A dynamic/interpreted implementation of the function.
      Name name()
      The unique name of the primitive function.
      TypeScheme type()
      The datatype of the primitive function.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MaybeCharAt

        public MaybeCharAt()
    • Method Detail

      • name

        public Name name()
        Description copied from class: PrimitiveFunction
        The unique name of the primitive function.
        Specified by:
        name in class PrimitiveFunction
        Returns:
        the name of this primitive function
      • implementation

        protected java.util.function.Function<java.util.List<Term>,​java.util.function.Function<InferenceContext,​java.util.function.Function<Graph,​Either<Error_,​Term>>>> implementation()
        Description copied from class: PrimitiveFunction
        A dynamic/interpreted implementation of the function. Subclasses implement this with Either-based logic.
        Specified by:
        implementation in class PrimitiveFunction
        Returns:
        the function implementation
      • apply

        public static java.util.function.Function<java.lang.String,​Optional<java.lang.Integer>> apply​(java.lang.Integer index)
        Returns a function that retrieves the character at the given index.
        Parameters:
        index - the index of the character to retrieve
        Returns:
        a function that takes a string and returns a Optional containing the code point at the index
      • apply

        public static Optional<java.lang.Integer> apply​(java.lang.Integer index,
                                                        java.lang.String s)
        Get the character at the given index in the string.
        Parameters:
        index - the index of the character to retrieve
        s - the string to query
        Returns:
        a Optional containing the code point at the index, or empty if out of bounds