<commit_before>//
// $Id$
//
// Vilya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/vilya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.threerings.stage.tools.editor;

import com.samskivert.util.HashIntMap;

import com.threerings.media.tile.NoSuchTileSetException;
import com.threerings.media.tile.TileSet;
import com.threerings.media.image.ImageManager;

import com.threerings.miso.tile.MisoTileManager;
import com.threerings.resource.ResourceManager;

/**
 * Extends the normal Miso Tile Manager to allow the use of a set of test tiles that can be used in
 *  the editor.  These are loaded through the TestTileLoader.
 */
public class EditorTileManager extends MisoTileManager
{
    public EditorTileManager (ResourceManager rmgr, ImageManager imgr)
    {
        super(rmgr, imgr);
    }

    @Override //Documentation inherited
    public TileSet getTileSet (int tileSetId)
        throws NoSuchTileSetException
    {
        TileSet testSet = _testSets.get(tileSetId);
        if (testSet != null) {
            return testSet;
        } else {
            return super.getTileSet(tileSetId);
        }
    }

    /**
     * Add a test tile set to search before normal tilesets.
     */
    public void addTestTileSet (int id, TileSet set)
    {
        _testSets.put(id, set);
    }

    /**
     * Clear all of our existing test tile sets.
     */
    public void clearTestTileSets ()
    {
        _testSets.clear();
    }

    /**
     * All the test tile sets we have available.
     */
    protected HashIntMap<TileSet> _testSets = new HashIntMap<TileSet>();
}
<commit_msg>Don't fringe test tiles in the editor.<commit_after>//
// $Id$
//
// Vilya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/vilya/
//
// This library is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.threerings.stage.tools.editor;

import com.samskivert.util.HashIntMap;

import com.threerings.media.tile.NoSuchTileSetException;
import com.threerings.media.tile.TileSet;
import com.threerings.media.image.ImageManager;

import com.threerings.miso.tile.FringeConfiguration;
import com.threerings.miso.tile.BaseTileSet;
import com.threerings.miso.tile.MisoTileManager;
import com.threerings.resource.ResourceManager;

/**
 * Extends the normal Miso Tile Manager to allow the use of a set of test tiles that can be used in
 *  the editor.  These are loaded through the TestTileLoader.
 */
public class EditorTileManager extends MisoTileManager
{
    public EditorTileManager (ResourceManager rmgr, ImageManager imgr)
    {
        super(rmgr, imgr);
    }

    @Override //Documentation inherited
    public TileSet getTileSet (int tileSetId)
        throws NoSuchTileSetException
    {
        TileSet testSet = _testSets.get(tileSetId);
        if (testSet != null) {
            return testSet;
        } else {
            return super.getTileSet(tileSetId);
        }
    }

    /**
     * Add a test tile set to search before normal tilesets.
     */
    public void addTestTileSet (int id, TileSet set)
    {
        _testSets.put(id, set);

        // Some minor insanity - we don't know whether we want to fringe test tiles or not, but
        //  it seems safest to not fringe test base tiles, so set their priority to highest.
        if (set instanceof BaseTileSet) {
            FringeConfiguration.FringeRecord fringeRec = new FringeConfiguration.FringeRecord();
            fringeRec.base_tsid = id;
            fringeRec.priority = 1000;
            getAutoFringer().getFringeConf().addFringeRecord(fringeRec);
        }
    }

    /**
     * Clear all of our existing test tile sets.
     */
    public void clearTestTileSets ()
    {
        _testSets.clear();
    }

    /**
     * All the test tile sets we have available.
     */
    protected HashIntMap<TileSet> _testSets = new HashIntMap<TileSet>();
}

{'fraction_non_alphanumeric': 0.08472068072512023, 'fraction_numerical': 0.009618941916389198, 'mean_word_length': 2.895533141210375, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2496688', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1522, 'n_words': 568}