1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * https://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /* 19 * This is not the original file distributed by the Apache Software Foundation 20 * It has been modified by the Hipparchus project 21 */ 22 package org.hipparchus.util; 23 24 import java.io.Serializable; 25 26 import org.hipparchus.Field; 27 28 /** 29 * The field of {@link Binary64 double precision floating-point numbers}. 30 * 31 * @see Binary64 32 */ 33 public class Binary64Field implements Field<Binary64>, Serializable { 34 35 /** Serializable version identifier */ 36 private static final long serialVersionUID = 20161219L; 37 38 /** Default constructor. */ 39 private Binary64Field() { 40 // Do nothing 41 } 42 43 /** 44 * Returns the unique instance of this class. 45 * 46 * @return the unique instance of this class 47 */ 48 public static Binary64Field getInstance() { 49 return LazyHolder.INSTANCE; 50 } 51 52 /** {@inheritDoc} */ 53 @Override 54 public Binary64 getZero() { 55 return Binary64.ZERO; 56 } 57 58 /** {@inheritDoc} */ 59 @Override 60 public Binary64 getOne() { 61 return Binary64.ONE; 62 } 63 64 /** {@inheritDoc} */ 65 @Override 66 public Class<Binary64> getRuntimeClass() { 67 return Binary64.class; 68 } 69 70 /** {@inheritDoc} */ 71 @Override 72 public boolean equals(final Object other) { 73 return this == other; 74 } 75 76 /** {@inheritDoc} */ 77 @Override 78 public int hashCode() { 79 return 0x0a04d2bf; 80 } 81 82 // CHECKSTYLE: stop HideUtilityClassConstructor 83 /** Holder for the instance. 84 * <p>We use here the Initialization On Demand Holder Idiom.</p> 85 */ 86 private static class LazyHolder { 87 /** Cached field instance. */ 88 private static final Binary64Field INSTANCE = new Binary64Field(); 89 } 90 // CHECKSTYLE: resume HideUtilityClassConstructor 91 92 /** Handle deserialization of the singleton. 93 * @return the singleton instance 94 */ 95 private Object readResolve() { 96 // return the singleton instance 97 return LazyHolder.INSTANCE; 98 } 99 100 }