idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
500 | protected boolean checkPackageLocators ( String classPackageName ) { if ( packageLocators != null && ! disablePackageLocatorsScanning && classPackageName . length ( ) > 0 && ( packageLocatorsBasePackage == null || classPackageName . startsWith ( packageLocatorsBasePackage ) ) ) { for ( String packageLocator : packageLo... | Checks if class package match provided list of package locators | 135 | 12 |
501 | private static List < Segment > parseSegments ( String origPathStr ) { String pathStr = origPathStr ; if ( ! pathStr . startsWith ( "/" ) ) { pathStr = pathStr + "/" ; } List < Segment > result = new ArrayList <> ( ) ; for ( String segmentStr : PATH_SPLITTER . split ( pathStr ) ) { Matcher m = SEGMENT_PATTERN . matcher... | currently does not support paths with name constrains | 190 | 10 |
502 | okhttp3 . Response get ( String url , Map < String , Object > params ) throws RequestException , LocalOperationException { String fullUrl = getFullUrl ( url ) ; okhttp3 . Request request = new okhttp3 . Request . Builder ( ) . url ( addUrlParams ( fullUrl , toPayload ( params ) ) ) . addHeader ( "Transloadit-Client" , ... | Makes http GET request . | 126 | 6 |
503 | okhttp3 . Response delete ( String url , Map < String , Object > params ) throws RequestException , LocalOperationException { okhttp3 . Request request = new okhttp3 . Request . Builder ( ) . url ( getFullUrl ( url ) ) . delete ( getBody ( toPayload ( params ) , null ) ) . addHeader ( "Transloadit-Client" , version ) .... | Makes http DELETE request | 122 | 7 |
504 | private String getFullUrl ( String url ) { return url . startsWith ( "https://" ) || url . startsWith ( "http://" ) ? url : transloadit . getHostUrl ( ) + url ; } | Converts url path to the Transloadit full url . Returns the url passed if it is already full . | 48 | 22 |
505 | private Map < String , String > toPayload ( Map < String , Object > data ) throws LocalOperationException { Map < String , Object > dataClone = new HashMap < String , Object > ( data ) ; dataClone . put ( "auth" , getAuthData ( ) ) ; Map < String , String > payload = new HashMap < String , String > ( ) ; payload . put ... | Returns data tree structured as Transloadit expects it . | 140 | 11 |
506 | private String jsonifyData ( Map < String , ? extends Object > data ) { JSONObject jsonData = new JSONObject ( data ) ; return jsonData . toString ( ) ; } | converts Map of data to json string | 39 | 8 |
507 | private static String convertISO88591toUTF8 ( String value ) { try { return new String ( value . getBytes ( CharEncoding . ISO_8859_1 ) , CharEncoding . UTF_8 ) ; } catch ( UnsupportedEncodingException ex ) { // ignore and fallback to original encoding return value ; } } | Converts a string from ISO - 8559 - 1 encoding to UTF - 8 . | 71 | 17 |
508 | @ Override public Result getResult ( ) throws Exception { Result returnResult = result ; // If we've chained to other Actions, we need to find the last result while ( returnResult instanceof ActionChainResult ) { ActionProxy aProxy = ( ( ActionChainResult ) returnResult ) . getProxy ( ) ; if ( aProxy != null ) { Result... | If the DefaultActionInvocation has been executed before and the Result is an instance of ActionChainResult this method will walk down the chain of ActionChainResults until it finds a non - chain result which will be returned . If the DefaultActionInvocation s result has not been executed before the Result instance will... | 137 | 70 |
509 | private void executeResult ( ) throws Exception { result = createResult ( ) ; String timerKey = "executeResult: " + getResultCode ( ) ; try { UtilTimerStack . push ( timerKey ) ; if ( result != null ) { result . execute ( this ) ; } else if ( resultCode != null && ! Action . NONE . equals ( resultCode ) ) { throw new C... | Uses getResult to get the final Result and executes it | 204 | 12 |
510 | protected < C > C convert ( Object object , Class < C > targetClass ) { return this . mapper . convertValue ( object , targetClass ) ; } | convert object into another class using the JSON mapper | 34 | 11 |
511 | protected final void sendObjectToSocket ( Object objectToSend , WriteCallback cb ) { Session sess = this . getSession ( ) ; if ( sess != null ) { String json ; try { json = this . mapper . writeValueAsString ( objectToSend ) ; } catch ( JsonProcessingException e ) { throw new RuntimeException ( "Failed to serialize obj... | send object to client and serialize it using JSON | 108 | 10 |
512 | public List < String > deviceTypes ( ) { Integer count = json ( ) . size ( DEVICE_FAMILIES ) ; List < String > deviceTypes = new ArrayList < String > ( count ) ; for ( int i = 0 ; i < count ; i ++ ) { String familyNumber = json ( ) . stringValue ( DEVICE_FAMILIES , i ) ; if ( familyNumber . equals ( "1" ) ) deviceTypes... | The list of device types on which this application can run . | 133 | 12 |
513 | public static boolean hasAnnotation ( Method method , Class < ? extends Annotation > annotation ) { return ! searchForAnnotation ( method , annotation ) . isEmpty ( ) ; } | Checks if there is an annotation of the given type on this method or on type level for all interfaces and superclasses | 38 | 24 |
514 | public static < T extends Annotation > List < T > searchForAnnotation ( Method method , Class < T > annotation ) { if ( method == null ) { return Lists . newArrayList ( ) ; } return searchClasses ( method , annotation , method . getDeclaringClass ( ) ) ; } | Searches for all annotations of the given type on this method or on type level for all interfaces and superclasses | 64 | 23 |
515 | public void addStep ( String name , String robot , Map < String , Object > options ) { steps . addStep ( name , robot , options ) ; } | Adds a step to the steps . | 33 | 7 |
516 | void merge ( Archetype flatParent , Archetype specialized ) { expandAttributeNodes ( specialized . getDefinition ( ) ) ; flattenCObject ( RmPath . ROOT , null , flatParent . getDefinition ( ) , specialized . getDefinition ( ) ) ; mergeOntologies ( flatParent . getTerminology ( ) , specialized . getTerminology ( ) ) ; i... | Merges a specialized archetype with its parent . Merge will be done in - place on the specialized parameter . | 156 | 21 |
517 | public static void addTTLIndex ( DBCollection collection , String field , int ttl ) { if ( ttl <= 0 ) { throw new IllegalArgumentException ( "TTL must be positive" ) ; } collection . createIndex ( new BasicDBObject ( field , 1 ) , new BasicDBObject ( "expireAfterSeconds" , ttl ) ) ; } | adds a TTL index to the given collection . The TTL must be a positive integer . | 81 | 18 |
518 | public static void addIndex ( DBCollection collection , String field , boolean asc , boolean background ) { int dir = ( asc ) ? 1 : - 1 ; collection . createIndex ( new BasicDBObject ( field , dir ) , new BasicDBObject ( "background" , background ) ) ; } | Add an index on the given collection and field | 63 | 9 |
519 | void checkRmModelConformance ( ) { final AmVisitor < AmObject , AmConstraintContext > visitor = AmVisitors . preorder ( new ConformanceVisitor ( ) ) ; ArchetypeWalker . walkConstraints ( visitor , archetype , new AmConstraintContext ( ) ) ; } | Check if information model entity referenced by archetype has right name or type | 66 | 13 |
520 | public static ResourceKey key ( Enum < ? > value ) { return new ResourceKey ( value . getClass ( ) . getName ( ) , value . name ( ) ) ; } | Creates a resource key for given enumeration value . By convention resource bundle for enumerations has the name of enumeration class and value identifier is the same as enumeration value name . | 39 | 37 |
521 | public static ResourceKey key ( Class < ? > clazz , String id ) { return new ResourceKey ( clazz . getName ( ) , id ) ; } | Creates a resource key with given id for bundle specified by given class . | 34 | 15 |
522 | public static ResourceKey key ( Class < ? > clazz , Enum < ? > value ) { return new ResourceKey ( clazz . getName ( ) , value . name ( ) ) ; } | Creates a resource key with id defined as enumeration value name and bundle specified by given class . | 42 | 20 |
523 | public static ResourceKey key ( Enum < ? > enumValue , String key ) { return new ResourceKey ( enumValue . getClass ( ) . getName ( ) , enumValue . name ( ) ) . child ( key ) ; } | Creates a resource key defined as a child of key defined by enumeration value . | 50 | 17 |
524 | public void set ( int i , double value ) { switch ( i ) { case 0 : { x = value ; break ; } case 1 : { y = value ; break ; } case 2 : { z = value ; break ; } default : { throw new ArrayIndexOutOfBoundsException ( i ) ; } } } | Sets a single element of this vector . Elements 0 1 and 2 correspond to x y and z . | 68 | 21 |
525 | public void set ( Vector3d v1 ) { x = v1 . x ; y = v1 . y ; z = v1 . z ; } | Sets the values of this vector to those of v1 . | 33 | 13 |
526 | public void add ( Vector3d v1 , Vector3d v2 ) { x = v1 . x + v2 . x ; y = v1 . y + v2 . y ; z = v1 . z + v2 . z ; } | Adds vector v1 to v2 and places the result in this vector . | 54 | 15 |
527 | public void add ( Vector3d v1 ) { x += v1 . x ; y += v1 . y ; z += v1 . z ; } | Adds this vector to v1 and places the result in this vector . | 33 | 14 |
528 | public void sub ( Vector3d v1 , Vector3d v2 ) { x = v1 . x - v2 . x ; y = v1 . y - v2 . y ; z = v1 . z - v2 . z ; } | Subtracts vector v1 from v2 and places the result in this vector . | 54 | 18 |
529 | public void sub ( Vector3d v1 ) { x -= v1 . x ; y -= v1 . y ; z -= v1 . z ; } | Subtracts v1 from this vector and places the result in this vector . | 33 | 17 |
530 | public double distance ( Vector3d v ) { double dx = x - v . x ; double dy = y - v . y ; double dz = z - v . z ; return Math . sqrt ( dx * dx + dy * dy + dz * dz ) ; } | Returns the Euclidean distance between this vector and vector v . | 60 | 13 |
531 | public double distanceSquared ( Vector3d v ) { double dx = x - v . x ; double dy = y - v . y ; double dz = z - v . z ; return dx * dx + dy * dy + dz * dz ; } | Returns the squared of the Euclidean distance between this vector and vector v . | 56 | 16 |
532 | public double dot ( Vector3d v1 ) { return x * v1 . x + y * v1 . y + z * v1 . z ; } | Returns the dot product of this vector and v1 . | 34 | 11 |
533 | public void normalize ( ) { double lenSqr = x * x + y * y + z * z ; double err = lenSqr - 1 ; if ( err > ( 2 * DOUBLE_PREC ) || err < - ( 2 * DOUBLE_PREC ) ) { double len = Math . sqrt ( lenSqr ) ; x /= len ; y /= len ; z /= len ; } } | Normalizes this vector in place . | 96 | 7 |
534 | public void cross ( Vector3d v1 , Vector3d v2 ) { double tmpx = v1 . y * v2 . z - v1 . z * v2 . y ; double tmpy = v1 . z * v2 . x - v1 . x * v2 . z ; double tmpz = v1 . x * v2 . y - v1 . y * v2 . x ; x = tmpx ; y = tmpy ; z = tmpz ; } | Computes the cross product of v1 and v2 and places the result in this vector . | 105 | 19 |
535 | protected void setRandom ( double lower , double upper , Random generator ) { double range = upper - lower ; x = generator . nextDouble ( ) * range + lower ; y = generator . nextDouble ( ) * range + lower ; z = generator . nextDouble ( ) * range + lower ; } | Sets the elements of this vector to uniformly distributed random values in a specified range using a supplied random number generator . | 62 | 23 |
536 | public LuaScriptBlock endBlockReturn ( LuaValue value ) { add ( new LuaAstReturnStatement ( argument ( value ) ) ) ; return new LuaScriptBlock ( script ) ; } | End the script block adding a return value statement | 38 | 9 |
537 | public static LuaCondition isNull ( LuaValue value ) { LuaAstExpression expression ; if ( value instanceof LuaLocal ) { expression = new LuaAstLocal ( ( ( LuaLocal ) value ) . getName ( ) ) ; } else { throw new IllegalArgumentException ( "Unexpected value type: " + value . getClass ( ) . getName ( ) ) ; } return new Lu... | IS NULL predicate | 95 | 3 |
538 | public String getVertexString ( ) { if ( tail ( ) != null ) { return "" + tail ( ) . index + "-" + head ( ) . index ; } else { return "?-" + head ( ) . index ; } } | Produces a string identifying this half - edge by the point index values of its tail and head vertices . | 52 | 22 |
539 | public static Face createTriangle ( Vertex v0 , Vertex v1 , Vertex v2 , double minArea ) { Face face = new Face ( ) ; HalfEdge he0 = new HalfEdge ( v0 , face ) ; HalfEdge he1 = new HalfEdge ( v1 , face ) ; HalfEdge he2 = new HalfEdge ( v2 , face ) ; he0 . prev = he2 ; he0 . next = he1 ; he1 . prev = he0 ; he1 . next = ... | Constructs a triangule Face from vertices v0 v1 and v2 . | 158 | 18 |
540 | public double distanceToPlane ( Point3d p ) { return normal . x * p . x + normal . y * p . y + normal . z * p . z - planeOffset ; } | Computes the distance from a point p to the plane of this face . | 42 | 15 |
541 | public HalfEdge getEdge ( int i ) { HalfEdge he = he0 ; while ( i > 0 ) { he = he . next ; i -- ; } while ( i < 0 ) { he = he . prev ; i ++ ; } return he ; } | Gets the i - th half - edge associated with the face . | 55 | 14 |
542 | public double areaSquared ( HalfEdge hedge0 , HalfEdge hedge1 ) { Point3d p0 = hedge0 . tail ( ) . pnt ; Point3d p1 = hedge0 . head ( ) . pnt ; Point3d p2 = hedge1 . head ( ) . pnt ; double dx1 = p1 . x - p0 . x ; double dy1 = p1 . y - p0 . y ; double dz1 = p1 . z - p0 . z ; double dx2 = p2 . x - p0 . x ; double dy2 = ... | return the squared area of the triangle defined by the half edge hedge0 and the point at the head of hedge1 . | 214 | 24 |
543 | protected < T > T fromJsonString ( String json , Class < T > clazz ) { return _gsonParser . fromJson ( json , clazz ) ; } | Convert JsonString to Object of Clazz | 38 | 10 |
544 | public LuaScript endScript ( LuaScriptConfig config ) { if ( ! endsWithReturnStatement ( ) ) { add ( new LuaAstReturnStatement ( ) ) ; } String scriptText = buildScriptText ( ) ; return new BasicLuaScript ( scriptText , config ) ; } | End building the script | 58 | 4 |
545 | public LuaScript endScriptReturn ( LuaValue value , LuaScriptConfig config ) { add ( new LuaAstReturnStatement ( argument ( value ) ) ) ; String scriptText = buildScriptText ( ) ; return new BasicLuaScript ( scriptText , config ) ; } | End building the script adding a return value statement | 55 | 9 |
546 | public LuaPreparedScript endPreparedScript ( LuaScriptConfig config ) { if ( ! endsWithReturnStatement ( ) ) { add ( new LuaAstReturnStatement ( ) ) ; } String scriptText = buildScriptText ( ) ; ArrayList < LuaKeyArgument > keyList = new ArrayList <> ( keyArg2AstArg . keySet ( ) ) ; ArrayList < LuaValueArgument > argvL... | End building the prepared script | 167 | 5 |
547 | public LuaPreparedScript endPreparedScriptReturn ( LuaValue value , LuaScriptConfig config ) { add ( new LuaAstReturnStatement ( argument ( value ) ) ) ; return endPreparedScript ( config ) ; } | End building the prepared script adding a return value statement | 46 | 10 |
548 | private synchronized static Cluster getCluster ( URI baseUrl , String [ ] personalities ) throws IOException { final Entry < URI , Set < String > > key = Maps . immutableEntry ( baseUrl , ( Set < String > ) ImmutableSet . copyOf ( personalities ) ) ; Cluster result = CLUSTERS . get ( key ) ; if ( result != null ) { ret... | Each schema set has its own database cluster . The template1 database has the schema preloaded so that each test case need only create a new database and not re - invoke Migratory . | 246 | 38 |
549 | public ImmutableMap < String , String > getConfigurationTweak ( String dbModuleName ) { final DbInfo db = cluster . getNextDb ( ) ; return ImmutableMap . of ( "ness.db." + dbModuleName + ".uri" , getJdbcUri ( db ) , "ness.db." + dbModuleName + ".ds.user" , db . user ) ; } | Return configuration tweaks in a format appropriate for ness - jdbc DatabaseModule . | 87 | 17 |
550 | public long remove ( final String ... fields ) { return doWithJedis ( new JedisCallable < Long > ( ) { @ Override public Long call ( Jedis jedis ) { return jedis . hdel ( getKey ( ) , fields ) ; } } ) ; } | Remove multiple fields from the map | 63 | 6 |
551 | public Double score ( final String member ) { return doWithJedis ( new JedisCallable < Double > ( ) { @ Override public Double call ( Jedis jedis ) { return jedis . zscore ( getKey ( ) , member ) ; } } ) ; } | Return the score of the specified element of the sorted set at key . | 62 | 14 |
552 | public boolean add ( final String member , final double score ) { return doWithJedis ( new JedisCallable < Boolean > ( ) { @ Override public Boolean call ( Jedis jedis ) { return jedis . zadd ( getKey ( ) , score , member ) > 0 ; } } ) ; } | Add an element assigned with its score | 70 | 7 |
553 | public long addAll ( final Map < String , Double > scoredMember ) { return doWithJedis ( new JedisCallable < Long > ( ) { @ Override public Long call ( Jedis jedis ) { return jedis . zadd ( getKey ( ) , scoredMember ) ; } } ) ; } | Adds to this set all of the elements in the specified map of members and their score . | 70 | 18 |
554 | public Set < String > rangeByRank ( final long start , final long end ) { return doWithJedis ( new JedisCallable < Set < String > > ( ) { @ Override public Set < String > call ( Jedis jedis ) { return jedis . zrange ( getKey ( ) , start , end ) ; } } ) ; } | Returns the specified range of elements in the sorted set . The elements are considered to be ordered from the lowest to the highest score . Lexicographical order is used for elements with equal score . Both start and stop are zero - based inclusive indexes . They can also be negative numbers indicating offsets from th... | 79 | 76 |
555 | public Set < String > rangeByRankReverse ( final long start , final long end ) { return doWithJedis ( new JedisCallable < Set < String > > ( ) { @ Override public Set < String > call ( Jedis jedis ) { return jedis . zrevrange ( getKey ( ) , start , end ) ; } } ) ; } | Returns the specified range of elements in the sorted set . The elements are considered to be ordered from the highest to the lowest score . Descending lexicographical order is used for elements with equal score . Both start and stop are zero - based inclusive indexes . They can also be negative numbers indicating offs... | 83 | 78 |
556 | public long countByLex ( final LexRange lexRange ) { return doWithJedis ( new JedisCallable < Long > ( ) { @ Override public Long call ( Jedis jedis ) { return jedis . zlexcount ( getKey ( ) , lexRange . from ( ) , lexRange . to ( ) ) ; } } ) ; } | When all the elements in a sorted set are inserted with the same score in order to force lexicographical ordering this command returns the number of elements in the sorted set with a value in the given range . | 79 | 41 |
557 | public Set < String > rangeByLex ( final LexRange lexRange ) { return doWithJedis ( new JedisCallable < Set < String > > ( ) { @ Override public Set < String > call ( Jedis jedis ) { if ( lexRange . hasLimit ( ) ) { return jedis . zrangeByLex ( getKey ( ) , lexRange . from ( ) , lexRange . to ( ) , lexRange . offset ( ... | When all the elements in a sorted set are inserted with the same score in order to force lexicographical ordering this command returns all the elements in the sorted set with a value in the given range . If the elements in the sorted set have different scores the returned elements are unspecified . | 148 | 56 |
558 | public Set < String > rangeByLexReverse ( final LexRange lexRange ) { return doWithJedis ( new JedisCallable < Set < String > > ( ) { @ Override public Set < String > call ( Jedis jedis ) { if ( lexRange . hasLimit ( ) ) { return jedis . zrevrangeByLex ( getKey ( ) , lexRange . fromReverse ( ) , lexRange . toReverse ( ... | When all the elements in a sorted set are inserted with the same score in order to force lexicographical ordering this command returns all the elements in the sorted set with a value in the given range . | 165 | 40 |
559 | public long removeRangeByLex ( final LexRange lexRange ) { return doWithJedis ( new JedisCallable < Long > ( ) { @ Override public Long call ( Jedis jedis ) { return jedis . zremrangeByLex ( getKey ( ) , lexRange . from ( ) , lexRange . to ( ) ) ; } } ) ; } | When all the elements in a sorted set are inserted with the same score in order to force lexicographical ordering this command removes all elements in the sorted set between the lexicographical range specified . | 82 | 39 |
560 | public Set < String > rangeByScoreReverse ( final ScoreRange scoreRange ) { return doWithJedis ( new JedisCallable < Set < String > > ( ) { @ Override public Set < String > call ( Jedis jedis ) { if ( scoreRange . hasLimit ( ) ) { return jedis . zrevrangeByScore ( getKey ( ) , scoreRange . fromReverse ( ) , scoreRange ... | Returns all the elements in the sorted set with a score in the given range . In contrary to the default ordering of sorted sets for this command the elements are considered to be ordered from high to low scores . The elements having the same score are returned in reverse lexicographical order . | 165 | 56 |
561 | public long removeRangeByScore ( final ScoreRange scoreRange ) { return doWithJedis ( new JedisCallable < Long > ( ) { @ Override public Long call ( Jedis jedis ) { return jedis . zremrangeByScore ( getKey ( ) , scoreRange . from ( ) , scoreRange . to ( ) ) ; } } ) ; } | Removes all elements in the sorted set with a score in the given range . | 82 | 16 |
562 | public void build ( double [ ] coords , int nump ) throws IllegalArgumentException { if ( nump < 4 ) { throw new IllegalArgumentException ( "Less than four input points specified" ) ; } if ( coords . length / 3 < nump ) { throw new IllegalArgumentException ( "Coordinate array too small for specified number of points" )... | Constructs the convex hull of a set of points whose coordinates are given by an array of doubles . | 106 | 21 |
563 | public void build ( Point3d [ ] points , int nump ) throws IllegalArgumentException { if ( nump < 4 ) { throw new IllegalArgumentException ( "Less than four input points specified" ) ; } if ( points . length < nump ) { throw new IllegalArgumentException ( "Point array too small for specified number of points" ) ; } ini... | Constructs the convex hull of a set of points . | 102 | 12 |
564 | public Point3d [ ] getVertices ( ) { Point3d [ ] vtxs = new Point3d [ numVertices ] ; for ( int i = 0 ; i < numVertices ; i ++ ) { vtxs [ i ] = pointBuffer [ vertexPointIndices [ i ] ] . pnt ; } return vtxs ; } | Returns the vertex points in this hull . | 77 | 8 |
565 | public int getVertices ( double [ ] coords ) { for ( int i = 0 ; i < numVertices ; i ++ ) { Point3d pnt = pointBuffer [ vertexPointIndices [ i ] ] . pnt ; coords [ i * 3 + 0 ] = pnt . x ; coords [ i * 3 + 1 ] = pnt . y ; coords [ i * 3 + 2 ] = pnt . z ; } return numVertices ; } | Returns the coordinates of the vertex points of this hull . | 103 | 11 |
566 | public int [ ] getVertexPointIndices ( ) { int [ ] indices = new int [ numVertices ] ; for ( int i = 0 ; i < numVertices ; i ++ ) { indices [ i ] = vertexPointIndices [ i ] ; } return indices ; } | Returns an array specifing the index of each hull vertex with respect to the original input points . | 61 | 20 |
567 | public long addAll ( final String ... members ) { return doWithJedis ( new JedisCallable < Long > ( ) { @ Override public Long call ( Jedis jedis ) { return jedis . sadd ( getKey ( ) , members ) ; } } ) ; } | Adds to this set all of the elements in the specified members array | 63 | 13 |
568 | public long removeAll ( final String ... members ) { return doWithJedis ( new JedisCallable < Long > ( ) { @ Override public Long call ( Jedis jedis ) { return jedis . srem ( getKey ( ) , members ) ; } } ) ; } | Removes from this set all of its elements that are contained in the specified members array | 64 | 17 |
569 | public String pop ( ) { return doWithJedis ( new JedisCallable < String > ( ) { @ Override public String call ( Jedis jedis ) { return jedis . spop ( getKey ( ) ) ; } } ) ; } | Removes and returns a random element from the set . | 57 | 11 |
570 | protected Object [ ] idsOf ( final List < ? > idsOrValues ) { // convert list to array that we can mutate final Object [ ] ids = idsOrValues . toArray ( ) ; // mutate array to contain only non-empty ids int length = 0 ; for ( int i = 0 ; i < ids . length ; ) { final Object p = ids [ i ++ ] ; if ( p instanceof HasId ) {... | Returns an array of non - empty ids from the given list of ids or values . | 310 | 19 |
571 | public long indexOf ( final String element ) { return doWithJedis ( new JedisCallable < Long > ( ) { @ Override public Long call ( Jedis jedis ) { return doIndexOf ( jedis , element ) ; } } ) ; } | Find the index of the first matching element in the list | 59 | 11 |
572 | public String get ( final long index ) { return doWithJedis ( new JedisCallable < String > ( ) { @ Override public String call ( Jedis jedis ) { return jedis . lindex ( getKey ( ) , index ) ; } } ) ; } | Get the element value in the list by index | 62 | 9 |
573 | public List < String > subList ( final long fromIndex , final long toIndex ) { return doWithJedis ( new JedisCallable < List < String > > ( ) { @ Override public List < String > call ( Jedis jedis ) { return jedis . lrange ( getKey ( ) , fromIndex , toIndex ) ; } } ) ; } | Get a sub - list of this list | 82 | 8 |
574 | private void ensureNext ( ) { // Check if the current scan result has more keys (i.e. the index did not reach the end of the result list) if ( resultIndex < scanResult . getResult ( ) . size ( ) ) { return ; } // Since the current scan result was fully iterated, // if there is another cursor scan it and ensure next key... | Make sure the result index points to the next available key in the scan result if exists . | 139 | 18 |
575 | public void addAll ( Vertex vtx ) { if ( head == null ) { head = vtx ; } else { tail . next = vtx ; } vtx . prev = tail ; while ( vtx . next != null ) { vtx = vtx . next ; } tail = vtx ; } | Adds a chain of vertices to the end of this list . | 66 | 13 |
576 | public void delete ( Vertex vtx ) { if ( vtx . prev == null ) { head = vtx . next ; } else { vtx . prev . next = vtx . next ; } if ( vtx . next == null ) { tail = vtx . prev ; } else { vtx . next . prev = vtx . prev ; } } | Deletes a vertex from this list . | 77 | 8 |
577 | public void delete ( Vertex vtx1 , Vertex vtx2 ) { if ( vtx1 . prev == null ) { head = vtx2 . next ; } else { vtx1 . prev . next = vtx2 . next ; } if ( vtx2 . next == null ) { tail = vtx1 . prev ; } else { vtx2 . next . prev = vtx1 . prev ; } } | Deletes a chain of vertices from this list . | 92 | 11 |
578 | public void insertBefore ( Vertex vtx , Vertex next ) { vtx . prev = next . prev ; if ( next . prev == null ) { head = vtx ; } else { next . prev . next = vtx ; } vtx . next = next ; next . prev = vtx ; } | Inserts a vertex into this list before another specificed vertex . | 66 | 13 |
579 | private static void freeTempLOB ( ClobWrapper clob , BlobWrapper blob ) { try { if ( clob != null ) { // If the CLOB is open, close it if ( clob . isOpen ( ) ) { clob . close ( ) ; } // Free the memory used by this CLOB clob . freeTemporary ( ) ; } if ( blob != null ) { // If the BLOB is open, close it if ( blob . isOp... | Frees the temporary LOBs when an exception is raised in the application or when the LOBs are no longer needed . If the LOBs are not freed the space used by these LOBs are not reclaimed . | 157 | 46 |
580 | public void check ( CollectionDescriptorDef collDef , String checkLevel ) throws ConstraintException { ensureElementClassRef ( collDef , checkLevel ) ; checkInheritedForeignkey ( collDef , checkLevel ) ; ensureCollectionClass ( collDef , checkLevel ) ; checkProxyPrefetchingLimit ( collDef , checkLevel ) ; checkOrderby ... | Checks the given collection descriptor . | 97 | 7 |
581 | private void ensureElementClassRef ( CollectionDescriptorDef collDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } String arrayElementClassName = collDef . getProperty ( PropertyHelper . OJB_PROPERTY_ARRAY_ELEMENT_CLASS_REF ) ; if ( ! collDef . hasPropert... | Ensures that the given collection descriptor has a valid element - class - ref property . | 704 | 18 |
582 | private void ensureCollectionClass ( CollectionDescriptorDef collDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } if ( collDef . hasProperty ( PropertyHelper . OJB_PROPERTY_ARRAY_ELEMENT_CLASS_REF ) ) { // an array cannot have a collection-class specifie... | Ensures that the given collection descriptor has the collection - class property if necessary . | 762 | 17 |
583 | private void checkOrderby ( CollectionDescriptorDef collDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } String orderbySpec = collDef . getProperty ( PropertyHelper . OJB_PROPERTY_ORDERBY ) ; if ( ( orderbySpec == null ) || ( orderbySpec . length ( ) == ... | Checks the orderby attribute . | 489 | 7 |
584 | private void checkQueryCustomizer ( CollectionDescriptorDef collDef , String checkLevel ) throws ConstraintException { if ( ! CHECKLEVEL_STRICT . equals ( checkLevel ) ) { return ; } String queryCustomizerName = collDef . getProperty ( PropertyHelper . OJB_PROPERTY_QUERY_CUSTOMIZER ) ; if ( queryCustomizerName == null ... | Checks the query - customizer setting of the given collection descriptor . | 291 | 14 |
585 | public static Class getClass ( String className , boolean initialize ) throws ClassNotFoundException { return Class . forName ( className , initialize , getClassLoader ( ) ) ; } | Retrieves the class object for the given qualified class name . | 38 | 13 |
586 | public static Object newInstance ( Class target , Class [ ] types , Object [ ] args ) throws InstantiationException , IllegalAccessException , IllegalArgumentException , InvocationTargetException , NoSuchMethodException , SecurityException { return newInstance ( target , types , args , false ) ; } | Returns a new instance of the given class using the constructor with the specified parameter types . | 60 | 17 |
587 | public static Field getField ( Class clazz , String fieldName ) { try { return clazz . getField ( fieldName ) ; } catch ( Exception ignored ) { } return null ; } | Determines the field via reflection look - up . | 40 | 11 |
588 | public static Object newInstance ( String className ) throws InstantiationException , IllegalAccessException , ClassNotFoundException { return newInstance ( getClass ( className ) ) ; } | Returns a new instance of the class with the given qualified name using the default or or a no - arg constructor . | 37 | 23 |
589 | public static Object newInstance ( String className , Class [ ] types , Object [ ] args ) throws InstantiationException , IllegalAccessException , IllegalArgumentException , InvocationTargetException , NoSuchMethodException , SecurityException , ClassNotFoundException { return newInstance ( getClass ( className ) , typ... | Returns a new instance of the class with the given qualified name using the constructor with the specified signature . | 69 | 20 |
590 | public static Object newInstance ( Class target , Class type , Object arg ) throws InstantiationException , IllegalAccessException , IllegalArgumentException , InvocationTargetException , NoSuchMethodException , SecurityException { return newInstance ( target , new Class [ ] { type } , new Object [ ] { arg } ) ; } | Returns a new instance of the given class using the constructor with the specified parameter . | 66 | 16 |
591 | public static Object newInstance ( String className , Class type , Object arg ) throws InstantiationException , IllegalAccessException , IllegalArgumentException , InvocationTargetException , NoSuchMethodException , SecurityException , ClassNotFoundException { return newInstance ( className , new Class [ ] { type } , n... | Returns a new instance of the class with the given qualified name using the constructor with the specified parameter . | 73 | 20 |
592 | public static Object buildNewObjectInstance ( ClassDescriptor cld ) { Object result = null ; // If either the factory class and/or factory method is null, // just follow the normal code path and create via constructor if ( ( cld . getFactoryClass ( ) == null ) || ( cld . getFactoryMethod ( ) == null ) ) { try { // 1. c... | Builds a new instance for the class represented by the given class descriptor . | 419 | 15 |
593 | private GraphicsDocument createFeatureDocument ( StringWriter writer ) throws RenderException { if ( TileMetadata . PARAM_SVG_RENDERER . equalsIgnoreCase ( renderer ) ) { DefaultSvgDocument document = new DefaultSvgDocument ( writer , false ) ; document . setMaximumFractionDigits ( MAXIMUM_FRACTION_DIGITS ) ; document ... | Create a document that parses the tile s featureFragment using GraphicsWriter classes . | 306 | 17 |
594 | private GraphicsDocument createLabelDocument ( StringWriter writer , LabelStyleInfo labelStyleInfo ) throws RenderException { if ( TileMetadata . PARAM_SVG_RENDERER . equalsIgnoreCase ( renderer ) ) { DefaultSvgDocument document = new DefaultSvgDocument ( writer , false ) ; document . setMaximumFractionDigits ( MAXIMUM... | Create a document that parses the tile s labelFragment using GraphicsWriter classes . | 321 | 17 |
595 | private GeometryCoordinateSequenceTransformer getTransformer ( ) { if ( unitToPixel == null ) { unitToPixel = new GeometryCoordinateSequenceTransformer ( ) ; unitToPixel . setMathTransform ( ProjectiveTransform . create ( new AffineTransform ( scale , 0 , 0 , - scale , - scale * panOrigin . x , scale * panOrigin . y ) ... | Get transformer to use . | 93 | 5 |
596 | private void doExecute ( Connection conn ) throws SQLException { PreparedStatement stmt ; int size ; size = _methods . size ( ) ; if ( size == 0 ) { return ; } stmt = conn . prepareStatement ( _sql ) ; try { m_platform . afterStatementCreate ( stmt ) ; } catch ( PlatformException e ) { if ( e . getCause ( ) instanceof ... | This method performs database modification at the very and of transaction . | 591 | 12 |
597 | public Object getBeliefValue ( String agent_name , final String belief_name , Connector connector ) { ( ( IExternalAccess ) connector . getAgentsExternalAccess ( agent_name ) ) . scheduleStep ( new IComponentStep < Integer > ( ) { public IFuture < Integer > execute ( IInternalAccess ia ) { IBDIInternalAccess bia = ( IB... | This method takes the value of an agent s belief through its external access | 142 | 14 |
598 | public void setBeliefValue ( String agent_name , final String belief_name , final Object new_value , Connector connector ) { ( ( IExternalAccess ) connector . getAgentsExternalAccess ( agent_name ) ) . scheduleStep ( new IComponentStep < Integer > ( ) { public IFuture < Integer > execute ( IInternalAccess ia ) { IBDIIn... | This method changes the value of an agent s belief through its external access | 142 | 14 |
599 | public IPlan [ ] getAgentPlans ( final String agent_name , Connector connector ) { ( ( IExternalAccess ) connector . getAgentsExternalAccess ( agent_name ) ) . scheduleStep ( new IComponentStep < Plan > ( ) { public IFuture < Plan > execute ( IInternalAccess ia ) { IBDIInternalAccess bia = ( IBDIInternalAccess ) ia ; p... | This method prints plan information of an agent through its external access . It can be used to check the correct behaviour of the agent . | 127 | 26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.