|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbcds.phison.io.PropertyBasedFormatter<V,E>
public class PropertyBasedFormatter<V extends GraphIONode,E>
Implements a simple "formatter" of node and link attributes.
The attributes are formatted according to directives given in
a comma-separated list of key=value pairs, called "properties".
The nodes in the corresponding graph must implement the
GraphIONode
interface.
The node properties supported are:
i
, and corresponds to the GraphIONode
attribute "id".
l
, and corresponds to the GraphIONode
attribute "label".
If this attribute is not present, an empty string is used instead.
The link properties supported are:
c
, refers to the link capacity in the TED
.
r
, refers to the residual link capacity in the TED.
w
, refers to the link weight in the TED.
Constructor Summary | |
---|---|
PropertyBasedFormatter(TED<V,E> ted,
java.lang.String node_prop,
java.lang.String link_prop)
Instantiates a formatter. |
Method Summary | |
---|---|
java.lang.String |
getEdgeDesc(E e)
Returns the attributes of link e . |
java.lang.String |
getEdgeExtraAttr(E e)
Always returns the empty string. |
java.lang.String |
getVertexDesc(V v)
Returns a description of node v . |
java.lang.String |
getVertexExtraAttr(V v)
Always returns an empty string. |
java.lang.String |
getVertexId(V v)
Returns the "id" attibute of parameter v , obtained via
the node's "environment" (i.e., the equivalent of
v.dumpToEnvironment().getStr("id") ). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertyBasedFormatter(TED<V,E> ted, java.lang.String node_prop, java.lang.String link_prop)
ted
- a TED
object from which link attributes will
be retrieved. It must not be null (though the link
attributes themselves may; in this case, the missing
attribute is omitted from the output).node_prop
- the node properties that should be returned.Method Detail |
---|
public java.lang.String getVertexId(V v)
v
, obtained via
the node's "environment" (i.e., the equivalent of
v.dumpToEnvironment().getStr("id")
).
getVertexId
in interface GraphFormatter<V extends GraphIONode,E>
public java.lang.String getVertexDesc(V v)
v
. If the node property
is "i", the node id is returned. If it is "l", the label is
returned.
If both i and l are present, the returned value is
(symbolically) i + "-" + l (for
example,
if i and l are equal, only i is returned (avoid "5-5").
If l is empty, only i is returned (avoid "5-").
If i is empty and l is not, only l is returned (avoid "-5").
getVertexDesc
in interface GraphFormatter<V extends GraphIONode,E>
public java.lang.String getVertexExtraAttr(V v)
getVertexExtraAttr
in interface GraphFormatter<V extends GraphIONode,E>
public java.lang.String getEdgeDesc(E e)
e
.
The values returned depend on what is present in the
constructor's link_prop
parameter:
"cap=nn" when "c" is present.
"res=nn" when "r" is present.
"w=ff" when "w" is present, formatted with "%.5f".
Note that any combination of these three values can be present.
A space is added between the respective values, if necessary.
getEdgeDesc
in interface GraphFormatter<V extends GraphIONode,E>
public java.lang.String getEdgeExtraAttr(E e)
getEdgeExtraAttr
in interface GraphFormatter<V extends GraphIONode,E>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |