alias_api.AlClusterable
- class alias_api.AlClusterable
Bases:
pybind11_objectEncapsulates methods common to Alias objects which can belong to clusters.
This class is a base class for all objects which can be contained in a cluster. It provides the methods necessary to access the cluster methods of these objects.
- add_to_cluster(self: alias_api.AlClusterable, cluster: AlCluster, percentage: SupportsFloat) int
Adds this clusterable object to a cluster. This means that all CV’s under this dag are affected by the cluster. The percentage defines how much of the cluster’s transformation is applied to the CVs under the dag node. A value of 1.0 means that the object’s CVs are affected 100% by the cluster leaf transformations.
The method may fail if unable to create a cluster member object, or if the addition of the object would create a cycle of clusters, or if the object to be added is already in the cluster, or if the object to be added already has an ancestor in the same target cluster.
- Parameters
cluster (AlCluster) – is the cluster to add this object to
percentage (float) – The extent of the effect of the cluster on the object’s CVs. A value of 1.0 means 100%.
- Returns
The status code result of the operation Success - if everything was successful InvalidArgument - cluster was None. Failure - failed for one of the reasons outlined above InvalidObject - the cluster was invalid InsufficientMemory - if not enough memory
- Return type
- apply_iterator_to_clusters(self: alias_api.AlClusterable, iter: AlIterator) tuple[int, int]
Apply the given iterator to all the clusters in this object. See the documentation for AlIterator.
Warning: be careful when using this iterator. If you modify the actual cluster during an iteration, it is possible that this routine will end up pointing to invalid data and send you garbage. This should not happen when simply applying transformations to a cluster. But deleting a cluster using this method is considered unsafe. If you do it, return immediately.
- Parameters
iter (AlIterator) – the iterator to apply to each cluster
- Returns
A tuple containing: (1) The status code result of the operation
Success - the application of the iterator terminated normally Failure - the application of the iterator terminated abnormally InvalidArgument - the iterator was None.
The return code of the last application of the iterator.
- Rype
AlStatusCode
- first_cluster(self: alias_api.AlClusterable) AlCluster
Finds and returns the first cluster of which this object is a member. If no such cluster can be found, None is returned.
- is_cluster_member(self: alias_api.AlClusterable, cluster: AlCluster) AlClusterMember
Finds the AlClusterMember that corresponds to the relationship between this object and the cluster object. None is returned if the object is not a member of the cluster or the cluster is not valid.
- Parameters
cluster (AlCluster) – Is the cluster object to be checked.
- Returns
The cluster member object that corresponds to the relationship between this object and the cluster object.
- Return type
- next_cluster(self: alias_api.AlClusterable, last_custer: AlCluster) AlCluster
Finds and returns the cluster following the given one of which this object is a member. If no such cluster can be found, None is returned.
- next_cluster_d(self: alias_api.AlClusterable, last_custer: AlCluster) int
Destructively sets the passed in cluster to the next cluster for the given object. If this can not be accomplished, the passed in cluster is unaffected.
- Parameters
last_cluster (AlCluster) – Cluster to walk forward from
- Returns
The status code result of the operation Success - the cluster now points to the next cluster InvalidArgument - ‘lastCluster’ was invalid or None Failure - there was no next cluster
- Return type
- percent_effect(self: alias_api.AlClusterable, cluster: AlCluster) float
Returns the percentage effect the given cluster has on this object. If the call fails, 0.0 is returned.
- Parameters
cluster (AlCluster) – Is the cluster whose percentage effect is to be found
- Returns
The percentage effect of the cluster on this object
- Return type
float
- prev_cluster(self: alias_api.AlClusterable, last_custer: AlCluster) AlCluster
Finds and returns the cluster preceding the given one of which this object is a member. If no such cluster can be found, None is returned.
- prev_cluster_d(self: alias_api.AlClusterable, last_custer: AlCluster) int
Finds and returns the cluster preceeding the given one of which this object is a member. If no such cluster can be found, None is returned.
- Parameters
last_cluster (AlCluster) – Cluster to walk forward from
- Returns
The status code result of the operation Success - the cluster now points to the previous cluster InvalidArgument - ‘lastCluster’ was invalid or None Failure - there was no previous cluster
- Return type
- remove_from_all_clusters(self: alias_api.AlClusterable) int
Removes this object from all clusters in the universe that it may be in.
- Returns
The status code result of the operation Success - the object was successfully removed from all clusters. InvalidArgument - the object was not valid.
- Return type
- remove_from_cluster(self: alias_api.AlClusterable, cluster: AlCluster) int
Removes this object from the cluster.
- Parameters
cluster (AlCluster) – The cluster to remove this object from.
- Returns
The status code result of the operation Success - if everything successful InvalidObject - if the cluster is not valid InvalidArgument - clustobj was not valid
- Return type
- set_percent_effect(self: alias_api.AlClusterable, cluster: AlCluster, percentage: SupportsFloat) int
Sets the percentage effect the given cluster has on all things below this object.
- Parameters
cluster (AlCluster) – is the cluster whose percentage effect is to be set
percentage (float) – the extent of the effect of the cluster
- Returns
The status code result of the operation Success - if everything successful InvalidArgument - ‘clustobj’ was None. Failure - if the percentage effect setting failed InvalidObject - the cluster was not valid