Search this API

y.layout
Class PortCandidateSet

java.lang.Object
  extended by y.layout.PortCandidateSet

public class PortCandidateSet
extends Object

This class describes a set of possible PortCandidates and their cardinality for a node-like entity.


Nested Class Summary
static interface PortCandidateSet.CandidateMatcher
          The interface that is used by PortCandidateSet to retrieve PortCandidates from.
static interface PortCandidateSet.Entry
          An interface that is returned by the find methods in PortCandidateSet.CandidateMatcher and the getEntries() method.
 
Field Summary
static Object NODE_DP_KEY
          A DataProvider key used to associate instances of this class with nodes in a graph.
 
Constructor Summary
PortCandidateSet()
          Creates a new and empty instance of PortCandidateSet
 
Method Summary
 void add(PortCandidate p)
          Adds another PortCandidate with capacity 1 to the set of PortCandidates.
 void add(PortCandidate p, int connections)
          Adds another PortCandidate with the given capacity to the set of candidates.
 PortCandidateSet.CandidateMatcher createMatcher()
          Creates a CandidateMatcher instance that can be used to query entries from.
 int getConnectionCount()
          Returns the maximum number of connections this set allows or Integer.MAX_VALUE if the number is unbound.
protected  double getCost(PortCandidateSet.Entry entry, Edge edge, boolean source, double xOffset, double yOffset)
          Calculates the cost for each entry for the given edge configuration.
 Iterator getEntries()
          Returns an Iterator over the list of entries.
protected  double getPriority(PortCandidateSet.Entry entry, Edge edge, boolean source)
          Returns the priority of the given entry.
 void remove(PortCandidateSet.Entry entry)
          Removes the entry from the internal list of PortCandidate entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_DP_KEY

public static final Object NODE_DP_KEY
A DataProvider key used to associate instances of this class with nodes in a graph.

Constructor Detail

PortCandidateSet

public PortCandidateSet()
Creates a new and empty instance of PortCandidateSet

See Also:
add(PortCandidate), add(PortCandidate, int)
Method Detail

add

public void add(PortCandidate p)
Adds another PortCandidate with capacity 1 to the set of PortCandidates.

Parameters:
p - the candidate to add.

add

public void add(PortCandidate p,
                int connections)
Adds another PortCandidate with the given capacity to the set of candidates.

Parameters:
p - the candidate to add
connections - the maximum number of connections allowed to the candidate

getConnectionCount

public int getConnectionCount()
Returns the maximum number of connections this set allows or Integer.MAX_VALUE if the number is unbound.

Returns:
the number of connections or Integer.MAX_VALUE

remove

public void remove(PortCandidateSet.Entry entry)
Removes the entry from the internal list of PortCandidate entries.

Parameters:
entry - the entry to remove from this set of candidates.

getEntries

public Iterator getEntries()
Returns an Iterator over the list of entries.

Returns:
an Iterator that yields PortCandidateSet.Entry instances.

createMatcher

public PortCandidateSet.CandidateMatcher createMatcher()
Creates a CandidateMatcher instance that can be used to query entries from.

Returns:
a fresh matching instance that reflects the current state of this set of candidates.

getCost

protected double getCost(PortCandidateSet.Entry entry,
                         Edge edge,
                         boolean source,
                         double xOffset,
                         double yOffset)
Calculates the cost for each entry for the given edge configuration.


getPriority

protected double getPriority(PortCandidateSet.Entry entry,
                             Edge edge,
                             boolean source)
Returns the priority of the given entry. The higher the priority the sooner it will be chosen by the PortCandidateSet.CandidateMatcher.


© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.