001/** 002 * RealReplicator.java 003 * 004 * Copyright (c) 2004-2012, Nicole C. Tedesco. All rights reserved. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); 007 * you may not use this file except in compliance with the License. 008 * You may obtain a copy of the License at: 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019package net.sf.jaccumulator.reals; 020 021import java.math.BigDecimal; 022import java.math.BigInteger; 023 024import net.sf.jaccumulator.Replicator; 025import net.sf.jaccumulator.scalars.ScalarReplicator; 026 027/** 028 * A {@link Replicator replicator} for {@link Real real} numbers 029 * 030 * @param <REAL> 031 * the factory product 032 * @since JAccumulator 4.0 033 * @author Nicole Tedesco (<a 034 * href="mailto:Nicole@NicoleTedesco.com">Nicole@NicoleTedesco.com</a>) 035 */ 036public interface RealReplicator<REAL extends RealReplicator<REAL>> 037 extends 038 ScalarReplicator<REAL> 039{ 040 /** 041 * Using this real as a factory, produce a new real of the 042 * same type but initialized with the value specified 043 * 044 * @param aValue 045 * a new value 046 * @return a copy (clone) of this real initialized using the 047 * specified value 048 */ 049 public REAL copyUsing( final BigDecimal aValue ); 050 051 /** 052 * Using this real as a factory, produce a new real of the 053 * same type but initialized with the value specified 054 * 055 * @param aValue 056 * a new value 057 * @return a copy (clone) of this real initialized using the 058 * specified value 059 */ 060 public REAL copyUsing( final BigInteger aValue ); 061 062 /** 063 * Using this real as a factory, produce a new real of the 064 * same type but initialized with the value specified 065 * 066 * @param aValue 067 * a new value 068 * @return a copy (clone) of this real initialized using the 069 * specified value 070 */ 071 public REAL copyUsingReal( final SealedReal<?> aValue ); 072 073 /** 074 * If this real is already a {@link Real real} number real 075 * then simply call its {@link #copy()} function, otherwise produce a new 076 * real number real 077 * @return 078 * a new real number real 079 */ 080 public Real<?> toReal(); 081}