ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [2/3] ignite git commit: IGNITE-1418: Simplified portable schema..
Date Mon, 02 Nov 2015 13:38:11 GMT
IGNITE-1418: Simplified portable schema..


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

Branch: refs/heads/ignite-1814-debug
Commit: 15fa7abc3d67547b7fe23da2fb7f2e6b1d065495
Parents: b90ba5a
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Mon Nov 2 16:26:17 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Nov 2 16:26:17 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/PortableSchema.java       | 129 +++++++------------
 1 file changed, 48 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/15fa7abc/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchema.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchema.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchema.java
index 250598a..03be319 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchema.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchema.java
@@ -36,52 +36,28 @@ public class PortableSchema {
     private final HashMap<Integer, Integer> map;
 
     /** ID 1. */
-    private final int id1;
-
-    /** Offset 1. */
-    private final int pos1;
+    private final int id0;
 
     /** ID 2. */
-    private final int id2;
-
-    /** Offset 2. */
-    private final int pos2;
+    private final int id1;
 
     /** ID 3. */
-    private final int id3;
-
-    /** Offset 3. */
-    private final int pos3;
+    private final int id2;
 
     /** ID 4. */
-    private final int id4;
-
-    /** Offset 4. */
-    private final int pos4;
+    private final int id3;
 
     /** ID 1. */
-    private final int id5;
-
-    /** Offset 1. */
-    private final int pos5;
+    private final int id4;
 
     /** ID 2. */
-    private final int id6;
-
-    /** Offset 2. */
-    private final int pos6;
+    private final int id5;
 
     /** ID 3. */
-    private final int id7;
-
-    /** Offset 3. */
-    private final int pos7;
+    private final int id6;
 
     /** ID 4. */
-    private final int id8;
-
-    /** Offset 4. */
-    private final int pos8;
+    private final int id7;
 
     /**
      * Constructor.
@@ -97,84 +73,75 @@ public class PortableSchema {
             Map.Entry<Integer, Integer> entry = iter.hasNext() ? iter.next() : null;
 
             if (entry != null) {
+                id0 = entry.getKey();
+
+                assert entry.getValue() == 0;
+            }
+            else
+                id0 = 0;
+
+            if ((entry = iter.hasNext() ? iter.next() : null) != null) {
                 id1 = entry.getKey();
-                pos1 = entry.getValue();
+
+                assert entry.getValue() == 1;
             }
-            else{
+            else
                 id1 = 0;
-                pos1 = 0;
-            }
 
             if ((entry = iter.hasNext() ? iter.next() : null) != null) {
                 id2 = entry.getKey();
-                pos2 = entry.getValue();
+
+                assert entry.getValue() == 2;
             }
-            else{
+            else
                 id2 = 0;
-                pos2 = 0;
-            }
 
             if ((entry = iter.hasNext() ? iter.next() : null) != null) {
                 id3 = entry.getKey();
-                pos3 = entry.getValue();
+
+                assert entry.getValue() == 3;
             }
-            else{
+            else
                 id3 = 0;
-                pos3 = 0;
-            }
 
             if ((entry = iter.hasNext() ? iter.next() : null) != null) {
                 id4 = entry.getKey();
-                pos4 = entry.getValue();
+
+                assert entry.getValue() == 4;
             }
-            else{
+            else
                 id4 = 0;
-                pos4 = 0;
-            }
 
             if ((entry = iter.hasNext() ? iter.next() : null) != null) {
                 id5 = entry.getKey();
-                pos5 = entry.getValue();
+
+                assert entry.getValue() == 5;
             }
-            else{
+            else
                 id5 = 0;
-                pos5 = 0;
-            }
 
             if ((entry = iter.hasNext() ? iter.next() : null) != null) {
                 id6 = entry.getKey();
-                pos6 = entry.getValue();
+
+                assert entry.getValue() == 6;
             }
-            else{
+            else
                 id6 = 0;
-                pos6 = 0;
-            }
 
             if ((entry = iter.hasNext() ? iter.next() : null) != null) {
                 id7 = entry.getKey();
-                pos7 = entry.getValue();
-            }
-            else{
-                id7 = 0;
-                pos7 = 0;
-            }
 
-            if ((entry = iter.hasNext() ? iter.next() : null) != null) {
-                id8 = entry.getKey();
-                pos8 = entry.getValue();
-            }
-            else{
-                id8 = 0;
-                pos8 = 0;
+                assert entry.getValue() == 7;
             }
+            else
+                id7 = 0;
 
             map = null;
         }
         else {
             inline = false;
 
-            id1 = id2 = id3 = id4 = id5 = id6 = id7 = id8 = 0;
-            pos1 = pos2 = pos3 = pos4 = pos5 = pos6 = pos7 = pos8 = 0;
+            id0 = id1 = id2 = id3 = id4 = id5 = id6 = id7 = 0;
 
             map = new HashMap<>(vals);
         }
@@ -188,29 +155,29 @@ public class PortableSchema {
      */
     public int order(int id) {
         if (inline) {
+            if (id == id0)
+                return 0;
+
             if (id == id1)
-                return pos1;
+                return 1;
 
             if (id == id2)
-                return pos2;
+                return 2;
 
             if (id == id3)
-                return pos3;
+                return 3;
 
             if (id == id4)
-                return pos4;
+                return 4;
 
             if (id == id5)
-                return pos5;
+                return 5;
 
             if (id == id6)
-                return pos6;
+                return 6;
 
             if (id == id7)
-                return pos7;
-
-            if (id == id8)
-                return pos8;
+                return 7;
 
             return 0;
         }


Mime
View raw message