test_class.file: base/isomorphism/src/test/java/org/openscience/cdk/isomorphism/VFStateTest.java
test_class.identifier: VFStateTest
test_case.body: @Test
      public void infeasibleTerminalCount() throws Exception {
          VFState state = createBenzeneToNaphthalene(AtomMatcher.forAny(), BondMatcher.forAny());
          assertTrue(state.feasible(4, 4)); // 4, 4 is feasible
          state.add(0, 0);
          state.add(1, 1);
          state.add(2, 2);
          state.add(3, 3);
          assertFalse(state.feasible(4, 4)); // 4, 4 is infeasible
      }
test_case.class_method_signature: VFStateTest.infeasibleTerminalCount()
test_case.full_signature: @Test public void infeasibleTerminalCount()
test_case.identifier: infeasibleTerminalCount
test_case.invocations: createBenzeneToNaphthalene forAny forAny assertTrue feasible add add add add assertFalse feasible
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void infeasibleTerminalCount()
focal_class.declarator: container1
focal_class.modifier: private final
focal_class.original_string: private final IAtomContainer container1, container2;
focal_class.type: IAtomContainer
focal_class.var_name: container1
focal_class.declarator: bonds1
focal_class.modifier: private final
focal_class.original_string: private final EdgeToBondMap  bonds1, bonds2;
focal_class.type: EdgeToBondMap
focal_class.var_name: bonds1
focal_class.declarator: atomMatcher
focal_class.modifier: private final
focal_class.original_string: private final AtomMatcher    atomMatcher;
focal_class.type: AtomMatcher
focal_class.var_name: atomMatcher
focal_class.declarator: bondMatcher
focal_class.modifier: private final
focal_class.original_string: private final BondMatcher    bondMatcher;
focal_class.type: BondMatcher
focal_class.var_name: bondMatcher
focal_class.file: base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/VFState.java
focal_class.identifier: VFState
focal_class.class_method_signature: VFState.VFState(IAtomContainer container1, IAtomContainer container2, int[][] g1, int[][] g2, EdgeToBondMap bonds1,
              EdgeToBondMap bonds2, AtomMatcher atomMatcher, BondMatcher bondMatcher)
focal_class.full_signature:   VFState(IAtomContainer container1, IAtomContainer container2, int[][] g1, int[][] g2, EdgeToBondMap bonds1,
              EdgeToBondMap bonds2, AtomMatcher atomMatcher, BondMatcher bondMatcher)
focal_class.identifier: VFState
focal_class.parameters: (IAtomContainer container1, IAtomContainer container2, int[][] g1, int[][] g2, EdgeToBondMap bonds1,
              EdgeToBondMap bonds2, AtomMatcher atomMatcher, BondMatcher bondMatcher)
focal_class.signature:  VFState(IAtomContainer container1, IAtomContainer container2, int[][] g1, int[][] g2, EdgeToBondMap bonds1,
              EdgeToBondMap bonds2, AtomMatcher atomMatcher, BondMatcher bondMatcher)
focal_class.class_method_signature: VFState.feasible(int n, int m)
focal_class.full_signature: @Override boolean feasible(int n, int m)
focal_class.identifier: feasible
focal_class.modifiers: @Override
focal_class.parameters: (int n, int m)
focal_class.return: boolean
focal_class.signature: boolean feasible(int n, int m)
focal_class.superclass: extends AbstractVFState
focal_method.body: @Override
      boolean feasible(int n, int m) {
  
          // verify atom semantic feasibility
          if (!atomMatcher.matches(container1.getAtom(n), container2.getAtom(m))) return false;
  
          // unmapped terminal vertices n and m are adjacent to
          int nTerminal1 = 0, nTerminal2 = 0;
          // unmapped non-terminal (remaining) vertices n and m are adjacent to
          int nRemain1 = 0, nRemain2 = 0;
  
          // 0-look-ahead: check each adjacent edge for being mapped, and count
          // terminal or remaining
          for (int n_prime : g1[n]) {
              int m_prime = m1[n_prime];
  
              // v is already mapped, there should be an edge {m, w} in g2.
              if (m_prime != UNMAPPED) {
                  IBond bond2 = bonds2.get(m, m_prime);
                  // the bond is not present in the target
                  if (bond2 == null) return false;
                  // verify bond semantic feasibility
                  if (!bondMatcher.matches(bonds1.get(n, n_prime), bond2)) return false;
              } else {
                  if (t1[n_prime] > 0)
                      nTerminal1++;
                  else
                      nRemain1++;
              }
          }
  
          // 0-look-ahead: check each adjacent edge for being mapped, and count
          // terminal or remaining
          for (int m_prime : g2[m]) {
              int n_prime = m2[m_prime];
  
              if (n_prime != UNMAPPED) {
                  IBond bond1 = bonds1.get(n, n_prime);
                  // the bond is not present in the query
                  if (bond1 == null) return false;
                  // verify bond semantic feasibility
                  if (!bondMatcher.matches(bond1, bonds2.get(m, m_prime))) return false;
              } else {
                  if (t2[m_prime] > 0)
                      nTerminal2++;
                  else
                      nRemain2++;
              }
          }
  
          // 1-look-ahead : the mapping {n, m} is feasible iff the number of
          // terminal vertices (t1) adjacent to n is equal to the
          // number of terminal vertices (t2) adjacent to m.
          //
          // 2-look-ahead: the mapping {n, m} is feasible iff the number of
          // vertices adjacent to n that are neither in m1 or t1 is equal to
          // the number of the number of vertices adjacent to m that are neither
          // in m2 or t2.
          return nTerminal1 == nTerminal2 && nRemain1 == nRemain2;
      }
focal_method.class_method_signature: VFState.feasible(int n, int m)
focal_method.full_signature: @Override boolean feasible(int n, int m)
focal_method.identifier: feasible
focal_method.invocations: matches getAtom getAtom get matches get get matches get
focal_method.modifiers: @Override
focal_method.parameters: (int n, int m)
focal_method.return: boolean
focal_method.signature: boolean feasible(int n, int m)