Packagecom.yworks.yfiles.util
Classpublic class Tuple
InheritanceTuple Inheritance YObject Inheritance Object

This class represents an ordered 2-Tuple that is consistent with equals() and hashCode(). Therefore it can safely be used within HashTables, HashSets, HashMaps and the like. Using the static create methods, it is possible to build 3,4,5-Tuples recursively out of multiple 2-Tuples.



Public Properties
 PropertyDefined By
  o1 : Object
[read-only] The first element of the Tuple
Tuple
  o2 : Object
[read-only] The second element of the Tuple
Tuple
Public Methods
 MethodDefined By
  
Tuple(o1:Object, o2:Object, init:Boolean = true)
Constructs a 2-Tuple using the two given Objects
Tuple
  
create(o1:Object, o2:Object):Object
[static] Factory method to create a 2-Tuple
Tuple
  
createFiveTuple(o1:Object, o2:Object, o3:Object, o4:Object, o5:Object):Object
[static] Factory method to create a 5-Tuple
Tuple
  
createFourTuple(o1:Object, o2:Object, o3:Object, o4:Object):Object
[static] Factory method to create a 4-Tuple
Tuple
  
createThreeTuple(o1:Object, o2:Object, o3:Object):Object
[static] Factory method to create a 3-Tuple
Tuple
  
equals(o:Object):Boolean
[override] Determines if the given Tuple equals another Tuple.
Tuple
  
getClass():Class
[override]
Tuple
  
hashCode():int
[override] Generates a hashCode using the two tuple elements.
Tuple
  
newTuple(o1:Object, o2:Object):Tuple
[static] Constructs a 2-Tuple using the two given Objects
Tuple
  
toString():String
Tuple
Protected Methods
 MethodDefined By
  
initTuple(o1:Object, o2:Object):void
Initializes this object.
Tuple
Property Detail
o1property
o1:Object  [read-only]

The first element of the Tuple


Implementation
    public function get o1():Object
o2property 
o2:Object  [read-only]

The second element of the Tuple


Implementation
    public function get o2():Object
Constructor Detail
Tuple()Constructor
public function Tuple(o1:Object, o2:Object, init:Boolean = true)

Constructs a 2-Tuple using the two given Objects

Parameters
o1:Object — The first element (may be null)
 
o2:Object — The second element (may be null)
 
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
create()method
public static function create(o1:Object, o2:Object):Object

Factory method to create a 2-Tuple

Parameters

o1:Object
 
o2:Object

Returns
Object
createFiveTuple()method 
public static function createFiveTuple(o1:Object, o2:Object, o3:Object, o4:Object, o5:Object):Object

Factory method to create a 5-Tuple

Parameters

o1:Object
 
o2:Object
 
o3:Object
 
o4:Object
 
o5:Object

Returns
Object
createFourTuple()method 
public static function createFourTuple(o1:Object, o2:Object, o3:Object, o4:Object):Object

Factory method to create a 4-Tuple

Parameters

o1:Object
 
o2:Object
 
o3:Object
 
o4:Object

Returns
Object
createThreeTuple()method 
public static function createThreeTuple(o1:Object, o2:Object, o3:Object):Object

Factory method to create a 3-Tuple

Parameters

o1:Object
 
o2:Object
 
o3:Object

Returns
Object
equals()method 
override public function equals(o:Object):Boolean

Determines if the given Tuple equals another Tuple. Returns true iff both elements are equal (both null or equals() returns true.

Parameters

o:Object — the element to compare this tuple with

Returns
Boolean — true iff o equals this
getClass()method 
override public function getClass():Class

Returns
Class
hashCode()method 
override public function hashCode():int

Generates a hashCode using the two tuple elements.

Returns
int — a hashCode built using the hashCodes of the two elements.
initTuple()method 
protected final function initTuple(o1:Object, o2:Object):void

Initializes this object. See the documentation of the corresponding factory method newTuple() for details.

Parameters

o1:Object
 
o2:Object

See also

newTuple()method 
public static function newTuple(o1:Object, o2:Object):Tuple

Constructs a 2-Tuple using the two given Objects

Parameters

o1:Object — The first element (may be null)
 
o2:Object — The second element (may be null)

Returns
Tuple
toString()method 
public function toString():String

Returns
String