public Pattern getPattern(String name) {
        if (patterns != null) {

            Object attribute = library.getObject(patterns, name);
            // An instance of TilingPattern will always have a stream
            if (attribute != null && attribute instanceof TilingPattern) {
                return (TilingPattern) attribute;
            }
            else  if (attribute != null && attribute instanceof Stream) {
                return new TilingPattern((Stream)attribute);
            }
            // ShaddingPatterns will not have a stream but still need to parsed
            else if (attribute != null && attribute instanceof Hashtable) {
                return ShadingPattern.getShadingPattern(library,
                        (Hashtable) attribute);
            }
        }
        return null;
    }