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;
29import javax.vecmath.Point3d;
31import org.junit.jupiter.api.Test;
32import org.openscience.cdk.Atom;
33import org.openscience.cdk.silent.Bond;
35import denoptim.constants.DENOPTIMConstants;
36import denoptim.graph.Vertex.BBType;
37import denoptim.graph.Vertex.VertexType;
38import denoptim.utils.MutationType;
48 private StringBuilder
reason =
new StringBuilder();
57 String evStr = ev.
toJson();
93 String evStr = ev.
toJson();
99 assertTrue(rebuilt1.contains(ev2.
getAP(3)));
100 assertTrue(rebuilt1.contains(ev2.
getAP(0)));
101 assertTrue(rebuilt2.contains(ev2.
getAP(1)));
102 assertTrue(rebuilt2.contains(ev2.
getAP(2)));
125 String k =
"MyPropKey";
175 assertEquals(v.
isRCV(), c.
isRCV(),
"RCV flag");
176 assertNotEquals(v.hashCode(), c.hashCode(),
"Hash code");
177 assertEquals(
"PROVALUE",c.
getProperty(
"PROPNAME"));
181 Atom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 1.1, 2.2}));
182 Atom a2 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 1.1, 2.2}));
183 Atom a3 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 1.1, 2.2}));
189 String APCLASS =
"apc" + DENOPTIMConstants.SEPARATORAPPROPSCL +
"0";
191 new double[]{0.0, 2.2, 3.3}));
193 new double[]{0.0, 0.0, 3.3}));
195 new double[]{0.0, 0.0, 1.1}));
197 new double[]{3.0, 0.0, 3.3}));
205 assertEquals(v2.
isRCV(), c2.
isRCV(),
"RCV flag");
206 assertNotEquals(v2.hashCode(), c2.hashCode(),
"Hash code");
219 "Fragments return themselves as mutable sites.");
222 "Scaffolds so not return any mutable site.");
225 "Capping groups so not return any mutable site.");
228 "Undefined building block return themselves as mutable sites.");
231 "'None' building block return themselves as mutable sites.");
235 "Consistency with restricted list of mutation types.");
238 +
"ignored mutation types is not a mutable site");
static APClass make(String ruleAndSubclass)
Creates an APClass if it does not exist already, or returns the reference to the existing instance.
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)
ArrayList< APClass > getAllAPClasses()
Returns the list of all APClasses present on this vertex.
List< Vertex > getMutationSites()
A list of mutation sites from within this vertex.
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 testSameAs_DiffAPNum()
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.