input
stringlengths
10
828
output
stringlengths
5
107
public void remove filter image filter filter throws filter exception if this filters contains filter this filters remove filter else throw new filter exception filter remove error
removes a filter from a filter chain
public void initialize image request request throws codec exception iterator it image encoders iterator assert image encoders size 0 missing encoders while it has next image encoder encoder image encoder it next if encoder can handle request encoder initialize request
initialize the image encoder for a particular encodingformat using properties
public document read file file throws ioexception saxexception parser configuration exception document builder factory factory document builder factory new instance document builder builder null builder factory new document builder assert file exists unable to find xml file file get absolute path document document builder parse file return document
read an xml document from file
public planar image filter planar image image throws filter exception for iterator it filters iterator it has next image filter filter image filter it next image filter filter image if log is info enabled log info filtered image in filterchain this get name return image
filters the image by passing it through all filters in the filterchain
public document read input stream input stream throws ioexception saxexception parser configuration exception document builder factory factory document builder factory new instance document builder builder null builder factory new document builder assert input stream available 1 unable to read from input stream input stream document document builder parse input stream return document
read an xml document from input stream
public void set attribute node node string key string value named node map map node get attributes attr attr node get owner document create attribute key attr set value value map set named item attr
sets an attribute in an xml dom node
public boolean equals object o if this o return true if o instanceof filter chain return false final filter chain filter chain filter chain o if name equals filter chain name return false return true
override equals to check for unique name
public string get attribute node node string key throws no such attribute exception try named node map map node get attributes attr attr attr map get named item key return attr get value catch exception e throw new no such attribute exception attribute for key does not exist key
gets an attributes value in an xml dom node
public int hash code return name hash code
override hash code to generate for name uniqueness
public planar image filter planar image image throws filter exception this normalize kernel jai kernel new kernel jai 5 5 data parameter block pb new parameter block pb add source image pb add kernel rendering hints hints new rendering hints jai key border extender border extender create instance border extender border copy return planar image jai create convolve pb hints
filter the image
public void normalize float sum 0 0 f for int i 0 i data length i sum data i if sum 0 0 f for int i 0 i data length i data i data i sum else sum 1 0 f
normalizes the convolution matrix
public planar image filter planar image image throws filter exception this normalize kernel jai kernel new kernel jai 5 5 data parameter block pb new parameter block pb add source image pb add kernel return planar image jai create convolve pb null
filter the image
public planar image filter planar image image throws filter exception mean filter mean new mean filter planar image mean image mean filter image parameter block pb new parameter block pb add source image pb add source mean image planar image edges jai create subtract pb null parameter block pb2 new parameter block pb2 add source image pb2 add source edges return planar image jai create add pb2 null
filter the image
public planar image filter planar image image throws filter exception this normalize kernel jai kernel new kernel jai 3 3 data parameter block pb new parameter block pb add source image pb add kernel return planar image jai create convolve pb null
filter the image
public planar image filter planar image image throws filter exception planar image la placian super filter image parameter block pb new parameter block pb add source image pb add source la placian return planar image jai create subtract pb null
filter the image
public void initialize properties filter properties throws filter exception if log is debug enabled log debug initialized no op filter
initializes the image filter with properties
public void initialize properties filter properties throws org jmage filter filter exception try adjust double value of filter properties get property adjust 10 double value assert adjust 0 adjust 100 adjust values are only allowed ranging from 0 100 out of range error adjust adjust 2 5d this filter properties filter properties if log is debug enabled log debug initialized catch throwable t string message not initialized t get message this filter properties null if log is enabled for priority error log error message throw new filter exception message
initializes the image filter with properties
public planar image filter planar image image throws filter exception if log is debug enabled log debug passed image through no op filter return image
returns the image
public string to string string source image this image uri null this image uri to asciistring null string filter chain this filter chain uri null this filter chain uri to string null long filter properties this filter chain properties null this filter chain properties hash code 0 filter properties this encoding format null this encoding format hash code 0 return source image filter chain filter properties
override to string for better readability
public planar image filter planar image image throws filter exception parameter block pb new parameter block pb add source image int bands image get sample model get num bands double matrix new double bands for int i 0 i bands 1 i matrix i adjust pb add matrix return jai create addconst pb null
brightens the image
public planar image filter planar image image throws filter exception try index color model model index color model image get color model byte lut new byte 3 model get map size model get reds lut 0 model get greens lut 1 model get blues lut 2 image jai create lookup image new lookup table jai lut return image catch class cast exception e throw new filter exception wrong colorspace catch exception e1 throw new filter exception conversion error e1 get message
convert the indexed image to rgb
public void initialize properties filter properties throws org jmage filter filter exception try initialize the brightness alpha double value of filter properties get property alpha alpha default double value assert alpha 100 0d alpha 100 0d alpha alpha range error alpha alpha 2 5d this filter properties filter properties if log is debug enabled log debug initialized catch throwable t string message not initialized t get message this filter properties null if log is enabled for priority error log error message throw new filter exception message
initializes the image filter with properties
public void initialize properties filter properties throws filter exception try adjust double value of filter properties get property adjust default darken double value assert adjust 0 adjust 100 adjust darken range error adjust adjust 2 5d this filter properties filter properties if log is debug enabled log debug initialized catch throwable t string message not initialized t get message this filter properties null if log is enabled for priority error log error message throw new filter exception message
initializes the image filter with properties
public planar image filter planar image image throws filter exception parameter block pb new parameter block pb add source image pb add table return jai create lookup pb null
color the image
public planar image filter planar image image throws filter exception if image get color model instanceof index color model image new index2 rgbconverter filter filter image int bands image get num bands double bandcombine new double 1 bands 1 system arraycopy ntsc luminance 0 0 bandcombine 0 0 bands bandcombine 0 bands alpha parameter block pb new parameter block pb add source image pb add bandcombine return planar image jai create bandcombine pb null
convert the image into a greyscaled version
protected void fill filter chain properties string key string value properties filter chain properties string per filter chain property key split object per filter chain props filter chain properties get per filter chain property 0 null per filter chain property 0 empty string if per filter chain props null per filter chain props new properties properties per filter chain props set property per filter chain property 1 null per filter chain property 1 to upper case empty string value filter chain properties put per filter chain property 0 null per filter chain property 0 empty string per filter chain props
extract per filterchain only properties
public planar image filter planar image image properties image properties throws filter exception additional properties on top of existing ones properties preconfigured this get filter properties properties local properties preconfigured clone local put all image properties change state to use local params this initialize local image this filter image return to previous state this initialize preconfigured return image
filter the image with additional properties
public properties get filter properties return filter properties
gets the filters properties
protected void fill image param string key string image image request image request throws urisyntax exception image request set image uri new uri image image request set encoding format determine content type image
set the image param on the image request
public planar image filter planar image image throws filter exception int width image get width int height image get height parameter block pb new parameter block pb add source image coordinates are 0 based pb add left pb add top pb add width left right pb add height top bottom planar image result planar image jai create crop pb return result
filter the image
public planar image filter planar image image throws filter exception parameter block pb new parameter block pb add source image renderable image renderable jai create renderable renderable pb return planar image renderable create scaled rendering scaled width scaled height hints
filter the image
protected void fill chain param string key string value image request image request throws urisyntax exception string chains value split uri filter chain uris new uri chains length for int i 0 i chains length i string chain chains i if chain starts with chainurischeme chain chainurischeme chain filter chain uris i new uri chain image request set filter chain uri filter chain uris
set the chain param on the image request
public planar image filter planar image image throws filter exception parameter block pb new parameter block pb add source image pb add left pb add right pb add top pb add bottom int bands image get sample model get num bands double constants new double bands for int i 0 i bands 1 i constants i rgb i pb add new border extender constant constants return planar image jai create border pb
filter the image
protected uri complete uri string resource throws urisyntax exception uri uri string buffer buffer new string buffer buffer append file buffer append colon buffer append slash buffer append slash buffer append resource starts with slash resource slash resource uri new uri buffer to string return uri
fix partial uris
protected string determine content type string image path return image path substring image path last index of dot 1 to lower case
what content type are we looking for
public void print message object obj string message system out println append class and date and message obj message to string
print the message
public void print message object obj string message throwable t system out println append class and date and message obj message to string t print stack trace
print the message
public void print message string category string message system out println append class and date and message category message to string
print the message
public void print message string category string message throwable t system out println append class and date and message category message to string t print stack trace
print the message
public void init log observer for int i 0 i log factory get instance get loggers size i try register new log observer logger log factory get instance get loggers element at i catch exception e
initialize the log observer
public void register new log observer logger logger if log validator get instance validate logger observers add logger
register a new log observer validate the class before registering it
public void print message object obj string message write to file output stream append class and date and message obj message to string
print the message
public void print message object obj string message throwable t write to file output stream append class and date and message obj message to string t print stack trace this output stream
print the message
public void print message string category string message write to file output stream append class and date and message category message to string
print the message
public void print message string category string message throwable t write to file output stream append class and date and message category message to string t print stack trace this output stream
print the message
public void warn object obj string message if check all conditions obj message severity levels warn print message obj message
this method will log for severity level warn
public void init factory load the properties file if load properties make logger classes
init the factory give the directory the file is in
public void init factory string baseconfigfiledirectory load the properties file if load properties baseconfigfiledirectory make logger classes
init the factory give the directory the file is in
public void warn object obj string message throwable t if check all conditions obj message severity levels warn print message obj message t
this method will log for severity level warn
public void set properties properties props this props props if props null set severity level related property props set all keyword related properties props set allcategory related properties props
this method sets the properties for the logger
public void warn string category string message if check all conditions category message severity levels warn print message category message
this method will log for severity level warn
public void warn object obj string message try logger loggers get obj get class get name fine message catch null pointer exception ne if loggers get obj get class get name null set new class to log obj warn obj message recursive yikes catch exception e
this method will log for severity level warn
private void make logger classes if props null props get property loggerclass null return string tokenizer st new string tokenizer props get property loggerclass delimiter while st has more tokens load logger class st next token trim
create all of the logger classes specified in the log file
public void warn string category string message throwable t if check all conditions category message severity levels warn print message category message t
this method will log for severity level warn
public void warn object obj string message try logger loggers get obj get class get name warn message catch null pointer exception ne if loggers get obj get class get name null set new class to log obj warn obj message recursive yikes catch exception e
this method will log for severity level warn
public void info object obj string message if check all conditions obj message severity levels info print message obj message
this method will log for severity level info
public void warn object obj string message throwable t try logger loggers get obj get class get name fine message t catch null pointer exception ne if loggers get obj get class get name null set new class to log obj warn obj message t recursive yikes catch exception e
this method will log for severity level warn
public void info object obj string message throwable t if check all conditions obj message severity levels info print message obj message t
this method will log for severity level info
public void warn string category string message try logger loggers get category fine message catch null pointer exception ne if loggers get category null set new class to log category warn category message recursive yikes catch exception e
this method will log for severity level warn
public void info string category string message if check all conditions category message severity levels info print message category message
this method will log for severity level info
public void warn object obj string message throwable t try logger loggers get obj get class get name warn message t catch null pointer exception ne if loggers get obj get class get name null set new class to log obj warn obj message t recursive yikes catch exception e
this method will log for severity level warn
private void set keywords string keywords this keywords keywords
set the keywords
public void info string category string message throwable t if check all conditions category message severity levels info print message category message t
this method will log for severity level info
public void warn string category string message throwable t try logger loggers get category fine message t catch null pointer exception ne if loggers get category null set new category to log category warn category message t recursive yikes catch exception e
this method will log for severity level warn
public void debug object obj string message if check all conditions obj message severity levels debug print message obj message
this method will log for severity level debug
private string get keywords return this keywords
get the keywords
public void warn string category string message try logger loggers get category warn message catch null pointer exception ne if loggers get category null set new category to log category warn category message recursive yikes catch exception e
this method will log for severity level warn
public void debug object obj string message throwable t if check all conditions obj message severity levels debug print message obj message t
this method will log for severity level debug
public void info object obj string message try logger loggers get obj get class get name info message catch null pointer exception ne if loggers get obj get class get name null set new class to log obj info obj message recursive yikes catch exception e
this method will log for severity level info
public void debug string category string message if check all conditions category message severity levels debug print message category message
this method will log for severity level debug
private void set usekeywords boolean usekeywords this usekeywords usekeywords
set if we use keywords search
public void debug string category string message throwable t if check all conditions category message severity levels debug print message category message t
this method will log for severity level debug
public void info object obj string message throwable t try logger loggers get obj get class get name info message t catch null pointer exception ne if loggers get obj get class get name null set new class to log obj info obj message t recursive yikes catch exception e
this method will log for severity level info
public void warn string category string message throwable t try logger loggers get category warn message t catch null pointer exception ne if loggers get category null set new category to log category warn category message t recursive yikes catch exception e
this method will log for severity level warn
public void error object obj string message if check all conditions obj message severity levels error print message obj message
this method will log for severity level error
public void info string category string message try logger loggers get category info message catch null pointer exception ne if loggers get category null set new class to log category info category message recursive yikes catch exception e
this method will log for severity level info
public void error object obj string message throwable t if check all conditions obj message severity levels error print message obj message t
this method will log for severity level error
private boolean get usekeywords return this usekeywords
get if we use keywords search
public void error string category string message if check all conditions category message severity levels error print message category message
this method will log for severity level error
public void info string category string message throwable t try logger loggers get category info message t catch null pointer exception ne if loggers get category null set new category to log category info category message t recursive yikes catch exception e
this method will log for severity level info
public void error string category string message throwable t if check all conditions category message severity levels error print message category message t
this method will log for severity level error
public void fatal object obj string message if check all conditions obj message severity levels fatal print message obj message
this method will log for severity level fatal
public void debug object obj string message try logger loggers get obj get class get name finest message catch null pointer exception ne if loggers get obj get class get name null set new class to log obj debug obj message recursive yikes catch exception e
this method will log for severity level debug
public void fatal object obj string message throwable t if check all conditions obj message severity levels fatal print message obj message t
this method will log for severity level fatal
public void fatal string category string message if check all conditions category message severity levels fatal print message category message
this method will log for severity level fatal
public void debug object obj string message throwable t try logger loggers get obj get class get name finest message t catch null pointer exception ne if loggers get obj get class get name null set new class to log obj debug obj message t recursive yikes catch exception e
this method will log for severity level debug
public void fatal string category string message throwable t if check all conditions category message severity levels fatal print message category message t
this method will log for severity level fatal
public void info string category string message try logger loggers get category info message catch null pointer exception ne if loggers get category null set new category to log category info category message recursive yikes catch exception e
this method will log for severity level info
private string get categories return this categories
get categories string
public void debug string category string message try logger loggers get category finest message catch null pointer exception ne if loggers get category null set new class to log category debug category message recursive yikes catch exception e
this method will log for severity level debug
private boolean check all conditions object obj string message int level if level get severity level chosen check for categories and keywords obj get class get name message return true return false
check if we will log the message
private void set usecategories boolean usecategories this usecategories usecategories
get if we use categories search
public void debug string category string message throwable t try logger loggers get category finest message t catch null pointer exception ne if loggers get category null set new category to log category debug category message t recursive yikes catch exception e
this method will log for severity level debug
private boolean check all conditions string category string message int level if level get severity level chosen check for categories and keywords category message return true return false
check if we will log the message
public void error object obj string message try logger loggers get obj get class get name warning message catch null pointer exception ne if loggers get obj get class get name null set new class to log obj error obj message recursive yikes catch exception e
this method will log for severity level error
public void debug object obj string message try logger loggers get obj get class get name debug message catch null pointer exception ne if loggers get obj get class get name null set new class to log obj debug obj message recursive yikes catch exception e
this method will log for severity level debug
private boolean get usecategories return this usecategories
get if we use categories search
public void error object obj string message throwable t try logger loggers get obj get class get name warning message t catch null pointer exception ne if loggers get obj get class get name null set new class to log obj error obj message t recursive yikes catch exception e
this method will log for severity level error
public void debug object obj string message throwable t try logger loggers get obj get class get name debug message t catch null pointer exception ne if loggers get obj get class get name null set new class to log obj debug obj message t recursive yikes catch exception e
this method will log for severity level debug
private void setup categories list string categories break character delimited string into vector list categories list categories
take the category string given delimited by a character