public boolean matches ( MediaQuery q ) { //match the media type if ( q . getType ( ) != null ) { if ( q . getType ( ) . equals ( "all" ) ) { if ( q . isNegative ( ) ) return false ; //"NOT all" doesn't match to anything } else if ( q . getType ( ) . equals ( this . getType ( ) ) == q . isNegative ( ) ) //other than all return false ; } //match the eventual expressions for ( MediaExpression e : q ) { if ( ! this . matches ( e ) ) return false ; } //everything matched return true ; }
Checks if this media specification matches a given media query .