X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=source%2Fmir%2Frss%2FRSSData.java;h=a5e6181cefc88cbfc10de174a7bd7d0c51a6759c;hb=29da699109ce8842d02b60abcdb0dfdc4aa4f0db;hp=184dcf37de377649e154ec0389183953d2d4a6d5;hpb=a459f111d85598df56c6ab711cec11632676b39c;p=mir.git diff --git a/source/mir/rss/RSSData.java b/source/mir/rss/RSSData.java index 184dcf37..a5e6181c 100755 --- a/source/mir/rss/RSSData.java +++ b/source/mir/rss/RSSData.java @@ -18,13 +18,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with any library licensed under the Apache Software License, - * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library - * (or with modified versions of the above that use the same license as the above), - * and distribute linked combinations including the two. You must obey the - * GNU General Public License in all respects for all of the code used other than - * the above mentioned libraries. If you modify this file, you may extend this - * exception to your version of the file, but you are not obligated to do so. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. * If you do not wish to do so, delete this exception statement from your version. */ package mir.rss; @@ -35,34 +35,46 @@ import java.util.Map; import java.util.Vector; public class RSSData { - private List items; - private Map item; - private RSSChannel channel; + private List resources; + private Map rdfClassToResources; + private Map identifierToResource; protected RSSData() { - items = new Vector(); - item = new HashMap(); - channel = null; + resources = new Vector(); + rdfClassToResources = new HashMap(); + identifierToResource = new HashMap(); } - protected void addItem(RSSItem anItem) { - items.add(anItem); - item.put(anItem.getIdentifier(), anItem); - }; + public List getAllResources() { + return resources; + } - public void setChannel(RSSChannel aChannel) { - channel = aChannel; + public void addResource(RDFResource aResource) { + resources.add(aResource); + List resourcesForClass = (List) rdfClassToResources.get(aResource.getRdfClass()); + if (resourcesForClass==null) { + resourcesForClass = new Vector(); + rdfClassToResources.put(aResource.getRdfClass(), resourcesForClass); + } + resourcesForClass.add(aResource); + if (aResource.getIdentifier()!=null) + identifierToResource.put(aResource.getIdentifier(), aResource); } - public RSSChannel getChannel() { - return channel; + public List getResourcesForRdfClass(String aClass) { + return (List) rdfClassToResources.get(aClass); } - public List getItems() { - return items; + public RDFResource getResourceForIdentifier(String anIdentifier) { + return (RDFResource) identifierToResource.get(anIdentifier); } - public Map getItem() { - return item; + public Object get(String aKey) { + Object result = getResourceForIdentifier(aKey); + + if (result==null) + return getResourcesForRdfClass(aKey); + else + return result; } }