📄 xmlcollectionimpl.java
字号:
// You can redistribute this software and/or modify it under the terms of
// the Ozone Library License version 1 published by ozone-db.org.
//
// The original code and portions created by SMB are
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
//
// $Id: XMLCollectionImpl.java,v 1.2 2003/11/20 23:18:42 per_nyfelt Exp $
package org.ozoneDB.xml.core;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import org.ozoneDB.OzoneObject;
import org.xmldb.api.base.Resource;
/**
*
* @author <a href="http://www.smb-tec.com">SMB</a>
* @version $Revision: 1.2 $
*/
public class XMLCollectionImpl extends OzoneObject
implements XMLCollection {
//
// data
//
// XML documents in this collection, String as key, XMLContainer as value
private Set xmlDocuments = null;
private Map childCollections = null;
private XMLCollection parentCollection = null;
private String collectionName = null;
public XMLCollectionImpl() {
// the id's for the XML documents in this collection
xmlDocuments = new HashSet();
// child collections
childCollections = new HashMap();
}
/**
*/
public XMLCollection getParentCollection() {
return parentCollection;
}
/**
* Added to support parent-child collections
*/
public void setParentCollection(XMLCollection parentCollection) {
this.parentCollection = parentCollection;
}
/**
*/
public String getName() {
return collectionName;
}
/**
*/
public void setName(String name) {
collectionName = name;
}
/**
*/
public int getChildCollectionCount() {
return childCollections.size();
}
/**
*/
public synchronized String[] listChildCollections() {
return (String[]) childCollections.keySet().toArray( new String[childCollections.keySet().size()] );
}
/**
*/
public XMLCollection getChildCollection( String name ) {
return (XMLCollection)childCollections.get(name);
}
public int getResourceCount() {
return xmlDocuments.size();
}
public Set getResources() {
return xmlDocuments;
}
public boolean hasResource(String id) {
return xmlDocuments.contains(id);
}
public void addResource(String id) {
System.out.println("XMLCollectionImpl.addResource() - Adding container to Set");
xmlDocuments.add(id);
}
public void storeResource( String id, Resource res ) {
System.out.println("XMLCOllectionImpl.storeResource() - Dont know what to do here");
}
/**
* Added to support parent-child collections
*/
public void setChildCollection(String childName, XMLCollection childCollection) {
childCollections.put(childName,childCollection);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -