XBRLAPI

A Java API for XBRL


org.xbrlapi.networks
Class NetworksImpl

java.lang.Object
  extended by org.xbrlapi.networks.NetworksImpl
All Implemented Interfaces:
Serializable, Iterable<Network>, Networks

public class NetworksImpl
extends Object
implements Networks, Serializable

Author:
Geoffrey Shuetrim (geoff@galexy.net)
See Also:
Serialized Form

Constructor Summary
NetworksImpl(Store store)
           
 
Method Summary
 void addAll(List<Network> networks)
          Merges the specified list of networks into this set of networks.
 void addAll(Networks networks)
          Merges the specified set of networks into this set of networks.
 void addNetwork(Network network)
          If the collection of networks already has a network with the same role and arcrole, then the relationships from the added network are added into the existing network.
 void addRelationship(Relationship relationship)
           
 void addRelationships(Collection<Relationship> relationships)
           
 void addRelationships(URI arcrole)
          Adds all relationships with the given arcrole to the set of networks.
 void complete()
          Complete the networks, finding all active relationships in the data store that participate in the networks.
 boolean equals(Object obj)
           
 List<Relationship> getActiveRelationships()
           
 SortedSet<Relationship> getActiveRelationshipsFrom(String index)
           
 SortedSet<Relationship> getActiveRelationshipsTo(String index)
           
 List<URI> getArcroles()
           
 List<URI> getLinkRoles(URI arcrole)
           
 Network getNetwork(URI linkRole, URI arcrole)
           
 Networks getNetworks(URI arcrole)
           
 int getSize()
           
<F extends Fragment>
List<F>
getSources(String targetIndex, URI arcrole)
           
<F extends Fragment>
List<F>
getSources(String targetIndex, URI linkRole, URI arcrole)
           
 Store getStore()
           
<F extends Fragment>
List<F>
getTargets(String sourceIndex, URI arcrole)
           
<F extends Fragment>
List<F>
getTargets(String sourceIndex, URI linkRole, URI arcrole)
           
 int hashCode()
           
 boolean hasNetwork(URI linkRole, URI arcrole)
           
 Iterator<Network> iterator()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworksImpl

public NetworksImpl(Store store)
             throws XBRLException
Parameters:
store - The data store containing the information defining the networks.
Throws:
XBRLException - if the data store is null.
Method Detail

addNetwork

public void addNetwork(Network network)
                throws XBRLException
Description copied from interface: Networks
If the collection of networks already has a network with the same role and arcrole, then the relationships from the added network are added into the existing network.

Specified by:
addNetwork in interface Networks
Parameters:
network - The network to add to the collection of networks.
Throws:
XBRLException
See Also:
Networks.addNetwork(Network)

getNetwork

public Network getNetwork(URI linkRole,
                          URI arcrole)
                   throws XBRLException
Specified by:
getNetwork in interface Networks
Parameters:
linkRole - The link role of the network to get.
arcrole - The arc role of the network to get.
Returns:
The network corresponding to the given arc and link roles or null if no such network is available.
Throws:
XBRLException
See Also:
Networks.getNetwork(URI, URI)

getNetworks

public Networks getNetworks(URI arcrole)
                     throws XBRLException
Specified by:
getNetworks in interface Networks
Parameters:
arcrole - The arc role to get the networks for.
Returns:
a list of networks, one per link role that exists for the specified arc role.
Throws:
XBRLException
See Also:
Networks.getNetworks(URI)

getSources

public <F extends Fragment> List<F> getSources(String targetIndex,
                                               URI arcrole)
                                    throws XBRLException
Specified by:
getSources in interface Networks
Parameters:
targetIndex - The index of the fragment that is the target for the sources being retrieved
arcrole - The arc role of the relationships to navigate from the given target to the sources being retrieved.
Returns:
The set of source fragments for active relationships in the collection of networks that are direct connections from the source fragments to the specified target fragment.
Throws:
XBRLException
See Also:
Networks.getSources(String, URI)

getSources

public <F extends Fragment> List<F> getSources(String targetIndex,
                                               URI linkRole,
                                               URI arcrole)
                                    throws XBRLException
Specified by:
getSources in interface Networks
Parameters:
targetIndex - The index of the fragment that is the target for the sources being retrieved
linkRole - The arc role of the relationships to navigate from the given target to the sources being retrieved.
arcrole - The arc role of the relationships to navigate from the given target to the sources being retrieved.
Returns:
The set of source fragments for active relationships in the chosen network that are direct connections from the source fragments to the specified. target fragment.
Throws:
XBRLException
See Also:
Networks.getSources(String, URI, URI)

getTargets

public <F extends Fragment> List<F> getTargets(String sourceIndex,
                                               URI arcrole)
                                    throws XBRLException
Specified by:
getTargets in interface Networks
Parameters:
sourceIndex - The index of the fragment that is the source for the targets being retrieved
arcrole - The arc role of the relationships to navigate from the given source to the targets being retrieved.
Returns:
The set of target fragments for active relationships in the collection of networks that are direct connections from the target fragments to the specified source fragment.
Throws:
XBRLException
See Also:
Networks.getTargets(String, URI)

getTargets

public <F extends Fragment> List<F> getTargets(String sourceIndex,
                                               URI linkRole,
                                               URI arcrole)
                                    throws XBRLException
Specified by:
getTargets in interface Networks
Parameters:
sourceIndex - The index of the fragment that is the source for the targets being retrieved
linkRole - The arc role of the relationships to navigate from the given source to the targets being retrieved.
arcrole - The arc role of the relationships to navigate from the given source to the targets being retrieved.
Returns:
The set of target fragments for active relationships in the chosen network that are direct connections from the target fragments to the specified source fragment.
Throws:
XBRLException
See Also:
Networks.getTargets(String, URI, URI)

hasNetwork

public boolean hasNetwork(URI linkRole,
                          URI arcrole)
Specified by:
hasNetwork in interface Networks
Parameters:
linkRole - The link role of the network to get.
arcrole - The arc role of the network to get.
Returns:
true if there is a network in the collection for the given arc role and link role.
See Also:
Networks.hasNetwork(URI, URI)

addRelationship

public void addRelationship(Relationship relationship)
                     throws XBRLException
Specified by:
addRelationship in interface Networks
Parameters:
relationship - The relationship to add to the collection of networks.
Throws:
XBRLException
See Also:
Networks.addRelationship(Relationship)

addRelationships

public void addRelationships(URI arcrole)
                      throws XBRLException
Description copied from interface: Networks
Adds all relationships with the given arcrole to the set of networks.

Specified by:
addRelationships in interface Networks
Parameters:
arcrole - The required arcrole.
Throws:
XBRLException
See Also:
Networks.addRelationships(URI)

getSize

public int getSize()
            throws XBRLException
Specified by:
getSize in interface Networks
Returns:
The number of networks in the collection.
Throws:
XBRLException
See Also:
Networks.getSize()

getArcroles

public List<URI> getArcroles()
                      throws XBRLException
Specified by:
getArcroles in interface Networks
Returns:
a list of arc role values for which there are networks in the collection. The list is empty if there are no networks in the set of networks.
Throws:
XBRLException
See Also:
Networks.getArcroles()

getLinkRoles

public List<URI> getLinkRoles(URI arcrole)
                       throws XBRLException
Specified by:
getLinkRoles in interface Networks
Parameters:
arcrole - The arc role for which the link roles are required.
Returns:
a list of link role values for which there are networks in the collection with the given arc role. The list is empty if there are no networks with the given arc role.
Throws:
XBRLException
See Also:
Networks.getLinkRoles(URI)

iterator

public Iterator<Network> iterator()
Specified by:
iterator in interface Iterable<Network>
See Also:
Iterable.iterator()

getStore

public Store getStore()
Specified by:
getStore in interface Networks
Returns:
the data store containing the information defining this collection of networks.
See Also:
Networks.getStore()

addAll

public void addAll(Networks networks)
            throws XBRLException
Description copied from interface: Networks
Merges the specified set of networks into this set of networks.

Specified by:
addAll in interface Networks
Parameters:
networks - The networks to merge into this collection of networks.
Throws:
XBRLException
See Also:
Networks.addAll(Networks)

addAll

public void addAll(List<Network> networks)
            throws XBRLException
Description copied from interface: Networks
Merges the specified list of networks into this set of networks.

Specified by:
addAll in interface Networks
Parameters:
networks - The networks to merge into this collection of networks.
Throws:
XBRLException
See Also:
Networks.addAll(List)

complete

public void complete()
              throws XBRLException
Description copied from interface: Networks
Complete the networks, finding all active relationships in the data store that participate in the networks.

Specified by:
complete in interface Networks
Throws:
XBRLException
See Also:
Networks.complete()

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

addRelationships

public void addRelationships(Collection<Relationship> relationships)
                      throws XBRLException
Specified by:
addRelationships in interface Networks
Parameters:
relationships - THe list of relationships to add to the networks
Throws:
XBRLException
See Also:
Networks.addRelationships(Collection)

getActiveRelationships

public List<Relationship> getActiveRelationships()
                                          throws XBRLException
Specified by:
getActiveRelationships in interface Networks
Returns:
a list of all active relationships in this collection of networks.
Throws:
XBRLException
See Also:
Networks.getActiveRelationships()

getActiveRelationshipsFrom

public SortedSet<Relationship> getActiveRelationshipsFrom(String index)
                                                   throws XBRLException
Specified by:
getActiveRelationshipsFrom in interface Networks
Parameters:
index - The index of the source fragment.
Returns:
the relationships that override or prohibit all other equivalent relationships in the networks and that run from the same source fragment.
Throws:
XBRLException
See Also:
Networks.getActiveRelationshipsFrom(java.lang.String)

getActiveRelationshipsTo

public SortedSet<Relationship> getActiveRelationshipsTo(String index)
                                                 throws XBRLException
Specified by:
getActiveRelationshipsTo in interface Networks
Parameters:
index - The index of the target fragment.
Returns:
the relationships that override or prohibit all other equivalent relationships in the networks and that run to the same target fragment.
Throws:
XBRLException
See Also:
Networks.getActiveRelationshipsTo(java.lang.String)

Get Java XBRL API implementation at SourceForge.net.