metaworks.js - TheOpenCloudEngine/metaworks GitHub Wiki
Members
object metadata
keyFieldDescriptor
Methods
orderBestObject
Metaworks3.prototype.orderBestObject = function(objectArray, fromObject);
change the order of candidate object list to be arranged with best matching with fromObject. the first criteria for ordering is the class hierarchy distance and second criteria is the key field value is same or not.
- objectArray: metaworks objects
- fromObject: object to be compared
if there are several array objects:
{__className: 'a', key: 5}
{__className: 'b', key: 6}
{__className: 'c', key: null}
and the fromObject is:
{__className: 'c', key: 5}
and the class hierarchy is following:
a
+- b
+- c
then the order must be:
{__className: 'c', key: null}
{__className: 'b', key: 6}
{__className: 'a', key: 5}
what if the fromObject is :
{__className: 'b', key: 5}
the result should be:
{__className: 'b', key: 6}
{__className: 'a', key: 5}
{__className: 'c', key: null}