mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 12:27:58 +01:00
Add getNumberOfEdges() and getNumberOfSignatures() to get insight into Network objects
This commit is contained in:
parent
6ec160835c
commit
b98707320d
1 changed files with 30 additions and 0 deletions
|
@ -96,6 +96,36 @@ public class Network {
|
||||||
return new HashMap<>(reverseEdges);
|
return new HashMap<>(reverseEdges);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the total number of edges on the network.
|
||||||
|
*
|
||||||
|
* @return number of edges
|
||||||
|
*/
|
||||||
|
public int getNumberOfEdges() {
|
||||||
|
int num = 0;
|
||||||
|
for (List<CertificationSet> outEdges : edges.values()) {
|
||||||
|
num += outEdges.size();
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the total number of signatures the network comprises.
|
||||||
|
*
|
||||||
|
* @return number of signatures
|
||||||
|
*/
|
||||||
|
public int getNumberOfSignatures() {
|
||||||
|
int num = 0;
|
||||||
|
for (List<CertificationSet> edgesPerIssuer : edges.values()) {
|
||||||
|
for (CertificationSet edge : edgesPerIssuer) {
|
||||||
|
for (List<Certification> sigsPerDatum : edge.getCertifications().values()) {
|
||||||
|
num += sigsPerDatum.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@link ReferenceTime} which was used when creating the {@link Network}.
|
* Return the {@link ReferenceTime} which was used when creating the {@link Network}.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue