Skip to content

mP1/walkingkooka-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,945 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status License Language grade: Java Total alerts J2CL compatible

Background

Trees are everywhere in computing, representing more complex than a list or sequence. The former is two dimensional, while the other is linear or one dimensional.

Examples of trees in computing:

  • JSON
  • XML documents
  • Computer languages

Before expanding on their utility consider the following key classes/interfaces.

An agnostic AST that supports complex expressions, including computation, logical operands and invoking user defined functions.

  • Immutable
  • Functional
  • Fully traversable
  • May be evaluated - see below

An abstraction holding a number value within an Expression, which available choices including:

  • BigDecimal slower but more precision and various Rounding options.
  • double faster but limited 64-bit precision
  • float fastest but limited 32-bit precision TODO

A context accompanies the evaluation of an Expression and provides context aware values and behaviours.

  • A powerful construct that supports many values and behaviours that modify evaluation of an expression.
  • Provides the preferred ExpressionNumber to use at evaluation time, during number / calculations.

Extends LocaleContext, which provides locale aware values such as decimal point, currency, day names and more.

A function provides an independent function which describes

  • name The name, which is used within expressions.
  • return type The return type
  • parameters All the parameters including their name, cardinality and type.
  • purity Useful to determine whether the computed value can be cached, Within a spreadsheet this can help improve speed by avoiding unnecessary recalculations, because component values have or will never change.

The accompanying ExpressionEvaluationContext when executing a function uses the function metadata to convert values to the target type as necessary, supporting a type-safe but dynamic conversions as necessary.

The following function projects hold many functions, and can be used in any Expression context including Spreadsheets.

A Node is a unit within a tree, coming in two forms, leaves and parent nodes with the former never having children while the later possibly containing zero or more children. Numerous Node implementations include:

  • Expression
  • File A file system abstraction, execute xpath over directories and files.
  • Json Json objects.
  • Patch JSON Patch
  • Pojo Java POJOs with highlight support
  • Xml Xml documents

A selector represents a query which may be used to match Node within a node graph, equivalent to XPATH

  • Almost identical in syntax and effective functionality to that of XPATH.
  • May be executed using any of the many Node implementations.

A NodePointer supports path navigation/selection over a Node and is similar in syntax and features to JSON POINTER. Like Select is can operate against any of the above mentioned Node implementations.

A NodePatch is an equivalent technology similar to json-patch but supports all Node technologies.

About

Tree graph abstractions with support for selection via almost XPath queries, expressions (AST) and pointers(generic JsonPointer)

Topics

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages