Packagecom.threerings.util
Classpublic class Predicates

Predicates suitable for Array.filter() and other needs.



Public Methods
 MethodDefined by
  
createAnd(... predicates):Function
[static] Return a predicate that is true if all the specified predicate Functions are true for any item.
Predicates
  
createEquals(value:Object):Function
[static] Create a predicate that tests if the item is Util.equals() to the specified value.
Predicates
  
createHasProperty(propName:String):Function
[static] Create a predicate that tests if the item has the specified property (with any value).
Predicates
  
createIn(array:Array):Function
[static] Create a predicate that returns true if the item is in the specified Array.
Predicates
  
createIs(clazz:Class):Function
[static] Return a predicate that tests for items that are "is" the specified class.
Predicates
  
createNot(pred:Function):Function
[static] Return a predicate that is the negation of the specified predicate.
Predicates
  
createOr(... predicates):Function
[static] Return a predicate that is true if any of the specified predicate Functions are true for any item.
Predicates
  
createPropertyEquals(propName:String, value:Object):Function
[static] Create a predicate that tests if the item has a property that is Util.equals() to the specified value.
Predicates
  
isNull(item:*, ... ignored):Boolean
[static] A predicate that tests for null (or undefined) items.
Predicates
  
notNull(item:*, ... ignored):Boolean
[static] A predicate that tests for items that are not null (or undefined).
Predicates
Method detail
createAnd()method
public static function createAnd(... predicates):Function

Return a predicate that is true if all the specified predicate Functions are true for any item.

Parameters
... predicates

Returns
Function
createEquals()method 
public static function createEquals(value:Object):Function

Create a predicate that tests if the item is Util.equals() to the specified value.

Parameters
value:Object

Returns
Function
createHasProperty()method 
public static function createHasProperty(propName:String):Function

Create a predicate that tests if the item has the specified property (with any value).

Parameters
propName:String

Returns
Function
createIn()method 
public static function createIn(array:Array):Function

Create a predicate that returns true if the item is in the specified Array.

Parameters
array:Array

Returns
Function
createIs()method 
public static function createIs(clazz:Class):Function

Return a predicate that tests for items that are "is" the specified class.

Parameters
clazz:Class

Returns
Function
createNot()method 
public static function createNot(pred:Function):Function

Return a predicate that is the negation of the specified predicate.

Parameters
pred:Function

Returns
Function
createOr()method 
public static function createOr(... predicates):Function

Return a predicate that is true if any of the specified predicate Functions are true for any item.

Parameters
... predicates

Returns
Function
createPropertyEquals()method 
public static function createPropertyEquals(propName:String, value:Object):Function

Create a predicate that tests if the item has a property that is Util.equals() to the specified value.

Parameters
propName:String
 
value:Object

Returns
Function
isNull()method 
public static function isNull(item:*, ... ignored):Boolean

A predicate that tests for null (or undefined) items.

Parameters
item:*
 
... ignored

Returns
Boolean
notNull()method 
public static function notNull(item:*, ... ignored):Boolean

A predicate that tests for items that are not null (or undefined).

Parameters
item:*
 
... ignored

Returns
Boolean