@Test public void testGetMaximumPatternDepth() { final LHSGeneratorContext root = factory.newGeneratorContext(); assertThat(factory.getMaximumPatternDepth()).isEqualTo(0); factory.newChildGeneratorContext(root, mock(IPattern.class)); assertThat(factory.getMaximumPatternDepth()).isEqualTo(1); factory.newChildGeneratorContext(root, mock(FieldConstraint.class)); assertThat(factory.getMaximumPatternDepth()).isEqualTo(1); }
public int getMaximumPatternDepth() { int depth = 0; for (LHSGeneratorContext gctx : contexts) { if (Objects.nonNull(gctx.getPattern())) { depth = Math.max(depth, gctx.getDepth()); } } return depth; }
LHSGeneratorContextFactory { public int getMaximumPatternDepth() { int depth = 0; for (LHSGeneratorContext gctx : contexts) { if (Objects.nonNull(gctx.getPattern())) { depth = Math.max(depth, gctx.getDepth()); } } return depth; } }
LHSGeneratorContextFactory { public int getMaximumPatternDepth() { int depth = 0; for (LHSGeneratorContext gctx : contexts) { if (Objects.nonNull(gctx.getPattern())) { depth = Math.max(depth, gctx.getDepth()); } } return depth; }  }
LHSGeneratorContextFactory { public int getMaximumPatternDepth() { int depth = 0; for (LHSGeneratorContext gctx : contexts) { if (Objects.nonNull(gctx.getPattern())) { depth = Math.max(depth, gctx.getDepth()); } } return depth; }  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 int getMaximumPatternDepth() { int depth = 0; for (LHSGeneratorContext gctx : contexts) { if (Objects.nonNull(gctx.getPattern())) { depth = Math.max(depth, gctx.getDepth()); } } return depth; }  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);  }