Skip to main content
summaryrefslogtreecommitdiffstats
blob: aea0e1870e8d03db182538e50d63f9f82f479751 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*******************************************************************************
 * Copyright (c) 2001, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jem.internal.proxy.remote;
/*
 *  $RCSfile: REMFloatTypeBeanProxy.java,v $
 *  $Revision: 1.4 $  $Date: 2005/08/24 20:39:07 $ 
 */


import org.eclipse.jem.internal.proxy.common.remote.Commands;
import org.eclipse.jem.internal.proxy.core.*;
/**
 * Remote Implementation of INumberBeanProxy for the primitive "float".
 * It can answer all of the primitive number types (int, long, short, byte, double, float).
 * Creation date: (2/6/00 9:02:54 AM)
 * @author: Joe Winchester
 */
class REMFloatTypeBeanProxy extends REMConstantBeanProxy implements INumberBeanProxy {
	private final float fFloat;

/**
 * It is package protected because they are created
 * in a special way and no one else should create them.
 * @param aBean java.lang.Object
 */
REMFloatTypeBeanProxy(REMProxyFactoryRegistry aRegistry, float aFloat) {
	super(aRegistry);
	fFloat = aFloat;
}
/**
 * equals: Equal if:
 *         1) This proxy == (identity) to the other object
 *         2) Else if other is an IBeanProxy and not a constant one, then if
 *            equals on the server.
 *         3) If this is a constant proxy and the other is too or is a constant
 *            value (e.g. IStringBeanProxy.equals(String), then true if values are equals.
 */
public boolean equals(Object anObject) {
	if (this == anObject)
		return true;	// Identity
	if (anObject instanceof REMFloatTypeBeanProxy)
		return fFloat == ((REMFloatTypeBeanProxy) anObject).floatValue();
	if (anObject instanceof Double)
		return fFloat == ((Float) anObject).floatValue();
	return false;
}

/* (non-Javadoc)
 * @see org.eclipse.jem.internal.proxy.core.IBeanProxy#sameAs(org.eclipse.jem.internal.proxy.core.IBeanProxy)
 */
public boolean sameAs(IBeanProxy aBeanProxy) {
	if (this == aBeanProxy)
		return true;	// Identity
	if (aBeanProxy instanceof REMFloatTypeBeanProxy)
		return fFloat == ((REMFloatTypeBeanProxy) aBeanProxy).floatValue();
	return false;
}
/**
 * byteValue method comment.
 */
public byte byteValue() {
	return (byte) fFloat;
}
/**
 * doubleValue method comment.
 */
public double doubleValue() {
	return fFloat;
}
/**
 * floatValue method comment.
 */
public float floatValue() {
	return fFloat;
}
/**
 * Return the int value
 */
public int intValue() {
	return (int) fFloat;
}
/**
 * longValue method comment.
 */
public long longValue() {
	return (long) fFloat;
}
/**
 * numberValue method comment.
 */
public Number numberValue() {
	return new Float(fFloat);
}
/**
 * shortValue method comment.
 */
public short shortValue() {
	return (short) fFloat;
}

/**
 * The bean's toString.
 */
public String toBeanString() {
	return String.valueOf(fFloat);
}

/**
 * Get the beantype
 */
public IBeanTypeProxy getTypeProxy() {
	return ((REMStandardBeanTypeProxyFactory) fFactory.getBeanTypeProxyFactory()).floatType;
}

/**
 * Render the bean into value object.
 */
public void renderBean(Commands.ValueObject value) {
	value.set(fFloat);
}
}


Back to the top