/*
 * ProActive Parallel Suite(TM): The Java(TM) library for
 *    Parallel, Distributed, Multi-Core Computing for
 *    Enterprise Grids & Clouds
 *
 * Copyright (C) 1997-2015 INRIA/University of
 *                 Nice-Sophia Antipolis/ActiveEon
 * Contact: proactive@ow2.org or contact@activeeon.com
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License
 * as published by the Free Software Foundation; version 3 of
 * the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * If needed, contact us to obtain a release under GPL Version 2 or 3
 * or a different license than the AGPL.
 *
 * Initial developer(s):               The ProActive Team
 *                         http://proactive.inria.fr/team_members.htm
 */
package org.ow2.proactive.scheduler.common;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Utility container to pass multiple parameters for tasks sorting.
 *
 * @author ActiveEon Team
 */
public class SortSpecifierContainer implements Serializable {

    public ArrayList<SortSpecifierItem> sortParameters = null;

    public SortSpecifierContainer() {
        sortParameters = new ArrayList<>();
    }

    public class SortSpecifierItem implements Serializable {

        protected String field;
        protected String order;

        SortSpecifierItem(String field, String order) {
            this.field = field;
            this.order = order;
        }

        public SortSpecifierItem() {
            this.field = "NOTSET";
            this.order = "ASCENDING";
        }

        public String toString() {
            return field + "," + order;
        }

        public String getField() {
            return field;
        }

        public String getOrder() {
            return order;
        }
    }

    public SortSpecifierContainer(int size) {
        sortParameters = new ArrayList<>(size);
    }

    public SortSpecifierContainer(String values) {
        sortParameters = new ArrayList<>();
        if (values != null && "".compareTo(values) != 0) {
            for (String s : values.split(";")) {
                String[] sortParam = s.split(",");
                add(sortParam[0], sortParam[1]);
            }
        }

    }

    public void add(String field, String order) {
        sortParameters.add(new SortSpecifierItem(field, order));
    }

    public List<SortSpecifierItem> getSortParameters() {
        return sortParameters;
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0 ; i < sortParameters.size(); i++) {
            sb.append(sortParameters.get(i).toString());
            if (i < sortParameters.size() - 1) sb.append(";");
        }
        return sb.toString();
    }

}

@@ -1472,24 +1472,30 @@
 %0A */%0Apublic 
+final 
 class SortSp
@@ -1543,21 +1543,28 @@
 %7B%0A%0A    p
-ublic
+rivate final
  ArrayLi
@@ -1603,15 +1603,8 @@
 ters
- = null
 ;%0A%0A 
@@ -1702,16 +1702,22 @@
  public 
+final 
 class So
@@ -1761,39 +1761,43 @@
 le %7B%0A%0A        pr
-otected
+ivate final
  String field;%0A 
@@ -1809,15 +1809,19 @@
   pr
-otected
+ivate final
  Str

Fix immutability into the SortSpecifierContainer