|
47 | 47 | * A expression stores a predicate tree for checking properties of atoms |
48 | 48 | * and bonds. |
49 | 49 | * <pre> |
50 | | - * Expr expr = new Expr(ExprType.ELEMENT, 6); |
| 50 | + * Expr expr = new Expr(ELEMENT, 6); |
51 | 51 | * if (expr.matches(atom)) { |
52 | 52 | * // expression matches if atom is a carbon! |
53 | 53 | * } |
|
57 | 57 | * an intermediate (logical) node. The simplest expression trees contain a |
58 | 58 | * single leaf node: |
59 | 59 | * <pre> |
60 | | - * new Expr(ExprType.IS_AROMATIC; // matches any aromatic atom |
61 | | - * new Expr(ExprType.ELEMENT, 6); // matches any carbon atom (atomic num=6) |
62 | | - * new Expr(ExprType.VALENCE, 4); // matches an atom with valence 4 |
63 | | - * new Expr(ExprType.DEGREE, 1); // matches a terminal atom, e.g. -OH, =O |
64 | | - * new Expr(ExprType.IS_IN_RING); // matches any atom marked as in a ring |
65 | | - * new Expr(ExprType.IS_HETERO); // matches anything other than carbon or nitrogen |
66 | | - * new Expr(ExprType.TRUE); // any atom |
| 60 | + * new Expr(IS_AROMATIC); // matches any aromatic atom |
| 61 | + * new Expr(ELEMENT, 6); // matches any carbon atom (atomic num=6) |
| 62 | + * new Expr(VALENCE, 4); // matches an atom with valence 4 |
| 63 | + * new Expr(DEGREE, 1); // matches a terminal atom, e.g. -OH, =O |
| 64 | + * new Expr(IS_IN_RING); // matches any atom marked as in a ring |
| 65 | + * new Expr(IS_HETERO); // matches anything other than carbon or nitrogen |
| 66 | + * new Expr(TRUE); // any atom |
67 | 67 | * </pre> |
68 | 68 | * Logical internal nodes combine one or two sub-expressions with conjunction |
69 | 69 | * (and), disjunction (or), and negation (not). |
|
79 | 79 | * </pre> |
80 | 80 | * We can construct this tree as follows: |
81 | 81 | * <pre> |
82 | | - * Expr expr = new Expr(ExprType.ELEMENT, 35) // Br |
83 | | - * .or(new Expr(ExprType.ELEMENT, 17)) // Cl |
84 | | - * .or(new Expr(ExprType.ELEMENT, 9)) // F</pre> |
| 82 | + * Expr expr = new Expr(ELEMENT, 9) // F |
| 83 | + * .or(new Expr(ELEMENT, 17)) // Cl |
| 84 | + * .or(new Expr(ELEMENT, 35)) // Br</pre> |
85 | 85 | * A more verbose construction could also be used: |
86 | 86 | * <pre> |
87 | | - * Expr leafF = new Expr(ExprType.ELEMENT, 9); // F |
88 | | - * Expr leafCl = new Expr(ExprType.ELEMENT, 17); // Cl |
89 | | - * Expr leafBr = new Expr(ExprType.ELEMENT, 35); // Br |
90 | | - * Expr node4 = new Expr(ExprType.OR, leaf2, leaf3); |
91 | | - * Expr node5 = new Expr(ExprType.OR, leaf1, node4); |
| 87 | + * Expr leafF = new Expr(ELEMENT, 9); // F |
| 88 | + * Expr leafCl = new Expr(ELEMENT, 17); // Cl |
| 89 | + * Expr leafBr = new Expr(ELEMENT, 35); // Br |
| 90 | + * Expr node4 = new Expr(OR, leaf2, leaf3); |
| 91 | + * Expr node5 = new Expr(OR, leaf1, node4); |
92 | 92 | * </pre> |
93 | 93 | * |
94 | 94 | * Expressions can be used to match bonds. Note some expressions apply to either |
95 | 95 | * atoms or bonds. |
96 | 96 | * <pre> |
97 | | - * new Expr(ExprType.TRUE); // any bond |
98 | | - * new Expr(ExprType.IS_IN_RING); // any ring bond |
99 | | - * new Expr(ExprType.ALIPHATIC_ORDER, 2); // double bond |
| 97 | + * new Expr(TRUE); // any bond |
| 98 | + * new Expr(IS_IN_RING); // any ring bond |
| 99 | + * new Expr(ALIPHATIC_ORDER, 2); // double bond |
100 | 100 | * </pre> |
101 | 101 | * See the documentation for {@link Type}s for a detail explanation of |
102 | 102 | * each type. |
|
0 commit comments