⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 equivalentrelationshipsimpl.java

📁 xbrlapi的源码
💻 JAVA
字号:
package org.xbrlapi.impl;import java.util.NoSuchElementException;import java.util.SortedMap;import java.util.TreeMap;import org.xbrlapi.EquivalentRelationships;import org.xbrlapi.Relationship;import org.xbrlapi.utilities.XBRLException;/** * @author Geoffrey Shuetrim (geoff@galexy.net) */public class EquivalentRelationshipsImpl implements EquivalentRelationships {	SortedMap<Integer,Relationship> relationships = new TreeMap<Integer,Relationship>();    /**     * @see org.xbrlapi.EquivalentRelationships#getLength()     */	public int getLength() {	    return relationships.size();	}		/**	 * @see org.xbrlapi.EquivalentRelationships#addRelationship(Relationship)	 */	public void addRelationship(Relationship relationship) throws XBRLException {				if (getActiveRelationship() == null) {			relationships.put(relationship.getPriority(),relationship);			return;		}				if (! relationship.getSemanticKey().equals(getSemanticKey())) {			throw new XBRLException("The new relationship is not semantically equal to the existing relationships.");					}		if (! relationship.getSourceIndex().equals(getSourceIndex())) {			throw new XBRLException("The new relationship starts from a different fragment.");		}		if (! relationship.getTargetIndex().equals(getTargetIndex())) {			throw new XBRLException("The new relationship ends at a different fragment.");		}				relationships.put(relationship.getPriority(),relationship);	}	/**	 * @see org.xbrlapi.EquivalentRelationships#getActiveRelationship()	 */	public Relationship getActiveRelationship() throws XBRLException {		Integer key = null;		try {			key = relationships.lastKey();		} catch (NoSuchElementException e) {			return null;		}		return relationships.get(key);	}		/**	 * @return The semantic key that is the same for all relationships in the 	 * collection, or null if the collection contains no relationships.	 * @throws XBRLException	 */	private String getSemanticKey() throws XBRLException {		Relationship r = getActiveRelationship();		if (r == null) return null;		return r.getSemanticKey();	}		/**	 * @return The index of the source fragment null if the collection 	 * contains no relationships.	 * @throws XBRLException	 */	private String getSourceIndex() throws XBRLException {		Relationship r = getActiveRelationship();		if (r == null) return null;		return r.getSourceIndex();	}		/**	 * @return The index of the target fragment null if the collection 	 * contains no relationships.	 * @throws XBRLException	 */	private String getTargetIndex() throws XBRLException {		Relationship r = getActiveRelationship();		if (r == null) return null;		return r.getTargetIndex();	}		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -