001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.commons.math3.stat.descriptive.rank;
018    
019    import java.io.Serializable;
020    
021    import org.apache.commons.math3.exception.NullArgumentException;
022    
023    
024    /**
025     * Returns the median of the available values.  This is the same as the 50th percentile.
026     * See {@link Percentile} for a description of the algorithm used.
027     * <p>
028     * <strong>Note that this implementation is not synchronized.</strong> If
029     * multiple threads access an instance of this class concurrently, and at least
030     * one of the threads invokes the <code>increment()</code> or
031     * <code>clear()</code> method, it must be synchronized externally.</p>
032     *
033     * @version $Id: Median.java 1416643 2012-12-03 19:37:14Z tn $
034     */
035    public class Median extends Percentile implements Serializable {
036    
037        /** Serializable version identifier */
038        private static final long serialVersionUID = -3961477041290915687L;
039    
040        /**
041         * Default constructor.
042         */
043        public Median() {
044            // No try-catch or advertised exception - arg is valid
045            super(50.0);
046        }
047    
048        /**
049         * Copy constructor, creates a new {@code Median} identical
050         * to the {@code original}
051         *
052         * @param original the {@code Median} instance to copy
053         * @throws NullArgumentException if original is null
054         */
055        public Median(Median original) throws NullArgumentException {
056            super(original);
057        }
058    
059    }