1 package de.j32.jpim.data;
3 import java.util.ArrayList;
4 import java.util.Iterator;
6 import de.j32.util.Filter;
7 import de.j32.util.FilteredIterator;
13 ArrayList<Attribute> attributes_ = new ArrayList<Attribute>();
15 public void name(String name)
25 public void id(long id)
35 public void attribute(String type, String rel, String value)
37 attributes_.add(new Attribute(type, rel, value, attributes_.size()));
40 public Iterable<Attribute> attributes()
45 public Iterable<Attribute> attributes(final String type)
47 return new Iterable<Attribute>() {
48 public Iterator<Attribute> iterator()
50 return new FilteredIterator<Attribute>(attributes_.iterator(),
51 new Filter<Attribute>() {
52 public boolean match(Attribute element)
54 return element.type == type;
61 public Iterable<Attribute> attributes(final String type, final String rel)
63 return new Iterable<Attribute>() {
64 public Iterator<Attribute> iterator()
66 return new FilteredIterator<Attribute>(attributes_.iterator(),
67 new Filter<Attribute>() {
68 public boolean match(Attribute element)
70 return element.type == type
71 && element.rel == rel;