19package denoptim.graph;
21import static org.junit.jupiter.api.Assertions.assertEquals;
22import static org.junit.jupiter.api.Assertions.assertFalse;
23import static org.junit.jupiter.api.Assertions.assertNotEquals;
24import static org.junit.jupiter.api.Assertions.assertTrue;
26import java.util.ArrayList;
27import java.util.Arrays;
30import javax.vecmath.Point3d;
32import org.junit.jupiter.api.Test;
33import org.openscience.cdk.Atom;
34import org.openscience.cdk.silent.Bond;
36import denoptim.constants.DENOPTIMConstants;
37import denoptim.fragspace.FragmentSpace;
38import denoptim.graph.Vertex.BBType;
39import denoptim.graph.Vertex.VertexType;
40import denoptim.utils.MutationType;
50 private StringBuilder
reason =
new StringBuilder();
59 String evStr = ev.
toJson();
95 String evStr = ev.
toJson();
101 assertTrue(rebuilt1.contains(ev2.
getAP(3)));
102 assertTrue(rebuilt1.contains(ev2.
getAP(0)));
103 assertTrue(rebuilt2.contains(ev2.
getAP(1)));
104 assertTrue(rebuilt2.contains(ev2.
getAP(2)));
127 String k =
"MyPropKey";
177 assertEquals(v.
isRCV(), c.
isRCV(),
"RCV flag");
178 assertNotEquals(v.hashCode(), c.hashCode(),
"Hash code");
179 assertEquals(
"PROVALUE",c.
getProperty(
"PROPNAME"));
183 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
184 Atom a2 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
185 Atom a3 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
191 String APCLASS =
"apc" + DENOPTIMConstants.SEPARATORAPPROPSCL +
"0";
193 new double[]{0.0, 2.2, 3.3}));
195 new double[]{0.0, 0.0, 3.3}));
197 new double[]{0.0, 0.0, 1.1}));
199 new double[]{3.0, 0.0, 3.3}));
207 assertEquals(v2.
isRCV(), c2.
isRCV(),
"RCV flag");
208 assertNotEquals(v2.hashCode(), c2.hashCode(),
"Hash code");
221 "Fragments return themselves as mutable sites.");
224 "Scaffolds so not return any mutable site.");
227 "Capping groups so not return any mutable site.");
230 "Undefined building block return themselves as mutable sites.");
233 "'None' building block return themselves as mutable sites.");
237 "Consistency with restricted list of mutation types.");
240 +
"ignored mutation types is not a mutable site");
256 assertEquals(3, aps.size());
260 assertTrue(ap.getAPClass().toString().startsWith(
"Ab"));
Class defining a space of building blocks.
static Vertex getPolarizedRCV(boolean polarity)
Returns a newly-built vertex that can play the role of a ring-closing vertex even when working with 3...
static APClass make(String ruleAndSubclass)
Creates an APClass if it does not exist already, or returns the reference to the existing instance.
static final APClass APCAROMBRIDGE2EL
Conventional class of attachment points on aromatic-bridge vertexes bringing 2 electrons to the aroma...
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
Container for the list of vertices and the edges that connect them.
void addVertex(Vertex vertex)
Appends a vertex to this graph without creating any edge.
void appendVertexOnAP(AttachmentPoint srcAP, AttachmentPoint trgAP)
Append a vertex to this graph: adds the new vertex to the list of vertices belonging to the graph,...
An empty vertex has the behaviors of a vertex, but has no molecular structure.
void addSymmetricAPSet(SymmetricAPs symAPs)
boolean sameAs(EmptyVertex other, StringBuilder reason)
Compares this and another vertex ignoring vertex IDs.
EmptyVertex clone()
Returns a deep-copy of this vertex.
String toJson()
Produces a string that represents this vertex and that adheres to the JSON format.
List< SymmetricAPs > getSymmetricAPSets()
void addAP()
Adds an attachment point with no APClass or other attribute.
Class representing a continuously connected portion of chemical object holding attachment points.
AttachmentPoint addAPOnAtom(IAtom srcAtm, APClass apc, Point3d vector)
Add an attachment point to the specifies atom.
Fragment clone()
Returns a deep copy of this fragments.
List< SymmetricAPs > getSymmetricAPSets()
String toJson()
Produces a string that represents this vertex and that adheres to the JSON format.
A collection of AttachmentPoints that are related by a relation that we call "symmetry",...
boolean add(T item)
Adds an item to this list, if not already present.
String toJson()
Produces a string that represents this vertex and that adheres to the JSON format.
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
void setMutationTypes(List< MutationType > lst)
List< AttachmentPoint > getAPsWithAPClassStartingWith(String root)
Finds only APs that have APClass starting with the given string.
ArrayList< APClass > getAllAPClasses()
Returns the list of all APClasses present on this vertex.
boolean isConnectedToAromaticBridge()
Checks if this vertex is connected to any vertex meant to be a piece of an aromatic system.
List< Vertex > getMutationSites()
A list of mutation sites from within this vertex.
boolean isAromaticBridge()
Checks if this vertex is meant to be a piece of an aromatic system.
abstract List< SymmetricAPs > getSymmetricAPSets()
Object getProperty(Object property)
static Vertex fromJson(String json)
void setUniquefyingProperty(String key)
Add the given key among the properties that are checked for equality when comparing vertices with the...
final VertexType vertexType
Field distinguishing implementations of Vertex when deserializing JSON representations.
void setProperty(Object key, Object property)
AttachmentPoint getAP(int i)
Get attachment point i on this vertex.
Unit test for DENOPTIMVertex.
void testGetMutationSites()
void testIsConnectedToAromaticBridge()
void testSameAs_DiffAPNum()
void testGetAPsWithAPClassStartingWith()
void testFromToJSON_minimal()
void testFromToJSON_withSymmetricAPs()
The type of building block.
Flag declaring the type of Vertex implementation.
Types of mutation defined in relation to what happens to the target vertex (i.e., the actual mutation...
EXTEND
append vertices on the target vertex according to substitution probability.