SomeFire commented on a change in pull request #78: IGNITE-10203 Support for 
alternative configurations for PR testing
URL: https://github.com/apache/ignite-teamcity-bot/pull/78#discussion_r235949008
 
 

 ##########
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/ParametersCompacted.java
 ##########
 @@ -0,0 +1,134 @@
+/*
+ * 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.ignite.ci.teamcity.ignited.buildtype;
+
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Strings;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import org.apache.ignite.ci.tcmodel.conf.bt.Parameters;
+import org.apache.ignite.ci.tcmodel.conf.bt.Property;
+import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
+import org.apache.ignite.internal.util.GridIntList;
+
+public class ParametersCompacted {
+    private GridIntList keys;
+    private GridIntList values;
+
+    /**
+     * Default constructor.
+     */
+    public ParametersCompacted() {
+    }
+
+    /**
+     * @param compactor Compactor.
+     * @param ref Reference.
+     */
+    public ParametersCompacted(IStringCompactor compactor, List<Property> ref) 
{
+        final int size = ref.size();
+        keys = new GridIntList(size);
+        values = new GridIntList(size);
+        for (Property next : ref) {
+            final String name = next.name();
+            if (Strings.isNullOrEmpty(name))
+                continue;
+
+            final String value = next.getValue();
+            if (Strings.isNullOrEmpty(value))
+                continue;
+            final int val = compactor.getStringId(value);
+            final int stringId = compactor.getStringId(name);
+
+            keys.add(stringId);
+            values.add(val);
+        }
+    }
+
+    public Parameters toParameters(IStringCompactor compactor) {
+        List<Property> properties = null;
+
+        if (keys.size() > 0) {
+            properties = new ArrayList<>();
+
+            final int size = keys.size();
+            for (int i = 0; i < size; i++) {
+                if (i >= values.size())
 
 Review comment:
   Move check inside `for` statement.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to