Dump the index of the child in the relation.
775988
def dump_index(self, obj):
        """"""
        if isinstance(obj, PIDNodeOrdered) and self._is_child(obj):
            return obj.index(self.context['pid'])
        else:
            return None
160462
def dump_type(self, obj):
        """"""
        if not isinstance(obj.relation_type, RelationType):
            return resolve_relation_type_config(obj.relation_type).name
        else:
            return obj.relation_type.name
456532
def remove_child(self, child_pid, reorder=False):
        """"""
        super(PIDNodeOrdered, self).remove_child(child_pid)
        child_relations = self._resolved_pid.child_relations.filter(
            PIDRelation.relation_type == self.relation_type.id).order_by(
                PIDRelation.index).all()
        if reorder:
            for idx, c in enumerate(child_relations):
                c.index = idx
711161
def to_index_variable(self):
        """"""
        return IndexVariable(self.dims, self._data, self._attrs,
                             encoding=self._encoding, fastpath=True)
1063628
def dump(self):
        """"""
        print("Relation " + self.relation)
        print("  With attributes")
        for n in self.attributes:
            if self.attribute_types[n] != TYPE_NOMINAL:
                print("    %s of type %s" % (n, self.attribute_types[n]))
            else:
                print("    " + n + " of type nominal with values " + ', '.join(self.attribute_data[n]))
        for d in self.data:
            print(d)
684389
def drop_index(self, keep_model=True):
        """"""
        self.check_session()
        result = self.session.drop_index(keep_model)
        if self.autosession:
            self.commit()
        return result
519301
def current_index(self):
        """"""
        i = self._parent.proxy_model.mapToSource(self._parent.currentIndex())
        return i
591542
def dump_bulk(cls, parent=None, keep_ids=True):
        """"""

        cls = get_result_class(cls)

        # Because of fix_tree, this method assumes that the depth
        # and numchild properties in the nodes can be incorrect,
        # so no helper methods are used
        qset = cls._get_serializable_model().objects.all()
        if parent:
            qset = qset.filter(path__startswith=parent.path)
        ret, lnk = [], {}
        for pyobj in serializers.serialize('python', qset):
            # django's serializer stores the attributes in 'fields'
            fields = pyobj['fields']
            path = fields['path']
            depth = int(len(path) / cls.steplen)
            # this will be useless in load_bulk
            del fields['depth']
            del fields['path']
            del fields['numchild']
            if 'id' in fields:
                # this happens immediately after a load_bulk
                del fields['id']

            newobj = {'data': fields}
            if keep_ids:
                newobj['id'] = pyobj['pk']

            if (not parent and depth == 1) or\
               (parent and len(path) == len(parent.path)):
                ret.append(newobj)
            else:
                parentpath = cls._get_basepath(path, depth - 1)
                parentobj = lnk[parentpath]
                if 'children' not in parentobj:
                    parentobj['children'] = []
                parentobj['children'].append(newobj)
            lnk[path] = newobj
        return ret
25098
def next_child(self, child_pid):
        """"""
        relation = self._get_child_relation(child_pid)
        if relation.index is not None:
            return self.children.filter(
                PIDRelation.index > relation.index
            ).ordered(ord='asc').first()
        else:
            return None
499667
function getIndex(increment) {
		var 
		max = $related.length, 
		newIndex = (index + increment) % max;
		
		return (newIndex < 0) ? max + newIndex : newIndex;
	}
1336109
def simple( child, shared, parent ):
    """"""
    return (
        not child.get('refs',())
        and (
            not shared.get(child['address'])
        or 
            shared.get(child['address']) == [parent['address']]
        )
    )
379112
def dump_relation(api, rel_cfg, pid, data):
    """"""
    schema_class = rel_cfg.schema
    if schema_class is not None:
        schema = schema_class()
        schema.context['pid'] = pid
        result, errors = schema.dump(api)
        data.setdefault(rel_cfg.name, []).append(result)
1139303
def index(self, value):
		
		for i in xrange(len(self.parentNode)):
			if getattr(self.parentNode[i], self.Name) == value:
				return i
		raise ValueError(value)
595181
def _put_into_indexes(self, obj):
        
        no_of_used_indexes = 0
        for field_name, db_index in list(self._get_db_fields(obj)):
            attr_value = getattr(obj, field_name)

            if attr_value is None:  # index only by set attributes
                continue

            container = db_index.get(attr_value, None)
            if container is None:
                container = OOTreeSet()
                db_index[attr_value] = container

            container.insert(obj)

            no_of_used_indexes += 1

        # make sure that atleast one `attr_value` was used
        if no_of_used_indexes <= 0:
            raise UnindexableObject(
                "You have to use atleast one of the identificators!"
            )
114702
def remove_child(self, child_pid):
        """"""
        with db.session.begin_nested():
            if not isinstance(child_pid, PersistentIdentifier):
                child_pid = resolve_pid(child_pid)
            relation = PIDRelation.query.filter_by(
                parent=self._resolved_pid,
                child=child_pid,
                relation_type=self.relation_type.id).one()
            db.session.delete(relation)
152120
private void indexDense(DBIDRef ref, V obj) {
    double len = 0.;
    for(int dim = 0, max = obj.getDimensionality(); dim < max; dim++) {
      final double val = obj.doubleValue(dim);
      if(val == 0. || val != val) {
        continue;
      }
      len += val * val;
      getOrCreateColumn(dim).add(val, ref);
    }
    length.put(ref, FastMath.sqrt(len));
  }
1163753
def index(self, child_pid):
        """"""
        if not isinstance(child_pid, PersistentIdentifier):
            child_pid = resolve_pid(child_pid)
        relation = PIDRelation.query.filter_by(
            parent=self._resolved_pid,
            child=child_pid,
            relation_type=self.relation_type.id).one()
        return relation.index