<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<!--This is an automatically generated file. DO NOT EDIT THIS FILE DIRECTLY. Rather, use the _ref.xml files found in the 'edits' folder.-->
<c74object name="bag" module="max" category="Data">
	<digest>
		Store a collection of numbers
	</digest>
	<description>
		Stores and manages a collection of numbers. You can add to or delete an integer from a <o>bag</o> as report its contents. <o>bag</o> with any argument maintains multiple entries with the same item; otherwise it holds only one of each.
	</description>
	<!--METADATA-->
	<metadatalist>
		<metadata name="author">
			Cycling '74
		</metadata>
		<metadata name="tag">
			Max
		</metadata>
		<metadata name="tag">
			Data
		</metadata>
	</metadatalist>
	<!--INLETS-->
	<inletlist>
		<inlet id="0" type="INLET_TYPE">
			<digest>
				list Adds Items, bang Dumps Items
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
		<inlet id="1" type="INLET_TYPE">
			<digest>
				Item Value in List
			</digest>
			<description>
				TEXT_HERE
			</description>
		</inlet>
	</inletlist>
	<!--OUTLETS-->
	<outletlist>
		<outlet id="0" type="OUTLET_TYPE">
			<digest>
				Output for Items When bang is Received
			</digest>
			<description>
				TEXT_HERE
			</description>
		</outlet>
	</outletlist>
	<!--ARGUMENTS-->
	<objarglist>
		<objarg name="duplicate-flag" optional="1" type="symbol">
			<digest>
				Symbol to allow duplicate storage
			</digest>
			<description>
				The presence of any symbol argument causes the <o>bag</o> to store duplicate values. If there is no argument, <o>bag</o> will store only one of each number at a time.
			</description>
		</objarg>
	</objarglist>
	<!--MESSAGES-->
	<methodlist>
		<method name="bang">
			<arglist />
			<digest>
				Output all entries
			</digest>
			<description>
				In left inlet: Causes <o>bag</o> to send all its collected numbers out the outlet.
			</description>
		</method>
		<method name="int">
			<arglist>
				<arg name="input" optional="0" type="int" />
			</arglist>
			<digest>
				Store or remove a number
			</digest>
			<description>
				In left inlet: The number is either added to or deleted from the collection of numbers stored in the <o>bag</o> object, depending on the number in the right inlet.
				<br />
				<br />
				In right inlet: The number is stored as an indicator of whether to include or delete the next number received in the left inlet. If non-zero, the number received in the left inlet is added to the <o>bag</o>. If 0, the number is deleted from the collection.
				<br />
				<br />
				No output is triggered by a number received in either inlet.
			</description>
		</method>
		<method name="float">
			<arglist>
				<arg name="input" optional="0" type="float" />
			</arglist>
			<digest>
				Store or remove a number
			</digest>
			<description>
				Converted to <m>int</m>.
			</description>
		</method>
		<method name="clear">
			<arglist />
			<digest>
				Delete all entries
			</digest>
			<description>
				In left inlet: Deletes the entire contents of the <o>bag</o>.
			</description>
		</method>
		<method name="cut">
			<arglist />
			<digest>
				Output the oldest entry
			</digest>
			<description>
				In left inlet: Sends out the oldest (earliest received) number stored in the <o>bag</o> object, and deletes it from the <o> <b>bag</b> </o>.
			</description>
		</method>
		<method name="in1">
			<arglist>
				<arg name="function" optional="0" type="int" />
			</arglist>
			<digest>
				Set the operation for the next received input
			</digest>
			<description>
				In right inlet: The number is stored as an indicator of whether to include or delete the next number received in the left inlet. If non-zero, the number received in the left inlet is added to the <o>bag</o>. If 0, the number is deleted from the <o>bag</o>.				<br />
				<br />
				No output is triggered by a number received in either inlet.
			</description>
		</method>
		<method name="length">
			<arglist />
			<digest>
				Report the number of entries
			</digest>
			<description>
				In left inlet: Reports how many numbers are currently stored in the <o> <b>bag</b> </o>.
			</description>
		</method>
		<method name="send">
			<arglist>
				<arg name="receive-name" optional="0" type="list" />
			</arglist>
			<digest>
				Send all entries to a receive object
			</digest>
			<description>
				In left inlet: The word <m>send</m>, followed by the name of a <o>receive</o> object, sends the result of a <m>bang</m> message to all <o>receive</o> objects with that name, instead of out the <o>bag</o> object's outlet.
			</description>
		</method>
		<method name="list">
			<arglist>
				<arg name="input" optional="0" type="int" />
				<arg name="function" optional="0" type="int" />
			</arglist>
			<digest>
				Store or remove a number
			</digest>
			<description>
				Any list composed of two numbers behaves as though the first list item was sent to the left inlet and the second list item was sent to the right inlet. If the second element of the list is a non-zero number, the number is added to the collection.
			</description>
		</method>
	</methodlist>
	<!--ATTRIBUTES-->
	<!--EXAMPLE-->
	<examplelist>
		<example img="bag.png" caption="Store a collection of numbers........ Used here to detect held notes" />
	</examplelist>
	<!--SEEALSO-->
	<seealsolist>
		<seealso name="coll" />
		<seealso name="funbuff" />
		<seealso name="offer" />
	</seealsolist>
	<misc name="Output">
		<entry name="int">
			<description>
				When <m>bang</m> is received in the left inlet, all the numbers stored in <o>bag</o> are sent out one at a time, in reverse order from that in which they were stored.
				<br />
				<br />
				When <m>cut</m> is received in the left inlet, the oldest stored number is sent out.
				<br />
				<br />
				When <m>length</m> is received in the left inlet, the number of items in the <o>bag</o> object is sent out.
			</description>
		</entry>
	</misc>
</c74object>
