3853N/A/*
3853N/A * CDDL HEADER START
3853N/A *
3853N/A * The contents of this file are subject to the terms of the
3853N/A * Common Development and Distribution License, Version 1.0 only
3853N/A * (the "License"). You may not use this file except in compliance
3853N/A * with the License.
3853N/A *
3853N/A * You can obtain a copy of the license at
3853N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE
3853N/A * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
3853N/A * See the License for the specific language governing permissions
3853N/A * and limitations under the License.
3853N/A *
3853N/A * When distributing Covered Code, include this CDDL HEADER in each
3853N/A * file and include the License file at
3853N/A * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
3853N/A * add the following below this CDDL HEADER, with the fields enclosed
3853N/A * by brackets "[]" replaced with your own identifying information:
3853N/A * Portions Copyright [yyyy] [name of copyright owner]
3853N/A *
3853N/A * CDDL HEADER END
3853N/A *
3853N/A *
3853N/A * Copyright 2008 Sun Microsystems, Inc.
3853N/A */
3853N/A
3853N/Apackage org.opends.guitools.controlpanel.datamodel;
3853N/A
3853N/A/**
3853N/A * Class that describes the VLV sort order.
3853N/A */
3853N/Apublic class VLVSortOrder
3853N/A{
3853N/A private String attributeName;
3853N/A private boolean isAscending;
3853N/A private int hashCode;
3853N/A
3853N/A /**
3853N/A * Constructor of the VLVSortOrder.
3853N/A * @param attributeName the attribute name to be used to sort.
3853N/A * @param isAscending whether the sorting is ascending or descending.
3853N/A */
3853N/A public VLVSortOrder(String attributeName, boolean isAscending)
3853N/A {
3853N/A this.attributeName = attributeName;
3853N/A this.isAscending = isAscending;
3853N/A hashCode = ("vlvsortorder"+attributeName+isAscending).hashCode();
3853N/A }
3853N/A
3853N/A /**
3853N/A * Returns the name of the attribute.
3853N/A * @return the name of the attribute.
3853N/A */
3853N/A public String getAttributeName()
3853N/A {
3853N/A return attributeName;
3853N/A }
3853N/A
3853N/A /**
3853N/A * Returns whether the sorting is ascending or descending.
3853N/A * @return <CODE>true</CODE> if the sorting is ascending and
3853N/A * <CODE>false</CODE> otherwise.
3853N/A */
3853N/A public boolean isAscending()
3853N/A {
3853N/A return isAscending;
3853N/A }
3853N/A
3853N/A /**
3853N/A * {@inheritDoc}
3853N/A */
3853N/A public int hashCode()
3853N/A {
3853N/A return hashCode;
3853N/A }
3853N/A
3853N/A /**
3853N/A * {@inheritDoc}
3853N/A */
3853N/A public boolean equals(Object o)
3853N/A {
3853N/A boolean equals = o == this;
3853N/A if (!equals)
3853N/A {
3853N/A equals = o instanceof VLVSortOrder;
3853N/A if (equals)
3853N/A {
3853N/A VLVSortOrder sortOrder = (VLVSortOrder)o;
3853N/A equals = sortOrder.getAttributeName().equalsIgnoreCase(attributeName) &&
3853N/A sortOrder.isAscending() == isAscending;
3853N/A }
3853N/A }
3853N/A return equals;
3853N/A }
3853N/A}