package com.cloudant.sync.query;

/**
 * Created by tomblench on 28/09/2016.
 */

public class FieldSort {

    public final String field;
    public final Direction sort;

    public FieldSort(String field) {
        this.field = field;
        this.sort = Direction.ASCENDING;
    }

    public FieldSort(String field, Direction sort) {
        this.field = field;
        this.sort = sort;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        FieldSort fieldSort = (FieldSort) o;

        if (!field.equals(fieldSort.field)) {
            return false;
        }
        return sort == fieldSort.sort;

    }

    @Override
    public int hashCode() {
        int result = field.hashCode();
        result = 31 * result + sort.hashCode();
        return result;
    }

    @Override
    public String toString() {
        return "FieldSort{" +
                "field='" + field + '\'' +
                ", sort=" + sort +
                '}';
    }

    public enum Direction {
        ASCENDING,
        DESCENDING
    };

}

@@ -1,8 +1,617 @@
+/*%0A * Copyright (C) 2016 IBM Corp. All rights reserved.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you may not use this file%0A * except in compliance with the License. You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software distributed under the%0A * License is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,%0A * either express or implied. See the License for the specific language governing permissions%0A * and limitations under the License.%0A */%0A%0A
 package 
@@ -828,43 +828,15 @@
 this
-.
+(
 field
- = field;%0A        this.sort =
+,
  Dir
@@ -851,16 +851,17 @@
 SCENDING
+)
 ;%0A    %7D%0A

Implement feedback from rhys' comments