Package com.singularsys.extensions.stream.dictionary


package com.singularsys.extensions.stream.dictionary
Provides a set of components for using dictionaries compatible with the com.singularsys.extensions.stream package.

Most functions are as in DictionaryComponents apart from entries(dict), keys(dict) and values(dict) which return streams rather than lists.

To set up use:

var sdc = new StreamDictComponents(
		DictionaryComponents.Type.MAP_MISSING_VALUES);
var sot = new StreamOperatorTable("=>", "..", "->", true);
var cp = new ConfigurableParserWithRange("..");
var fs = new StreamFunctionSet();
var lp = new StreamListProcessor();
var se = new StreamEvaluator(new FastEvaluator());
jep = new Jep(sot, cp, lp, se, fs, sdc);

To use with a FieldI use the StreamFieldDictComponents. The FieldI.eq(Object, Object) method is used to compare keys. The treeSet() is setup to use FieldComparator for ordering elements.

fields = new FieldCollection();
fields.addField(new StringField());
fields.addField(new RationalField());

var sfdc = new StreamFieldDictComponents(
        DictionaryComponents.Type.MAP_MISSING_VALUES,
		   fields);

var fot = new FieldOperatorTable(fields);
var sot = new StreamOperatorTable(fot,"=>", "..", "->", true, fields);
var cp = new ConfigurableParserWithRange("..");
var lfs = new StreamFunctionSet(fields);
var lp = new StreamListProcessor();
var se = new StreamEvaluator(new FastEvaluator());
var nf = new RationalNumberFactory();
jep = new Jep(sot, cp, lp, se, lfs, sfdc, nf);
To use with matrices use the StreamMatrixDictComponents The matrix field is used to compare keys, and determine the order in a treeMap(). The {code entries(dict)} function returns a stream of VectorI elements:
var mfact = new ObjectMatrixFactory();
var mfield = new SimpleMatrixField(mfact);

var smdc = new StreamMatrixDictComponents(
		StreamMatrixDictComponents.Type.MAP_NULL_VALUES,
		mfact,
		mfield);

var mot = new MatrixOperatorTable(mfact, mfield);
var sot = new StreamOperatorTable(mot,"=>", "..", "->", true, mfield);
var cp = new ConfigurableParserWithRange("..");
var mft = new MatrixFunctionTable(mfact, mfield);
var sfs = new StreamFunctionSet(mfield);
var lp = new StreamMatrixListProcessor(mfact,mfield);
var se = new StreamEvaluator(new FastEvaluator());
jep = new Jep(new StandardConfigurableParser(), se, mot, mft, smdc, sot, cp, sfs, lp);
Since:
Jep 4.1 extensions 2.2
See Also: