How to compare brain waves? I'm a Java developer completely naive of brain waves and such. Could anyone tell me how to compare them? 

For instance, how can I compare: 



and this: 



What fields of study should I focus on? I understand there are some Pattern Recognition involved. Other than that, what else? 
Related Questions: 


Is EEG brain-computer interface reliable?
https://cogsci.stackexchange.com/questions/8628/brain-computer-interface?rq=1
The field of study you should focus on is the one for which you have already identified in your paragraph above which is EEG based &quot;brain-computer interface&quot;.
EEG signals are compared by their &quot;features&quot;. Each of the signal you have provided above have different features. These features can be mean, variance, frequency, kurtosis, skewness of each of the signals (statistical parameters which also includes fractal dimension, Hjorth parameters, common spatial pattern, fano factor... ...) or power as computed through frequency space algorithms such as fast fourier transform.
More sophisticated techniques such as blind source separation, empirical mode decomposition and wavelet coherence (a phase domain approach) should yield additional insights but these are more reserved for research purposes.
The most common algorithm for post processing is the wavelet transform which plots the energy as a function of both time and frequency.
During a seizure, the wavelet transform will display a clear high energy periodic signal at the lower frequency. While highly efficient in pin pointing exactly where and how the seizure is happening, the wavelet transform is highly advanced (challenging to implement) and runs at O(n^2) for a naive implementation and O(nlogn) for a fast implementation. It is quite computationally expensive.

What you need to implement is a real time seizure detection based on EEG features.
(offline)
This is done first by grabbing the EEG signal when he has a seizure using EEG headsets or through research, estimate what the characteristics of this type of seizures are. (this can be done even with a single electrode).
(real time)
Once this done, hook the patient with the EEG headset and compute the features of the seizure signal at every other other second worth of samples as they stream into a computing platform. The features are constantly compared to the threshold features. When all these features are have their respective threshold (A and B and C and D all meets threshold). Send alert that a seizure is happening.
The threshold approach is a basic one, but because our brain continuously changing and EEG depends on many many external variables, what is commonly used in practice are the detection of seizure through artificial neural networks (ANN) - it will not only tell you when a seizure is happening but could in fact PREDICT when a seizure will occur! (*)
One challenge I can see with what you are attempting to do is that the patient will be constantly hooked up with a headset in order to perform real time seizure prediction. The distance between your USB and the headset will be a hard constraint. The headsets needs to be recharged frequently. Emotiv EPOC (one popular headset) contains 16 electrodes which can be quite burdensome when worn. Wet electrodes provides better data but requires delicate preparation which can take a long time. If worn constantly, I would pick a headset containing a few electrodes at key places like the frontal-polar lobe (since seizure is more easily picked up than other EEG patterns, we don't need many electrodes) and would choose one that is aesthetically pleasing (one from Neurosky or one of the recent headset from Emotiv i.e. insight) and has a long battery life time
Good luck
(*) Prediction of seizure onset in an in-vitro hippocampal slice model of epilepsy using Gaussian-based and wavelet-based artificial neural networks. - A. Chiu