Software Development (CSC 321 2016F) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] [FAQ] [Teaching & Learning]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Outlines]
Reference: [Slack] [Ruby@CodeCademy]
Related Courses: [Rails Tutorial] [CSC 321 2016S @ EdX] [CSC 321 2015S (Davis)] [CSC 321 2016S (Rebelsky)] [CSC 322 2016F (Rebelsky)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker]
Overview
For each ...
struct.each do |x| ... end, whether we have a graph or a list or
a tree or an array or ....get, next, and hasNext.each method?
sendMail and a bunch of other methods.Mailer that provides a method
called send.public class AmikoAdapter implements Mailer
send method just calls sendMail method of Amiko.Sometimes it's to hide functionality; more often, it's just to go from one thing to something similar.
public interface LinearStructure<T>
{
public void put(T val);
public T get();
}
public interface Stack<T>
{
public void push(T val);
public T pop();
}
public interface Queue<T>
{
public void enqueue(T val);
public T dequeue(T val);
}
public class StackAdapter<T> implements LinearStructure<T>
{
Stack<T> s;
public void put(T val)
{
s.push(val);
}
public T get()
{
return s.pop();
}
}
turnOff method. If your realize that horses are also
vehicles, you'll realize that you may want to move turnOff
into a MechanicalVehicle subclass of Vehicle.ShipFactory.build.