Skip Headers
Oracle® Fusion Middleware User's Guide for Oracle Business Rules
11g Release 1 (11.1.1.7)

Part Number E10228-12
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

B Oracle Business Rules Built-in Classes and Functions

This appendix discusses the extensive library of Oracle Business Rules (OBR) built-in classes, methods, and functions that help reasoning about data containing text strings, lists, numbers, dates, times, and so on.

In the following sections, there are multiple tables whose each row has a Kind column that is either Cl, Co, M, sM, P, or sP (Class, Constructor, Method, static Method, Property, or static Property (Java static final field) respectively). The first row in each table specifies the class. When the Java Name is the same as the OBR Name (the rule SDK terms it the Alias), a '-' is displayed. The Signature column provides type information for methods, functions, and properties. The signature of a property is actually the type, for example BigDecimal. The signature of a method or function is of the form return(arg1,arg2,...), where return is the return type and arg1,arg2,... are the argument types.

This appendix covers the following sections:

B.1 String Classes

This section covers the String-related classes provided by Oracle Business Rules.

Table B-1 lists the String class.

Table B-1 The String Class

OBR Name Kind Signature Java Name Description Reference

String

Cl

-

java.lang.String

Java immutable character strings. Beware, Java uses 0-based indexing for characters in strings, and XML uses 1-based indexing

http://java.sun.com/javase/6/docs/api/java/lang/String.html

charAt

S

char(int)

-

Returns the char value at 0-based index arg1. "Oracle".charAt(2)=='a'.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#charAt%28int%29

compareTo

M

int(String)

-

Returns the value 0 if the argument string is equal to this string; a value less than 0 if this string is lexicographically less than the string argument; and a value greater than 0 if this string is lexicographically greater than the string argument. "a".compareTo("b")<0.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#compareTo%28java.lang.String%29

contains

M

boolean(String)

-

Tests whether this string contains arg1. "Oracle".contains("rac")==true.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#contains%28java.lang.CharSequence%29

endsWith

M

boolean(String)

-

Tests whether this string ends with arg1. "Oracle".endsWith("le")==true.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#endsWith%28java.lang.String%29

equalsIgnoreCase

M

boolean(String)

-

Tests whether this string equals arg1, ignoring case consideration. "Oracle".equalsIgnoreCase("oRaClE")==true.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#equalsIgnoreCase%28java.lang.String%29

indexOf

M

int(String,int)

-

Returns the 0-based index of the start of arg1 within this String, but not before the 0-based index arg2. "banana".indexOf("an",2)==3.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#indexOf%28java.lang.String,%20int%29

lastIndexOf

M

int(String,int)

-

Returns the 0-based index within this string of the last occurrence of arg1, searching backward starting at the index arg2. "banana".lastIndexOf("an","banana".length())==3.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#lastIndexOf%28java.lang.String,%20int%29

length

M

int

-

Returns the length of this string. "Oracle".length()==6.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#length%28%29

matches

M

boolean(String)

-

Tests if this string matches the given regular expression. "banana".matches("^b.*a$")==true.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#matches%28java.lang.String%29

replaceAll

M

String(String,String)

-

Replaces each substring of this string that matches arg1 (a regular expression) with arg2. "banana".replaceAll(".a","xo")=="xoxoxo".

http://java.sun.com/javase/6/docs/api/java/lang/String.html#replaceAll%28java.lang.String,%20java.lang.String%29

replaceFirst

M

String(String,String)

-

Replaces first substring of this string that matches arg1 (a regular expression) with arg2. "banana".replaceFirst(".a","xo")=="xonana".

http://java.sun.com/javase/6/docs/api/java/lang/String.html#replaceFirst%28java.lang.String,%20java.lang.String%29

startsWith

M

boolean(String)

-

Tests whether this string starts with arg1. "Oracle".startsWith("Or")==true.

http://java.sun.com/javase/6/docs/api/java/lang/String.html#startsWith%28java.lang.String%29

substring

M

String(int,int)

-

Returns the substring of this string, starting with the 0-based index arg1, and ending before the 0-based index arg2. "Oracle".substring(1,4)=="rac".

http://java.sun.com/javase/6/docs/api/java/lang/String.html#substring%28int,%20int%29

toLowerCase

M

String()

-

Converts this string to lower case. "Oracle".toLowerCase()=="oracle".

http://java.sun.com/javase/6/docs/api/java/lang/String.html#toLowerCase%28%29

toUpperCase

M

String()

-

Converts this string to upper case. "Oracle".toUpperCase()=="ORACLE".

http://java.sun.com/javase/6/docs/api/java/lang/String.html#toUpperCase%28%29

trim

M

String()

-

Removes leading and trailing whitespace. " Oracle ".trim()=="Oracle".

http://java.sun.com/javase/6/docs/api/java/lang/String.html#trim%28%29


Table B-2 lists the RL class strings methods.

Table B-2 The RL Class String Methods

OBR Name Kind Signature Java Name Description Reference

RL

Cl

-

oracle.rules.rl.extensions.RL

Supplement standard Java classes with W3C RIF functionality.

http://www.w3.org/TR/rif-dtb/

string.join

sM

String(String...)

stringJoin

Concatenates first n-1 args using the last arg as a separator. RL.string.join("a","b","c","#")=="a#b#c".

http://www.w3.org/TR/rif-dtb/#func:string-join

string.substring

sM

String(String,int,int)

substring

Returns the substring of arg1, beginning at the 1-based index arg2, and continuing for arg3 characters. RL.string.substring("Oracle",2,3)=="rac".

http://www.w3.org/TR/rif-dtb/#func:substring

string.suffix

sM

String(String,int)

substring

Returns the suffix of arg1, beginning at the 1-based index arg2. RL.string.suffix("Oracle",5)=="le".

http://www.w3.org/TR/rif-dtb/#func:substring

string.substring before

sM

String(String,String)

substringBefore

Returns the substring of arg1 that occurs before arg2. RL.string.substring before("Oracle","ac")=="Or".

http://www.w3.org/TR/rif-dtb/#func:substring-before

string.substring after

sM

String(String,String)

substringAfter

Returns the substring of arg1 that occurs after arg2. RL.string.substring after("Oracle","ac")=="le".

http://www.w3.org/TR/rif-dtb/#func:substring-after

string.iri.encode path

sM

String(String)

encodeForURI

Encodes characters not permitted in an URI path. RL.string.iri encode path("Oracle Business Rules")=="Oracle%20Business%20Rules".

http://www.w3.org/TR/rif-dtb/#func:encode-for-uri

string.iri.to uri

sM

String(String)

iriToUri

Encodes some characters not permitted in a URI. RL.string.iri to uri("http://www.example.com/~bébé")=="http://www.example.com/~b%C3%A9b%C3%A9"

http://www.w3.org/TR/rif-dtb/#func:iri-to-uri

string.iri.to ascii

sM

String(String)

escapeHtmlUri

Encodes non-ascii characters. RL.string.iri to ascii("javascript:if (navigator.browserLanguage == 'fr') window.open('http://www.example.com/~bébé');")=="javascript:if (navigator.browserLanguage == 'fr') window.open('http://www.example.com/~b%C3%A9b%C3%A9');"

http://www.w3.org/TR/rif-dtb/#func:escape-html-uri

string.is normalized

sM

boolean(String)

isNormalizedString

A normalized string does not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters. RL.string.is normalized(" Business Rules ")==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

string.is token

sM

boolean(String)

isToken

A token is a normalized string with no leading or trailing spaces, and no double spaces. RL.string.is token("Business Rules")==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

string.is language

sM

boolean(String)

isLanguage

A language identifier. RL.string.is language("en")==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

string.is Name

sM

boolean(String)

isName

A name is a token with no spaces (and some other constraints on its characters). RL.string.is Name("xs:Name")==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

string.is NCName

sM

boolean(String)

isNCName

A non-colonized name. RL.string.is NCName("xs:NCName")==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

string.is NMTOKEN

sM

boolean(String)

isNMTOKEN

An NMTOKEN is a Name with no restriction on the initial character. RL.string.is NMTOKEN("-Oracle")==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

string.compare

sM

int(String,String)

compare

Returns -1, 0, or 1 if arg1<arg2, arg1==arg2, or arg1>arg2, respectively. RL.string.compare("foo","bar")==1.

http://www.w3.org/TR/rif-dtb/#func:compare_.28adapted_from_fn:compare.29


B.2 List Classes

This section covers the List classes provided by Oracle Business Rules.

Table B-3 lists the List class.

Table B-3 The List Class

OBR Name Kind Signature Java Name Description Reference

List

Cl

-

java.util.List

Represents mutable and immutable lists. Lists use 0-based indexes. Attempts to modify an immutable list may result in UnsupportedOperationExceptions.

http://java.sun.com/javase/6/docs/api/java/util/List.html

append

M

void(Object)

add

Appends arg1 to this list. Modifies this list.

http://java.sun.com/javase/6/docs/api/java/util/List.html#add(E)

add

M

void(int,Object)

-

Inserts arg2 into this list at position arg1. Modifies this list.

http://java.sun.com/javase/6/docs/api/java/util/List.html#add(int,%20E)

appendAll

M

void(java.util.Collection)

addAll

Appends the contents of arg1 to this list. Modifies this list.

http://java.sun.com/javase/6/docs/api/java/util/List.html#addAll(java.util.Collection)

addAll

M

void(int,java.util.Collection)

-

Inserts the contents of arg2 into this list at position arg1. Modifies this list.

http://java.sun.com/javase/6/docs/api/java/util/List.html#addAll(int,%20java.util.Collection)

clear

M

void()

-

Removes the contents of this list. Modifies this list.

http://java.sun.com/javase/6/docs/api/java/util/List.html#clear()

contains

M

boolean(Object)

-

Tests whether this list contains arg1. RL.list.create(1,2,3).contains(2)==true.

http://java.sun.com/javase/6/docs/api/java/util/List.html#contains(java.lang.Object)

containsAll

M

boolean(java.util.Collection)

-

Tests whether this list contains every element in arg1. RL.list.create(1,2,3).containsAll(RL.list.create(3,2,1))==true.

http://java.sun.com/javase/6/docs/api/java/util/List.html#containsAll(java.util.Collection)

get

M

Object(int)

-

Get the element at position arg1. RL.list.create(1,2,3).get(1)==2.

http://java.sun.com/javase/6/docs/api/java/util/List.html#get(int)

indexOf

M

int(Object)

-

Returns first index of arg1 in this list. RL.list.create(1,2,3).indexOf(2)==1.

http://java.sun.com/javase/6/docs/api/java/util/List.html#indexOf(java.lang.Object)

remove

M

boolean(Object)

-

Removes first occurrence of arg1 from this list. Returns whether this list was modified.

http://java.sun.com/javase/6/docs/api/java/util/List.html#remove(java.lang.Object)

remove by index

M

Object(int)

remove

Removes and return the element at position arg1. Modifies this list.

http://java.sun.com/javase/6/docs/api/java/util/List.html#remove(int)

removeAll

M

boolean(java.util.Collection)

-

Removes all elements from this list that are contained in arg1. Returns whether this list was modified.

http://java.sun.com/javase/6/docs/api/java/util/List.html#removeAll(java.util.Collection)

retainAll

M

boolean(java.util.Collection)

-

Removes all elements from this list that are *not* contained in arg1. Returns whether this list was modified.

http://java.sun.com/javase/6/docs/api/java/util/List.html#retainAll(java.util.Collection)

set

M

Object(int,Object)

-

Replaces the item in this list at position arg1 with arg2. Returns the replaced item. Modifies this list.

http://java.sun.com/javase/6/docs/api/java/util/List.html#set(int,%20E)

size

M

int()

-

Returns the size of this list. RL.list.create(1,2,3).size()==3.

http://java.sun.com/javase/6/docs/api/java/util/List.html#size()

subList

M

List(int,int)

-

Returns a view of the portion of this list between arg1, inclusive, and arg2, exclusive. RL.list.create(1,2,3,4).subList(1,3)==RL.list.create(2,3).

http://java.sun.com/javase/6/docs/api/java/util/List.html#subList(int,%20int)


Table B-4 lists the RL class list methods.

Table B-4 The RL Class List Methods

OBR Name Kind Signature Java Name Description Reference

RL

Cl

-

oracle.rules.rl.extensions.RL

-

-

list.append

sM

List(List,Object...)

append

Returns a new immutable list containing the contents of arg1, followed by arg2, arg3, ... RL.list.append(RL.list.create(1),2,3)==RL.list.create(1,2,3).

http://www.w3.org/TR/rif-dtb/#func:append

list.concatenate

sM

List(List...)

concatenate

Returns a new immutable list containing the concatenation of arg1, arg2, ... RL.list.concatenate(RL.list.create(1),RL.list.create(2))==RL.list.create(1,2).

http://www.w3.org/TR/rif-dtb/#func:concatenate

list.distinct values

sM

List(List)

distinctValues

Returns a new immutable list like arg1 but with duplicates removed. RL.list.distinct values(RL.list.create(2,2))==RL.list.create(2).

http://www.w3.org/TR/rif-dtb/#func:distinct-values

list.except

sM

List(List,List)

except

Returns a new immutable list containing elements from arg1 that are not in arg2. RL.list.except(RL.list.create(1,2,3,4),RL.list.create(1,3))==RL.list.create(2,4).

http://www.w3.org/TR/rif-dtb/#func:except

list.get

sM

Object(List,int)

get

Returns the element at position arg2 in arg1. If arg2<0, return the element at arg1.size()+arg2. RL.list.get(RL.list.create(1,2,3),-1)==3.

http://www.w3.org/TR/rif-dtb/#func:get

list.index of

sM

List<Integer>(List,Object)

indexOf

Returns a list of indexes where the arg2 occurs in arg1. RL.list.index of(RL.list.create(1,2,3,2),2)==RL.list.create(1,3).

http://www.w3.org/TR/rif-dtb/#func:index-of

list.insert before

sM

List(List,int,Object)

insertBefore

Returns a new immutable list containing arg1 with arg3 inserted before the item at position arg2. If arg2<0, arg3 is inserted before the element at arg1.size()+arg2. RL.list.insert before(RL.list.create(1,2,3),-1,99)==RL.list.create(1,2,99,3).

http://www.w3.org/TR/rif-dtb/#func:insert-before

list.intersect

sM

List(List,List)

intersect

Returns a new immutable list containing the intersection of arg1 and arg2. RL.list.intersect(RL.list.create(1,2,3),RL.list.create(3,1))==RL.list.create(1,3).

http://www.w3.org/TR/rif-dtb/#func:intersect

list.create

sM

List(Object...)

list

Returns a new immutable list containing the arguments.

http://www.w3.org/TR/rif-dtb/#func:make-list

list.remove

sM

List(List,int)

remove

Returns a new immutable list containing the elements of arg1, with the element at position arg2 removed. If arg2<0, the element at arg1.size()+arg2 is removed. RL.list.remove(RL.list.create(1,2,3),0)==RL.list.create(2,3).

http://www.w3.org/TR/rif-dtb/#func:remove

list.reverse

sM

List(List)

reverse

Returns a new immutable list containing the elements of arg1 in reverse order. RL.list.reverse(RL.list.create(1,2,3))==RL.list.create(3,2,1).

http://www.w3.org/TR/rif-dtb/#func:reverse

list.union

sM

List(List)

union

Returns a new immutable list containing the concatenation of the arguments with duplicates removed. RL.list.union(RL.list.create(1,2),RL.list.create(2,3))==RL.list.create(1,2,3).

http://www.w3.org/TR/rif-dtb/#func:union


B.3 Numeric Classes

Oracle Business Rules support the primitive Java numeric types byte, short, int, long, float, and double. OBR also supports the "boxed" versions: Short, Int, Long, Float, and Double. Unlimited precision integers and decimals are supported, using the Java classes BigInteger and BigDecimal. OBR supports arithmetic expressions (+, -, *, /, **) on all numeric types. For example, if *bd is BigDecimal, then you can add one to it by simply writing bd + 1. You do not have to write bd.add(BigDecimal.ONE).

Table B-5 lists the Integer class.

Table B-5 The Integer Class

OBR Name Kind Signature Java Name Description Reference

Integer

Cl

-

java.lang.Integer

An integer object. Unlike the primitive "int", an Integer can be null and can be in Lists.

http://java.sun.com/javase/6/docs/api/java/lang/Integer.html

Integer

Co

Integer(int|String)

-

Creates an Integer from an int or from its lexical representation as a String. new Integer(1)==new Integer("1").

http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#Integer(int)

MIN_VALUE

sP

int

-

Smallest primitive int value. Integer.MIN_VALUE<0.

http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#MIN_VALUE

MAX_VALUE

sP

int

-

Largest primitive int value. Integer.MAX_VALUE>0.

http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#MAX_VALUE

intValue

M

int()

-

Converts this Integer to an int. new Integer(1).intValue()==1.

http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#intValue()

toString

M

String()

-

Converts this Integer to its lexical representation. new Integer(1).toString()=="1".

http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#toString()


Table B-6 lists the Long class.

Table B-6 The Long Class

OBR Name Kind Signature Java Name Description Reference

Long

Cl

-

java.lang.Long

A long integer object. Unlike the primitive "long", a Long can be null and can be in Lists.

http://java.sun.com/javase/6/docs/api/java/lang/Long.html

Long

Co

Long(long|String)

-

Creates a Long from a long or from its lexical representation as a String. new Long(1)==new Long("1").

http://java.sun.com/javase/6/docs/api/java/lang/Long.html#Long(long)

MIN_VALUE

sP

long

-

Smallest primitive long value. Long.MIN_VALUE<0.

http://java.sun.com/javase/6/docs/api/java/lang/Long.html#MIN_VALUE

MAX_VALUE

sP

long

-

Largest primitive long value. Long.MAX_VALUE>0.

http://java.sun.com/javase/6/docs/api/java/lang/Long.html#MAX_VALUE

longValue

M

long()

-

Converts this Long to a long. new Long(1).longValue()==1.

http://java.sun.com/javase/6/docs/api/java/lang/Long.html#longValue()

toString

M

String()

-

Converts this Long to its lexical representation. new Long(1).toString()=="1".

http://java.sun.com/javase/6/docs/api/java/lang/Long.html#toString()


Table B-7 lists the Short class.

Table B-7 The Short Class

OBR Name Kind Signature Java Name Description Reference

Short

Cl

-

java.lang.Short

A short integer object. Unlike the primitive "short", a Short can be null and can be in Lists.

http://java.sun.com/javase/6/docs/api/java/lang/Short.html

Short

Co

Short(short|String)

-

Creates a Short from a short or from its lexical representation as a String. new Short(1)==new Short("1").

http://java.sun.com/javase/6/docs/api/java/lang/Short.html#Short(short)

MIN_VALUE

sP

short

-

Smallest primitive short value. Short.MIN_VALUE<0.

http://java.sun.com/javase/6/docs/api/java/lang/Short.html#MIN_VALUE

MAX_VALUE

sP

short

-

Largest primitive short value. Short.MAX_VALUE>0.

http://java.sun.com/javase/6/docs/api/java/lang/Short.html#MAX_VALUE

shortValue

M

short()

-

Converts this Short to a short. new Short(-1).shortValue()==-1.

http://java.sun.com/javase/6/docs/api/java/lang/Short.html#shortValue()

toString

M

String()

-

Converts this Short to its lexical representation. new Short(-1).toString()=="-1".

http://java.sun.com/javase/6/docs/api/java/lang/Short.html#toString()


Table B-8 lists the Float class.

Table B-8 The Float Class

OBR Name Kind Signature Java Name Description Reference

Float

Cl

-

java.lang.Float

A Float object. Unlike the primitive "float", a Float can be null and can be in Lists.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html

Float

Co

Float(float|double|String)

-

Creates a Float from a float, a double, or from its lexical representation as a String. new Float(1.1)==new Float("1.1").

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#Float(float)

infinite

P

boolean

-

The value of this Float is infinity. new Float(Float.NEGATIVE_INFINITY).infinite==true.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#isInfinite()

naN

P

boolean

-

The value of this Float is not a number. new Float(Float.NaN).naN==true.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#isNaN()()

NaN

sP

float

-

Value representing "not a number".

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#NaN

NEGATIVE_INFINITY

sP

float

-

Value representing negative infinity.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#NEGATIVE_INFINITY

POSITIVE_INFINITY

sP

float

-

Value representing positive infinity.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#POSITIVE_INFINITY

floatValue

M

float()

-

Converts this Float to a float. new Float(1.1f).floatValue()==1.1f.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#floatValue()

toString

M

String()

-

Converts this Float to its lexical representation. new Float(1.1f).toString()=="1.1".

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#toString()


Table B-9 lists the Double class.

Table B-9 The Double Class

OBR Name Kind Signature Java Name Description Reference

Double

Cl

-

java.lang.Double

A Double object. Unlike the primitive "double", a Double can be null and can be in Lists.

http://java.sun.com/javase/6/docs/api/java/lang/Double.html

Double

Co

Double(double|String)

-

Creates a Double from a double or from its lexical representation as a String. new Double(1.1)==new Double("1.1").

http://java.sun.com/javase/6/docs/api/java/lang/Double.html#Double(double)

infinite

P

boolean

-

The value of this Double is infinity. new Float(Float.POSITIVE_INFINITY).infinite==true.

http://java.sun.com/javase/6/docs/api/java/lang/Double.html#isInfinite()

naN

P

boolean

-

The value of this Double is not a number. new Double(double.NaN).naN==true.

http://java.sun.com/javase/6/docs/api/java/lang/Double.html#isNaN()

NaN

sP

double

-

Value representing "not a number".

http://java.sun.com/javase/6/docs/api/java/lang/Double.html#NaN

NEGATIVE_INFINITY

sP

double

-

Value representing negative infinity.

http://java.sun.com/javase/6/docs/api/java/lang/Double.html#NEGATIVE_INFINITY

POSITIVE_INFINITY

sP

double

-

Value representing positive infinity.

http://java.sun.com/javase/6/docs/api/java/lang/Double.html#POSITIVE_INFINITY

doubleValue

M

double()

-

Converts this Double to a double. new Double(1.1).doubleValue()==1.1.

http://java.sun.com/javase/6/docs/api/java/lang/Double.html#doubleValue()

toString

M

String()

-

Converts this Double to its lexical representation. new Double(1.1).toString()=="1.1".

http://java.sun.com/javase/6/docs/api/java/lang/Double.html#toString()


Table B-10 lists the BigInteger class.

Table B-10 The BigInteger Class

OBR Name Kind Signature Java Name Description Reference

BigInteger

Cl

-

java.math.BigInteger

Immutable arbitrary-precision integers.

http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html

BigInteger

Co

BigInteger(String)

-

Creates a BigInteger from its lexical representation as a String. new BigInteger("1")==1.

http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html#BigInteger(java.lang.String)

doubleValue

M

double()

-

Converts this BigInteger to a double. May lose precision. new BigInteger("1").doubleValue()==1.0.

http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html#doubleValue()

longValue

M

long()

-

Converts this BigInteger to a long. May lose precision. new BigInteger("1").longValue()==1L.

http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html#longValue()

max

M

BigInteger(BigInteger)

-

Returns the greater of this or arg1. new BigInteger("1").max(2)==2.

http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html#max(java.math.BigInteger)

min

M

BigInteger(BigInteger)

-

Returns the lesser of this or arg1. new BigInteger("1").min(2)==1.

http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html#min(java.math.BigInteger)

toString

M

String()

-

Returns the lexical representation of this BigInteger. new BigInteger("123").toString()=="123".

http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html#toString()

valueOf

sM

BigInteger(long)

-

Converts arg1 (a long) to a BigInteger. BigInteger.valueOf(123).toString()=="123".

http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html#valueOf(long)


Table B-11 lists the BigDecimal class.

Table B-11 The BigDecimal Class

OBR Name Kind Signature Java Name Description Reference

BigDecimal

Cl

-

java.math.BigDecimal

Immutable, arbitrary-precision signed decimal numbers.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html

BigDecimal

Co

BigDecimal(long|double|String)

-

Creates a BigDecimal from a long, a double, or from its lexical representation as a String. new BigDecimal(1.1)==new BigDecimal("1.1").

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#BigDecimal(java.lang.String)

BigDecimal

Co

BigDecimal(BigInteger,int)

-

Creates a BigDecimal from BigInteger arg1 and scale arg2. new BigDecimal(new BigInteger("123"),2)==1.23.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#BigDecimal(java.math.BigInteger,%20int)

doubleValue

M

double()

-

Converts this BigDecimal to a double. May lose precision. new BigDecimal("0.1").doubleValue()==0.1.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#doubleValue()

longValue

M

long()

-

Converts this BigDecimal to a long. May lose precision. new BigDecimal("0.1").longValue()==0L.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#longValue()

max

M

BigDecimal(BigDecimal)

-

Returns the greater of this BigDecimal or arg1. new BigDecimal("0.1").max(0.2)==0.2.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#max(java.math.BigDecimal)

min

M

BigDecimal(BigDecimal)

-

Returns the lesser of this BigDecimal or arg1. new BigDecimal("0.1").min(0.2)==0.1.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#min(java.math.BigDecimal)

scale

M

int()

-

Returns the scale--the number of digits to the right of the decimal point. new BigDecimal("1.00").scale()==2.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#scale()

setScale

M

BigDecimal(int)

-

Sets the scale, but don't change the value. new BigDecimal("1").setScale(2).toString()=="1.00".

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#setScale(int)

toEngineeringString

M

String()

-

Returns the literal representation of this BigDecimal using engineering notation if an exponent is needed. new BigDecimal("123E2").toEngineeringString()=="12.3E+3".

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#toEngineeringString()

toPlainString

M

String

-

Returns the literal representation of this BigDecimal without exponents. new BigDecimal("123E2").toPlainString()=="12300".

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#toPlainString()

valueOf

sM

BigDecimal(long|double)

-

Converts arg1 (a long or double) to a BigDecimal. new BigDecimal(1.3)==BigDecimal.valueOf(1.3).

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#valueOf(double)

ROUND_UP

sP

int

-

Used with divide. new BigDecimal("11").divide(2,BigDecimal.ROUND_UP)==6.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#ROUND_UP

ROUND_DOWN

sP

int

-

Used with divide. new BigDecimal("11").divide(2,BigDecimal.ROUND_DOWN)==5.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#ROUND_DOWN

divide

M

BigDecimal(BigDecimal,int)

-

Returns this/arg1 with scale the same as this BigDecimal. If rounding must be performed to stay within the result scale, use the rounding mode given by arg2 (ROUND_UP or ROUND_DOWN). new BigDecimal("11").divide(2,BigDecimal.ROUND_UP)==6.

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#divide(java.math.BigDecimal,%20int)


Table B-12 lists the Number class.

Table B-12 The Number Class

OBR Name Kind Signature Java Name Description Reference

Number

Cl

-

-

Base class of all numerics (except primitives).

http://java.sun.com/javase/6/docs/api/java/lang/Number.html

doubleValue

M

double()

-

Converts this number to a double.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#doubleValue()

floatValue

M

float()

-

Converts this number to a float.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#floatValue()

intValue

M

int()

-

Converts this number to a int.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#intValue()

longValue

M

long()

-

Converts this number to a long.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#longValue()

shortValue

M

short()

-

Converts this number to a short.

http://java.sun.com/javase/6/docs/api/java/lang/Float.html#shortValue()


Table B-13 lists the RL class number methods.

Table B-13 The RL Class Number Methods

OBR Name Kind Signature Java Name Description Reference

RL

Cl

-

oracle.rules.rl.extensions.RL

-

-

number.is byte

sM

boolean(Number)

isByte

arg1 is integral and -128<=arg1<=127. RL.numeric.is byte(200)==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is short

sM

boolean(Number)

isShort

arg1 is integral and -32768<=arg1<=32767. RL.numeric.is short(0.1)==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is int

sM

boolean(Number)

isInt

arg1 is integral and -2147483648<=arg1<=2147483647. RL.numeric.is int(-1000)==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is long

sM

boolean(Number)

isLong

arg1 is integral and -9223372036854775808<=arg1<=9223372036854775807. RL.numeric.is integer(new BigInteger("100")**100)==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is integer

sM

boolean(Number)

isInteger

arg1 is integral. RL.numeric.is integer(new BigInteger("100")**100)==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is decimal

sM

boolean(Number)

isDecimal

arg1 is neither Double nor Float. RL.numeric.is decimal(1.1)==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is non-negative integer

sM

boolean(Number)

isNonNegativeInteger

arg1 is integral and arg1>=0. RL.numeric.is non-negative integer(-1)==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is negative integer

sM

boolean(Number)

isNegativeInteger

arg1 is integral and arg1<0. RL.numeric.is negative integer(-1)==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is non-positive integer

sM

boolean(Number)

isNonPositiveInteger

arg1 is integral and arg1<=0. RL.numeric.is non-positive integer(-1)==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is positive integer

sM

boolean(Number)

isPositiveInteger

arg1 is integral and arg1>0. RL.numeric.is positive integer(-1)==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is unsigned byte

sM

boolean(Number)

isUnsignedByte

arg1 is integral and 0<=arg1<=255. RL.numeric.is unsigned byte(200)==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is unsigned short

sM

boolean(Number)

isUnsignedShort

arg1 is integral and 0<=arg1<=65535. RL.numeric.is unsigned short(0.1)==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is unsigned int

sM

boolean(Number)

isUnsignedInt

arg1 is integral and 0<=arg1<=4294967295. RL.numeric.is unsigned int(-1000)==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

number.is unsigned long

sM

boolean(Number)

isUnsignedLong

arg1 is integral and 0<=arg1<=18446744073709551615.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes


B.4 Time and Duration Classes

This section lists the time and duration classes provided by Oracle Business Rules.

Table B-14 lists the Calendar class.

Table B-14 The Calendar Class

OBR Name Kind Signature Java Name Description Reference

Calendar

Cl

-

java.util.Calendar

A Calendar represents a datetime and timezone. A calendar instance has a number of mutable int fields. The first argument to add, get, isSet, roll, and set is a field number. This class provides a number of static properties that should be used for the field numbers.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html

ERA

sP

int

-

Field number for the Calendar era. 1 is for A.D. and 0 is for B.C. ((Calendar)"2010-02-01").get(Calendar.ERA)==1.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#ERA

YEAR

sP

int

-

Field number for the Calendar year. ((Calendar)"2010-02-01").get(Calendar.YEAR)==2010.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#YEAR

MONTH

sP

int

-

Field number for the Calendar month. Months are 0-based. ((Calendar)"2010-02-01").get(Calendar.MONTH)==1.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#MONTH

WEEK_OF_YEAR

sP

int

-

Field number for the Calendar week. ((Calendar)"2010-02-01").get(Calendar.WEEK_OF_YEAR)==6.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#WEEK_OF_YEAR

DAY_OF_YEAR

sP

int

-

Field number for the Calendar day of year. ((Calendar)"2010-02-01").get(Calendar.DAY_OF_YEAR)==32.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#DAY_OF_YEAR

DAY_OF_MONTH

sP

int

-

Field number for the Calendar day of month. ((Calendar)"2010-02-01").get(Calendar.DAY_OF_MONTH)==1.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#DAY_OF_MONTH

DAY_OF_WEEK

sP

int

-

Field number for the Calendar day of the week. ((Calendar)"2010-02-01").get(Calendar.DAY_OF_WEEK)==2.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#DAY_OF_WEEK

HOUR

sP

int

-

Field number for the Calendar hour, 12 hour format. ((Calendar)"2010-02-01T20:15:10").get(Calendar.HOUR)==8.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#HOUR

AM_PM

sP

int

-

Field number for the Calendar AM_PM flag. 0 is for AM and 1 is for PM. ((Calendar)"2010-02-01T20:15:10").get(Calendar.AM_PM)==1.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#AM_PM

HOUR_OF_DAY

sP

int

-

Field number for the Calendar hour, 24 hour format. ((Calendar)"20:15:10").get(Calendar.HOUR)==20.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#HOUR_OF_DAY

MINUTE

sP

int

-

Field number for the Calendar minutes. JavaDate.from time string("20:15:10").get(Calendar.MINUTE)==15.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#MINUTE

SECOND

sP

int

-

Field number for Calendar seconds. ((Calendar)"20:15:10").get(Calendar.SECOND)==10.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#SECOND

ZONE_OFFSET

sP

int

-

Field number for timezone. Value is millsecond offset from GMT. ((Calendar)"20:15:10-05:30").get(Calendar.ZONE_OFFSET)==-(5*3600+30*60)*1000.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#ZONE_OFFSET

add

M

void(int,int)

add

Adds the amount of time specified by arg2 to the calendar field specified by arg1. Modifies this Calendar.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#add(int,%20int)

clear

M

void()

clear

Clears (unset all fields in) this Calendar. Modifies this Calendar.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#clear()

get

M

int(int)

get

Gets the value of the field specified by field number arg1. ((Calendar)"20:15:10").get(Calendar.SECOND)==10.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#get(int)

getInstance

sM

Calendar()

getInstance

Gets a calendar initialized to the current time in the default time zone and locale.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#getInstance()

roll

M

void(int,int)

roll

Adds the amount of time specified by arg2 to the calendar field specified by arg1. Does not affect any other calendar field. Modifies this Calendar.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#roll(int,%20int)

set

M

void(int,int)

set

Sets the calendar field specified by arg1 to the value specified by arg2. Modifies this Calendar.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#set(int,%20int)

time

P

java.util.Date

time

Returns a Date object representing this Calendar's time value. ((Calendar)"2010-02-01").time<((Calendar)"2010-02-02").time.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#getTime()

timeInMillis

P

long

timeInMillis

Returns this Calendar's time value in milliseconds. ((Calendar)"2010-02-01").timeInMillis<((Calendar)"2010-02-02").timeInMillis.

http://java.sun.com/javase/6/docs/api/java/util/Calendar.html#getTimeInMillis()


Table B-15 lists the JavaDate class.

Table B-15 The JavaDate Class

OBR Name Kind Signature Java Name Description Reference

JavaDate

Cl

-

oracle.rules. rl. extensions.JavaDate

Helper class for working with Calendars as immutable objects. Treating Calendars as immutable objects can help prevent errors.

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/JavaDate.html

add years to

sM

Calendar(Calendar, int)

addYearsTo

Returns a new Calendar that is arg2 years later than arg1. JavaDate.add years to("2009-01-01",1)=="2010-01-01".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/JavaDate.html#addYearsTo_java_util_Calendar__int_

add months to

sM

Calendar(Calendar, int)

addMonthsTo

Returns a new Calendar that is arg2 months later than arg1. JavaDate.add months to("2009-01-01",1)=="2009-02-01".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#addMonthsTo_java_util_Calendar__int_

add weeks to

sM

Calendar(Calendar,int)

addWeeksTo

Returns a new Calendar that is 7*arg2 days later than arg1. JavaDate.add weeks to("2009-01-01",1)=="2009-01-08".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#addWeeksTo_java_util_Calendar__int_

add days to

sM

Calendar(Calendar,int)

addDaysTo

Returns a new Calendar that is arg2 days later than arg1. JavaDate.add days to("2009-01-01",1)=="2009-01-02".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#addDaysTo_java_util_Calendar__int_

add hours to

sM

Calendar(Calendar,int)

addHoursTo

Returns a new Calendar that is arg2 hours later than arg1. JavaDate.add hours to("01:01:01",1)=="02:01:01".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#addHoursTo_java_util_Calendar__int_

add minutes to

sM

Calendar(Calendar,int)

addMinutesTo

Returns a new Calendar that is arg2 minutes later than arg1. JavaDate.add minutes to("01:01:01",1)=="01:02:01".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#addMinutesTo_java_util_Calendar__int_

add seconds to

sM

Calendar(Calendar,int)

addSecondsTo

Returns a new Calendar that is arg2 seconds later than arg1. JavaDate.add seconds to("01:01:01",61)=="01:02:02".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#addSecondsTo_java_util_Calendar__int_

add milliseconds to

sM

Calendar(Calendar,int)

addMillisecondsTo

Returns a new Calendar that is arg2 milliseconds later than arg1. JavaDate.add milliseconds to("01:01:01",61)=="01:01:01.061".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#addMillsecondsTo_java_util_Calendar__int_

add duration to

sM

Calendar(Calendar,XMLDuration)

addDurationTo

Returns a new Calendar that is later than arg1 by the duration arg2. JavaDate.add duration to("2009-12-30T23:59:00",Duration.from string("P1DT1M"))=="2010-01-01".

http://www.w3.org/TR/rif-dtb/#func:add-day TimeDuration-to-dateTime_.28adapted_from_op: add-dayTimeDuration-to-dateTime.29

http://www.w3.org/TR/rif-dtb/#func: add-yearMonthDuration-to-dateTime_.28adapted_from_op: add-yearMonthDuration-to-dateTime.29

from date string

sM

Calendar(String)

fromDateString

Creates a Calendar for the extended ISO 8601 date literal arg1. Extended to allow YYYY-MM-DD@TimeZoneId. JavaDate.from date string("2010-02-06@PST")=="2010-02-06-08:00".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#fromDateString_java_lang_String_

from datetime string

sM

Calendar(String)

fromDateTimeString

Creates a Calendar for the extended ISO 8601 datetime literal arg1. Extended to allow YYYY-MM-DDTHH:MM:SS@TimeZoneId. JavaDate.from datetime string("2010-02-06T14:15:00@PST")=="2010-02-06T14:15:00-08:00".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#fromDateTimeString_java_lang_String_

from time string

sM

Calendar(String)

fromTimeString

Creates a Calendar for the extended ISO 8601 time literal arg1. Extended to allow HH:MM:SS@TimeZoneId. Warning: the date portion of the Calendar will be initialized to the current date. JavaDate.from time string("14:15:00@PST")=="14:15:00-08:00".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#fromTimeString_java_lang_String_

subtract years from

sM

Calendar(Calendar,int)

subtractYearsFrom

Returns a new Calendar that is arg2 years earlier than arg1. JavaDate.subtract years from("2009-01-01",1)=="2008-01-01".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#subtractYearsFrom_java_util_Calendar__int_

subtract months from

sM

Calendar(Calendar,int)

subtractMonthsFrom

Returns a new Calendar that is arg2 months earlier than arg1. JavaDate.subtract months from("2009-01-01",1)=="2008-12-01".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#subtractMonthsFrom_java_util_Calendar__int_

subtract weeks from

sM

Calendar(Calendar,int)

subtractWeeksFrom

Returns a new Calendar that is 7*arg2 days earlier than arg1. JavaDate.subtract weeks from("2009-01-01",1)=="2008-12-25".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#subtractWeeksFrom_java_util_Calendar__int_

subtract days from

sM

Calendar(Calendar,int)

subtractDaysFrom

Returns a new Calendar that is arg2 days earlier than arg1. JavaDate.subtract days from("2009-01-01",1)=="2008-12-31".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#subtractDaysFrom_java_util_Calendar__int_

subtract hours from

sM

Calendar(Calendar,int)

subtractHoursFrom

Returns a new Calendar that is arg2 hours earlier than arg1. JavaDate.subtract hours from("01:01:01",1)=="00:01:01".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#subtractHoursFrom_java_util_Calendar__int_

subtract minutes from

sM

Calendar(Calendar,int)

subtractMinutesFrom

Returns a new Calendar that is arg2 minutes earlier than arg1. JavaDate.subtract minutes from("01:01:01",1)=="01:00:01".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#subtractMinutesFrom_java_util_Calendar__int_

subtract seconds from

sM

Calendar(Calendar,int)

subtractSecondsFrom

Returns a new Calendar that is arg2 seconds earlier than arg1. JavaDate.subtract seconds from("01:01:01",61)=="01:00:00".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#subtractSecondsFrom_java_util_Calendar__int_

subtract milliseconds from

sM

Calendar(Calendar,int)

subtractMillisecondsFrom

Returns a new Calendar that is arg2 milliseconds earlier than arg1. JavaDate.subtract milliseconds from("01:01:01",61)=="01:01:00.939".

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#subtractMillisecondsFrom_java_util_Calendar__int_

subtract duration from

sM

Calendar(Calendar,XMLDuration)

subtractDurationFrom

Returns a new Calendar that is earlier than arg1 by the duration arg2. JavaDate.subtract duration from("2009-12-30T23:59:00",Duration.from string("P1DT1M"))=="20009-12-29T23:58:00".

http://www.w3.org/TR/rif-dtb/#func: add-dayTimeDuration-to-dateTime_.28adapted_from_op: subtract-dayTimeDuration-from-dateTime.29

http://www.w3.org/TR/rif-dtb/#func: subtract-yearMonthDuration-from-dateTime_.28adapted_from_op: add-yearMonthDuration-to-dateTime.29

to date string

sM

String(Calendar)

toDateString

Returns the ISO 8601 lexical representation of arg1, ignoring time components. JavaDate.to date string("2010-07-04T12:30:00Z")=="2010-07-04Z"

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#toDateString_java_util_Calendar_

to datetime string

sM

String(Calendar)

toDateTimeString

Returns the ISO 8601 lexical representation of arg1. JavaDate.to datetime string("2010-07-04T12:30:00Z")=="2010-07-04T12:30:00.000Z"

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#toDateTimeString_java_util_Calendar_

to time string

sM

String(Calendar)

toTimeString

Returns the ISO 8601 lexical representation of arg1, ignoring date components. JavaDate.to time string("2010-07-04T12:30:00Z")=="12:30:00.000Z"

http://download.oracle.com/docs/cd/E12839_01 /apirefs.1111/e10663/oracle/rules/rl/extensions/ JavaDate.html#toTimeString_java_util_Calendar_


Table B-16 lists the XMLGregorianCalendar class.

Table B-16 The XMLGregorianCalendar Class

OBR Name Kind Signature Java Name Description Reference

XMLGregorianCalendar

Cl

-

javax.xml.datatype.XMLGregorianCalendar

Representation for W3C XML Schema 1.0 date/time datatypes.

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html

normalize

M

XMLGregorianCalendar()

-

Normalizes this instance to UTC. XMLDate.from string("2000-03-04T23:00:00+03:00").normalize()==XMLDate.from string("2000-03-04T20:00:00Z")

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html#normalize()

toGregorianCalendar

M

java.util.GregorianCalendar()

-

Converts this XMLGregorianCalendar to a (superclass of) Calendar. XMLDate.from string("2010-02-03").toGregorianCalendar()==(Calendar)"2010-02-03".

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html#toGregorianCalendar()

year

P

int

-

The year of this calendar, or Integer.MIN_VALUE if undefined. XMLDate.from string("2011-12-31").year==2011.

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html#getYear()

month

P

int

-

The month of this calendar, or Integer.MIN_VALUE if undefined. Months are 1-based, e.g. Jan is month 1. XMLDate.from string("2011-12-31").month==12.

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html#getMonth()

day

P

int

-

The day of this calendar, or Integer.MIN_VALUE if undefined. XMLDate.from string("2011-12-31").day==31.

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html#getDay()

hour

P

int

-

The hour of this calendar, or Integer.MIN_VALUE if undefined. XMLDate.from string("2011-12-31").hour==Integer.MIN_VALUE.

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html#getHour()

minute

P

int

-

The minute of this calendar, or Integer.MIN_VALUE if undefined. XMLDate.from string("2011-12-31T09:30:00").minute==30.

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html#getMinute()

second

P

int

-

The second of this calendar, or Integer.MIN_VALUE if undefined. XMLDate.from string("09:30:05Z").second==5.

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html#getSecond()

timezone

P

int

-

The timezone offset in minutes of this calendar, or Integer.MIN_VALUE if undefined. XMLDate.from string("09:30:00-09:00").timezone==-540.

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ XMLGregorianCalendar.html#getTimezone()


Table B-17 lists the XMLDate class.

Table B-17 The XMLDate Class

OBR Name Kind Signature Java Name Description Reference

XMLDate

Cl

-

oracle.rules.rl.extensions.XMLDate

Helper class for working with XMLGregorianCalendars as immutable objects. Treating calendars as immutable objects can help prevent errors.

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html

add years to

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

addYearsTo

Returns a new XMLGregorianCalendar that is arg2 years later than arg1. XMLDate.add years to("2009-01-01",1)=="2010-01-01".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #addYearsTo_javax_xml_datatype_XMLGregorianCalendar__int_

add months to

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

addMonthsTo

Returns a new XMLGregorianCalendar that is arg2 months later than arg1. XMLDate.add months to("2009-01-01",1)=="2009-02-01".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #addMonthsTo_javax_xml_datatype_XMLGregorianCalendar__int_

add weeks to

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

addWeeksTo

Returns a new XMLGregorianCalendar that is 7*arg2 days later than arg1. XMLDate.add weeks to("2009-01-01",1)=="2009-01-08".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #addWeeksTo_javax_xml_datatype_XMLGregorianCalendar__int_

add days to

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

addDaysTo

Returns a new XMLGregorianCalendar that is arg2 days later than arg1. XMLDate.add days to("2009-01-01",1)=="2009-01-02".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #addDaysTo_javax_xml_datatype_XMLGregorianCalendar__int_

add hours to

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

addHoursTo

Returns a new XMLGregorianCalendar that is arg2 hours later than arg1. XMLDate.add hours to("01:01:01",1)=="02:01:01".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #addHoursTo_javax_xml_datatype_XMLGregorianCalendar__int_

add minutes to

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

addMinutesTo

Returns a new XMLGregorianCalendar that is arg2 minutes later than arg1. XMLDate.add minutes to("01:01:01",1)=="01:02:01".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #addMinutesTo_javax_xml_datatype_XMLGregorianCalendar__int_

add seconds to

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

addSecondsTo

Returns a new XMLGregorianCalendar that is arg2 seconds later than arg1. XMLDate.add seconds to("01:01:01",61)=="01:02:02".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #addSecondsTo_javax_xml_datatype_XMLGregorianCalendar__int_

add milliseconds to

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

addMillisecondsTo

Returns a new XMLGregorianCalendar that is arg2 milliseconds later than arg1. XMLDate.add milliseconds to("01:01:01",61)=="01:01:01.061".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #addMillisecondsTo_javax_xml_datatype_XMLGregorianCalendar__int_

add duration to

sM

XMLGregorianCalendar(XMLGregorianCalendar,XMLDuration)

addDurationTo

Returns a new XMLGregorianCalendar that is later than arg1 by the duration arg2. XMLDate.add duration to("2009-12-30T23:59:00",Duration.from string("P1DT1M"))=="2010-01-01".

http://www.w3.org/TR/rif-dtb/#func:add-yearMonthDuration-to-dateTime_.28 adapted_from_op:add-yearMonthDuration-to-dateTime.29

http://www.w3.org/TR/rif-dtb/#func:add-dayTimeDuration-to-dateTime_.28 adapted_from_op:add-dayTimeDuration-to-dateTime.29

from string

sM

XMLGregorianCalendar(String)

fromString

Creates an XMLGregorianCalendar for the ISO 8601 date literal arg1. XMLDate.from string("2010-02-06-08:00")=="2010-02-06-08:00".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #fromString_java_lang_String_

subtract years from

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

subtractYearsFrom

Returns a new XMLGregorianCalendar that is arg2 years earlier than arg1. XMLDate.subtract years from("2009-01-01",1)=="2008-01-01".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #subtractYearsFrom_javax_xml_datatype_XMLGregorianCalendar__int_

subtract months from

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

subtractMonthsFrom

Returns a new XMLGregorianCalendar that is arg2 months earlier than arg1. XMLDate.subtract months from("2009-01-01",1)=="2008-12-01".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #subtractMonthsFrom_javax_xml_datatype_XMLGregorianCalendar__int_

subtract weeks from

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

subtractWeeksFrom

Returns a new XMLGregorianCalendar that is 7*arg2 days earlier than arg1. XMLDate.subtract weeks from("2009-01-01",1)=="2008-12-25".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #subtractWeeksFrom_javax_xml_datatype_XMLGregorianCalendar__int_

subtract days from

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

subtractDaysFrom

Returns a new XMLGregorianCalendar that is arg2 days earlier than arg1. XMLDate.subtract days from("2009-01-01",1)=="2008-12-31".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #subtractDaysFrom_javax_xml_datatype_XMLGregorianCalendar__int_

subtract hours from

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

subtractHoursFrom

Returns a new XMLGregorianCalendar that is arg2 hours earlier than arg1. XMLDate.subtract hours from("01:01:01",1)=="00:01:01".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #subtractHoursFrom_javax_xml_datatype_XMLGregorianCalendar__int_

subtract minutes from

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

subtractMinutesFrom

Returns a new XMLGregorianCalendar that is arg2 minutes earlier than arg1. XMLDate.subtract minutes from("01:01:01",1)=="01:00:01".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #subtractMinutesFrom_javax_xml_datatype_XMLGregorianCalendar__int_

subtract seconds from

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

subtractSecondsFrom

Returns a new XMLGregorianCalendar that is arg2 seconds earlier than arg1. XMLDate.subtract seconds from("01:01:01",61)=="01:00:00".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #subtractSecondsFrom_javax_xml_datatype_XMLGregorianCalendar__int_

subtract milliseconds from

sM

XMLGregorianCalendar(XMLGregorianCalendar,int)

subtractMillisecondsFrom

Returns a new XMLGregorianCalendar that is arg2 milliseconds earlier than arg1. XMLDate.subtract milliseconds from("01:01:01",61)=="01:01:00.939".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #subtractMillisecondsFrom_javax_xml_datatype_XMLGregorianCalendar__int_

subtract duration from

sM

XMLGregorianCalendar(XMLGregorianCalendar,XMLDuration)

subtractDurationFrom

Returns a new XMLGregorianCalendar that is earlier than arg1 by the duration arg2. XMLDate.subtract duration from("2009-12-30T23:59:00",Duration.from string("P1DT1M"))=="20009-12-29T23:58:00".

http://www.w3.org/TR/rif-dtb/#func:subtract-yearMonthDuration-from-dateTime_.28 adapted_from_op:subtract-yearMonthDuration-from-dateTime.29

http://www.w3.org/TR/rif-dtb/#func:subtract-dayTimeDuration-from-dateTime_.28 adapted_from_op:subtract-dayTimeDuration-from-dateTime.29

to string

sM

String(XMLGregorianCalendar)

toString

Returns the ISO 8601 lexical representation of arg1. XMLDate.to string("2010-04-15T11:00:00-09:00")=="2010-04-15T11:00:00-09:00".

http://download.oracle.com/docs/cd/E12839_01/apirefs.1111 /e10663/oracle/rules/rl/extensions/XMLDate.html #toString_javax_xml_datatype_XMLGregorianCalendar_

is datetime

sM

boolean(XMLGregorianCalendar)

isDateTime

Checks if this calendar have both date and time fields. XMLDate.is datetime("2009-12-30T23:59:00")==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

is datetime stamp

sM

boolean(XMLGregorianCalendar)

isDateTimeStamp

Checks if this calendar have date, time, and timezone fields. XMLDate.is datetime stamp("2009-12-30T23:59:00")==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

is date

sM

boolean(XMLGregorianCalendar)

isDate

Checks if this calendar have date fields and no time fields. XMLDate.is date("2009-12-30")==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

is time

sM

boolean(XMLGregorianCalendar)

isTime

Checks if this calendar have time fields and no date fields. XMLDate.is time("2009-12-30T23:59:00")==false.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

get timezone

sM

XMLDuration(XMLGregorianCalendar)

getTimezone

Gets the timezone from the calendar as a duration. XMLDate.get timezone("11:00:00+05:30")==Duration.from string("PT5H30M").

http://www.w3.org/TR/rif-dtb/ #func:timezone-from-dateTime_.28adapted_from_fn:timezone-from-dateTime.29

get seconds

sM

BigDecimal(XMLGregorianCalendar)

getSeconds

Gets the seconds, including fractional part, from the calendar as a BigDecimal. XMLDate.get seconds("00:00:12.345")==12.345.

http://www.w3.org/TR/rif-dtb/ #func:seconds-from-dateTime_.28adapted_from_fn:seconds-from-dateTime.29


Table B-18 lists the OracleDate class.

Table B-18 The OracleDate Class

OBR Name Kind Signature Java Name Description

OracleDate

Cl

-

oracle.rules.sdk2.extensions.OracleDate

Helper class for working with oracle.jbo.domain.Timestamp. For examples of method use, see like-named XMLDate methods.

add years to

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

addYearsTo

Returns a new oracle.jbo.domain.Timestamp that is arg2 years later than arg1.

add months to

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

addMonthsTo

Returns a new oracle.jbo.domain.Timestamp that is arg2 months later than arg1.

add weeks to

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

addWeeksTo

Returns a new oracle.jbo.domain.Timestamp that is 7*arg2 days later than arg1.

add days to

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

addDaysTo

Returns a new oracle.jbo.domain.Timestamp that is arg2 days later than arg1.

add hours to

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

addHoursTo

Returns a new oracle.jbo.domain.Timestamp that is arg2 hours later than arg1.

add minutes to

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

addMinutesTo

Returns a new oracle.jbo.domain.Timestamp that is arg2 minutes later than arg1.

add seconds to

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

addSecondsTo

Returns a new oracle.jbo.domain.Timestamp that is arg2 seconds later than arg1.

add milliseconds to

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

addMillisecondsTo

Returns a new oracle.jbo.domain.Timestamp that is arg2 milliseconds later than arg1.

add duration to

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,XMLDuration)

addDurationTo

Returns a new oracle.jbo.domain.Timestamp that is later than arg1 by the duration arg2.

from string

sM

oracle.jbo.domain.Timestamp(String)

fromString

Creates an oracle.jbo.domain.Timestamp for the ISO 8601 date literal arg1.

subtract years from

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

subtractYearsFrom

Returns a new oracle.jbo.domain.Timestamp that is arg2 years earlier than arg1.

subtract months from

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

subtractMonthsFrom

Returns a new oracle.jbo.domain.Timestamp that is arg2 months earlier than arg1.

subtract weeks from

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

subtractWeeksFrom

Returns a new oracle.jbo.domain.Timestamp that is 7*arg2 days earlier than arg1.

subtract days from

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

subtractDaysFrom

Returns a new oracle.jbo.domain.Timestamp that is arg2 days earlier than arg1.

subtract hours from

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

subtractHoursFrom

Returns a new oracle.jbo.domain.Timestamp that is arg2 hours earlier than arg1.

subtract minutes from

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

subtractMinutesFrom

Returns a new oracle.jbo.domain.Timestamp that is arg2 minutes earlier than arg1.

subtract seconds from

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

subtractSecondsFrom

Returns a new oracle.jbo.domain.Timestamp that is arg2 seconds earlier than arg1.

subtract milliseconds from

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,int)

subtractMillisecondsFrom

Returns a new oracle.jbo.domain.Timestamp that is arg2 milliseconds earlier than arg1.

subtract duration from

sM

oracle.jbo.domain.Timestamp(oracle.jbo.domain.Timestamp,XMLDuration)

subtractDurationFrom

Returns a new oracle.jbo.domain.Timestamp that is earlier than arg1 by the duration arg2.

to string

sM

String(oracle.jbo.domain.Timestamp)

toString

Returns the ISO 8601 lexical representation of arg1.


Table B-19 lists the Duration class.

Table B-19 The Duration Class

OBR Name Kind Signature Java Name Description Reference

Duration

Cl

-

oracle.rules.sdk2.extensions.OracleDuration

Helper class for comparing and subtracting dates. Can convert the difference of 2 dates into an XMLDuration. Can also create an XMLDuration from its literal (String) representation. Only day time and year month XMLDurations are supported.

-

compare

sM

int(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

-

Returns -1, 0, or 1 according to whether arg1<arg2, arg1==arg2, or arg1>arg2, respectively. Duration.compare("2010-01-01","2010-02-02")==-1

http://www.w3.org/TR/rif-dtb/#pred:date Time-less-than_.28adapted_from_op:dateTime-less-than.29

years between

sM

int(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

yearsBetween

Subtracts arg1 from arg2, where the args are some kind of date/time. Duration.years between("2008-01-01", "2009-02-02")==1.

-

months between

sM

int(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

monthsBetween

Subtracts arg1 from arg2, where the args are some kind of date/time. Duration.months between("2009-01-01","2008-02-02")==-10.

-

weeks between

sM

int(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

weeksBetween

Subtracts arg1 from arg2, where the args are some kind of date/time. Duration.weeks between("2000-01-01","2000-02-04")==4.

-

days between

sM

int(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

daysBetween

Subtracts arg1 from arg2, where the args are some kind of date/time. Duration.days between("2000-01-01","2000-02-04")==34.

-

hours between

sM

int(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

hoursBetween

Subtracts arg1 from arg2, where the args are some kind of date/time. Duration.hours between("2000-01-04T03:30:00","2000-01-01T00:00:00")==-75

-

minutes between

sM

int(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

minutesBetween

Subtracts arg1 from arg2, where the args are some kind of date/time. Duration.minutes between("03:30:00","04:45:00")==75.

-

seconds between

sM

int(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

secondsBetween

Subtracts arg1 from arg2, where the args are some kind of date/time. Duration.seconds between("03:30:00","03:31:15")==75.

-

milliseconds between

sM

int(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

millisecondsBetween

Subtracts arg1 from arg2, where the args are some kind of date/time. Duration.milliseconds between("03:30:00","03:31:15")==75000.

 

between

sM

XMLDuration(Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp, Calendar|XMLGregorianCalendar|oracle.jbo.domain.Timestamp)

between

Subtracts arg1 from arg2, where the args are some kind of date/time. Returns day-time Duration. Duration.between("2009-01-01T01:15:00","2009-02-02T11:30:00")==Duration.from string("P32DT10H15M").

http://www.w3.org/TR/rif-dtb/#func:subtract-date Times_.28adapted_from_op:subtract-dateTimes.29

from string

sM

XMLDuration(String)

fromString

Parses a duration from an ISO 8601 duration literal. "P1DT2H3M" is the duration of 1 day, 2 hours, and 3 minutes.

http://www.w3.org/TR/xpath-functions/#duration-subtypes

compare durations

sM

int(XMLDuration,XMLDuration)

compareDurations

Compares two durations. Both must be either day-time or year-month durations. Returns -1, 0, or 1 according to whether arg1<arg2, arg1==arg2, or arg1>arg2, respectively. Duration.compare(Duration.from string("P1Y"),Duration.from string("P13M"))==-1.

http://www.w3.org/TR/rif-dtb/#pred:dayTimeDuration-less-than_.28 adapted_from_op:dayTimeDuration-less-than.29

http://www.w3.org/TR/rif-dtb/#pred:yearMonthDuration-less-than_.28 adapted_from_op:yearMonthDuration-less-than.29

is day-time duration

sM

boolean(XMLDuration)

isDayTimeDuration

Checks if arg1 a day-time duration. Only day-time and year-month durations are supported. Duration.is day-time duration(Duration.from string("P2DT1S"))==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

is year-month duration

sM

boolean(XMLDuration)

isYearMonthDuration

Checks if arg1 a year-month duration. Only day-time and year-month durations are supported. Duration.is year-month duration(Duration.from string("P13M"))==true.

http://www.w3.org/TR/rif-dtb/#Guard_Predicates_for_Datatypes

get seconds

sM

BigDecimal(XMLDuration)

getSeconds

Gets the seconds field from the duration as a BigDecimal, including fractional seconds. Duration.get seconds(Duraton.from string("PT12.345S"))==12.345.

http://www.w3.org/TR/rif-dtb/#func:seconds-from-duration_.28 adapted_from_fn:seconds-from-duration.29

divide

sM

XMLDuration(XMLDuration,int|double)

-

Divides a duration by an integral or double divisor. Duration.divide(Duration.from string("P1Y"),4)==Duration.from string("P3M").

http://www.w3.org/TR/rif-dtb/#func:divide-dayTimeDuration_.28 adapted_from_op:divide-dayTimeDuration.29

http://www.w3.org/TR/rif-dtb/#func:divide-yearMonthDuration_.28 adapted_from_op:divide-yearMonthDuration.29

ratio

sM

BigDecimal(XMLDuration,XMLDuration)

-

Computes the ratio of 2 durations as a BigDecimal. Duration.ratio(Duration.from string("P1Y"),Duration.from string("P3M"))==4

http://www.w3.org/TR/rif-dtb/#func:divide-dayTimeDuration-by-dayTimeDuration_.28 adapted_from_op:divide-dayTimeDuration-by-dayTimeDuration.29

http://www.w3.org/TR/rif-dtb/#func:divide-yearMonthDuration-by-yearMonthDuration_.28 adapted_from_op:divide-yearMonthDuration-by-yearMonthDuration.29


Table B-20 lists the XMLDuration class.

Table B-20 The XMLDuration Class

OBR Name Kind Signature Java Name Description Reference

XMLDuration

Cl

-

javax.xml.datatype.Duration

Immutable representation of a time span as defined in the W3C XML Schema 1.0 specification. Only day-time and year-month XMLDurations are supported.

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/Duration.html

http://www.w3.org/TR/xpath-functions/#duration-subtypes

years

P

int

-

Years field of the duration. Duration.from string("P2Y3M").years==2.

http://www.w3.org/TR/rif-dtb/#func: years-from-duration_.28adapted_from_fn:years-from-duration.29

months

P

int

-

Months field of the duration. Duration.from string("P2Y3M").months==2.

http://www.w3.org/TR/rif-dtb/#func: months-from-duration_.28adapted_from_fn:months-from-duration.29

days

P

int

-

Days field of the duration. Duration.from string("P1DT2H3M4S").days==1.

http://www.w3.org/TR/rif-dtb/#func: days-from-duration_.28adapted_from_fn:days-from-duration.29

hours

P

int

-

Hours field of the duration. Duration.from string("P1DT2H3M4S").hours==2.

http://www.w3.org/TR/rif-dtb/#func: hours-from-duration_.28adapted_from_fn:hours-from-duration.29

minutes

P

int

-

Minutes field of the duration. Duration.from string("P1DT2H3M4S").minutes==3.

http://www.w3.org/TR/rif-dtb/#func: minutes-from-duration_.28adapted_from_fn:minutes-from-duration.29

seconds

P

int

-

Seconds field of the duration. Duration.from string("P1DT2H3M4S").seconds==4.

http://www.w3.org/TR/rif-dtb/#func: seconds-from-duration_.28adapted_from_fn:seconds-from-duration.29

sign

P

int

-

Returns the sign of this duration in -1,0, or 1. Duration.from string("-P1Y").sign==-1.

-

add

M

XMLDuration(XMLDuration)

-

Adds two durations. Duration.from string("P6M").add(Duration.from string("P6M"))==Duration.from string("P1Y").

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ Duration.html#add(javax.xml.datatype.Duration)

subtract

M

XMLDuration(XMLDuration)

-

Subtracts two durations. Duration.from string("P6M").subtract(Duration.from string("P6M"))==Duration.from string("P0Y").

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ Duration.html#subtract(javax.xml.datatype.Duration)

multiply

M

XMLDuration(BigDecimal|int)

-

Multiplies arg1 duration by arg2 factor. Duration.from string("P6M").multiply(2)==Duration.from string("P1Y").

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ Duration.html#multiply(java.math.BigDecimal)

negate

M

XMLDuration()

-

Durations can be negative, e.g. if you reverse the arguments to Duration.between(arg1,arg2). Duration.from string("P6M").negate()==Duration.from string("-P6M").

http://java.sun.com/javase/6/docs/api/javax/xml/datatype/ Duration.html#negate()

to string

M

String()

toString

Gets the ISO8601 literal representation for this duration. Duration.from string("P6M").to string()=="P6M".

http://www.w3.org/TR/xpath-functions/ #duration-subtypes


Table B-21 lists the CurrentDate class.

Table B-21 The CurrentDate Class

OBR Name Kind Signature Java Name Description

CurrentDate

Cl

-

oracle.rules.rl.extensions.CurrentDate

Fact type of a holder for the current date. Can be used in rule patterns.

date

P

Calendar

-

Returns the current date.


B.5 Miscellaneous Classes

This section covers the miscellaneous classes provided by Oracle Business Rules.

Table B-22 lists the JAXBElement class.

Table B-22 The JAXBElement Class

OBR Name Kind Signature Java Name Description Reference

JAXBElement

Cl

-

javax.xml.bind.JAXBElement

Represents XML element information in XML Fact Types.

http://java.sun.com/javase/6/docs/api/javax/xml/bind/JAXBElement.html

nil

P

boolean

-

A nil element is not the same thing (in XML) as an absent element.

http://java.sun.com/javase/6/docs/api/javax/xml/bind/JAXBElement.html#isNil()

value

P

Object

-

This is a reference to an XML Fact Type

http://java.sun.com/javase/6/docs/api/javax/xml/bind/JAXBElement.html#getValue()


Table B-23 lists the Object class.

Table B-23 The Object Class

OBR Name Kind Signature Java Name Description Reference

Object

Cl

-

java.lang.Object

Base class of all Java objects.

http://java.sun.com/javase/6/docs/api/java/lang/Object.html


B.6 Functions

Table B-24 lists the different functions provided by Oracle Business Rules..

Table B-24 The Oracle Business Rules Functions

OBR Name Signature RL Name Description Reference

print

void(Object)

println

Prints the string value of arg1.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.assert a tree of facts

Object(Object)

assertTree

Asserts (insert into working memory) the tree of visible fact types with arg1 as the root. Returns arg1.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.assert

Object(Object)

assert

Asserts arg1 (insert arg1 into working memory). Returns arg1.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.retract

void(Object)

retract

Removes the fact associated with the object arg1 from working memory.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.get fact ID

int(Object)

id

Returns the fact id associated with the object arg1. If arg1 is not associated with a fact, return -1.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.get fact by ID

Object(int)

object

Returns the object associated with the given fact id. If there is no such fact id, returns null.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.contains

boolean(List,Object)

contains

The contains() function is similar to the contains() method on Java Collection but includes the ability to handle the presence of JAXBElement in the collection.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.ruleset stack.push

void(String)

pushRuleset

Pushes arg1, the name of a ruleset, onto the ruleset stack.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.ruleset stack.pop

String()

popRuleset

Pops and returns the top of the ruleset stack, the name of a ruleset.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.ruleset stack.get

String[]()

getRulesetStack

Returns the ruleset stack as a String array.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.ruleset stack.set

void(String[])

setRulesetStack

Sets the ruleset stack to arg1, a String array.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.ruleset stack.clear

void()

clearRulesetStack

Pops all ruleset names off the ruleset stack.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.date.get current

Calendar()

getCurrentDate

Returns the date associated with the CurrentDate fact.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.date.set current

void(Calendar)

setCurrentDate

Sets the date for reasoning on an engine managed fact representing the "current" date (with the CurrentDate fact).

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.date.get effective

Calendar()

getEffectiveDate

Returns the current value of the effective date.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.date.set effective

void(Calendar)

setEffectiveDate

Updates the effective date in the rules engine.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.watch.rules

void()

watchRules

Prints information about rule firings (execution of activations).

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.watch.activations

void()

watchActivations

Prints information about addition or removal of activations from the agenda.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.watch.facts

void()

watchFacts

Prints information about assertion, retraction, or modification of facts in working memory.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.watch.focus

void()

watchFocus

Prints information about pushing and popping of the ruleset stack.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.watch.compilations

void()

watchCompilations

Prints information about how the condition parts of a rule are shared with existing rules.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.watch.all

void()

watchAll

Prints information about rules, facts, activations, focus, and compilations.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.stop watching.rules

void()

clearWatchRules

Stops printing information about rule firings.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.stop watching.activations

void()

clearWatchActivations

Stops printing information about addition or removal of activations from the agenda.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.stop watching.facts

void()

clearWatchFacts

Stops printing information about assertion, retraction, or modification of facts in working memory.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.stop watching.focus

void()

clearWatchFocus

Stops printing information about pushing and popping of the ruleset stack.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.stop watching.compilations

void()

clearWatchCompilations

Stops printing information about how the condition parts of a rule are shared with existing rules.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.stop watching.all

void()

clearWatchAll

Stops printing information about rules, facts, activations, focus, and compilations.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.show.facts

void()

showFacts

Prints all facts in working memory.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules

RL.show.activations

void()

showActivations

Prints all activations on the agenda.

Oracle Fusion Middleware Language Reference Guide for Oracle Business Rules