input
stringlengths
10
828
output
stringlengths
5
107
public void validate email string email if email null email equals errors add div align center style color ff0000 email was not entered div return else string expression a za z0 9 a za z0 9 a z a z 2 4 char sequence input str email pattern pattern pattern compile expression pattern case insensitive matcher matcher pattern matcher input str if matcher matches errors add div align center style color ff0000 email format is incorrect div
this method takes an email and makes sure that it is not null
public string render header string title string css locs string script locs string str html new line head new line str title title title new line for string css loc css locs str link type text css rel stylesheet href css loc new line for string script script locs str script type text javascript src script new line str head new line return str
method that renders the header
public string render time picker div return fb dialog id time chooser fb dialog title please wait fb dialog title fb dialog content loading fb dialog content fb dialog
renders the ajax div for showing the times
public event is restricted http servlet request request if request get session get attribute parameters event id null service service new service return event service load event class long request get session get attribute parameters event id return null
method to determine whether an event has been created already
public string get google map url location loc string url string input input loc get location name replace all url http maps google com maps api staticmap center url input url zoom 14 size 512x512 maptype roadmap markers color blue label url loc get location name url input url sensor false key new property loader get property google maps api key return url
called by the attendees servlet
public boolean has entry event interface event date date for day day event get event days if day matches date return true return false
method to determine whether that date entry exists for the given event
private string render location chooser div return fb dialog id location chooser div fb dialog title please wait fb dialog title fb dialog content loading fb dialog content fb dialog
renders the ajax div for showing the times
private void render text element int current day element td text current day text node null if the current day is greater than the max then don t print anything out if date util is valid date current day this start date get month 1 this start date get year 1900 current day text node document create text node current day else current day text node document create text node td append child current day text node
helper method to render individual elements of time render
private void remove user from times event interface event int year int month int day person person gets all the days and see if it matches the one chosen for day day obj event get event days if day obj get day day day obj get month month day obj get year year we find found the day we have look at the times remove old times for time time day obj get times set person attendees if attendees time get attendees null attendees remove person
method that removes the person from that timeslot
public domain load class extends domain clazz long uid session get session session begin transaction object obj session load clazz uid return clazz cast obj
method to load an object from the database
public long save or update domain obj session get session session begin transaction session save or update obj serializable srl session get identifier obj session get transaction commit log info srl to string log info save triggered object obj to string return long srl
will save the object using the persistance framework
private string build event saver button return input type button style margin left auto margin right auto clickrewriteurl new property loader get property url time saver chooser clickrewriteform time saver form clickrewriteid time saver div clicktoshowdialog time saver div name save value save event preference
method that will render the button to save the day option choice
public boolean matches int year2 int month2 int day2 return year year2 month month2 day day2
see if this date object matches another one
public void commit get session get transaction commit commit will close off the tx we
public method to commit the current transaction
public boolean matches date date gregorian calendar cal new gregorian calendar cal set time date return matches cal get calendar year cal get calendar month 1 cal get calendar day of month
determines whether this day object is the same as the date object given
public void delete domain obj session get session session begin transaction session delete obj session get transaction commit
this method will delete a domain object and then will flush right away
public void delete defer commit domain obj session get session session begin transaction session delete obj
this method will delete the object but wont flush right away
public session get session return hibernate singleton get session get current session
gets the current hibernate session
private string build check box boolean checked location loc if checked return input type checkbox name location loc get id value loc get id id location loc get id checked yes else return input type checkbox name location loc get id value loc get id id location loc get id
private method to build the checkbox of the voting
public person person exists string email long facebook uid throws more than one person exception person person if person get person by facebook uid facebook uid null return get person by email email return person
method to check if the person exists in the database
private boolean delete temp xml file file file name return file name delete
a method to delete the temp file generated by the xml parser
public object retrieve sqlquery string sql session get session session begin transaction return session create sqlquery sql list get 0
a wrapper method to call sql query via the session
private boolean check if creator person p person c long user id p get facebook uid long creator id c get facebook uid if user id creator id return true else return false
method checks to see if persons have the same id
public void attach sequences array list sequence sequences for iterator sequence iter sequences iterator iter has next sequence sequence iter next orf orf find orf sequence get name if orf null orf set sequence sequence
attach sequences to the orfs in this genome matching orfs names
private void changed btn apply set enabled true
indicating parameter or palette has been changed
public string get description if full description null if description null is extension list in description full description description null description build the description from the extension list enumeration string extensions filters keys if extensions null full description extensions next element while extensions has more elements full description string extensions next element full description else full description description return full description
returns the human readable description of this filter
public boolean is focus traversable return super is focus traversable is request focus enabled
identifies whether or not this component can receive the focus
public float get layout alignment x container target return 1 0f 2 0f
returns the alignment along the x axis
public float get layout alignment y container target return 1 0f 2 0f
returns the alignment along the y axis
public void remove layout component component comp m component to constraint remove comp
removes the specified component from the layout
public void set name string name if m validated return m name name
setter for the name attribute
public void set interface string interface name if m validated return m interface interface name
setter for the interface name attribute
public void set enabled boolean enabled if m validated return m enabled enabled
setter for the enabled property
public void set cardinality string cardinality if m validated return m cardinality cardinality if m cardinality equals 0 1 m cardinality equals 0 n m cardinality equals 1 1 m cardinality equals 1 n throw new illegal argument exception cardinality should take one of the following values 0 1 0 n 1 1 1 n if m cardinality equals 0 1 m cardinality equals 0 n m is optional true if m cardinality equals 0 n m cardinality equals 1 n m is multiple true
setter for the cardinality attribute
public void validate if m name null throw new component exception property name attribute is mandatory
method used to verify if the semantics of this metadata are correct
public void set policy string policy if m validated return if m policy equals static m policy equals dynamic throw new illegal argument exception policy must be either static or dynamic if policy equals static false m is static false m policy policy
setter for the policy attribute
public void set immediate boolean immediate if m validated return m immediate immediate
setter for the immediate property
public void set bind string bind if m validated return m bind bind
setter for the bind method attribute
public void set implementation class name string implementation class name if m validated return m implementation class name implementation class name
sets the name of the implementation class
public void set unbind string unbind if m validated return m unbind unbind
setter for the unbind method attribute
public void add property property metadata new property if m validated return if new property null throw new illegal argument exception cannot add a null property m property meta data add new property
used to add a property to the instance
public void set service service metadata service if m validated return m service service
used to set a service metadata object
public string get cardinality return m cardinality
get the cardinality as a string
public void add dependency reference metadata new reference if new reference null throw new illegal argument exception cannot add a null reference metadata m references add new reference
used to add a reference metadata to the component
public string get policy return m policy
get the policy as a string
public boolean is static return m is static
test if dependencys binding policy is static
public string get factory identifier return m factory
returns the factory identifier
public boolean is multiple return m is multiple
test if dependency is multiple 0
public boolean is immediate return m immediate
returns the flag that defines the activation policy for the component
public string get implementation class name return m implementation class name
returns the name of the implementation class
public service metadata get service metadata return m service
returns the associated service metadata
public dictionary get properties return m properties
returns the properties
public list get dependencies return m references
returns the dependency descriptors
public boolean is factory return m factory null
test to see if this service is a factory
public object get instance return m implementation object
get the object that is implementing this descriptor
public string get lang name by code string lang code string ret string lang name if lang code length 2 lang code lang code substring 0 2 lang code substring 3 5 to upper case lang name lang hash code name get lang code if lang name null ret else ret lang name return ret
return language name by input language code
public string get lang code by name string lang name string ret string lang code lang hash name code get lang name if lang code null ret else ret lang code to string replace to lower case return ret
return language name by input language code
public string convert name to short string name int pos name index of if pos 1 return name string lang name lang name name substring 0 pos 1 name substring pos 1 pos 3 to upper case return lang name
convert flag name from long format to short format
public int get count return data length
the number of items in the list is determined by the number of
public object get item int position return data position
since the data comes from an array just returning the index is
public void request picture handler handler if m camera null m b previewing m parent message handler handler
save the parent handler in order to process the image request
public void set surface holder surface holder holder m parent surface holder holder
set the parent surface holder
public boolean open driver if m parent surface holder null return false if m camera null m camera camera open try m camera set preview display m parent surface holder catch ioexception e log v tag e to string return false if m b initialized m b initialized true get screen resolution set camera parameters return true
open the camera driver using the saved parent surface holder
public void open driver surface holder holder if m camera null m camera camera open try m camera set preview display holder catch ioexception e log v tag e to string if m b initialized m b initialized true get screen resolution toast make text context m context get screen resolution toast length long show set camera parameters
open camera driver using a parameter surface holder
public void close driver if m camera null m camera release m camera null m parent surface holder null
close the camera driver
public void stop preview if m camera null m b previewing m camera set preview callback null m camera stop preview m b previewing false
stop camera preview mode
public void request auto focus if m camera null m b previewing m camera auto focus m auto focus callback
set the camera auto focus callback
public void get picture m camera take picture null null m picture callback jpg
take a picture and set the jpg callback
private void do installatioin install thread new thread new runnable public void run download installation files un zip installation files install thread start
call this method to complete installation processes
public void do ocrjob bitmap bm m bm ocrbitmap bm m pd ocrin progress progress dialog show this text recognition in progress please wait true true m pd ocrin progress set on cancel listener new on cancel listener public void on cancel dialog interface dialog android os process kill process android os process my pid thread the ocrthread new thread this the ocrthread start
show a progress bar and start the ocr thread
private void play sound on focus tone generator tg new tone generator audio manager stream system 100 tg start tone tone generator tone prop beep2
play a predefined sound when camera focused
private void init camera if camera manager get null return m b preview ready true if camera manager get open driver camera manager get start preview
initialize the camera open the driver no params we assume the surface
public boolean on options item selected menu item item switch item get item id case menu aboutus intent i contact us new intent droidslator this contact us activity class start activity i contact us return true case menu setup intent i setting new intent droidslator this setting activity class start activity i setting return true case menu donate my util call web browser http www codemobiles com donate html droidslator this return true case menu upgrade app my util call web browser http www codemobiles com droidslator droids beta apk droidslator this return false
called when item in option menu is selected
public void refresh vector v parent get all files int len v size string titles new string len list model clear for int i 0 i len i titles i extendet text pane v get i get title sort them in order arrays sort titles for int i 0 i titles length i list model add element titles i repaint
refresh the dialog
public void set syntax syntax syntax syntax syntax line comment header size syntax get line comment header size block comment header size syntax get block comment header size block comment trailer size syntax get block comment trailer size block com start syntax get block comment header block com end syntax get block comment trailer line com start syntax get line comment header string quote syntax get string quote char quote syntax get char quote
set the syntax of the programming language
public void add progress listener progress listener listener listeners add listener
add a progress listener
public void remove progress listener progress listener listener for int i 0 i listeners size progress listener l listeners get i if l listener system out println found progress listener to remove listeners remove i else i
remove a progress listener
public void set editor options preferences option options option set font size options get font size set font family set bold set italic if color highlight set color else set bw
set the editor options
private void set font family font set to monospaced font so that it will have fixed width style constants set font family normal style monospaced style constants set font family key style monospaced style constants set font family reserved style monospaced style constants set font family line comment style monospaced style constants set font family block comment style monospaced style constants set font family number style monospaced style constants set font family string style monospaced style constants set font family character style monospaced
set the font family
private void set bw style constants set foreground normal style color black style constants set foreground key style color black style constants set foreground line comment style color black style constants set foreground block comment style color black style constants set foreground number style color black style constants set foreground string style color black style constants set foreground character style color black style constants set background break style color white
set black and white basically it is for printing black and white purpose
private component set tool bar if tool bar null tool bar new jtool bar tool bar add create new btn tool bar add create open btn tool bar add separator tool bar add create save btn tool bar add box create horizontal strut 5 tool bar add box create horizontal glue tool bar set floatable false return tool bar
method to initialize the toolbar
public void set font size int size style constants set font size normal style size style constants set font size key style size style constants set font size reserved style size style constants set font size line comment style size style constants set font size block comment style size style constants set font size number style size style constants set font size string style size style constants set font size character style size
set the font size of the document
public void refresh try refresh 0 get length 1 system out println refreshed get length characters catch bad location exception e
refresh the document
private int find string search string int start int end int a text index of search string start if a end return a else return 1 the below method is slow return my text util find text to string search string true false start end
find the search string in the text
private int get new line int start int end int a text index of n start if a end return a else return 1
return the position of a newline or 1 is doesnt exist
private void remove newlines int offs int len find all new lines position before offs these do not need to be updated int i 0 boolean exceed false while exceed i newlines size int x newlines get i if x offs exceed true else i remove the newline that are between offs to offs len 1 int end offs len 1 int j i while j newlines size int x newlines get j newlines remove j if x end update position and add them back newlines add j x len j
remove newline to the array of newlines
public void set breakpoint int line set style line break style
highlight a line in the document to indicate that the line is breakpoint
private void set style int line style style int total lines get no of lines 1 int start get line pos line int end get length if line total lines end get line pos line 1 set character attributes start end start style false
highlight a line in the document with indicated style
private void clear style int line int total lines get no of lines 1 int start get line pos line int end get length if line total lines end get line pos line 1 try set character attributes start end start normal style true refresh start end 1 catch bad location exception e
clear the style at line indicated
public void highlight int line if highlighted 0 clear style highlighted highlighted line set style line highlight style
hightlight a line
public void highlight int start int end unhighlight first unhighlight highlighted get line no start set character attributes start end start highlight style true
highlight portion of the text
public void unhighlight if highlighted 1 clear style highlighted highlighted 1
unhighlight the line being highlighted
public void set integer int i set text new string new integer i to string
set the int value
public void set bold boolean is bold bold is bold
set the bold parameter
public void set italic boolean is italic italic is italic
set the italic parameter
public void set colour color color colour color
set the color parameter
public void on module load try out the tab panel tab panel tab panel make tab panel root panel get tab panel add tab panel
this is the entry point method
public map get class objects return class objects
returns the class objects
public map get class index map return class index map
returns the class index map
public string get database config file return database config file
returns the database config file