Dimension getSharedDimension ( Group group , Dimension d ) { if ( d . getShortName ( ) == null ) return d ; if ( group == null ) group = rootGroup ; for ( Dimension sd : group . getDimensions ( ) ) { if ( sd . getShortName ( ) . equals ( d . getShortName ( ) ) && sd . getLength ( ) == d . getLength ( ) ) return sd ; } d . setShared ( true ) ; group . addDimension ( d ) ; return d ; }
If an equivilent shared dimension already exists use it else add d to shared dimensions . Equivilent is same name and length .