11package denoptim.graph;
13import static org.junit.jupiter.api.Assertions.assertEquals;
14import static org.junit.jupiter.api.Assertions.assertFalse;
15import static org.junit.jupiter.api.Assertions.assertTrue;
17import org.junit.jupiter.api.BeforeEach;
18import org.junit.jupiter.api.Test;
20import denoptim.exception.DENOPTIMException;
21import denoptim.graph.Edge.BondType;
42 assertFalse(query.
matches(
null));
53 assertTrue(query.
matches(edgeV0V1));
54 assertTrue(query.
matches(edgeEV4EV5));
73 assertTrue(match.
matches(edgeV0V1));
76 null,
null,
null,
null);
77 assertTrue(matchSrcOnly.
matches(edgeEV5EV7));
81 assertTrue(matchTrgOnly.
matches(edgeEV5EV7));
86 assertFalse(wrongTarget.
matches(edgeEV5EV7));
105 assertTrue(match.
matches(edgeV1V2));
106 assertFalse(match.
matches(edgeV1V5));
107 match =
new EdgeQuery(
null,
null, ap0,
null,
null);
108 assertTrue(match.
matches(edgeV1V2));
109 assertFalse(match.
matches(edgeV1V5));
110 match =
new EdgeQuery(
null,
null, ap1,
null,
null);
111 assertTrue(match.
matches(edgeV1V3));
112 assertFalse(match.
matches(edgeV1V5));
113 match =
new EdgeQuery(
null,
null,
null, ap1,
null);
114 assertTrue(match.
matches(edgeV1V5));
115 assertFalse(match.
matches(edgeV1V3));
116 match =
new EdgeQuery(
null,
null, ap2, ap1,
null);
117 assertTrue(match.
matches(edgeV1V5));
118 assertFalse(match.
matches(edgeV1V3));
135 assertTrue(triple.
matches(edgeV1V2));
136 assertFalse(triple.
matches(edgeV1V3));
137 assertTrue(single.
matches(edgeV1V3));
138 assertFalse(single.
matches(edgeV1V2));
156 assertTrue(srcClass.
matches(edgeV1V2));
157 assertTrue(trgClass.
matches(edgeV1V2));
158 assertFalse(trgClass.
matches(edgeV1V3));
177 assertTrue(query.
matches(edgeV1V2));
178 assertFalse(query.
matches(edgeV1V3));
185 assertFalse(almost.
matches(edgeV1V2));
186 assertFalse(query.
matches(edgeV1V3));
198 int directMatches = 0;
207 assertEquals(5, directMatches);
208 assertEquals(directMatches,
210 java.util.logging.Logger.getLogger(
"test")).size());
223 null,
null,
null,
null,
null);
225 null,
null,
null,
null,
null);
233 assertTrue(query.
matches(edgeV1V2));
static APClass make(String ruleAndSubclass)
Creates an APClass if it does not exist already, or returns the reference to the existing instance.
Query for searching AttachmentPoints.
Container for the list of vertices and the edges that connect them.
Vertex getVertexAtPosition(int pos)
Returns the vertex that is in the given position of the list of vertices belonging to this graph.
List< Edge > findEdges(EdgeQuery edgeQuery, Logger logger)
Search this graph for edges that match the criteria defined in a query.
List< Edge > getEdgeList()
Unit test for DENOPTIMGraph.
static DGraph makeTestGraphA2()
Build a graph meant to be used in unit tests.
This class represents the edge between two vertices.
A query for edges: a list of properties that target edges should possess in order to match this query...
boolean matches(Edge e)
Tests whether the given edge satisfies this query.
Unit tests for EdgeQuery#matches(Edge).
void testMatchesNullEdge()
void testMatchesBondType()
void testMatchesNestedQueries()
void testMatchesAPClasses()
void testFindEdgesUsesMatches()
void testMatchesSourceAndTargetVertices()
void testMatchesAttachmentPointIndices()
void testMatchesCombinedCriteria()
void testMatchesAllNullCriteria()
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
Edge getEdgeToParent()
Looks into the edges that use any of the APs that belong to this vertex and returns the edge that has...
Query for searching vertices.
Possible chemical bond types an edge can represent.