XML Feeds

.

[java-dev] Re: beginner question about Atom.intersection

Emmanuel Jourdan c74-mailinglists at e--j.com
Sat Sep 1 11:23:18 MDT 2007


On 1 sept. 07, at 19:07, matpe wrote:

> Thanks Emmanuel
> but it doesn't work?


import com.cycling74.max.*;

public class Intersect2List extends MaxObject
{
	
	private Atom[] inputList1;
	private Atom[] inputList2;
	private Atom[] result;

	
	private Intersect2List() {
		declareTypedIO("LL","L");
		declareInlets(new int[]{DataTypes.LIST, DataTypes.LIST});
		createInfoOutlet(false);
		setInletAssist(new String[] {"list a and bang", "list b"});
		setOutletAssist(new String[] {"intersection list"});
	}
	
	public void list(Atom[] args) {
		switch (getInlet()) {
			case 0:
				inputList1 = args;
				bang();	// trigger because it arrived in the left inlet
				break;
			case 1:
				inputList2 = args;
				break;
		}
	}
	
	public void listIntersect() {
		result = Atom.intersection(inputList1, inputList2);
		outlet(0, result);
	}
	
	public void bang() {
		listIntersect();
	}
}

This one works!
ej



More information about the java-dev mailing list