src/test/java/ucar/geoapi/NetcdfCRSTest.java
private <T extends SingleCRS> T separateComponents(final String message,
            final Class<T> horizontalType, final boolean hasVerticalCRS)
    {
        validator.dispatch(crs);
        assertInstanceOf(message, CompoundCRS.class, crs);
        assertAxisDirectionsEqual(message, crs.getCoordinateSystem(),
                hasVerticalCRS ? new AxisDirection[] {EAST, NORTH, UP, FUTURE}
                               : new AxisDirection[] {EAST, NORTH, FUTURE});
        final List<CoordinateReferenceSystem> components = ((CompoundCRS) crs).getComponents();
        int n = hasVerticalCRS ? 3 : 2;
        assertEquals("CompoundCRS number of components:", n, components.size());
        CoordinateReferenceSystem candidate = components.get(--n);
        assertInstanceOf("CompoundCRS.component[last] type:", TemporalCRS.class, candidate);
        temporalCRS = (TemporalCRS) candidate;
        if (hasVerticalCRS) {
            candidate = components.get(--n);
            assertInstanceOf("CompoundCRS.component[1] type:", VerticalCRS.class, candidate);
            verticalCRS = (VerticalCRS) candidate;
        }
        candidate = components.get(--n);
        assertInstanceOf("CompoundCRS.component[0] type:", horizontalType, candidate);
        return horizontalType.cast(candidate);
    }
/**
     * Asserts that the tested {@linkplain #crs} is an instance of {@link CompoundCRS} in which
     * the first component is of the given type and the second component is a temporal CRS.
     * This method sets the {@linkplain #temporalCRS} field to the second component and returns
     * the first component for convenience.
     *
     * @param  <T>             the compile-time type of the class specified by the {@code horizontalType} argument.
     * @param  message         the message to use in case of failure.
     * @param  horizontalType  the expected type of the horizontal component.
     * @param  hasVerticalCRS  {@code true} if the CRS is expected to have an horizontal component.
     * @return the first component, which should be the horizontal one.
     */
Asserts that the tested  #crs is an instance of  CompoundCRS in which
the first component is of the given type and the second component is a temporal CRS.
This method sets the  #temporalCRS field to the second component and returns
the first component for convenience.

@param               the compile-time type of the class specified by the  horizontalType argument.
@param  message         the message to use in case of failure.
@param  horizontalType  the expected type of the horizontal component.
@param  hasVerticalCRS   true if the CRS is expected to have an horizontal component.
@return the first component, which should be the horizontal one.
Asserts that the tested #crs is an instance of CompoundCRS in which the first component is of the given type and the second component is a temporal CRS . This method sets the #temporalCRS field to the second component and returns the first component for convenience . @param the compile - time type of the class specified by the horizontalType argument . @param message the message to use in case of failure . @param horizontalType the expected type of the horizontal component . @param hasVerticalCRS true if the CRS is expected to have an horizontal component . @return the first component which should be the horizontal one .
private <T extends SingleCRS> T separateComponents(final String message,
            final Class<T> horizontalType, final boolean hasVerticalCRS)
    {
        validator.dispatch(crs);
        assertInstanceOf(message, CompoundCRS.class, crs);
        assertAxisDirectionsEqual(message, crs.getCoordinateSystem(),
                hasVerticalCRS ? new AxisDirection[] {EAST, NORTH, UP, FUTURE}
                               : new AxisDirection[] {EAST, NORTH, FUTURE});
        final List<CoordinateReferenceSystem> components = ((CompoundCRS) crs).getComponents();
        int n = hasVerticalCRS ? 3 : 2;
        assertEquals("CompoundCRS number of components:", n, components.size());
        CoordinateReferenceSystem candidate = components.get(--n);
        assertInstanceOf("CompoundCRS.component[last] type:", TemporalCRS.class, candidate);
        temporalCRS = (TemporalCRS) candidate;
        if (hasVerticalCRS) {
            candidate = components.get(--n);
            assertInstanceOf("CompoundCRS.component[1] type:", VerticalCRS.class, candidate);
            verticalCRS = (VerticalCRS) candidate;
        }
        candidate = components.get(--n);
        assertInstanceOf("CompoundCRS.component[0] type:", horizontalType, candidate);
        return horizontalType.cast(candidate);
    }
private < T extends SingleCRS > T separateComponents ( final String message , final Class < T > horizontalType , final boolean hasVerticalCRS ) { validator . dispatch ( crs ) ; assertInstanceOf ( message , CompoundCRS . class , crs ) ; assertAxisDirectionsEqual ( message , crs . getCoordinateSystem ( ) , hasVerticalCRS ? new AxisDirection [ ] { EAST , NORTH , UP , FUTURE } : new AxisDirection [ ] { EAST , NORTH , FUTURE } ) ; final List < CoordinateReferenceSystem > components = ( ( CompoundCRS ) crs ) . getComponents ( ) ; int n = hasVerticalCRS ? 3 : 2 ; assertEquals ( "CompoundCRS number of components:" , n , components . size ( ) ) ; CoordinateReferenceSystem candidate = components . get ( -- n ) ; assertInstanceOf ( "CompoundCRS.component[last] type:" , TemporalCRS . class , candidate ) ; temporalCRS = ( TemporalCRS ) candidate ; if ( hasVerticalCRS ) { candidate = components . get ( -- n ) ; assertInstanceOf ( "CompoundCRS.component[1] type:" , VerticalCRS . class , candidate ) ; verticalCRS = ( VerticalCRS ) candidate ; } candidate = components . get ( -- n ) ; assertInstanceOf ( "CompoundCRS.component[0] type:" , horizontalType , candidate ) ; return horizontalType . cast ( candidate ) ; }
Asserts that the tested {@linkplain #crs} is an instance of {@link CompoundCRS} in which
 the first component is of the given type and the second component is a temporal CRS.
Asserts that the tested { @linkplain #crs } is an instance of { @link CompoundCRS } in which the first component is of the given type and the second component is a temporal CRS .