ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [1/2] ignite git commit: IGNITE-1770: Refactoring.
Date Tue, 27 Oct 2015 09:08:35 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1770 fb9a816f1 -> 7bc3f2ff5


IGNITE-1770: Refactoring.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a21f12b7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a21f12b7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a21f12b7

Branch: refs/heads/ignite-1770
Commit: a21f12b78ec7bfe4bfe1be4d4ed4794527c11307
Parents: fb9a816
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Tue Oct 27 12:05:01 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Oct 27 12:05:01 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/PortableReaderExImpl.java | 10 ++---
 .../ignite/internal/portable/PortableUtils.java | 42 ++++++++++----------
 .../portable/builder/PortableBuilderImpl.java   | 18 ++++-----
 3 files changed, 35 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a21f12b7/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
index b6d36a1..2830c1e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
@@ -211,12 +211,12 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
 
         typeId = in.readIntPositioned(start + GridPortableMarshaller.TYPE_ID_POS);
 
-        IgniteBiTuple<Integer, Integer> footer = PortableUtils.footer(in, start);
+        IgniteBiTuple<Integer, Integer> footer = PortableUtils.footerAbsolute(in, start);
 
         footerStart = footer.get1();
         footerEnd = footer.get2();
 
-        rawOff = PortableUtils.rawOffset(in, start);
+        rawOff = PortableUtils.rawOffsetAbsolute(in, start);
 
         if (typeId == UNREGISTERED_TYPE_ID) {
             // Skip to the class name position.
@@ -1403,7 +1403,7 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
 
     /** {@inheritDoc} */
     @Override public PortableRawReader rawReader() {
-        in.position(start + rawOff);
+        in.position(rawOff);
 
         return this;
     }
@@ -2511,8 +2511,8 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
     private boolean hasField(int id) {
         assert hdrLen != 0;
 
-        int searchHead = start + footerStart;
-        int searchTail = start + footerEnd;
+        int searchHead = footerStart;
+        int searchTail = footerEnd;
 
         // TODO: Opto.
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/a21f12b7/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index 23ec501..f077293 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -568,24 +568,6 @@ public class PortableUtils {
     }
 
     /**
-     * Get object's footer.
-     *
-     * @param in Input stream.
-     * @param start Start position.
-     * @return Footer.
-     */
-    public static IgniteBiTuple<Integer, Integer> footer(PortablePositionReadable in,
int start) {
-        int footerStart = footerStart(in, start);
-        int footerEnd = length(in, start);
-
-        // Take in count possible raw offset.
-        if ((((footerEnd - footerStart) >> 2) & 0x1) == 0x1)
-            footerEnd -= 4;
-
-        return F.t(footerStart, footerEnd);
-    }
-
-    /**
      * Get footer start of the object.
      *
      * @param in Input stream.
@@ -604,13 +586,31 @@ public class PortableUtils {
     }
 
     /**
+     * Get object's footer.
+     *
+     * @param in Input stream.
+     * @param start Start position.
+     * @return Footer.
+     */
+    public static IgniteBiTuple<Integer, Integer> footerAbsolute(PortablePositionReadable
in, int start) {
+        int footerStart = footerStart(in, start);
+        int footerEnd = length(in, start);
+
+        // Take in count possible raw offset.
+        if ((((footerEnd - footerStart) >> 2) & 0x1) == 0x1)
+            footerEnd -= 4;
+
+        return F.t(start + footerStart, start + footerEnd);
+    }
+
+    /**
      * Get raw offset of the object.
      *
      * @param in Input stream.
      * @param start Object start position inside the stream.
      * @return Raw offset.
      */
-    public static int rawOffset(PortablePositionReadable in, int start) {
+    public static int rawOffsetAbsolute(PortablePositionReadable in, int start) {
         int len = in.readIntPositioned(start + GridPortableMarshaller.TOTAL_LEN_POS);
         int schemaId = in.readIntPositioned(start + GridPortableMarshaller.SCHEMA_ID_POS);
 
@@ -623,10 +623,10 @@ public class PortableUtils {
 
             if ((((len - schemaOff) >> 2) & 0x1) == 0x0)
                 // Even amount of records in schema => no raw offset.
-                return schemaOff;
+                return start + schemaOff;
             else
                 // Odd amount of records in schema => raw offset is the very last 4 bytes
in object.
-                return in.readIntPositioned(start + len - 4);
+                return start + in.readIntPositioned(start + len - 4);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/a21f12b7/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
index 14ea625..da9f86f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
@@ -225,13 +225,13 @@ public class PortableBuilderImpl implements PortableBuilder {
                 assignedFldsById = Collections.emptyMap();
 
             // Get footer details.
-            IgniteBiTuple<Integer, Integer> footer = PortableUtils.footer(reader, start);
+            IgniteBiTuple<Integer, Integer> footer = PortableUtils.footerAbsolute(reader,
start);
 
-            int footerPos = start + footer.get1();
-            int footerEnd = start + footer.get2();
+            int footerPos = footer.get1();
+            int footerEnd = footer.get2();
 
             // Get raw position.
-            int rawPos = start + PortableUtils.rawOffset(reader, start);
+            int rawPos = PortableUtils.rawOffsetAbsolute(reader, start);
 
             // Position reader on data.
             reader.position(start + hdrLen);
@@ -378,7 +378,7 @@ public class PortableBuilderImpl implements PortableBuilder {
 
         if (reader != null) {
             // Write raw data if any.
-            int rawOff = start + PortableUtils.rawOffset(reader, start);
+            int rawOff = PortableUtils.rawOffsetAbsolute(reader, start);
             int footerStart = start + PortableUtils.footerStart(reader, start);
 
             if (rawOff < footerStart) {
@@ -436,12 +436,12 @@ public class PortableBuilderImpl implements PortableBuilder {
         if (readCache == null) {
             Map<Integer, Object> readCache = new HashMap<>();
 
-            IgniteBiTuple<Integer, Integer> footer = PortableUtils.footer(reader, start);
+            IgniteBiTuple<Integer, Integer> footer = PortableUtils.footerAbsolute(reader,
start);
 
-            int footerPos = start + footer.get1();
-            int footerEnd = start + footer.get2();
+            int footerPos = footer.get1();
+            int footerEnd = footer.get2();
 
-            int rawPos = start + PortableUtils.rawOffset(reader, start);
+            int rawPos = PortableUtils.rawOffsetAbsolute(reader, start);
 
             while (footerPos < footerEnd) {
                 int fieldId = reader.readIntPositioned(footerPos);


Mime
View raw message