Index a single (sparse) instance.

@param ref Object reference
@param obj Object to index.
172170
private void indexSparse(DBIDRef ref, SparseNumberVector obj) {
    double len = 0.;
    for(int iter = obj.iter(); obj.iterValid(iter); iter = obj.iterAdvance(iter)) {
      final int dim = obj.iterDim(iter);
      final double val = obj.iterDoubleValue(iter);
      if(val == 0. || val != val) {
        continue;
      }
      len += val * val;
      getOrCreateColumn(dim).add(val, ref);
    }
    length.put(ref, len);
  }
1017321
public static Object setObjectIndex(Object obj, double dblIndex,
                                        Object value, Context cx,
                                        Scriptable scope)
    {
        Scriptable sobj = toObjectOrNull(cx, obj, scope);
        if (sobj == null) {
            throw undefWriteError(obj, String.valueOf(dblIndex), value);
        }

        int index = (int)dblIndex;
        if (index == dblIndex) {
            return setObjectIndex(sobj, index, value, cx);
        }
        String s = toString(dblIndex);
        return setObjectProp(sobj, s, value, cx);
    }
122845
public void set(String alias, Object obj) {
        map.put(alias, (Extension)obj);
    }
1361162
function getIndex(objects, obj) {

            var i;
            for (i = 0; i < objects.length; i++) {
                if (objects[i] === obj) {
                    return i;
                }
            }

            return -1;
        }
642705
@Override
    public void write(ZooPC obj) {
        if (obj.getClass() == GenericObject.class) {
        	writeGeneric((GenericObject) obj);
        	return;
        }
        preWrite();

        //write object
        ds.writeObject(obj, cls);

        //updated index
        //This is buffered to reduce look-ups to find field indices.
        buffer[bufferCnt++] = obj;
        if (bufferCnt == BUFFER_SIZE) {
            flushBuffer();
        }
    }
1066086
@Pure
	@Override
	@SuppressWarnings({"unchecked", "checkstyle:npathcomplexity"})
	public int compareTo(Object obj) {
		final Object oth = (obj instanceof Reference) ? ((Reference<?>) obj).get() : obj;
		final T cur = get();

		if (oth == null && cur == null) {
			return 0;
		}
		if (cur == null) {
			return 1;
		}
		if (oth == null) {
			return -1;
		}

		if (cur instanceof Comparable) {
			try {
				return ((Comparable<Object>) cur).compareTo(oth);
			} catch (AssertionError e) {
				throw e;
			} catch (Throwable exception) {
				//
			}
		}

		if (oth instanceof Comparable) {
			try {
				return -((Comparable<Object>) oth).compareTo(cur);
			} catch (AssertionError e) {
				throw e;
			} catch (Throwable exception) {
				//
			}
		}

		return oth.hashCode() - cur.hashCode();
	}
90758
@Override
	public Object getObjectInstance(Object obj, Name name, Context context, Hashtable<?,?> environment) throws Exception
	{
		if (!(obj instanceof Reference))
			throw new IllegalStateException("Object is not a reference : "+obj);
		
        Reference reference = (Reference)obj;
        String objClassName = reference.getClassName();
        
        // Queue
        if (objClassName.equals(QueueRef.class.getName()))
        {
        	String queueName = getRequiredAttribute(reference, "queueName");
        	return new QueueRef(queueName);
        }
        
        // Topic
        if (objClassName.equals(TopicRef.class.getName()))
        {
        	String topicName = getRequiredAttribute(reference, "topicName");
        	return new TopicRef(topicName);
        }
        
        // ConnectionFactory
        if (objClassName.equals(FFMQConnectionFactory.class.getName()))
        	return new FFMQConnectionFactory(recreateConnectionFactoryEnv(reference));
        
        // QueueConnectionFactory
        if (objClassName.equals(FFMQQueueConnectionFactory.class.getName()))
        	return new FFMQQueueConnectionFactory(recreateConnectionFactoryEnv(reference));
        
        // TopicConnectionFactory
        if (objClassName.equals(FFMQTopicConnectionFactory.class.getName()))
        	return new FFMQTopicConnectionFactory(recreateConnectionFactoryEnv(reference));

        // We don't know how to handle this
        return null; 
	}
1261979
@Override
    public void copyFrom(final CopyFrom obj) {
        final OpenSearchModule osm = (OpenSearchModule) obj;
        setTotalResults(osm.getTotalResults());
        setItemsPerPage(osm.getItemsPerPage());
        setStartIndex(osm.getStartIndex());
        setLink(osm.getLink());
        for (final OSQuery q : osm.getQueries()) {
            try {
                getQueries().add((OSQuery) q.clone());
            } catch (final CloneNotSupportedException e) {
                LOG.error("Error", e);
            }
        }
    }
833227
@Deprecated
    public static Object setObjectIndex(Object obj, double dblIndex,
                                        Object value, Context cx)
    {
        return setObjectIndex(obj, dblIndex, value, cx, getTopCallScope(cx));
    }
72239
def index(request, obj_id=None):
    """"""
    if request.method == 'GET':
        return get(request, obj_id)
    elif request.method == 'POST':
        return post(request)
    elif request.method == 'PUT':
        getPutData(request)
        return put(request, obj_id)
    elif request.method == 'DELETE':
        getPutData(request)
        return delete(request, obj_id)
987057
def index(self, item, **kwargs):
        # type: (Any, dict) -> int
        
        return list.index(self, self.ref(item), **kwargs)
330343
public void init(Object obj)
    {
        m_bookmark = null;
        m_objectID = null;
        m_dataSource = null;
        m_objectSource = null;
        m_buffer = null;
    }
790553
function crawl (obj, file) {
  var type = typeOf(obj);

  if (!type.isPOJO && !type.isArray) {
    return;
  }

  if (type.isPOJO && isFileReference(obj)) {
    // We found a file reference, so resolve it
    resolveFileReference(obj.$ref, file);
  }

  // Crawl this POJO or Array, looking for nested JSON References
  //
  // NOTE: According to the spec, JSON References should not have any properties other than "$ref".
  //       However, in practice, many schema authors DO add additional properties. Because of this,
  //       we crawl JSON Reference objects just like normal POJOs. If the schema author has added
  //       additional properties, then they have opted-into this non-spec-compliant behavior.
  var keys = Object.keys(obj);

  for (var i = 0; i < keys.length; i++) {
    var key = keys[i];
    var value = obj[key];
    crawl(value, file);
  }
}
1191292
@Override
    public void add(final int index, final SyndCategory obj) {
        final SyndCategoryImpl sCat = (SyndCategoryImpl) obj;
        DCSubject subject;
        if (sCat != null) {
            subject = sCat.getSubject();
        } else {
            subject = null;
        }
        subjects.add(index, subject);
    }
1253943
public int lastIndexOf(Object obj) {
        if (obj instanceof JavascriptObject) {
            return checkInteger(invokeJavascript("lastIndexOf", ((JavascriptObject) obj).getJSObject()), -1);
        }
        return checkInteger(invokeJavascript("lastIndexOf", obj), -1);
    }
610785
public void index(Record record) {
    // FIXME: check if record is already indexed

    // allocate an ID for this record
    long id = store.makeNewRecordId();
    store.registerRecord(id, record);
    
    // go through ID properties and register them
    for (Property p : config.getIdentityProperties())
      for (String extid : record.getValues(p.getName()))
        store.registerId(id, extid);

    // go through lookup properties and register those
    for (Property p : config.getLookupProperties()) {
      String propname = p.getName();
      for (String value : record.getValues(propname)) {
        String[] tokens = StringUtils.split(value);
        for (int ix = 0; ix < tokens.length; ix++)
          store.registerToken(id, propname, tokens[ix]);
      }
    }
  }
873183
public final void enqueue(Object obj)
  {
//    if (tc.isEntryEnabled())
//      SibTr.entry(tc, "enqueue", obj);
    // m_array has at least one position in it that is free.
    m_array[m_tail++] = obj;
    if (m_tail == m_array.length)
      m_tail = 0;
    if (m_head == m_tail)
      expand_array();
//    if (tc.isEntryEnabled())
//      SibTr.exit(tc, "enqueue");
  }