Apama Documentation : Developing Apama Applications : EPL Reference : Types : Reference types
Reference types
 
action
Channel
chunk
context
dictionary
event
Exception
listener
location
sequence
StackTraceElement
stream
In addition to the primitive types, EPL provides for a number of object types. These types are manipulated by reference as opposed to by value (in the same way as complex types are handled in Java). These are the reference types which are discussed in this section.
When a variable of reference type is assigned to another one of the same type, the latter will reference the same object as the former, and should one be changed, the other one would reflect the change as well.
If you require a variable of reference type to contain a copy of another one of the same type, that is a completely distinct but identical copy, then you should use the clone() method as described below. This returns a deep copy of the variable, that is, it copies it and all its contents (and their contents in turn) recursively.
The string type is technically a reference type, but unlike all other reference types, the string type is immutable; its value cannot change. The clone() method has no effect on strings, as they cannot be changed. Therefore, string is discussed with the primitive types.
Note that you cannot use an object type for matching in an event template. For example, suppose you have the following event types:
InnerEvent
{   
float f;
}
 
WrapperEvent
{   
string s;
   InnerEvent anInnerEvent;
}
The following statement is correct:
on all WrapperEvent(s = "some_string")
However, the following statement is not allowed:
on all WrapperEvent(anInnerEvent.f = 5.5)
More than one variable can have a reference to the same underlying data value. For example, consider the following code:
sequence <integer> s1;
sequence <integer> s2;
s1 := [12, 55, 42];
s2 := s1;
print s1[1].toString; // print second element of s1
s2[1] := 99; // change the second element
print s1[1].toString; // print second element of s1 again
Both s1 and s2 refer to the same array, so whichever variable you use, there is only one copy of the data values. So the program's output is:
55
99
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback