class InternalPackedLongArray extends PackedLongArray {
        private final long containingInstanceId;

        private InternalPackedLongArray(final long id, int virtualLength, final int initialPhysicalLength) {
            super(virtualLength, initialPhysicalLength);
            this.containingInstanceId = id;
        }

        private InternalPackedLongArray(final long id, final int virtualLength) {
            super(virtualLength);
            this.containingInstanceId = id;
        }
    }

    private void validateFitAsReplacementArray(final PackedLongArray replacementArray,
                                               final boolean enforceContainingInstance) {<FILL_FUNCTION_BODY>

        boolean bad = true;
        if (replacementArray == null) {
            bad = false;
        } else if (replacementArray instanceof InternalPackedLongArray) {
            if ((activeArray instanceof InternalPackedLongArray)
                    &&
                    ((!enforceContainingInstance) ||
                            (((InternalPackedLongArray)replacementArray).containingInstanceId ==
                                    ((InternalPackedLongArray) activeArray).containingInstanceId)
                    )) {
                bad = false;
            }
        }
        if (bad) {
            throw new IllegalArgumentException("replacement array must have been obtained via a previous" +
                    " getIntervalArray() call from this " + this.getClass().getName() +
                    (enforceContainingInstance ? " instance" : " class"));
        }
    
<no_super_class>