input
stringlengths
10
828
output
stringlengths
5
107
public r case short field model short field model field return case atomic field model field
this implementation delegates to
public r case integer field model integer field model field return case atomic field model field
this implementation delegates to
public r case float field model float field model field return case atomic field model field
this implementation delegates to
public r case double field model double field model field return case atomic field model field
this implementation delegates to
public r case long field model long field model field return case atomic field model field
this implementation delegates to
protected r case atomic field model atomic field model field return case simple field model field
internal roll up method
protected r case simple field model simple field model field return case default field
internal roll up method
public void validate schema model schema sidekar check valid field name get name
validate this field
protected r case collection field model collection field model field return case complex field model field
internal roll up method
public void check same field field model that if that type name equals this type name throw new schema mismatch exception field type mismatch this get type description vs that get type description
determine if the given field has the same in database structure
protected r case complex field model complex field model field return case default field
internal roll up method
protected r case default field model field return null
internal roll up method
public schema model read database schema return get entity schema model class get singleton
read in the schema thats stored in this instance i
public t get item item return get item null
extract the value of this field from the given item
public t cast object obj return this get type cast obj
cast the object to this fields java type
public void set item item t value item get sidekar entity write field item this value
set the value of this field in the given item
public string get sidekar environment bean name return this sidekar environment bean name
get the name of the
public void set sidekar environment bean name string sidekar environment bean name this sidekar environment bean name sidekar environment bean name
set the name of the
public string get transaction isolation return this transaction isolation
get the transaction isolation level to use if any
public void set transaction isolation string transaction isolation this transaction isolation transaction isolation
set the transaction isolation level to use if any
public string get transaction durability return this transaction durability
get the transaction durability to use if using transactions
public void set transaction durability string transaction durability this transaction durability transaction durability
set the transaction durability to use if using transactions
protected sidekar environment lookup sidekar environment web application context wac web application context utils get required web application context get servlet context return wac get bean get sidekar environment bean name sidekar environment class
look up the
private void verify schema final schema database schema db final boolean initialize this env perform action new void database action public void execute void if initialize initialize database schema db sidekar database this sidekar schema open true else update database schema db sidekar database this sidekar schema open false
create or initialize the schema database associated with this database
public transaction config get transaction config return this transaction config
get the configured
public boolean is transactional return this transactional
determine whether this instance is configured to operate transactionally
public void set base package names list string base package names this base package names base package names
configure the list of java package names to search under
public void case attached field attached field field case implicit field field
the implementation in
public void case entity field entity field field case implicit field field
the implementation in
public void case id field id field field case implicit field field
the implementation in
public void case string field string field field case atomic field field
the implementation in
public void case boolean field boolean field field case atomic field field
the implementation in
public void case byte field byte field field case atomic field field
the implementation in
public void case character field character field field case atomic field field
the implementation in
public void case short field short field field case atomic field field
the implementation in
public database entry get stop key boolean exact byte prefix if exact prefix this data clone else prefix new byte this data length 1 system arraycopy this data 0 prefix 0 prefix length database entry stop key jeutil get key after prefix new database entry prefix assert stop key null return stop key
get the stop key associated with this discriminator prefix
public void case integer field integer field field case atomic field field
the implementation in
public void case float field float field field case atomic field field
the implementation in
public void case double field double field field case atomic field field
the implementation in
public void case long field long field field case atomic field field
the implementation in
public long gc final set entity candidates return perform transaction get gctransaction config new database action long public long execute return new garbage collector sidekar database this collect candidates
detach unreferenced and unwanted items from this database using mark sweep garbage collection
public void case date field date field field case atomic field field
the implementation in
public void case big integer field big integer field field case atomic field field
the implementation in
public long gc final set entity candidates final set entity root entities return perform transaction get gctransaction config new database action long public long execute return new garbage collector sidekar database this collect candidates root entities
detach unreferenced and unwanted items from this database using mark sweep garbage collection
public sequence open idsequence string name return this id sequence db open sequence null get sequence key name get sequence config
open the id sequence for the given entity
public void add entity string name
adjust meta data state when a new entity is added
public void remove entity string name remove id sequence operation status status this id sequence db delete get current transaction get sequence key name if status operation status success throw new sidekar exception operation failed status remove discriminator this discrim map remove name write discriminator map
adjust meta data state when an entity is removed
public void record database update string update name tuple output timestamp new tuple output new byte 8 write long new date get time operation status status this meta data db put this db get current transaction jeutil string to entry database update prefix update name jeutil to database entry timestamp if status operation status success throw new sidekar exception operation failed status
record a newly applied database update
public long gc final set entity candidates final iterator roots return perform transaction get gctransaction config new database action long public long execute return new garbage collector sidekar database this collect candidates roots
detach unreferenced and unwanted items from this database using mark sweep garbage collection
private cursor state get cursor for prefix database db string prefix database entry start key jeutil string to entry prefix start key set size start key get size 1 database entry stop key jeutil get key after prefix start key return new cursor state db open cursor get current transaction null start key stop key
get a cursor that will scan all entries with the given prefix
private database entry get sequence key string name return jeutil string to entry id sequence key prefix name
get the database key for the id sequence associated with the given entity
public boolean can reference candidates entity entity return this edges key set contains entity
determine if instances of the given entity can possibly reference any potential garbage
public boolean is candidate entity entity return this candidates contains entity
determine if the given entity is candidate garbage
public void mark iterator roots while roots has next this stack push item roots next process stack
mark reachable objects
public long sweep long count 0 for entity entity0 this candidates final entity entity entity0 if entity is abstract continue count this db perform action new database action long public long execute long entity count 0 for closeable iterator i entity get entity iterator true i has next item item item i next if garbage collection this marker is marked item continue i remove entity count return entity count return count
remove unreachable objects
public long collect set entity candidates final iterator roots return collect candidates new root set builder public closeable iterator build root set garbage collection gc return new multi iterator object collections singleton roots
perform garbage collection given an explicit iterator for the root set
protected void record model annotation a method method string name field model field model validate name if name equals throw new invalid annotation exception a method invalid empty field name name check for duplicate field if this field map contains key name throw new invalid annotation exception a method duplicate field name configure field name field model set name name update maps this field map put name field model if this method map put method field model null throw new invalid annotation exception a method method has more than one schema annotation
record a new
protected bean property record getter model annotation a method method string name field model field model check parameter count check parameter count a method 0 get property info bean property prop try prop new bean property method this all methods catch illegal argument exception e throw new invalid annotation exception a method method is not a getter method e get message default name if necessary if name length 0 name prop get name create model record model a method name field model done return prop
record a new
protected void check return type annotation a method method class type boolean exact if exact method get return type equals type throw new invalid annotation exception a method method does not return type get name if get raw type a method method get generic return type is assignable from type throw new invalid annotation exception a method method does not return type
check return type
protected void check parameter count annotation a method method int num type ptypes method get generic parameter types if ptypes length num throw new invalid annotation exception a method method does not take exactly num parameter s
check parameter count
public schema model get schema model return this schema model
get the current
protected void check duplicate method annotation a method method method other method if other method null throw new invalid annotation exception a method duplicate annotation also exists on method other method
check duplicate method
protected entity model find entity model by type annotation a method method type type return find entity model by type a method get raw type a method type
find entity type corresponding to the given type
public annotation get annotation return this a
get the annotation that was deemed invalid
public method get annotated method return this annotated method
get the method to which the annotation was attached if any
protected entity model find entity model by type annotation a method method class cl for class sc cl sc null sc sc get superclass entity model entity model this schema model get class map get sc if entity model null return entity model throw new invalid annotation exception a method cl does not correspond to any known entity type
find entity type corresponding to the given class
private void initialize database schema database schema db if no schema was provided use an empty one if this schema model null this schema model new schema model create schema structure from schema model this sidekar schema new sidekar schema this this schema model initialize associated schema db if schema db null new sidekar lifter schema db lift this schema model update meta data to record all new updates that don t need to be applied if this database updates null for database update update this database updates this meta data record database update update get name
create and save a newly created databases schema
public void rename entity string old name string new name perform checks check not open entity entity check entity exists old name check valid entity name new name check entity not exists new name change name this name map remove entity get name entity change name new name this name map put entity get name entity regen recompute derived info
schema modification rename an entity
public boolean change entity abstractness string name boolean is abstract perform checks check not open entity entity check entity exists name trivial case if is abstract entity is abstract return false verify no instances exist if changing to abstract if is abstract check entity has no exact instances entity update abstractness entity set abstract is abstract regen recompute derived info return true
schema modification change an entitys abstractness if necessary
public void remove index string entity name final string index name perform checks final entity entity check entity exists entity name if entity get index map contains key index name throw new schema modification exception no index named index name exists on entity remove index entity remove index index name
schema modification remove an index from an entity
private void do while open void database action action sanity check check not open open databases open false perform action then close databases try this db get sidekar environment perform action action finally close
perform operation within a transaction
private void check entity has no exact instances entity entity entity get top parent open databases true false entity entity iterator i entity get entity iterator true boolean found try found i has next finally i close entity get top parent close databases true if found throw new schema modification exception one or more instances of entity exist
verify no exact instances of the given entity exist
private void recompute derived info initialize entities for entity entity get sorted entities entity initialize regenerate class map this class map clear for entity entity this name map values class user class entity get user class if user class item class this class map put user class entity
recompute all entity derived information
private object open databases boolean create open all databases open databases true create boolean success false try open databases false create success true finally if success close databases true set open token object token new object for entity entity get sorted entities entity set open token token return token
open bdb databases un doing on failure
private void open databases boolean primary boolean create stack entity partial new stack entity boolean success false try for entity entity get sorted entities entity open databases primary create partial push entity success true finally if success while partial empty partial pop close databases primary
open bdb databases un doing on failure
protected void put hook k key v value
hook invoked when a new key value pair is put into the map
protected entry set create entry set return new entry set
create an entry set
protected key set create key set return new key set
create a key set
private void close databases boolean primary for entity entity get sorted entities entity close databases primary
close bdb databases
protected values create values return new values
create a values collection
protected entry create entry k key v value return new entry key value
create one map entry
public string get original input return this input
get the original input string as passed to the constructor
public string get input return this input substring this index
get the current input
public void reset set index 0
reset this instance
public matcher match prefix string regex string s get input matcher matcher pattern compile regex matcher s if matcher looking at throw build exception expected input matching pattern regex this index matcher end return matcher
match the current input against the given regular expression and advance past it
public boolean try literal string prefix boolean match this input starts with prefix this index if match this index prefix length return match
determine if the current input starts with the given literal prefix
public boolean is eof return this index this input length
determine if we are at the end of the input
public char read char ch peek this index return ch
read and advance past the next character
public char peek try return this input char at this index catch string index out of bounds exception e throw build exception truncated input
read but do not advance past the next character
public void unread if this index 0 throw new illegal state exception this index
push back the previously read character returning this instance to the
public void expect char ch if read ch unread throw build exception expected ch
read and advance past the next character which must match
public void skip whitespace while this index this input length character is whitespace this input char at this index this index
skip leading whitespace if any
public parse context clone try return parse context super clone catch clone not supported exception e throw new runtime exception e
clone this instance
public illegal argument exception build exception return build exception null
create a generic exception for rejecting the current input
public illegal argument exception build exception string message string text parse error string bogus get input if bogus length 0 text at end of input else if bogus length max reject quote bogus bogus substring 0 max reject quote 3 text staring with bogus if message null text message return new illegal argument exception text
create an exception for rejecting the current input
public e first initialize if necessary if this initialized initialize true throw new no such element exception jump to the beginning if this cursor state first throw new no such element exception update state this position position after this have current element true return first element return get current
jump to the first element in the list making it the current element
public e last initialize if necessary if this initialized initialize true throw new no such element exception jump to the end if this cursor state last throw new no such element exception update state this position position after this have current element true return last element return get current
jump to the last element in the list making it the current element
protected operation status put transaction tx e elem database entry key database entry value return this db handle put no overwrite tx key value
add a key value pair
protected void add hook e elem
hook invoked just after an element is added to the set
protected void remove hook e elem
hook invoked just afer an element is removed from the set