Finite State Automata

I tried to take a photo of the FSA on the board from class, but it did not turn out.

Here is a similar diagram to the one we went over in class. This is NOT identical, but it does have a similar structure and actually is more complete.

Corgis databases

Ant properties

Bundling one jar in another

Running from a jar file

-bash-4.3$ java -cp build/corgiAirlines.jar edu.ucsb.cs56.corgis.airlines.demos.ExampleStringSort
[BOS, EWR, JFK, LAX, OAK, PHX, SAN, SBA, SFO, SJC, SNA]
-bash-4.3$

Sorting with lambdas

In ExampleSort01.java we use a lambda to sort by Airport Code

    public static void main(String[] args) {
        // Get access to the library
        AirlinesLibrary airlinesLibrary = new AirlinesLibrary();
        // Access data inside the library
        ArrayList<Airline> list_of_airline = airlinesLibrary.getReports(true);

 	      Collections.sort(list_of_airline,
			    (a1,a2) ->
			      a1.getAirport().toString().compareTo(a2.getAirport().toString()));
	
        AirlinePrinter.printNicely(list_of_airline);
    }

The main class of ExampleSort02.java is identical except for the lambda expression; here we sort by airline code (Carrier, e.g. AA for American Airlines, DL for Delta, etc.)

 		Collections.sort(list_of_airline,
			 (a1,a2) ->
			 a1.getCarrier().toString().compareTo
			         (a2.getCarrier().toString()));