1 package uk.ac.cam.ch.wwmm.opsin;
2 
3 /**
4  * Holds information about the positions of 2 atoms relative to a double bond allowing the specification of cis/trans stereochemistry
5  * @author dl387
6  *
7  */
8 class BondStereo {
9 
10 	private Atom[] atomRefs4;
11 	private BondStereoValue bondStereoValue;
12 
13 	/**
14 	 * Possible values for a bondStereo element
15 	 * @author dl387
16 	 *
17 	 */
18 	enum BondStereoValue{
19 		CIS("C"),
20 		TRANS("T");
21 
22 		private final String value;
BondStereoValue(String value)23 		BondStereoValue(String value){
24 			this.value = value;
25 		}
26 		@Override
toString()27 		public String toString() {
28 			return value;
29 		}
30 	}
31 
32 	/**
33 	 * Create a bondStereo from an array of 4 atoms. The 2nd and 3rd atoms of this array are connected via a double bond.
34 	 * The 1st and 4th atoms are at either end of this bond and indication is given as to whether they are cis or trans to each other.
35 	 * @param atomRefs4
36 	 * @param cOrT
37 	 */
BondStereo(Atom[] atomRefs4, BondStereoValue cOrT)38 	BondStereo(Atom[] atomRefs4, BondStereoValue cOrT) {
39 		if (atomRefs4.length !=4){
40 			throw new IllegalArgumentException("atomRefs4 must contain references to 4 atoms");
41 		}
42 		this.atomRefs4 = atomRefs4;
43 		this.bondStereoValue = cOrT;
44 	}
45 
getAtomRefs4()46 	Atom[] getAtomRefs4() {
47 		return atomRefs4;
48 	}
setAtomRefs4(Atom[] atomRefs4)49 	void setAtomRefs4(Atom[] atomRefs4) {
50 		this.atomRefs4 = atomRefs4;
51 	}
getBondStereoValue()52 	BondStereoValue getBondStereoValue() {
53 		return bondStereoValue;
54 	}
setBondStereoValue(BondStereoValue bondStereoValue)55 	void setBondStereoValue(BondStereoValue bondStereoValue) {
56 		this.bondStereoValue = bondStereoValue;
57 	}
58 }
59