input
stringlengths
10
828
output
stringlengths
5
107
public object get data object p key int p index object obj null array list arr array list m hash get p key if arr null p index 0 if arr size p index obj arr get p index return obj
retrieve data from the taglist
public iterator get iterator set set m hash key set return set iterator
return the hasmap iterator
public hash map get hash map return m hash
return the hashmap
public boolean is empty return m hash is empty
is taglist empty
public void jd report error throwable p throw jd report error p throw null return
report an error
public void put data jd taglist p tags if p tags null m hash put all p tags m hash return
merge the taglist
public void jd report error throwable p throw string p comment try jd taglist tags new jd taglist tags put data java lang throwable p throw tags put data comment p comment jd do method jd raise error tags jd to parent catch jd exception ee g log log level severe fatal error ee return
report an error with comment
public void put data object p key object p data int p index array list arr array list m hash get p key if arr null p index 0 arr set p index p data return
put data in the taglist
public void jd remove object jd objectable p object throws jd exception m children remove object p object return
remove a object from the object tree this method only remove the
public void remove data object p key array list arr array list m hash remove p key if arr null arr clear return
remove b all b data values with the key
public void remove data value object p value boolean changed true while changed true synchronized this int i object key data set set m hash key set iterator it set iterator changed false while changed false it has next key it next i 0 while changed false data get data key i null if data equals p value if i 1 p value null remove data key changed true hmmmmmmmmmm todo if i 2 p value null remove data key changed true return
remove b all b keys with data value
public void replace data object p key object p data remove data p key put data p key p data return
replace the data removing all keys first
public void sort data object p key comparator p comp array list arr array list m hash get p key if arr null object objl arr to array arrays sort objl p comp remove data p key int l objl length 1 int i 0 while i l put data p key objl i return
sort the data belong to the key
public void jd destroy jd taglist p tags throws jd exception jd remove string null clear members decrease object count m name null m children null return
destroy the jdot object
public jsonarray get public timeline throws jsonexception connection exception connection authentication exception connection unavailable exception socket timeout exception return new jsonarray get request statuses public timeline url
get the users public timeline
public jsonarray get friends timeline throws connection exception connection authentication exception connection unavailable exception socket timeout exception string url statuses friends timeline url url count m limit if m since id 0 url since id m since id jsonarray j arr null string request get request url try j arr new jsonarray request catch jsonexception e try jsonobject j obj new jsonobject request string error j obj opt string error if could not authenticate you equals error throw new connection authentication exception error catch jsonexception e1 throw new connection exception e return j arr
get the users own and friends timeline
public jsonarray get mentions timeline throws connection exception connection authentication exception connection unavailable exception socket timeout exception string url statuses mentions timeline url url count m limit if m since id 0 url since id m since id jsonarray j arr null string request get request url try j arr new jsonarray request catch jsonexception e try jsonobject j obj new jsonobject request string error j obj opt string error if could not authenticate you equals error throw new connection authentication exception error catch jsonexception e1 throw new connection exception e return j arr
get the users replies
public jsonarray get followers throws connection exception connection authentication exception connection unavailable exception socket timeout exception string url statuses followers url jsonarray j arr null string request get request url try j arr new jsonarray request catch jsonexception e try jsonobject j obj new jsonobject request string error j obj opt string error if could not authenticate you equals error throw new connection authentication exception error catch jsonexception e1 throw new connection exception e return j arr
get the users followers from the twitter rest api
protected void load theme boolean light m sp get boolean appearance light theme false string builder theme new string builder string name m sp get string theme and tweet if name index of theme 1 name name substring name index of theme theme append theme if light theme append light theme append name set theme int get resources get identifier theme to string style com xorcode andtweet
load the theme for preferences
public jsonarray get direct messages throws connection exception connection authentication exception connection unavailable exception socket timeout exception string url direct messages url url count m limit if m since id 0 url since id m since id jsonarray j arr null string request get request url try j arr new jsonarray request catch jsonexception e try jsonobject j obj new jsonobject request string error j obj opt string error if could not authenticate you equals error throw new connection authentication exception error catch jsonexception e1 throw new connection exception e return j arr
get the users own and friends timeline
public jsonarray get sent direct messages throws connection exception connection authentication exception connection unavailable exception socket timeout exception string url direct messages sent url url count m limit if m since id 0 url since id m since id jsonarray j arr null string request get request url try j arr new jsonarray request catch jsonexception e try jsonobject j obj new jsonobject request string error j obj opt string error if could not authenticate you equals error throw new connection authentication exception error catch jsonexception e1 throw new connection exception e return j arr
get the users own and friends timeline
public jsonobject destroy status long status id throws unsupported encoding exception connection exception connection authentication exception connection unavailable exception socket timeout exception string builder url new string builder statuses destroy url url append string value of status id url append extension jsonobject j obj null try j obj new jsonobject post request url to string string error j obj opt string error if could not authenticate you equals error throw new connection authentication exception error catch jsonexception e throw new connection exception e return j obj
destroys the status specified by the required id parameter
public jsonobject create favorite long status id throws unsupported encoding exception connection exception connection authentication exception connection unavailable exception socket timeout exception string builder url new string builder favorites create base url url append string value of status id url append extension jsonobject j obj null try j obj new jsonobject post request url to string string error j obj opt string error if could not authenticate you equals error throw new connection authentication exception error catch jsonexception e throw new connection exception e return j obj
favorites the status specified in the id parameter as the authenticating user
private void close soft keyboard input method manager input method manager input method manager get system service context input method service input method manager hide soft input from window m edit text get window token 0
close the on screen keyboard
public jsonobject verify credentials throws jsonexception connection exception connection authentication exception connection unavailable exception socket timeout exception return new jsonobject get request account verify credentials url new default http client new basic http params
verify the users credentials
public jsonobject rate limit status throws jsonexception connection exception connection authentication exception connection unavailable exception socket timeout exception return new jsonobject get request account rate limit status url new default http client new basic http params
check api requests status
protected string get request string url throws connection exception connection authentication exception connection unavailable exception socket timeout exception return get request url new default http client new basic http params
execute a get request against the twitter rest api
protected string post request string url throws connection exception connection authentication exception connection unavailable exception socket timeout exception return post request url new default http client new basic http params null
execute a post request against the twitter rest api
protected string post request string url url encoded form entity form params throws connection exception connection authentication exception connection unavailable exception socket timeout exception return post request url new default http client new basic http params form params
execute a post request against the twitter rest api
public cursor run query char sequence constraint string selection null string selection args null if constraint null selection m from 0 like string filter constraint to string selection args new string filter if m cursor null m cursor is closed m cursor close return m content resolver query m uri m projection selection selection args m sort order
create a new query with the constraint search parameters
public uri insert from jsonobject jsonobject jo boolean notify throws jsonexception sqlite constraint exception uri a message uri insert from jsonobject jo if notify m content resolver notify change a message uri null return a message uri
insert a record from a json object
public int prune old records long since timestamp if since timestamp 0 since timestamp system current time millis return m content resolver delete rettiwt database direct messages content uri rettiwt database direct messages created date since timestamp null
prune old records from the database to keep the size down
public void load timeline throws connection exception jsonexception sqlite constraint exception connection authentication exception connection unavailable exception socket timeout exception load timeline rettiwt database tweets tweet type tweet false
load the user and friends timeline
public void load timeline int tweet type throws connection exception jsonexception sqlite constraint exception connection authentication exception connection unavailable exception socket timeout exception load timeline tweet type false
load the user and friends timeline
public uri insert from jsonobject jsonobject jo int tweet type boolean notify throws jsonexception sqlite constraint exception uri a tweet uri insert from jsonobject jo tweet type if notify m content resolver notify change a tweet uri null return a tweet uri
insert a row from a jsonobject
public int prune old records long since timestamp if since timestamp 0 since timestamp system current time millis return m content resolver delete rettiwt database tweets content uri rettiwt database tweets created date since timestamp null
remove old records to ensure that the database does not grow too large
public int new count return m new tweets
return the number of new statuses
protected string get credentials return new string base64 encode bytes m username m password get bytes
get the http digest authentication
public int reply count return m replies
return the number of new replies
public long last id return m last status id
get the last status id
public int destroy status long status id return m content resolver delete rettiwt database tweets content uri rettiwt database tweets id status id null
destroy the status specified by id
protected void parse status code int code string path throws connection exception connection authentication exception connection unavailable exception switch code case 200 case 304 break case 401 throw new connection authentication exception string value of code case 400 case 403 case 404 throw new connection exception string value of code case 500 case 502 case 503 throw new connection unavailable exception string value of code
parse the status code and throw appropriate exceptions when necessary
protected string get twitter date long time synchronized m date format return m date format format new date time
format a date in the twitter date format
public string to string return get difference m context m calendar get time in millis
returns the relative time passed since now
public void load theme boolean light m sp get boolean appearance light theme false string builder theme new string builder string name m sp get string theme and tweet if name index of theme 1 name name substring name index of theme theme append theme if light theme append light theme append name set theme int get resources get identifier theme to string style com xorcode andtweet
load the theme for preferences
public void set title char sequence left text char sequence right text text view left title text view find view by id r id custom title left text text view right title text view find view by id r id custom title right text left title set text left text right title set text right text
sets the title with a left and right title
public void update title string username m sp get string twitter username null set title get string r string activity title format new object get title username
updates the activity title
protected char sequence get saved text return edit text find view by id r id edt tweet input get text
retrieve the text that is currently in the editor
protected void set saved text char sequence text edit text find view by id r id edt tweet input set text text
set the text in the text editor
protected void init ui attach listeners to the message list get list view set on create context menu listener this get list view set on item click listener this
initialize the user interface
protected boolean has hardware keyboard configuration c get resources get configuration switch c keyboard case configuration keyboard 12 key case configuration keyboard qwerty return true default return false
check to see if the system has a hardware keyboard
protected void bind to service if m sp contains automatic updates m sp get boolean automatic updates false intent service intent new intent iand tweet service class get name if m is bound start service service intent m is bound true bind service service intent m connection context bind auto create
initialize service and bind to it
protected void disconnect service if m is bound if m service null try m service unregister callback m service callback catch remote exception e service crashed not much we can do unbind service m connection m is bound false
disconnect and unregister the service
protected void destroy service disconnect service stop service new intent iand tweet service class get name m service null m is bound false
disconnects from the service and stops it
public void tweets changed int value throws remote exception m handler send message m handler obtain message msg tweets changed value 0
tweets changed callback method
public void data loading int value throws remote exception m handler send message m handler obtain message msg data loading value 0
data loading callback method
public void messages changed int value throws remote exception m handler send message m handler obtain message msg direct messages changed value 0
messages changed callback method
public void replies changed int value throws remote exception m handler send message m handler obtain message msg replies changed value 0
replies changed callback method
public void stop console console if separate thread null separate thread is alive i know this is separate thread stop console print console get info color note background thread stopped else console print console get warning color note background thread not alive
this will be one of the next features of jinni console
public boolean wait for console console currently not implemented return true
this will be one of the next features of jinni console
public void halt jinni if engine null engine stop engine machine new machine output print console get info color stop and new completed ok
halt jinni which is a stronger kind of reset
public void consult buffer buffer try string str filepath buffer get path output print console get info color jinni consulting str filepath string feed back engine run consult str filepath print jinni output output console get warning color output print console get info color feed back catch exception runtimeexception console print console get error color runtimeexception get message
consult the current j edit jinni file
public void consult from macro string str filepath startup engine in case of macros try engine run consult str filepath catch exception runtimeexception system out println runtimeexception get message
consult a jinni file from a macro
public void reconsult buffer buffer color info color console get info color color error color console get error color try string s buffer get path output print info color jinni reconsulting s string feed back engine run reconsult s print jinni output output console get warning color output print info color feed back catch exception runtimeexception console print error color runtimeexception get message
reconsult the current j edit jinni file
public void list jinni state color info color console get info color color warning color console get warning color color error color console get error color try string s listing output print info color jinni s string feed back engine run s print jinni output output console get warning color if feed back equals output print info color listing ok else output print warning color feed back catch exception runtimeexception console print error color runtimeexception get message
display all the current clauses in the output text area
private void find further solution try string feed back engine ask engine print jinni output output console get warning color output print console get info color feed back catch exception e console print console get warning color e get message
find and return multiple solutions in case there are multiple ones
public tvalue put tkey key tvalue value this assert store try return this put object key value catch store exception se throw new illegal state exception se get message
maps a key to a value
public tvalue get tkey key this assert store try return get object key catch store exception re throw new illegal state exception re get message
gets a persistent instance mapped to a string
public tvalue remove tkey key this assert store try return remove object key catch store exception re throw new illegal state exception re get message
removes a mapping for the given key if it exists
public void set driver class name string dcn try class c class for name dcn this driver driver c new instance catch class not found exception cnf throw new illegal argument exception class not found dcn catch class cast exception cc throw new illegal argument exception class dcn is not a java sql driver catch instantiation exception ie throw new illegal argument exception class dcn does not have a default public constructor catch illegal access exception iae throw new illegal state exception iae
sets mandatory property driver class name the
public object create store store throws store exception try return this clazz new instance catch instantiation exception ie throw new store exception unable to instantiate class this clazz get name it should have a default public constructor or it should have a store info suffixed class which implements store info catch illegal access exception iae throw new store exception iae
creates an instance of the class passed to the constructor
public void set connection timeout int timeout this timeout timeout
sets the amount of time in milliseconds that a
public boolean is duplicate entry error sqlexception se return se get error code 2601
checks if error code is 2601
public boolean is duplicate entry error sqlexception se if this sql state type database meta data sql state sql99 return 23505 equals se get sqlstate else string message se get message boolean is duplicate message null message to lower case index of duplicate 1 return is duplicate
checks for sql state 23505 in case sql99 codes are supported
public boolean equals object other if other instanceof index descriptor return false index descriptor oid index descriptor other return this name equals oid get name this unique oid is unique this field names equals oid get field names todo key length cannot be compared because metadata does not provide a key length to compare against this key length oid key length
compares this index descriptor to another
public void release thread owner thread synchronized monitor if this owner null already released right return if owner thread this owner throw new illegal state exception connection released on behalf of owner thread expecting this owner if logger is loggable level info logger info release releasing thread pool connection outside expected thread owner thread this owner null available connections add this
releases connection wrapper on behalf of another thread
public field descriptor string name int sql type boolean nullable string renamed from boolean primary key boolean global reference string suggested sql type name this name name this sql type sql type this nullable nullable this renamed from renamed from this primary key primary key this global reference global reference this suggested sql type name suggested sql type name
constructs a field descriptor
public void init data source data source throws sqlexception this pool new connection pool data source 99 59 60 1000 this init database info
override this method to obtain metadata information such
public int get max table name length throws sqlexception return this max table name length
gets the maximum length of a table name
public index string property names this false property names 0
construcst an instance of index
public index boolean unique string property name this unique new string property name 0
construcst an instance of index
public index boolean unique string property names int key length this unique unique this key length key length for int i 0 i property names length i this property names add property names i
construcst an instance of index
public boolean equals object other if other instanceof index return false index oid index other return this unique oid is unique this property names equals oid get property names
compares this index with another
public store data source data source database factory dbf class loader default class loader throws store exception try this database factory dbf this database dbf get database data source this max table name length this database get max table name length this max column name length this database get max column name length this default class loader default class loader catch sqlexception se throw new store exception se
constructs a store instance
public void add property name string name this property names add name
adds a property name to the index
public void invalidate this cached store null
clears cached store
public persistent id get owner id return this owner id
note that we could define a property of type
protected string get type declaration field descriptor field descriptor throws sqlexception string sst field descriptor get suggested sql type name if sst null sst length 0 return sst int data type field descriptor get sql type type info ti type info this types by type id get new integer data type if ti null throw new sqlexception database is not aware of java java sql types constant data type return ti get declaration
gets the type declaration for a type constant as
public iterator fetch accounts store store throws exception return store select parts store get persistent id this account class owner id
this is a good way to get a collection of accounts
public void add account account account store store throws exception account set owner id store get persistent id this store save account
to add an account to this user we simply set
public store data source data source throws store exception this data source new default database factory null null
constructs a store instance
public void ensure table exists string table name field descriptor mandatory field collection field descriptors collection index descriptors throws sqlexception this ensure table exists table name mandatory field field descriptors index descriptors false false false null null
makes sure that a table exists
public string get automatic primary key index name return null
gets the name of an implicit index created when theres
public store data source data source int max connections int connection timeout throws store exception this data source new default database factory null null default database factory ddb default database factory this database factory ddb set max connections max connections ddb set connection timeout connection timeout
constructs a store instance
public void assign password string password set password hash create password hash password
password is only persisted as a hash
public iterator fetch accounts store store throws exception return store select parts store get persistent id this account1 class owner id
this is a good way to get a collection of accounts
public void add account account1 account store store throws exception account set owner id store get persistent id this
to add an account to this user we simply set
public string normalize name string s return s
takes a field name or table name as it would be requested
public void set modify object on query boolean modify object on query this modify object on query modify object on query
indicates whether objects that already exist in memory should
protected boolean can set nullable on table alter return true
determines if the database is able to alter