Refactor for AB3

This commit is contained in:
2022-03-31 17:49:49 +02:00
parent 8c67e157d5
commit cf4c1ad9d0
3 changed files with 81 additions and 60 deletions

@ -1,40 +1,45 @@
// 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.
/**
* 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.
/**
* 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.
/**
* 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.
/**
* 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.
/**
* 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;
}
}