Files
narya/src/as/com/threerings/util/Map.as
T
Ray Greenwell 2a6940363d Rollback r5502.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5503 542714f4-19e9-0310-aa3c-eee0fc999fb1
2008-11-04 21:42:18 +00:00

89 lines
2.5 KiB
ActionScript

//
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// 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.util {
/**
* A Map is an object that maps keys to values.
*/
public interface Map
{
/**
* Clear this map, removing all stored elements.
*/
function clear () :void;
/**
* Returns true if the specified key exists in the map.
*/
function containsKey (key :Object) :Boolean;
/**
* Retrieve the value stored in this map for the specified key.
* Returns the value, or undefined if there is no mapping for the key.
*/
function get (key :Object) :*;
/**
* Call the specified function, which accepts two args: key and value,
* for every mapping.
*/
function forEach (fn :Function) :void;
/**
* Returns true if this map contains no elements.
*/
function isEmpty () :Boolean;
/**
* Return all the unique keys in this Map, in Array form.
* The Array is not a 'view': it can be modified without disturbing
* the Map from whence it came.
*/
function keys () :Array;
/**
* Store a value in the map associated with the specified key.
* Returns the previous value stored for that key, or undefined.
*/
function put (key :Object, value :Object) :*;
/**
* Removes the mapping for the specified key.
* Returns the value that had been stored, or undefined.
*/
function remove (key :Object) :*;
/**
* Return the current size of the map.
*/
function size () :int;
/**
* Return all the values in this Map, in Array form.
* The Array is not a 'view': it can be modified without disturbing
* the Map from whence it came.
*/
function values () :Array;
}
}