Also ich glaube, jetzt funktioniert jedenfalls mal der Testlauf (noch ohne best-fit) ...
> public void add(Bag obj) {
>
> Bag newBag = new Bag(obj);
------------------^
Hier hab ich nun direkt das Objekt zugewiesen, wie im vorigen Posting geschrieben ...
> if (begin == null && end == null) {
> begin = newBag;
> }
> else if (begin != null && end == null) {
> begin.next = newBag;
> end = begin.next;
> }
> else {
> end.next = newBag;
> end = end.next;
> }
> }
> public void print() {
>
> Bag actBag = begin;
> int i = 1;
>
> while (actBag != null) {
> System.out.println("Bag " + i + " with " + actBag.element.getActWeight() + " gramm. (" + actBag + ")");
-----------------------------------------------------------^
wo auch immer das herkommt, das element muss weg ... verhaspelt ...
> actBag = actBag.next;
> i++;
> }
> }
Bin mir zwar noch nicht wirklich sicher, was für einen Blödsinn ich da sonst noch so zusammengefuselt habe, aber jetzt funktioniert zumindest endlich "irgendwas" ... *jetztallesnochmalinRuheanschau*
Lg
sunny