Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group 3 #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions src/main/java/Airport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import models.MilitaryType;
import Planes.MilitaryPlane;
import Planes.Plane;

import java.util.*;
Copy link

@themasterlink themasterlink Sep 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* import are considered bad in python (no idea about java), clutter the global namespace


public class Airport {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class has no documentation


/**
* Prints transport military planes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add content for documentation

*/
private void printMaxTransportMilitaryPlane() {
List<MilitaryPlane> transportMilitaryPlanes = new ArrayList<>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
List<MilitaryPlane> transportMilitaryPlanes = new ArrayList<>();

Not used

Plane maxPlane = null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this line to before the for loop.


// print banner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment can be omitted.

System.out.println ("*********************************************");
System.out.println ("***** Largest Transport Military Plane ******");
System.out.println ("*********************************************");
Comment on lines +17 to +19

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No white space before opening parenthesis.


for (Plane plane : planes) {
if (plane instanceof MilitaryPlane) {
if (((MilitaryPlane) plane).getType() == MilitaryType.TRANSPORT) {
if (maxPlane != null && maxPlane.getMaxLoadCapacity() < plane.getMaxLoadCapacity()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxPlane is always null. Therefore this is always false, which leads to a seg fault in Line 33.

maxPlane = plane;
}
}
} //if

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove empty docu

else {

} // else
Comment on lines +29 to +31

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code can be omitted.

} //for

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove empty docu

System.out.println("model:" + maxPlane.getModel());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No seg fault check

System.out.println("capacity:" + maxPlane.getMaxLoadCapacity());
}

//Constructor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove empty docu, and please add explicit documentation on the constructor

public Airport(List<? extends Plane> planes) {
this.planes = planes;
this.printMaxTransportMilitaryPlane();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not call a print fct in a constructor

}

private List<? extends Plane> planes;

public List<? extends Plane> getPlanes() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing documentation

return planes;
}

}