Reputation: 632
I don't understand the difference between setAttribute( ) and addAttribute( ) in GraphStream1.3
.
In GraphStream
's Element
API 1.3 it's explained that setAttribute is
Like addAttribute() but for consistency.
what does it means?
Upvotes: 0
Views: 218
Reputation: 1267
It is most likely that they mean api consistency
with this wording; overall consistency between their own API or what developers might expect to find in general in the API of a Java library.
For example properties
on Java Beans (pojo's) are usually implemented as getter
and setter
methods by convention (rather than language features, as can be found in C#).
So perhaps the graphstream
devs wanted to have both getAttribute
and setAttribute
in a similar fashion.
This can be confirmed by checking one of the Known Implementing Classes
as listed in the javadoc; for example org.graphstream.graph.implementations.AbstractElement, where the setAttribute
method is just calling addAttribute
directly:
/**
* @complexity O(log(n)) with n being the number of attributes of this
* element.
*/
public void setAttribute(String attribute, Object... values) {
addAttribute(attribute, values);
}
Taken from the decompiled jar or the sources jar of the following artifact.
Upvotes: 1