All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.fedora.server.resourceIndex.ParamDomain Maven / Gradle / Ivy

/*
 * -----------------------------------------------------------------------------
 *
 * 

License and Copyright: The contents of this file are subject to 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.fedora-commons.org/licenses.

* *

Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License.

* *

The entire file consists of original code.

*

Copyright © 2008 Fedora Commons, Inc.
*

Copyright © 2002-2007 The Rector and Visitors of the University of * Virginia and Cornell University
* All rights reserved.

* * ----------------------------------------------------------------------------- */ package fedora.server.resourceIndex; import java.util.TreeSet; /** * A sorted set of domain values for a parameter. * * As per the SortedSet contract, iterators over the values * in this collection will provide the elements in ascending order. * * @author [email protected] */ public class ParamDomain extends TreeSet { private static final long serialVersionUID = 1L; /** * The parameter whose domain is being described. */ private String _parameterName; /** * Whether specifying a value is required. */ private boolean _isRequired; /** * Construct an empty ParamDomain. * * @param parameterName the parameter whose domain is being described. * @param isRequired whether specifying a value is required. */ public ParamDomain(String parameterName, boolean isRequired) { _parameterName = parameterName; _isRequired = isRequired; } /** * Construct a ParamDomain with values from the given array. * * @param parameterName the parameter whose domain is being described. * @param isRequired whether specifying a value is required. * @param values the domain values. */ public ParamDomain(String parameterName, boolean isRequired, String[] domainValues) { _parameterName = parameterName; _isRequired = isRequired; for (int i = 0; i < domainValues.length; i++) { add(domainValues[i]); } } /** * Get the name of the parameter whose domain is being described. */ public String getParameterName() { return _parameterName; } /** * Tell whether specifying a value is required. */ public boolean isRequired() { return _isRequired; } public boolean equals(Object obj) { if (super.equals(obj)) { ParamDomain p = (ParamDomain) obj; return _parameterName.equals(p.getParameterName()) && _isRequired == p.isRequired(); } else { return false; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy