idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
10,200
public void setAmbientLight ( int i , Color color , boolean enableColor ) { float ambient [ ] = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; gl . glEnable ( GL2 . GL_LIGHTING ) ; gl . glEnable ( GL2 . GL_LIGHT0 + i ) ; if ( enableCo...
Sets the color value of the No . i ambientLight
135
12
10,201
public void setAmbientLight ( int i , Color color , boolean enableColor , Vector3D v ) { float ambient [ ] = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; float position [ ] = { ( float ) v . getX ( ) , ( float ) v . getY ( ) , ( flo...
Sets the color value and the position of the No . i ambientLight
213
15
10,202
public void setSpotLight ( int i , Color color , boolean enableColor , Vector3D v , float nx , float ny , float nz , float angle ) { float spotColor [ ] = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; float pos [ ] = { ( float ) v . ...
Sets the color value position direction and the angle of the spotlight cone of the No . i spotLight
324
21
10,203
public void setLightAttenuation ( int i , float constant , float liner , float quadratic ) { float c [ ] = { constant } ; float l [ ] = { liner } ; float q [ ] = { quadratic } ; gl . glEnable ( GL2 . GL_LIGHTING ) ; gl . glEnable ( GL2 . GL_LIGHT0 + i ) ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_CONSTANT_ATTENUA...
Set attenuation rates for point lights spot lights and ambient lights .
197
13
10,204
public void setLightSpecular ( int i , Color color ) { float [ ] tmpColor = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_SPECULAR , tmpColor , 0 ) ; }
Sets the specular color for No . i light .
95
12
10,205
public void setLightDiffuse ( int i , Color color ) { float [ ] tmpColor = { ( float ) color . getRed ( ) , ( float ) color . getGreen ( ) , ( float ) color . getBlue ( ) , ( float ) color . getAlpha ( ) } ; gl . glLightfv ( GL2 . GL_LIGHT0 + i , GL2 . GL_DIFFUSE , tmpColor , 0 ) ; }
Sets the diffuse color for No . i light .
96
11
10,206
private static float [ ] normalize ( float [ ] in ) { float [ ] out = new float [ in . length ] ; for ( int i = 0 ; i < in . length ; i ++ ) { out [ i ] = ( in [ i ] / 255.0f ) ; } return out ; }
Returns the array normalized from 0 - 255 to 0 - 1 . 0 .
66
15
10,207
public void setPerspective ( double fov , double aspect , double zNear , double zFar ) { matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; glu . gluPerspective ( fov , aspect , zNear , zFar ) ; matrixMode ( MatrixMode . MODELVIEW ) ; resetMatrix ( ) ; }
Sets a perspective projection applying foreshortening making distant objects appear smaller than closer ones . The parameters define a viewing volume with the shape of truncated pyramid . Objects near to the front of the volume appear their actual size while farther objects appear smaller . This projection simulates th...
77
66
10,208
public void setPerspective ( ) { double cameraZ = ( ( height / 2.0 ) / Math . tan ( Math . PI * 60.0 / 360.0 ) ) ; matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; glu . gluPerspective ( Math . PI / 3.0 , this . width / this . height , cameraZ / 10.0 , cameraZ * 10.0 ) ; matrixMode ( MatrixMode . MODELVIEW ) ...
Sets a default perspective .
113
6
10,209
public void setOrtho ( double left , double right , double bottom , double top , double near , double far ) { matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; gl . glOrtho ( left , right , bottom , top , near , far ) ; matrixMode ( MatrixMode . MODELVIEW ) ; resetMatrix ( ) ; }
Sets an orthographic projection and defines a parallel clipping volume . All objects with the same dimension appear the same size regardless of whether they are near or far from the camera . The parameters to this function specify the clipping volume where left and right are the minimum and maximum x values top and bot...
79
77
10,210
public void setOrtho ( ) { matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; gl . glOrtho ( 0 , this . width , 0 , this . height , - 1.0e10 , 1.0e10 ) ; matrixMode ( MatrixMode . MODELVIEW ) ; resetMatrix ( ) ; }
Sets the default orthographic projection .
75
8
10,211
public void setFrustum ( double left , double right , double bottom , double top , double near , double far ) { matrixMode ( MatrixMode . PROJECTION ) ; resetMatrix ( ) ; gl . glFrustum ( left , right , bottom , top , near , far ) ; matrixMode ( MatrixMode . MODELVIEW ) ; resetMatrix ( ) ; }
Sets a perspective matrix defined through the parameters . Works like glFrustum except it wipes out the current perspective matrix rather than multiplying itself with it .
79
31
10,212
public void setCamera ( ) { glu . gluLookAt ( width / 2.0 , height / 2.0 , ( height / 2.0 ) / Math . tan ( Math . PI * 60.0 / 360.0 ) , width / 2.0 , height / 2.0 , 0 , 0 , 1 , 0 ) ; }
Sets the default camera position .
74
7
10,213
public Key getKey ( ) { final Key ret = new Key ( ) . setPersonId ( getPersonId ( ) ) . setCompanyId ( getCompanyId ( ) ) . setTypeId ( getTypeId ( ) ) ; return ret ; }
Gets the key .
53
5
10,214
@ Override public String getTag ( ) throws IOException { URLConnection urlConnection = url . openConnection ( ) ; String tag = urlConnection . getHeaderField ( ETAG ) ; if ( tag == null ) { String key = url . toString ( ) + "@" + urlConnection . getLastModified ( ) ; tag = md5Cache . getIfPresent ( key ) ; if ( tag == ...
Gets the tag using either the ETAG header of the URL connection or calculates it and caches it based on the URL & last modified date
168
28
10,215
private List < Pair < Id , GuiceSupplier > > getSuppliers ( ) { ImmutableList . Builder < Pair < Id , GuiceSupplier > > suppliersBuilder = ImmutableList . builder ( ) ; for ( Binding < GuiceRegistration > registrationBinding : injector . findBindingsByType ( TypeLiteral . get ( GuiceRegistration . class ) ) ) { Key < ?...
enforce load all providers before register them
130
8
10,216
public SQLSelect column ( final String _name ) { columns . add ( new Column ( tablePrefix , null , _name ) ) ; return this ; }
Appends a selected column .
33
6
10,217
public int columnIndex ( final int _tableIndex , final String _columnName ) { final Optional < Column > colOpt = getColumns ( ) . stream ( ) . filter ( column -> column . tableIndex == _tableIndex && column . columnName . equals ( _columnName ) ) . findFirst ( ) ; final int ret ; if ( colOpt . isPresent ( ) ) { ret = g...
Column index .
139
3
10,218
public String getSQL ( ) { final StringBuilder cmd = new StringBuilder ( ) . append ( " " ) . append ( Context . getDbType ( ) . getSQLPart ( SQLPart . SELECT ) ) . append ( " " ) ; if ( distinct ) { cmd . append ( Context . getDbType ( ) . getSQLPart ( SQLPart . DISTINCT ) ) . append ( " " ) ; } boolean first = true ;...
Returns the depending SQL statement .
347
6
10,219
public SQLSelect addColumnPart ( final Integer _tableIndex , final String _columnName ) { parts . add ( new Column ( tablePrefix , _tableIndex , _columnName ) ) ; return this ; }
Add a column as part .
45
6
10,220
public SQLSelect addTablePart ( final String _tableName , final Integer _tableIndex ) { parts . add ( new FromTable ( tablePrefix , _tableName , _tableIndex ) ) ; return this ; }
Add a table as part .
46
6
10,221
public SQLSelect addTimestampValue ( final String _isoDateTime ) { parts . add ( new Value ( Context . getDbType ( ) . getTimestampValue ( _isoDateTime ) ) ) ; return this ; }
Add a timestamp value to the select .
48
8
10,222
public static CachedPrintQuery get4Request ( final Instance _instance ) throws EFapsException { return new CachedPrintQuery ( _instance , Context . getThreadContext ( ) . getRequestId ( ) ) . setLifespan ( 5 ) . setLifespanUnit ( TimeUnit . MINUTES ) ; }
Get a CachedPrintQuery that will only cache during a request .
71
14
10,223
@ Override protected void prepare ( final AbstractSQLInsertUpdate < ? > _insertUpdate , final Attribute _attribute , final Object ... _values ) throws SQLException { checkSQLColumnSize ( _attribute , 1 ) ; try { _insertUpdate . column ( _attribute . getSqlColNames ( ) . get ( 0 ) , Context . getThreadContext ( ) . getP...
The instance method sets the value in the insert statement to the id of the current context user .
123
19
10,224
protected void addMapping ( final ColumnType _columnType , final String _writeTypeName , final String _nullValueSelect , final String ... _readTypeNames ) { this . writeColTypeMap . put ( _columnType , _writeTypeName ) ; this . nullValueColTypeMap . put ( _columnType , _nullValueSelect ) ; for ( final String readTypeNa...
Adds a new mapping for given eFaps column type used for mapping from and to the SQL database .
163
21
10,225
public boolean existsView ( final Connection _con , final String _viewName ) throws SQLException { boolean ret = false ; final DatabaseMetaData metaData = _con . getMetaData ( ) ; // first test with lower case final ResultSet rs = metaData . getTables ( null , null , _viewName . toLowerCase ( ) , new String [ ] { "VIEW...
The method tests if a view with given name exists .
184
11
10,226
public T updateColumn ( final Connection _con , final String _tableName , final String _columnName , final ColumnType _columnType , final int _length , final int _scale ) throws SQLException { final StringBuilder cmd = new StringBuilder ( ) ; cmd . append ( "alter table " ) . append ( getTableQuote ( ) ) . append ( _ta...
Adds a column to a SQL table .
247
8
10,227
public T addUniqueKey ( final Connection _con , final String _tableName , final String _uniqueKeyName , final String _columns ) throws SQLException { final StringBuilder cmd = new StringBuilder ( ) ; cmd . append ( "alter table " ) . append ( _tableName ) . append ( " " ) . append ( "add constraint " ) . append ( _uniq...
Adds a new unique key to given table name .
197
10
10,228
public T addForeignKey ( final Connection _con , final String _tableName , final String _foreignKeyName , final String _key , final String _reference , final boolean _cascade ) throws InstallationException { final StringBuilder cmd = new StringBuilder ( ) . append ( "alter table " ) . append ( _tableName ) . append ( "...
Adds a foreign key to given SQL table .
281
9
10,229
public void addCheckKey ( final Connection _con , final String _tableName , final String _checkKeyName , final String _condition ) throws SQLException { final StringBuilder cmd = new StringBuilder ( ) . append ( "alter table " ) . append ( _tableName ) . append ( " " ) . append ( "add constraint " ) . append ( _checkKe...
Adds a new check key to given SQL table .
174
10
10,230
public static AbstractDatabase < ? > findByClassName ( final String _dbClassName ) throws ClassNotFoundException , InstantiationException , IllegalAccessException { return ( AbstractDatabase < ? > ) Class . forName ( _dbClassName ) . newInstance ( ) ; }
Instantiate the given DB class name and returns them .
58
11
10,231
private Collection < Observable < Attachment > > upload ( RxComapiClient client , List < Attachment > data ) { Collection < Observable < Attachment >> obsList = new ArrayList <> ( ) ; for ( Attachment a : data ) { obsList . add ( upload ( client , a ) ) ; } return obsList ; }
Create list of upload attachment observables .
73
8
10,232
private Observable < Attachment > upload ( RxComapiClient client , Attachment a ) { return client . service ( ) . messaging ( ) . uploadContent ( a . getFolder ( ) , a . getData ( ) ) . map ( response -> a . updateWithUploadDetails ( response . getResult ( ) ) ) . doOnError ( t -> log . e ( "Error uploading attachment....
Upload single attachment and update the details in it from the response .
108
13
10,233
public void set ( double left , double right , double bottom , double top , double near , double far ) { this . left = left ; this . right = right ; this . bottom = bottom ; this . top = top ; this . near = near ; this . far = far ; }
Sets the clipping plane .
60
6
10,234
public static AbstractStmt getStatement ( final CharSequence _stmt ) { AbstractStmt ret = null ; final IStatement < ? > stmt = parse ( _stmt ) ; if ( stmt instanceof IPrintStatement ) { ret = PrintStmt . get ( ( IPrintStatement < ? > ) stmt ) ; } else if ( stmt instanceof IDeleteStatement ) { ret = DeleteStmt . get ( (...
Parses the stmt .
174
7
10,235
public static List < Instance > getInstances ( final AbstractQueryPart _queryPart ) throws EFapsException { return getQueryBldr ( _queryPart ) . getQuery ( ) . execute ( ) ; }
Gets the instances .
46
5
10,236
public static BigDecimal parseLocalized ( final String _value ) throws EFapsException { final DecimalFormat format = ( DecimalFormat ) NumberFormat . getInstance ( Context . getThreadContext ( ) . getLocale ( ) ) ; format . setParseBigDecimal ( true ) ; try { return ( BigDecimal ) format . parse ( _value ) ; } catch ( ...
Method to parse a localized String to an BigDecimal .
112
12
10,237
public void update ( String cacheName , Cache cache ) { cacheManager . enableManagement ( cacheName , cache . isManagementEnabled ( ) ) ; updateStatistics ( cacheName , cache ) ; }
Update mutable information of cache configuration such as management and statistics support
40
13
10,238
public void setStatistics ( boolean enabled ) { all ( ) . forEach ( cache -> updateStatistics ( cache . getName ( ) , new Cache ( false , enabled ) ) ) ; }
Enable or disable statistics for all caches
39
7
10,239
public Optional < CacheStatistics > getStatistics ( String cacheName ) { javax . cache . Cache cache = cacheManager . getCache ( cacheName ) ; if ( cache == null ) { return Optional . empty ( ) ; } if ( ( ( CompleteConfiguration ) cache . getConfiguration ( CompleteConfiguration . class ) ) . isStatisticsEnabled ( ) &&...
Get a cache statistic information if available
235
7
10,240
private void setAttrValue ( final AttrName _attrName , final String _value ) { synchronized ( this . attrValues ) { this . attrValues . put ( _attrName , _value ) ; } }
The method sets the attribute values in the cache for given attribute name to given new attribute value .
48
19
10,241
public Locale getLocale ( ) { final Locale ret ; if ( this . attrValues . get ( Person . AttrName . LOCALE ) != null ) { final String localeStr = this . attrValues . get ( Person . AttrName . LOCALE ) ; final String [ ] countries = localeStr . split ( "_" ) ; if ( countries . length == 2 ) { ret = new Locale ( countrie...
Method to get the Locale of this Person . Default is the English Locale .
165
17
10,242
public String getLanguage ( ) { return this . attrValues . get ( Person . AttrName . LANGUAGE ) != null ? this . attrValues . get ( Person . AttrName . LANGUAGE ) : Locale . ENGLISH . getISO3Language ( ) ; }
Method to get the Language of the UserInterface for this Person . Default is english .
65
17
10,243
public DateTimeZone getTimeZone ( ) { return this . attrValues . get ( Person . AttrName . TIMZONE ) != null ? DateTimeZone . forID ( this . attrValues . get ( Person . AttrName . TIMZONE ) ) : DateTimeZone . UTC ; }
Method to get the Timezone of this Person . Default is the UTC Timezone .
66
17
10,244
public ChronologyType getChronologyType ( ) { final String chronoKey = this . attrValues . get ( Person . AttrName . CHRONOLOGY ) ; final ChronologyType chronoType ; if ( chronoKey != null ) { chronoType = ChronologyType . getByKey ( chronoKey ) ; } else { chronoType = ChronologyType . ISO8601 ; } return chronoType ; }
Method to get the ChronologyType of this Person . Default is the ISO8601 ChronologyType .
93
21
10,245
public boolean checkPassword ( final String _passwd ) throws EFapsException { boolean ret = false ; final PrintQuery query = new PrintQuery ( CIAdminUser . Person . getType ( ) , getId ( ) ) ; query . addAttribute ( CIAdminUser . Person . Password , CIAdminUser . Person . LastLogin , CIAdminUser . Person . LoginTry , C...
The instance method checks if the given password is the same password as the password in the database .
220
19
10,246
private void setFalseLogin ( final DateTime _logintry , final int _count ) throws EFapsException { if ( _count > 0 ) { final DateTime now = new DateTime ( DateTimeUtil . getCurrentTimeFromDB ( ) . getTime ( ) ) ; final SystemConfiguration kernelConfig = EFapsSystemConfiguration . get ( ) ; final int minutes = kernelCon...
Method that sets the time and the number of failed logins .
223
13
10,247
private void updateFalseLoginDB ( final int _tries ) throws EFapsException { Connection con = null ; try { con = Context . getConnection ( ) ; Statement stmt = null ; final StringBuilder cmd = new StringBuilder ( ) ; try { cmd . append ( "update T_USERPERSON " ) . append ( "set LOGINTRY=" ) . append ( Context . getDbTy...
Method to set the number of false Login tries in the eFaps - DataBase .
443
18
10,248
public Status setPassword ( final String _newPasswd ) throws EFapsException { final Type type = CIAdminUser . Person . getType ( ) ; if ( _newPasswd . length ( ) == 0 ) { throw new EFapsException ( getClass ( ) , "PassWordLength" , 1 , _newPasswd . length ( ) ) ; } final Update update = new Update ( type , "" + getId (...
The instance method sets the new password for the current context user . Before the new password is set some checks are made .
194
24
10,249
protected void readFromDB ( ) throws EFapsException { readFromDBAttributes ( ) ; this . roles . clear ( ) ; for ( final Role role : getRolesFromDB ( ) ) { add ( role ) ; } this . groups . clear ( ) ; for ( final Group group : getGroupsFromDB ( null ) ) { add ( group ) ; } this . companies . clear ( ) ; for ( final Comp...
The instance method reads all information from the database .
141
10
10,250
private void readFromDBAttributes ( ) throws EFapsException { Connection con = null ; try { con = Context . getConnection ( ) ; Statement stmt = null ; try { stmt = con . createStatement ( ) ; final StringBuilder cmd = new StringBuilder ( "select " ) ; for ( final AttrName attrName : Person . AttrName . values ( ) ) { ...
All attributes from this person are read from the database .
446
11
10,251
public void setGroups ( final JAASSystem _jaasSystem , final Set < Group > _groups ) throws EFapsException { if ( _jaasSystem == null ) { throw new EFapsException ( getClass ( ) , "setGroups.nojaasSystem" , getName ( ) ) ; } if ( _groups == null ) { throw new EFapsException ( getClass ( ) , "setGroups.noGroups" , getNa...
The depending groups for the user are set for the given JAAS system . All groups are added to the loaded groups in the cache of this person .
250
30
10,252
public void assignGroupInDb ( final JAASSystem _jaasSystem , final Group _group ) throws EFapsException { assignToUserObjectInDb ( CIAdminUser . Person2Group . getType ( ) , _jaasSystem , _group ) ; }
For this person a group is assigned for the given JAAS system .
56
14
10,253
public void unassignGroupInDb ( final JAASSystem _jaasSystem , final Group _group ) throws EFapsException { unassignFromUserObjectInDb ( CIAdminUser . Person2Group . getType ( ) , _jaasSystem , _group ) ; }
The given group is unassigned for the given JAAS system from this person .
60
17
10,254
public static void reset ( final String _key ) throws EFapsException { final Person person ; if ( UUIDUtil . isUUID ( _key ) ) { person = Person . get ( UUID . fromString ( _key ) ) ; } else { person = Person . get ( _key ) ; } if ( person != null ) { InfinispanCache . get ( ) . < Long , Person > getCache ( Person . ID...
Reset a person . Meaning ti will be removed from all Caches .
198
15
10,255
public void preparePostUpload ( final List < Attachment > attachments ) { tempParts . clear ( ) ; if ( ! attachments . isEmpty ( ) ) { for ( Attachment a : attachments ) { if ( a . getError ( ) != null ) { errorParts . add ( createErrorPart ( a ) ) ; } else { publicParts . add ( createPart ( a ) ) ; } } } }
Replace temporary attachment parts with final parts with upload details or error message .
86
15
10,256
private Part createErrorPart ( Attachment a ) { return Part . builder ( ) . setName ( String . valueOf ( a . hashCode ( ) ) ) . setSize ( 0 ) . setType ( Attachment . LOCAL_PART_TYPE_ERROR ) . setUrl ( null ) . setData ( a . getError ( ) . getLocalizedMessage ( ) ) . build ( ) ; }
Create message part based on attachment upload error details .
86
10
10,257
private Part createTempPart ( Attachment a ) { return Part . builder ( ) . setName ( String . valueOf ( a . hashCode ( ) ) ) . setSize ( 0 ) . setType ( Attachment . LOCAL_PART_TYPE_UPLOADING ) . setUrl ( null ) . setData ( null ) . build ( ) ; }
Create message part based on attachment upload . This is a temporary message to indicate that one of the attachments for this message is being uploaded .
77
27
10,258
private Part createPart ( Attachment a ) { return Part . builder ( ) . setName ( a . getName ( ) != null ? a . getName ( ) : a . getId ( ) ) . setSize ( a . getSize ( ) ) . setType ( a . getType ( ) ) . setUrl ( a . getUrl ( ) ) . build ( ) ; }
Create message part based on attachment details .
82
8
10,259
public MessageToSend prepareMessageToSend ( ) { originalMessage . getParts ( ) . clear ( ) ; originalMessage . getParts ( ) . addAll ( publicParts ) ; return originalMessage ; }
Prepare message to be sent through messaging service .
43
10
10,260
public ChatMessage createFinalMessage ( MessageSentResponse response ) { return ChatMessage . builder ( ) . setMessageId ( response . getId ( ) ) . setSentEventId ( response . getEventId ( ) ) . setConversationId ( conversationId ) . setSentBy ( sender ) . setFromWhom ( new Sender ( sender , sender ) ) . setSentOn ( Sy...
Create a final message for a conversation . At this point we know message id and sent event id .
122
20
10,261
private void addTables ( ) { for ( final SQLTable table : getType ( ) . getTables ( ) ) { if ( ! getTable2values ( ) . containsKey ( table ) ) { getTable2values ( ) . put ( table , new ArrayList < Value > ( ) ) ; } } }
Add all tables of the type to the expressions because for the type an insert must be made for all tables!!!
68
22
10,262
private void addCreateUpdateAttributes ( ) throws EFapsException { final Iterator < ? > iter = getType ( ) . getAttributes ( ) . entrySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { final Map . Entry < ? , ? > entry = ( Map . Entry < ? , ? > ) iter . next ( ) ; final Attribute attr = ( Attribute ) entry . getVa...
Add all attributes of the type which must be always updated and the default values .
174
16
10,263
public Insert setExchangeIds ( final Long _exchangeSystemId , final Long _exchangeId ) { this . exchangeSystemId = _exchangeSystemId ; this . exchangeId = _exchangeId ; return this ; }
Set the exchangeids for the new object .
50
9
10,264
@ Override public void executeWithoutTrigger ( ) throws EFapsException { final Context context = Context . getThreadContext ( ) ; ConnectionResource con = null ; try { con = context . getConnectionResource ( ) ; final SQLTable mainTable = getType ( ) . getMainTable ( ) ; final long id = executeOneStatement ( con , main...
The insert is done without calling triggers and check of access rights .
258
13
10,265
public static final Vector3D randVertex2d ( ) { float theta = random ( ( float ) ( Math . PI * 2.0 ) ) ; return new Vector3D ( Math . cos ( theta ) , Math . sin ( theta ) ) ; }
returns a random Vertex that represents a point on the unit circle
58
14
10,266
@ SuppressLint ( "UseSparseArrays" ) public void addStatusUpdate ( ChatMessageStatus status ) { int unique = ( status . getMessageId ( ) + status . getProfileId ( ) + status . getMessageStatus ( ) . name ( ) ) . hashCode ( ) ; if ( statusUpdates == null ) { statusUpdates = new HashMap <> ( ) ; } statusUpdates . put ( u...
Update status list with a new status .
98
8
10,267
public static void put ( Map < String , Object > structure , String name , Object object ) { if ( name != null && object != null ) { structure . put ( name , object ) ; } }
Puts an object into a map
42
7
10,268
protected long createTaskInternal ( final String name , final String channel , final String data , final String key1 , final String key2 , final Long batchId , int postponeSec , TedStatus status ) { final String sqlLogId = "create_task" ; if ( status == null ) status = TedStatus . NEW ; String nextts = ( status == TedS...
taskid is autonumber in MySql
559
10
10,269
public static String escape ( String literal ) { StringBuilder sb = new StringBuilder ( ) ; for ( int ii = 0 ; ii < literal . length ( ) ; ii ++ ) { char cc = literal . charAt ( ii ) ; switch ( cc ) { case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : case ' ' ...
Escapes all regex control characters returning expression suitable for literal parsing .
164
13
10,270
public boolean isMatch ( CharSequence text ) { try { if ( text . length ( ) == 0 ) { return acceptEmpty ; } InputReader reader = Input . getInstance ( text ) ; return isMatch ( reader ) ; } catch ( IOException ex ) { throw new IllegalArgumentException ( "can't happen" ) ; } }
Return true if text matches the regex
72
7
10,271
public boolean isMatch ( PushbackReader input , int size ) throws IOException { InputReader reader = Input . getInstance ( input , size ) ; return isMatch ( reader ) ; }
Return true if input matches the regex
39
7
10,272
public boolean isMatch ( InputReader reader ) throws IOException { int rc = match ( reader ) ; return ( rc == 1 && reader . read ( ) == - 1 ) ; }
Return true if input matches the regex .
38
8
10,273
public String match ( CharSequence text ) { try { if ( text . length ( ) == 0 ) { if ( acceptEmpty ) { return "" ; } else { throw new SyntaxErrorException ( "empty string not accepted" ) ; } } InputReader reader = Input . getInstance ( text ) ; int rc = match ( reader ) ; if ( rc == 1 && reader . read ( ) == - 1 ) { re...
Attempts to match input to regex
178
6
10,274
public String lookingAt ( CharSequence text ) { try { if ( text . length ( ) == 0 ) { if ( acceptEmpty ) { return "" ; } else { throw new SyntaxErrorException ( "empty string not accepted" ) ; } } InputReader reader = Input . getInstance ( text ) ; return lookingAt ( reader ) ; } catch ( IOException ex ) { throw new Il...
Matches the start of text and returns the matched string
96
11
10,275
public String replace ( CharSequence text , CharSequence replacement ) { try { if ( text . length ( ) == 0 ) { if ( acceptEmpty ) { return "" ; } } CharArrayWriter caw = new CharArrayWriter ( ) ; InputReader reader = Input . getInstance ( text ) ; ObsoleteSimpleReplacer fsp = new ObsoleteSimpleReplacer ( replacement ) ...
Replaces regular expression matches in text with replacement string
128
10
10,276
public String replace ( CharSequence text , ObsoleteReplacer replacer ) throws IOException { if ( text . length ( ) == 0 ) { return "" ; } CharArrayWriter caw = new CharArrayWriter ( ) ; InputReader reader = Input . getInstance ( text ) ; replace ( reader , caw , replacer ) ; return caw . toString ( ) ; }
Replaces regular expression matches in text using replacer
81
10
10,277
public void replace ( PushbackReader in , int bufferSize , Writer out , String format ) throws IOException { InputReader reader = Input . getInstance ( in , bufferSize ) ; ObsoleteSimpleReplacer fsp = new ObsoleteSimpleReplacer ( format ) ; replace ( reader , out , fsp ) ; }
Writes in to out replacing every match with a string
67
11
10,278
public void replace ( PushbackReader in , int bufferSize , Writer out , ObsoleteReplacer replacer ) throws IOException { InputReader reader = Input . getInstance ( in , bufferSize ) ; replace ( reader , out , replacer ) ; }
Replaces regular expression matches in input using replacer
53
10
10,279
public static Regex literal ( String expression , Option ... options ) throws IOException { return compile ( escape ( expression ) , options ) ; }
Compiles a literal string into RegexImpl class . This is ok for testing . use RegexBuilder ant task for release classes
29
26
10,280
public static DFA < Integer > createDFA ( String expression , int reducer , Option ... options ) { NFA < Integer > nfa = createNFA ( new Scope < NFAState < Integer > > ( expression ) , expression , reducer , options ) ; DFA < Integer > dfa = nfa . constructDFA ( new Scope < DFAState < Integer > > ( expression ) ) ; ret...
Creates a DFA from regular expression
92
8
10,281
static < T > List < T > executeOraBlock ( Connection connection , String sql , Class < T > clazz , List < SqlParam > sqlParams ) throws SQLException { String cursorParam = null ; List < T > list = new ArrayList < T > ( ) ; //boolean autoCommitOrig = connection.getAutoCommit(); //if (autoCommitOrig == true) { // connect...
Execute sql block or stored procedure . If exists output parameter with type CURSOR then return resultSet as List of clazz type objects .
320
30
10,282
Observable < List < ChatConversationBase > > loadAllConversations ( ) { return Observable . create ( emitter -> storeFactory . execute ( new StoreTransaction < ChatStore > ( ) { @ Override protected void execute ( ChatStore store ) { store . open ( ) ; List < ChatConversationBase > conversations = store . getAllConvers...
Wraps loading all conversations from store implementation into an Observable .
122
13
10,283
Observable < ComapiResult < MessagesQueryResponse > > processOrphanedEvents ( ComapiResult < MessagesQueryResponse > result , final ChatController . OrphanedEventsToRemoveListener removeListener ) { if ( result . isSuccessful ( ) && result . getResult ( ) != null ) { final MessagesQueryResponse response = result . getR...
Handle orphaned events related to message query .
483
9
10,284
public Observable < Boolean > updateStoreWithNewMessage ( final ChatMessage message , final ChatController . NoConversationListener noConversationListener ) { return asObservable ( new Executor < Boolean > ( ) { @ Override protected void execute ( ChatStore store , Emitter < Boolean > emitter ) { boolean isSuccessful =...
Deletes temporary message and inserts provided one . If no associated conversation exists will trigger GET from server .
476
20
10,285
public Observable < Boolean > updateStoreForSentError ( String conversationId , String tempId , String profileId ) { return asObservable ( new Executor < Boolean > ( ) { @ Override protected void execute ( ChatStore store , Emitter < Boolean > emitter ) { store . beginTransaction ( ) ; boolean isSuccess = store . updat...
Insert error message status if sending message failed .
147
9
10,286
private boolean doUpdateConversationFromEvent ( ChatStore store , String conversationId , Long eventId , Long updatedOn ) { ChatConversationBase conversation = store . getConversation ( conversationId ) ; if ( conversation != null ) { ChatConversationBase . Builder builder = ChatConversationBase . baseBuilder ( ) . pop...
Update conversation state with received event details . This should be called only inside transaction .
215
16
10,287
public Observable < Boolean > upsertConversation ( ChatConversation conversation ) { List < ChatConversation > conversations = new ArrayList <> ( ) ; conversations . add ( conversation ) ; return upsertConversations ( conversations ) ; }
Insert or update conversation in the store .
54
8
10,288
private < T > Observable < T > asObservable ( Executor < T > transaction ) { return Observable . create ( emitter -> storeFactory . execute ( new StoreTransaction < ChatStore > ( ) { @ Override protected void execute ( ChatStore store ) { try { transaction . execute ( store , emitter ) ; } finally { emitter . onComplet...
Executes transaction callback ass an observable .
98
8
10,289
@ Override public void setCharset ( Charset cs , boolean fixedCharset ) { if ( includeLevel . in instanceof ModifiableCharset ) { ModifiableCharset sr = ( ModifiableCharset ) includeLevel . in ; sr . setCharset ( cs , fixedCharset ) ; } else { throw new UnsupportedOperationException ( "setting charset not supported wit...
Set current character set . Only supported with byte input!
100
11
10,290
@ Override public void release ( ) throws IOException { if ( includeLevel . in != null && end != cursor ) { if ( end % size < cursor % size ) { buffer2 . position ( 0 ) ; buffer2 . limit ( ( int ) ( end % size ) ) ; buffer1 . position ( ( int ) ( cursor % size ) ) ; buffer1 . limit ( size ) ; } else { buffer2 . positio...
Synchronizes actual reader to current cursor position
271
9
10,291
@ Override public int peek ( int offset ) throws IOException { long target = cursor + offset - 1 ; if ( target - end > size || target < end - size || target < 0 ) { throw new IllegalArgumentException ( "offset " + offset + " out of buffer" ) ; } if ( target >= end ) { int la = 0 ; while ( target >= end ) { int cc = rea...
get a char from input buffer .
144
7
10,292
@ Override public void rewind ( int count ) throws IOException { if ( count < 0 ) { throw new IllegalArgumentException ( "negative rewind " + count ) ; } cursor -= count ; if ( cursor < end - size || cursor < 0 ) { throw new IOException ( "insufficient room in the pushback buffer" ) ; } length -= count ; if ( length < ...
Rewinds cursor position count characters . Used for unread .
248
13
10,293
@ Override public final int read ( ) throws IOException { assert cursor <= end ; if ( cursor >= end ) { if ( includeLevel . in == null ) { return - 1 ; } int cp = ( int ) ( cursor % size ) ; long len = size - ( cursor - waterMark ) ; int il ; if ( len > size - cp ) { buffer1 . position ( cp ) ; buffer1 . limit ( size )...
Reads from ring buffer or from actual reader .
474
10
10,294
@ Override public int parseInt ( long s , int l , int radix ) { return Primitives . parseInt ( getCharSequence ( s , l ) , radix ) ; }
Converts binary to int
41
5
10,295
@ GET public Response compile ( @ QueryParam ( "type" ) final String _type ) { boolean success = false ; try { if ( hasAccess ( ) ) { AbstractRest . LOG . info ( "===Starting Compiler via REST===" ) ; if ( "java" . equalsIgnoreCase ( _type ) ) { AbstractRest . LOG . info ( "==Compiling Java==" ) ; new ESJPCompiler ( ge...
Called to compile java css etc .
399
9
10,296
@ Override public void supplierChanged ( SupplierEvent supplierEvent ) { SupplierEvent . Type type = supplierEvent . type ( ) ; @ SuppressWarnings ( "unchecked" ) Supplier < T > supplier = ( Supplier < T > ) supplierEvent . supplier ( ) ; switch ( type ) { case ADD : if ( supplierReference . compareAndSet ( null , supp...
there no thread safety issue because the supplierFutureRef is only used for the asynchronous approach . The risk is small enough to avoid to introduce more complexity .
162
30
10,297
private String getLabel ( final UIValue _uiValue , final Boolean _key ) throws CacheReloadException { String ret = BooleanUtils . toStringTrueFalse ( _key ) ; if ( _uiValue . getAttribute ( ) != null && DBProperties . hasProperty ( _uiValue . getAttribute ( ) . getKey ( ) + "." + BooleanUtils . toStringTrueFalse ( _key...
Method to evaluate a String representation for the boolean .
221
10
10,298
public void addObject ( final Object [ ] _row ) throws SQLException { // store the ids also this . idList . add ( ( Long ) _row [ 0 ] ) ; if ( getFromSelect ( ) != null ) { final int column = "id" . equals ( this . valueSelect . getValueType ( ) ) ? this . valueSelect . getColIndexs ( ) . get ( 0 ) : 2 ; this . relIdLi...
Add an Object for this OneSelect .
479
8
10,299
public void addFileSelectPart ( ) throws EFapsException { final Type type ; // if a previous select exists it is based on the previous select, // else it is based on the basic table if ( this . selectParts . size ( ) > 0 ) { type = this . selectParts . get ( this . selectParts . size ( ) - 1 ) . getType ( ) ; } else { ...
Add the select part to connect the general store .
123
10