Aufgabenblatt 3
This commit is contained in:
40
src/BodyForceTreeMap.java
Normal file
40
src/BodyForceTreeMap.java
Normal file
@ -0,0 +1,40 @@
|
||||
// A map that associates a Body with a Vector3 (typically this is the force exerted on the body).
|
||||
// The number of key-value pairs is not limited.
|
||||
public class BodyForceTreeMap {
|
||||
|
||||
//TODO: declare variables.
|
||||
|
||||
// Adds a new key-value association to this map. If the key already exists in this map,
|
||||
// the value is replaced and the old value is returned. Otherwise 'null' is returned.
|
||||
// Precondition: key != null.
|
||||
public Vector3 put(Body key, Vector3 value) {
|
||||
|
||||
//TODO: implement method.
|
||||
return null;
|
||||
}
|
||||
|
||||
// Returns the value associated with the specified key, i.e. the method returns the force vector
|
||||
// associated with the specified key. Returns 'null' if the key is not contained in this map.
|
||||
// Precondition: key != null.
|
||||
public Vector3 get(Body key) {
|
||||
|
||||
//TODO: implement method.
|
||||
return null;
|
||||
}
|
||||
|
||||
// Returns 'true' if this map contains a mapping for the specified key.
|
||||
public boolean containsKey(Body key) {
|
||||
|
||||
//TODO: implement method.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns a readable representation of this map, in which key-value pairs are ordered
|
||||
// descending according to the mass of the bodies.
|
||||
public String toString() {
|
||||
|
||||
//TODO: implement method.
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user