Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: chrome/test/data/extensions/samples/youtube_popular/map.js

Issue 386023: Remove the last of the old samples. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/samples/youtube_popular/map.js
===================================================================
--- chrome/test/data/extensions/samples/youtube_popular/map.js (revision 31819)
+++ chrome/test/data/extensions/samples/youtube_popular/map.js (working copy)
@@ -1,126 +0,0 @@
-/**
- * @fileoverview This file contains js create a helper Map object
- * @author lzheng@chromium.com (Lei Zheng)
- */
-
-/**
- * A Map class that implemeted using two arrays.
- */
-Map = function() {
- /**
- * Array that hold all Keys.
- * @private
- */
- this.keysArray = []; // Keys
- /**
- * Array that hold all values.
- * @private
- */
- this.valsArray = []; // Values
-
- /**
- * Index of where to insert new entries in key and value array.
- * @private
- */
- this.mapIndex_ = 0;
-};
-
-/**
- * Insert a key, value pair to map.
- * @param {object} key An object that supports "==".
- * @param {object} value The entry in map.
- */
-Map.prototype.insert = function(key, value) {
- var index = this.findIndex(key);
- if (index == -1) {
- this.keysArray[this.mapIndex_] = key;
- this.valsArray[this.mapIndex_] = value;
- ++this.mapIndex_;
- }
- else {
- this.valsArray[index] = value;
- }
-};
-
-/**
- * Get the entry associated with a key.
- * @param {object} key for the entry.
- * @return {object} The entry in map.
- */
-Map.prototype.keys = function() {
- return this.keysArray;
-};
-
-/**
- * Get the entry associated with a key.
- * @param {object} key for the entry.
- * @return {object} The entry in map.
- */
-Map.prototype.get = function(key) {
- var index = this.findIndex(key);
- if (index != -1) {
- return this.valsArray[index];
- }
- return null;
-};
-
-
-
-/**
- * Remove an entry associated with a key.
- * @param {object} key for the entry.
- */
-Map.prototype.remove = function(key) {
- var index = this.findIndex(key);
- if (index != -1) {
- this.keysArray = this.removeFromArray(keysArray, index);
- this.valsArray = this.removeFromAarry(valsArray, index);
- --this.mapIndex_;
- }
- return;
-};
-
-/**
- * Get the total entries in the map.
- * @return {int} The total number of entries.
- */
-Map.prototype.size = function() {
- return this.mapIndex_;
-};
-
-/**
- * Clear up everything in the map.
- */
-Map.clear = function() {
- this.mapIndex_ = 0;
- this.keysArray = [];
- this.valsArray = [];
-};
-
-/**
- * Find the index associated with a key.
- * @private
- * @param {object} key for the entry.
- * @return {int} The index of this entry.
- */
-Map.prototype.findIndex = function(key) {
- var result = -1;
- for (var i = 0; i < this.keysArray.length; i++) {
- if (this.keysArray[i] == key) {
- result = i;
- break;
- }
- }
- return result;
-};
-
-/**
- * @private
- * Remove an entry from the map.
- * @param {int} index The index of the entry.
- */
-Map.prototype.removeAt = function(array, index) {
- var first_half = array.slice(0, index);
- var second_half = array.slice(index + 1);
- return first_half.concat(second_half);
-}

Powered by Google App Engine
This is Rietveld 408576698