Class: InstanceOf

olympe.dc.predicates. InstanceOf

Predicates that tests whether objects are instances of one of the provided models.

Example:

const filtered = list.transform(
    new olympe.dc.transformers.Filter(
        new olympe.dc.predicates.Not(
            new olympe.dc.predicates.InstanceOf(
                [ model1, model2, model3 ]
            )
        )
    )
);

This code examples filters out instances of 3 different models.


new InstanceOf(models)

Creates a InstanceOf predicate.

Parameters:
Name Type Description
models !Array.<!olympe.dc.InstanceTag> | olympe.dc.InstanceTag

the tags of models to check for.

Implements:

Methods


getInternalPaths()

Returns the path in the graph followed by this predicate to be evaluated.

Implements:
Returns:
Type
Array.<!Array.<!olympe.dc.query.Relation>>

getModelTags()

Gets the array of tags of the models expected by this predicate

Returns:

The tags of the models.

Type
Array.<string>

getName()

Gets the name of this Predicate.

Implements:
Returns:

The name.

Type
string

serialize(parameters)

Serializes the predicate.

Parameters:
Name Type Description
parameters olympe.dc.query.Parameters

Serialization parameters.

Implements:
Throws:

If the predicate is not serializable.

Type
Error
Returns:

A string containing the serialized form.

Type
string

test(dcManager, tag)

Checks whether an instance matches this predicate.

Parameters:
Name Type Description
dcManager olympe.dc.Manager

The DC manager.

tag string

The tag of the instance to test.

Implements:
Returns:

The result of the test as a boolean (or OBoolean) or a node (or proxy) of those types

Type
boolean | olympe.df.Node | olympe.df.OBoolean | olympe.df.Proxy

toString()

Gets a string representation of this Predicate.

Implements:
Returns:

The string representation.

Type
string