You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by wl...@apache.org on 2022/10/20 19:51:49 UTC

[datasketches-memory] 02/12: refactor step2 - rename public interfaces

This is an automated email from the ASF dual-hosted git repository.

wlauer pushed a commit to branch refactorInterfaces
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git

commit 4fb3b5ff2eeaf8cd9938219cf2ea8b21d51a4e6d
Author: Will Lauer <wl...@yahooinc.com>
AuthorDate: Thu Oct 20 12:59:26 2022 -0500

    refactor step2 - rename public interfaces
---
 .../org/apache/datasketches/memory/BaseBuffer.java | 124 ---------------------
 .../datasketches/memory/MemoryCloseException.java  |  49 --------
 .../datasketches/memory/MemoryException.java       |  42 -------
 .../datasketches/memory/{Map.java => Mmap.java}    |   0
 .../memory/{MapHandle.java => MmapHandle.java}     |   0
 .../datasketches/memory/ReadOnlyException.java     |  38 -------
 .../memory/{BaseState.java => Resource.java}       |   0
 .../memory/{WritableMap.java => WritableMmap.java} |   0
 ...tableMapHandle.java => WritableMmapHandle.java} |   0
 .../memory/{ => hash}/MurmurHash3v2.java           |   0
 .../datasketches/memory/{ => hash}/XxHash.java     |   0
 .../memory/{ => internal}/Utf8CodingException.java |   0
 12 files changed, 253 deletions(-)

diff --git a/src/main/java/org/apache/datasketches/memory/BaseBuffer.java b/src/main/java/org/apache/datasketches/memory/BaseBuffer.java
deleted file mode 100644
index 3e1869e..0000000
--- a/src/main/java/org/apache/datasketches/memory/BaseBuffer.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.datasketches.memory;
-
-/**
- * Defines the relative positional API.
- *
- * @author Lee Rhodes
- */
-public interface BaseBuffer extends BaseState {
-
-  /**
-   * Increments the current position by the given increment.
-   * Asserts that the resource is valid and that the positional invariants are not violated,
-   * otherwise, if asserts are enabled throws an {@link AssertionError}.
-   * @param increment the given increment
-   * @return BaseBuffer
-   */
-  BaseBuffer incrementPosition(long increment);
-
-  /**
-   * Increments the current position by the given increment.
-   * Checks that the resource is valid and that the positional invariants are not violated,
-   * otherwise throws an {@link IllegalArgumentException}.
-   * @param increment the given increment
-   * @return BaseBuffer
-   */
-  BaseBuffer incrementAndCheckPosition(final long increment);
-
-  /**
-   * Gets the end position
-   * @return the end position
-   */
-  long getEnd();
-
-  /**
-   * Gets the current position
-   * @return the current position
-   */
-  long getPosition();
-
-  /**
-   * Gets start position
-   * @return start position
-   */
-  long getStart();
-
-  /**
-   * The number of elements remaining between the current position and the end position
-   * @return {@code (end - position)}
-   */
-  long getRemaining();
-
-  /**
-   * Returns true if there are elements remaining between the current position and the end position
-   * @return {@code (end - position) > 0}
-   */
-  boolean hasRemaining();
-
-  /**
-   * Resets the current position to the start position,
-   * This does not modify any data.
-   * @return BaseBuffer
-   */
-  BaseBuffer resetPosition();
-
-  /**
-   * Sets the current position.
-   * Asserts that the positional invariants are not violated,
-   * otherwise, if asserts are enabled throws an {@link AssertionError}.
-   * @param position the given current position.
-   * @return BaseBuffer
-   */
-  BaseBuffer setPosition(long position);
-
-  /**
-   * Sets the current position.
-   * Checks that the positional invariants are not violated,
-   * otherwise, throws an {@link IllegalArgumentException}.
-   * @param position the given current position.
-   * @return BaseBuffer
-   */
-  BaseBuffer setAndCheckPosition(long position);
-
-  /**
-   * Sets start position, current position, and end position.
-   * Asserts that the positional invariants are not violated,
-   * otherwise, if asserts are enabled throws an {@link AssertionError}.
-   * @param start the start position in the buffer
-   * @param position the current position between the start and end
-   * @param end the end position in the buffer
-   * @return BaseBuffer
-   */
-  BaseBuffer setStartPositionEnd(long start, long position, long end);
-
-  /**
-   * Sets start position, current position, and end position.
-   * Checks that the positional invariants are not violated,
-   * otherwise, throws an {@link IllegalArgumentException}.
-   * @param start the start position in the buffer
-   * @param position the current position between the start and end
-   * @param end the end position in the buffer
-   * @return BaseBuffer
-   */
-  BaseBuffer setAndCheckStartPositionEnd(long start, long position, long end);
-
-}
diff --git a/src/main/java/org/apache/datasketches/memory/MemoryCloseException.java b/src/main/java/org/apache/datasketches/memory/MemoryCloseException.java
deleted file mode 100644
index 782c6cd..0000000
--- a/src/main/java/org/apache/datasketches/memory/MemoryCloseException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.datasketches.memory;
-
-/**
- * Specific RuntimeException for the AutoCloseable.close() method.
- *
- * @author Lee Rhodes
- *
- */
-public class MemoryCloseException extends MemoryException {
-  private static final long serialVersionUID = 2L;
-
-  /**
-   * The associated resource failed to close.
-   */
-  public MemoryCloseException() {
-    super("The associated resource failed to close.");
-  }
-
-  /**
-   * The associated resource failed to close, with comment
-   *
-   * @param resource the named resource that failed to close, plus other comments.
-   */
-  public MemoryCloseException(final String resource) {
-    super("The associated resource, " + resource + ", failed to close");
-  }
-
-}
-
-
diff --git a/src/main/java/org/apache/datasketches/memory/MemoryException.java b/src/main/java/org/apache/datasketches/memory/MemoryException.java
deleted file mode 100644
index 6b3663c..0000000
--- a/src/main/java/org/apache/datasketches/memory/MemoryException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.datasketches.memory;
-
-/**
- * Specific RuntimeExceptions for the datasketches-memory component.
- *
- * @author Lee Rhodes
- *
- */
-public class MemoryException extends RuntimeException {
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Constructs a new runtime exception with the specified detail message. The cause is not
-   * initialized, and may subsequently be initialized by a call to
-   * Throwable.initCause(java.lang.Throwable).
-   *
-   * @param message the detail message. The detail message is saved for later retrieval by the
-   * Throwable.getMessage() method.
-   */
-  public MemoryException(final String message) {
-    super(message);
-  }
-}
diff --git a/src/main/java/org/apache/datasketches/memory/Map.java b/src/main/java/org/apache/datasketches/memory/Mmap.java
similarity index 100%
rename from src/main/java/org/apache/datasketches/memory/Map.java
rename to src/main/java/org/apache/datasketches/memory/Mmap.java
diff --git a/src/main/java/org/apache/datasketches/memory/MapHandle.java b/src/main/java/org/apache/datasketches/memory/MmapHandle.java
similarity index 100%
rename from src/main/java/org/apache/datasketches/memory/MapHandle.java
rename to src/main/java/org/apache/datasketches/memory/MmapHandle.java
diff --git a/src/main/java/org/apache/datasketches/memory/ReadOnlyException.java b/src/main/java/org/apache/datasketches/memory/ReadOnlyException.java
deleted file mode 100644
index 3e14795..0000000
--- a/src/main/java/org/apache/datasketches/memory/ReadOnlyException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.datasketches.memory;
-
-/**
- * The exception thrown when attempting to write into a read-only Resource.
- *
- * @author Praveenkumar Venkatesan
- */
-public class ReadOnlyException extends MemoryException {
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * Read Only Exception
-     * @param message the error message
-     */
-    public ReadOnlyException(final String message) {
-      super(message);
-    }
-}
-
diff --git a/src/main/java/org/apache/datasketches/memory/BaseState.java b/src/main/java/org/apache/datasketches/memory/Resource.java
similarity index 100%
rename from src/main/java/org/apache/datasketches/memory/BaseState.java
rename to src/main/java/org/apache/datasketches/memory/Resource.java
diff --git a/src/main/java/org/apache/datasketches/memory/WritableMap.java b/src/main/java/org/apache/datasketches/memory/WritableMmap.java
similarity index 100%
rename from src/main/java/org/apache/datasketches/memory/WritableMap.java
rename to src/main/java/org/apache/datasketches/memory/WritableMmap.java
diff --git a/src/main/java/org/apache/datasketches/memory/WritableMapHandle.java b/src/main/java/org/apache/datasketches/memory/WritableMmapHandle.java
similarity index 100%
rename from src/main/java/org/apache/datasketches/memory/WritableMapHandle.java
rename to src/main/java/org/apache/datasketches/memory/WritableMmapHandle.java
diff --git a/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java b/src/main/java/org/apache/datasketches/memory/hash/MurmurHash3v2.java
similarity index 100%
rename from src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java
rename to src/main/java/org/apache/datasketches/memory/hash/MurmurHash3v2.java
diff --git a/src/main/java/org/apache/datasketches/memory/XxHash.java b/src/main/java/org/apache/datasketches/memory/hash/XxHash.java
similarity index 100%
rename from src/main/java/org/apache/datasketches/memory/XxHash.java
rename to src/main/java/org/apache/datasketches/memory/hash/XxHash.java
diff --git a/src/main/java/org/apache/datasketches/memory/Utf8CodingException.java b/src/main/java/org/apache/datasketches/memory/internal/Utf8CodingException.java
similarity index 100%
rename from src/main/java/org/apache/datasketches/memory/Utf8CodingException.java
rename to src/main/java/org/apache/datasketches/memory/internal/Utf8CodingException.java


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org