Aufgabenblatt 6

This commit is contained in:
Anton Ertl
2022-05-16 20:27:14 +02:00
parent 1e789dba34
commit e311ef3c6b
7 changed files with 428 additions and 0 deletions

View File

@ -0,0 +1,56 @@
// A map that associates an object of 'Massive' with a Vector3. The number of key-value pairs
// is not limited.
//
// TODO: define further classes and methods for the binary search tree and the implementation
// of MassiveSet, if needed.
//
public class MassiveForceTreeMap {
// TODO: define missing parts of this class.
// 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(Massive 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(Massive key) {
// TODO: implement method.
return null;
}
// Returns 'true' if this map contains a mapping for the specified key.
//Precondition: key != null
public boolean containsKey(Massive key) {
// TODO: implement method.
return false;
}
// Returns a readable representation of this map, in which key-value pairs are ordered
// descending according to 'key.getMass()'.
public String toString() {
// TODO: implement method.
return "";
}
// Returns a `MassiveSet` view of the keys contained in this tree map. Changing the
// elements of the returned `MassiveSet` object also affects the keys in this tree map.
public MassiveSet getKeys() {
// TODO: implement method.
return null;
}
}
//TODO: Define additional class(es) implementing the binary search tree and the implementation
// of MassiveSet (either here or in a separate file).