-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
1.4.2
-
Fix Understood
-
x86
-
windows_xp
Name: rmT116609 Date: 04/20/2003
A DESCRIPTION OF THE REQUEST :
The current implementation of the setValue method initially calls getModel which simply returns the model. The re-worked method would be:
public void setValue(int n) {
int oldValue = model.getValue();
model.setValue(n);
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
new Integer(oldValue),
new Integer(model.getValue()
);
}
}
JUSTIFICATION :
This causes many calls to getModel which are not needed. I propose a change to just use the local member variable (called model).
The call to getModel may be (possibly) a more way to access the model however if data hiding was the reason behind this choice perhaps the model shouldn't have been a member variable in the first place.
EXPECTED VERSUS ACTUAL BEHAVIOR :
A speed improvement
(Review ID: 184477)
======================================================================
A DESCRIPTION OF THE REQUEST :
The current implementation of the setValue method initially calls getModel which simply returns the model. The re-worked method would be:
public void setValue(int n) {
int oldValue = model.getValue();
model.setValue(n);
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
new Integer(oldValue),
new Integer(model.getValue()
);
}
}
JUSTIFICATION :
This causes many calls to getModel which are not needed. I propose a change to just use the local member variable (called model).
The call to getModel may be (possibly) a more way to access the model however if data hiding was the reason behind this choice perhaps the model shouldn't have been a member variable in the first place.
EXPECTED VERSUS ACTUAL BEHAVIOR :
A speed improvement
(Review ID: 184477)
======================================================================