| «« The Freedom to Blog | Freedom in the News »» |
|
About
I'm Ryan Lowe, a Software Engineering graduate living in Ottawa, Canada. I like agile software development and Ruby on Rails.
I write this blog in Canadian English and don't use a spell checker. Typos happen.
Projects
» Full-time Ruby on Rails freelancer
» Full-time with Rails since May 2005 » Former committer for RadRails (now Aptana) » I also have a few Rails side-projects in development: 1. wheretogoinTO.com Toronto nightlife 2. Hey Heads Up! TODO list and sharing 3. Layered Genealogy family history research 4. foos for foosball scoring 5. fanconcert for music fans (on hold) Hiring Rails developers? I can telecommute by the hour from Ottawa, Canada »» Email: rails AT ryanlowe DOT ca
BulletBlog
Now hosted on Hey! Heads Up -- check it out!
Syndication
Pings
Recent
Derek Lowe's (Ryan's older brother) words at Ryan's funeral
blog@ryanlowe.ca no more Forging Email Headers: Good, Bad or Ugly? Sarcastic Dictionary (Part 1 of Many) Tags Hierarchies Twisting Rails is Risky Business Risky Business? My Take on Early Alphas Whoa, it's August 2007 Closing Comments A Postscript to "Growth at the grassroots" »» All Blog Posts
Linkage
del.icio.us/ryanlowe
technorati/ryanlowe.ca/blog Aurora Roy Jim Andrew Trasker Travis Kibbee Karen Dr. Unk Ayana Van Bloggers Joel Spolsky Robert Scoble Tim Bray Dave Winer Raymond Chen James Robertson Ruby/Rails Bloggers rubyonrails.org weblog David Heinemeier Hansson Dave Thomas James Duncan Davidson Mike Clark Jamis Buck Signal vs. Noise Tobias Luetke Amy Hoy: (24)slash7 Jeremy Voorhis Eclipse Bloggers Planet Eclipse EclipseZone Luis de la Rosa Eclipse Foundation Kim Horne Billy Biggs Ian Skerrett Mike Milinkovich Bjorn Freeman-Benson Denis Roy
Archives
|
AudioMan's TrackFilter
AudioMan's immutable TrackFilter object is used to filter tracks for the models. The models receive notification any time a mutator changes the repository. Some of these notifications don't apply to what the model is currently holding, like albums for a specific artist for example. The TrackFilter object's constructor takes three parameters: playlist, artist and album; and has two methods: acceptAdd() and acceptRemove() that both return boolean. If acceptAdd(track) is true, then the track should be added to the model. If acceptRemove(track) is true, then the track should be removed from the model. I used to have one method called accept() but then during unit testing I noticed a slight difference in filtering when a track was added and when it was removed, so I needed a method for each situation. If you are curious, check out the code for the exact situation. :) The accept...(track) methods determine their boolean output by comparing the track parameter against the parameters given in the constructor. If the playlist, artist and album names all match, then the method returns true. If any of the parameters are null then that means "all". So when each model is made it is given a TrackFilter to use. Each new model has a new TrackFilter to determine what notify messages reach it and actually change the model. The rest of the notifications are ignored. The TrackFilter class was inspired by Java's FileFilter interface. Posted at March 12, 2004 at 11:41 PM ESTLast updated March 12, 2004 at 11:41 PM EST Comments
|