@Test public void testGetPeers() { final LHSGeneratorContext root = factory.newGeneratorContext(); final LHSGeneratorContext peer1 = factory.newPeerGeneratorContext(root, mock(FieldConstraint.class)); final LHSGeneratorContext peer2 = factory.newPeerGeneratorContext(peer1, mock(FieldConstraint.class)); final List<LHSGeneratorContext> peers = factory.getPeers(root); assertThat(peers).contains(peer1, peer2); }
public List<LHSGeneratorContext> getPeers(final LHSGeneratorContext peer) { final List<LHSGeneratorContext> peers = new ArrayList<LHSGeneratorContext>(); for (LHSGeneratorContext c : contexts) { if (c.getDepth() == peer.getDepth()) { peers.add(c); } } peers.remove(peer); return peers; }
LHSGeneratorContextFactory { public List<LHSGeneratorContext> getPeers(final LHSGeneratorContext peer) { final List<LHSGeneratorContext> peers = new ArrayList<LHSGeneratorContext>(); for (LHSGeneratorContext c : contexts) { if (c.getDepth() == peer.getDepth()) { peers.add(c); } } peers.remove(peer); return peers; } }
LHSGeneratorContextFactory { public List<LHSGeneratorContext> getPeers(final LHSGeneratorContext peer) { final List<LHSGeneratorContext> peers = new ArrayList<LHSGeneratorContext>(); for (LHSGeneratorContext c : contexts) { if (c.getDepth() == peer.getDepth()) { peers.add(c); } } peers.remove(peer); return peers; }  }
LHSGeneratorContextFactory { public List<LHSGeneratorContext> getPeers(final LHSGeneratorContext peer) { final List<LHSGeneratorContext> peers = new ArrayList<LHSGeneratorContext>(); for (LHSGeneratorContext c : contexts) { if (c.getDepth() == peer.getDepth()) { peers.add(c); } } peers.remove(peer); return peers; }  LHSGeneratorContext newGeneratorContext(); LHSGeneratorContext newChildGeneratorContext(final LHSGeneratorContext parent,
                                                        final IPattern pattern); LHSGeneratorContext newChildGeneratorContext(final LHSGeneratorContext parent,
                                                        final FieldConstraint fieldConstraint); LHSGeneratorContext newPeerGeneratorContext(final LHSGeneratorContext peer,
                                                       final IPattern pattern); LHSGeneratorContext newPeerGeneratorContext(final LHSGeneratorContext peer,
                                                       final FieldConstraint fieldConstraint); List<LHSGeneratorContext> getGeneratorContexts(); int getMaximumDepth(); int getMaximumPatternDepth(); List<LHSGeneratorContext> getPeers(final LHSGeneratorContext peer); }
LHSGeneratorContextFactory { public List<LHSGeneratorContext> getPeers(final LHSGeneratorContext peer) { final List<LHSGeneratorContext> peers = new ArrayList<LHSGeneratorContext>(); for (LHSGeneratorContext c : contexts) { if (c.getDepth() == peer.getDepth()) { peers.add(c); } } peers.remove(peer); return peers; }  LHSGeneratorContext newGeneratorContext(); LHSGeneratorContext newChildGeneratorContext(final LHSGeneratorContext parent,
                                                        final IPattern pattern); LHSGeneratorContext newChildGeneratorContext(final LHSGeneratorContext parent,
                                                        final FieldConstraint fieldConstraint); LHSGeneratorContext newPeerGeneratorContext(final LHSGeneratorContext peer,
                                                       final IPattern pattern); LHSGeneratorContext newPeerGeneratorContext(final LHSGeneratorContext peer,
                                                       final FieldConstraint fieldConstraint); List<LHSGeneratorContext> getGeneratorContexts(); int getMaximumDepth(); int getMaximumPatternDepth(); List<LHSGeneratorContext> getPeers(final LHSGeneratorContext peer);  }