<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=JavaScript%2FLimitedQueue.js</id>
	<title>JavaScript/LimitedQueue.js - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=JavaScript%2FLimitedQueue.js"/>
	<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=JavaScript/LimitedQueue.js&amp;action=history"/>
	<updated>2026-06-06T23:54:16Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://monobook.org/w/index.php?title=JavaScript/LimitedQueue.js&amp;diff=8705&amp;oldid=prev</id>
		<title>103.22.200.204: ページの作成:「容量上限到達でエンキューが無視されるキュー。いわゆるパチンコの「保留」みたいなもの。 &lt;source lang=&quot;javascript&quot;&gt; function Lim...」</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=JavaScript/LimitedQueue.js&amp;diff=8705&amp;oldid=prev"/>
		<updated>2017-06-10T04:16:15Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「容量上限到達でエンキューが無視される&lt;a href=&quot;/wiki/%E3%82%AD%E3%83%A5%E3%83%BC&quot; title=&quot;キュー&quot;&gt;キュー&lt;/a&gt;。いわゆるパチンコの「保留」みたいなもの。 &amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt; function Lim...」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;容量上限到達でエンキューが無視される[[キュー]]。いわゆるパチンコの「保留」みたいなもの。&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function LimitedQueue(){&lt;br /&gt;
&lt;br /&gt;
  var queue  = [];&lt;br /&gt;
  var offset = 0;&lt;br /&gt;
  var limit = 4;&lt;br /&gt;
&lt;br /&gt;
  this.getLength = function(){&lt;br /&gt;
    return (queue.length - offset);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  this.isEmpty = function(){&lt;br /&gt;
    return (queue.length == 0);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  this.isLimit = function(){&lt;br /&gt;
    return (this.limit &amp;lt;= this.getLength());&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  this.enqueue = function(item){&lt;br /&gt;
    if (this.isLimit()) return false;&lt;br /&gt;
    queue.push(item);&lt;br /&gt;
    return true;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  this.dequeue = function(){&lt;br /&gt;
    if (queue.length == 0) return undefined;&lt;br /&gt;
&lt;br /&gt;
    var item = queue[offset];&lt;br /&gt;
&lt;br /&gt;
    if (++ offset * 2 &amp;gt;= queue.length){&lt;br /&gt;
      queue  = queue.slice(offset);&lt;br /&gt;
      offset = 0;&lt;br /&gt;
    }&lt;br /&gt;
    return item;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  this.peek = function(){&lt;br /&gt;
    return (queue.length &amp;gt; 0 ? queue[offset] : undefined);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>103.22.200.204</name></author>
	</entry>
</feed>