public Interval getInstance ( Long start , Granularity startGran , Long finish , Granularity finishGran ) { List < Object > key = Arrays . asList ( new Object [ ] { start , startGran , finish , finishGran } ) ; Interval result ; synchronized ( cache ) { result = cache . get ( key ) ; if ( result == null ) { if ( start == null || finish == null ) { result = new DefaultInterval ( start , startGran , finish , finishGran ) ; } else { result = new SimpleInterval ( start , startGran , finish , finishGran ) ; } cache . put ( key , result ) ; } } return result ; }
Returns at interval specified by the given start and finish and granularities .