1 package de.j32.pimstuff.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() {
49 return new FilteredIterator<Attribute>(
50 attributes_.iterator(),
51 new Filter<Attribute>() {
52 public boolean match(Attribute element) {
53 return element.type == type;
60 public Iterable<Attribute> attributes(final String type, final String rel)
62 return new Iterable<Attribute>() {
63 public Iterator<Attribute> iterator() {
64 return new FilteredIterator<Attribute>(
65 attributes_.iterator(),
66 new Filter<Attribute>() {
67 public boolean match(Attribute element) {
68 return element.type == type && element.rel == rel;