Jep 3 Releases | Jep 2 Releases | Jep 1 Releases
Localization:
com.singularsys.jep.JepMessages
.com.singularsys.jep.messages.properties
provides default English messagescom.singularsys.jeptests.system.MessagesTest
which checks Exceptions are thrown and prints all messages produced by Jep in the current locale.Threads
threadsafeevaluator
package which allows the same expression
to be evaluated in multiple threads/Jep instances without needing to transfer.ImportationVisitor
class which allows quicker transfer of an expression
between multiple threads/Jep instances.ThreadSpeedTest
compares evaluation speed with multiple threads.
This was previously named ThreadTest
Both in the com.singularsys.jepexamples.diagnostics
package.ThreadSafeSpeedTest
class used to tests speeds using the ThreadSafeEvaluator
.Bound variables:
ConfigurableParser:
LookaheadNIterator
which allows any given number of characters of lookahead.GrammarParser.parsePrefixSuffix()
allowing GrammarMatchers to ask the parser for a prefix-terminal-suffix
like "-2", "x", "5!" or "sin(x)". Implement in the ShuntingYard parserSingleArgFunctionMatcher
which can parse expressions like "sin 30" with a single simple argument and no brackets.ShuntingYard
allowing test matching of prefix expressionsprev()
for Lookahead2Itterator
allow last token consumed to be examined, useful for debugging messages.setInputIterator()
method for Lookahead2Itterator
allows nested gramatical parsers.errorToken()
method for improved error reporting in FunctionGrammarMatcher
OperatorTokenMatcher
one OperatorToken
will be produced for each operator encountered, allowing line and column numbers to be recorded.
Changed constructors for OperatorToken
.GrammarParserFactory
and TokenizerFactory
now implement JepComponent
and these
can now be specified with jep.setComponent()
which simplifies the construction process.com.singularsys.jep.configurableparser.matchers.SingleArgFunctionMatcher
which can parse functions like "sin 30" with no brackets and a single argument.OperatorAsFunctionGrammarMatcher
which allows all operators to
be used like functions so it possible to parse +(1,2,3,4)
.VariableTable
has a method removeNonConstants()
which removes all
non-constant variables.
Variable
can have annotation using the setHook(HookKey key, Object value)
and Object getHook(HookKey key)
methods. These use the Node.HookKey
interface.
ComponentSubset
class to hold an partial set of components.
Functions:
NullaryFunction
base class for functions with zero arguments.
Implemented by Random
and ThreadSafeRandom
and ConstantFunction
StringFunctionSet
from com.singularsys.jep.functions.strings
to
com.singularsys.jep.misc
to remove package dependence.Average
have altered functions specifing the Add, Divide methods used.CallbackEvaluationI.Runnable
interfaces, impacting three classes
Case
, Switch
and SwitchDefault
, but no functional change.getID()
to Comparative
getVariable()
method to Ele
which
is overwitten by the thread-safe subclass ThreadSafeEle
IllegalParameterException(PostfixMathCommandI pfmc,
int pos,
String expectedMsg, Object actualObject)
run()
methods whose error behaviour is now handled by base class PostfixMathCommand
Logarithm
now has correct values for negative and complex argumentsCheckStack()
protected method from PostfixMathCommand
com.singularsys.jep.misc.threadsafeeval.ThreadSafeRandom
provides a faster random function
based on Java's ThreadLocalRandomFactorial
moved out of the ExtendedOperatorSet
into its own class. The function throws exception when argument is greater than 20 causing overflow.ExtendedOperatorSet
no longer includes a ternary conditional operator as duplicate that in the JavaOperatorSet.JepComponent
interface. Their init(Jep)
method will be called
whenever jep is reinitialised. Likewise their getLightWeightInstance()
will
be called when building a function table for use in a separate thread.
BigDecimals:
BigDecFunctionTable
now provide the if(cond,val1,val2),
abs(val), signum(val), min(val1,val2,...), max(val1,val2,...), average(val1,val2,...),
round(val), round(val,dp), roundSF(val,s), rint(val), rint(val,dp), ceil(val), floor(val)
functions by default.BigDecAbs
, BigDecRound
, BigDecRoundSigFig
,
BigDecSignum
functions.BigDecAdd
etc reworked so they work with the
MinMax
and Average
functions.BigDecTieBreakComparative
to allow predictible behaviour
for min/max when given
two equal big decimal numbers with different precisionsNullWapper package:
NullWrapped...
All function base classes and interfaces now moved to com.singularsys.jep.misc.functions. This will break existing code using this package.getWrappedFunction(PostfixMathCommandI)
and getSpecialFunction(PostfixMathCommandI)
functions moved to NullWrappedFunctionFactory. Breaks backward compatibility.com.singularsys.jepexamples.diagnostics.DestructiveTests
diagnostic tool
which checks the size of expressions which can be parsed/evaluated before Stack overflows.Operator
now has an optional printSymbol
property which can be used when printing out equations.
This is of use when alphabetical operator names like "AND" are used, here the printSymbol is set to " AND " so that
spaces appear when printing and
X==Y AND Z==W
is printed correctly.StandardEvaluator
NullPrintVisitor
class for reduced memory footprint.ElementOf
function which can test if an the first argument is in a list of items.
elementOf(x,"north","south","east","west")
IllegalParameterException
which allows details for expected result to be specified by a string.PostfixMathCommand.run()
method which throws an exception reintroduced.OperatorAsFunctionGrammarMatcher
which allows specific operators to be treated as function so you can have
+(1,2,3,4)
.Complex
for testing equality using double ==.buildFunctionNode(String,Node)
to NodeFactory
.VariableTableObserver
now has a switch to allow/dis-allow watching in change of variable values.Console
applications can set a double format to format numbers in printf like formats.Jep.setVariable(String,Object)
which works like addVariable
but does not throw exceptions.trapUnsetValues
field FastEvaluator
with corresponding getter and setters. Detects is a variable has an unset value.RealComponents
for the usercase where pure real evaluation is needed, function like sqrt(-1) return NaN rather than a complex number.DoNothingVisitor
now has a method childrenHaveChanged(Node, Node[])
method to test if new children aare different from the original.
StandardVariableTable
and RealVariableTable
now allow delayed
initialisation with constants added when the VariableFactory is set in the init method.
PostfixMathCommand.checkStack()
method removed as of little utility.CallbackEvaluationI.Runnable
removed.Ele
.Ele
.NodeFactory
.VariableTable.clearValues()
called, but evaluators return previous values.SymbolTokenMatcher
when parsing alternate symbols for operators.NaryBinaryFunction
when given more than 2 arguments. (Not normally produced during parsing)Logarithm
(Log base 10) with complex arguments. Was giving results as natural logarithm.a*(-b)
.
RealEvaluator
, FastEvaluator
BitwiseOperatorTable
and JavaOperatorTable
no longer set the basis operators
instead using those in the supplied argument.LightWeightComponentSet
now uses the NullPrintVisitor
.Operator
, FastEvaluator
and PrintVisitor
to protected to allow use by subclasses SimpleNode
remove corresponding constructors in subclasses.Real
, Str
, BitComp
now implement UnaryFunction
.BitAnd
, BitOr
BitXor
LShift
RShift
URShift
now implement BinaryFunction
.FromBase
, Switch
SwitchDefault
ToBase
RShift
URShift
now implement NaryFunction
.NodeFactory
now have varargs parameters simplify the number of methods and several places they are called from. Will
require corresponding changes in subclasses.basicIndetifierMatcher
and dottedIndetifierMatcher
, replace with
basicIdentifierMatcher
and dottedIdentifierMatcher
deprecate old versions.
StackCheckingFastEvaluator
in the package com.singularsys.jeptests.system
which can be used to detect some stack corruption errors.PrintVisitor
in Full Bracket mode does no longer puts brackets around variables and positive constants
as there is no ambiguity.sqrt()
function to the standard set of functions.
getAdditionComponent(Class<?>)
method to find components which instance a particular class.append(String)
method allowing classes which implement PrintRulesI to append text to the output.VariableTable
has a new method clearValues()
which clears the valid-value flag of
all non constant values. Constants are always valid.round
function now uses Math.round and a new rint
function is added which calls Math.rint. These differ in how 1.5 is rounded (rint rounds up to nearest even value, round always rounds down).calc(List)
method makes it easier to create sub-classes which act on lists of objects.min([1,[2,3]])
can be computed. The Comparative parameter can be set by sub classes.TokenizerFactory
, GrammarParserFactory
which
allow different objects to be used for the tokenizing and parsing steps.ShuntingYard
some methods made protected.Tokenizer
constructor changed, line and column numbering starts from 1.OperatorTokenMatcher
improved handling of operators with word characters.GrammarParser
has an additional method public void setIterator(Lookahead2Iterator<Token>)
setting the iterator used by parseSubExpression()
.MacroFunction
has an additional constructor for use with non recursive functions.com.singularsys.jep.misc.lineNumbering
to allow line number information to be stored in nodes in the parse tree. With classes LineNumberingNodeFactory
,
LineNumberingShuntingYard
.com.singularsys.jep.misc.nullwrapper
which provides functions and operators which propagate null values through results. These classes can be wrapped
around other classes to add this functionality to existing classes.com.singularsys.jep.walkers
so they can be used as JepComponents.system
and unit
packages.
Jep(JepComponent... comp)
which makes it easier
to construct Jep with a specific set of components.
For example new Jep(new StandardConfigurableParser())
.Jep.getOperatorTable()
now returns OperatorTableI
which may break some code.getName()
, getValue()
making it easier to extract values without a cast.
setHook()
, getHook()
allowing annotation of nodes with key-value pairs.
BinaryFunction
just needs to define an Object eval(Object l, Object r)
method.
EvaluationException
provides standardised error
messages, for the common case of wrong arguments being passed to user functions.
int asInt()
to convert arguments to a specified type.
General Changes:
Changes to the configurable parser:
0x1F
) a | b
, bit shifting a << 2
) in BitwiseOperatorTable a?b:c
, x+=1
, ++x
syntax a[1][1]
accesses the first element of a two-dimensional array)Known issues:
Jep.addVariable
does not notify the user when the specified value can not be set. This happens when a constant is already defined with the same name.avg
, min
, and max
functionslog10
, sinh
, cosh
, tanh
, and hypot
NaN
for negative reals rather than complex.Known issues:
Known issues: