class PackedInternalDoubleHistogram extends PackedDoubleHistogram {
        private final long containingInstanceId;

        private PackedInternalDoubleHistogram(long id, int numberOfSignificantValueDigits) {
            super(numberOfSignificantValueDigits);
            this.containingInstanceId = id;
        }
    }

    private void validateFitAsReplacementHistogram(DoubleHistogram replacementHistogram,
                                                   boolean enforceContainingInstance) {<FILL_FUNCTION_BODY>

        boolean bad = true;
        if (replacementHistogram == null) {
            bad = false;
        } else if ((replacementHistogram instanceof InternalDoubleHistogram)
                &&
                ((!enforceContainingInstance) ||
                        (((InternalDoubleHistogram) replacementHistogram).containingInstanceId ==
                                ((InternalDoubleHistogram)activeHistogram).containingInstanceId)
                )) {
            bad = false;
        } else if ((replacementHistogram instanceof PackedInternalDoubleHistogram)
                &&
                ((!enforceContainingInstance) ||
                        (((PackedInternalDoubleHistogram) replacementHistogram).containingInstanceId ==
                                ((PackedInternalDoubleHistogram)activeHistogram).containingInstanceId)
                )) {
            bad = false;
        }

        if (bad) {
            throw new IllegalArgumentException("replacement histogram must have been obtained via a previous " +
                    "getIntervalHistogram() call from this " + this.getClass().getName() +" instance");
        }
    
<no_super_class>