This document lists the custom extended operators available in this sample Java project, with source-file references and usage examples.
- Review operator categories in the table of contents.
- Open the linked Java source file for implementation details.
- Build and package the project as a JAR, then add it to your Rules Project.
-
- AttributeOperators
- CollectionOperators
- DecimalOperators
- Finance
- JaroWinklerDistance
- SimilarityAnalysisOperators
- PerformanceOperators
- SolarEnergyOperators
- MathOperators
- DateTimeOperators
- Some operator names preserve legacy spellings for backward compatibility (for example
getFarenheight). - Existing class names, anchors, and URL slugs are unchanged.
Note: Corticon Studio is built on Eclipse which provides a Java development environment you can use for creating Corticon extensions that you can use in current and future versions of Corticon. If you want to create extensions in a separate IDE, you must use Java 1.8 or higher.
Note: Compatibility of extensions created in an earlier release, any extension operators and service callouts that are in extended.core.jar are shared across all Rule Projects. As a result, such extensions are always in the Rule Operator tab in every editor. Then, you can add your extended operators and service callouts to specific Rule Projects using the new mechanism.
Note: You might want to simply copy the sample project Extended Operator Java Project, and then tweak a sample such as AttributeOperators.java by renaming the TopLevelFolder to mySampleExtendedOperators for your first run. You can then build the Java project.
For many developers, the quickest way to learn is by example. You might want to compare the three Java source files in the Extended Operator Java Project to see what is common and what changes. In this example, the AttributeOperators.java is presented.
Description: Determines if a date is a leap year.
Source: AttributeOperators.java
Usage:
Entity.attribute.isLeapYear()
Description: Replaces all occurrences of a substring in a string with another string.
Source: AttributeOperators.java
Usage:
replaceAll(string, searchString, replacement)
Description: Determine whether the specified string contains any blanks.
Source: AttributeOperators.java
Usage:
containsBlanks(string)
Description: Returns the character at the specified index (one-based) in the String.
Source: AttributeOperators.java
Usage:
characterAt(string, index)
Description: Determines whether the specified String contains nothing but integer digits.
Source: AttributeOperators.java
Usage:
isInteger(string)
Description: Trim the leading and trailing whitespace from the specified string.
Source: AttributeOperators.java
Usage:
trimSpaces(string)
Description: Determine whether all the characters in the specified are contained in the passed in String
Source: AttributeOperators.java
Usage:
charsIn(string, characterSet)
Description: Determines if a collection of strings contains any duplicates.
Source: CollectionOperators.java
Usage:
Entity.collection.containsDuplicates()
Description: Determines the number of times a given string occurs in a collection of strings.
Source: CollectionOperators.java
Usage:
occurrenceCount(collection, searchString)
Description: Given an array of numbers, return the number which represents the standard deviation of the list, using the unbiased n-1 method.
Source: CollectionOperators.java
Usage:
stddev(inputArray)
Description: Truncate and round down to a specified number of fractional digits.
Source: DecimalOperators.java
Usage:
truncFloor(decimal, digits)
Description: Get the present value of an investment.
Source: Finance.java
Usage:
getPresentValue(futureValue, interestRate, numberOfYears)
Description: Get the future value of an investment.
Source: Finance.java
Usage:
getFutureValue(presentValue, interestRate, numberOfYears)
Description: A similarity algorithm indicating the percentage of matched characters between two character sequences.
Source: JaroWinklerDistance.java
Usage:
apply(string1, string2)
Description: Calculates Double Metaphone (phonetic) similarity between two strings.
Source: SimilarityAnalysisOperators.java
Usage:
compareWithDoubleMetaphone(string1, string2)
Description: Calculates Levenshtein similarity between two strings.
Source: SimilarityAnalysisOperators.java
Usage:
compareWithLevenshtein(string1, string2)
Description: Calculates N-gram similarity between two strings.
Source: SimilarityAnalysisOperators.java
Usage:
compareWithNgram(string1, string2, n-gram size)
Description: Calculates tokenization-based similarity between two strings.
Source: SimilarityAnalysisOperators.java
Usage:
compareWithTokenization(string1, string2)
Description: Returns a timestamp in milliseconds allowing to gather performance metrics in a rulesheet.
Source: PerformanceOperators.java
Usage:
getNanoTimeMillis()
Description: Returns the sine of the angle in degrees.
Source: SolarEnergyOperators.java
Usage:
sinDegrees(angle)
Description: Returns the cosine of the angle in degrees.
Source: SolarEnergyOperators.java
Usage:
cosDegrees(angle)
Description: Returns the elevation angle for solar panel installation.
Source: SolarEnergyOperators.java
Usage:
calculateElevationAngle(declination, latitude, hourAngle)
Description: Returns the solar declination angle for a given day of the year.
Source: SolarEnergyOperators.java
Usage:
calculateSolarDeclination(dayOfYear)
Description: Returns the solar hour angle based on solar time.
Source: SolarEnergyOperators.java
Usage:
calculateHourAngle(solarTime)
Description: Returns the air mass based on the zenith angle.
Source: SolarEnergyOperators.java
Usage:
calculateAirMass(zenithAngle)
Description: Convert a caller-supplied radius to circumference.
Source: MathOperators.java
Usage:
getCircumference(radius)
Description: Convert a caller-supplied Centigrade temperature to Farenheight.
Source: MathOperators.java
Usage:
getFarenheight(centigrade)
Description: Returns the absolute value of a decimal value.
Source: MathOperators.java
Usage:
abs(n)
Description: Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi.
Source: MathOperators.java
Usage:
acos(n)
Description: Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2.
Source: MathOperators.java
Usage:
asin(n)
Description: Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2.
Source: MathOperators.java
Usage:
atan(n)
Description: Returns the cube root of a double value.
Source: MathOperators.java
Usage:
cbrt(n)
Description: Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
Source: MathOperators.java
Usage:
ceil(n)
Description: Returns the trigonometric cosine of an angle.
Source: MathOperators.java
Usage:
cos(n)
Description: Returns the hyperbolic cosine of a double value.
Source: MathOperators.java
Usage:
cosh(n)
Description: Returns Euler's number e raised to the power of a double value.
Source: MathOperators.java
Usage:
exp(n)
Description: Returns ex -1.
Source: MathOperators.java
Usage:
expm1(n)
Description: Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
Source: MathOperators.java
Usage:
floor(n)
Description: Returns the unbiased exponent used in the representation of a double.
Source: MathOperators.java
Usage:
exponent(n)
Description: Returns the natural logarithm (base e) of a double value.
Source: MathOperators.java
Usage:
loge(n)
Description: Returns the base 10 logarithm of a double value.
Source: MathOperators.java
Usage:
log10(n)
Description: Returns the natural logarithm of the sum of the argument and 1.
Source: MathOperators.java
Usage:
log1p(n)
Description: Returns the first day of the month from the given date.
Source: DateTimeOperators.java
Usage:
Entity.date.firstOfMonth()
Description: Determine the number of "working" hours between the two date [startDate, endDate] that fall between the start and close business times [beginHour, endHour], excluding Saturday & Sunday. The beginHour and endHour are integers 0-23 [24 hr clock].
Source: DateTimeOperators.java
Usage:
workingHoursBetween(startDate, endDate, beginHour, endHour)