private static IAtom unbox(IAtom atom) { while (atom instanceof AtomRef) atom = ((AtomRef) atom).deref(); return atom; }
/** * Utility method to dereference an atom. If the atom is not * an {@link AtomRef} it simply returns the input. * * @param atom the atom * @return non-pointer atom */ public static IAtom deref(IAtom atom) { while (atom instanceof AtomRef) atom = ((AtomRef) atom).deref(); return atom; }
private static IAtom unbox(IAtom atom) { while (atom instanceof AtomRef) atom = ((AtomRef) atom).deref(); return atom; }
private static IAtom unbox(IAtom atom) { while (atom instanceof AtomRef) atom = ((AtomRef) atom).deref(); return atom; }
/** * Utility method to dereference an atom. If the atom is not * an {@link AtomRef} it simply returns the input. * * @param atom the atom * @return non-pointer atom */ public static IAtom deref(IAtom atom) { while (atom instanceof AtomRef) atom = ((AtomRef) atom).deref(); return atom; }
private static IAtom unbox(IAtom atom) { while (atom instanceof AtomRef) atom = ((AtomRef) atom).deref(); return atom; }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj instanceof AtomRef) return super.equals(((AtomRef) obj).deref()); return super.equals(obj); } }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj instanceof AtomRef) return super.equals(((AtomRef) obj).deref()); return super.equals(obj); }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj instanceof AtomRef) return super.equals(((AtomRef) obj).deref()); return super.equals(obj); } }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj instanceof AtomRef) return super.equals(((AtomRef) obj).deref()); return super.equals(obj); } }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj instanceof AtomRef) return super.equals(((AtomRef) obj).deref()); return super.equals(obj); } }
private List<List<PharmacophoreAtom>> getPCoreAtoms(Mappings mappings) { List<List<PharmacophoreAtom>> atoms = new ArrayList<>(); // XXX: re-subsearching the query for (Map<IAtom,IAtom> map : mappings.toAtomMap()) { List<PharmacophoreAtom> pcoreatoms = new ArrayList<>(); for (IAtom atom : map.values()) pcoreatoms.add((PharmacophoreAtom) AtomRef.deref(atom)); atoms.add(pcoreatoms); } return atoms; }
private List<List<PharmacophoreAtom>> getPCoreAtoms(Mappings mappings) { List<List<PharmacophoreAtom>> atoms = new ArrayList<>(); // XXX: re-subsearching the query for (Map<IAtom,IAtom> map : mappings.toAtomMap()) { List<PharmacophoreAtom> pcoreatoms = new ArrayList<>(); for (IAtom atom : map.values()) pcoreatoms.add((PharmacophoreAtom) AtomRef.deref(atom)); atoms.add(pcoreatoms); } return atoms; }
public static PharmacophoreAtom get(IAtom atom) { if (atom instanceof PharmacophoreAtom) return (PharmacophoreAtom) atom; if (atom instanceof AtomRef) return get(((AtomRef) atom).deref()); return null; }
public static PharmacophoreAtom get(IAtom atom) { if (atom instanceof PharmacophoreAtom) return (PharmacophoreAtom) atom; if (atom instanceof AtomRef) return get(((AtomRef) atom).deref()); return null; }
@Override public boolean equals(Object obj) { if (obj instanceof AtomRef) return deref().equals(((AtomRef) obj).deref()); return deref().equals(obj); } }
@Override public boolean equals(Object obj) { if (obj instanceof AtomRef) return deref().equals(((AtomRef) obj).deref()); return deref().equals(obj); } }
@Override public boolean equals(Object obj) { if (obj instanceof AtomRef) return deref().equals(((AtomRef) obj).deref()); return deref().equals(obj); } }
@Test public void dereferencePointer() { IAtom mock = mock(IAtom.class); IAtom ptr = new AtomRef(mock); assertThat(AtomRef.deref(ptr), is(sameInstance(mock))); }
@Test public void dereferencePointerPointer() { IAtom mock = mock(IAtom.class); IAtom ptr = new AtomRef(new AtomRef(mock)); assertThat(AtomRef.deref(ptr), is(sameInstance(mock))); } }