Package hydra

Interface Annotations


  • public interface Annotations
    Utilities for reading and writing type and term annotations
    • Method Detail

      • aggregateAnnotations

        static <T0,​T1,​T2,​T3> java.util.Map<T2,​T3> aggregateAnnotations​(java.util.function.Function<T0,​Optional<T1>> getValue,
                                                                                               java.util.function.Function<T1,​T0> getX,
                                                                                               java.util.function.Function<T1,​java.util.Map<T2,​T3>> getAnns,
                                                                                               T0 t)
        Aggregate annotations from nested structures
      • aggregateAnnotations_toPairs

        static <T0,​T1,​T2,​T3> java.util.List<java.util.List<Pair<T2,​T3>>> aggregateAnnotations_toPairs​(java.util.function.Function<T1,​java.util.Map<T2,​T3>> getAnns,
                                                                                                                              java.util.function.Function<T0,​Optional<T1>> getValue,
                                                                                                                              java.util.function.Function<T1,​T0> getX,
                                                                                                                              java.util.List<java.util.List<Pair<T2,​T3>>> rest,
                                                                                                                              T0 t)
      • commentsFromBinding

        static <T0> Either<Error_,​Optional<java.lang.String>> commentsFromBinding​(T0 cx,
                                                                                        Graph g,
                                                                                        Binding b)
        Extract comments/description from a Binding
      • commentsFromFieldType

        static <T0> Either<Error_,​Optional<java.lang.String>> commentsFromFieldType​(T0 cx,
                                                                                          Graph g,
                                                                                          FieldType ft)
        Extract comments/description from a FieldType
      • getAnnotationMap

        static java.util.Map<Name,​Term> getAnnotationMap​(Term t)
        Project a Map<Name, Term> out of an annotation Term. For a TermMap with TermVariable-shaped keys (or, transitionally, TermWrap-encoded Name keys), returns those (Name, value) entries; for any other shape, returns the empty map.
      • getAnnotationMap_v

        static <T0> T0 getAnnotationMap_v​(Pair<Term,​T0> p)
      • getDescription

        static <T0> Either<Error_,​Optional<java.lang.String>> getDescription​(T0 cx,
                                                                                   Graph graph,
                                                                                   java.util.Map<Name,​Term> anns)
        Get description from annotations map (Either version)
      • getTermAnnotation

        static Optional<Term> getTermAnnotation​(Name key,
                                                Term term)
        Get a term annotation
      • getTermDescription

        static <T0> Either<Error_,​Optional<java.lang.String>> getTermDescription​(T0 cx,
                                                                                       Graph graph,
                                                                                       Term term)
        Get term description (Either version)
      • getTypeAnnotation

        static Optional<Term> getTypeAnnotation​(Name key,
                                                Type typ)
        Get a type annotation
      • getTypeClasses

        static <T0> Either<Error_,​java.util.Map<Name,​java.util.Set<Name>>> getTypeClasses​(T0 cx,
                                                                                                      Graph graph,
                                                                                                      Term term)
        Get type classes from term. Each Set Name contains bare class identifiers (#275).
      • getTypeDescription

        static <T0> Either<Error_,​Optional<java.lang.String>> getTypeDescription​(T0 cx,
                                                                                       Graph graph,
                                                                                       Type typ)
        Get type description (Either version)
      • hasDescription

        static <T0> java.lang.Boolean hasDescription​(java.util.Map<Name,​T0> anns)
        Check if annotations contain description
      • hasTypeDescription

        static java.lang.Boolean hasTypeDescription​(Type typ)
        Check if type has description
      • isNativeType

        static java.lang.Boolean isNativeType​(Binding el)
        For a typed term, decide whether a coder should encode it as a native type expression, or as a Hydra type expression.
      • normalizeTermAnnotations

        static Term normalizeTermAnnotations​(Term term)
        Normalize term annotations
      • normalizeTypeAnnotations

        static Type normalizeTypeAnnotations​(Type typ)
        Normalize type annotations
      • setAnnotation

        static <T0,​T1> java.util.Map<T0,​T1> setAnnotation​(T0 key,
                                                                      Optional<T1> val,
                                                                      java.util.Map<T0,​T1> m)
        Set annotation in map
      • setDescription

        static java.util.Map<Name,​Term> setDescription​(Optional<java.lang.String> d,
                                                             java.util.Map<Name,​Term> v1)
        Set description in annotations
      • setTermDescription

        static Term setTermDescription​(Optional<java.lang.String> d,
                                       Term v1)
        Set term description
      • setTypeClasses

        static Term setTypeClasses​(java.util.Map<Name,​java.util.Set<Name>> m,
                                   Term term)
        Set type classes on term. The Set Name carries bare class identifiers (#275).
      • setTypeDescription

        static Type setTypeDescription​(Optional<java.lang.String> d,
                                       Type v1)
        Set type description
      • termAnnotationInternal

        static java.util.Map<Name,​Term> termAnnotationInternal​(Term term)
        Get internal term annotations
      • typeAnnotationInternal

        static java.util.Map<Name,​Term> typeAnnotationInternal​(Type typ)
        Get internal type annotations
      • wrapAnnotationMap

        static Term wrapAnnotationMap​(java.util.Map<Name,​Term> m)
        Wrap a Map<Name, Term> as a TermMap annotation. Each Name key becomes a TermVariable.