repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
kristofa/wicket-tagcloud
src/main/java/com/github/kristofa/wickettagcloud/TagRenderDataModel.java
TagRenderDataModel.buildTagRenderDataList
private List<TagRenderData> buildTagRenderDataList() { final List<TagRenderData> tagRenderData = new ArrayList<TagRenderData>(); final Collection<TagCloudTag> tags = tagCollectionModel.getObject(); int minWeight = Integer.MAX_VALUE; int maxWeight = Integer.MIN_VALUE; for (final TagCloudTag tag : tags) { minWeight = Math.min(minWeight, tag.getWeight()); maxWeight = Math.max(maxWeight, tag.getWeight()); } final int fontRange = maxFontSizeInPixels - minFontSizeInPixels; int weightRange = 1; if (minWeight != maxWeight) { weightRange = maxWeight - minWeight; } float weightIncrease = 0; if (fontRange >= weightRange) { weightIncrease = fontRange / weightRange; } else { weightIncrease = weightRange / fontRange; } for (final TagCloudTag tag : tags) { final int fontSize = Math.round(minFontSizeInPixels + (tag.getWeight() - minWeight) * weightIncrease); tagRenderData.add(new TagRenderData(tag, fontSize)); } return tagRenderData; }
java
private List<TagRenderData> buildTagRenderDataList() { final List<TagRenderData> tagRenderData = new ArrayList<TagRenderData>(); final Collection<TagCloudTag> tags = tagCollectionModel.getObject(); int minWeight = Integer.MAX_VALUE; int maxWeight = Integer.MIN_VALUE; for (final TagCloudTag tag : tags) { minWeight = Math.min(minWeight, tag.getWeight()); maxWeight = Math.max(maxWeight, tag.getWeight()); } final int fontRange = maxFontSizeInPixels - minFontSizeInPixels; int weightRange = 1; if (minWeight != maxWeight) { weightRange = maxWeight - minWeight; } float weightIncrease = 0; if (fontRange >= weightRange) { weightIncrease = fontRange / weightRange; } else { weightIncrease = weightRange / fontRange; } for (final TagCloudTag tag : tags) { final int fontSize = Math.round(minFontSizeInPixels + (tag.getWeight() - minWeight) * weightIncrease); tagRenderData.add(new TagRenderData(tag, fontSize)); } return tagRenderData; }
[ "private", "List", "<", "TagRenderData", ">", "buildTagRenderDataList", "(", ")", "{", "final", "List", "<", "TagRenderData", ">", "tagRenderData", "=", "new", "ArrayList", "<", "TagRenderData", ">", "(", ")", ";", "final", "Collection", "<", "TagCloudTag", ">...
Builds a List of {@link TagRenderData} based on the Collection of {@link TagCloudTag tags} provided by the input model. It will calculate the font size for each of the tags, respecting the min/max font sizes, and wrap each provided {@link TagCloudTag tags} in a {@link TagRenderData} object. @return List of {@link TagRenderData}.
[ "Builds", "a", "List", "of", "{", "@link", "TagRenderData", "}", "based", "on", "the", "Collection", "of", "{", "@link", "TagCloudTag", "tags", "}", "provided", "by", "the", "input", "model", ".", "It", "will", "calculate", "the", "font", "size", "for", ...
train
https://github.com/kristofa/wicket-tagcloud/blob/9c0b5d09e7781597da26d465853db4cfdc7650a5/src/main/java/com/github/kristofa/wickettagcloud/TagRenderDataModel.java#L74-L106
deeplearning4j/deeplearning4j
nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorflowConversion.java
TensorflowConversion.loadGraph
public TF_Graph loadGraph(String filePath, TF_Status status) throws IOException { byte[] bytes = Files.readAllBytes(Paths.get(filePath)); return loadGraph(bytes, status); }
java
public TF_Graph loadGraph(String filePath, TF_Status status) throws IOException { byte[] bytes = Files.readAllBytes(Paths.get(filePath)); return loadGraph(bytes, status); }
[ "public", "TF_Graph", "loadGraph", "(", "String", "filePath", ",", "TF_Status", "status", ")", "throws", "IOException", "{", "byte", "[", "]", "bytes", "=", "Files", ".", "readAllBytes", "(", "Paths", ".", "get", "(", "filePath", ")", ")", ";", "return", ...
Get an initialized {@link TF_Graph} based on the passed in file (the file must be a binary protobuf/pb file) The graph will be modified to be associated with the device associated with this current thread. Depending on the active {@link Nd4j#getBackend()} the device will either be the gpu pinned to the current thread or the cpu @param filePath the path to the file to read @return the initialized graph @throws IOException
[ "Get", "an", "initialized", "{", "@link", "TF_Graph", "}", "based", "on", "the", "passed", "in", "file", "(", "the", "file", "must", "be", "a", "binary", "protobuf", "/", "pb", "file", ")", "The", "graph", "will", "be", "modified", "to", "be", "associa...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorflowConversion.java#L284-L287
grpc/grpc-java
examples/src/main/java/io/grpc/examples/authentication/AuthClient.java
AuthClient.main
public static void main(String[] args) throws Exception { AuthClient client = new AuthClient("localhost", 50051); try { /* Access a service running on the local machine on port 50051 */ String user = "world"; if (args.length > 0) { user = args[0]; /* Use the arg as the name to greet if provided */ } if (args.length > 1) { client.setTokenValue(args[1]); } client.greet(user); } finally { client.shutdown(); } }
java
public static void main(String[] args) throws Exception { AuthClient client = new AuthClient("localhost", 50051); try { /* Access a service running on the local machine on port 50051 */ String user = "world"; if (args.length > 0) { user = args[0]; /* Use the arg as the name to greet if provided */ } if (args.length > 1) { client.setTokenValue(args[1]); } client.greet(user); } finally { client.shutdown(); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "AuthClient", "client", "=", "new", "AuthClient", "(", "\"localhost\"", ",", "50051", ")", ";", "try", "{", "/* Access a service running on the local machine on p...
Greet server. If provided, the first element of {@code args} is the name to use in the greeting.
[ "Greet", "server", ".", "If", "provided", "the", "first", "element", "of", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/examples/src/main/java/io/grpc/examples/authentication/AuthClient.java#L92-L108
alkacon/opencms-core
src/org/opencms/relations/CmsCategoryService.java
CmsCategoryService.readCategoryResources
public List<CmsResource> readCategoryResources( CmsObject cms, String categoryPath, boolean recursive, String referencePath) throws CmsException { return readCategoryResources(cms, categoryPath, recursive, referencePath, CmsResourceFilter.DEFAULT); }
java
public List<CmsResource> readCategoryResources( CmsObject cms, String categoryPath, boolean recursive, String referencePath) throws CmsException { return readCategoryResources(cms, categoryPath, recursive, referencePath, CmsResourceFilter.DEFAULT); }
[ "public", "List", "<", "CmsResource", ">", "readCategoryResources", "(", "CmsObject", "cms", ",", "String", "categoryPath", ",", "boolean", "recursive", ",", "String", "referencePath", ")", "throws", "CmsException", "{", "return", "readCategoryResources", "(", "cms"...
Reads the resources for a category identified by the given category path.<p> @param cms the current cms context @param categoryPath the path of the category to read the resources for @param recursive <code>true</code> if including sub-categories @param referencePath the reference path to find all the category repositories @return a list of {@link CmsResource} objects @throws CmsException if something goes wrong
[ "Reads", "the", "resources", "for", "a", "category", "identified", "by", "the", "given", "category", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L583-L591
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/HeapAlphaSketch.java
HeapAlphaSketch.heapifyInstance
static HeapAlphaSketch heapifyInstance(final Memory srcMem, final long seed) { final int preambleLongs = extractPreLongs(srcMem); //byte 0 final int lgNomLongs = extractLgNomLongs(srcMem); //byte 3 final int lgArrLongs = extractLgArrLongs(srcMem); //byte 4 checkAlphaFamily(srcMem, preambleLongs, lgNomLongs); checkMemIntegrity(srcMem, seed, preambleLongs, lgNomLongs, lgArrLongs); final float p = extractP(srcMem); //bytes 12-15 final int lgRF = extractLgResizeFactor(srcMem); //byte 0 final ResizeFactor myRF = ResizeFactor.getRF(lgRF); final double nomLongs = (1L << lgNomLongs); final double alpha = nomLongs / (nomLongs + 1.0); final long split1 = (long) (((p * (alpha + 1.0)) / 2.0) * MAX_THETA_LONG_AS_DOUBLE); if ((myRF == ResizeFactor.X1) && (lgArrLongs != Util.startingSubMultiple(lgNomLongs + 1, myRF, MIN_LG_ARR_LONGS))) { throw new SketchesArgumentException("Possible corruption: ResizeFactor X1, but provided " + "array too small for sketch size"); } final HeapAlphaSketch has = new HeapAlphaSketch(lgNomLongs, seed, p, myRF, alpha, split1); has.lgArrLongs_ = lgArrLongs; has.hashTableThreshold_ = setHashTableThreshold(lgNomLongs, lgArrLongs); has.curCount_ = extractCurCount(srcMem); has.thetaLong_ = extractThetaLong(srcMem); has.empty_ = PreambleUtil.isEmpty(srcMem); has.cache_ = new long[1 << lgArrLongs]; srcMem.getLongArray(preambleLongs << 3, has.cache_, 0, 1 << lgArrLongs); //read in as hash table return has; }
java
static HeapAlphaSketch heapifyInstance(final Memory srcMem, final long seed) { final int preambleLongs = extractPreLongs(srcMem); //byte 0 final int lgNomLongs = extractLgNomLongs(srcMem); //byte 3 final int lgArrLongs = extractLgArrLongs(srcMem); //byte 4 checkAlphaFamily(srcMem, preambleLongs, lgNomLongs); checkMemIntegrity(srcMem, seed, preambleLongs, lgNomLongs, lgArrLongs); final float p = extractP(srcMem); //bytes 12-15 final int lgRF = extractLgResizeFactor(srcMem); //byte 0 final ResizeFactor myRF = ResizeFactor.getRF(lgRF); final double nomLongs = (1L << lgNomLongs); final double alpha = nomLongs / (nomLongs + 1.0); final long split1 = (long) (((p * (alpha + 1.0)) / 2.0) * MAX_THETA_LONG_AS_DOUBLE); if ((myRF == ResizeFactor.X1) && (lgArrLongs != Util.startingSubMultiple(lgNomLongs + 1, myRF, MIN_LG_ARR_LONGS))) { throw new SketchesArgumentException("Possible corruption: ResizeFactor X1, but provided " + "array too small for sketch size"); } final HeapAlphaSketch has = new HeapAlphaSketch(lgNomLongs, seed, p, myRF, alpha, split1); has.lgArrLongs_ = lgArrLongs; has.hashTableThreshold_ = setHashTableThreshold(lgNomLongs, lgArrLongs); has.curCount_ = extractCurCount(srcMem); has.thetaLong_ = extractThetaLong(srcMem); has.empty_ = PreambleUtil.isEmpty(srcMem); has.cache_ = new long[1 << lgArrLongs]; srcMem.getLongArray(preambleLongs << 3, has.cache_, 0, 1 << lgArrLongs); //read in as hash table return has; }
[ "static", "HeapAlphaSketch", "heapifyInstance", "(", "final", "Memory", "srcMem", ",", "final", "long", "seed", ")", "{", "final", "int", "preambleLongs", "=", "extractPreLongs", "(", "srcMem", ")", ";", "//byte 0", "final", "int", "lgNomLongs", "=", "extractLgN...
Heapify a sketch from a Memory object containing sketch data. @param srcMem The source Memory object. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a> @return instance of this sketch
[ "Heapify", "a", "sketch", "from", "a", "Memory", "object", "containing", "sketch", "data", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/HeapAlphaSketch.java#L108-L139
Netflix/spectator
spectator-reg-servo/src/main/java/com/netflix/spectator/servo/ServoRegistry.java
ServoRegistry.toMonitorConfig
MonitorConfig toMonitorConfig(Id id, Tag stat) { MonitorConfig.Builder builder = new MonitorConfig.Builder(id.name()); if (stat != null) { builder.withTag(stat.key(), stat.value()); } for (Tag t : id.tags()) { builder.withTag(t.key(), t.value()); } return builder.build(); }
java
MonitorConfig toMonitorConfig(Id id, Tag stat) { MonitorConfig.Builder builder = new MonitorConfig.Builder(id.name()); if (stat != null) { builder.withTag(stat.key(), stat.value()); } for (Tag t : id.tags()) { builder.withTag(t.key(), t.value()); } return builder.build(); }
[ "MonitorConfig", "toMonitorConfig", "(", "Id", "id", ",", "Tag", "stat", ")", "{", "MonitorConfig", ".", "Builder", "builder", "=", "new", "MonitorConfig", ".", "Builder", "(", "id", ".", "name", "(", ")", ")", ";", "if", "(", "stat", "!=", "null", ")"...
Converts a spectator id into a MonitorConfig that can be used by servo.
[ "Converts", "a", "spectator", "id", "into", "a", "MonitorConfig", "that", "can", "be", "used", "by", "servo", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-servo/src/main/java/com/netflix/spectator/servo/ServoRegistry.java#L95-L104
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/suite/CompactionSuiteBase.java
CompactionSuiteBase.getCompactionCompleteActions
public List<CompactionCompleteAction<FileSystemDataset>> getCompactionCompleteActions() { ArrayList<CompactionCompleteAction<FileSystemDataset>> array = new ArrayList<>(); array.add(new CompactionCompleteFileOperationAction(state, configurator)); array.add(new CompactionHiveRegistrationAction(state)); array.add(new CompactionMarkDirectoryAction(state, configurator)); return array; }
java
public List<CompactionCompleteAction<FileSystemDataset>> getCompactionCompleteActions() { ArrayList<CompactionCompleteAction<FileSystemDataset>> array = new ArrayList<>(); array.add(new CompactionCompleteFileOperationAction(state, configurator)); array.add(new CompactionHiveRegistrationAction(state)); array.add(new CompactionMarkDirectoryAction(state, configurator)); return array; }
[ "public", "List", "<", "CompactionCompleteAction", "<", "FileSystemDataset", ">", ">", "getCompactionCompleteActions", "(", ")", "{", "ArrayList", "<", "CompactionCompleteAction", "<", "FileSystemDataset", ">>", "array", "=", "new", "ArrayList", "<>", "(", ")", ";",...
Some post actions are required after compaction job (map-reduce) is finished. @return A list of {@link CompactionCompleteAction}s which needs to be executed after map-reduce is done.
[ "Some", "post", "actions", "are", "required", "after", "compaction", "job", "(", "map", "-", "reduce", ")", "is", "finished", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/suite/CompactionSuiteBase.java#L117-L123
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/PhoneIntents.java
PhoneIntents.newSmsIntent
public static Intent newSmsIntent(Context context, String body, String[] phoneNumbers) { Uri smsUri; if (phoneNumbers == null || phoneNumbers.length==0) { smsUri = Uri.parse("smsto:"); } else { smsUri = Uri.parse("smsto:" + Uri.encode(TextUtils.join(",", phoneNumbers))); } Intent intent; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { intent = new Intent(Intent.ACTION_SENDTO, smsUri); intent.setPackage(Telephony.Sms.getDefaultSmsPackage(context)); } else { intent = new Intent(Intent.ACTION_VIEW, smsUri); } if (body!=null) { intent.putExtra("sms_body", body); } return intent; }
java
public static Intent newSmsIntent(Context context, String body, String[] phoneNumbers) { Uri smsUri; if (phoneNumbers == null || phoneNumbers.length==0) { smsUri = Uri.parse("smsto:"); } else { smsUri = Uri.parse("smsto:" + Uri.encode(TextUtils.join(",", phoneNumbers))); } Intent intent; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { intent = new Intent(Intent.ACTION_SENDTO, smsUri); intent.setPackage(Telephony.Sms.getDefaultSmsPackage(context)); } else { intent = new Intent(Intent.ACTION_VIEW, smsUri); } if (body!=null) { intent.putExtra("sms_body", body); } return intent; }
[ "public", "static", "Intent", "newSmsIntent", "(", "Context", "context", ",", "String", "body", ",", "String", "[", "]", "phoneNumbers", ")", "{", "Uri", "smsUri", ";", "if", "(", "phoneNumbers", "==", "null", "||", "phoneNumbers", ".", "length", "==", "0"...
Creates an intent that will allow to send an SMS to a phone number @param body The text to send @param phoneNumbers The phone numbers to send the SMS to (or null if you don't want to specify it) @return the intent
[ "Creates", "an", "intent", "that", "will", "allow", "to", "send", "an", "SMS", "to", "a", "phone", "number" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/PhoneIntents.java#L94-L115
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/request/RequestConfig.java
RequestConfig.with
public RequestConfig with(Heroku.RequestKey key, Map<Heroku.RequestKey, Either> value) { RequestConfig newConfig = copy(); newConfig.config.put(key, new Either(value)); return newConfig; }
java
public RequestConfig with(Heroku.RequestKey key, Map<Heroku.RequestKey, Either> value) { RequestConfig newConfig = copy(); newConfig.config.put(key, new Either(value)); return newConfig; }
[ "public", "RequestConfig", "with", "(", "Heroku", ".", "RequestKey", "key", ",", "Map", "<", "Heroku", ".", "RequestKey", ",", "Either", ">", "value", ")", "{", "RequestConfig", "newConfig", "=", "copy", "(", ")", ";", "newConfig", ".", "config", ".", "p...
Sets a {@link com.heroku.api.Heroku.RequestKey} parameter. @param key Heroku request key @param value value of the property @return A new {@link RequestConfig}
[ "Sets", "a", "{" ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/request/RequestConfig.java#L54-L58
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.isApptentivePushNotification
public static boolean isApptentivePushNotification(Map<String, String> data) { try { if (!ApptentiveInternal.checkRegistered()) { return false; } return ApptentiveInternal.getApptentivePushNotificationData(data) != null; } catch (Exception e) { ApptentiveLog.e(PUSH, e, "Exception while checking for Apptentive push notification data"); logException(e); } return false; }
java
public static boolean isApptentivePushNotification(Map<String, String> data) { try { if (!ApptentiveInternal.checkRegistered()) { return false; } return ApptentiveInternal.getApptentivePushNotificationData(data) != null; } catch (Exception e) { ApptentiveLog.e(PUSH, e, "Exception while checking for Apptentive push notification data"); logException(e); } return false; }
[ "public", "static", "boolean", "isApptentivePushNotification", "(", "Map", "<", "String", ",", "String", ">", "data", ")", "{", "try", "{", "if", "(", "!", "ApptentiveInternal", ".", "checkRegistered", "(", ")", ")", "{", "return", "false", ";", "}", "retu...
Determines whether push payload data came from an Apptentive push notification. @param data The push payload data obtained through FCM's RemoteMessage.getData(), when using FCM @return True if the push came from, and should be handled by Apptentive.
[ "Determines", "whether", "push", "payload", "data", "came", "from", "an", "Apptentive", "push", "notification", "." ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L535-L546
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java
BaseNeo4jAssociationQueries.initCreateRelationshipQuery
private static String initCreateRelationshipQuery(EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata) { EntityKeyMetadata targetEntityKeyMetadata = associationKeyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata(); int offset = 0; StringBuilder queryBuilder = new StringBuilder( "MATCH " ); appendEntityNode( "n", ownerEntityKeyMetadata, queryBuilder ); queryBuilder.append( ", " ); offset += ownerEntityKeyMetadata.getColumnNames().length; appendEntityNode( "t", targetEntityKeyMetadata, queryBuilder, offset ); queryBuilder.append( " MERGE (n)" ); queryBuilder.append( " -[r" ); queryBuilder.append( ":" ); appendRelationshipType( queryBuilder, associationKeyMetadata ); offset = ownerEntityKeyMetadata.getColumnNames().length; if ( associationKeyMetadata.getRowKeyIndexColumnNames().length > 0 ) { offset += targetEntityKeyMetadata.getColumnNames().length; appendProperties( queryBuilder, associationKeyMetadata.getRowKeyIndexColumnNames(), offset ); } queryBuilder.append( "]-> (t)" ); queryBuilder.append( " RETURN r" ); return queryBuilder.toString(); }
java
private static String initCreateRelationshipQuery(EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata) { EntityKeyMetadata targetEntityKeyMetadata = associationKeyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata(); int offset = 0; StringBuilder queryBuilder = new StringBuilder( "MATCH " ); appendEntityNode( "n", ownerEntityKeyMetadata, queryBuilder ); queryBuilder.append( ", " ); offset += ownerEntityKeyMetadata.getColumnNames().length; appendEntityNode( "t", targetEntityKeyMetadata, queryBuilder, offset ); queryBuilder.append( " MERGE (n)" ); queryBuilder.append( " -[r" ); queryBuilder.append( ":" ); appendRelationshipType( queryBuilder, associationKeyMetadata ); offset = ownerEntityKeyMetadata.getColumnNames().length; if ( associationKeyMetadata.getRowKeyIndexColumnNames().length > 0 ) { offset += targetEntityKeyMetadata.getColumnNames().length; appendProperties( queryBuilder, associationKeyMetadata.getRowKeyIndexColumnNames(), offset ); } queryBuilder.append( "]-> (t)" ); queryBuilder.append( " RETURN r" ); return queryBuilder.toString(); }
[ "private", "static", "String", "initCreateRelationshipQuery", "(", "EntityKeyMetadata", "ownerEntityKeyMetadata", ",", "AssociationKeyMetadata", "associationKeyMetadata", ")", "{", "EntityKeyMetadata", "targetEntityKeyMetadata", "=", "associationKeyMetadata", ".", "getAssociatedEnt...
/* MATCH (o:ENTITY:table1 {id: {0}}), (t:ENTITY:table2 {id: {1}}) MERGE (o) -[r:role {props}]-> (t) RETURN r
[ "/", "*", "MATCH", "(", "o", ":", "ENTITY", ":", "table1", "{", "id", ":", "{", "0", "}}", ")", "(", "t", ":", "ENTITY", ":", "table2", "{", "id", ":", "{", "1", "}}", ")", "MERGE", "(", "o", ")", "-", "[", "r", ":", "role", "{", "props",...
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java#L110-L130
tvesalainen/util
rpm/src/main/java/org/vesalainen/pm/deb/DEBBuilder.java
DEBBuilder.addFile
@Override public ComponentBuilder addFile(ByteBuffer content, String target) throws IOException { checkTarget(target); FileBuilder fb = new FileBuilder(target, content); fileBuilders.add(fb); return fb; }
java
@Override public ComponentBuilder addFile(ByteBuffer content, String target) throws IOException { checkTarget(target); FileBuilder fb = new FileBuilder(target, content); fileBuilders.add(fb); return fb; }
[ "@", "Override", "public", "ComponentBuilder", "addFile", "(", "ByteBuffer", "content", ",", "String", "target", ")", "throws", "IOException", "{", "checkTarget", "(", "target", ")", ";", "FileBuilder", "fb", "=", "new", "FileBuilder", "(", "target", ",", "con...
Add regular file to package. @param content @param target @return @throws IOException
[ "Add", "regular", "file", "to", "package", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/deb/DEBBuilder.java#L377-L384
baratine/baratine
web/src/main/java/com/caucho/v5/io/i18n/Encoding.java
Encoding.getReadEncoding
public static Reader getReadEncoding(InputStream is, String encoding) throws UnsupportedEncodingException { return getReadFactory(encoding).create(is); }
java
public static Reader getReadEncoding(InputStream is, String encoding) throws UnsupportedEncodingException { return getReadFactory(encoding).create(is); }
[ "public", "static", "Reader", "getReadEncoding", "(", "InputStream", "is", ",", "String", "encoding", ")", "throws", "UnsupportedEncodingException", "{", "return", "getReadFactory", "(", "encoding", ")", ".", "create", "(", "is", ")", ";", "}" ]
Returns a Reader to translate bytes to characters. If a specialized reader exists in com.caucho.v5.vfs.i18n, use it. @param is the input stream. @param encoding the encoding name. @return a reader for the translation
[ "Returns", "a", "Reader", "to", "translate", "bytes", "to", "characters", ".", "If", "a", "specialized", "reader", "exists", "in", "com", ".", "caucho", ".", "v5", ".", "vfs", ".", "i18n", "use", "it", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/i18n/Encoding.java#L121-L125
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/reflection/ClassInspector.java
ClassInspector.getTheNearestSuperClass
@Deprecated public static Class<?> getTheNearestSuperClass(Class<?> clazz1, Class<?> clazz2) { return intersectRawTypes(clazz1, clazz2).get(0); }
java
@Deprecated public static Class<?> getTheNearestSuperClass(Class<?> clazz1, Class<?> clazz2) { return intersectRawTypes(clazz1, clazz2).get(0); }
[ "@", "Deprecated", "public", "static", "Class", "<", "?", ">", "getTheNearestSuperClass", "(", "Class", "<", "?", ">", "clazz1", ",", "Class", "<", "?", ">", "clazz2", ")", "{", "return", "intersectRawTypes", "(", "clazz1", ",", "clazz2", ")", ".", "get"...
Looks for intersection of raw types of classes and all super classes and interfaces @param clazz1 one of the classes to intersect. @param clazz2 one of the classes to intersect. @deprecated use {@link #intersectRawTypes} @return #interectRawTypes(clazz1, clazz2).get(0)
[ "Looks", "for", "intersection", "of", "raw", "types", "of", "classes", "and", "all", "super", "classes", "and", "interfaces" ]
train
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/reflection/ClassInspector.java#L211-L214
jwtk/jjwt
api/src/main/java/io/jsonwebtoken/lang/Strings.java
Strings.splitArrayElementsIntoProperties
public static Properties splitArrayElementsIntoProperties(String[] array, String delimiter) { return splitArrayElementsIntoProperties(array, delimiter, null); }
java
public static Properties splitArrayElementsIntoProperties(String[] array, String delimiter) { return splitArrayElementsIntoProperties(array, delimiter, null); }
[ "public", "static", "Properties", "splitArrayElementsIntoProperties", "(", "String", "[", "]", "array", ",", "String", "delimiter", ")", "{", "return", "splitArrayElementsIntoProperties", "(", "array", ",", "delimiter", ",", "null", ")", ";", "}" ]
Take an array Strings and split each element based on the given delimiter. A <code>Properties</code> instance is then generated, with the left of the delimiter providing the key, and the right of the delimiter providing the value. <p>Will trim both the key and value before adding them to the <code>Properties</code> instance. @param array the array to process @param delimiter to split each element using (typically the equals symbol) @return a <code>Properties</code> instance representing the array contents, or <code>null</code> if the array to process was null or empty
[ "Take", "an", "array", "Strings", "and", "split", "each", "element", "based", "on", "the", "given", "delimiter", ".", "A", "<code", ">", "Properties<", "/", "code", ">", "instance", "is", "then", "generated", "with", "the", "left", "of", "the", "delimiter"...
train
https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Strings.java#L891-L893
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.writeStringToFile
public static boolean writeStringToFile(final File file, final String string2write, final String encoding) throws FileNotFoundException, IOException { boolean iswritten = true; try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos); OutputStreamWriter osw = (null == encoding) ? new OutputStreamWriter(bos) : new OutputStreamWriter(bos, encoding); PrintWriter printWriter = new PrintWriter(osw);) { printWriter.write(string2write); } return iswritten; }
java
public static boolean writeStringToFile(final File file, final String string2write, final String encoding) throws FileNotFoundException, IOException { boolean iswritten = true; try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos); OutputStreamWriter osw = (null == encoding) ? new OutputStreamWriter(bos) : new OutputStreamWriter(bos, encoding); PrintWriter printWriter = new PrintWriter(osw);) { printWriter.write(string2write); } return iswritten; }
[ "public", "static", "boolean", "writeStringToFile", "(", "final", "File", "file", ",", "final", "String", "string2write", ",", "final", "String", "encoding", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "boolean", "iswritten", "=", "true", ";",...
The Method writeStringToFile(File, String, String) writes the String to the File. @param file The File to write the String. @param string2write The String to write into the File. @param encoding The encoding from the file. @return The Method return true if the String was write successfull to the file otherwise false. @throws FileNotFoundException is thrown if an attempt to open the file denoted by a specified pathname has failed. @throws IOException Signals that an I/O exception has occurred.
[ "The", "Method", "writeStringToFile", "(", "File", "String", "String", ")", "writes", "the", "String", "to", "the", "File", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L343-L357
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookSignatureUtil.java
FacebookSignatureUtil.verifySignature
public static boolean verifySignature(EnumMap<FacebookParam, CharSequence> params, String secret, String expected) { assert !(null == secret || "".equals(secret)); if (null == params || params.isEmpty() ) return false; if (null == expected || "".equals(expected)) { return false; } params.remove(FacebookParam.SIGNATURE); List<String> sigParams = convertFacebookParams(params.entrySet()); return verifySignature(sigParams, secret, expected); }
java
public static boolean verifySignature(EnumMap<FacebookParam, CharSequence> params, String secret, String expected) { assert !(null == secret || "".equals(secret)); if (null == params || params.isEmpty() ) return false; if (null == expected || "".equals(expected)) { return false; } params.remove(FacebookParam.SIGNATURE); List<String> sigParams = convertFacebookParams(params.entrySet()); return verifySignature(sigParams, secret, expected); }
[ "public", "static", "boolean", "verifySignature", "(", "EnumMap", "<", "FacebookParam", ",", "CharSequence", ">", "params", ",", "String", "secret", ",", "String", "expected", ")", "{", "assert", "!", "(", "null", "==", "secret", "||", "\"\"", ".", "equals",...
Verifies that a signature received matches the expected value. @param params a map of parameters and their values, such as one obtained from extractFacebookParams @return a boolean indicating whether the calculated signature matched the expected signature
[ "Verifies", "that", "a", "signature", "received", "matches", "the", "expected", "value", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookSignatureUtil.java#L160-L171
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/NetUtils.java
NetUtils.getDefaultSocketFactory
public static SocketFactory getDefaultSocketFactory(Configuration conf) { String propValue = conf.get("hadoop.rpc.socket.factory.class.default"); if ((propValue == null) || (propValue.length() == 0)) return SocketFactory.getDefault(); return getSocketFactoryFromProperty(conf, propValue); }
java
public static SocketFactory getDefaultSocketFactory(Configuration conf) { String propValue = conf.get("hadoop.rpc.socket.factory.class.default"); if ((propValue == null) || (propValue.length() == 0)) return SocketFactory.getDefault(); return getSocketFactoryFromProperty(conf, propValue); }
[ "public", "static", "SocketFactory", "getDefaultSocketFactory", "(", "Configuration", "conf", ")", "{", "String", "propValue", "=", "conf", ".", "get", "(", "\"hadoop.rpc.socket.factory.class.default\"", ")", ";", "if", "(", "(", "propValue", "==", "null", ")", "|...
Get the default socket factory as specified by the configuration parameter <tt>hadoop.rpc.socket.factory.default</tt> @param conf the configuration @return the default socket factory as specified in the configuration or the JVM default socket factory if the configuration does not contain a default socket factory property.
[ "Get", "the", "default", "socket", "factory", "as", "specified", "by", "the", "configuration", "parameter", "<tt", ">", "hadoop", ".", "rpc", ".", "socket", ".", "factory", ".", "default<", "/", "tt", ">" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetUtils.java#L111-L118
dottydingo/hyperion
client/src/main/java/com/dottydingo/hyperion/client/builder/query/QueryBuilder.java
QueryBuilder.ne
public QueryExpression ne(String propertyName,String value) { return new SimpleQueryExpression(propertyName, ComparisonOperator.NOT_EQUAL,wrap(value)); }
java
public QueryExpression ne(String propertyName,String value) { return new SimpleQueryExpression(propertyName, ComparisonOperator.NOT_EQUAL,wrap(value)); }
[ "public", "QueryExpression", "ne", "(", "String", "propertyName", ",", "String", "value", ")", "{", "return", "new", "SimpleQueryExpression", "(", "propertyName", ",", "ComparisonOperator", ".", "NOT_EQUAL", ",", "wrap", "(", "value", ")", ")", ";", "}" ]
Create a not equals expression @param propertyName The propery name @param value The value @return The query expression
[ "Create", "a", "not", "equals", "expression" ]
train
https://github.com/dottydingo/hyperion/blob/c4d119c90024a88c0335d7d318e9ccdb70149764/client/src/main/java/com/dottydingo/hyperion/client/builder/query/QueryBuilder.java#L92-L95
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/MergeRequestApi.java
MergeRequestApi.approveMergeRequest
public MergeRequest approveMergeRequest(Object projectIdOrPath, Integer mergeRequestIid, String sha) throws GitLabApiException { if (mergeRequestIid == null) { throw new RuntimeException("mergeRequestIid cannot be null"); } Form formData = new GitLabApiForm().withParam("sha", sha); Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "approve"); return (response.readEntity(MergeRequest.class)); }
java
public MergeRequest approveMergeRequest(Object projectIdOrPath, Integer mergeRequestIid, String sha) throws GitLabApiException { if (mergeRequestIid == null) { throw new RuntimeException("mergeRequestIid cannot be null"); } Form formData = new GitLabApiForm().withParam("sha", sha); Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "approve"); return (response.readEntity(MergeRequest.class)); }
[ "public", "MergeRequest", "approveMergeRequest", "(", "Object", "projectIdOrPath", ",", "Integer", "mergeRequestIid", ",", "String", "sha", ")", "throws", "GitLabApiException", "{", "if", "(", "mergeRequestIid", "==", "null", ")", "{", "throw", "new", "RuntimeExcept...
Approve a merge request. Note: This API endpoint is only available on 8.9 EE and above. <pre><code>GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/approve</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param mergeRequestIid the internal ID of the merge request @param sha the HEAD of the merge request, optional @return a MergeRequest instance with approval information included @throws GitLabApiException if any exception occurs
[ "Approve", "a", "merge", "request", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/MergeRequestApi.java#L719-L728
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java
ParsedScheduleExpression.getNextDayOfWeek
private int getNextDayOfWeek(int day, int dayOfWeek) { if (!contains(daysOfWeek, dayOfWeek)) { long higher = higher(daysOfWeek, dayOfWeek); if (higher != 0) { return day + (first(higher) - dayOfWeek); } return day + (7 - dayOfWeek) + first(daysOfWeek); } return day; }
java
private int getNextDayOfWeek(int day, int dayOfWeek) { if (!contains(daysOfWeek, dayOfWeek)) { long higher = higher(daysOfWeek, dayOfWeek); if (higher != 0) { return day + (first(higher) - dayOfWeek); } return day + (7 - dayOfWeek) + first(daysOfWeek); } return day; }
[ "private", "int", "getNextDayOfWeek", "(", "int", "day", ",", "int", "dayOfWeek", ")", "{", "if", "(", "!", "contains", "(", "daysOfWeek", ",", "dayOfWeek", ")", ")", "{", "long", "higher", "=", "higher", "(", "daysOfWeek", ",", "dayOfWeek", ")", ";", ...
Returns the next day of the month after <tt>day</tt> that satisfies the dayOfWeek constraint. @param day the current 0-based day of the month @param dayOfWeek the current 0-based day of the week @return a value greater than or equal to <tt>day</tt>
[ "Returns", "the", "next", "day", "of", "the", "month", "after", "<tt", ">", "day<", "/", "tt", ">", "that", "satisfies", "the", "dayOfWeek", "constraint", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java#L969-L983
kejunxia/AndroidMvc
library/poke/src/main/java/com/shipdream/lib/poke/Provider.java
Provider.notifyReferenced
void notifyReferenced(Provider provider, T instance) { notifyInstanceCreationWhenNeeded(); if (referencedListeners != null) { int len = referencedListeners.size(); for(int i = 0; i < len; i++) { referencedListeners.get(i).onReferenced(provider, instance); } } }
java
void notifyReferenced(Provider provider, T instance) { notifyInstanceCreationWhenNeeded(); if (referencedListeners != null) { int len = referencedListeners.size(); for(int i = 0; i < len; i++) { referencedListeners.get(i).onReferenced(provider, instance); } } }
[ "void", "notifyReferenced", "(", "Provider", "provider", ",", "T", "instance", ")", "{", "notifyInstanceCreationWhenNeeded", "(", ")", ";", "if", "(", "referencedListeners", "!=", "null", ")", "{", "int", "len", "=", "referencedListeners", ".", "size", "(", ")...
Notify the instance with the given type is <b>FULLY</b> injected which means all of its nested injectable fields are injected and ready <b>RECURSIVELY</b>. <p>This method should get called every time the instance is injected, no matter if it's a newly created instance or it's a reused cached instance.</p> @param instance The instance. Its own injectable members should have been injected recursively as well.
[ "Notify", "the", "instance", "with", "the", "given", "type", "is", "<b", ">", "FULLY<", "/", "b", ">", "injected", "which", "means", "all", "of", "its", "nested", "injectable", "fields", "are", "injected", "and", "ready", "<b", ">", "RECURSIVELY<", "/", ...
train
https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/library/poke/src/main/java/com/shipdream/lib/poke/Provider.java#L401-L410
vlingo/vlingo-http
src/main/java/io/vlingo/http/resource/StaticFilesResource.java
StaticFilesResource.serveFile
public void serveFile(final String contentFile, final String root, final String validSubPaths) { if (rootPath == null) { final String slash = root.endsWith("/") ? "" : "/"; rootPath = root + slash; } final String contentPath = rootPath + context.request.uri; try { final byte[] fileContent = readFile(contentPath); completes().with(Response.of(Ok, Body.from(fileContent, Body.Encoding.UTF8).content)); } catch (IOException e) { completes().with(Response.of(InternalServerError)); } catch (IllegalArgumentException e) { completes().with(Response.of(NotFound)); } }
java
public void serveFile(final String contentFile, final String root, final String validSubPaths) { if (rootPath == null) { final String slash = root.endsWith("/") ? "" : "/"; rootPath = root + slash; } final String contentPath = rootPath + context.request.uri; try { final byte[] fileContent = readFile(contentPath); completes().with(Response.of(Ok, Body.from(fileContent, Body.Encoding.UTF8).content)); } catch (IOException e) { completes().with(Response.of(InternalServerError)); } catch (IllegalArgumentException e) { completes().with(Response.of(NotFound)); } }
[ "public", "void", "serveFile", "(", "final", "String", "contentFile", ",", "final", "String", "root", ",", "final", "String", "validSubPaths", ")", "{", "if", "(", "rootPath", "==", "null", ")", "{", "final", "String", "slash", "=", "root", ".", "endsWith"...
Completes with {@code Ok} and the file content or {@code NotFound}. @param contentFile the String name of the content file to be served @param root the String root path of the static content @param validSubPaths the String indicating the valid file paths under the root
[ "Completes", "with", "{" ]
train
https://github.com/vlingo/vlingo-http/blob/746065fb1eaf1609c550ae45e96e3dbb9bfa37a2/src/main/java/io/vlingo/http/resource/StaticFilesResource.java#L38-L54
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java
DecoratorProxyFactory.addHandlerInitializerMethod
private void addHandlerInitializerMethod(ClassFile proxyClassType, ClassMethod staticConstructor) throws Exception { ClassMethod classMethod = proxyClassType.addMethod(AccessFlag.PRIVATE, INIT_MH_METHOD_NAME, BytecodeUtils.VOID_CLASS_DESCRIPTOR, LJAVA_LANG_OBJECT); final CodeAttribute b = classMethod.getCodeAttribute(); b.aload(0); StaticMethodInformation methodInfo = new StaticMethodInformation(INIT_MH_METHOD_NAME, new Class[] { Object.class }, void.class, classMethod.getClassFile().getName()); invokeMethodHandler(classMethod, methodInfo, false, DEFAULT_METHOD_RESOLVER, staticConstructor); b.checkcast(MethodHandler.class); b.putfield(classMethod.getClassFile().getName(), METHOD_HANDLER_FIELD_NAME, DescriptorUtils.makeDescriptor(MethodHandler.class)); b.returnInstruction(); BeanLogger.LOG.createdMethodHandlerInitializerForDecoratorProxy(getBeanType()); }
java
private void addHandlerInitializerMethod(ClassFile proxyClassType, ClassMethod staticConstructor) throws Exception { ClassMethod classMethod = proxyClassType.addMethod(AccessFlag.PRIVATE, INIT_MH_METHOD_NAME, BytecodeUtils.VOID_CLASS_DESCRIPTOR, LJAVA_LANG_OBJECT); final CodeAttribute b = classMethod.getCodeAttribute(); b.aload(0); StaticMethodInformation methodInfo = new StaticMethodInformation(INIT_MH_METHOD_NAME, new Class[] { Object.class }, void.class, classMethod.getClassFile().getName()); invokeMethodHandler(classMethod, methodInfo, false, DEFAULT_METHOD_RESOLVER, staticConstructor); b.checkcast(MethodHandler.class); b.putfield(classMethod.getClassFile().getName(), METHOD_HANDLER_FIELD_NAME, DescriptorUtils.makeDescriptor(MethodHandler.class)); b.returnInstruction(); BeanLogger.LOG.createdMethodHandlerInitializerForDecoratorProxy(getBeanType()); }
[ "private", "void", "addHandlerInitializerMethod", "(", "ClassFile", "proxyClassType", ",", "ClassMethod", "staticConstructor", ")", "throws", "Exception", "{", "ClassMethod", "classMethod", "=", "proxyClassType", ".", "addMethod", "(", "AccessFlag", ".", "PRIVATE", ",",...
calls _initMH on the method handler and then stores the result in the methodHandler field as then new methodHandler
[ "calls", "_initMH", "on", "the", "method", "handler", "and", "then", "stores", "the", "result", "in", "the", "methodHandler", "field", "as", "then", "new", "methodHandler" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java#L81-L93
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/StatementExecutor.java
StatementExecutor.updateId
public int updateId(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache) throws SQLException { if (mappedUpdateId == null) { mappedUpdateId = MappedUpdateId.build(dao, tableInfo); } int result = mappedUpdateId.execute(databaseConnection, data, newId, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
java
public int updateId(DatabaseConnection databaseConnection, T data, ID newId, ObjectCache objectCache) throws SQLException { if (mappedUpdateId == null) { mappedUpdateId = MappedUpdateId.build(dao, tableInfo); } int result = mappedUpdateId.execute(databaseConnection, data, newId, objectCache); if (dao != null && !localIsInBatchMode.get()) { dao.notifyChanges(); } return result; }
[ "public", "int", "updateId", "(", "DatabaseConnection", "databaseConnection", ",", "T", "data", ",", "ID", "newId", ",", "ObjectCache", "objectCache", ")", "throws", "SQLException", "{", "if", "(", "mappedUpdateId", "==", "null", ")", "{", "mappedUpdateId", "=",...
Update an object in the database to change its id to the newId parameter.
[ "Update", "an", "object", "in", "the", "database", "to", "change", "its", "id", "to", "the", "newId", "parameter", "." ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L482-L492
apache/flink
flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
RestClusterClient.pollResourceAsync
private <R, A extends AsynchronouslyCreatedResource<R>> CompletableFuture<R> pollResourceAsync( final Supplier<CompletableFuture<A>> resourceFutureSupplier) { return pollResourceAsync(resourceFutureSupplier, new CompletableFuture<>(), 0); }
java
private <R, A extends AsynchronouslyCreatedResource<R>> CompletableFuture<R> pollResourceAsync( final Supplier<CompletableFuture<A>> resourceFutureSupplier) { return pollResourceAsync(resourceFutureSupplier, new CompletableFuture<>(), 0); }
[ "private", "<", "R", ",", "A", "extends", "AsynchronouslyCreatedResource", "<", "R", ">", ">", "CompletableFuture", "<", "R", ">", "pollResourceAsync", "(", "final", "Supplier", "<", "CompletableFuture", "<", "A", ">", ">", "resourceFutureSupplier", ")", "{", ...
Creates a {@code CompletableFuture} that polls a {@code AsynchronouslyCreatedResource} until its {@link AsynchronouslyCreatedResource#queueStatus() QueueStatus} becomes {@link QueueStatus.Id#COMPLETED COMPLETED}. The future completes with the result of {@link AsynchronouslyCreatedResource#resource()}. @param resourceFutureSupplier The operation which polls for the {@code AsynchronouslyCreatedResource}. @param <R> The type of the resource. @param <A> The type of the {@code AsynchronouslyCreatedResource}. @return A {@code CompletableFuture} delivering the resource.
[ "Creates", "a", "{", "@code", "CompletableFuture", "}", "that", "polls", "a", "{", "@code", "AsynchronouslyCreatedResource", "}", "until", "its", "{", "@link", "AsynchronouslyCreatedResource#queueStatus", "()", "QueueStatus", "}", "becomes", "{", "@link", "QueueStatus...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java#L584-L587
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java
CustomerAccountUrl.getLoginStateByUserNameUrl
public static MozuUrl getLoginStateByUserNameUrl(String customerSetCode, String responseFields, String userName) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/loginstatebyusername?userName={userName}&customerSetCode={customerSetCode}&responseFields={responseFields}"); formatter.formatUrl("customerSetCode", customerSetCode); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("userName", userName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getLoginStateByUserNameUrl(String customerSetCode, String responseFields, String userName) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/loginstatebyusername?userName={userName}&customerSetCode={customerSetCode}&responseFields={responseFields}"); formatter.formatUrl("customerSetCode", customerSetCode); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("userName", userName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getLoginStateByUserNameUrl", "(", "String", "customerSetCode", ",", "String", "responseFields", ",", "String", "userName", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/accounts/loginstateby...
Get Resource Url for GetLoginStateByUserName @param customerSetCode The unique idenfitier of the customer set. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param userName The user name associated with the customer account. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetLoginStateByUserName" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java#L217-L224
jdereg/java-util
src/main/java/com/cedarsoftware/util/ProxyFactory.java
ProxyFactory.create
public static <T> T create(ClassLoader loader, Class<T> intf, InvocationHandler h) { return (T)Proxy.newProxyInstance(loader, new Class[]{intf}, h); }
java
public static <T> T create(ClassLoader loader, Class<T> intf, InvocationHandler h) { return (T)Proxy.newProxyInstance(loader, new Class[]{intf}, h); }
[ "public", "static", "<", "T", ">", "T", "create", "(", "ClassLoader", "loader", ",", "Class", "<", "T", ">", "intf", ",", "InvocationHandler", "h", ")", "{", "return", "(", "T", ")", "Proxy", ".", "newProxyInstance", "(", "loader", ",", "new", "Class",...
Returns an instance of a proxy class for the specified interfaces that dispatches method invocations to the specified invocation handler. @param loader the class loader to define the proxy class @param intf the interface for the proxy to implement @param h the invocation handler to dispatch method invocations to @return a proxy instance with the specified invocation handler of a proxy class that is defined by the specified class loader and that implements the specified interfaces @throws IllegalArgumentException if any of the restrictions on the parameters that may be passed to <code>getProxyClass</code> are violated @throws NullPointerException if the <code>interfaces</code> array argument or any of its elements are <code>null</code>, or if the invocation handler, <code>h</code>, is <code>null</code>
[ "Returns", "an", "instance", "of", "a", "proxy", "class", "for", "the", "specified", "interfaces", "that", "dispatches", "method", "invocations", "to", "the", "specified", "invocation", "handler", "." ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/ProxyFactory.java#L73-L75
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java
FeatureCollection.fromFeatures
public static FeatureCollection fromFeatures(@NonNull List<Feature> features, @Nullable BoundingBox bbox) { return new FeatureCollection(TYPE, bbox, features); }
java
public static FeatureCollection fromFeatures(@NonNull List<Feature> features, @Nullable BoundingBox bbox) { return new FeatureCollection(TYPE, bbox, features); }
[ "public", "static", "FeatureCollection", "fromFeatures", "(", "@", "NonNull", "List", "<", "Feature", ">", "features", ",", "@", "Nullable", "BoundingBox", "bbox", ")", "{", "return", "new", "FeatureCollection", "(", "TYPE", ",", "bbox", ",", "features", ")", ...
Create a new instance of this class by giving the feature collection a list of {@link Feature}s. The list of features itself isn't null but it can be empty and have a size of 0. @param features a list of features @param bbox optionally include a bbox definition as a double array @return a new instance of this class defined by the values passed inside this static factory method @since 3.0.0
[ "Create", "a", "new", "instance", "of", "this", "class", "by", "giving", "the", "feature", "collection", "a", "list", "of", "{", "@link", "Feature", "}", "s", ".", "The", "list", "of", "features", "itself", "isn", "t", "null", "but", "it", "can", "be",...
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java#L125-L128
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/upload/SketchHex.java
SketchHex.create
public static SketchHex create(String sketchName, String hexString) throws HexParsingException { if (sketchName.length() > Constants.MAX_SKETCH_NAME_LENGTH) { sketchName = sketchName.substring(0, Constants.MAX_SKETCH_NAME_LENGTH); } List<Line> lines = parseHexStringToLines(hexString); byte[] bytes = convertLinesToBytes(lines); return new AutoParcel_SketchHex(sketchName, bytes); }
java
public static SketchHex create(String sketchName, String hexString) throws HexParsingException { if (sketchName.length() > Constants.MAX_SKETCH_NAME_LENGTH) { sketchName = sketchName.substring(0, Constants.MAX_SKETCH_NAME_LENGTH); } List<Line> lines = parseHexStringToLines(hexString); byte[] bytes = convertLinesToBytes(lines); return new AutoParcel_SketchHex(sketchName, bytes); }
[ "public", "static", "SketchHex", "create", "(", "String", "sketchName", ",", "String", "hexString", ")", "throws", "HexParsingException", "{", "if", "(", "sketchName", ".", "length", "(", ")", ">", "Constants", ".", "MAX_SKETCH_NAME_LENGTH", ")", "{", "sketchNam...
Initialize a SketchHex object with a string of Intel Hex data. @param sketchName The name of the sketch. @param hexString The Intel Hex data as a string @return The new SketchHex object @throws com.punchthrough.bean.sdk.internal.exception.HexParsingException if the string data being parsed is not valid Intel Hex
[ "Initialize", "a", "SketchHex", "object", "with", "a", "string", "of", "Intel", "Hex", "data", "." ]
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/upload/SketchHex.java#L56-L65
d-michail/jheaps
src/main/java/org/jheaps/tree/ReflectedHeap.java
ReflectedHeap.insertPair
@SuppressWarnings("unchecked") private void insertPair(ReflectedHandle<K, V> handle1, ReflectedHandle<K, V> handle2) { int c; if (comparator == null) { c = ((Comparable<? super K>) handle1.key).compareTo(handle2.key); } else { c = comparator.compare(handle1.key, handle2.key); } AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle1; AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle2; if (c <= 0) { innerHandle1 = minHeap.insert(handle1.key); handle1.minNotMax = true; innerHandle2 = maxHeap.insert(handle2.key); handle2.minNotMax = false; } else { innerHandle1 = maxHeap.insert(handle1.key); handle1.minNotMax = false; innerHandle2 = minHeap.insert(handle2.key); handle2.minNotMax = true; } handle1.inner = innerHandle1; handle2.inner = innerHandle2; innerHandle1.setValue(new HandleMap<K, V>(handle1, innerHandle2)); innerHandle2.setValue(new HandleMap<K, V>(handle2, innerHandle1)); }
java
@SuppressWarnings("unchecked") private void insertPair(ReflectedHandle<K, V> handle1, ReflectedHandle<K, V> handle2) { int c; if (comparator == null) { c = ((Comparable<? super K>) handle1.key).compareTo(handle2.key); } else { c = comparator.compare(handle1.key, handle2.key); } AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle1; AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle2; if (c <= 0) { innerHandle1 = minHeap.insert(handle1.key); handle1.minNotMax = true; innerHandle2 = maxHeap.insert(handle2.key); handle2.minNotMax = false; } else { innerHandle1 = maxHeap.insert(handle1.key); handle1.minNotMax = false; innerHandle2 = minHeap.insert(handle2.key); handle2.minNotMax = true; } handle1.inner = innerHandle1; handle2.inner = innerHandle2; innerHandle1.setValue(new HandleMap<K, V>(handle1, innerHandle2)); innerHandle2.setValue(new HandleMap<K, V>(handle2, innerHandle1)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "insertPair", "(", "ReflectedHandle", "<", "K", ",", "V", ">", "handle1", ",", "ReflectedHandle", "<", "K", ",", "V", ">", "handle2", ")", "{", "int", "c", ";", "if", "(", "comparator...
Insert a pair of elements, one in the min heap and one in the max heap. @param handle1 a handle to the first element @param handle2 a handle to the second element
[ "Insert", "a", "pair", "of", "elements", "one", "in", "the", "min", "heap", "and", "one", "in", "the", "max", "heap", "." ]
train
https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/tree/ReflectedHeap.java#L510-L538
katharsis-project/katharsis-framework
katharsis-jpa/src/main/java/io/katharsis/jpa/internal/JpaRepositoryUtils.java
JpaRepositoryUtils.addMergeInclusions
private static void addMergeInclusions(JpaQueryExecutor<?> executor, QuerySpec querySpec) { ArrayDeque<String> attributePath = new ArrayDeque<>(); Class<?> resourceClass = querySpec.getResourceClass(); addMergeInclusions(attributePath, executor, resourceClass); }
java
private static void addMergeInclusions(JpaQueryExecutor<?> executor, QuerySpec querySpec) { ArrayDeque<String> attributePath = new ArrayDeque<>(); Class<?> resourceClass = querySpec.getResourceClass(); addMergeInclusions(attributePath, executor, resourceClass); }
[ "private", "static", "void", "addMergeInclusions", "(", "JpaQueryExecutor", "<", "?", ">", "executor", ",", "QuerySpec", "querySpec", ")", "{", "ArrayDeque", "<", "String", ">", "attributePath", "=", "new", "ArrayDeque", "<>", "(", ")", ";", "Class", "<", "?...
related attribute that are merged into a resource should be loaded by graph control to avoid lazy-loading or potential lack of session in serialization.
[ "related", "attribute", "that", "are", "merged", "into", "a", "resource", "should", "be", "loaded", "by", "graph", "control", "to", "avoid", "lazy", "-", "loading", "or", "potential", "lack", "of", "session", "in", "serialization", "." ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-jpa/src/main/java/io/katharsis/jpa/internal/JpaRepositoryUtils.java#L88-L93
h2oai/h2o-3
h2o-core/src/main/java/water/rapids/ast/prims/assign/AstRecAsgnHelper.java
AstRecAsgnHelper.createValueSetter
public static ValueSetter createValueSetter(Vec v, Object value) { if (value == null) { return new NAValueSetter(); } switch (v.get_type()) { case Vec.T_CAT: return new CatValueSetter(v.domain(), value); case Vec.T_NUM: case Vec.T_TIME: return new NumValueSetter(value); case Vec.T_STR: return new StrValueSetter(value); case Vec.T_UUID: return new UUIDValueSetter(value); default: throw new IllegalArgumentException("Cannot create ValueSetter for a Vec of type = " + v.get_type_str()); } }
java
public static ValueSetter createValueSetter(Vec v, Object value) { if (value == null) { return new NAValueSetter(); } switch (v.get_type()) { case Vec.T_CAT: return new CatValueSetter(v.domain(), value); case Vec.T_NUM: case Vec.T_TIME: return new NumValueSetter(value); case Vec.T_STR: return new StrValueSetter(value); case Vec.T_UUID: return new UUIDValueSetter(value); default: throw new IllegalArgumentException("Cannot create ValueSetter for a Vec of type = " + v.get_type_str()); } }
[ "public", "static", "ValueSetter", "createValueSetter", "(", "Vec", "v", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "new", "NAValueSetter", "(", ")", ";", "}", "switch", "(", "v", ".", "get_type", "(", ")", ...
Create an instance of ValueSetter for a given scalar value. It creates setter of the appropriate type based on the type of the underlying Vec. @param v Vec @param value scalar value @return instance of ValueSetter
[ "Create", "an", "instance", "of", "ValueSetter", "for", "a", "given", "scalar", "value", ".", "It", "creates", "setter", "of", "the", "appropriate", "type", "based", "on", "the", "type", "of", "the", "underlying", "Vec", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/ast/prims/assign/AstRecAsgnHelper.java#L35-L52
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/Swagger2MarkupProperties.java
Swagger2MarkupProperties.getRequiredString
public String getRequiredString(String key) throws IllegalStateException { Optional<String> property = getString(key); if (property.isPresent()) { return property.get(); } else { throw new IllegalStateException(String.format("required key [%s] not found", key)); } }
java
public String getRequiredString(String key) throws IllegalStateException { Optional<String> property = getString(key); if (property.isPresent()) { return property.get(); } else { throw new IllegalStateException(String.format("required key [%s] not found", key)); } }
[ "public", "String", "getRequiredString", "(", "String", "key", ")", "throws", "IllegalStateException", "{", "Optional", "<", "String", ">", "property", "=", "getString", "(", "key", ")", ";", "if", "(", "property", ".", "isPresent", "(", ")", ")", "{", "re...
Return the String property value associated with the given key (never {@code null}). @return The String property @throws IllegalStateException if the key cannot be resolved
[ "Return", "the", "String", "property", "value", "associated", "with", "the", "given", "key", "(", "never", "{", "@code", "null", "}", ")", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/Swagger2MarkupProperties.java#L333-L340
ixa-ehu/ixa-pipe-pos
src/main/java/eus/ixa/ixa/pipe/pos/dict/MultiWordMatcher.java
MultiWordMatcher.multiWordsToSpans
public final Span[] multiWordsToSpans(final String[] tokens) { final List<Span> multiWordsFound = new LinkedList<Span>(); for (int offsetFrom = 0; offsetFrom < tokens.length; offsetFrom++) { Span multiwordFound = null; String tokensSearching[] = new String[] {}; for (int offsetTo = offsetFrom; offsetTo < tokens.length; offsetTo++) { final int lengthSearching = offsetTo - offsetFrom + 1; if (lengthSearching > getMaxTokenCount()) { break; } else { tokensSearching = new String[lengthSearching]; System.arraycopy(tokens, offsetFrom, tokensSearching, 0, lengthSearching); final String entryForSearch = StringUtils .getStringFromTokens(tokensSearching); final String entryValue = dictionary .get(entryForSearch.toLowerCase()); if (entryValue != null) { multiwordFound = new Span(offsetFrom, offsetTo + 1, entryValue); } } } if (multiwordFound != null) { multiWordsFound.add(multiwordFound); offsetFrom += multiwordFound.length() - 1; } } return multiWordsFound.toArray(new Span[multiWordsFound.size()]); }
java
public final Span[] multiWordsToSpans(final String[] tokens) { final List<Span> multiWordsFound = new LinkedList<Span>(); for (int offsetFrom = 0; offsetFrom < tokens.length; offsetFrom++) { Span multiwordFound = null; String tokensSearching[] = new String[] {}; for (int offsetTo = offsetFrom; offsetTo < tokens.length; offsetTo++) { final int lengthSearching = offsetTo - offsetFrom + 1; if (lengthSearching > getMaxTokenCount()) { break; } else { tokensSearching = new String[lengthSearching]; System.arraycopy(tokens, offsetFrom, tokensSearching, 0, lengthSearching); final String entryForSearch = StringUtils .getStringFromTokens(tokensSearching); final String entryValue = dictionary .get(entryForSearch.toLowerCase()); if (entryValue != null) { multiwordFound = new Span(offsetFrom, offsetTo + 1, entryValue); } } } if (multiwordFound != null) { multiWordsFound.add(multiwordFound); offsetFrom += multiwordFound.length() - 1; } } return multiWordsFound.toArray(new Span[multiWordsFound.size()]); }
[ "public", "final", "Span", "[", "]", "multiWordsToSpans", "(", "final", "String", "[", "]", "tokens", ")", "{", "final", "List", "<", "Span", ">", "multiWordsFound", "=", "new", "LinkedList", "<", "Span", ">", "(", ")", ";", "for", "(", "int", "offsetF...
Detects multiword expressions ignoring case. @param tokens the tokenized sentence @return spans of the multiword
[ "Detects", "multiword", "expressions", "ignoring", "case", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/dict/MultiWordMatcher.java#L184-L216
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/NarAssemblyMojo.java
NarAssemblyMojo.narExecute
@Override public final void narExecute() throws MojoExecutionException, MojoFailureException { // download the dependencies if needed in local maven repository. List<AttachedNarArtifact> attachedNarArtifacts = getAttachedNarArtifacts(libraries); downloadAttachedNars(attachedNarArtifacts); // Warning, for SNAPSHOT artifacts that were not in the local maven // repository, the downloadAttachedNars // method above modified the version in the AttachedNarArtifact object to // set the timestamp version from // the web repository. // In order to unpack the files with the correct names we need to get back // the AttachedNarArtifact objects with // -SNAPSHOT versions, so we call again getAttachedNarArtifacts() to get the // unmodified AttachedNarArtifact // objects attachedNarArtifacts = getAttachedNarArtifacts(libraries); unpackAttachedNars(attachedNarArtifacts); // this may make some extra copies... for (final Object element : attachedNarArtifacts) { final Artifact dependency = (Artifact) element; getLog().debug("Assemble from " + dependency); // FIXME reported to maven developer list, isSnapshot // changes behaviour // of getBaseVersion, called in pathOf. dependency.isSnapshot(); final File srcDir = getLayout().getNarUnpackDirectory(getUnpackDirectory(), getNarManager().getNarFile(dependency)); // File srcDir = new File( getLocalRepository().pathOf( dependency ) ); // srcDir = new File( getLocalRepository().getBasedir(), // srcDir.getParent() ); // srcDir = new File( srcDir, "nar/" ); final File dstDir = getTargetDirectory(); try { FileUtils.mkdir(dstDir.getPath()); getLog().debug("SrcDir: " + srcDir); if (srcDir.exists()) { FileUtils.copyDirectoryStructureIfModified(srcDir, dstDir); } } catch (final IOException ioe) { throw new MojoExecutionException("Failed to copy directory for dependency " + dependency + " from " + srcDir + " to " + dstDir, ioe); } } }
java
@Override public final void narExecute() throws MojoExecutionException, MojoFailureException { // download the dependencies if needed in local maven repository. List<AttachedNarArtifact> attachedNarArtifacts = getAttachedNarArtifacts(libraries); downloadAttachedNars(attachedNarArtifacts); // Warning, for SNAPSHOT artifacts that were not in the local maven // repository, the downloadAttachedNars // method above modified the version in the AttachedNarArtifact object to // set the timestamp version from // the web repository. // In order to unpack the files with the correct names we need to get back // the AttachedNarArtifact objects with // -SNAPSHOT versions, so we call again getAttachedNarArtifacts() to get the // unmodified AttachedNarArtifact // objects attachedNarArtifacts = getAttachedNarArtifacts(libraries); unpackAttachedNars(attachedNarArtifacts); // this may make some extra copies... for (final Object element : attachedNarArtifacts) { final Artifact dependency = (Artifact) element; getLog().debug("Assemble from " + dependency); // FIXME reported to maven developer list, isSnapshot // changes behaviour // of getBaseVersion, called in pathOf. dependency.isSnapshot(); final File srcDir = getLayout().getNarUnpackDirectory(getUnpackDirectory(), getNarManager().getNarFile(dependency)); // File srcDir = new File( getLocalRepository().pathOf( dependency ) ); // srcDir = new File( getLocalRepository().getBasedir(), // srcDir.getParent() ); // srcDir = new File( srcDir, "nar/" ); final File dstDir = getTargetDirectory(); try { FileUtils.mkdir(dstDir.getPath()); getLog().debug("SrcDir: " + srcDir); if (srcDir.exists()) { FileUtils.copyDirectoryStructureIfModified(srcDir, dstDir); } } catch (final IOException ioe) { throw new MojoExecutionException("Failed to copy directory for dependency " + dependency + " from " + srcDir + " to " + dstDir, ioe); } } }
[ "@", "Override", "public", "final", "void", "narExecute", "(", ")", "throws", "MojoExecutionException", ",", "MojoFailureException", "{", "// download the dependencies if needed in local maven repository.", "List", "<", "AttachedNarArtifact", ">", "attachedNarArtifacts", "=", ...
Copies the unpacked nar libraries and files into the projects target area
[ "Copies", "the", "unpacked", "nar", "libraries", "and", "files", "into", "the", "projects", "target", "area" ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/NarAssemblyMojo.java#L56-L104
jbundle/jbundle
thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java
Application.getParameterByReflection
public String getParameterByReflection(Object obj, String param) { Object value = null; try { java.lang.reflect.Method method = obj.getClass().getMethod("getParameter", String.class); if (method != null) value = method.invoke(obj, param); } catch (Exception e) { e.printStackTrace(); } if (value == null) return null; else return value.toString(); }
java
public String getParameterByReflection(Object obj, String param) { Object value = null; try { java.lang.reflect.Method method = obj.getClass().getMethod("getParameter", String.class); if (method != null) value = method.invoke(obj, param); } catch (Exception e) { e.printStackTrace(); } if (value == null) return null; else return value.toString(); }
[ "public", "String", "getParameterByReflection", "(", "Object", "obj", ",", "String", "param", ")", "{", "Object", "value", "=", "null", ";", "try", "{", "java", ".", "lang", ".", "reflect", ".", "Method", "method", "=", "obj", ".", "getClass", "(", ")", ...
Lame method, since android doesn't have awt/applet support. @param obj @param text
[ "Lame", "method", "since", "android", "doesn", "t", "have", "awt", "/", "applet", "support", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java#L909-L924
geomajas/geomajas-project-client-gwt2
plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java
WmsServerExtension.setHintValue
public <T> void setHintValue(Hint<T> hint, T value) { if (value == null) { throw new IllegalArgumentException("Null value passed."); } hintValues.put(hint, value); }
java
public <T> void setHintValue(Hint<T> hint, T value) { if (value == null) { throw new IllegalArgumentException("Null value passed."); } hintValues.put(hint, value); }
[ "public", "<", "T", ">", "void", "setHintValue", "(", "Hint", "<", "T", ">", "hint", ",", "T", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null value passed.\"", ")", ";", "}", "hin...
Apply a new value for a specific WMS hint. @param hint The hint to change the value for. @param value The new actual value. If the value is null, an IllegalArgumentException is thrown.
[ "Apply", "a", "new", "value", "for", "a", "specific", "WMS", "hint", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java#L193-L198
cdk/cdk
descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java
Tanimoto.calculate
public static float calculate(double[] features1, double[] features2) throws CDKException { if (features1.length != features2.length) { throw new CDKException("Features vectors must be of the same length"); } int n = features1.length; double ab = 0.0; double a2 = 0.0; double b2 = 0.0; for (int i = 0; i < n; i++) { ab += features1[i] * features2[i]; a2 += features1[i] * features1[i]; b2 += features2[i] * features2[i]; } return (float) ab / (float) (a2 + b2 - ab); }
java
public static float calculate(double[] features1, double[] features2) throws CDKException { if (features1.length != features2.length) { throw new CDKException("Features vectors must be of the same length"); } int n = features1.length; double ab = 0.0; double a2 = 0.0; double b2 = 0.0; for (int i = 0; i < n; i++) { ab += features1[i] * features2[i]; a2 += features1[i] * features1[i]; b2 += features2[i] * features2[i]; } return (float) ab / (float) (a2 + b2 - ab); }
[ "public", "static", "float", "calculate", "(", "double", "[", "]", "features1", ",", "double", "[", "]", "features2", ")", "throws", "CDKException", "{", "if", "(", "features1", ".", "length", "!=", "features2", ".", "length", ")", "{", "throw", "new", "...
Evaluates the continuous Tanimoto coefficient for two real valued vectors. <p> @param features1 The first feature vector @param features2 The second feature vector @return The continuous Tanimoto coefficient @throws org.openscience.cdk.exception.CDKException if the features are not of the same length
[ "Evaluates", "the", "continuous", "Tanimoto", "coefficient", "for", "two", "real", "valued", "vectors", ".", "<p", ">" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java#L122-L139
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/model/ClassDescriptorDef.java
ClassDescriptorDef.cloneCollection
private CollectionDescriptorDef cloneCollection(CollectionDescriptorDef collDef, String prefix) { CollectionDescriptorDef copyCollDef = new CollectionDescriptorDef(collDef, prefix); copyCollDef.setOwner(this); // we remove properties that are only relevant to the class the features are declared in copyCollDef.setProperty(PropertyHelper.OJB_PROPERTY_IGNORE, null); Properties mod = getModification(copyCollDef.getName()); if (mod != null) { if (!PropertyHelper.toBoolean(mod.getProperty(PropertyHelper.OJB_PROPERTY_IGNORE), false) && hasFeature(copyCollDef.getName())) { LogHelper.warn(true, ClassDescriptorDef.class, "process", "Class "+getName()+" has a feature that has the same name as its included collection "+ copyCollDef.getName()+" from class "+collDef.getOwner().getName()); } copyCollDef.applyModifications(mod); } return copyCollDef; }
java
private CollectionDescriptorDef cloneCollection(CollectionDescriptorDef collDef, String prefix) { CollectionDescriptorDef copyCollDef = new CollectionDescriptorDef(collDef, prefix); copyCollDef.setOwner(this); // we remove properties that are only relevant to the class the features are declared in copyCollDef.setProperty(PropertyHelper.OJB_PROPERTY_IGNORE, null); Properties mod = getModification(copyCollDef.getName()); if (mod != null) { if (!PropertyHelper.toBoolean(mod.getProperty(PropertyHelper.OJB_PROPERTY_IGNORE), false) && hasFeature(copyCollDef.getName())) { LogHelper.warn(true, ClassDescriptorDef.class, "process", "Class "+getName()+" has a feature that has the same name as its included collection "+ copyCollDef.getName()+" from class "+collDef.getOwner().getName()); } copyCollDef.applyModifications(mod); } return copyCollDef; }
[ "private", "CollectionDescriptorDef", "cloneCollection", "(", "CollectionDescriptorDef", "collDef", ",", "String", "prefix", ")", "{", "CollectionDescriptorDef", "copyCollDef", "=", "new", "CollectionDescriptorDef", "(", "collDef", ",", "prefix", ")", ";", "copyCollDef", ...
Clones the given collection. @param collDef The collection descriptor @param prefix A prefix for the name @return The cloned collection
[ "Clones", "the", "given", "collection", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/ClassDescriptorDef.java#L512-L536
aws/aws-sdk-java
jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java
JmesPathEvaluationVisitor.visit
@Override public JsonNode visit(JmesPathNotExpression notExpression, JsonNode input) throws InvalidTypeException { JsonNode resultExpr = notExpression.getExpr().accept(this, input); if (resultExpr != BooleanNode.TRUE) { return BooleanNode.TRUE; } return BooleanNode.FALSE; }
java
@Override public JsonNode visit(JmesPathNotExpression notExpression, JsonNode input) throws InvalidTypeException { JsonNode resultExpr = notExpression.getExpr().accept(this, input); if (resultExpr != BooleanNode.TRUE) { return BooleanNode.TRUE; } return BooleanNode.FALSE; }
[ "@", "Override", "public", "JsonNode", "visit", "(", "JmesPathNotExpression", "notExpression", ",", "JsonNode", "input", ")", "throws", "InvalidTypeException", "{", "JsonNode", "resultExpr", "=", "notExpression", ".", "getExpr", "(", ")", ".", "accept", "(", "this...
Not-expression negates the result of an expression. If the expression results in a truth-like value, a not-expression will change this value to false. If the expression results in a false-like value, a not-expression will change this value to true. @param notExpression JmesPath not-expression type @param input Input json node against which evaluation is done @return Negation of the evaluated expression @throws InvalidTypeException
[ "Not", "-", "expression", "negates", "the", "result", "of", "an", "expression", ".", "If", "the", "expression", "results", "in", "a", "truth", "-", "like", "value", "a", "not", "-", "expression", "will", "change", "this", "value", "to", "false", ".", "If...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java#L279-L286
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java
ESClient.addSource
private void addSource(Object entity, Map<String, Object> values, EntityType entityType) { Set<Attribute> attributes = entityType.getAttributes(); for (Attribute attrib : attributes) { if (!attrib.isAssociation()) { Object value = PropertyAccessorHelper.getObject(entity, (Field) attrib.getJavaMember()); values.put(((AbstractAttribute) attrib).getJPAColumnName(), value); } } }
java
private void addSource(Object entity, Map<String, Object> values, EntityType entityType) { Set<Attribute> attributes = entityType.getAttributes(); for (Attribute attrib : attributes) { if (!attrib.isAssociation()) { Object value = PropertyAccessorHelper.getObject(entity, (Field) attrib.getJavaMember()); values.put(((AbstractAttribute) attrib).getJPAColumnName(), value); } } }
[ "private", "void", "addSource", "(", "Object", "entity", ",", "Map", "<", "String", ",", "Object", ">", "values", ",", "EntityType", "entityType", ")", "{", "Set", "<", "Attribute", ">", "attributes", "=", "entityType", ".", "getAttributes", "(", ")", ";",...
Adds the source. @param entity the entity @param values the values @param entityType the entity type
[ "Adds", "the", "source", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java#L235-L246
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/HexUtil.java
HexUtil.dumpString
public static String dumpString(byte[] frame, int offset, int length) { return dumpString(frame, offset, length, false); }
java
public static String dumpString(byte[] frame, int offset, int length) { return dumpString(frame, offset, length, false); }
[ "public", "static", "String", "dumpString", "(", "byte", "[", "]", "frame", ",", "int", "offset", ",", "int", "length", ")", "{", "return", "dumpString", "(", "frame", ",", "offset", ",", "length", ",", "false", ")", ";", "}" ]
Create a formatted "dump" of a sequence of bytes @param frame the byte array containing the bytes to be formatted @param offset the offset of the first byte to format @param length the number of bytes to format @return a String containing the formatted dump.
[ "Create", "a", "formatted", "dump", "of", "a", "sequence", "of", "bytes" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/HexUtil.java#L95-L97
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XPopupBox.java
XPopupBox.printInputControl
public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, String strFieldType) { strValue = Utility.encodeXML(this.getScreenField().getSFieldValue(false, true)); // Need the RAW data. if (m_vDisplays == null) this.scanTableItems(); out.println("<xfm:exclusiveSelect xform=\"form1\" ref=\"" + strFieldName + "\" style=\"list-ui:listbox;\">"); out.println(" <xfm:caption>" + strFieldDesc + "</xfm:caption>"); for (int index = 0; index < m_vDisplays.size(); index++) { String strField = (String)m_vValues.get(index); String strDisplay = (String)m_vDisplays.get(index); if (strValue.equals(strField)) // out.println("<option value=\"" + strField + "\" selected>" + strDisplay); out.println("<xfm:item value=\"" + strField + "\">" + strDisplay + "</xfm:item>"); else out.println("<xfm:item value=\"" + strField + "\">" + strDisplay + "</xfm:item>"); } out.println("</xfm:exclusiveSelect>"); }
java
public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, String strFieldType) { strValue = Utility.encodeXML(this.getScreenField().getSFieldValue(false, true)); // Need the RAW data. if (m_vDisplays == null) this.scanTableItems(); out.println("<xfm:exclusiveSelect xform=\"form1\" ref=\"" + strFieldName + "\" style=\"list-ui:listbox;\">"); out.println(" <xfm:caption>" + strFieldDesc + "</xfm:caption>"); for (int index = 0; index < m_vDisplays.size(); index++) { String strField = (String)m_vValues.get(index); String strDisplay = (String)m_vDisplays.get(index); if (strValue.equals(strField)) // out.println("<option value=\"" + strField + "\" selected>" + strDisplay); out.println("<xfm:item value=\"" + strField + "\">" + strDisplay + "</xfm:item>"); else out.println("<xfm:item value=\"" + strField + "\">" + strDisplay + "</xfm:item>"); } out.println("</xfm:exclusiveSelect>"); }
[ "public", "void", "printInputControl", "(", "PrintWriter", "out", ",", "String", "strFieldDesc", ",", "String", "strFieldName", ",", "String", "strSize", ",", "String", "strMaxSize", ",", "String", "strValue", ",", "String", "strControlType", ",", "String", "strFi...
Display this field in html input format. @param out The html out stream. @param strFieldDesc The field description. @param strFieldName The field name. @param strSize The control size. @param strMaxSize The string max size. @param strValue The default value. @param strControlType The control type. @param iHtmlAttribures The attributes.
[ "Display", "this", "field", "in", "html", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XPopupBox.java#L128-L147
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItem
public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType) throws RepositoryException { return getItem(parent, name, pool, itemType, true); }
java
public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType) throws RepositoryException { return getItem(parent, name, pool, itemType, true); }
[ "public", "ItemImpl", "getItem", "(", "NodeData", "parent", ",", "QPathEntry", "name", ",", "boolean", "pool", ",", "ItemType", "itemType", ")", "throws", "RepositoryException", "{", "return", "getItem", "(", "parent", ",", "name", ",", "pool", ",", "itemType"...
Return Item by parent NodeDada and the name of searched item. @param parent - parent of the searched item @param name - item name @param itemType - item type @param pool - indicates does the item fall in pool @return existed item or null if not found @throws RepositoryException
[ "Return", "Item", "by", "parent", "NodeDada", "and", "the", "name", "of", "searched", "item", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L361-L365
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.compareIgnoreCase
public static int compareIgnoreCase(final String str1, final String str2, final boolean nullIsLess) { if (str1 == str2) { return 0; } if (str1 == null) { return nullIsLess ? -1 : 1; } if (str2 == null) { return nullIsLess ? 1 : - 1; } return str1.compareToIgnoreCase(str2); }
java
public static int compareIgnoreCase(final String str1, final String str2, final boolean nullIsLess) { if (str1 == str2) { return 0; } if (str1 == null) { return nullIsLess ? -1 : 1; } if (str2 == null) { return nullIsLess ? 1 : - 1; } return str1.compareToIgnoreCase(str2); }
[ "public", "static", "int", "compareIgnoreCase", "(", "final", "String", "str1", ",", "final", "String", "str2", ",", "final", "boolean", "nullIsLess", ")", "{", "if", "(", "str1", "==", "str2", ")", "{", "return", "0", ";", "}", "if", "(", "str1", "=="...
<p>Compare two Strings lexicographically, ignoring case differences, as per {@link String#compareToIgnoreCase(String)}, returning :</p> <ul> <li>{@code int = 0}, if {@code str1} is equal to {@code str2} (or both {@code null})</li> <li>{@code int < 0}, if {@code str1} is less than {@code str2}</li> <li>{@code int > 0}, if {@code str1} is greater than {@code str2}</li> </ul> <p>This is a {@code null} safe version of :</p> <blockquote><pre>str1.compareToIgnoreCase(str2)</pre></blockquote> <p>{@code null} inputs are handled according to the {@code nullIsLess} parameter. Two {@code null} references are considered equal. Comparison is case insensitive.</p> <pre> StringUtils.compareIgnoreCase(null, null, *) = 0 StringUtils.compareIgnoreCase(null , "a", true) &lt; 0 StringUtils.compareIgnoreCase(null , "a", false) &gt; 0 StringUtils.compareIgnoreCase("a", null, true) &gt; 0 StringUtils.compareIgnoreCase("a", null, false) &lt; 0 StringUtils.compareIgnoreCase("abc", "abc", *) = 0 StringUtils.compareIgnoreCase("abc", "ABC", *) = 0 StringUtils.compareIgnoreCase("a", "b", *) &lt; 0 StringUtils.compareIgnoreCase("b", "a", *) &gt; 0 StringUtils.compareIgnoreCase("a", "B", *) &lt; 0 StringUtils.compareIgnoreCase("A", "b", *) &lt; 0 StringUtils.compareIgnoreCase("ab", "abc", *) &lt; 0 </pre> @see String#compareToIgnoreCase(String) @param str1 the String to compare from @param str2 the String to compare to @param nullIsLess whether consider {@code null} value less than non-{@code null} value @return &lt; 0, 0, &gt; 0, if {@code str1} is respectively less, equal ou greater than {@code str2}, ignoring case differences. @since 3.5
[ "<p", ">", "Compare", "two", "Strings", "lexicographically", "ignoring", "case", "differences", "as", "per", "{", "@link", "String#compareToIgnoreCase", "(", "String", ")", "}", "returning", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "{", "@code", "i...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L1211-L1222
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java
VirtualMachineScaleSetRollingUpgradesInner.beginCancelAsync
public Observable<OperationStatusResponseInner> beginCancelAsync(String resourceGroupName, String vmScaleSetName) { return beginCancelWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> beginCancelAsync(String resourceGroupName, String vmScaleSetName) { return beginCancelWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "beginCancelAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "beginCancelWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", ...
Cancels the current virtual machine scale set rolling upgrade. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object
[ "Cancels", "the", "current", "virtual", "machine", "scale", "set", "rolling", "upgrade", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java#L181-L188
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toGUId
public static Object toGUId(Object o, Object defaultValue) { String str = toString(o, null); if (str == null) return defaultValue; if (!Decision.isGUId(str)) return defaultValue; return str; }
java
public static Object toGUId(Object o, Object defaultValue) { String str = toString(o, null); if (str == null) return defaultValue; if (!Decision.isGUId(str)) return defaultValue; return str; }
[ "public", "static", "Object", "toGUId", "(", "Object", "o", ",", "Object", "defaultValue", ")", "{", "String", "str", "=", "toString", "(", "o", ",", "null", ")", ";", "if", "(", "str", "==", "null", ")", "return", "defaultValue", ";", "if", "(", "!"...
cast a Object to a GUID @param o Object to cast @param defaultValue @return casted Query Object
[ "cast", "a", "Object", "to", "a", "GUID" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L3137-L3143
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
PurgeDao.deleteNonRootComponentsInView
public void deleteNonRootComponentsInView(DbSession dbSession, Collection<ComponentDto> components) { Set<ComponentDto> nonRootComponents = components.stream().filter(PurgeDao::isNotRoot).collect(MoreCollectors.toSet()); if (nonRootComponents.isEmpty()) { return; } PurgeProfiler profiler = new PurgeProfiler(); PurgeCommands purgeCommands = new PurgeCommands(dbSession, profiler); deleteNonRootComponentsInView(nonRootComponents, purgeCommands); }
java
public void deleteNonRootComponentsInView(DbSession dbSession, Collection<ComponentDto> components) { Set<ComponentDto> nonRootComponents = components.stream().filter(PurgeDao::isNotRoot).collect(MoreCollectors.toSet()); if (nonRootComponents.isEmpty()) { return; } PurgeProfiler profiler = new PurgeProfiler(); PurgeCommands purgeCommands = new PurgeCommands(dbSession, profiler); deleteNonRootComponentsInView(nonRootComponents, purgeCommands); }
[ "public", "void", "deleteNonRootComponentsInView", "(", "DbSession", "dbSession", ",", "Collection", "<", "ComponentDto", ">", "components", ")", "{", "Set", "<", "ComponentDto", ">", "nonRootComponents", "=", "components", ".", "stream", "(", ")", ".", "filter", ...
Delete the non root components (ie. sub-view, application or project copy) from the specified collection of {@link ComponentDto} and data from their child tables. <p> This method has no effect when passed an empty collection or only root components. </p>
[ "Delete", "the", "non", "root", "components", "(", "ie", ".", "sub", "-", "view", "application", "or", "project", "copy", ")", "from", "the", "specified", "collection", "of", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java#L252-L261
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNode.java
PeerEurekaNode.syncInstancesIfTimestampDiffers
private void syncInstancesIfTimestampDiffers(String appName, String id, InstanceInfo info, InstanceInfo infoFromPeer) { try { if (infoFromPeer != null) { logger.warn("Peer wants us to take the instance information from it, since the timestamp differs," + "Id : {} My Timestamp : {}, Peer's timestamp: {}", id, info.getLastDirtyTimestamp(), infoFromPeer.getLastDirtyTimestamp()); if (infoFromPeer.getOverriddenStatus() != null && !InstanceStatus.UNKNOWN.equals(infoFromPeer.getOverriddenStatus())) { logger.warn("Overridden Status info -id {}, mine {}, peer's {}", id, info.getOverriddenStatus(), infoFromPeer.getOverriddenStatus()); registry.storeOverriddenStatusIfRequired(appName, id, infoFromPeer.getOverriddenStatus()); } registry.register(infoFromPeer, true); } } catch (Throwable e) { logger.warn("Exception when trying to set information from peer :", e); } }
java
private void syncInstancesIfTimestampDiffers(String appName, String id, InstanceInfo info, InstanceInfo infoFromPeer) { try { if (infoFromPeer != null) { logger.warn("Peer wants us to take the instance information from it, since the timestamp differs," + "Id : {} My Timestamp : {}, Peer's timestamp: {}", id, info.getLastDirtyTimestamp(), infoFromPeer.getLastDirtyTimestamp()); if (infoFromPeer.getOverriddenStatus() != null && !InstanceStatus.UNKNOWN.equals(infoFromPeer.getOverriddenStatus())) { logger.warn("Overridden Status info -id {}, mine {}, peer's {}", id, info.getOverriddenStatus(), infoFromPeer.getOverriddenStatus()); registry.storeOverriddenStatusIfRequired(appName, id, infoFromPeer.getOverriddenStatus()); } registry.register(infoFromPeer, true); } } catch (Throwable e) { logger.warn("Exception when trying to set information from peer :", e); } }
[ "private", "void", "syncInstancesIfTimestampDiffers", "(", "String", "appName", ",", "String", "id", ",", "InstanceInfo", "info", ",", "InstanceInfo", "infoFromPeer", ")", "{", "try", "{", "if", "(", "infoFromPeer", "!=", "null", ")", "{", "logger", ".", "warn...
Synchronize {@link InstanceInfo} information if the timestamp between this node and the peer eureka nodes vary.
[ "Synchronize", "{" ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNode.java#L358-L373
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VpnConnectionsInner.java
VpnConnectionsInner.beginCreateOrUpdateAsync
public Observable<VpnConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String gatewayName, String connectionName, VpnConnectionInner vpnConnectionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters).map(new Func1<ServiceResponse<VpnConnectionInner>, VpnConnectionInner>() { @Override public VpnConnectionInner call(ServiceResponse<VpnConnectionInner> response) { return response.body(); } }); }
java
public Observable<VpnConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String gatewayName, String connectionName, VpnConnectionInner vpnConnectionParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters).map(new Func1<ServiceResponse<VpnConnectionInner>, VpnConnectionInner>() { @Override public VpnConnectionInner call(ServiceResponse<VpnConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnConnectionInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ",", "String", "connectionName", ",", "VpnConnectionInner", "vpnConnectionParameters", ")", "{", "return", "beginCreateOrUpd...
Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing connection. @param resourceGroupName The resource group name of the VpnGateway. @param gatewayName The name of the gateway. @param connectionName The name of the connection. @param vpnConnectionParameters Parameters supplied to create or Update a VPN Connection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VpnConnectionInner object
[ "Creates", "a", "vpn", "connection", "to", "a", "scalable", "vpn", "gateway", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VpnConnectionsInner.java#L308-L315
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.generateKey
public static SecretKey generateKey(String algorithm, KeySpec keySpec) { return KeyUtil.generateKey(algorithm, keySpec); }
java
public static SecretKey generateKey(String algorithm, KeySpec keySpec) { return KeyUtil.generateKey(algorithm, keySpec); }
[ "public", "static", "SecretKey", "generateKey", "(", "String", "algorithm", ",", "KeySpec", "keySpec", ")", "{", "return", "KeyUtil", ".", "generateKey", "(", "algorithm", ",", "keySpec", ")", ";", "}" ]
生成 {@link SecretKey},仅用于对称加密和摘要算法 @param algorithm 算法 @param keySpec {@link KeySpec} @return {@link SecretKey}
[ "生成", "{", "@link", "SecretKey", "}", ",仅用于对称加密和摘要算法" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L129-L131
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java
ChatController.synchroniseStore
Observable<ChatResult> synchroniseStore() { if (isSynchronising.getAndSet(true)) { log.i("Synchronisation in progress."); return Observable.fromCallable(() -> new ChatResult(true, null)); } log.i("Synchronising store."); return synchroniseConversations() .onErrorReturn(t -> new ChatResult(false, new ChatResult.Error(0, t))) .doOnNext(i -> { if (i.isSuccessful()) { log.i("Synchronisation successfully finished."); } else { log.e("Synchronisation finished with error. " + (i.getError() != null ? i.getError().getDetails() : "")); } isSynchronising.compareAndSet(true, false); }); }
java
Observable<ChatResult> synchroniseStore() { if (isSynchronising.getAndSet(true)) { log.i("Synchronisation in progress."); return Observable.fromCallable(() -> new ChatResult(true, null)); } log.i("Synchronising store."); return synchroniseConversations() .onErrorReturn(t -> new ChatResult(false, new ChatResult.Error(0, t))) .doOnNext(i -> { if (i.isSuccessful()) { log.i("Synchronisation successfully finished."); } else { log.e("Synchronisation finished with error. " + (i.getError() != null ? i.getError().getDetails() : "")); } isSynchronising.compareAndSet(true, false); }); }
[ "Observable", "<", "ChatResult", ">", "synchroniseStore", "(", ")", "{", "if", "(", "isSynchronising", ".", "getAndSet", "(", "true", ")", ")", "{", "log", ".", "i", "(", "\"Synchronisation in progress.\"", ")", ";", "return", "Observable", ".", "fromCallable"...
Check state for all conversations and update from services. @return Result of synchronisation process.
[ "Check", "state", "for", "all", "conversations", "and", "update", "from", "services", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L332-L348
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/TimeUtils.java
TimeUtils.formatHumanFriendlyShortDate
public static String formatHumanFriendlyShortDate(final Context context, long timestamp) { long localTimestamp, localTime; long now = System.currentTimeMillis(); TimeZone tz = TimeZone.getDefault(); localTimestamp = timestamp + tz.getOffset(timestamp); localTime = now + tz.getOffset(now); long dayOrd = localTimestamp / 86400000L; long nowOrd = localTime / 86400000L; if (dayOrd == nowOrd) { return context.getString(R.string.day_title_today); } else if (dayOrd == nowOrd - 1) { return context.getString(R.string.day_title_yesterday); } else if (dayOrd == nowOrd + 1) { return context.getString(R.string.day_title_tomorrow); } else { return formatShortDate(context, new Date(timestamp)); } }
java
public static String formatHumanFriendlyShortDate(final Context context, long timestamp) { long localTimestamp, localTime; long now = System.currentTimeMillis(); TimeZone tz = TimeZone.getDefault(); localTimestamp = timestamp + tz.getOffset(timestamp); localTime = now + tz.getOffset(now); long dayOrd = localTimestamp / 86400000L; long nowOrd = localTime / 86400000L; if (dayOrd == nowOrd) { return context.getString(R.string.day_title_today); } else if (dayOrd == nowOrd - 1) { return context.getString(R.string.day_title_yesterday); } else if (dayOrd == nowOrd + 1) { return context.getString(R.string.day_title_tomorrow); } else { return formatShortDate(context, new Date(timestamp)); } }
[ "public", "static", "String", "formatHumanFriendlyShortDate", "(", "final", "Context", "context", ",", "long", "timestamp", ")", "{", "long", "localTimestamp", ",", "localTime", ";", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "TimeZon...
Returns "Today", "Tomorrow", "Yesterday", or a short date format.
[ "Returns", "Today", "Tomorrow", "Yesterday", "or", "a", "short", "date", "format", "." ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/TimeUtils.java#L141-L161
getsentry/sentry-java
sentry/src/main/java/io/sentry/util/Util.java
Util.parseDouble
public static Double parseDouble(String value, Double defaultValue) { if (isNullOrEmpty(value)) { return defaultValue; } return Double.parseDouble(value); }
java
public static Double parseDouble(String value, Double defaultValue) { if (isNullOrEmpty(value)) { return defaultValue; } return Double.parseDouble(value); }
[ "public", "static", "Double", "parseDouble", "(", "String", "value", ",", "Double", "defaultValue", ")", "{", "if", "(", "isNullOrEmpty", "(", "value", ")", ")", "{", "return", "defaultValue", ";", "}", "return", "Double", ".", "parseDouble", "(", "value", ...
Parses the provided string value into a double value. <p>If the string is null or empty this returns the default value.</p> @param value value to parse @param defaultValue default value @return double representation of provided value or default value.
[ "Parses", "the", "provided", "string", "value", "into", "a", "double", "value", ".", "<p", ">", "If", "the", "string", "is", "null", "or", "empty", "this", "returns", "the", "default", "value", ".", "<", "/", "p", ">" ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/util/Util.java#L132-L137
micronaut-projects/micronaut-core
function/src/main/java/io/micronaut/function/executor/FunctionApplication.java
FunctionApplication.parseData
static void parseData(String[] args, BiConsumer<String, Boolean> data) { CommandLine commandLine = parseCommandLine(args); Object value = commandLine.optionValue("d"); if (value != null) { data.accept(value.toString(), commandLine.hasOption("x")); } else { data.accept(null, commandLine.hasOption("x")); } }
java
static void parseData(String[] args, BiConsumer<String, Boolean> data) { CommandLine commandLine = parseCommandLine(args); Object value = commandLine.optionValue("d"); if (value != null) { data.accept(value.toString(), commandLine.hasOption("x")); } else { data.accept(null, commandLine.hasOption("x")); } }
[ "static", "void", "parseData", "(", "String", "[", "]", "args", ",", "BiConsumer", "<", "String", ",", "Boolean", ">", "data", ")", "{", "CommandLine", "commandLine", "=", "parseCommandLine", "(", "args", ")", ";", "Object", "value", "=", "commandLine", "....
Parse entries. @param args command line options @param data data
[ "Parse", "entries", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/function/src/main/java/io/micronaut/function/executor/FunctionApplication.java#L92-L100
baratine/baratine
framework/src/main/java/com/caucho/v5/bartender/pod/MethodRefPod.java
MethodRefPod.findLocalMethod
private MethodRefAmp findLocalMethod() { ServiceRefAmp serviceRefLocal = _serviceRef.getLocalService(); if (serviceRefLocal == null) { return null; } MethodRefActive methodRefLocal = _methodRefLocal; MethodRefAmp methodRef; if (methodRefLocal != null) { methodRef = methodRefLocal.getMethod(serviceRefLocal); if (methodRef != null) { return methodRef; } } if (_type != null) { methodRef = serviceRefLocal.methodByName(_name, _type); } else { methodRef = serviceRefLocal.methodByName(_name); } _methodRefLocal = new MethodRefActive(serviceRefLocal, methodRef); return methodRef; }
java
private MethodRefAmp findLocalMethod() { ServiceRefAmp serviceRefLocal = _serviceRef.getLocalService(); if (serviceRefLocal == null) { return null; } MethodRefActive methodRefLocal = _methodRefLocal; MethodRefAmp methodRef; if (methodRefLocal != null) { methodRef = methodRefLocal.getMethod(serviceRefLocal); if (methodRef != null) { return methodRef; } } if (_type != null) { methodRef = serviceRefLocal.methodByName(_name, _type); } else { methodRef = serviceRefLocal.methodByName(_name); } _methodRefLocal = new MethodRefActive(serviceRefLocal, methodRef); return methodRef; }
[ "private", "MethodRefAmp", "findLocalMethod", "(", ")", "{", "ServiceRefAmp", "serviceRefLocal", "=", "_serviceRef", ".", "getLocalService", "(", ")", ";", "if", "(", "serviceRefLocal", "==", "null", ")", "{", "return", "null", ";", "}", "MethodRefActive", "meth...
/* @Override public <T> void stream(Headers headers, ResultStream<T> result, long timeout, TimeUnit timeUnit, Object... args) { try { MethodRefAmp method = findActiveMethod(); method.stream(headers, result, timeout, timeUnit, args); } catch (Throwable e) { result.fail(e); } }
[ "/", "*", "@Override", "public", "<T", ">", "void", "stream", "(", "Headers", "headers", "ResultStream<T", ">", "result", "long", "timeout", "TimeUnit", "timeUnit", "Object", "...", "args", ")", "{", "try", "{", "MethodRefAmp", "method", "=", "findActiveMethod...
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/pod/MethodRefPod.java#L196-L225
jcuda/jcurand
JCurandJava/src/main/java/jcuda/jcurand/JCurand.java
JCurand.curandGenerateLongLong
public static int curandGenerateLongLong(curandGenerator generator, Pointer outputPtr, long num) { return checkResult(curandGenerateLongLongNative(generator, outputPtr, num)); }
java
public static int curandGenerateLongLong(curandGenerator generator, Pointer outputPtr, long num) { return checkResult(curandGenerateLongLongNative(generator, outputPtr, num)); }
[ "public", "static", "int", "curandGenerateLongLong", "(", "curandGenerator", "generator", ",", "Pointer", "outputPtr", ",", "long", "num", ")", "{", "return", "checkResult", "(", "curandGenerateLongLongNative", "(", "generator", ",", "outputPtr", ",", "num", ")", ...
<pre> Generate 64-bit quasirandom numbers. Use generator to generate num 64-bit results into the device memory at outputPtr. The device memory must have been previously allocated and be large enough to hold all the results. Launches are done with the stream set using ::curandSetStream(), or the null stream if no stream has been set. Results are 64-bit values with every bit random. @param generator - Generator to use @param outputPtr - Pointer to device memory to store CUDA-generated results, or Pointer to host memory to store CPU-generated results @param num - Number of random 64-bit values to generate @return CURAND_STATUS_NOT_INITIALIZED if the generator was never created CURAND_STATUS_PREEXISTING_FAILURE if there was an existing error from a previous kernel launch CURAND_STATUS_LENGTH_NOT_MULTIPLE if the number of output samples is not a multiple of the quasirandom dimension CURAND_STATUS_LAUNCH_FAILURE if the kernel launch failed for any reason CURAND_STATUS_SUCCESS if the results were generated successfully </pre>
[ "<pre", ">", "Generate", "64", "-", "bit", "quasirandom", "numbers", "." ]
train
https://github.com/jcuda/jcurand/blob/0f463d2bb72cd93b3988f7ce148cdb6069ba4fd9/JCurandJava/src/main/java/jcuda/jcurand/JCurand.java#L560-L563
HeidelTime/heideltime
src/jvntextpro/util/StringUtils.java
StringUtils.findFirstNotOf
public static int findFirstNotOf(String container, String chars, int begin){ //find the first occurrence of characters not in the charSeq from begin forward for (int i = begin; i < container.length() && i >=0; ++i) if (!chars.contains("" + container.charAt(i))) return i; return -1; }
java
public static int findFirstNotOf(String container, String chars, int begin){ //find the first occurrence of characters not in the charSeq from begin forward for (int i = begin; i < container.length() && i >=0; ++i) if (!chars.contains("" + container.charAt(i))) return i; return -1; }
[ "public", "static", "int", "findFirstNotOf", "(", "String", "container", ",", "String", "chars", ",", "int", "begin", ")", "{", "//find the first occurrence of characters not in the charSeq\tfrom begin forward\t\r", "for", "(", "int", "i", "=", "begin", ";", "i", "<",...
Find the first occurrence of characters not in the charSeq from begin @param container the container @param chars the chars @param begin the begin @return the int
[ "Find", "the", "first", "occurrence", "of", "characters", "not", "in", "the", "charSeq", "from", "begin" ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/jvntextpro/util/StringUtils.java#L86-L92
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java
GenericBoJdbcDao.getAll
protected Stream<T> getAll(Connection conn) { return executeSelectAsStream(rowMapper, conn, true, calcSqlSelectAll()); }
java
protected Stream<T> getAll(Connection conn) { return executeSelectAsStream(rowMapper, conn, true, calcSqlSelectAll()); }
[ "protected", "Stream", "<", "T", ">", "getAll", "(", "Connection", "conn", ")", "{", "return", "executeSelectAsStream", "(", "rowMapper", ",", "conn", ",", "true", ",", "calcSqlSelectAll", "(", ")", ")", ";", "}" ]
Fetch all existing BOs from storage and return the result as a stream. @param conn @return @since 0.9.0
[ "Fetch", "all", "existing", "BOs", "from", "storage", "and", "return", "the", "result", "as", "a", "stream", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java#L596-L598
Erudika/para
para-core/src/main/java/com/erudika/para/utils/RegistryUtils.java
RegistryUtils.removeValue
public static void removeValue(String registryName, String key) { Sysprop registryObject = readRegistryObject(registryName); if (registryObject == null || StringUtils.isBlank(key)) { return; } if (registryObject.hasProperty(key)) { registryObject.removeProperty(key); CoreUtils.getInstance().getDao().update(REGISTRY_APP_ID, registryObject); } }
java
public static void removeValue(String registryName, String key) { Sysprop registryObject = readRegistryObject(registryName); if (registryObject == null || StringUtils.isBlank(key)) { return; } if (registryObject.hasProperty(key)) { registryObject.removeProperty(key); CoreUtils.getInstance().getDao().update(REGISTRY_APP_ID, registryObject); } }
[ "public", "static", "void", "removeValue", "(", "String", "registryName", ",", "String", "key", ")", "{", "Sysprop", "registryObject", "=", "readRegistryObject", "(", "registryName", ")", ";", "if", "(", "registryObject", "==", "null", "||", "StringUtils", ".", ...
Remove a specific value from a registry. @param registryName the name of the registry. @param key the unique key corresponding to the value to remove (typically an appid).
[ "Remove", "a", "specific", "value", "from", "a", "registry", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/RegistryUtils.java#L78-L87
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java
TableBuilder.getRow
public TableRow getRow(final Table table, final TableAppender appender, final int rowIndex) throws FastOdsException, IOException { TableBuilder.checkRow(rowIndex); return this.getRowSecure(table, appender, rowIndex, true); }
java
public TableRow getRow(final Table table, final TableAppender appender, final int rowIndex) throws FastOdsException, IOException { TableBuilder.checkRow(rowIndex); return this.getRowSecure(table, appender, rowIndex, true); }
[ "public", "TableRow", "getRow", "(", "final", "Table", "table", ",", "final", "TableAppender", "appender", ",", "final", "int", "rowIndex", ")", "throws", "FastOdsException", ",", "IOException", "{", "TableBuilder", ".", "checkRow", "(", "rowIndex", ")", ";", ...
get a row from a table @param table the table @param appender the appender @param rowIndex the row index @return the table row @throws FastOdsException if the index is invalid @throws IOException if an I/O error occurs
[ "get", "a", "row", "from", "a", "table" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java#L236-L240
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java
DomainsInner.beginDelete
public void beginDelete(String resourceGroupName, String domainName) { beginDeleteWithServiceResponseAsync(resourceGroupName, domainName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String domainName) { beginDeleteWithServiceResponseAsync(resourceGroupName, domainName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "domainName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", ...
Delete a domain. Delete existing domain. @param resourceGroupName The name of the resource group within the user's subscription. @param domainName Name of the domain @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Delete", "a", "domain", ".", "Delete", "existing", "domain", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java#L466-L468
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.examplesMethodAsync
public Observable<List<LabelTextObject>> examplesMethodAsync(UUID appId, String versionId, String modelId, ExamplesMethodOptionalParameter examplesMethodOptionalParameter) { return examplesMethodWithServiceResponseAsync(appId, versionId, modelId, examplesMethodOptionalParameter).map(new Func1<ServiceResponse<List<LabelTextObject>>, List<LabelTextObject>>() { @Override public List<LabelTextObject> call(ServiceResponse<List<LabelTextObject>> response) { return response.body(); } }); }
java
public Observable<List<LabelTextObject>> examplesMethodAsync(UUID appId, String versionId, String modelId, ExamplesMethodOptionalParameter examplesMethodOptionalParameter) { return examplesMethodWithServiceResponseAsync(appId, versionId, modelId, examplesMethodOptionalParameter).map(new Func1<ServiceResponse<List<LabelTextObject>>, List<LabelTextObject>>() { @Override public List<LabelTextObject> call(ServiceResponse<List<LabelTextObject>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "LabelTextObject", ">", ">", "examplesMethodAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "String", "modelId", ",", "ExamplesMethodOptionalParameter", "examplesMethodOptionalParameter", ")", "{", "return", "ex...
Gets the utterances for the given model in the given app version. @param appId The application ID. @param versionId The version ID. @param modelId The ID (GUID) of the model. @param examplesMethodOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;LabelTextObject&gt; object
[ "Gets", "the", "utterances", "for", "the", "given", "model", "in", "the", "given", "app", "version", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2653-L2660
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java
WebhooksInner.beginCreateAsync
public Observable<WebhookInner> beginCreateAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() { @Override public WebhookInner call(ServiceResponse<WebhookInner> response) { return response.body(); } }); }
java
public Observable<WebhookInner> beginCreateAsync(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() { @Override public WebhookInner call(ServiceResponse<WebhookInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WebhookInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "webhookName", ",", "WebhookCreateParameters", "webhookCreateParameters", ")", "{", "return", "beginCreateWithServiceRespo...
Creates a webhook for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param webhookName The name of the webhook. @param webhookCreateParameters The parameters for creating a webhook. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WebhookInner object
[ "Creates", "a", "webhook", "for", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L336-L343
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsync
public static <T1, T2, T3, T4> Func4<T1, T2, T3, T4, Observable<Void>> toAsync(Action4<? super T1, ? super T2, ? super T3, ? super T4> action) { return toAsync(action, Schedulers.computation()); }
java
public static <T1, T2, T3, T4> Func4<T1, T2, T3, T4, Observable<Void>> toAsync(Action4<? super T1, ? super T2, ? super T3, ? super T4> action) { return toAsync(action, Schedulers.computation()); }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ">", "Func4", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "Observable", "<", "Void", ">", ">", "toAsync", "(", "Action4", "<", "?", "super", "T1", ",", "?", "super", "T2", "...
Convert a synchronous action call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.an.png" alt=""> @param <T1> the first parameter type @param <T2> the second parameter type @param <T3> the third parameter type @param <T4> the fourth parameter type @param action the action to convert @return a function that returns an Observable that executes the {@code action} and emits {@code null} @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh229769.aspx">MSDN: Observable.ToAsync</a>
[ "Convert", "a", "synchronous", "action", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", ...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L344-L346
apache/fluo
modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
TransactionImpl.readUnread
private void readUnread(CommitData cd, Consumer<Entry<Key, Value>> locksSeen) { // TODO make async // TODO need to keep track of ranges read (not ranges passed in, but actual data read... user // may not iterate over entire range Map<Bytes, Set<Column>> columnsToRead = new HashMap<>(); for (Entry<Bytes, Set<Column>> entry : cd.getRejected().entrySet()) { Set<Column> rowColsRead = columnsRead.get(entry.getKey()); if (rowColsRead == null) { columnsToRead.put(entry.getKey(), entry.getValue()); } else { HashSet<Column> colsToRead = new HashSet<>(entry.getValue()); colsToRead.removeAll(rowColsRead); if (!colsToRead.isEmpty()) { columnsToRead.put(entry.getKey(), colsToRead); } } } for (Entry<Bytes, Set<Column>> entry : columnsToRead.entrySet()) { getImpl(entry.getKey(), entry.getValue(), locksSeen); } }
java
private void readUnread(CommitData cd, Consumer<Entry<Key, Value>> locksSeen) { // TODO make async // TODO need to keep track of ranges read (not ranges passed in, but actual data read... user // may not iterate over entire range Map<Bytes, Set<Column>> columnsToRead = new HashMap<>(); for (Entry<Bytes, Set<Column>> entry : cd.getRejected().entrySet()) { Set<Column> rowColsRead = columnsRead.get(entry.getKey()); if (rowColsRead == null) { columnsToRead.put(entry.getKey(), entry.getValue()); } else { HashSet<Column> colsToRead = new HashSet<>(entry.getValue()); colsToRead.removeAll(rowColsRead); if (!colsToRead.isEmpty()) { columnsToRead.put(entry.getKey(), colsToRead); } } } for (Entry<Bytes, Set<Column>> entry : columnsToRead.entrySet()) { getImpl(entry.getKey(), entry.getValue(), locksSeen); } }
[ "private", "void", "readUnread", "(", "CommitData", "cd", ",", "Consumer", "<", "Entry", "<", "Key", ",", "Value", ">", ">", "locksSeen", ")", "{", "// TODO make async", "// TODO need to keep track of ranges read (not ranges passed in, but actual data read... user", "// may...
This function helps handle the following case <OL> <LI>TX1 locls r1 col1 <LI>TX1 fails before unlocking <LI>TX2 attempts to write r1:col1 w/o reading it </OL> <p> In this case TX2 would not roll back TX1, because it never read the column. This function attempts to handle this case if TX2 fails. Only doing this in case of failures is cheaper than trying to always read unread columns. @param cd Commit data
[ "This", "function", "helps", "handle", "the", "following", "case" ]
train
https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java#L557-L579
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/DefaultRedisCommandsMetadata.java
DefaultRedisCommandsMetadata.getMostSpecificMethod
public static Method getMostSpecificMethod(Method method, Class<?> targetClass) { if (method != null && isOverridable(method, targetClass) && targetClass != null && targetClass != method.getDeclaringClass()) { try { try { return targetClass.getMethod(method.getName(), method.getParameterTypes()); } catch (NoSuchMethodException ex) { return method; } } catch (SecurityException ex) { } } return method; }
java
public static Method getMostSpecificMethod(Method method, Class<?> targetClass) { if (method != null && isOverridable(method, targetClass) && targetClass != null && targetClass != method.getDeclaringClass()) { try { try { return targetClass.getMethod(method.getName(), method.getParameterTypes()); } catch (NoSuchMethodException ex) { return method; } } catch (SecurityException ex) { } } return method; }
[ "public", "static", "Method", "getMostSpecificMethod", "(", "Method", "method", ",", "Class", "<", "?", ">", "targetClass", ")", "{", "if", "(", "method", "!=", "null", "&&", "isOverridable", "(", "method", ",", "targetClass", ")", "&&", "targetClass", "!=",...
Given a method, which may come from an interface, and a target class used in the current reflective invocation, find the corresponding target method if there is one. E.g. the method may be {@code IFoo.bar()} and the target class may be {@code DefaultFoo}. In this case, the method may be {@code DefaultFoo.bar()}. This enables attributes on that method to be found. @param method the method to be invoked, which may come from an interface @param targetClass the target class for the current invocation. May be {@code null} or may not even implement the method. @return the specific target method, or the original method if the {@code targetClass} doesn't implement it or is {@code null}
[ "Given", "a", "method", "which", "may", "come", "from", "an", "interface", "and", "a", "target", "class", "used", "in", "the", "current", "reflective", "invocation", "find", "the", "corresponding", "target", "method", "if", "there", "is", "one", ".", "E", ...
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/DefaultRedisCommandsMetadata.java#L101-L115
jayantk/jklol
src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java
FeatureStandardizer.getVariances
public static DiscreteFactor getVariances(DiscreteFactor featureFactor, int featureVariableNum) { return getVariances(Arrays.asList(featureFactor), featureVariableNum); }
java
public static DiscreteFactor getVariances(DiscreteFactor featureFactor, int featureVariableNum) { return getVariances(Arrays.asList(featureFactor), featureVariableNum); }
[ "public", "static", "DiscreteFactor", "getVariances", "(", "DiscreteFactor", "featureFactor", ",", "int", "featureVariableNum", ")", "{", "return", "getVariances", "(", "Arrays", ".", "asList", "(", "featureFactor", ")", ",", "featureVariableNum", ")", ";", "}" ]
Gets the variance of the values of each assignment to {@code featureVariableNum} in {@code featureFactor}. @param featureFactor @param featureVariableNum @return
[ "Gets", "the", "variance", "of", "the", "values", "of", "each", "assignment", "to", "{", "@code", "featureVariableNum", "}", "in", "{", "@code", "featureFactor", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java#L171-L173
Metatavu/edelphi
rest/src/main/java/fi/metatavu/edelphi/permissions/PermissionController.java
PermissionController.hasDelfoiAccess
private boolean hasDelfoiAccess(DelfoiAction action, UserRole userRole) { Delfoi delfoi = getDelfoi(); return delfoiUserRoleActionDAO.hasDelfoiActionAccess(delfoi, userRole, action); }
java
private boolean hasDelfoiAccess(DelfoiAction action, UserRole userRole) { Delfoi delfoi = getDelfoi(); return delfoiUserRoleActionDAO.hasDelfoiActionAccess(delfoi, userRole, action); }
[ "private", "boolean", "hasDelfoiAccess", "(", "DelfoiAction", "action", ",", "UserRole", "userRole", ")", "{", "Delfoi", "delfoi", "=", "getDelfoi", "(", ")", ";", "return", "delfoiUserRoleActionDAO", ".", "hasDelfoiActionAccess", "(", "delfoi", ",", "userRole", "...
Returns whether user role required action access @param action action @param userRole role @return whether user role required action access
[ "Returns", "whether", "user", "role", "required", "action", "access" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/rest/src/main/java/fi/metatavu/edelphi/permissions/PermissionController.java#L175-L178
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.removeEmpty
public static <T extends CharSequence> Collection<T> removeEmpty(Collection<T> collection) { return filter(collection, new Filter<T>() { @Override public boolean accept(T t) { return false == StrUtil.isEmpty(t); } }); }
java
public static <T extends CharSequence> Collection<T> removeEmpty(Collection<T> collection) { return filter(collection, new Filter<T>() { @Override public boolean accept(T t) { return false == StrUtil.isEmpty(t); } }); }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "Collection", "<", "T", ">", "removeEmpty", "(", "Collection", "<", "T", ">", "collection", ")", "{", "return", "filter", "(", "collection", ",", "new", "Filter", "<", "T", ">", "(", ")", "{...
去除{@code null}或者"" 元素 @param collection 集合 @return 处理后的集合 @since 3.2.2
[ "去除", "{", "@code", "null", "}", "或者", "元素" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1090-L1097
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Widgets.java
Widgets.getText
public static String getText (TextBoxBase box, String defaultAsBlank) { String s = box.getText().trim(); return s.equals(defaultAsBlank) ? "" : s; }
java
public static String getText (TextBoxBase box, String defaultAsBlank) { String s = box.getText().trim(); return s.equals(defaultAsBlank) ? "" : s; }
[ "public", "static", "String", "getText", "(", "TextBoxBase", "box", ",", "String", "defaultAsBlank", ")", "{", "String", "s", "=", "box", ".", "getText", "(", ")", ".", "trim", "(", ")", ";", "return", "s", ".", "equals", "(", "defaultAsBlank", ")", "?...
Retrieve the text from the TextBox, unless it is the specified default, in which case we return "".
[ "Retrieve", "the", "text", "from", "the", "TextBox", "unless", "it", "is", "the", "specified", "default", "in", "which", "case", "we", "return", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L346-L350
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java
WebConfigParamUtils.getInstanceInitParameter
@SuppressWarnings("unchecked") public static <T> T getInstanceInitParameter(ExternalContext context, String name, String deprecatedName, T defaultValue) { String param = getStringInitParameter(context, name, deprecatedName); if (param == null) { return defaultValue; } else { try { return (T) ClassUtils.classForName(param).newInstance(); } catch (Exception e) { throw new FacesException("Error Initializing Object[" + param + "]", e); } } }
java
@SuppressWarnings("unchecked") public static <T> T getInstanceInitParameter(ExternalContext context, String name, String deprecatedName, T defaultValue) { String param = getStringInitParameter(context, name, deprecatedName); if (param == null) { return defaultValue; } else { try { return (T) ClassUtils.classForName(param).newInstance(); } catch (Exception e) { throw new FacesException("Error Initializing Object[" + param + "]", e); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getInstanceInitParameter", "(", "ExternalContext", "context", ",", "String", "name", ",", "String", "deprecatedName", ",", "T", "defaultValue", ")", "{", "String", "para...
Gets the init parameter value from the specified context and instanciate it. If the parameter was not specified, the default value is used instead. @param context the application's external context @param name the init parameter's name @param deprecatedName the init parameter's deprecated name. @param defaultValue the default value to return in case the parameter was not set @return the init parameter value as an object instance @throws NullPointerException if context or name is <code>null</code>
[ "Gets", "the", "init", "parameter", "value", "from", "the", "specified", "context", "and", "instanciate", "it", ".", "If", "the", "parameter", "was", "not", "specified", "the", "default", "value", "is", "used", "instead", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L687-L707
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WAjaxControlRenderer.java
WAjaxControlRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WAjaxControl ajaxControl = (WAjaxControl) component; XmlStringBuilder xml = renderContext.getWriter(); WComponent trigger = ajaxControl.getTrigger() == null ? ajaxControl : ajaxControl. getTrigger(); int delay = ajaxControl.getDelay(); if (ajaxControl.getTargets() == null || ajaxControl.getTargets().isEmpty()) { return; } // Start tag xml.appendTagOpen("ui:ajaxtrigger"); xml.appendAttribute("triggerId", trigger.getId()); xml.appendOptionalAttribute("loadOnce", ajaxControl.isLoadOnce(), "true"); xml.appendOptionalAttribute("delay", delay > 0, delay); xml.appendClose(); // Targets for (AjaxTarget target : ajaxControl.getTargets()) { xml.appendTagOpen("ui:ajaxtargetid"); xml.appendAttribute("targetId", target.getId()); xml.appendEnd(); } // End tag xml.appendEndTag("ui:ajaxtrigger"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WAjaxControl ajaxControl = (WAjaxControl) component; XmlStringBuilder xml = renderContext.getWriter(); WComponent trigger = ajaxControl.getTrigger() == null ? ajaxControl : ajaxControl. getTrigger(); int delay = ajaxControl.getDelay(); if (ajaxControl.getTargets() == null || ajaxControl.getTargets().isEmpty()) { return; } // Start tag xml.appendTagOpen("ui:ajaxtrigger"); xml.appendAttribute("triggerId", trigger.getId()); xml.appendOptionalAttribute("loadOnce", ajaxControl.isLoadOnce(), "true"); xml.appendOptionalAttribute("delay", delay > 0, delay); xml.appendClose(); // Targets for (AjaxTarget target : ajaxControl.getTargets()) { xml.appendTagOpen("ui:ajaxtargetid"); xml.appendAttribute("targetId", target.getId()); xml.appendEnd(); } // End tag xml.appendEndTag("ui:ajaxtrigger"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WAjaxControl", "ajaxControl", "=", "(", "WAjaxControl", ")", "component", ";", "XmlStringBuilder", "xml", "=", ...
Paints the given AjaxControl. @param component the AjaxControl to paint @param renderContext the RenderContext to paint to
[ "Paints", "the", "given", "AjaxControl", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WAjaxControlRenderer.java#L24-L52
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/constraints/InheritanceHelper.java
InheritanceHelper.isSameOrSubTypeOf
public boolean isSameOrSubTypeOf(ClassDescriptorDef type, String baseType, boolean checkActualClasses) throws ClassNotFoundException { if (type.getQualifiedName().equals(baseType.replace('$', '.'))) { return true; } else if (type.getOriginalClass() != null) { return isSameOrSubTypeOf(type.getOriginalClass(), baseType, checkActualClasses); } else { return checkActualClasses ? isSameOrSubTypeOf(type.getName(), baseType) : false; } }
java
public boolean isSameOrSubTypeOf(ClassDescriptorDef type, String baseType, boolean checkActualClasses) throws ClassNotFoundException { if (type.getQualifiedName().equals(baseType.replace('$', '.'))) { return true; } else if (type.getOriginalClass() != null) { return isSameOrSubTypeOf(type.getOriginalClass(), baseType, checkActualClasses); } else { return checkActualClasses ? isSameOrSubTypeOf(type.getName(), baseType) : false; } }
[ "public", "boolean", "isSameOrSubTypeOf", "(", "ClassDescriptorDef", "type", ",", "String", "baseType", ",", "boolean", "checkActualClasses", ")", "throws", "ClassNotFoundException", "{", "if", "(", "type", ".", "getQualifiedName", "(", ")", ".", "equals", "(", "b...
Determines whether the given type is the same or a sub type of the other type. @param type The type @param baseType The possible base type @param checkActualClasses Whether to use the actual classes for the test @return <code>true</code> If <code>type</code> specifies the same or a sub type of <code>baseType</code> @throws ClassNotFoundException If the two classes are not on the classpath
[ "Determines", "whether", "the", "given", "type", "is", "the", "same", "or", "a", "sub", "type", "of", "the", "other", "type", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/InheritanceHelper.java#L110-L124
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/TrashPolicy.java
TrashPolicy.getInstance
public static TrashPolicy getInstance(Configuration conf, FileSystem fs, Path home) throws IOException { Class<? extends TrashPolicy> trashClass = conf.getClass("fs.trash.classname", TrashPolicyDefault.class, TrashPolicy.class); TrashPolicy trash = (TrashPolicy) ReflectionUtils.newInstance(trashClass, conf); trash.initialize(conf, fs, home); // initialize TrashPolicy return trash; }
java
public static TrashPolicy getInstance(Configuration conf, FileSystem fs, Path home) throws IOException { Class<? extends TrashPolicy> trashClass = conf.getClass("fs.trash.classname", TrashPolicyDefault.class, TrashPolicy.class); TrashPolicy trash = (TrashPolicy) ReflectionUtils.newInstance(trashClass, conf); trash.initialize(conf, fs, home); // initialize TrashPolicy return trash; }
[ "public", "static", "TrashPolicy", "getInstance", "(", "Configuration", "conf", ",", "FileSystem", "fs", ",", "Path", "home", ")", "throws", "IOException", "{", "Class", "<", "?", "extends", "TrashPolicy", ">", "trashClass", "=", "conf", ".", "getClass", "(", ...
Get an instance of the configured TrashPolicy based on the value of the configuration paramater fs.trash.classname. @param conf the configuration to be used @param fs the file system to be used @param home the home directory @return an instance of TrashPolicy
[ "Get", "an", "instance", "of", "the", "configured", "TrashPolicy", "based", "on", "the", "value", "of", "the", "configuration", "paramater", "fs", ".", "trash", ".", "classname", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/TrashPolicy.java#L94-L102
alexvasilkov/AndroidCommons
library/src/main/java/com/alexvasilkov/android/commons/nav/handlers/PickPhoneHandler.java
PickPhoneHandler.onResult
@Nullable public static Data onResult(@NonNull Context context, int resultCode, @Nullable Intent data) { if (resultCode != Activity.RESULT_OK || data == null || data.getData() == null) { return null; } Cursor cursor = null; try { cursor = context.getContentResolver().query(data.getData(), new String[] { ContactsContract.CommonDataKinds.Phone.CONTACT_ID, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER }, null, null, null); if (cursor != null && cursor.moveToFirst()) { return new Data(cursor.getInt(0), cursor.getString(1), cursor.getString(2)); } } finally { if (cursor != null) { cursor.close(); } } return null; }
java
@Nullable public static Data onResult(@NonNull Context context, int resultCode, @Nullable Intent data) { if (resultCode != Activity.RESULT_OK || data == null || data.getData() == null) { return null; } Cursor cursor = null; try { cursor = context.getContentResolver().query(data.getData(), new String[] { ContactsContract.CommonDataKinds.Phone.CONTACT_ID, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER }, null, null, null); if (cursor != null && cursor.moveToFirst()) { return new Data(cursor.getInt(0), cursor.getString(1), cursor.getString(2)); } } finally { if (cursor != null) { cursor.close(); } } return null; }
[ "@", "Nullable", "public", "static", "Data", "onResult", "(", "@", "NonNull", "Context", "context", ",", "int", "resultCode", ",", "@", "Nullable", "Intent", "data", ")", "{", "if", "(", "resultCode", "!=", "Activity", ".", "RESULT_OK", "||", "data", "==",...
Call this method from {@link Activity#onActivityResult(int, int, Intent)} method to get picked contact info.
[ "Call", "this", "method", "from", "{" ]
train
https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/nav/handlers/PickPhoneHandler.java#L18-L44
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPDefinitionUtil.java
CPDefinitionUtil.findByUUID_G
public static CPDefinition findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPDefinitionException { return getPersistence().findByUUID_G(uuid, groupId); }
java
public static CPDefinition findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPDefinitionException { return getPersistence().findByUUID_G(uuid, groupId); }
[ "public", "static", "CPDefinition", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "product", ".", "exception", ".", "NoSuchCPDefinitionException", "{", "return", "getPersistence", "(", ...
Returns the cp definition where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPDefinitionException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp definition @throws NoSuchCPDefinitionException if a matching cp definition could not be found
[ "Returns", "the", "cp", "definition", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPDefinitionException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPDefinitionUtil.java#L278-L281
google/closure-compiler
src/com/google/javascript/jscomp/CheckAccessControls.java
CheckAccessControls.checkNameDeprecation
private void checkNameDeprecation(NodeTraversal t, Node n) { if (!n.isName()) { return; } if (!shouldEmitDeprecationWarning(t, n)) { return; } Var var = t.getScope().getVar(n.getString()); JSDocInfo docInfo = var == null ? null : var.getJSDocInfo(); if (docInfo != null && docInfo.isDeprecated()) { if (docInfo.getDeprecationReason() != null) { compiler.report( JSError.make(n, DEPRECATED_NAME_REASON, n.getString(), docInfo.getDeprecationReason())); } else { compiler.report(JSError.make(n, DEPRECATED_NAME, n.getString())); } } }
java
private void checkNameDeprecation(NodeTraversal t, Node n) { if (!n.isName()) { return; } if (!shouldEmitDeprecationWarning(t, n)) { return; } Var var = t.getScope().getVar(n.getString()); JSDocInfo docInfo = var == null ? null : var.getJSDocInfo(); if (docInfo != null && docInfo.isDeprecated()) { if (docInfo.getDeprecationReason() != null) { compiler.report( JSError.make(n, DEPRECATED_NAME_REASON, n.getString(), docInfo.getDeprecationReason())); } else { compiler.report(JSError.make(n, DEPRECATED_NAME, n.getString())); } } }
[ "private", "void", "checkNameDeprecation", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "if", "(", "!", "n", ".", "isName", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "shouldEmitDeprecationWarning", "(", "t", ",", "n", ")", ")"...
Checks the given NAME node to ensure that access restrictions are obeyed.
[ "Checks", "the", "given", "NAME", "node", "to", "ensure", "that", "access", "restrictions", "are", "obeyed", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckAccessControls.java#L448-L468
datasalt/pangool
core/src/main/java/com/datasalt/pangool/utils/InstancesDistributor.java
InstancesDistributor.locateFileInCache
private static Path locateFileInCache(Configuration conf, String filename) throws IOException { return new Path(getInstancesFolder(FileSystem.get(conf), conf), filename); }
java
private static Path locateFileInCache(Configuration conf, String filename) throws IOException { return new Path(getInstancesFolder(FileSystem.get(conf), conf), filename); }
[ "private", "static", "Path", "locateFileInCache", "(", "Configuration", "conf", ",", "String", "filename", ")", "throws", "IOException", "{", "return", "new", "Path", "(", "getInstancesFolder", "(", "FileSystem", ".", "get", "(", "conf", ")", ",", "conf", ")",...
Locates a file in the temporal folder @param conf The Hadoop Configuration. @param filename The file name. @throws IOException
[ "Locates", "a", "file", "in", "the", "temporal", "folder" ]
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/InstancesDistributor.java#L149-L151
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/NameSpaceBinderImpl.java
NameSpaceBinderImpl.createBindingObject
@Override public EJBBinding createBindingObject(HomeRecord hr, HomeWrapperSet homeSet, String interfaceName, int interfaceIndex, boolean local) { return new EJBBinding(hr, interfaceName, interfaceIndex, local); }
java
@Override public EJBBinding createBindingObject(HomeRecord hr, HomeWrapperSet homeSet, String interfaceName, int interfaceIndex, boolean local) { return new EJBBinding(hr, interfaceName, interfaceIndex, local); }
[ "@", "Override", "public", "EJBBinding", "createBindingObject", "(", "HomeRecord", "hr", ",", "HomeWrapperSet", "homeSet", ",", "String", "interfaceName", ",", "int", "interfaceIndex", ",", "boolean", "local", ")", "{", "return", "new", "EJBBinding", "(", "hr", ...
Store the binding information for later use. @see com.ibm.ws.ejbcontainer.runtime.NameSpaceBinder#createBindingObject(com.ibm.ejs.container.HomeRecord, com.ibm.websphere.csi.HomeWrapperSet, java.lang.String, boolean, boolean)
[ "Store", "the", "binding", "information", "for", "later", "use", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/NameSpaceBinderImpl.java#L54-L61
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java
CellUtil.getCellValue
public static Object getCellValue(Cell cell, CellType cellType, CellEditor cellEditor) { if (null == cell) { return null; } if (null == cellType) { cellType = cell.getCellTypeEnum(); } Object value; switch (cellType) { case NUMERIC: value = getNumericValue(cell); break; case BOOLEAN: value = cell.getBooleanCellValue(); break; case FORMULA: // 遇到公式时查找公式结果类型 value = getCellValue(cell, cell.getCachedFormulaResultTypeEnum(), cellEditor); break; case BLANK: value = StrUtil.EMPTY; break; case ERROR: final FormulaError error = FormulaError.forInt(cell.getErrorCellValue()); value = (null == error) ? StrUtil.EMPTY : error.getString(); break; default: value = cell.getStringCellValue(); } return null == cellEditor ? value : cellEditor.edit(cell, value); }
java
public static Object getCellValue(Cell cell, CellType cellType, CellEditor cellEditor) { if (null == cell) { return null; } if (null == cellType) { cellType = cell.getCellTypeEnum(); } Object value; switch (cellType) { case NUMERIC: value = getNumericValue(cell); break; case BOOLEAN: value = cell.getBooleanCellValue(); break; case FORMULA: // 遇到公式时查找公式结果类型 value = getCellValue(cell, cell.getCachedFormulaResultTypeEnum(), cellEditor); break; case BLANK: value = StrUtil.EMPTY; break; case ERROR: final FormulaError error = FormulaError.forInt(cell.getErrorCellValue()); value = (null == error) ? StrUtil.EMPTY : error.getString(); break; default: value = cell.getStringCellValue(); } return null == cellEditor ? value : cellEditor.edit(cell, value); }
[ "public", "static", "Object", "getCellValue", "(", "Cell", "cell", ",", "CellType", "cellType", ",", "CellEditor", "cellEditor", ")", "{", "if", "(", "null", "==", "cell", ")", "{", "return", "null", ";", "}", "if", "(", "null", "==", "cellType", ")", ...
获取单元格值<br> 如果单元格值为数字格式,则判断其格式中是否有小数部分,无则返回Long类型,否则返回Double类型 @param cell {@link Cell}单元格 @param cellType 单元格值类型{@link CellType}枚举,如果为{@code null}默认使用cell的类型 @param cellEditor 单元格值编辑器。可以通过此编辑器对单元格值做自定义操作 @return 值,类型可能为:Date、Double、Boolean、String
[ "获取单元格值<br", ">", "如果单元格值为数字格式,则判断其格式中是否有小数部分,无则返回Long类型,否则返回Double类型" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java#L78-L110
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/common/StaticSemanticSpace.java
StaticSemanticSpace.loadFromFormat
private void loadFromFormat(InputStream is, SSpaceFormat format) throws IOException { // NOTE: Use a LinkedHashMap here because this will ensure that the // words are returned in the same row-order as the matrix. This // generates better disk I/O behavior for accessing the matrix since // each word is directly after the previous on disk. termToIndex = new LinkedHashMap<String, Integer>(); Matrix m = null; long start = System.currentTimeMillis(); switch (format) { case TEXT: m = Matrices.synchronizedMatrix(loadText(is)); break; case BINARY: m = Matrices.synchronizedMatrix(loadBinary(is)); break; // REMINDER: we don't use synchronized here because the current // sparse matrix implementations are thread-safe. We really should // be aware of this for when the file-based sparse matrix gets // implemented. -jurgens 05/29/09 case SPARSE_TEXT: m = loadSparseText(is); break; case SPARSE_BINARY: m = loadSparseBinary(is); break; } if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("loaded " + format + " .sspace file in " + (System.currentTimeMillis() - start) + "ms"); } wordSpace = m; }
java
private void loadFromFormat(InputStream is, SSpaceFormat format) throws IOException { // NOTE: Use a LinkedHashMap here because this will ensure that the // words are returned in the same row-order as the matrix. This // generates better disk I/O behavior for accessing the matrix since // each word is directly after the previous on disk. termToIndex = new LinkedHashMap<String, Integer>(); Matrix m = null; long start = System.currentTimeMillis(); switch (format) { case TEXT: m = Matrices.synchronizedMatrix(loadText(is)); break; case BINARY: m = Matrices.synchronizedMatrix(loadBinary(is)); break; // REMINDER: we don't use synchronized here because the current // sparse matrix implementations are thread-safe. We really should // be aware of this for when the file-based sparse matrix gets // implemented. -jurgens 05/29/09 case SPARSE_TEXT: m = loadSparseText(is); break; case SPARSE_BINARY: m = loadSparseBinary(is); break; } if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("loaded " + format + " .sspace file in " + (System.currentTimeMillis() - start) + "ms"); } wordSpace = m; }
[ "private", "void", "loadFromFormat", "(", "InputStream", "is", ",", "SSpaceFormat", "format", ")", "throws", "IOException", "{", "// NOTE: Use a LinkedHashMap here because this will ensure that the", "// words are returned in the same row-order as the matrix. This", "// generates bett...
Loads the semantic space data from the specified stream, using the format to determine how the data is layed out internally within the stream. @param is the input stream from which the semantic space will be read @param format the internal data formatting of the semantic space
[ "Loads", "the", "semantic", "space", "data", "from", "the", "specified", "stream", "using", "the", "format", "to", "determine", "how", "the", "data", "is", "layed", "out", "internally", "within", "the", "stream", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/StaticSemanticSpace.java#L161-L196
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_GeometryN.java
ST_GeometryN.getGeometryN
public static Geometry getGeometryN(Geometry geometry, Integer n) throws SQLException { if (geometry == null) { return null; } if (n >= 1 && n <= geometry.getNumGeometries()) { return geometry.getGeometryN(n - 1); } else { throw new SQLException(OUT_OF_BOUNDS_ERR_MESSAGE); } }
java
public static Geometry getGeometryN(Geometry geometry, Integer n) throws SQLException { if (geometry == null) { return null; } if (n >= 1 && n <= geometry.getNumGeometries()) { return geometry.getGeometryN(n - 1); } else { throw new SQLException(OUT_OF_BOUNDS_ERR_MESSAGE); } }
[ "public", "static", "Geometry", "getGeometryN", "(", "Geometry", "geometry", ",", "Integer", "n", ")", "throws", "SQLException", "{", "if", "(", "geometry", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "n", ">=", "1", "&&", "n", "<=",...
Return Geometry number n from the given GeometryCollection. @param geometry GeometryCollection @param n Index of Geometry number n in [1-N] @return Geometry number n or Null if parameter is null. @throws SQLException
[ "Return", "Geometry", "number", "n", "from", "the", "given", "GeometryCollection", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_GeometryN.java#L61-L70
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/MtoNBroker.java
MtoNBroker.deleteMtoNImplementor
public void deleteMtoNImplementor(CollectionDescriptor cod, Object obj) { ClassDescriptor cld = pb.getDescriptorRepository().getDescriptorFor(obj.getClass()); ValueContainer[] pkValues = pb.serviceBrokerHelper().getKeyValues(cld, obj); String[] pkColumns = cod.getFksToThisClass(); String table = cod.getIndirectionTable(); String deleteStmt = pb.serviceSqlGenerator().getDeleteMNStatement(table, pkColumns, null); pb.serviceJdbcAccess().executeUpdateSQL(deleteStmt, cld, pkValues, null); }
java
public void deleteMtoNImplementor(CollectionDescriptor cod, Object obj) { ClassDescriptor cld = pb.getDescriptorRepository().getDescriptorFor(obj.getClass()); ValueContainer[] pkValues = pb.serviceBrokerHelper().getKeyValues(cld, obj); String[] pkColumns = cod.getFksToThisClass(); String table = cod.getIndirectionTable(); String deleteStmt = pb.serviceSqlGenerator().getDeleteMNStatement(table, pkColumns, null); pb.serviceJdbcAccess().executeUpdateSQL(deleteStmt, cld, pkValues, null); }
[ "public", "void", "deleteMtoNImplementor", "(", "CollectionDescriptor", "cod", ",", "Object", "obj", ")", "{", "ClassDescriptor", "cld", "=", "pb", ".", "getDescriptorRepository", "(", ")", ".", "getDescriptorFor", "(", "obj", ".", "getClass", "(", ")", ")", "...
delete all rows from m:n table belonging to obj @param cod @param obj
[ "delete", "all", "rows", "from", "m", ":", "n", "table", "belonging", "to", "obj" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/MtoNBroker.java#L196-L204
baratine/baratine
kraken/src/main/java/com/caucho/v5/kelp/query/ObjectPathExprBuilder.java
ObjectPathExprBuilder.buildParentPath
@Override protected PathHessian buildParentPath(QueryBuilder builder) { PathMapHessian pathMap = _parent.buildPathMap(builder); PathHessian subPath = pathMap.get(_name); if (subPath == null) { PathMapHessian pathMapSelf = buildPathMap(builder); subPath = new PathHessianFieldParent(this, pathMapSelf, _name); pathMap.put(_name, subPath); } return subPath; }
java
@Override protected PathHessian buildParentPath(QueryBuilder builder) { PathMapHessian pathMap = _parent.buildPathMap(builder); PathHessian subPath = pathMap.get(_name); if (subPath == null) { PathMapHessian pathMapSelf = buildPathMap(builder); subPath = new PathHessianFieldParent(this, pathMapSelf, _name); pathMap.put(_name, subPath); } return subPath; }
[ "@", "Override", "protected", "PathHessian", "buildParentPath", "(", "QueryBuilder", "builder", ")", "{", "PathMapHessian", "pathMap", "=", "_parent", ".", "buildPathMap", "(", "builder", ")", ";", "PathHessian", "subPath", "=", "pathMap", ".", "get", "(", "_nam...
/* @Override public PathBuilderH3 buildPathH3(QueryBuilder builder) { PathMapHessian pathMap = _parent.buildPathMap(builder); System.out.println("PM: " + pathMap + " " + _parent); return pathMap.field(_name); }
[ "/", "*", "@Override", "public", "PathBuilderH3", "buildPathH3", "(", "QueryBuilder", "builder", ")", "{", "PathMapHessian", "pathMap", "=", "_parent", ".", "buildPathMap", "(", "builder", ")", ";", "System", ".", "out", ".", "println", "(", "PM", ":", "+", ...
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/query/ObjectPathExprBuilder.java#L121-L137
jbundle/jbundle
main/screen/src/main/java/org/jbundle/main/properties/screen/PropertiesInputGridScreen.java
PropertiesInputGridScreen.doCommand
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if ((MenuConstants.FORMLINK.equalsIgnoreCase(strCommand)) || (MenuConstants.FORM.equalsIgnoreCase(strCommand))) return true; // Ignore these commands return super.doCommand(strCommand, sourceSField, iCommandOptions); }
java
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if ((MenuConstants.FORMLINK.equalsIgnoreCase(strCommand)) || (MenuConstants.FORM.equalsIgnoreCase(strCommand))) return true; // Ignore these commands return super.doCommand(strCommand, sourceSField, iCommandOptions); }
[ "public", "boolean", "doCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iCommandOptions", ")", "{", "if", "(", "(", "MenuConstants", ".", "FORMLINK", ".", "equalsIgnoreCase", "(", "strCommand", ")", ")", "||", "(", "Menu...
Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "<br", "/", ">", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "<br", "/", ">", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/properties/screen/PropertiesInputGridScreen.java#L179-L184
Inbot/inbot-utils
src/main/java/io/inbot/utils/MiscUtils.java
MiscUtils.urlEncode
public static String urlEncode(String s) { try { return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("get a jdk that actually supports utf-8", e); } }
java
public static String urlEncode(String s) { try { return URLEncoder.encode(s, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("get a jdk that actually supports utf-8", e); } }
[ "public", "static", "String", "urlEncode", "(", "String", "s", ")", "{", "try", "{", "return", "URLEncoder", ".", "encode", "(", "s", ",", "StandardCharsets", ".", "UTF_8", ".", "name", "(", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException",...
Url encode a string and don't throw a checked exception. Uses UTF-8 as per RFC 3986. @param s a string @return url encoded string
[ "Url", "encode", "a", "string", "and", "don", "t", "throw", "a", "checked", "exception", ".", "Uses", "UTF", "-", "8", "as", "per", "RFC", "3986", "." ]
train
https://github.com/Inbot/inbot-utils/blob/3112bc08d4237e95fe0f8a219a5bbceb390d0505/src/main/java/io/inbot/utils/MiscUtils.java#L31-L37
openengsb/openengsb
components/util/src/main/java/org/openengsb/core/util/CipherUtils.java
CipherUtils.verify
public static boolean verify(byte[] text, byte[] signatureValue, PublicKey key, String algorithm) throws SignatureException { Signature signature; try { signature = Signature.getInstance(algorithm); signature.initVerify(key); } catch (GeneralSecurityException e) { throw new IllegalArgumentException("cannot initialize signature for algorithm " + algorithm, e); } signature.update(text); return signature.verify(signatureValue); }
java
public static boolean verify(byte[] text, byte[] signatureValue, PublicKey key, String algorithm) throws SignatureException { Signature signature; try { signature = Signature.getInstance(algorithm); signature.initVerify(key); } catch (GeneralSecurityException e) { throw new IllegalArgumentException("cannot initialize signature for algorithm " + algorithm, e); } signature.update(text); return signature.verify(signatureValue); }
[ "public", "static", "boolean", "verify", "(", "byte", "[", "]", "text", ",", "byte", "[", "]", "signatureValue", ",", "PublicKey", "key", ",", "String", "algorithm", ")", "throws", "SignatureException", "{", "Signature", "signature", ";", "try", "{", "signat...
verifies if the given data is valid for the given signature and public key. @throws SignatureException if the algorithm cannot be initialized
[ "verifies", "if", "the", "given", "data", "is", "valid", "for", "the", "given", "signature", "and", "public", "key", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/util/src/main/java/org/openengsb/core/util/CipherUtils.java#L224-L235
VoltDB/voltdb
src/frontend/org/voltdb/client/ClientConfig.java
ClientConfig.setTrustStore
public void setTrustStore(String pathToTrustStore, String trustStorePassword) { File tsFD = new File(pathToTrustStore != null && !pathToTrustStore.trim().isEmpty() ? pathToTrustStore : ""); if (!tsFD.exists() || !tsFD.isFile() || !tsFD.canRead()) { throw new IllegalArgumentException("Trust store " + pathToTrustStore + " is not a read accessible file"); } m_sslConfig = new SSLConfiguration.SslConfig(null, null, pathToTrustStore, trustStorePassword); }
java
public void setTrustStore(String pathToTrustStore, String trustStorePassword) { File tsFD = new File(pathToTrustStore != null && !pathToTrustStore.trim().isEmpty() ? pathToTrustStore : ""); if (!tsFD.exists() || !tsFD.isFile() || !tsFD.canRead()) { throw new IllegalArgumentException("Trust store " + pathToTrustStore + " is not a read accessible file"); } m_sslConfig = new SSLConfiguration.SslConfig(null, null, pathToTrustStore, trustStorePassword); }
[ "public", "void", "setTrustStore", "(", "String", "pathToTrustStore", ",", "String", "trustStorePassword", ")", "{", "File", "tsFD", "=", "new", "File", "(", "pathToTrustStore", "!=", "null", "&&", "!", "pathToTrustStore", ".", "trim", "(", ")", ".", "isEmpty"...
Configure trust store @param pathToTrustStore file specification for the trust store @param trustStorePassword trust store key file password
[ "Configure", "trust", "store" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/client/ClientConfig.java#L467-L473
GCRC/nunaliit
nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/StreamUtils.java
StreamUtils.copyStream
static public void copyStream(Reader reader, Writer writer, int transferBufferSize) throws IOException { if( transferBufferSize < 1 ) { throw new IOException("Transfer buffer size can not be smaller than 1"); } char[] buffer = new char[transferBufferSize]; int bytesRead = reader.read(buffer); while( bytesRead >= 0 ) { writer.write(buffer, 0, bytesRead); bytesRead = reader.read(buffer); } }
java
static public void copyStream(Reader reader, Writer writer, int transferBufferSize) throws IOException { if( transferBufferSize < 1 ) { throw new IOException("Transfer buffer size can not be smaller than 1"); } char[] buffer = new char[transferBufferSize]; int bytesRead = reader.read(buffer); while( bytesRead >= 0 ) { writer.write(buffer, 0, bytesRead); bytesRead = reader.read(buffer); } }
[ "static", "public", "void", "copyStream", "(", "Reader", "reader", ",", "Writer", "writer", ",", "int", "transferBufferSize", ")", "throws", "IOException", "{", "if", "(", "transferBufferSize", "<", "1", ")", "{", "throw", "new", "IOException", "(", "\"Transfe...
Copy all the characters from a reader to a writer. @param reader Input character stream @param writer Output character stream @param transferBufferSize Size of character buffer used to transfer characters from one stream to the other @throws IOException
[ "Copy", "all", "the", "characters", "from", "a", "reader", "to", "a", "writer", "." ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/StreamUtils.java#L64-L77
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java
MiniTemplator.generateOutput
public void generateOutput(String outputFileName) throws IOException { FileOutputStream stream = null; OutputStreamWriter writer = null; try { stream = new FileOutputStream(outputFileName); writer = new OutputStreamWriter(stream, charset); generateOutput(writer); } finally { if (writer != null) { writer.close(); } if (stream != null) { stream.close(); } } }
java
public void generateOutput(String outputFileName) throws IOException { FileOutputStream stream = null; OutputStreamWriter writer = null; try { stream = new FileOutputStream(outputFileName); writer = new OutputStreamWriter(stream, charset); generateOutput(writer); } finally { if (writer != null) { writer.close(); } if (stream != null) { stream.close(); } } }
[ "public", "void", "generateOutput", "(", "String", "outputFileName", ")", "throws", "IOException", "{", "FileOutputStream", "stream", "=", "null", ";", "OutputStreamWriter", "writer", "=", "null", ";", "try", "{", "stream", "=", "new", "FileOutputStream", "(", "...
Generates the HTML page and writes it into a file. @param outputFileName name of the file to which the generated HTML page will be written. @throws IOException when an i/o error occurs while writing to the file.
[ "Generates", "the", "HTML", "page", "and", "writes", "it", "into", "a", "file", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java#L621-L636
jhipster/jhipster
jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java
QueryService.buildReferringEntitySpecification
protected <OTHER, X> Specification<ENTITY> buildReferringEntitySpecification(Filter<X> filter, SingularAttribute<? super ENTITY, OTHER> reference, SingularAttribute<? super OTHER, X> valueField) { return buildSpecification(filter, root -> root.get(reference).get(valueField)); }
java
protected <OTHER, X> Specification<ENTITY> buildReferringEntitySpecification(Filter<X> filter, SingularAttribute<? super ENTITY, OTHER> reference, SingularAttribute<? super OTHER, X> valueField) { return buildSpecification(filter, root -> root.get(reference).get(valueField)); }
[ "protected", "<", "OTHER", ",", "X", ">", "Specification", "<", "ENTITY", ">", "buildReferringEntitySpecification", "(", "Filter", "<", "X", ">", "filter", ",", "SingularAttribute", "<", "?", "super", "ENTITY", ",", "OTHER", ">", "reference", ",", "SingularAtt...
Helper function to return a specification for filtering on one-to-one or many-to-one reference. Usage: <pre> Specification&lt;Employee&gt; specByProjectId = buildReferringEntitySpecification(criteria.getProjectId(), Employee_.project, Project_.id); Specification&lt;Employee&gt; specByProjectName = buildReferringEntitySpecification(criteria.getProjectName(), Employee_.project, Project_.name); </pre> @param filter the filter object which contains a value, which needs to match or a flag if nullness is checked. @param reference the attribute of the static metamodel for the referring entity. @param valueField the attribute of the static metamodel of the referred entity, where the equality should be checked. @param <OTHER> The type of the referenced entity. @param <X> The type of the attribute which is filtered. @return a Specification
[ "Helper", "function", "to", "return", "a", "specification", "for", "filtering", "on", "one", "-", "to", "-", "one", "or", "many", "-", "to", "-", "one", "reference", ".", "Usage", ":", "<pre", ">", "Specification&lt", ";", "Employee&gt", ";", "specByProjec...
train
https://github.com/jhipster/jhipster/blob/5dcf4239c7cc035e188ef02447d3c628fac5c5d9/jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java#L184-L188
watchrabbit/rabbit-executor
src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java
ExecutorCommand.observe
public void observe(CheckedRunnable runnable, CheckedRunnable onSuccess, Consumer<Exception> onFailure) { service.executeAsynchronously(wrap(runnable, onSuccess, onFailure), config); }
java
public void observe(CheckedRunnable runnable, CheckedRunnable onSuccess, Consumer<Exception> onFailure) { service.executeAsynchronously(wrap(runnable, onSuccess, onFailure), config); }
[ "public", "void", "observe", "(", "CheckedRunnable", "runnable", ",", "CheckedRunnable", "onSuccess", ",", "Consumer", "<", "Exception", ">", "onFailure", ")", "{", "service", ".", "executeAsynchronously", "(", "wrap", "(", "runnable", ",", "onSuccess", ",", "on...
Invokes runnable asynchronously with respecting circuit logic and cache logic if configured. If callable completed with success then the {@code onSuccess} method is called. If callable throws exception then {@code onFailure} method is called @param runnable method fired by executor @param onSuccess method fired if callable is completed with success @param onFailure method fired if callable throws
[ "Invokes", "runnable", "asynchronously", "with", "respecting", "circuit", "logic", "and", "cache", "logic", "if", "configured", ".", "If", "callable", "completed", "with", "success", "then", "the", "{", "@code", "onSuccess", "}", "method", "is", "called", ".", ...
train
https://github.com/watchrabbit/rabbit-executor/blob/fe6674b78e6ab464babcecb6e1f100edec3c9966/src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java#L200-L202
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Strings.java
Strings.containsIgnoreCase
public static boolean containsIgnoreCase(final String string, final String[] strings) { if (null == strings) { return false; } return Arrays.stream(strings).anyMatch(str -> StringUtils.equalsIgnoreCase(string, str)); }
java
public static boolean containsIgnoreCase(final String string, final String[] strings) { if (null == strings) { return false; } return Arrays.stream(strings).anyMatch(str -> StringUtils.equalsIgnoreCase(string, str)); }
[ "public", "static", "boolean", "containsIgnoreCase", "(", "final", "String", "string", ",", "final", "String", "[", "]", "strings", ")", "{", "if", "(", "null", "==", "strings", ")", "{", "return", "false", ";", "}", "return", "Arrays", ".", "stream", "(...
Determines whether the specified strings contains the specified string, ignoring case considerations. @param string the specified string @param strings the specified strings @return {@code true} if the specified strings contains the specified string, ignoring case considerations, returns {@code false} otherwise
[ "Determines", "whether", "the", "specified", "strings", "contains", "the", "specified", "string", "ignoring", "case", "considerations", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Strings.java#L207-L213
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.createHeader
private static AudioFrame createHeader(HeaderBitField bits) { if (bits.get(21, 23) != 7) { return null; } int mpegVer = bits.get(19, 20); int layer = bits.get(17, 18); int bitRateCode = bits.get(12, 15); int sampleRateCode = bits.get(10, 11); int padding = bits.get(9); if (mpegVer == 1 || layer == 0 || bitRateCode == 0 || bitRateCode == 15 || sampleRateCode == 3) { // invalid header values return null; } int bitRate = calculateBitRate(mpegVer, layer, bitRateCode); int sampleRate = calculateSampleRate(mpegVer, sampleRateCode); int length = calculateFrameLength(layer, bitRate, sampleRate, padding); float duration = calculateDuration(layer, sampleRate); int channels = calculateChannels(bits.get(6, 7)); return new AudioFrame(mpegVer, layer, bitRate, sampleRate, channels, length, duration); }
java
private static AudioFrame createHeader(HeaderBitField bits) { if (bits.get(21, 23) != 7) { return null; } int mpegVer = bits.get(19, 20); int layer = bits.get(17, 18); int bitRateCode = bits.get(12, 15); int sampleRateCode = bits.get(10, 11); int padding = bits.get(9); if (mpegVer == 1 || layer == 0 || bitRateCode == 0 || bitRateCode == 15 || sampleRateCode == 3) { // invalid header values return null; } int bitRate = calculateBitRate(mpegVer, layer, bitRateCode); int sampleRate = calculateSampleRate(mpegVer, sampleRateCode); int length = calculateFrameLength(layer, bitRate, sampleRate, padding); float duration = calculateDuration(layer, sampleRate); int channels = calculateChannels(bits.get(6, 7)); return new AudioFrame(mpegVer, layer, bitRate, sampleRate, channels, length, duration); }
[ "private", "static", "AudioFrame", "createHeader", "(", "HeaderBitField", "bits", ")", "{", "if", "(", "bits", ".", "get", "(", "21", ",", "23", ")", "!=", "7", ")", "{", "return", "null", ";", "}", "int", "mpegVer", "=", "bits", ".", "get", "(", "...
Creates an {@code AudioFrame} object based on the given header field. If the header field contains invalid values, result is <b>null</b>. @param bits the header bit field @return the {@code AudioFrame}
[ "Creates", "an", "{", "@code", "AudioFrame", "}", "object", "based", "on", "the", "given", "header", "field", ".", "If", "the", "header", "field", "contains", "invalid", "values", "result", "is", "<b", ">", "null<", "/", "b", ">", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L179-L198
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/InputTypeUtil.java
InputTypeUtil.getPreProcessorForInputTypeCnn3DLayers
public static InputPreProcessor getPreProcessorForInputTypeCnn3DLayers(InputType inputType, String layerName) { switch (inputType.getType()) { case FF: log.info("Automatic addition of FF -> CNN3D preprocessors: not yet implemented (layer name: \"" + layerName + "\")"); return null; case RNN: log.warn("Automatic addition of RNN -> CNN3D preprocessors: not yet implemented (layer name: \"" + layerName + "\")"); return null; // TODO: handle CNN to CNN3D case CNN3D: return null; default: throw new RuntimeException("Unknown input type: " + inputType); } }
java
public static InputPreProcessor getPreProcessorForInputTypeCnn3DLayers(InputType inputType, String layerName) { switch (inputType.getType()) { case FF: log.info("Automatic addition of FF -> CNN3D preprocessors: not yet implemented (layer name: \"" + layerName + "\")"); return null; case RNN: log.warn("Automatic addition of RNN -> CNN3D preprocessors: not yet implemented (layer name: \"" + layerName + "\")"); return null; // TODO: handle CNN to CNN3D case CNN3D: return null; default: throw new RuntimeException("Unknown input type: " + inputType); } }
[ "public", "static", "InputPreProcessor", "getPreProcessorForInputTypeCnn3DLayers", "(", "InputType", "inputType", ",", "String", "layerName", ")", "{", "switch", "(", "inputType", ".", "getType", "(", ")", ")", "{", "case", "FF", ":", "log", ".", "info", "(", ...
Utility method for determining the appropriate preprocessor for CNN layers, such as {@link ConvolutionLayer} and {@link SubsamplingLayer} @param inputType Input type to get the preprocessor for @return Null if no preprocessor is required; otherwise the appropriate preprocessor for the given input type
[ "Utility", "method", "for", "determining", "the", "appropriate", "preprocessor", "for", "CNN", "layers", "such", "as", "{", "@link", "ConvolutionLayer", "}", "and", "{", "@link", "SubsamplingLayer", "}" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/InputTypeUtil.java#L417-L433
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DataHandler.java
DataHandler.pushFcmRegistrationId
@Deprecated public void pushFcmRegistrationId(String fcmId, boolean register) { CleverTapAPI cleverTapAPI = weakReference.get(); if (cleverTapAPI == null) { Logger.d("CleverTap Instance is null."); } else { cleverTapAPI.pushFcmRegistrationId(fcmId, register); } }
java
@Deprecated public void pushFcmRegistrationId(String fcmId, boolean register) { CleverTapAPI cleverTapAPI = weakReference.get(); if (cleverTapAPI == null) { Logger.d("CleverTap Instance is null."); } else { cleverTapAPI.pushFcmRegistrationId(fcmId, register); } }
[ "@", "Deprecated", "public", "void", "pushFcmRegistrationId", "(", "String", "fcmId", ",", "boolean", "register", ")", "{", "CleverTapAPI", "cleverTapAPI", "=", "weakReference", ".", "get", "(", ")", ";", "if", "(", "cleverTapAPI", "==", "null", ")", "{", "L...
Sends the FCM registration ID to CleverTap. @param fcmId The FCM registration ID @param register Boolean indicating whether to register or not for receiving push messages from CleverTap. Set this to true to receive push messages from CleverTap, and false to not receive any messages from CleverTap. @deprecated use {@link CleverTapAPI#pushFcmRegistrationId(String gcmId, boolean register)}
[ "Sends", "the", "FCM", "registration", "ID", "to", "CleverTap", "." ]
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DataHandler.java#L43-L51
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java
SVGUtil.svgCircleSegment
public static Element svgCircleSegment(SVGPlot svgp, double centerx, double centery, double angleStart, double angleDelta, double innerRadius, double outerRadius) { final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine double sin1st = FastMath.sinAndCos(angleStart, tmp); double cos1st = tmp.value; double sin2nd = FastMath.sinAndCos(angleStart + angleDelta, tmp); double cos2nd = tmp.value; // Note: tmp is modified! double inner1stx = centerx + (innerRadius * sin1st); double inner1sty = centery - (innerRadius * cos1st); double outer1stx = centerx + (outerRadius * sin1st); double outer1sty = centery - (outerRadius * cos1st); double inner2ndx = centerx + (innerRadius * sin2nd); double inner2ndy = centery - (innerRadius * cos2nd); double outer2ndx = centerx + (outerRadius * sin2nd); double outer2ndy = centery - (outerRadius * cos2nd); double largeArc = angleDelta >= Math.PI ? 1 : 0; SVGPath path = new SVGPath(inner1stx, inner1sty).lineTo(outer1stx, outer1sty) // .ellipticalArc(outerRadius, outerRadius, 0, largeArc, 1, outer2ndx, outer2ndy) // .lineTo(inner2ndx, inner2ndy); if(innerRadius > 0) { path.ellipticalArc(innerRadius, innerRadius, 0, largeArc, 0, inner1stx, inner1sty); } return path.makeElement(svgp); }
java
public static Element svgCircleSegment(SVGPlot svgp, double centerx, double centery, double angleStart, double angleDelta, double innerRadius, double outerRadius) { final DoubleWrapper tmp = new DoubleWrapper(); // To return cosine double sin1st = FastMath.sinAndCos(angleStart, tmp); double cos1st = tmp.value; double sin2nd = FastMath.sinAndCos(angleStart + angleDelta, tmp); double cos2nd = tmp.value; // Note: tmp is modified! double inner1stx = centerx + (innerRadius * sin1st); double inner1sty = centery - (innerRadius * cos1st); double outer1stx = centerx + (outerRadius * sin1st); double outer1sty = centery - (outerRadius * cos1st); double inner2ndx = centerx + (innerRadius * sin2nd); double inner2ndy = centery - (innerRadius * cos2nd); double outer2ndx = centerx + (outerRadius * sin2nd); double outer2ndy = centery - (outerRadius * cos2nd); double largeArc = angleDelta >= Math.PI ? 1 : 0; SVGPath path = new SVGPath(inner1stx, inner1sty).lineTo(outer1stx, outer1sty) // .ellipticalArc(outerRadius, outerRadius, 0, largeArc, 1, outer2ndx, outer2ndy) // .lineTo(inner2ndx, inner2ndy); if(innerRadius > 0) { path.ellipticalArc(innerRadius, innerRadius, 0, largeArc, 0, inner1stx, inner1sty); } return path.makeElement(svgp); }
[ "public", "static", "Element", "svgCircleSegment", "(", "SVGPlot", "svgp", ",", "double", "centerx", ",", "double", "centery", ",", "double", "angleStart", ",", "double", "angleDelta", ",", "double", "innerRadius", ",", "double", "outerRadius", ")", "{", "final"...
Create a circle segment. @param svgp Plot to draw to @param centerx Center X position @param centery Center Y position @param angleStart Starting angle @param angleDelta Angle delta @param innerRadius inner radius @param outerRadius outer radius @return SVG element representing this circle segment
[ "Create", "a", "circle", "segment", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L678-L705
VoltDB/voltdb
src/frontend/org/voltdb/importclient/kinesis/KinesisStreamImporterConfig.java
KinesisStreamImporterConfig.getPropertyAsLong
public static long getPropertyAsLong(Properties props, String propertyName, long defaultValue) { String value = props.getProperty(propertyName, "").trim(); if (value.isEmpty()) { return defaultValue; } try { long val = Long.parseLong(value); if (val <= 0) { throw new IllegalArgumentException( "Value of " + propertyName + " should be positive, but current value is " + val); } return val; } catch (NumberFormatException e) { throw new IllegalArgumentException( "Property " + propertyName + " must be a number in Kinesis importer configuration."); } }
java
public static long getPropertyAsLong(Properties props, String propertyName, long defaultValue) { String value = props.getProperty(propertyName, "").trim(); if (value.isEmpty()) { return defaultValue; } try { long val = Long.parseLong(value); if (val <= 0) { throw new IllegalArgumentException( "Value of " + propertyName + " should be positive, but current value is " + val); } return val; } catch (NumberFormatException e) { throw new IllegalArgumentException( "Property " + propertyName + " must be a number in Kinesis importer configuration."); } }
[ "public", "static", "long", "getPropertyAsLong", "(", "Properties", "props", ",", "String", "propertyName", ",", "long", "defaultValue", ")", "{", "String", "value", "=", "props", ".", "getProperty", "(", "propertyName", ",", "\"\"", ")", ".", "trim", "(", "...
get property value as long. @param props The properties @param propertyName property name @param defaultValue The default value @return property value
[ "get", "property", "value", "as", "long", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importclient/kinesis/KinesisStreamImporterConfig.java#L232-L248