logic.js

Summary
logic.js
bbop.logicBBOP object to try and take some of the pain out of managing the boolean logic that seems to show up periodically.
Functions
logicContructor for the bbop.logic object.
addAdd to the current stored logic bundle.
negateNegate the current stored logic.
to_stringDump the current data out to a string.
urlTODO
emptyEmpty/reset self.
parseTODO: I think I can grab the shunting yard algorithm for a similar problem in the old AmiGO 1.x codebase.

bbop.logic

BBOP object to try and take some of the pain out of managing the boolean logic that seems to show up periodically.  Right now mostly aimed at dealing with Solr/GOlr.

Anatomy of a core data bundle.

data_bundle => {op: arg}
op => '__AND__', '__OR__', '__NOT__'
arg => <string>, array, data_bundle
array => [array_item*]
array_item => <string>, data

Example

{and: [{or: ...}, {or: ...}, {and: ...} ]}
var filters = {'and': []};

TODO: parens between levels

Summary
Functions
logicContructor for the bbop.logic object.
addAdd to the current stored logic bundle.
negateNegate the current stored logic.
to_stringDump the current data out to a string.
urlTODO
emptyEmpty/reset self.
parseTODO: I think I can grab the shunting yard algorithm for a similar problem in the old AmiGO 1.x codebase.

Functions

logic

bbop.logic = function(default_conjunction)

Contructor for the bbop.logic object.  NOTE: during processing, binary operators with a single argument cease to exist as they will never make it to output.

Arguments

default_conjuntion[optional] “and” or “or”; defaults to “and”

Returns

bbop logic object

add

Add to the current stored logic bundle.

Parameters

itemstring or bbop.logic object

Returns

n/a

negate

this.negate = function()

Negate the current stored logic.

TODO/BUG: I think this might cause an unreleasable circular reference.

Parameters

n/a

Returns

n/a

to_string

this.to_string = function()

Dump the current data out to a string.

Parameters

n/a

Returns

n/a

url

this.url = function()

TODO

Dump the current data out to a URL.

Parameters

n/a

Returns

n/a

empty

Empty/reset self.

Parameters

n/a

Returns

n/a

parse

this.parse = function(in_str)

TODO: I think I can grab the shunting yard algorithm for a similar problem in the old AmiGO 1.x codebase.

Parse an incoming string into the internal data structure.

Parameters

in_strthe incoming string to parse

Returns

n/a

bbop.logic = function(default_conjunction)
Contructor for the bbop.logic object.
this.negate = function()
Negate the current stored logic.
this.to_string = function()
Dump the current data out to a string.
this.url = function()
TODO
this.parse = function(in_str)
TODO: I think I can grab the shunting yard algorithm for a similar problem in the old AmiGO 1.x codebase.
Close