@Test public void testGetAncestor() { assertThat(EMPTY.getAncestor(0)).isNull(); assertThat(SECTOR_REGION.getAncestor(0)).isNull(); assertThat(INDUSTRY.getAncestor(0)).isEqualTo(SECTOR_REGION); assertThat(INDUSTRY.getAncestor(1)).isNull(); assertThat(INDUSTRY_BE.getAncestor(0)).isEqualTo(SECTOR_REGION); assertThat(INDUSTRY_BE.getAncestor(1)).isEqualTo(INDUSTRY); assertThat(INDUSTRY_BE.getAncestor(2)).isNull(); }
@Nullable CubeId getAncestor(int level) { return 0 <= level && level < getLevel() ? new CubeId(dimensionIds, Arrays.copyOf(dimensionsValues, level)) : null; }
CubeId { @Nullable CubeId getAncestor(int level) { return 0 <= level && level < getLevel() ? new CubeId(dimensionIds, Arrays.copyOf(dimensionsValues, level)) : null; } }
CubeId { @Nullable CubeId getAncestor(int level) { return 0 <= level && level < getLevel() ? new CubeId(dimensionIds, Arrays.copyOf(dimensionsValues, level)) : null; } private  CubeId(@NonNull String[] dimensionIds, @NonNull String[] dimensionsValues); }
CubeId { @Nullable CubeId getAncestor(int level) { return 0 <= level && level < getLevel() ? new CubeId(dimensionIds, Arrays.copyOf(dimensionsValues, level)) : null; } private  CubeId(@NonNull String[] dimensionIds, @NonNull String[] dimensionsValues); @NonNull static CubeId root(@NonNull String... dimensionIds); @NonNull static CubeId root(@NonNull List<String> dimensionIds); @NonNegative int getLevel(); @NonNegative int getMaxLevel(); @NonNull String getDimensionValue(@NonNegative int index); @NonNull Stream<String> getDimensionValueStream(); @NonNull String getDimensionId(@NonNegative int index); @NonNegative int getDepth(); boolean isRoot(); boolean isSeries(); boolean isVoid(); @NonNull CubeId child(@NonNull String... dimensionValues); boolean isAncestorOf(@NonNull CubeId input); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); }
CubeId { @Nullable CubeId getAncestor(int level) { return 0 <= level && level < getLevel() ? new CubeId(dimensionIds, Arrays.copyOf(dimensionsValues, level)) : null; } private  CubeId(@NonNull String[] dimensionIds, @NonNull String[] dimensionsValues); @NonNull static CubeId root(@NonNull String... dimensionIds); @NonNull static CubeId root(@NonNull List<String> dimensionIds); @NonNegative int getLevel(); @NonNegative int getMaxLevel(); @NonNull String getDimensionValue(@NonNegative int index); @NonNull Stream<String> getDimensionValueStream(); @NonNull String getDimensionId(@NonNegative int index); @NonNegative int getDepth(); boolean isRoot(); boolean isSeries(); boolean isVoid(); @NonNull CubeId child(@NonNull String... dimensionValues); boolean isAncestorOf(@NonNull CubeId input); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }