Apama Documentation : Release Notes : What's New in Apama 5.0 : Changes to EPL features in Apama 5.0 : EPL changes without migration implications
EPL changes without migration implications
This topic describes EPL enhancements. If you use these new EPL features in applications that you are migrating from Apama 4.3 you do not need to change the application other than to implement these new features.
See also: EPL changes that might have migration implications.
Addition of decimal primitive type
EPL now supports the decimal primitive type. When perfect accuracy in working with decimal fractions is a requirement, use the decimal type in place of the float type. When you are not working with decimal values then using float types is the right choice. For example, it makes sense to use decimal types to compute 3.9% interest on $127,729.23 if it is important that the answer be exact. Conversely, there is no reason to use a decimal type to determine the area of a circle, for example, because pi is not a decimal fraction. When extremely small floating point variations are acceptable, you might choose to use the float type to obtain better performance.
A decimal type is a signed, decimal, floating point number. Either a decimal point (.) or an exponent symbol (e) must be present within the number for it to be a valid decimal. Also, there must be a decimal suffix (d) to distinguish it from a float type.
Streams of decimal type items are supported. The built-in aggregate functions that you can specify in stream query projections support decimal types.
Correlator plug-ins, Event Modeler, DataViews, and dashboards do not support use of the decimal type.
New string type methods
Apama 5.0 provides the following new string methods:
*The new string.intern() method is an optimization that can reduce memory use. This method takes no arguments, returns the interned version of the string that it is called on, and marks the string as being interned, which means that the correlator uses the same string object for every subsequent occasion that the same string is parsed.
*The new string.replaceAll(string1, string2) method makes a copy of the string that the method is called on, replaces instances of string1 in the copy with instances of string2, and returns the updated copy.
*The new string.split(string) method splits the string that is the argument at occurences of the string that the method is called on and returns a sequence that contains the new strings.
*The new string.tokenize(string) method divides the string argument into tokens where each token is separated from its neighbors by one or more delimiters in the string that the method is called on. The tokenize() method returns a sequence of strings.
Allowable key types in dictionaries
It is now possible to use any comparable type as the key in a dictionary. The comparable types are:
*boolean
*decimal
*float
*integer
*string
*context
*dictionary if it contains items that are a comparable type
*event if it contains only comparable types
*location
*sequence if it contains items that are a comparable type
New dictionary methods
Apama 5.0 provides the following new dictionary methods:
*The dictionary.getOr(key, alternative) method either retrieves an existing item by its key or returns the specified alternative.
*The dictionary.getOrDefault(key) method either retrieves an existing item by its key or returns a default instance of the dictionary's item type if the dictionary does not contain the specified key.
*The getOrAdd(key, alternative) method either retrieves an existing item by its key or if the dictionary does not already contain an item with the specified key then it adds the specified key to the dictionary with the specified value and then returns that value.
*The getOrAddDefault(key) method either retrieves an existing item by its key or if the dictionary does not already contain an item with the specified key then it adds the specified key to the dictionary with a default-constructed value and returns that value.
The getOr() methods let you avoid calls to the hasKey() method before you look up a key. This leads to safer, simpler, and faster code.
Before Apama 5.0, the dictionary.getOr() method was called dictionary.getDefault(). The getDefault() method remains only for backwards compatibility and should not be used. It is deprecated and will be removed in a future release. Use the dictionary.getOr() method instead.
New sequence method
The new sequence.setCapacity(integer) method sets the amount of memory initially allocated for the sequence. Note that this does not limit the amount of memory the sequence can use. By default, as you add more elements to a sequence, the correlator allocates more memory. Calling sequence.setCapacity() can improve performance because it removes the need to add more memory each time you add an element to the sequence. For example, consider a sequence that will contain at least 1000 elements. A call to setCapacity(1000) removes the need to allocate additional memory unless more than 1000 elements are added. A call to this method does not change the behavior of your code.
New context method
The new context.isPublic() method returns a Boolean value that indicates whether the context is public.
New chunk methods
Apama 5.0 provides the following new chunk methods:
*empty() – returns true if the chunk is empty. This lets you distinguish between a chunk that contains a default initialization value and a chunk that has been populated by a correlator plug-in.
*getOwner() – returns a string that contains the name of the correlator plug-in that the chunk belongs to. This method returns an empty string if the chunk is empty.
Enhancement to MemoryStore plug-in
When you expose a MemoryStore table as a DataView you can now specify the display name and/or the description for the exposed DataView. Previously, the MemoryStore always used a default display name and description.
Names no longer reserved for future use
The names open, close and reset are no longer reserved for future use. A custom aggregate function can have members with these names.
EPL samples removed
The following sample event interfaces and monitors, some of which are specific to capital market solutions, have been removed from Apama 5.0:
*DatabaseSupport.mon
*MultiLegOrderManagerSupport.mon
*OrderManagerSupport.mon
*ScenarioOrderService.mon
*SimpleExchangeSimulator.mon
*SimpleNonPersistentDatabase.mon
*SimplePriceGenerator.mon
*TickManagerSupport.mon
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback