<commit_before>//
// $Id: ObjectSet.java,v 1.1 2003/04/17 19:21:17 mdb Exp $

package com.threerings.miso.util;

import java.util.Arrays;
import java.util.Comparator;

import com.samskivert.util.ArrayUtil;
import com.samskivert.util.ListUtil;

import com.threerings.miso.Log;
import com.threerings.miso.data.ObjectInfo;

/**
 * Used to store an (arbitrarily) ordered, low-impact iteratable (doesn't
 * require object creation), set of {@link ObjectInfo} instances.
 */
public class ObjectSet
{
    /**
     * Inserts the supplied object into the set.
     *
     * @return true if it was inserted, false if the object was already in
     * the set.
     */
    public boolean insert (ObjectInfo info)
    {
        // bail if it's already in the set
        int ipos = indexOf(info);
        if (ipos >= 0) {
            // log a warning because the caller shouldn't be doing this
            Log.warning("Requested to add a display object to a set that " +
                        "already contains such an object [ninfo=" + info +
                        ", oinfo=" + _objs[ipos] + "].");
            return false;
        }

        // otherwise insert it
        ipos = -(ipos+1);
        _objs = ListUtil.insert(_objs, ipos, info);
        _size++;
        return true;
    }

    /**
     * Returns true if the specified object is in the set, false if it is<commit_msg>Log a stack trace to help us find out where this sort of thing happens if it happens.<commit_after>//
// $Id: ObjectSet.java,v 1.2 2003/04/22 01:57:44 mdb Exp $

package com.threerings.miso.util;

import java.util.Arrays;
import java.util.Comparator;

import com.samskivert.util.ArrayUtil;
import com.samskivert.util.ListUtil;

import com.threerings.miso.Log;
import com.threerings.miso.data.ObjectInfo;

/**
 * Used to store an (arbitrarily) ordered, low-impact iteratable (doesn't
 * require object creation), set of {@link ObjectInfo} instances.
 */
public class ObjectSet
{
    /**
     * Inserts the supplied object into the set.
     *
     * @return true if it was inserted, false if the object was already in
     * the set.
     */
    public boolean insert (ObjectInfo info)
    {
        // bail if it's already in the set
        int ipos = indexOf(info);
        if (ipos >= 0) {
            // log a warning because the caller shouldn't be doing this
            Log.warning("Requested to add an object to a set that already " +
                        "contains such an object [ninfo=" + info +
                        ", oinfo=" + _objs[ipos] + "].");
            Thread.dumpStack();
            return false;
        }

        // otherwise insert it
        ipos = -(ipos+1);
        _objs = ListUtil.insert(_objs, ipos, info);
        _size++;
        return true;
    }

    /**
     * Returns true if the specified object is in the set, false if it is
{'fraction_non_alphanumeric': 0.1050228310502283, 'fraction_numerical': 0.012644889357218124, 'mean_word_length': 2.1574279379157426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4222762', 'n_tokens_mistral': 893, 'n_tokens_neox': 851, 'n_words': 294}