repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
JodaOrg/joda-money
src/main/java/org/joda/money/BigMoney.java
BigMoney.minusRetainScale
public BigMoney minusRetainScale(double amountToSubtract, RoundingMode roundingMode) { if (amountToSubtract == 0) { return this; } BigDecimal newAmount = amount.subtract(BigDecimal.valueOf(amountToSubtract)); newAmount = newAmount.setScale(getScale(), roundingMode); return BigMoney.of(currency, newAmount); }
java
public BigMoney minusRetainScale(double amountToSubtract, RoundingMode roundingMode) { if (amountToSubtract == 0) { return this; } BigDecimal newAmount = amount.subtract(BigDecimal.valueOf(amountToSubtract)); newAmount = newAmount.setScale(getScale(), roundingMode); return BigMoney.of(currency, newAmount); }
[ "public", "BigMoney", "minusRetainScale", "(", "double", "amountToSubtract", ",", "RoundingMode", "roundingMode", ")", "{", "if", "(", "amountToSubtract", "==", "0", ")", "{", "return", "this", ";", "}", "BigDecimal", "newAmount", "=", "amount", ".", "subtract",...
Returns a copy of this monetary value with the amount subtracted retaining the scale by rounding the result. <p> The scale of the result will be the same as the scale of this instance. For example,'USD 25.95' minus '3.029d' gives 'USD 22.92' with most rounding modes. <p> The amount is converted via {@link BigDecimal#valueOf(double)} which yields the most expected answer for most programming scenarios. Any {@code double} literal in code will be converted to exactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'. <p> This instance is immutable and unaffected by this method. @param amountToSubtract the monetary value to add, not null @param roundingMode the rounding mode to use to adjust the scale, not null @return the new instance with the input amount subtracted, never null
[ "Returns", "a", "copy", "of", "this", "monetary", "value", "with", "the", "amount", "subtracted", "retaining", "the", "scale", "by", "rounding", "the", "result", ".", "<p", ">", "The", "scale", "of", "the", "result", "will", "be", "the", "same", "as", "t...
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/BigMoney.java#L1226-L1233
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java
ServiceManagerSparql.addService
@Override public URI addService(Service service) throws ServiceException { // Check input and exit early if (service == null) throw new ServiceException("No service provided."); if (!this.graphStoreManager.canBeModified()) { log.warn("The dataset cannot be modified. Unable to store the service."); return null; } URI newBaseServiceUri = this.generateUniqueServiceUri(); // Replace URIs in service description try { replaceUris(service, newBaseServiceUri); } catch (URISyntaxException e) { log.error("Unable to create URI for service", e); throw new ServiceException("Unable to create URI for service", e); } // Store in backend ServiceWriterImpl writer = new ServiceWriterImpl(); Model svcModel = writer.generateModel(service); log.info("Adding service - {}", service.getUri().toASCIIString()); // The graph id corresponds is the base id this.graphStoreManager.putGraph(newBaseServiceUri, svcModel); // Generate Event this.getEventBus().post(new ServiceCreatedEvent(new Date(), service)); return service.getUri(); }
java
@Override public URI addService(Service service) throws ServiceException { // Check input and exit early if (service == null) throw new ServiceException("No service provided."); if (!this.graphStoreManager.canBeModified()) { log.warn("The dataset cannot be modified. Unable to store the service."); return null; } URI newBaseServiceUri = this.generateUniqueServiceUri(); // Replace URIs in service description try { replaceUris(service, newBaseServiceUri); } catch (URISyntaxException e) { log.error("Unable to create URI for service", e); throw new ServiceException("Unable to create URI for service", e); } // Store in backend ServiceWriterImpl writer = new ServiceWriterImpl(); Model svcModel = writer.generateModel(service); log.info("Adding service - {}", service.getUri().toASCIIString()); // The graph id corresponds is the base id this.graphStoreManager.putGraph(newBaseServiceUri, svcModel); // Generate Event this.getEventBus().post(new ServiceCreatedEvent(new Date(), service)); return service.getUri(); }
[ "@", "Override", "public", "URI", "addService", "(", "Service", "service", ")", "throws", "ServiceException", "{", "// Check input and exit early", "if", "(", "service", "==", "null", ")", "throw", "new", "ServiceException", "(", "\"No service provided.\"", ")", ";"...
Creates a Service Description in the system. Only needs to be fed with an MSM Service description. After successfully adding a service, implementations of this method should raise a {@code ServiceCreatedEvent} @param service the input service description in terms of MSM @return the URI this service description was saved to @throws uk.ac.open.kmi.iserve.sal.exception.ServiceException
[ "Creates", "a", "Service", "Description", "in", "the", "system", ".", "Only", "needs", "to", "be", "fed", "with", "an", "MSM", "Service", "description", "." ]
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L451-L482
skjolber/3d-bin-container-packing
src/main/java/com/github/skjolberg/packing/Packager.java
Packager.pack
public Container pack(List<BoxItem> boxes, long deadline) { return pack(boxes, filterByVolumeAndWeight(toBoxes(boxes, false), Arrays.asList(containers), 1), deadLinePredicate(deadline)); }
java
public Container pack(List<BoxItem> boxes, long deadline) { return pack(boxes, filterByVolumeAndWeight(toBoxes(boxes, false), Arrays.asList(containers), 1), deadLinePredicate(deadline)); }
[ "public", "Container", "pack", "(", "List", "<", "BoxItem", ">", "boxes", ",", "long", "deadline", ")", "{", "return", "pack", "(", "boxes", ",", "filterByVolumeAndWeight", "(", "toBoxes", "(", "boxes", ",", "false", ")", ",", "Arrays", ".", "asList", "(...
Return a container which holds all the boxes in the argument @param boxes list of boxes to fit in a container @param deadline the system time in millis at which the search should be aborted @return index of container if match, -1 if not
[ "Return", "a", "container", "which", "holds", "all", "the", "boxes", "in", "the", "argument" ]
train
https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/Packager.java#L85-L87
structr/structr
structr-core/src/main/java/org/structr/schema/action/Function.java
Function.assertArrayHasMinLengthAndMaxLengthAndAllElementsNotNull
protected void assertArrayHasMinLengthAndMaxLengthAndAllElementsNotNull(final Object[] array, final Integer minLength, final Integer maxLength) throws ArgumentCountException, ArgumentNullException { if (array.length < minLength || array.length > maxLength) { throw ArgumentCountException.notBetween(array.length, minLength, maxLength); } for (final Object element : array) { if (element == null) { throw new ArgumentNullException(); } } }
java
protected void assertArrayHasMinLengthAndMaxLengthAndAllElementsNotNull(final Object[] array, final Integer minLength, final Integer maxLength) throws ArgumentCountException, ArgumentNullException { if (array.length < minLength || array.length > maxLength) { throw ArgumentCountException.notBetween(array.length, minLength, maxLength); } for (final Object element : array) { if (element == null) { throw new ArgumentNullException(); } } }
[ "protected", "void", "assertArrayHasMinLengthAndMaxLengthAndAllElementsNotNull", "(", "final", "Object", "[", "]", "array", ",", "final", "Integer", "minLength", ",", "final", "Integer", "maxLength", ")", "throws", "ArgumentCountException", ",", "ArgumentNullException", "...
Test if the given object array has a minimum length and all its elements are not null. @param array @param minLength @param maxLength @throws ArgumentCountException in case of wrong number of parameters @throws ArgumentNullException in case of a null parameter
[ "Test", "if", "the", "given", "object", "array", "has", "a", "minimum", "length", "and", "all", "its", "elements", "are", "not", "null", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/action/Function.java#L147-L159
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/kernelized/CSKLRBatch.java
CSKLRBatch.setGamma
public void setGamma(double gamma) { if(gamma < 0 || Double.isNaN(gamma) || Double.isInfinite(gamma)) throw new IllegalArgumentException("Gamma must be in (0, Infity), not " + gamma); this.gamma = gamma; }
java
public void setGamma(double gamma) { if(gamma < 0 || Double.isNaN(gamma) || Double.isInfinite(gamma)) throw new IllegalArgumentException("Gamma must be in (0, Infity), not " + gamma); this.gamma = gamma; }
[ "public", "void", "setGamma", "(", "double", "gamma", ")", "{", "if", "(", "gamma", "<", "0", "||", "Double", ".", "isNaN", "(", "gamma", ")", "||", "Double", ".", "isInfinite", "(", "gamma", ")", ")", "throw", "new", "IllegalArgumentException", "(", "...
Sets the gamma value to use. This value, depending on which {@link CSKLR.UpdateMode} is used, controls the sparsity of the model. @param gamma the gamma parameter, which is at least always positive
[ "Sets", "the", "gamma", "value", "to", "use", ".", "This", "value", "depending", "on", "which", "{" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/kernelized/CSKLRBatch.java#L194-L199
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/render/R.java
R.decorateFacetComponent
public static void decorateFacetComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw) throws IOException { /* * System.out.println("COMPONENT CLASS = " + comp.getClass().getName()); * System.out.println("FAMILY = " + comp.getFamily()); * System.out.println("CHILD COUNT = " + comp.getChildCount()); * System.out.println("PARENT CLASS = " + comp.getParent().getClass()); * * * if (app.getClass().getName().endsWith("Button") || * (app.getChildCount() > 0 && * app.getChildren().get(0).getClass().getName().endsWith("Button"))) { * rw.startElement("div", inputText); rw.writeAttribute("class", * "input-group-btn", "class"); app.encodeAll(context); * rw.endElement("div"); } else { if (app instanceof Icon) ((Icon) * app).setAddon(true); rw.startElement("span", inputText); * rw.writeAttribute("class", "input-group-addon", "class"); * app.encodeAll(context); rw.endElement("span"); } */ if (comp.getChildCount() >= 1 && comp.getClass().getName().endsWith("Panel")) { for (UIComponent child : comp.getChildren()) { decorateComponent(parent, child, ctx, rw); } } else { decorateComponent(parent, comp, ctx, rw); } }
java
public static void decorateFacetComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw) throws IOException { /* * System.out.println("COMPONENT CLASS = " + comp.getClass().getName()); * System.out.println("FAMILY = " + comp.getFamily()); * System.out.println("CHILD COUNT = " + comp.getChildCount()); * System.out.println("PARENT CLASS = " + comp.getParent().getClass()); * * * if (app.getClass().getName().endsWith("Button") || * (app.getChildCount() > 0 && * app.getChildren().get(0).getClass().getName().endsWith("Button"))) { * rw.startElement("div", inputText); rw.writeAttribute("class", * "input-group-btn", "class"); app.encodeAll(context); * rw.endElement("div"); } else { if (app instanceof Icon) ((Icon) * app).setAddon(true); rw.startElement("span", inputText); * rw.writeAttribute("class", "input-group-addon", "class"); * app.encodeAll(context); rw.endElement("span"); } */ if (comp.getChildCount() >= 1 && comp.getClass().getName().endsWith("Panel")) { for (UIComponent child : comp.getChildren()) { decorateComponent(parent, child, ctx, rw); } } else { decorateComponent(parent, comp, ctx, rw); } }
[ "public", "static", "void", "decorateFacetComponent", "(", "UIComponent", "parent", ",", "UIComponent", "comp", ",", "FacesContext", "ctx", ",", "ResponseWriter", "rw", ")", "throws", "IOException", "{", "/*\n\t\t * System.out.println(\"COMPONENT CLASS = \" + comp.getClass()....
Decorate the facet children with a class to render bootstrap like "prepend" and "append" sections @param parent @param comp @param ctx @param rw @throws IOException
[ "Decorate", "the", "facet", "children", "with", "a", "class", "to", "render", "bootstrap", "like", "prepend", "and", "append", "sections" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L215-L241
apache/flink
flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java
AvroSchemaConverter.convertToTypeInfo
@SuppressWarnings("unchecked") public static <T> TypeInformation<T> convertToTypeInfo(String avroSchemaString) { Preconditions.checkNotNull(avroSchemaString, "Avro schema must not be null."); final Schema schema; try { schema = new Schema.Parser().parse(avroSchemaString); } catch (SchemaParseException e) { throw new IllegalArgumentException("Could not parse Avro schema string.", e); } return (TypeInformation<T>) convertToTypeInfo(schema); }
java
@SuppressWarnings("unchecked") public static <T> TypeInformation<T> convertToTypeInfo(String avroSchemaString) { Preconditions.checkNotNull(avroSchemaString, "Avro schema must not be null."); final Schema schema; try { schema = new Schema.Parser().parse(avroSchemaString); } catch (SchemaParseException e) { throw new IllegalArgumentException("Could not parse Avro schema string.", e); } return (TypeInformation<T>) convertToTypeInfo(schema); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "TypeInformation", "<", "T", ">", "convertToTypeInfo", "(", "String", "avroSchemaString", ")", "{", "Preconditions", ".", "checkNotNull", "(", "avroSchemaString", ",", "\"Avro s...
Converts an Avro schema string into a nested row structure with deterministic field order and data types that are compatible with Flink's Table & SQL API. @param avroSchemaString Avro schema definition string @return type information matching the schema
[ "Converts", "an", "Avro", "schema", "string", "into", "a", "nested", "row", "structure", "with", "deterministic", "field", "order", "and", "data", "types", "that", "are", "compatible", "with", "Flink", "s", "Table", "&", "SQL", "API", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java#L73-L83
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java
UCharacter.codePointBefore
public static final int codePointBefore(char[] text, int index) { char c2 = text[--index]; if (isLowSurrogate(c2)) { if (index > 0) { char c1 = text[--index]; if (isHighSurrogate(c1)) { return toCodePoint(c1, c2); } } } return c2; }
java
public static final int codePointBefore(char[] text, int index) { char c2 = text[--index]; if (isLowSurrogate(c2)) { if (index > 0) { char c1 = text[--index]; if (isHighSurrogate(c1)) { return toCodePoint(c1, c2); } } } return c2; }
[ "public", "static", "final", "int", "codePointBefore", "(", "char", "[", "]", "text", ",", "int", "index", ")", "{", "char", "c2", "=", "text", "[", "--", "index", "]", ";", "if", "(", "isLowSurrogate", "(", "c2", ")", ")", "{", "if", "(", "index",...
Same as {@link Character#codePointBefore(char[], int)}. Returns the code point before index. This examines only the characters at index-1 and index-2. @param text the characters to check @param index the index after the last or only char forming the code point @return the code point before the index
[ "Same", "as", "{", "@link", "Character#codePointBefore", "(", "char", "[]", "int", ")", "}", ".", "Returns", "the", "code", "point", "before", "index", ".", "This", "examines", "only", "the", "characters", "at", "index", "-", "1", "and", "index", "-", "2...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L5414-L5425
amaembo/streamex
src/main/java/one/util/streamex/DoubleStreamEx.java
DoubleStreamEx.minByInt
public OptionalDouble minByInt(DoubleToIntFunction keyExtractor) { return collect(PrimitiveBox::new, (box, d) -> { int key = keyExtractor.applyAsInt(d); if (!box.b || box.i > key) { box.b = true; box.i = key; box.d = d; } }, PrimitiveBox.MIN_INT).asDouble(); }
java
public OptionalDouble minByInt(DoubleToIntFunction keyExtractor) { return collect(PrimitiveBox::new, (box, d) -> { int key = keyExtractor.applyAsInt(d); if (!box.b || box.i > key) { box.b = true; box.i = key; box.d = d; } }, PrimitiveBox.MIN_INT).asDouble(); }
[ "public", "OptionalDouble", "minByInt", "(", "DoubleToIntFunction", "keyExtractor", ")", "{", "return", "collect", "(", "PrimitiveBox", "::", "new", ",", "(", "box", ",", "d", ")", "->", "{", "int", "key", "=", "keyExtractor", ".", "applyAsInt", "(", "d", ...
Returns the minimum element of this stream according to the provided key extractor function. <p> This is a terminal operation. @param keyExtractor a non-interfering, stateless function @return an {@code OptionalDouble} describing the first element of this stream for which the lowest value was returned by key extractor, or an empty {@code OptionalDouble} if the stream is empty @since 0.1.2
[ "Returns", "the", "minimum", "element", "of", "this", "stream", "according", "to", "the", "provided", "key", "extractor", "function", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L901-L910
jboss-integration/fuse-bxms-integ
switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java
KnowledgeOperations.getInputOnlyList
public static List<Object> getInputOnlyList(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { return getInputList(message, operation.getInputOnlyExpressionMappings(), runtime); }
java
public static List<Object> getInputOnlyList(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { return getInputList(message, operation.getInputOnlyExpressionMappings(), runtime); }
[ "public", "static", "List", "<", "Object", ">", "getInputOnlyList", "(", "Message", "message", ",", "KnowledgeOperation", "operation", ",", "KnowledgeRuntimeEngine", "runtime", ")", "{", "return", "getInputList", "(", "message", ",", "operation", ".", "getInputOnlyE...
Gets an input-only list. @param message the message @param operation the operation @param runtime the runtime engine @return the input-only list
[ "Gets", "an", "input", "-", "only", "list", "." ]
train
https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java#L200-L202
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/overlay/TilesOverlay.java
TilesOverlay.drawTiles
public void drawTiles(final Canvas c, final Projection projection, final double zoomLevel, final RectL viewPort) { mProjection = projection; mTileLooper.loop(zoomLevel, viewPort, c); }
java
public void drawTiles(final Canvas c, final Projection projection, final double zoomLevel, final RectL viewPort) { mProjection = projection; mTileLooper.loop(zoomLevel, viewPort, c); }
[ "public", "void", "drawTiles", "(", "final", "Canvas", "c", ",", "final", "Projection", "projection", ",", "final", "double", "zoomLevel", ",", "final", "RectL", "viewPort", ")", "{", "mProjection", "=", "projection", ";", "mTileLooper", ".", "loop", "(", "z...
This is meant to be a "pure" tile drawing function that doesn't take into account osmdroid-specific characteristics (like osmdroid's canvas's having 0,0 as the center rather than the upper-left corner). Once the tile is ready to be drawn, it is passed to onTileReadyToDraw where custom manipulations can be made before drawing the tile.
[ "This", "is", "meant", "to", "be", "a", "pure", "tile", "drawing", "function", "that", "doesn", "t", "take", "into", "account", "osmdroid", "-", "specific", "characteristics", "(", "like", "osmdroid", "s", "canvas", "s", "having", "0", "0", "as", "the", ...
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/TilesOverlay.java#L213-L216
OpenLiberty/open-liberty
dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java
ShutdownHook.writeWindowsCleanup
private void writeWindowsCleanup(File file, BufferedWriter bw) throws IOException { bw.write("set max=30\n"); bw.write("set cnt=0\n"); bw.write("set dir=" + dir + "\n"); bw.write("echo delete %dir%\n"); bw.write(":while\n"); bw.write(" if exist %dir% (\n"); bw.write(" rmdir /s /q %dir%\n"); bw.write(" timeout 1\n"); bw.write(" set /a cnt+=1\n"); bw.write(" if %cnt% leq %max% (\n"); bw.write(" goto :while \n"); bw.write(" )\n"); bw.write(" )\n"); bw.write("erase " + file.getAbsoluteFile() + "\n"); }
java
private void writeWindowsCleanup(File file, BufferedWriter bw) throws IOException { bw.write("set max=30\n"); bw.write("set cnt=0\n"); bw.write("set dir=" + dir + "\n"); bw.write("echo delete %dir%\n"); bw.write(":while\n"); bw.write(" if exist %dir% (\n"); bw.write(" rmdir /s /q %dir%\n"); bw.write(" timeout 1\n"); bw.write(" set /a cnt+=1\n"); bw.write(" if %cnt% leq %max% (\n"); bw.write(" goto :while \n"); bw.write(" )\n"); bw.write(" )\n"); bw.write("erase " + file.getAbsoluteFile() + "\n"); }
[ "private", "void", "writeWindowsCleanup", "(", "File", "file", ",", "BufferedWriter", "bw", ")", "throws", "IOException", "{", "bw", ".", "write", "(", "\"set max=30\\n\"", ")", ";", "bw", ".", "write", "(", "\"set cnt=0\\n\"", ")", ";", "bw", ".", "write", ...
Write logic for windows cleanup script @param file - script File object @param bw - bufferedWriter to write into script file @throws IOException
[ "Write", "logic", "for", "windows", "cleanup", "script" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L151-L166
susom/database
src/main/java/com/github/susom/database/DatabaseProvider.java
DatabaseProvider.fromDriverManager
@CheckReturnValue public static Builder fromDriverManager(String url, String user, String password) { return fromDriverManager(url, Flavor.fromJdbcUrl(url), null, user, password); }
java
@CheckReturnValue public static Builder fromDriverManager(String url, String user, String password) { return fromDriverManager(url, Flavor.fromJdbcUrl(url), null, user, password); }
[ "@", "CheckReturnValue", "public", "static", "Builder", "fromDriverManager", "(", "String", "url", ",", "String", "user", ",", "String", "password", ")", "{", "return", "fromDriverManager", "(", "url", ",", "Flavor", ".", "fromJdbcUrl", "(", "url", ")", ",", ...
Builder method to create and initialize an instance of this class using the JDBC standard DriverManager method. The url parameter will be inspected to determine the Flavor for this database.
[ "Builder", "method", "to", "create", "and", "initialize", "an", "instance", "of", "this", "class", "using", "the", "JDBC", "standard", "DriverManager", "method", ".", "The", "url", "parameter", "will", "be", "inspected", "to", "determine", "the", "Flavor", "fo...
train
https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProvider.java#L171-L174
jimmoores/quandl4j
core/src/main/java/com/jimmoores/quandl/SearchResult.java
SearchResult.getDocumentsPerPage
public int getDocumentsPerPage() { try { final int perPage = _jsonObject.getJSONObject(META_OBJECT_FIELD).getInt("per_page"); return perPage; } catch (JSONException ex) { throw new QuandlRuntimeException("Could not find total_count field in results from Quandl", ex); } }
java
public int getDocumentsPerPage() { try { final int perPage = _jsonObject.getJSONObject(META_OBJECT_FIELD).getInt("per_page"); return perPage; } catch (JSONException ex) { throw new QuandlRuntimeException("Could not find total_count field in results from Quandl", ex); } }
[ "public", "int", "getDocumentsPerPage", "(", ")", "{", "try", "{", "final", "int", "perPage", "=", "_jsonObject", ".", "getJSONObject", "(", "META_OBJECT_FIELD", ")", ".", "getInt", "(", "\"per_page\"", ")", ";", "return", "perPage", ";", "}", "catch", "(", ...
Get the number of documents per page in this result set. Throws a QuandlRuntimeException if Quandl response doesn't contain this field, although it should. @return the number of documents per page in this result set
[ "Get", "the", "number", "of", "documents", "per", "page", "in", "this", "result", "set", ".", "Throws", "a", "QuandlRuntimeException", "if", "Quandl", "response", "doesn", "t", "contain", "this", "field", "although", "it", "should", "." ]
train
https://github.com/jimmoores/quandl4j/blob/5d67ae60279d889da93ae7aa3bf6b7d536f88822/core/src/main/java/com/jimmoores/quandl/SearchResult.java#L62-L69
GoogleCloudPlatform/app-maven-plugin
src/main/java/com/google/cloud/tools/maven/deploy/AppDeployer.java
AppDeployer.deployAll
public void deployAll() throws MojoExecutionException { stager.stage(); ImmutableList.Builder<Path> computedDeployables = ImmutableList.builder(); // Look for app.yaml Path appYaml = deployMojo.getStagingDirectory().resolve("app.yaml"); if (!Files.exists(appYaml)) { throw new MojoExecutionException("Failed to deploy all: could not find app.yaml."); } deployMojo.getLog().info("deployAll: Preparing to deploy app.yaml"); computedDeployables.add(appYaml); // Look for config yamls String[] configYamls = {"cron.yaml", "dispatch.yaml", "dos.yaml", "index.yaml", "queue.yaml"}; for (String yamlName : configYamls) { Path yaml = appengineDirectory.resolve(yamlName); if (Files.exists(yaml)) { deployMojo.getLog().info("deployAll: Preparing to deploy " + yamlName); computedDeployables.add(yaml); } } DeployConfiguration config = configBuilder.buildDeployConfiguration(computedDeployables.build()); try { deployMojo.getAppEngineFactory().deployment().deploy(config); } catch (AppEngineException ex) { throw new MojoExecutionException("Failed to deploy", ex); } }
java
public void deployAll() throws MojoExecutionException { stager.stage(); ImmutableList.Builder<Path> computedDeployables = ImmutableList.builder(); // Look for app.yaml Path appYaml = deployMojo.getStagingDirectory().resolve("app.yaml"); if (!Files.exists(appYaml)) { throw new MojoExecutionException("Failed to deploy all: could not find app.yaml."); } deployMojo.getLog().info("deployAll: Preparing to deploy app.yaml"); computedDeployables.add(appYaml); // Look for config yamls String[] configYamls = {"cron.yaml", "dispatch.yaml", "dos.yaml", "index.yaml", "queue.yaml"}; for (String yamlName : configYamls) { Path yaml = appengineDirectory.resolve(yamlName); if (Files.exists(yaml)) { deployMojo.getLog().info("deployAll: Preparing to deploy " + yamlName); computedDeployables.add(yaml); } } DeployConfiguration config = configBuilder.buildDeployConfiguration(computedDeployables.build()); try { deployMojo.getAppEngineFactory().deployment().deploy(config); } catch (AppEngineException ex) { throw new MojoExecutionException("Failed to deploy", ex); } }
[ "public", "void", "deployAll", "(", ")", "throws", "MojoExecutionException", "{", "stager", ".", "stage", "(", ")", ";", "ImmutableList", ".", "Builder", "<", "Path", ">", "computedDeployables", "=", "ImmutableList", ".", "builder", "(", ")", ";", "// Look for...
Deploy a single application and any found yaml configuration files.
[ "Deploy", "a", "single", "application", "and", "any", "found", "yaml", "configuration", "files", "." ]
train
https://github.com/GoogleCloudPlatform/app-maven-plugin/blob/1f31bb8e963ce189e9ed6b88923a1853533485ff/src/main/java/com/google/cloud/tools/maven/deploy/AppDeployer.java#L64-L94
threerings/nenya
core/src/main/java/com/threerings/media/VirtualRangeModel.java
VirtualRangeModel.setScrollableArea
public void setScrollableArea (int x, int y, int width, int height) { Rectangle vb = _panel.getViewBounds(); int hmax = x + width, vmax = y + height, value; if (width > vb.width) { value = MathUtil.bound(x, _hrange.getValue(), hmax - vb.width); _hrange.setRangeProperties(value, vb.width, x, hmax, false); } else { // Let's center it and lock it down. int newx = x - (vb.width - width)/2; _hrange.setRangeProperties(newx, 0, newx, newx, false); } if (height > vb.height) { value = MathUtil.bound(y, _vrange.getValue(), vmax - vb.height); _vrange.setRangeProperties(value, vb.height, y, vmax, false); } else { // Let's center it and lock it down. int newy = y - (vb.height - height)/2; _vrange.setRangeProperties(newy, 0, newy, newy, false); } }
java
public void setScrollableArea (int x, int y, int width, int height) { Rectangle vb = _panel.getViewBounds(); int hmax = x + width, vmax = y + height, value; if (width > vb.width) { value = MathUtil.bound(x, _hrange.getValue(), hmax - vb.width); _hrange.setRangeProperties(value, vb.width, x, hmax, false); } else { // Let's center it and lock it down. int newx = x - (vb.width - width)/2; _hrange.setRangeProperties(newx, 0, newx, newx, false); } if (height > vb.height) { value = MathUtil.bound(y, _vrange.getValue(), vmax - vb.height); _vrange.setRangeProperties(value, vb.height, y, vmax, false); } else { // Let's center it and lock it down. int newy = y - (vb.height - height)/2; _vrange.setRangeProperties(newy, 0, newy, newy, false); } }
[ "public", "void", "setScrollableArea", "(", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "Rectangle", "vb", "=", "_panel", ".", "getViewBounds", "(", ")", ";", "int", "hmax", "=", "x", "+", "width", ",", "vmax", ...
Informs the virtual range model the extent of the area over which we can scroll.
[ "Informs", "the", "virtual", "range", "model", "the", "extent", "of", "the", "area", "over", "which", "we", "can", "scroll", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/VirtualRangeModel.java#L56-L77
csc19601128/Phynixx
phynixx/phynixx-common/src/main/java/org/csc/phynixx/common/cast/ImplementorUtils.java
ImplementorUtils.isImplementationOf
public static <T> boolean isImplementationOf(final Object obj, final Class<T> targetClass) { if (targetClass == null) { throw new IllegalArgumentException("Zielklasse, in welche gecasted werden soll, ist anzugeben."); } if (obj == null) { return false; } return new ObjectImplementor<Object>(obj).isImplementationOf(targetClass); }
java
public static <T> boolean isImplementationOf(final Object obj, final Class<T> targetClass) { if (targetClass == null) { throw new IllegalArgumentException("Zielklasse, in welche gecasted werden soll, ist anzugeben."); } if (obj == null) { return false; } return new ObjectImplementor<Object>(obj).isImplementationOf(targetClass); }
[ "public", "static", "<", "T", ">", "boolean", "isImplementationOf", "(", "final", "Object", "obj", ",", "final", "Class", "<", "T", ">", "targetClass", ")", "{", "if", "(", "targetClass", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", ...
prueft, ob eine Objekt in den Zieltyp <code>targetClass</code> zu casten ist. Wird <code>null</code> uebergeben, so wird <code>false</code> geliefert. @param obj @param targetClass @return @throws IllegalArgumentException object oder Zielklasse sind undefiniert @throws ClassCastException cast konnte nicht durch gefuehrt werden
[ "prueft", "ob", "eine", "Objekt", "in", "den", "Zieltyp", "<code", ">", "targetClass<", "/", "code", ">", "zu", "casten", "ist", "." ]
train
https://github.com/csc19601128/Phynixx/blob/a26c03bc229a8882c647799834115bec6bdc0ac8/phynixx/phynixx-common/src/main/java/org/csc/phynixx/common/cast/ImplementorUtils.java#L63-L71
voldemort/voldemort
src/java/voldemort/store/readonly/ReadOnlyUtils.java
ReadOnlyUtils.isFormatCorrect
public static boolean isFormatCorrect(String fileName, ReadOnlyStorageFormat format) { switch(format) { case READONLY_V0: case READONLY_V1: if(fileName.matches("^[\\d]+_[\\d]+\\.(data|index)")) { return true; } else { return false; } case READONLY_V2: if(fileName.matches("^[\\d]+_[\\d]+_[\\d]+\\.(data|index)")) { return true; } else { return false; } default: throw new VoldemortException("Format type not supported"); } }
java
public static boolean isFormatCorrect(String fileName, ReadOnlyStorageFormat format) { switch(format) { case READONLY_V0: case READONLY_V1: if(fileName.matches("^[\\d]+_[\\d]+\\.(data|index)")) { return true; } else { return false; } case READONLY_V2: if(fileName.matches("^[\\d]+_[\\d]+_[\\d]+\\.(data|index)")) { return true; } else { return false; } default: throw new VoldemortException("Format type not supported"); } }
[ "public", "static", "boolean", "isFormatCorrect", "(", "String", "fileName", ",", "ReadOnlyStorageFormat", "format", ")", "{", "switch", "(", "format", ")", "{", "case", "READONLY_V0", ":", "case", "READONLY_V1", ":", "if", "(", "fileName", ".", "matches", "("...
Given a file name and read-only storage format, tells whether the file name format is correct @param fileName The name of the file @param format The RO format @return true if file format is correct, else false
[ "Given", "a", "file", "name", "and", "read", "-", "only", "storage", "format", "tells", "whether", "the", "file", "name", "format", "is", "correct" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/ReadOnlyUtils.java#L53-L73
line/armeria
core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java
JsonTextSequences.fromPublisher
public static HttpResponse fromPublisher(Publisher<?> contentPublisher) { return fromPublisher(defaultHttpHeaders, contentPublisher, HttpHeaders.EMPTY_HEADERS, defaultMapper); }
java
public static HttpResponse fromPublisher(Publisher<?> contentPublisher) { return fromPublisher(defaultHttpHeaders, contentPublisher, HttpHeaders.EMPTY_HEADERS, defaultMapper); }
[ "public", "static", "HttpResponse", "fromPublisher", "(", "Publisher", "<", "?", ">", "contentPublisher", ")", "{", "return", "fromPublisher", "(", "defaultHttpHeaders", ",", "contentPublisher", ",", "HttpHeaders", ".", "EMPTY_HEADERS", ",", "defaultMapper", ")", ";...
Creates a new JSON Text Sequences from the specified {@link Publisher}. @param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents
[ "Creates", "a", "new", "JSON", "Text", "Sequences", "from", "the", "specified", "{", "@link", "Publisher", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java#L98-L100
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/temporal/IntervalUtils.java
IntervalUtils.plus
public static Interval plus(final Interval interval, final Period period) { return new Interval(interval.getStart().plus(period), interval.getEnd().plus(period)); }
java
public static Interval plus(final Interval interval, final Period period) { return new Interval(interval.getStart().plus(period), interval.getEnd().plus(period)); }
[ "public", "static", "Interval", "plus", "(", "final", "Interval", "interval", ",", "final", "Period", "period", ")", "{", "return", "new", "Interval", "(", "interval", ".", "getStart", "(", ")", ".", "plus", "(", "period", ")", ",", "interval", ".", "get...
Move both the start and end of an {@link Interval} into the future by the duration of {@code period}.
[ "Move", "both", "the", "start", "and", "end", "of", "an", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/temporal/IntervalUtils.java#L28-L31
akarnokd/akarnokd-xml
src/main/java/hu/akarnokd/xml/XNElement.java
XNElement.longValue
public long longValue(String name, String namespace) { String s = childValue(name, namespace); if (s != null) { return Long.parseLong(s); } throw new IllegalArgumentException(this + ": content: " + name); }
java
public long longValue(String name, String namespace) { String s = childValue(name, namespace); if (s != null) { return Long.parseLong(s); } throw new IllegalArgumentException(this + ": content: " + name); }
[ "public", "long", "longValue", "(", "String", "name", ",", "String", "namespace", ")", "{", "String", "s", "=", "childValue", "(", "name", ",", "namespace", ")", ";", "if", "(", "s", "!=", "null", ")", "{", "return", "Long", ".", "parseLong", "(", "s...
Returns a long value of the supplied child or throws an exception if missing. @param name the child element name @param namespace the element namespace @return the value
[ "Returns", "a", "long", "value", "of", "the", "supplied", "child", "or", "throws", "an", "exception", "if", "missing", "." ]
train
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L1011-L1017
actframework/actframework
src/main/java/act/ws/WebSocketConnectionRegistry.java
WebSocketConnectionRegistry.signIn
public void signIn(String key, Collection<WebSocketConnection> connections) { if (connections.isEmpty()) { return; } Map<WebSocketConnection, WebSocketConnection> newMap = new HashMap<>(); for (WebSocketConnection conn : connections) { newMap.put(conn, conn); } ConcurrentMap<WebSocketConnection, WebSocketConnection> bag = ensureConnectionList(key); bag.putAll(newMap); }
java
public void signIn(String key, Collection<WebSocketConnection> connections) { if (connections.isEmpty()) { return; } Map<WebSocketConnection, WebSocketConnection> newMap = new HashMap<>(); for (WebSocketConnection conn : connections) { newMap.put(conn, conn); } ConcurrentMap<WebSocketConnection, WebSocketConnection> bag = ensureConnectionList(key); bag.putAll(newMap); }
[ "public", "void", "signIn", "(", "String", "key", ",", "Collection", "<", "WebSocketConnection", ">", "connections", ")", "{", "if", "(", "connections", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "Map", "<", "WebSocketConnection", ",", "WebSoc...
Sign in a group of connections to the registry by key @param key the key @param connections a collection of websocket connections
[ "Sign", "in", "a", "group", "of", "connections", "to", "the", "registry", "by", "key" ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketConnectionRegistry.java#L156-L166
aws/aws-sdk-java
aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/Toolchain.java
Toolchain.withStackParameters
public Toolchain withStackParameters(java.util.Map<String, String> stackParameters) { setStackParameters(stackParameters); return this; }
java
public Toolchain withStackParameters(java.util.Map<String, String> stackParameters) { setStackParameters(stackParameters); return this; }
[ "public", "Toolchain", "withStackParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "stackParameters", ")", "{", "setStackParameters", "(", "stackParameters", ")", ";", "return", "this", ";", "}" ]
<p> The list of parameter overrides to be passed into the toolchain template during stack provisioning, if any. </p> @param stackParameters The list of parameter overrides to be passed into the toolchain template during stack provisioning, if any. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "list", "of", "parameter", "overrides", "to", "be", "passed", "into", "the", "toolchain", "template", "during", "stack", "provisioning", "if", "any", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/Toolchain.java#L176-L179
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GanttChartView.java
GanttChartView.getFontStyle
protected FontStyle getFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases) { Integer index = Integer.valueOf(MPPUtility.getByte(data, offset)); FontBase fontBase = fontBases.get(index); int style = MPPUtility.getByte(data, offset + 1); ColorType color = ColorType.getInstance(MPPUtility.getByte(data, offset + 2)); boolean bold = ((style & 0x01) != 0); boolean italic = ((style & 0x02) != 0); boolean underline = ((style & 0x04) != 0); FontStyle fontStyle = new FontStyle(fontBase, italic, bold, underline, false, color.getColor(), null, BackgroundPattern.SOLID); //System.out.println(fontStyle); return fontStyle; }
java
protected FontStyle getFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases) { Integer index = Integer.valueOf(MPPUtility.getByte(data, offset)); FontBase fontBase = fontBases.get(index); int style = MPPUtility.getByte(data, offset + 1); ColorType color = ColorType.getInstance(MPPUtility.getByte(data, offset + 2)); boolean bold = ((style & 0x01) != 0); boolean italic = ((style & 0x02) != 0); boolean underline = ((style & 0x04) != 0); FontStyle fontStyle = new FontStyle(fontBase, italic, bold, underline, false, color.getColor(), null, BackgroundPattern.SOLID); //System.out.println(fontStyle); return fontStyle; }
[ "protected", "FontStyle", "getFontStyle", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "Map", "<", "Integer", ",", "FontBase", ">", "fontBases", ")", "{", "Integer", "index", "=", "Integer", ".", "valueOf", "(", "MPPUtility", ".", "getByte", ...
Retrieve font details from a block of property data. @param data property data @param offset offset into property data @param fontBases map of font bases @return FontStyle instance
[ "Retrieve", "font", "details", "from", "a", "block", "of", "property", "data", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView.java#L1135-L1149
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/CnnLossLayer.java
CnnLossLayer.computeScoreForExamples
@Override public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) { //For CNN: need to sum up the score over each x/y location before returning if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); INDArray input2d = ConvolutionUtils.reshape4dTo2d(input, workspaceMgr, ArrayType.FF_WORKING_MEM); INDArray labels2d = ConvolutionUtils.reshape4dTo2d(labels, workspaceMgr, ArrayType.FF_WORKING_MEM); INDArray maskReshaped = ConvolutionUtils.reshapeMaskIfRequired(maskArray, input, workspaceMgr, ArrayType.FF_WORKING_MEM); ILossFunction lossFunction = layerConf().getLossFn(); INDArray scoreArray = lossFunction.computeScoreArray(labels2d, input2d, layerConf().getActivationFn(), maskReshaped); //scoreArray: shape [minibatch*h*w, 1] //Reshape it to [minibatch, 1, h, w] then sum over x/y to give [minibatch, 1] val newShape = input.shape().clone(); newShape[1] = 1; // FIXME INDArray scoreArrayTs = ConvolutionUtils.reshape2dTo4d(scoreArray, ArrayUtil.toInts(newShape), workspaceMgr, ArrayType.FF_WORKING_MEM); INDArray summedScores = scoreArrayTs.sum(1,2,3).reshape(scoreArrayTs.size(0), 1); if (fullNetRegTerm != 0.0) { summedScores.addi(fullNetRegTerm); } return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, summedScores); }
java
@Override public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) { //For CNN: need to sum up the score over each x/y location before returning if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); INDArray input2d = ConvolutionUtils.reshape4dTo2d(input, workspaceMgr, ArrayType.FF_WORKING_MEM); INDArray labels2d = ConvolutionUtils.reshape4dTo2d(labels, workspaceMgr, ArrayType.FF_WORKING_MEM); INDArray maskReshaped = ConvolutionUtils.reshapeMaskIfRequired(maskArray, input, workspaceMgr, ArrayType.FF_WORKING_MEM); ILossFunction lossFunction = layerConf().getLossFn(); INDArray scoreArray = lossFunction.computeScoreArray(labels2d, input2d, layerConf().getActivationFn(), maskReshaped); //scoreArray: shape [minibatch*h*w, 1] //Reshape it to [minibatch, 1, h, w] then sum over x/y to give [minibatch, 1] val newShape = input.shape().clone(); newShape[1] = 1; // FIXME INDArray scoreArrayTs = ConvolutionUtils.reshape2dTo4d(scoreArray, ArrayUtil.toInts(newShape), workspaceMgr, ArrayType.FF_WORKING_MEM); INDArray summedScores = scoreArrayTs.sum(1,2,3).reshape(scoreArrayTs.size(0), 1); if (fullNetRegTerm != 0.0) { summedScores.addi(fullNetRegTerm); } return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, summedScores); }
[ "@", "Override", "public", "INDArray", "computeScoreForExamples", "(", "double", "fullNetRegTerm", ",", "LayerWorkspaceMgr", "workspaceMgr", ")", "{", "//For CNN: need to sum up the score over each x/y location before returning", "if", "(", "input", "==", "null", "||", "label...
Compute the score for each example individually, after labels and input have been set. @param fullNetRegTerm Regularization score term for the entire network (or, 0.0 to not include regularization) @return A column INDArray of shape [numExamples,1], where entry i is the score of the ith example
[ "Compute", "the", "score", "for", "each", "example", "individually", "after", "labels", "and", "input", "have", "been", "set", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/CnnLossLayer.java#L219-L248
OpenTSDB/opentsdb
src/tsd/client/MetricForm.java
MetricForm.setSelectedItem
private void setSelectedItem(final ListBox list, final String item) { final int nitems = list.getItemCount(); for (int i = 0; i < nitems; i++) { if (item.equals(list.getValue(i))) { list.setSelectedIndex(i); return; } } }
java
private void setSelectedItem(final ListBox list, final String item) { final int nitems = list.getItemCount(); for (int i = 0; i < nitems; i++) { if (item.equals(list.getValue(i))) { list.setSelectedIndex(i); return; } } }
[ "private", "void", "setSelectedItem", "(", "final", "ListBox", "list", ",", "final", "String", "item", ")", "{", "final", "int", "nitems", "=", "list", ".", "getItemCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nitems", ";"...
If the given item is in the list, mark it as selected. @param list The list to manipulate. @param item The item to select if present.
[ "If", "the", "given", "item", "is", "in", "the", "list", "mark", "it", "as", "selected", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/client/MetricForm.java#L689-L697
fernandospr/javapns-jdk16
src/main/java/javapns/notification/Payload.java
Payload.validateMaximumPayloadSize
private void validateMaximumPayloadSize(int currentPayloadSize) throws PayloadMaxSizeExceededException { int maximumPayloadSize = getMaximumPayloadSize(); if (currentPayloadSize > maximumPayloadSize) { throw new PayloadMaxSizeExceededException(maximumPayloadSize, currentPayloadSize); } }
java
private void validateMaximumPayloadSize(int currentPayloadSize) throws PayloadMaxSizeExceededException { int maximumPayloadSize = getMaximumPayloadSize(); if (currentPayloadSize > maximumPayloadSize) { throw new PayloadMaxSizeExceededException(maximumPayloadSize, currentPayloadSize); } }
[ "private", "void", "validateMaximumPayloadSize", "(", "int", "currentPayloadSize", ")", "throws", "PayloadMaxSizeExceededException", "{", "int", "maximumPayloadSize", "=", "getMaximumPayloadSize", "(", ")", ";", "if", "(", "currentPayloadSize", ">", "maximumPayloadSize", ...
Validate that the payload does not exceed the maximum size allowed. If the limit is exceeded, a PayloadMaxSizeExceededException is thrown. @param currentPayloadSize the total size of the payload in bytes @throws PayloadMaxSizeExceededException if the payload exceeds the maximum size allowed
[ "Validate", "that", "the", "payload", "does", "not", "exceed", "the", "maximum", "size", "allowed", ".", "If", "the", "limit", "is", "exceeded", "a", "PayloadMaxSizeExceededException", "is", "thrown", "." ]
train
https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/notification/Payload.java#L249-L254
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java
StyleSet.setBorder
public StyleSet setBorder(BorderStyle borderSize, IndexedColors colorIndex) { StyleUtil.setBorder(this.headCellStyle, borderSize, colorIndex); StyleUtil.setBorder(this.cellStyle, borderSize, colorIndex); StyleUtil.setBorder(this.cellStyleForNumber, borderSize, colorIndex); StyleUtil.setBorder(this.cellStyleForDate, borderSize, colorIndex); return this; }
java
public StyleSet setBorder(BorderStyle borderSize, IndexedColors colorIndex) { StyleUtil.setBorder(this.headCellStyle, borderSize, colorIndex); StyleUtil.setBorder(this.cellStyle, borderSize, colorIndex); StyleUtil.setBorder(this.cellStyleForNumber, borderSize, colorIndex); StyleUtil.setBorder(this.cellStyleForDate, borderSize, colorIndex); return this; }
[ "public", "StyleSet", "setBorder", "(", "BorderStyle", "borderSize", ",", "IndexedColors", "colorIndex", ")", "{", "StyleUtil", ".", "setBorder", "(", "this", ".", "headCellStyle", ",", "borderSize", ",", "colorIndex", ")", ";", "StyleUtil", ".", "setBorder", "(...
定义所有单元格的边框类型 @param borderSize 边框粗细{@link BorderStyle}枚举 @param colorIndex 颜色的short值 @return this @since 4.0.0
[ "定义所有单元格的边框类型" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java#L98-L104
aws/aws-sdk-java
aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/GrantConstraints.java
GrantConstraints.withEncryptionContextEquals
public GrantConstraints withEncryptionContextEquals(java.util.Map<String, String> encryptionContextEquals) { setEncryptionContextEquals(encryptionContextEquals); return this; }
java
public GrantConstraints withEncryptionContextEquals(java.util.Map<String, String> encryptionContextEquals) { setEncryptionContextEquals(encryptionContextEquals); return this; }
[ "public", "GrantConstraints", "withEncryptionContextEquals", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "encryptionContextEquals", ")", "{", "setEncryptionContextEquals", "(", "encryptionContextEquals", ")", ";", "return", "this", ";", ...
<p> A list of key-value pairs that must be present in the encryption context of certain subsequent operations that the grant allows. When certain subsequent operations allowed by the grant include encryption context that matches this list, the grant allows the operation. Otherwise, the grant does not allow the operation. </p> @param encryptionContextEquals A list of key-value pairs that must be present in the encryption context of certain subsequent operations that the grant allows. When certain subsequent operations allowed by the grant include encryption context that matches this list, the grant allows the operation. Otherwise, the grant does not allow the operation. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "list", "of", "key", "-", "value", "pairs", "that", "must", "be", "present", "in", "the", "encryption", "context", "of", "certain", "subsequent", "operations", "that", "the", "grant", "allows", ".", "When", "certain", "subsequent", "operation...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/GrantConstraints.java#L195-L198
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java
GeoPackageCoreConnection.addColumn
public void addColumn(String tableName, String columnName, String columnDef) { execSQL("ALTER TABLE " + CoreSQLUtils.quoteWrap(tableName) + " ADD COLUMN " + CoreSQLUtils.quoteWrap(columnName) + " " + columnDef + ";"); }
java
public void addColumn(String tableName, String columnName, String columnDef) { execSQL("ALTER TABLE " + CoreSQLUtils.quoteWrap(tableName) + " ADD COLUMN " + CoreSQLUtils.quoteWrap(columnName) + " " + columnDef + ";"); }
[ "public", "void", "addColumn", "(", "String", "tableName", ",", "String", "columnName", ",", "String", "columnDef", ")", "{", "execSQL", "(", "\"ALTER TABLE \"", "+", "CoreSQLUtils", ".", "quoteWrap", "(", "tableName", ")", "+", "\" ADD COLUMN \"", "+", "CoreSQL...
Add a new column to the table @param tableName table name @param columnName column name @param columnDef column definition @since 1.1.8
[ "Add", "a", "new", "column", "to", "the", "table" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java#L158-L162
Metrink/croquet
croquet-examples/src/main/java/com/metrink/croquet/examples/crm/pages/AbstractFormPage.java
AbstractFormPage.setForm
protected void setForm(final T bean, final AjaxRequestTarget target) { LOG.debug("Setting form to {}", bean); // update the model with the new bean formModel.setObject(bean); // add the form to the target target.add(form); // update the button updateSaveButton.setModel(Model.of("Update")); target.add(updateSaveButton); }
java
protected void setForm(final T bean, final AjaxRequestTarget target) { LOG.debug("Setting form to {}", bean); // update the model with the new bean formModel.setObject(bean); // add the form to the target target.add(form); // update the button updateSaveButton.setModel(Model.of("Update")); target.add(updateSaveButton); }
[ "protected", "void", "setForm", "(", "final", "T", "bean", ",", "final", "AjaxRequestTarget", "target", ")", "{", "LOG", ".", "debug", "(", "\"Setting form to {}\"", ",", "bean", ")", ";", "// update the model with the new bean", "formModel", ".", "setObject", "("...
Sets the form to the bean passed in, updating the form via AJAX. @param bean the bean to set the form to. @param target the target of whatever triggers the form fill action.
[ "Sets", "the", "form", "to", "the", "bean", "passed", "in", "updating", "the", "form", "via", "AJAX", "." ]
train
https://github.com/Metrink/croquet/blob/1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b/croquet-examples/src/main/java/com/metrink/croquet/examples/crm/pages/AbstractFormPage.java#L185-L197
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/FaxField.java
FaxField.setupDefaultView
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { ScreenComponent screenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.FAX); properties.put(ScreenModel.IMAGE, ScreenModel.FAX); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return screenField; }
java
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { ScreenComponent screenField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); properties = new HashMap<String,Object>(); properties.put(ScreenModel.FIELD, this); properties.put(ScreenModel.COMMAND, ScreenModel.FAX); properties.put(ScreenModel.IMAGE, ScreenModel.FAX); ScreenComponent pSScreenField = createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties); pSScreenField.setRequestFocusEnabled(false); return screenField; }
[ "public", "ScreenComponent", "setupDefaultView", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "ScreenComp...
Set up the default screen control for this field. @param itsLocation Location of this component on screen (ie., GridBagConstraint). @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). @param converter The converter to set the screenfield to. @param iDisplayFieldDesc Display the label? (optional). @return Return the component or ScreenField that is created for this field.
[ "Set", "up", "the", "default", "screen", "control", "for", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/FaxField.java#L87-L97
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/TemplatesApi.java
TemplatesApi.createRecipients
public Recipients createRecipients(String accountId, String templateId, TemplateRecipients templateRecipients) throws ApiException { return createRecipients(accountId, templateId, templateRecipients, null); }
java
public Recipients createRecipients(String accountId, String templateId, TemplateRecipients templateRecipients) throws ApiException { return createRecipients(accountId, templateId, templateRecipients, null); }
[ "public", "Recipients", "createRecipients", "(", "String", "accountId", ",", "String", "templateId", ",", "TemplateRecipients", "templateRecipients", ")", "throws", "ApiException", "{", "return", "createRecipients", "(", "accountId", ",", "templateId", ",", "templateRec...
Adds tabs for a recipient. Adds one or more recipients to a template. @param accountId The external account number (int) or account ID Guid. (required) @param templateId The ID of the template being accessed. (required) @param templateRecipients (optional) @return Recipients
[ "Adds", "tabs", "for", "a", "recipient", ".", "Adds", "one", "or", "more", "recipients", "to", "a", "template", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L302-L304
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.createOrUpdateByIdAsync
public Observable<GenericResourceInner> createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { return createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
java
public Observable<GenericResourceInner> createOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { return createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "GenericResourceInner", ">", "createOrUpdateByIdAsync", "(", "String", "resourceId", ",", "String", "apiVersion", ",", "GenericResourceInner", "parameters", ")", "{", "return", "createOrUpdateByIdWithServiceResponseAsync", "(", "resourceId", ","...
Create a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @param parameters Create or update resource parameters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "a", "resource", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L2097-L2104
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java
Reflection.getProperty
public Property getProperty( Object target, String propertyName, String description ) throws SecurityException, IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { CheckArg.isNotNull(target, "target"); CheckArg.isNotEmpty(propertyName, "propertyName"); return getProperty(target, propertyName, null, null, description); }
java
public Property getProperty( Object target, String propertyName, String description ) throws SecurityException, IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { CheckArg.isNotNull(target, "target"); CheckArg.isNotEmpty(propertyName, "propertyName"); return getProperty(target, propertyName, null, null, description); }
[ "public", "Property", "getProperty", "(", "Object", "target", ",", "String", "propertyName", ",", "String", "description", ")", "throws", "SecurityException", ",", "IllegalArgumentException", ",", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTar...
Get the representation of the named property (with the supplied description) on the target object. @param target the target on which the setter is to be called; may not be null @param propertyName the name of the Java object property; may not be null @param description the description for the property; may be null if this is not known @return the representation of the Java property; never null @throws NoSuchMethodException if a matching method is not found. @throws SecurityException if access to the information is denied. @throws IllegalAccessException if the setter method could not be accessed @throws InvocationTargetException if there was an error invoking the setter method on the target @throws IllegalArgumentException if 'target' is null, or if 'propertyName' is null or empty
[ "Get", "the", "representation", "of", "the", "named", "property", "(", "with", "the", "supplied", "description", ")", "on", "the", "target", "object", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java#L1013-L1021
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeLong
@Pure public static long getAttributeLong(Node document, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeLongWithDefault(document, true, (long) 0, path); }
java
@Pure public static long getAttributeLong(Node document, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeLongWithDefault(document, true, (long) 0, path); }
[ "@", "Pure", "public", "static", "long", "getAttributeLong", "(", "Node", "document", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "return", "getAttributeLongWit...
Replies the long value that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. Be careful about the fact that the names are case sensitives. @param document is the XML document to explore. @param path is the list of and ended by the attribute's name. @return the long value of the specified attribute or <code>0</code>.
[ "Replies", "the", "long", "value", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L902-L906
bwkimmel/jdcp
jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java
FileClassManager.classExists
private boolean classExists(File directory, String name) { String baseName = getBaseFileName(name); File classFile = new File(directory, baseName + CLASS_EXTENSION); File digestFile = new File(directory, baseName + DIGEST_EXTENSION); return classFile.isFile() && digestFile.isFile(); }
java
private boolean classExists(File directory, String name) { String baseName = getBaseFileName(name); File classFile = new File(directory, baseName + CLASS_EXTENSION); File digestFile = new File(directory, baseName + DIGEST_EXTENSION); return classFile.isFile() && digestFile.isFile(); }
[ "private", "boolean", "classExists", "(", "File", "directory", ",", "String", "name", ")", "{", "String", "baseName", "=", "getBaseFileName", "(", "name", ")", ";", "File", "classFile", "=", "new", "File", "(", "directory", ",", "baseName", "+", "CLASS_EXTEN...
Determines if the specified class exists in the specified directory tree. @param directory The root of the directory tree to examine. @param name The fully qualified name of the class. @return A value indicating if the class exists in the given directory tree.
[ "Determines", "if", "the", "specified", "class", "exists", "in", "the", "specified", "directory", "tree", "." ]
train
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L223-L229
norbsoft/android-typeface-helper
lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java
TypefaceHelper.applyForView
private static void applyForView(View view, TypefaceCollection typefaceCollection) { if (view instanceof TextView) { TextView textView = (TextView) view; Typeface oldTypeface = textView.getTypeface(); final int style = oldTypeface == null ? Typeface.NORMAL : oldTypeface.getStyle(); textView.setTypeface(typefaceCollection.getTypeface(style)); textView.setPaintFlags(textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); } }
java
private static void applyForView(View view, TypefaceCollection typefaceCollection) { if (view instanceof TextView) { TextView textView = (TextView) view; Typeface oldTypeface = textView.getTypeface(); final int style = oldTypeface == null ? Typeface.NORMAL : oldTypeface.getStyle(); textView.setTypeface(typefaceCollection.getTypeface(style)); textView.setPaintFlags(textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); } }
[ "private", "static", "void", "applyForView", "(", "View", "view", ",", "TypefaceCollection", "typefaceCollection", ")", "{", "if", "(", "view", "instanceof", "TextView", ")", "{", "TextView", "textView", "=", "(", "TextView", ")", "view", ";", "Typeface", "old...
Apply typeface to single view @param view to typeface typeface @param typefaceCollection typeface collection
[ "Apply", "typeface", "to", "single", "view" ]
train
https://github.com/norbsoft/android-typeface-helper/blob/f9e12655f01144efa937c1172f5de7f9b29c4df7/lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java#L244-L253
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java
BaseNeo4jAssociationQueries.removeAssociationRow
public void removeAssociationRow(GraphDatabaseService executionEngine, AssociationKey associationKey, RowKey rowKey) { Object[] relationshipValues = relationshipValues( associationKey, rowKey ); Object[] queryValues = ArrayHelper.concat( associationKey.getEntityKey().getColumnValues(), relationshipValues ); executionEngine.execute( removeAssociationRowQuery, params( queryValues ) ); }
java
public void removeAssociationRow(GraphDatabaseService executionEngine, AssociationKey associationKey, RowKey rowKey) { Object[] relationshipValues = relationshipValues( associationKey, rowKey ); Object[] queryValues = ArrayHelper.concat( associationKey.getEntityKey().getColumnValues(), relationshipValues ); executionEngine.execute( removeAssociationRowQuery, params( queryValues ) ); }
[ "public", "void", "removeAssociationRow", "(", "GraphDatabaseService", "executionEngine", ",", "AssociationKey", "associationKey", ",", "RowKey", "rowKey", ")", "{", "Object", "[", "]", "relationshipValues", "=", "relationshipValues", "(", "associationKey", ",", "rowKey...
Remove an association row @param executionEngine the {@link GraphDatabaseService} used to run the query @param associationKey represents the association @param rowKey represents a row in an association
[ "Remove", "an", "association", "row" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java#L275-L279
Netflix/karyon
karyon2-governator/src/main/java/netflix/karyon/Karyon.java
Karyon.forServer
public static KaryonServer forServer(KaryonServer server, Module... modules) { return forServer(server, toBootstrapModule(modules)); }
java
public static KaryonServer forServer(KaryonServer server, Module... modules) { return forServer(server, toBootstrapModule(modules)); }
[ "public", "static", "KaryonServer", "forServer", "(", "KaryonServer", "server", ",", "Module", "...", "modules", ")", "{", "return", "forServer", "(", "server", ",", "toBootstrapModule", "(", "modules", ")", ")", ";", "}" ]
Creates a new {@link KaryonServer} which combines lifecycle of the passed {@link KaryonServer} with it's own lifecycle. This is useful when a {@link KaryonServer} is already present and the passed {@link Module}s are to be added to that server. @param server An existing karyon server @param modules Additional modules. @return {@link KaryonServer} which is to be used to start the created server.
[ "Creates", "a", "new", "{", "@link", "KaryonServer", "}", "which", "combines", "lifecycle", "of", "the", "passed", "{", "@link", "KaryonServer", "}", "with", "it", "s", "own", "lifecycle", ".", "This", "is", "useful", "when", "a", "{", "@link", "KaryonServ...
train
https://github.com/Netflix/karyon/blob/d50bc0ff37693ef3fbda373e90a109d1f92e0b9a/karyon2-governator/src/main/java/netflix/karyon/Karyon.java#L258-L260
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/IDOS.java
IDOS.computeIDOS
protected DoubleDataStore computeIDOS(DBIDs ids, KNNQuery<O> knnQ, DoubleDataStore intDims, DoubleMinMax idosminmax) { WritableDoubleDataStore ldms = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_STATIC); FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("ID Outlier Scores for objects", ids.size(), LOG) : null; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { final KNNList neighbors = knnQ.getKNNForDBID(iter, k_r); double sum = 0.; int cnt = 0; for(DoubleDBIDListIter neighbor = neighbors.iter(); neighbor.valid(); neighbor.advance()) { if(DBIDUtil.equal(iter, neighbor)) { continue; } final double id = intDims.doubleValue(neighbor); sum += id > 0 ? 1.0 / id : 0.; if(++cnt == k_r) { // Always stop after at most k_r elements. break; } } final double id_q = intDims.doubleValue(iter); final double idos = id_q > 0 ? id_q * sum / cnt : 0.; ldms.putDouble(iter, idos); idosminmax.put(idos); LOG.incrementProcessed(prog); } LOG.ensureCompleted(prog); return ldms; }
java
protected DoubleDataStore computeIDOS(DBIDs ids, KNNQuery<O> knnQ, DoubleDataStore intDims, DoubleMinMax idosminmax) { WritableDoubleDataStore ldms = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_STATIC); FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("ID Outlier Scores for objects", ids.size(), LOG) : null; for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { final KNNList neighbors = knnQ.getKNNForDBID(iter, k_r); double sum = 0.; int cnt = 0; for(DoubleDBIDListIter neighbor = neighbors.iter(); neighbor.valid(); neighbor.advance()) { if(DBIDUtil.equal(iter, neighbor)) { continue; } final double id = intDims.doubleValue(neighbor); sum += id > 0 ? 1.0 / id : 0.; if(++cnt == k_r) { // Always stop after at most k_r elements. break; } } final double id_q = intDims.doubleValue(iter); final double idos = id_q > 0 ? id_q * sum / cnt : 0.; ldms.putDouble(iter, idos); idosminmax.put(idos); LOG.incrementProcessed(prog); } LOG.ensureCompleted(prog); return ldms; }
[ "protected", "DoubleDataStore", "computeIDOS", "(", "DBIDs", "ids", ",", "KNNQuery", "<", "O", ">", "knnQ", ",", "DoubleDataStore", "intDims", ",", "DoubleMinMax", "idosminmax", ")", "{", "WritableDoubleDataStore", "ldms", "=", "DataStoreUtil", ".", "makeDoubleStora...
Computes all IDOS scores. @param ids the DBIDs to process @param knnQ the KNN query @param intDims Precomputed intrinsic dimensionalities @param idosminmax Output of minimum and maximum, for metadata @return ID scores
[ "Computes", "all", "IDOS", "scores", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/IDOS.java#L180-L206
jenkinsci/jenkins
core/src/main/java/hudson/PluginManager.java
PluginManager.parseRequestedPlugins
public Map<String,VersionNumber> parseRequestedPlugins(InputStream configXml) throws IOException { final Map<String,VersionNumber> requestedPlugins = new TreeMap<>(); try { SAXParserFactory.newInstance().newSAXParser().parse(configXml, new DefaultHandler() { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { String plugin = attributes.getValue("plugin"); if (plugin == null) { return; } if (!plugin.matches("[^@]+@[^@]+")) { throw new SAXException("Malformed plugin attribute: " + plugin); } int at = plugin.indexOf('@'); String shortName = plugin.substring(0, at); VersionNumber existing = requestedPlugins.get(shortName); VersionNumber requested = new VersionNumber(plugin.substring(at + 1)); if (existing == null || existing.compareTo(requested) < 0) { requestedPlugins.put(shortName, requested); } } @Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { return RestrictiveEntityResolver.INSTANCE.resolveEntity(publicId, systemId); } }); } catch (SAXException x) { throw new IOException("Failed to parse XML",x); } catch (ParserConfigurationException e) { throw new AssertionError(e); // impossible since we don't tweak XMLParser } return requestedPlugins; }
java
public Map<String,VersionNumber> parseRequestedPlugins(InputStream configXml) throws IOException { final Map<String,VersionNumber> requestedPlugins = new TreeMap<>(); try { SAXParserFactory.newInstance().newSAXParser().parse(configXml, new DefaultHandler() { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { String plugin = attributes.getValue("plugin"); if (plugin == null) { return; } if (!plugin.matches("[^@]+@[^@]+")) { throw new SAXException("Malformed plugin attribute: " + plugin); } int at = plugin.indexOf('@'); String shortName = plugin.substring(0, at); VersionNumber existing = requestedPlugins.get(shortName); VersionNumber requested = new VersionNumber(plugin.substring(at + 1)); if (existing == null || existing.compareTo(requested) < 0) { requestedPlugins.put(shortName, requested); } } @Override public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException { return RestrictiveEntityResolver.INSTANCE.resolveEntity(publicId, systemId); } }); } catch (SAXException x) { throw new IOException("Failed to parse XML",x); } catch (ParserConfigurationException e) { throw new AssertionError(e); // impossible since we don't tweak XMLParser } return requestedPlugins; }
[ "public", "Map", "<", "String", ",", "VersionNumber", ">", "parseRequestedPlugins", "(", "InputStream", "configXml", ")", "throws", "IOException", "{", "final", "Map", "<", "String", ",", "VersionNumber", ">", "requestedPlugins", "=", "new", "TreeMap", "<>", "("...
Parses configuration XML files and picks up references to XML files.
[ "Parses", "configuration", "XML", "files", "and", "picks", "up", "references", "to", "XML", "files", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginManager.java#L1900-L1933
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.BitArray
public JBBPDslBuilder BitArray(final String bitLenExpression, final String sizeExpression) { return this.BitArray(null, bitLenExpression, assertExpressionChars(sizeExpression)); }
java
public JBBPDslBuilder BitArray(final String bitLenExpression, final String sizeExpression) { return this.BitArray(null, bitLenExpression, assertExpressionChars(sizeExpression)); }
[ "public", "JBBPDslBuilder", "BitArray", "(", "final", "String", "bitLenExpression", ",", "final", "String", "sizeExpression", ")", "{", "return", "this", ".", "BitArray", "(", "null", ",", "bitLenExpression", ",", "assertExpressionChars", "(", "sizeExpression", ")",...
Add anonymous bit array with size calculated through expression. @param bitLenExpression expression to calculate length of the bit field, must not be null @param sizeExpression expression to be used to calculate array size, must not be null @return the builder instance, must not be null
[ "Add", "anonymous", "bit", "array", "with", "size", "calculated", "through", "expression", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L710-L712
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.resemblesPropertyPattern
private static boolean resemblesPropertyPattern(String pattern, int pos) { // Patterns are at least 5 characters long if ((pos+5) > pattern.length()) { return false; } // Look for an opening [:, [:^, \p, or \P return pattern.regionMatches(pos, "[:", 0, 2) || pattern.regionMatches(true, pos, "\\p", 0, 2) || pattern.regionMatches(pos, "\\N", 0, 2); }
java
private static boolean resemblesPropertyPattern(String pattern, int pos) { // Patterns are at least 5 characters long if ((pos+5) > pattern.length()) { return false; } // Look for an opening [:, [:^, \p, or \P return pattern.regionMatches(pos, "[:", 0, 2) || pattern.regionMatches(true, pos, "\\p", 0, 2) || pattern.regionMatches(pos, "\\N", 0, 2); }
[ "private", "static", "boolean", "resemblesPropertyPattern", "(", "String", "pattern", ",", "int", "pos", ")", "{", "// Patterns are at least 5 characters long", "if", "(", "(", "pos", "+", "5", ")", ">", "pattern", ".", "length", "(", ")", ")", "{", "return", ...
Return true if the given position, in the given pattern, appears to be the start of a property set pattern.
[ "Return", "true", "if", "the", "given", "position", "in", "the", "given", "pattern", "appears", "to", "be", "the", "start", "of", "a", "property", "set", "pattern", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L3522-L3532
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java
EmbeddedNeo4jEntityQueries.insertEntity
public Node insertEntity(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getCreateEntityQuery(), params ); return singleResult( result ); }
java
public Node insertEntity(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getCreateEntityQuery(), params ); return singleResult( result ); }
[ "public", "Node", "insertEntity", "(", "GraphDatabaseService", "executionEngine", ",", "Object", "[", "]", "columnValues", ")", "{", "Map", "<", "String", ",", "Object", ">", "params", "=", "params", "(", "columnValues", ")", ";", "Result", "result", "=", "e...
Creates the node corresponding to an entity. @param executionEngine the {@link GraphDatabaseService} used to run the query @param columnValues the values in {@link org.hibernate.ogm.model.key.spi.EntityKey#getColumnValues()} @return the corresponding node
[ "Creates", "the", "node", "corresponding", "to", "an", "entity", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java#L131-L135
santhosh-tekuri/jlibs
xml/src/main/java/jlibs/xml/DefaultNamespaceContext.java
DefaultNamespaceContext.toQName
public QName toQName(String qname){ String prefix = ""; String localName = qname; int colon = qname.indexOf(':'); if(colon!=-1){ prefix = qname.substring(0, colon); localName = qname.substring(colon+1); } String ns = getNamespaceURI(prefix); if(ns==null) throw new IllegalArgumentException("undeclared prefix: "+prefix); return new QName(ns, localName, prefix); }
java
public QName toQName(String qname){ String prefix = ""; String localName = qname; int colon = qname.indexOf(':'); if(colon!=-1){ prefix = qname.substring(0, colon); localName = qname.substring(colon+1); } String ns = getNamespaceURI(prefix); if(ns==null) throw new IllegalArgumentException("undeclared prefix: "+prefix); return new QName(ns, localName, prefix); }
[ "public", "QName", "toQName", "(", "String", "qname", ")", "{", "String", "prefix", "=", "\"\"", ";", "String", "localName", "=", "qname", ";", "int", "colon", "=", "qname", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "colon", "!=", "-", "1...
Constructs {@link javax.xml.namespace.QName} for the specified {@code qname}. @param qname the qualified name @return {@link javax.xml.namespace.QName} object constructed. @throws IllegalArgumentException if the prefix in {@code qname} is undeclared.
[ "Constructs", "{", "@link", "javax", ".", "xml", ".", "namespace", ".", "QName", "}", "for", "the", "specified", "{", "@code", "qname", "}", "." ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/xml/src/main/java/jlibs/xml/DefaultNamespaceContext.java#L177-L191
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.listMetricsAsync
public Observable<Page<ResourceMetricInner>> listMetricsAsync(final String resourceGroupName, final String name) { return listMetricsWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Page<ResourceMetricInner>>() { @Override public Page<ResourceMetricInner> call(ServiceResponse<Page<ResourceMetricInner>> response) { return response.body(); } }); }
java
public Observable<Page<ResourceMetricInner>> listMetricsAsync(final String resourceGroupName, final String name) { return listMetricsWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Page<ResourceMetricInner>>() { @Override public Page<ResourceMetricInner> call(ServiceResponse<Page<ResourceMetricInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ResourceMetricInner", ">", ">", "listMetricsAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listMetricsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name"...
Get metrics for an App Serice plan. Get metrics for an App Serice plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricInner&gt; object
[ "Get", "metrics", "for", "an", "App", "Serice", "plan", ".", "Get", "metrics", "for", "an", "App", "Serice", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1976-L1984
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/listener/ProcessStartEventHandler.java
ProcessStartEventHandler.getMasterRequestId
protected String getMasterRequestId(XmlObject msgdoc, Map<String,String> metaInfo) { String masterRequestId = metaInfo.get(Listener.METAINFO_MDW_REQUEST_ID); if (masterRequestId == null) masterRequestId = metaInfo.get(Listener.METAINFO_DOCUMENT_ID); else masterRequestId = this.placeHolderTranslation(masterRequestId, metaInfo, msgdoc); return masterRequestId; }
java
protected String getMasterRequestId(XmlObject msgdoc, Map<String,String> metaInfo) { String masterRequestId = metaInfo.get(Listener.METAINFO_MDW_REQUEST_ID); if (masterRequestId == null) masterRequestId = metaInfo.get(Listener.METAINFO_DOCUMENT_ID); else masterRequestId = this.placeHolderTranslation(masterRequestId, metaInfo, msgdoc); return masterRequestId; }
[ "protected", "String", "getMasterRequestId", "(", "XmlObject", "msgdoc", ",", "Map", "<", "String", ",", "String", ">", "metaInfo", ")", "{", "String", "masterRequestId", "=", "metaInfo", ".", "get", "(", "Listener", ".", "METAINFO_MDW_REQUEST_ID", ")", ";", "...
This method is invoked by handleEventMessage() to obtain master request ID. The default implementation does the following: - If "mdw-request-id" is defined in metaInfo, then takes its value performs place holder translation ({@link #placeHolderTranslation(String, Map, XmlObject)}), and returns it - otherwise, return the external event instance ID You can override this method to generate custom master request ID that cannot be configured the above way. @param msgdoc @param metaInfo @return
[ "This", "method", "is", "invoked", "by", "handleEventMessage", "()", "to", "obtain", "master", "request", "ID", ".", "The", "default", "implementation", "does", "the", "following", ":", "-", "If", "mdw", "-", "request", "-", "id", "is", "defined", "in", "m...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/listener/ProcessStartEventHandler.java#L123-L129
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java
BigtableInstanceAdminClient.deleteAppProfile
@SuppressWarnings("WeakerAccess") public void deleteAppProfile(String instanceId, String appProfileId) { ApiExceptions.callAndTranslateApiException(deleteAppProfileAsync(instanceId, appProfileId)); }
java
@SuppressWarnings("WeakerAccess") public void deleteAppProfile(String instanceId, String appProfileId) { ApiExceptions.callAndTranslateApiException(deleteAppProfileAsync(instanceId, appProfileId)); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "void", "deleteAppProfile", "(", "String", "instanceId", ",", "String", "appProfileId", ")", "{", "ApiExceptions", ".", "callAndTranslateApiException", "(", "deleteAppProfileAsync", "(", "instanceId", ",",...
Deletes the specified app profile. <p>Sample code: <pre>{@code client.deleteAppProfile("my-instance", "my-app-profile"); }</pre>
[ "Deletes", "the", "specified", "app", "profile", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java#L1046-L1049
devcon5io/common
mixin/src/main/java/io/devcon5/mixin/Mixin.java
Mixin.invokeDefault
private static Object invokeDefault(final Object proxy, final Method method, final Object[] args) { final Class<?> declaringClass = method.getDeclaringClass(); try { return lookupIn(declaringClass).unreflectSpecial(method, declaringClass) .bindTo(proxy) .invokeWithArguments(args); } catch (Throwable throwable) { throw new RuntimeException(throwable); } }
java
private static Object invokeDefault(final Object proxy, final Method method, final Object[] args) { final Class<?> declaringClass = method.getDeclaringClass(); try { return lookupIn(declaringClass).unreflectSpecial(method, declaringClass) .bindTo(proxy) .invokeWithArguments(args); } catch (Throwable throwable) { throw new RuntimeException(throwable); } }
[ "private", "static", "Object", "invokeDefault", "(", "final", "Object", "proxy", ",", "final", "Method", "method", ",", "final", "Object", "[", "]", "args", ")", "{", "final", "Class", "<", "?", ">", "declaringClass", "=", "method", ".", "getDeclaringClass",...
Invokes a default method. Default methods are implemented in an interface which is overrided by applying the interface to the proxy. This method allows to invoke the default method on the proxy itselfs bypassing the overriden method. @param proxy the proxy object on which the method should be invoked @param method the method to be invoked @param args arguments that are passed to the method @return the return value of the invocation @throws Throwable
[ "Invokes", "a", "default", "method", ".", "Default", "methods", "are", "implemented", "in", "an", "interface", "which", "is", "overrided", "by", "applying", "the", "interface", "to", "the", "proxy", ".", "This", "method", "allows", "to", "invoke", "the", "de...
train
https://github.com/devcon5io/common/blob/363688e0dc904d559682bf796bd6c836b4e0efc7/mixin/src/main/java/io/devcon5/mixin/Mixin.java#L89-L99
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/ArtifactHandler.java
ArtifactHandler.updateDoNotUse
public void updateDoNotUse(final String gavc, final Boolean doNotUse) { final DbArtifact artifact = getArtifact(gavc); repositoryHandler.updateDoNotUse(artifact, doNotUse); }
java
public void updateDoNotUse(final String gavc, final Boolean doNotUse) { final DbArtifact artifact = getArtifact(gavc); repositoryHandler.updateDoNotUse(artifact, doNotUse); }
[ "public", "void", "updateDoNotUse", "(", "final", "String", "gavc", ",", "final", "Boolean", "doNotUse", ")", "{", "final", "DbArtifact", "artifact", "=", "getArtifact", "(", "gavc", ")", ";", "repositoryHandler", ".", "updateDoNotUse", "(", "artifact", ",", "...
Add "DO_NOT_USE" flag to an artifact @param gavc String @param doNotUse Boolean
[ "Add", "DO_NOT_USE", "flag", "to", "an", "artifact" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ArtifactHandler.java#L244-L247
apache/incubator-druid
sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java
Calcites.jodaToCalciteTimestamp
public static long jodaToCalciteTimestamp(final DateTime dateTime, final DateTimeZone timeZone) { return dateTime.withZone(timeZone).withZoneRetainFields(DateTimeZone.UTC).getMillis(); }
java
public static long jodaToCalciteTimestamp(final DateTime dateTime, final DateTimeZone timeZone) { return dateTime.withZone(timeZone).withZoneRetainFields(DateTimeZone.UTC).getMillis(); }
[ "public", "static", "long", "jodaToCalciteTimestamp", "(", "final", "DateTime", "dateTime", ",", "final", "DateTimeZone", "timeZone", ")", "{", "return", "dateTime", ".", "withZone", "(", "timeZone", ")", ".", "withZoneRetainFields", "(", "DateTimeZone", ".", "UTC...
Calcite expects "TIMESTAMP" types to be an instant that has the expected local time fields if printed as UTC. @param dateTime joda timestamp @param timeZone session time zone @return Calcite style millis
[ "Calcite", "expects", "TIMESTAMP", "types", "to", "be", "an", "instant", "that", "has", "the", "expected", "local", "time", "fields", "if", "printed", "as", "UTC", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L224-L227
phax/ph-datetime
ph-holiday/src/main/java/com/helger/holiday/mgr/XMLHolidayManager.java
XMLHolidayManager._unmarshallConfiguration
@Nonnull private static Configuration _unmarshallConfiguration (@WillClose @Nonnull final InputStream aIS) { ValueEnforcer.notNull (aIS, "InputStream"); try { final JAXBContext ctx = JAXBContextCache.getInstance () .getFromCache (com.helger.holiday.jaxb.ObjectFactory.class); final Unmarshaller um = ctx.createUnmarshaller (); final JAXBElement <Configuration> aElement = GenericReflection.uncheckedCast (um.unmarshal (aIS)); return aElement.getValue (); } catch (final JAXBException ex) { throw new IllegalArgumentException ("Cannot parse holidays XML.", ex); } finally { StreamHelper.close (aIS); } }
java
@Nonnull private static Configuration _unmarshallConfiguration (@WillClose @Nonnull final InputStream aIS) { ValueEnforcer.notNull (aIS, "InputStream"); try { final JAXBContext ctx = JAXBContextCache.getInstance () .getFromCache (com.helger.holiday.jaxb.ObjectFactory.class); final Unmarshaller um = ctx.createUnmarshaller (); final JAXBElement <Configuration> aElement = GenericReflection.uncheckedCast (um.unmarshal (aIS)); return aElement.getValue (); } catch (final JAXBException ex) { throw new IllegalArgumentException ("Cannot parse holidays XML.", ex); } finally { StreamHelper.close (aIS); } }
[ "@", "Nonnull", "private", "static", "Configuration", "_unmarshallConfiguration", "(", "@", "WillClose", "@", "Nonnull", "final", "InputStream", "aIS", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aIS", ",", "\"InputStream\"", ")", ";", "try", "{", "final", ...
Unmarshals the configuration from the stream. Uses <code>JAXB</code> for this. @param aIS @return The unmarshalled configuration.
[ "Unmarshals", "the", "configuration", "from", "the", "stream", ".", "Uses", "<code", ">", "JAXB<", "/", "code", ">", "for", "this", "." ]
train
https://github.com/phax/ph-datetime/blob/cfaff01cb76d9affb934800ff55734b5a7d8983e/ph-holiday/src/main/java/com/helger/holiday/mgr/XMLHolidayManager.java#L80-L101
qiniu/android-sdk
library/src/main/java/com/qiniu/android/utils/StringUtils.java
StringUtils.join
public static String join(String[] array, String sep) { if (array == null) { return null; } int arraySize = array.length; int sepSize = 0; if (sep != null && !sep.equals("")) { sepSize = sep.length(); } int bufSize = (arraySize == 0 ? 0 : ((array[0] == null ? 16 : array[0].length()) + sepSize) * arraySize); StringBuilder buf = new StringBuilder(bufSize); for (int i = 0; i < arraySize; i++) { if (i > 0) { buf.append(sep); } if (array[i] != null) { buf.append(array[i]); } } return buf.toString(); }
java
public static String join(String[] array, String sep) { if (array == null) { return null; } int arraySize = array.length; int sepSize = 0; if (sep != null && !sep.equals("")) { sepSize = sep.length(); } int bufSize = (arraySize == 0 ? 0 : ((array[0] == null ? 16 : array[0].length()) + sepSize) * arraySize); StringBuilder buf = new StringBuilder(bufSize); for (int i = 0; i < arraySize; i++) { if (i > 0) { buf.append(sep); } if (array[i] != null) { buf.append(array[i]); } } return buf.toString(); }
[ "public", "static", "String", "join", "(", "String", "[", "]", "array", ",", "String", "sep", ")", "{", "if", "(", "array", "==", "null", ")", "{", "return", "null", ";", "}", "int", "arraySize", "=", "array", ".", "length", ";", "int", "sepSize", ...
以指定的分隔符来进行字符串元素连接 <p> 例如有字符串数组array和连接符为逗号(,) <code> String[] array = new String[] { "hello", "world", "qiniu", "cloud","storage" }; </code> 那么得到的结果是: <code> hello,world,qiniu,cloud,storage </code> </p> @param array 需要连接的字符串数组 @param sep 元素连接之间的分隔符 @return 连接好的新字符串
[ "以指定的分隔符来进行字符串元素连接", "<p", ">", "例如有字符串数组array和连接符为逗号", "(", ")", "<code", ">", "String", "[]", "array", "=", "new", "String", "[]", "{", "hello", "world", "qiniu", "cloud", "storage", "}", ";", "<", "/", "code", ">", "那么得到的结果是", ":", "<code", ">", "hell...
train
https://github.com/qiniu/android-sdk/blob/dbd2a01fb3bff7a5e75e8934bbf81713124d8466/library/src/main/java/com/qiniu/android/utils/StringUtils.java#L29-L52
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTable.java
WTable.addActionConstraint
public void addActionConstraint(final WButton button, final ActionConstraint constraint) { if (button.getParent() != actions) { throw new IllegalArgumentException( "Can only add a constraint to a button which is in this table's actions"); } getOrCreateComponentModel().addActionConstraint(button, constraint); }
java
public void addActionConstraint(final WButton button, final ActionConstraint constraint) { if (button.getParent() != actions) { throw new IllegalArgumentException( "Can only add a constraint to a button which is in this table's actions"); } getOrCreateComponentModel().addActionConstraint(button, constraint); }
[ "public", "void", "addActionConstraint", "(", "final", "WButton", "button", ",", "final", "ActionConstraint", "constraint", ")", "{", "if", "(", "button", ".", "getParent", "(", ")", "!=", "actions", ")", "{", "throw", "new", "IllegalArgumentException", "(", "...
Adds a constraint to when the given action can be used. @param button the button which the constraint applies to. @param constraint the constraint to add.
[ "Adds", "a", "constraint", "to", "when", "the", "given", "action", "can", "be", "used", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTable.java#L1222-L1229
icode/ameba
src/main/java/ameba/websocket/internal/EndpointMeta.java
EndpointMeta.onClose
public void onClose(Session session, CloseReason closeReason) { if (getOnCloseHandle() != null) { callMethod(getOnCloseHandle(), getOnCloseParameters(), session, true, closeReason); } }
java
public void onClose(Session session, CloseReason closeReason) { if (getOnCloseHandle() != null) { callMethod(getOnCloseHandle(), getOnCloseParameters(), session, true, closeReason); } }
[ "public", "void", "onClose", "(", "Session", "session", ",", "CloseReason", "closeReason", ")", "{", "if", "(", "getOnCloseHandle", "(", ")", "!=", "null", ")", "{", "callMethod", "(", "getOnCloseHandle", "(", ")", ",", "getOnCloseParameters", "(", ")", ",",...
<p>onClose.</p> @param session a {@link javax.websocket.Session} object. @param closeReason a {@link javax.websocket.CloseReason} object.
[ "<p", ">", "onClose", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/websocket/internal/EndpointMeta.java#L195-L199
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactGroup
private void compactGroup(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { // Iterate through all segments being compacted and write entries to a single compact segment. for (int i = 0; i < segments.size(); i++) { compactSegment(segments.get(i), predicates.get(i), compactSegment); } }
java
private void compactGroup(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { // Iterate through all segments being compacted and write entries to a single compact segment. for (int i = 0; i < segments.size(); i++) { compactSegment(segments.get(i), predicates.get(i), compactSegment); } }
[ "private", "void", "compactGroup", "(", "List", "<", "Segment", ">", "segments", ",", "List", "<", "OffsetPredicate", ">", "predicates", ",", "Segment", "compactSegment", ")", "{", "// Iterate through all segments being compacted and write entries to a single compact segment....
Compacts segments in a group sequentially. @param segments The segments to compact. @param compactSegment The compact segment.
[ "Compacts", "segments", "in", "a", "group", "sequentially", "." ]
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L174-L179
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java
IdGenerator.extractTimestamp48Ascii
public static long extractTimestamp48Ascii(String id48ascii) throws NumberFormatException { return extractTimestamp48(Long.parseLong(id48ascii, Character.MAX_RADIX)); }
java
public static long extractTimestamp48Ascii(String id48ascii) throws NumberFormatException { return extractTimestamp48(Long.parseLong(id48ascii, Character.MAX_RADIX)); }
[ "public", "static", "long", "extractTimestamp48Ascii", "(", "String", "id48ascii", ")", "throws", "NumberFormatException", "{", "return", "extractTimestamp48", "(", "Long", ".", "parseLong", "(", "id48ascii", ",", "Character", ".", "MAX_RADIX", ")", ")", ";", "}" ...
Extracts the (UNIX) timestamp from a 48-bit ASCII id (radix {@link Character#MAX_RADIX}). @param id48ascii @return the UNIX timestamp (milliseconds) @throws NumberFormatException
[ "Extracts", "the", "(", "UNIX", ")", "timestamp", "from", "a", "48", "-", "bit", "ASCII", "id", "(", "radix", "{", "@link", "Character#MAX_RADIX", "}", ")", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java#L338-L340
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfPKCS7.java
PdfPKCS7.loadCacertsKeyStore
public static KeyStore loadCacertsKeyStore(String provider) { File file = new File(System.getProperty("java.home"), "lib"); file = new File(file, "security"); file = new File(file, "cacerts"); FileInputStream fin = null; try { fin = new FileInputStream(file); KeyStore k; if (provider == null) k = KeyStore.getInstance("JKS"); else k = KeyStore.getInstance("JKS", provider); k.load(fin, null); return k; } catch (Exception e) { throw new ExceptionConverter(e); } finally { try{if (fin != null) {fin.close();}}catch(Exception ex){} } }
java
public static KeyStore loadCacertsKeyStore(String provider) { File file = new File(System.getProperty("java.home"), "lib"); file = new File(file, "security"); file = new File(file, "cacerts"); FileInputStream fin = null; try { fin = new FileInputStream(file); KeyStore k; if (provider == null) k = KeyStore.getInstance("JKS"); else k = KeyStore.getInstance("JKS", provider); k.load(fin, null); return k; } catch (Exception e) { throw new ExceptionConverter(e); } finally { try{if (fin != null) {fin.close();}}catch(Exception ex){} } }
[ "public", "static", "KeyStore", "loadCacertsKeyStore", "(", "String", "provider", ")", "{", "File", "file", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"java.home\"", ")", ",", "\"lib\"", ")", ";", "file", "=", "new", "File", "(", "file",...
Loads the default root certificates at &lt;java.home&gt;/lib/security/cacerts. @param provider the provider or <code>null</code> for the default provider @return a <CODE>KeyStore</CODE>
[ "Loads", "the", "default", "root", "certificates", "at", "&lt", ";", "java", ".", "home&gt", ";", "/", "lib", "/", "security", "/", "cacerts", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java#L786-L807
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.sendMessage
public void sendMessage(@NonNull final String conversationId, @NonNull final String body, @Nullable Callback<ComapiResult<MessageSentResponse>> callback) { SessionData session = dataMgr.getSessionDAO().session(); adapter.adapt(sendMessage(conversationId, APIHelper.createMessage(conversationId, body, session != null ? session.getProfileId() : null)), callback); }
java
public void sendMessage(@NonNull final String conversationId, @NonNull final String body, @Nullable Callback<ComapiResult<MessageSentResponse>> callback) { SessionData session = dataMgr.getSessionDAO().session(); adapter.adapt(sendMessage(conversationId, APIHelper.createMessage(conversationId, body, session != null ? session.getProfileId() : null)), callback); }
[ "public", "void", "sendMessage", "(", "@", "NonNull", "final", "String", "conversationId", ",", "@", "NonNull", "final", "String", "body", ",", "@", "Nullable", "Callback", "<", "ComapiResult", "<", "MessageSentResponse", ">", ">", "callback", ")", "{", "Sessi...
Send message to the chanel. @param conversationId ID of a conversation to send a message to. @param body Message body to be send. @param callback Callback to deliver new session instance.
[ "Send", "message", "to", "the", "chanel", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L728-L731
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java
ToStream.processAttributes
public void processAttributes(java.io.Writer writer, int nAttrs) throws IOException, SAXException { /* real SAX attributes are not passed in, so process the * attributes that were collected after the startElement call. * _attribVector is a "cheap" list for Stream serializer output * accumulated over a series of calls to attribute(name,value) */ String encoding = getEncoding(); for (int i = 0; i < nAttrs; i++) { // elementAt is JDK 1.1.8 final String name = m_attributes.getQName(i); final String value = m_attributes.getValue(i); writer.write(' '); writer.write(name); writer.write("=\""); writeAttrString(writer, value, encoding); writer.write('\"'); } }
java
public void processAttributes(java.io.Writer writer, int nAttrs) throws IOException, SAXException { /* real SAX attributes are not passed in, so process the * attributes that were collected after the startElement call. * _attribVector is a "cheap" list for Stream serializer output * accumulated over a series of calls to attribute(name,value) */ String encoding = getEncoding(); for (int i = 0; i < nAttrs; i++) { // elementAt is JDK 1.1.8 final String name = m_attributes.getQName(i); final String value = m_attributes.getValue(i); writer.write(' '); writer.write(name); writer.write("=\""); writeAttrString(writer, value, encoding); writer.write('\"'); } }
[ "public", "void", "processAttributes", "(", "java", ".", "io", ".", "Writer", "writer", ",", "int", "nAttrs", ")", "throws", "IOException", ",", "SAXException", "{", "/* real SAX attributes are not passed in, so process the \n * attributes that were collected after ...
Process the attributes, which means to write out the currently collected attributes to the writer. The attributes are not cleared by this method @param writer the writer to write processed attributes to. @param nAttrs the number of attributes in m_attributes to be processed @throws java.io.IOException @throws org.xml.sax.SAXException
[ "Process", "the", "attributes", "which", "means", "to", "write", "out", "the", "currently", "collected", "attributes", "to", "the", "writer", ".", "The", "attributes", "are", "not", "cleared", "by", "this", "method" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L2062-L2082
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitLiteral
@Override public R visitLiteral(LiteralTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitLiteral(LiteralTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitLiteral", "(", "LiteralTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L273-L276
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseShyb2dense
public static int cusparseShyb2dense( cusparseHandle handle, cusparseMatDescr descrA, cusparseHybMat hybA, Pointer A, int lda) { return checkResult(cusparseShyb2denseNative(handle, descrA, hybA, A, lda)); }
java
public static int cusparseShyb2dense( cusparseHandle handle, cusparseMatDescr descrA, cusparseHybMat hybA, Pointer A, int lda) { return checkResult(cusparseShyb2denseNative(handle, descrA, hybA, A, lda)); }
[ "public", "static", "int", "cusparseShyb2dense", "(", "cusparseHandle", "handle", ",", "cusparseMatDescr", "descrA", ",", "cusparseHybMat", "hybA", ",", "Pointer", "A", ",", "int", "lda", ")", "{", "return", "checkResult", "(", "cusparseShyb2denseNative", "(", "ha...
Description: This routine converts a sparse matrix in HYB storage format to a dense matrix.
[ "Description", ":", "This", "routine", "converts", "a", "sparse", "matrix", "in", "HYB", "storage", "format", "to", "a", "dense", "matrix", "." ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L11917-L11925
zxing/zxing
core/src/main/java/com/google/zxing/client/result/CalendarParsedResult.java
CalendarParsedResult.parseDate
private static long parseDate(String when) throws ParseException { if (!DATE_TIME.matcher(when).matches()) { throw new ParseException(when, 0); } if (when.length() == 8) { // Show only year/month/day DateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH); // For dates without a time, for purposes of interacting with Android, the resulting timestamp // needs to be midnight of that day in GMT. See: // http://code.google.com/p/android/issues/detail?id=8330 format.setTimeZone(TimeZone.getTimeZone("GMT")); return format.parse(when).getTime(); } // The when string can be local time, or UTC if it ends with a Z if (when.length() == 16 && when.charAt(15) == 'Z') { long milliseconds = parseDateTimeString(when.substring(0, 15)); Calendar calendar = new GregorianCalendar(); // Account for time zone difference milliseconds += calendar.get(Calendar.ZONE_OFFSET); // Might need to correct for daylight savings time, but use target time since // now might be in DST but not then, or vice versa calendar.setTime(new Date(milliseconds)); return milliseconds + calendar.get(Calendar.DST_OFFSET); } return parseDateTimeString(when); }
java
private static long parseDate(String when) throws ParseException { if (!DATE_TIME.matcher(when).matches()) { throw new ParseException(when, 0); } if (when.length() == 8) { // Show only year/month/day DateFormat format = new SimpleDateFormat("yyyyMMdd", Locale.ENGLISH); // For dates without a time, for purposes of interacting with Android, the resulting timestamp // needs to be midnight of that day in GMT. See: // http://code.google.com/p/android/issues/detail?id=8330 format.setTimeZone(TimeZone.getTimeZone("GMT")); return format.parse(when).getTime(); } // The when string can be local time, or UTC if it ends with a Z if (when.length() == 16 && when.charAt(15) == 'Z') { long milliseconds = parseDateTimeString(when.substring(0, 15)); Calendar calendar = new GregorianCalendar(); // Account for time zone difference milliseconds += calendar.get(Calendar.ZONE_OFFSET); // Might need to correct for daylight savings time, but use target time since // now might be in DST but not then, or vice versa calendar.setTime(new Date(milliseconds)); return milliseconds + calendar.get(Calendar.DST_OFFSET); } return parseDateTimeString(when); }
[ "private", "static", "long", "parseDate", "(", "String", "when", ")", "throws", "ParseException", "{", "if", "(", "!", "DATE_TIME", ".", "matcher", "(", "when", ")", ".", "matches", "(", ")", ")", "{", "throw", "new", "ParseException", "(", "when", ",", ...
Parses a string as a date. RFC 2445 allows the start and end fields to be of type DATE (e.g. 20081021) or DATE-TIME (e.g. 20081021T123000 for local time, or 20081021T123000Z for UTC). @param when The string to parse @throws ParseException if not able to parse as a date
[ "Parses", "a", "string", "as", "a", "date", ".", "RFC", "2445", "allows", "the", "start", "and", "end", "fields", "to", "be", "of", "type", "DATE", "(", "e", ".", "g", ".", "20081021", ")", "or", "DATE", "-", "TIME", "(", "e", ".", "g", ".", "2...
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/client/result/CalendarParsedResult.java#L199-L224
wcm-io/wcm-io-handler
commons/src/main/java/io/wcm/handler/commons/dom/HtmlElement.java
HtmlElement.setEmptyAttributeValueAsBoolean
protected final T setEmptyAttributeValueAsBoolean(String attributeName, boolean value) { if (value) { setAttribute(attributeName, attributeName.toLowerCase()); } else { removeAttribute(attributeName); } return (T)this; }
java
protected final T setEmptyAttributeValueAsBoolean(String attributeName, boolean value) { if (value) { setAttribute(attributeName, attributeName.toLowerCase()); } else { removeAttribute(attributeName); } return (T)this; }
[ "protected", "final", "T", "setEmptyAttributeValueAsBoolean", "(", "String", "attributeName", ",", "boolean", "value", ")", "{", "if", "(", "value", ")", "{", "setAttribute", "(", "attributeName", ",", "attributeName", ".", "toLowerCase", "(", ")", ")", ";", "...
Sets "empty" attribute value as boolean (i.e. for "checked" attribute). @param attributeName Attribute name @param value Attribute value as boolean @return Self reference
[ "Sets", "empty", "attribute", "value", "as", "boolean", "(", "i", ".", "e", ".", "for", "checked", "attribute", ")", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/commons/src/main/java/io/wcm/handler/commons/dom/HtmlElement.java#L79-L87
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.readCertificate
public static Certificate readCertificate(String type, InputStream in, char[] password, String alias) { return KeyUtil.readCertificate(type, in, password, alias); }
java
public static Certificate readCertificate(String type, InputStream in, char[] password, String alias) { return KeyUtil.readCertificate(type, in, password, alias); }
[ "public", "static", "Certificate", "readCertificate", "(", "String", "type", ",", "InputStream", "in", ",", "char", "[", "]", "password", ",", "String", "alias", ")", "{", "return", "KeyUtil", ".", "readCertificate", "(", "type", ",", "in", ",", "password", ...
读取Certification文件<br> Certification为证书文件<br> see: http://snowolf.iteye.com/blog/391931 @param type 类型,例如X.509 @param in {@link InputStream} 如果想从文件读取.cer文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取 @param password 密码 @param alias 别名 @return {@link KeyStore} @since 4.4.1
[ "读取Certification文件<br", ">", "Certification为证书文件<br", ">", "see", ":", "http", ":", "//", "snowolf", ".", "iteye", ".", "com", "/", "blog", "/", "391931" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L364-L366
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java
IterUtil.toMap
public static <K, V> Map<K, V> toMap(Iterable<K> keys, Iterable<V> values) { return toMap(keys, values, false); }
java
public static <K, V> Map<K, V> toMap(Iterable<K> keys, Iterable<V> values) { return toMap(keys, values, false); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "toMap", "(", "Iterable", "<", "K", ">", "keys", ",", "Iterable", "<", "V", ">", "values", ")", "{", "return", "toMap", "(", "keys", ",", "values", ",", "false", ")", ...
将键列表和值列表转换为Map<br> 以键为准,值与键位置需对应。如果键元素数多于值元素,多余部分值用null代替。<br> 如果值多于键,忽略多余的值。 @param <K> 键类型 @param <V> 值类型 @param keys 键列表 @param values 值列表 @return 标题内容Map @since 3.1.0
[ "将键列表和值列表转换为Map<br", ">", "以键为准,值与键位置需对应。如果键元素数多于值元素,多余部分值用null代替。<br", ">", "如果值多于键,忽略多余的值。" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L371-L373
goldmansachs/reladomo
reladomogen/src/main/java/com/gs/fw/common/mithra/generator/queryparser/JJTMithraQLState.java
JJTMithraQLState.closeNodeScope
void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); mk = ((Integer)marks.pop()).intValue(); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { mk = ((Integer)marks.pop()).intValue(); node_created = false; } }
java
void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); mk = ((Integer)marks.pop()).intValue(); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { mk = ((Integer)marks.pop()).intValue(); node_created = false; } }
[ "void", "closeNodeScope", "(", "Node", "n", ",", "boolean", "condition", ")", "{", "if", "(", "condition", ")", "{", "int", "a", "=", "nodeArity", "(", ")", ";", "mk", "=", "(", "(", "Integer", ")", "marks", ".", "pop", "(", ")", ")", ".", "intVa...
/* A conditional node is constructed if its condition is true. All the nodes that have been pushed since the node was opened are made children of the the conditional node, which is then pushed on to the stack. If the condition is false the node is not constructed and they are left on the stack.
[ "/", "*", "A", "conditional", "node", "is", "constructed", "if", "its", "condition", "is", "true", ".", "All", "the", "nodes", "that", "have", "been", "pushed", "since", "the", "node", "was", "opened", "are", "made", "children", "of", "the", "the", "cond...
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomogen/src/main/java/com/gs/fw/common/mithra/generator/queryparser/JJTMithraQLState.java#L122-L138
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/IPCLoggerChannel.java
IPCLoggerChannel.buildURLToFetchImage
@Override public URL buildURLToFetchImage(long txid) { Preconditions.checkArgument(txid >= -1, "Invalid segment: %s", txid); Preconditions.checkState(httpPort != -1, "HTTP port not set yet"); try { // for now we disable throttling for image downloads String path = GetJournalImageServlet.buildPath(journalId, txid, nsInfo, true); return new URL("http", addr.getAddress().getHostAddress(), httpPort, path.toString()); } catch (MalformedURLException e) { // should never get here. throw new IllegalStateException(e); } }
java
@Override public URL buildURLToFetchImage(long txid) { Preconditions.checkArgument(txid >= -1, "Invalid segment: %s", txid); Preconditions.checkState(httpPort != -1, "HTTP port not set yet"); try { // for now we disable throttling for image downloads String path = GetJournalImageServlet.buildPath(journalId, txid, nsInfo, true); return new URL("http", addr.getAddress().getHostAddress(), httpPort, path.toString()); } catch (MalformedURLException e) { // should never get here. throw new IllegalStateException(e); } }
[ "@", "Override", "public", "URL", "buildURLToFetchImage", "(", "long", "txid", ")", "{", "Preconditions", ".", "checkArgument", "(", "txid", ">=", "-", "1", ",", "\"Invalid segment: %s\"", ",", "txid", ")", ";", "Preconditions", ".", "checkState", "(", "httpPo...
Build url to fetch image from the journal node to which this logger channel is attached.
[ "Build", "url", "to", "fetch", "image", "from", "the", "journal", "node", "to", "which", "this", "logger", "channel", "is", "attached", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/IPCLoggerChannel.java#L697-L712
apereo/cas
support/cas-server-support-electrofence/src/main/java/org/apereo/cas/web/flow/RiskAwareAuthenticationWebflowEventResolver.java
RiskAwareAuthenticationWebflowEventResolver.handlePossibleSuspiciousAttempt
protected Set<Event> handlePossibleSuspiciousAttempt(final HttpServletRequest request, final Authentication authentication, final RegisteredService service) { getWebflowEventResolutionConfigurationContext().getEventPublisher() .publishEvent(new CasRiskBasedAuthenticationEvaluationStartedEvent(this, authentication, service)); LOGGER.debug("Evaluating possible suspicious authentication attempt for [{}]", authentication.getPrincipal()); val score = authenticationRiskEvaluator.eval(authentication, service, request); if (score.isRiskGreaterThan(threshold)) { getWebflowEventResolutionConfigurationContext().getEventPublisher() .publishEvent(new CasRiskyAuthenticationDetectedEvent(this, authentication, service, score)); LOGGER.debug("Calculated risk score [{}] for authentication request by [{}] is above the risk threshold [{}].", score.getScore(), authentication.getPrincipal(), threshold); getWebflowEventResolutionConfigurationContext().getEventPublisher() .publishEvent(new CasRiskBasedAuthenticationMitigationStartedEvent(this, authentication, service, score)); val res = authenticationRiskMitigator.mitigate(authentication, service, score, request); getWebflowEventResolutionConfigurationContext().getEventPublisher() .publishEvent(new CasRiskyAuthenticationMitigatedEvent(this, authentication, service, res)); return CollectionUtils.wrapSet(res.getResult()); } LOGGER.debug("Authentication request for [{}] is below the risk threshold", authentication.getPrincipal()); return null; }
java
protected Set<Event> handlePossibleSuspiciousAttempt(final HttpServletRequest request, final Authentication authentication, final RegisteredService service) { getWebflowEventResolutionConfigurationContext().getEventPublisher() .publishEvent(new CasRiskBasedAuthenticationEvaluationStartedEvent(this, authentication, service)); LOGGER.debug("Evaluating possible suspicious authentication attempt for [{}]", authentication.getPrincipal()); val score = authenticationRiskEvaluator.eval(authentication, service, request); if (score.isRiskGreaterThan(threshold)) { getWebflowEventResolutionConfigurationContext().getEventPublisher() .publishEvent(new CasRiskyAuthenticationDetectedEvent(this, authentication, service, score)); LOGGER.debug("Calculated risk score [{}] for authentication request by [{}] is above the risk threshold [{}].", score.getScore(), authentication.getPrincipal(), threshold); getWebflowEventResolutionConfigurationContext().getEventPublisher() .publishEvent(new CasRiskBasedAuthenticationMitigationStartedEvent(this, authentication, service, score)); val res = authenticationRiskMitigator.mitigate(authentication, service, score, request); getWebflowEventResolutionConfigurationContext().getEventPublisher() .publishEvent(new CasRiskyAuthenticationMitigatedEvent(this, authentication, service, res)); return CollectionUtils.wrapSet(res.getResult()); } LOGGER.debug("Authentication request for [{}] is below the risk threshold", authentication.getPrincipal()); return null; }
[ "protected", "Set", "<", "Event", ">", "handlePossibleSuspiciousAttempt", "(", "final", "HttpServletRequest", "request", ",", "final", "Authentication", "authentication", ",", "final", "RegisteredService", "service", ")", "{", "getWebflowEventResolutionConfigurationContext", ...
Handle possible suspicious attempt. @param request the request @param authentication the authentication @param service the service @return the set
[ "Handle", "possible", "suspicious", "attempt", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-electrofence/src/main/java/org/apereo/cas/web/flow/RiskAwareAuthenticationWebflowEventResolver.java#L68-L97
spotbugs/spotbugs
spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/BugLoader.java
BugLoader.createEngine
private static IFindBugsEngine createEngine(@Nonnull Project p, BugReporter pcb) { FindBugs2 engine = new FindBugs2(); engine.setBugReporter(pcb); engine.setProject(p); engine.setDetectorFactoryCollection(DetectorFactoryCollection.instance()); // // Honor -effort option if one was given on the command line. // engine.setAnalysisFeatureSettings(Driver.getAnalysisSettingList()); return engine; }
java
private static IFindBugsEngine createEngine(@Nonnull Project p, BugReporter pcb) { FindBugs2 engine = new FindBugs2(); engine.setBugReporter(pcb); engine.setProject(p); engine.setDetectorFactoryCollection(DetectorFactoryCollection.instance()); // // Honor -effort option if one was given on the command line. // engine.setAnalysisFeatureSettings(Driver.getAnalysisSettingList()); return engine; }
[ "private", "static", "IFindBugsEngine", "createEngine", "(", "@", "Nonnull", "Project", "p", ",", "BugReporter", "pcb", ")", "{", "FindBugs2", "engine", "=", "new", "FindBugs2", "(", ")", ";", "engine", ".", "setBugReporter", "(", "pcb", ")", ";", "engine", ...
Create the IFindBugsEngine that will be used to analyze the application. @param p the Project @param pcb the PrintCallBack @return the IFindBugsEngine
[ "Create", "the", "IFindBugsEngine", "that", "will", "be", "used", "to", "analyze", "the", "application", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/BugLoader.java#L124-L137
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.sampleFromDistribution
public static int sampleFromDistribution(double[] d, Random random) { // sample from the uniform [0,1] double r = random.nextDouble(); // now compare its value to cumulative values to find what interval it falls in double total = 0; for (int i = 0; i < d.length - 1; i++) { if (Double.isNaN(d[i])) { throw new RuntimeException("Can't sample from NaN"); } total += d[i]; if (r < total) { return i; } } return d.length - 1; // in case the "double-math" didn't total to exactly 1.0 }
java
public static int sampleFromDistribution(double[] d, Random random) { // sample from the uniform [0,1] double r = random.nextDouble(); // now compare its value to cumulative values to find what interval it falls in double total = 0; for (int i = 0; i < d.length - 1; i++) { if (Double.isNaN(d[i])) { throw new RuntimeException("Can't sample from NaN"); } total += d[i]; if (r < total) { return i; } } return d.length - 1; // in case the "double-math" didn't total to exactly 1.0 }
[ "public", "static", "int", "sampleFromDistribution", "(", "double", "[", "]", "d", ",", "Random", "random", ")", "{", "// sample from the uniform [0,1]\r", "double", "r", "=", "random", ".", "nextDouble", "(", ")", ";", "// now compare its value to cumulative values t...
Samples from the distribution over values 0 through d.length given by d. Assumes that the distribution sums to 1.0. @param d the distribution to sample from @return a value from 0 to d.length
[ "Samples", "from", "the", "distribution", "over", "values", "0", "through", "d", ".", "length", "given", "by", "d", ".", "Assumes", "that", "the", "distribution", "sums", "to", "1", ".", "0", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L1231-L1246
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/Tracer.java
Tracer.withSpan
public final Runnable withSpan(Span span, Runnable runnable) { return CurrentSpanUtils.withSpan(span, /* endSpan= */ false, runnable); }
java
public final Runnable withSpan(Span span, Runnable runnable) { return CurrentSpanUtils.withSpan(span, /* endSpan= */ false, runnable); }
[ "public", "final", "Runnable", "withSpan", "(", "Span", "span", ",", "Runnable", "runnable", ")", "{", "return", "CurrentSpanUtils", ".", "withSpan", "(", "span", ",", "/* endSpan= */", "false", ",", "runnable", ")", ";", "}" ]
Returns a {@link Runnable} that runs the given task with the given {@code Span} in the current context. <p>Users may consider to use {@link SpanBuilder#startSpanAndRun(Runnable)}. <p>Any error will end up as a {@link Status#UNKNOWN}. <p>IMPORTANT: Caller must manually propagate the entire {@code io.grpc.Context} when wraps a {@code Runnable}, see the examples. <p>IMPORTANT: Caller must manually end the {@code Span} within the {@code Runnable}, or after the {@code Runnable} is executed. <p>Example with Executor wrapped with {@link io.grpc.Context#currentContextExecutor}: <pre><code> class MyClass { private static Tracer tracer = Tracing.getTracer(); void handleRequest(Executor executor) { Span span = tracer.spanBuilder("MyRunnableSpan").startSpan(); executor.execute(tracer.withSpan(span, new Runnable() { {@literal @}Override public void run() { try { sendResult(); } finally { span.end(); } } })); } } </code></pre> <p>Example without Executor wrapped with {@link io.grpc.Context#currentContextExecutor}: <pre><code> class MyClass { private static Tracer tracer = Tracing.getTracer(); void handleRequest(Executor executor) { Span span = tracer.spanBuilder("MyRunnableSpan").startSpan(); executor.execute(Context.wrap(tracer.withSpan(span, new Runnable() { {@literal @}Override public void run() { try { sendResult(); } finally { span.end(); } } }))); } } </code></pre> @param span the {@code Span} to be set as current. @param runnable the {@code Runnable} to withSpan in the {@code Span}. @return the {@code Runnable}. @since 0.11.0
[ "Returns", "a", "{", "@link", "Runnable", "}", "that", "runs", "the", "given", "task", "with", "the", "given", "{", "@code", "Span", "}", "in", "the", "current", "context", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/Tracer.java#L218-L220
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.loadBalancing_serviceName_backend_POST
public OvhLoadBalancingTask loadBalancing_serviceName_backend_POST(String serviceName, String ipBackend, OvhLoadBalancingBackendProbeEnum probe, Long weight) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/backend"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ipBackend", ipBackend); addBody(o, "probe", probe); addBody(o, "weight", weight); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhLoadBalancingTask.class); }
java
public OvhLoadBalancingTask loadBalancing_serviceName_backend_POST(String serviceName, String ipBackend, OvhLoadBalancingBackendProbeEnum probe, Long weight) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/backend"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ipBackend", ipBackend); addBody(o, "probe", probe); addBody(o, "weight", weight); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhLoadBalancingTask.class); }
[ "public", "OvhLoadBalancingTask", "loadBalancing_serviceName_backend_POST", "(", "String", "serviceName", ",", "String", "ipBackend", ",", "OvhLoadBalancingBackendProbeEnum", "probe", ",", "Long", "weight", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip...
Add a new backend on your IP load balancing REST: POST /ip/loadBalancing/{serviceName}/backend @param weight [required] Weight of the backend on its zone, must be between 1 and 100 @param probe [required] The type of probe used @param ipBackend [required] IP of your backend @param serviceName [required] The internal name of your IP load balancing
[ "Add", "a", "new", "backend", "on", "your", "IP", "load", "balancing" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1455-L1464
datacleaner/DataCleaner
engine/utils/src/main/java/org/datacleaner/util/CsvConfigurationDetection.java
CsvConfigurationDetection.suggestCsvConfiguration
public CsvConfiguration suggestCsvConfiguration(final String encoding, final List<String> columnNames) throws IllegalStateException { final byte[] sample = getSampleBuffer(); return suggestCsvConfiguration(sample, encoding, columnNames); }
java
public CsvConfiguration suggestCsvConfiguration(final String encoding, final List<String> columnNames) throws IllegalStateException { final byte[] sample = getSampleBuffer(); return suggestCsvConfiguration(sample, encoding, columnNames); }
[ "public", "CsvConfiguration", "suggestCsvConfiguration", "(", "final", "String", "encoding", ",", "final", "List", "<", "String", ">", "columnNames", ")", "throws", "IllegalStateException", "{", "final", "byte", "[", "]", "sample", "=", "getSampleBuffer", "(", ")"...
Auto-detect the {@link CsvConfiguration} of a CSV style data file, providing the encoding externally. @param encoding @return a detected CSV configuration @throws IllegalStateException if an error occurs during auto-detection
[ "Auto", "-", "detect", "the", "{", "@link", "CsvConfiguration", "}", "of", "a", "CSV", "style", "data", "file", "providing", "the", "encoding", "externally", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/utils/src/main/java/org/datacleaner/util/CsvConfigurationDetection.java#L119-L123
beangle/beangle3
ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java
BeanDefinitionParser.createBeanDefinition
protected AbstractBeanDefinition createBeanDefinition(String className, String parentName) throws ClassNotFoundException { return BeanDefinitionReaderUtils.createBeanDefinition(parentName, className, null); }
java
protected AbstractBeanDefinition createBeanDefinition(String className, String parentName) throws ClassNotFoundException { return BeanDefinitionReaderUtils.createBeanDefinition(parentName, className, null); }
[ "protected", "AbstractBeanDefinition", "createBeanDefinition", "(", "String", "className", ",", "String", "parentName", ")", "throws", "ClassNotFoundException", "{", "return", "BeanDefinitionReaderUtils", ".", "createBeanDefinition", "(", "parentName", ",", "className", ","...
Create a bean definition for the given class name and parent name. @param className the name of the bean class @param parentName the name of the bean's parent bean @return the newly created bean definition @throws java.lang.ClassNotFoundException if bean class resolution was attempted but failed
[ "Create", "a", "bean", "definition", "for", "the", "given", "class", "name", "and", "parent", "name", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L320-L323
bwkimmel/java-util
src/main/java/ca/eandb/util/io/FileUtil.java
FileUtil.getApplicationDataDirectory
public static File getApplicationDataDirectory(final String applicationName) { final String userHome = System.getProperty("user.home", "."); final File workingDirectory; final String osName = System.getProperty("os.name", "").toLowerCase(); if (osName.contains("windows")) { final String applicationData = System.getenv("APPDATA"); if (applicationData != null) workingDirectory = new File(applicationData, applicationName + '/'); else workingDirectory = new File(userHome, '.' + applicationName + '/'); } else if (osName.contains("mac")) { workingDirectory = new File(userHome, "Library/Application Support/" + applicationName); } else { workingDirectory = new File(userHome, '.' + applicationName + '/'); } if (!workingDirectory.exists()) if (!workingDirectory.mkdirs()) throw new RuntimeException("The working directory could not be created: " + workingDirectory); return workingDirectory; }
java
public static File getApplicationDataDirectory(final String applicationName) { final String userHome = System.getProperty("user.home", "."); final File workingDirectory; final String osName = System.getProperty("os.name", "").toLowerCase(); if (osName.contains("windows")) { final String applicationData = System.getenv("APPDATA"); if (applicationData != null) workingDirectory = new File(applicationData, applicationName + '/'); else workingDirectory = new File(userHome, '.' + applicationName + '/'); } else if (osName.contains("mac")) { workingDirectory = new File(userHome, "Library/Application Support/" + applicationName); } else { workingDirectory = new File(userHome, '.' + applicationName + '/'); } if (!workingDirectory.exists()) if (!workingDirectory.mkdirs()) throw new RuntimeException("The working directory could not be created: " + workingDirectory); return workingDirectory; }
[ "public", "static", "File", "getApplicationDataDirectory", "(", "final", "String", "applicationName", ")", "{", "final", "String", "userHome", "=", "System", ".", "getProperty", "(", "\"user.home\"", ",", "\".\"", ")", ";", "final", "File", "workingDirectory", ";"...
Returns the appropriate working directory for storing application data. The result of this method is platform dependant: On linux, it will return ~/applicationName, on windows, the working directory will be located in the user's application data folder. For Mac OS systems, the working directory will be placed in the proper location in "Library/Application Support". <p> This method will also make sure that the working directory exists. When invoked, the directory and all required subfolders will be created. @param applicationName Name of the application, used to determine the working directory. @return the appropriate working directory for storing application data.
[ "Returns", "the", "appropriate", "working", "directory", "for", "storing", "application", "data", ".", "The", "result", "of", "this", "method", "is", "platform", "dependant", ":", "On", "linux", "it", "will", "return", "~", "/", "applicationName", "on", "windo...
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L349-L368
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/util/SegmentClipper.java
SegmentClipper.isOnTheSameSideOut
private boolean isOnTheSameSideOut(final long pX0, final long pY0, final long pX1, final long pY1) { return (pX0 < mXMin && pX1 < mXMin) || (pX0 > mXMax && pX1 > mXMax) || (pY0 < mYMin && pY1 < mYMin) || (pY0 > mYMax && pY1 > mYMax); }
java
private boolean isOnTheSameSideOut(final long pX0, final long pY0, final long pX1, final long pY1) { return (pX0 < mXMin && pX1 < mXMin) || (pX0 > mXMax && pX1 > mXMax) || (pY0 < mYMin && pY1 < mYMin) || (pY0 > mYMax && pY1 > mYMax); }
[ "private", "boolean", "isOnTheSameSideOut", "(", "final", "long", "pX0", ",", "final", "long", "pY0", ",", "final", "long", "pX1", ",", "final", "long", "pY1", ")", "{", "return", "(", "pX0", "<", "mXMin", "&&", "pX1", "<", "mXMin", ")", "||", "(", "...
Optimization for lines (as opposed to Path) If both points are outside of the clip area and "on the same side of the outside" (sic) we don't need to compute anything anymore as it won't draw a line in the end @since 6.0.0
[ "Optimization", "for", "lines", "(", "as", "opposed", "to", "Path", ")", "If", "both", "points", "are", "outside", "of", "the", "clip", "area", "and", "on", "the", "same", "side", "of", "the", "outside", "(", "sic", ")", "we", "don", "t", "need", "to...
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/SegmentClipper.java#L241-L246
wcm-io/wcm-io-tooling
commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/unpack/ContentUnpacker.java
ContentUnpacker.getNamespacePrefixes
private Set<String> getNamespacePrefixes(ZipFile zipFile, ZipArchiveEntry entry) throws IOException { try (InputStream entryStream = zipFile.getInputStream(entry)) { SAXParser parser = SAX_PARSER_FACTORY.newSAXParser(); final Set<String> prefixes = new LinkedHashSet<>(); final AtomicBoolean foundRootElement = new AtomicBoolean(false); DefaultHandler handler = new DefaultHandler() { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // validate that XML file contains FileVault XML content if (StringUtils.equals(uri, JCR_NAMESPACE.getURI()) && StringUtils.equals(localName, "root")) { foundRootElement.set(true); } } @Override public void startPrefixMapping(String prefix, String uri) throws SAXException { if (StringUtils.isNotBlank(prefix)) { prefixes.add(prefix); } } }; parser.parse(entryStream, handler); if (!foundRootElement.get()) { return null; } else { return prefixes; } } catch (IOException | SAXException | ParserConfigurationException ex) { throw new IOException("Error parsing " + entry.getName(), ex); } }
java
private Set<String> getNamespacePrefixes(ZipFile zipFile, ZipArchiveEntry entry) throws IOException { try (InputStream entryStream = zipFile.getInputStream(entry)) { SAXParser parser = SAX_PARSER_FACTORY.newSAXParser(); final Set<String> prefixes = new LinkedHashSet<>(); final AtomicBoolean foundRootElement = new AtomicBoolean(false); DefaultHandler handler = new DefaultHandler() { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // validate that XML file contains FileVault XML content if (StringUtils.equals(uri, JCR_NAMESPACE.getURI()) && StringUtils.equals(localName, "root")) { foundRootElement.set(true); } } @Override public void startPrefixMapping(String prefix, String uri) throws SAXException { if (StringUtils.isNotBlank(prefix)) { prefixes.add(prefix); } } }; parser.parse(entryStream, handler); if (!foundRootElement.get()) { return null; } else { return prefixes; } } catch (IOException | SAXException | ParserConfigurationException ex) { throw new IOException("Error parsing " + entry.getName(), ex); } }
[ "private", "Set", "<", "String", ">", "getNamespacePrefixes", "(", "ZipFile", "zipFile", ",", "ZipArchiveEntry", "entry", ")", "throws", "IOException", "{", "try", "(", "InputStream", "entryStream", "=", "zipFile", ".", "getInputStream", "(", "entry", ")", ")", ...
Parses XML file with namespace-aware SAX parser to get defined namespaces prefixes in order of appearance (to keep the same order when outputting the XML file again). @param zipFile ZIP file @param entry ZIP entry @return Ordered set with namespace prefixes in correct order. Returns null if given XML file does not contain FileVault XML content. @throws IOException
[ "Parses", "XML", "file", "with", "namespace", "-", "aware", "SAX", "parser", "to", "get", "defined", "namespaces", "prefixes", "in", "order", "of", "appearance", "(", "to", "keep", "the", "same", "order", "when", "outputting", "the", "XML", "file", "again", ...
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/unpack/ContentUnpacker.java#L217-L250
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/client/OLAPSession.java
OLAPSession.mergeShard
public boolean mergeShard(String shard, Date expireDate) { Utils.require(!Utils.isEmpty(shard), "shard"); try { // Send a POST request to "/{application}/_shards/{shard}[?expire-date=<date>]" StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix()); uri.append("/"); uri.append(Utils.urlEncode(m_appDef.getAppName())); uri.append("/_shards/"); uri.append(Utils.urlEncode(shard)); if (expireDate != null) { uri.append("?expire-date="); uri.append(Utils.urlEncode(Utils.formatDateUTC(expireDate))); } RESTResponse response = m_restClient.sendRequest(HttpMethod.POST, uri.toString()); m_logger.debug("mergeShard() response: {}", response.toString()); throwIfErrorResponse(response); return true; } catch (Exception e) { throw new RuntimeException(e); } }
java
public boolean mergeShard(String shard, Date expireDate) { Utils.require(!Utils.isEmpty(shard), "shard"); try { // Send a POST request to "/{application}/_shards/{shard}[?expire-date=<date>]" StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix()); uri.append("/"); uri.append(Utils.urlEncode(m_appDef.getAppName())); uri.append("/_shards/"); uri.append(Utils.urlEncode(shard)); if (expireDate != null) { uri.append("?expire-date="); uri.append(Utils.urlEncode(Utils.formatDateUTC(expireDate))); } RESTResponse response = m_restClient.sendRequest(HttpMethod.POST, uri.toString()); m_logger.debug("mergeShard() response: {}", response.toString()); throwIfErrorResponse(response); return true; } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "boolean", "mergeShard", "(", "String", "shard", ",", "Date", "expireDate", ")", "{", "Utils", ".", "require", "(", "!", "Utils", ".", "isEmpty", "(", "shard", ")", ",", "\"shard\"", ")", ";", "try", "{", "// Send a POST request to \"/{application}/_...
Request a merge of the OLAP shard with the given name belonging to this session's application. Optionally set the shard's expire-date to the given value. True is returned if the merge was successful. An exception is thrown if an error occurred. @param shard Shard name. @param expireDate Optional value for shard's new expire-date. Leave null if the shard should have no expiration date. @return True if the merge was successful.
[ "Request", "a", "merge", "of", "the", "OLAP", "shard", "with", "the", "given", "name", "belonging", "to", "this", "session", "s", "application", ".", "Optionally", "set", "the", "shard", "s", "expire", "-", "date", "to", "the", "given", "value", ".", "Tr...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/OLAPSession.java#L219-L239
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toTimestamp
public static java.sql.Timestamp toTimestamp(String date, String time) { java.util.Date newDate = toDate(date, time); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
java
public static java.sql.Timestamp toTimestamp(String date, String time) { java.util.Date newDate = toDate(date, time); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Timestamp", "toTimestamp", "(", "String", "date", ",", "String", "time", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "date", ",", "time", ")", ";", "if", "(", "newDate", "!=...
Converts a date String and a time String into a Timestamp @param date The date String: MM/DD/YYYY @param time The time String: either HH:MM or HH:MM:SS @return A Timestamp made from the date and time Strings
[ "Converts", "a", "date", "String", "and", "a", "time", "String", "into", "a", "Timestamp" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L230-L237
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Path.java
Path.lineTo
public void lineTo(float x, float y) { if (hole != null) { hole.add(new float[] {x,y}); } else { localPoints.add(new float[] {x,y}); } cx = x; cy = y; pointsDirty = true; }
java
public void lineTo(float x, float y) { if (hole != null) { hole.add(new float[] {x,y}); } else { localPoints.add(new float[] {x,y}); } cx = x; cy = y; pointsDirty = true; }
[ "public", "void", "lineTo", "(", "float", "x", ",", "float", "y", ")", "{", "if", "(", "hole", "!=", "null", ")", "{", "hole", ".", "add", "(", "new", "float", "[", "]", "{", "x", ",", "y", "}", ")", ";", "}", "else", "{", "localPoints", ".",...
Add a line to the contour or hole which ends at the specified location. @param x The x coordinate to draw the line to @param y The y coordiante to draw the line to
[ "Add", "a", "line", "to", "the", "contour", "or", "hole", "which", "ends", "at", "the", "specified", "location", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Path.java#L56-L65
apache/incubator-gobblin
gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigResourceLocalHandler.java
FlowConfigResourceLocalHandler.createFlowSpecForConfig
public static FlowSpec createFlowSpecForConfig(FlowConfig flowConfig) { ConfigBuilder configBuilder = ConfigBuilder.create() .addPrimitive(ConfigurationKeys.FLOW_GROUP_KEY, flowConfig.getId().getFlowGroup()) .addPrimitive(ConfigurationKeys.FLOW_NAME_KEY, flowConfig.getId().getFlowName()); if (flowConfig.hasSchedule()) { Schedule schedule = flowConfig.getSchedule(); configBuilder.addPrimitive(ConfigurationKeys.JOB_SCHEDULE_KEY, schedule.getCronSchedule()); configBuilder.addPrimitive(ConfigurationKeys.FLOW_RUN_IMMEDIATELY, schedule.isRunImmediately()); } else { // If the job does not have schedule, it is a run-once job. // In this case, we add flow execution id to the flow spec now to be able to send this id back to the user for // flow status tracking purpose. // If it is not a run-once job, we should not add flow execution id here, // because execution id is generated for every scheduled execution of the flow and cannot be materialized to // the flow catalog. In this case, this id is added during flow compilation. configBuilder.addPrimitive(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, String.valueOf(System.currentTimeMillis())); } if (flowConfig.hasExplain()) { configBuilder.addPrimitive(ConfigurationKeys.FLOW_EXPLAIN_KEY, flowConfig.isExplain()); } Config config = configBuilder.build(); Config configWithFallback; //We first attempt to process the REST.li request as a HOCON string. If the request is not a valid HOCON string // (e.g. when certain special characters such as ":" or "*" are not properly escaped), we catch the Typesafe ConfigException and // fallback to assuming that values are literal strings. try { // We first convert the StringMap object to a String object and then use ConfigFactory#parseString() to parse the // HOCON string. configWithFallback = config.withFallback(ConfigFactory.parseString(flowConfig.getProperties().toString()).resolve()); } catch (Exception e) { configWithFallback = config.withFallback(ConfigFactory.parseMap(flowConfig.getProperties())); } try { URI templateURI = new URI(flowConfig.getTemplateUris()); return FlowSpec.builder().withConfig(configWithFallback).withTemplate(templateURI).build(); } catch (URISyntaxException e) { throw new FlowConfigLoggedException(HttpStatus.S_400_BAD_REQUEST, "bad URI " + flowConfig.getTemplateUris(), e); } }
java
public static FlowSpec createFlowSpecForConfig(FlowConfig flowConfig) { ConfigBuilder configBuilder = ConfigBuilder.create() .addPrimitive(ConfigurationKeys.FLOW_GROUP_KEY, flowConfig.getId().getFlowGroup()) .addPrimitive(ConfigurationKeys.FLOW_NAME_KEY, flowConfig.getId().getFlowName()); if (flowConfig.hasSchedule()) { Schedule schedule = flowConfig.getSchedule(); configBuilder.addPrimitive(ConfigurationKeys.JOB_SCHEDULE_KEY, schedule.getCronSchedule()); configBuilder.addPrimitive(ConfigurationKeys.FLOW_RUN_IMMEDIATELY, schedule.isRunImmediately()); } else { // If the job does not have schedule, it is a run-once job. // In this case, we add flow execution id to the flow spec now to be able to send this id back to the user for // flow status tracking purpose. // If it is not a run-once job, we should not add flow execution id here, // because execution id is generated for every scheduled execution of the flow and cannot be materialized to // the flow catalog. In this case, this id is added during flow compilation. configBuilder.addPrimitive(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, String.valueOf(System.currentTimeMillis())); } if (flowConfig.hasExplain()) { configBuilder.addPrimitive(ConfigurationKeys.FLOW_EXPLAIN_KEY, flowConfig.isExplain()); } Config config = configBuilder.build(); Config configWithFallback; //We first attempt to process the REST.li request as a HOCON string. If the request is not a valid HOCON string // (e.g. when certain special characters such as ":" or "*" are not properly escaped), we catch the Typesafe ConfigException and // fallback to assuming that values are literal strings. try { // We first convert the StringMap object to a String object and then use ConfigFactory#parseString() to parse the // HOCON string. configWithFallback = config.withFallback(ConfigFactory.parseString(flowConfig.getProperties().toString()).resolve()); } catch (Exception e) { configWithFallback = config.withFallback(ConfigFactory.parseMap(flowConfig.getProperties())); } try { URI templateURI = new URI(flowConfig.getTemplateUris()); return FlowSpec.builder().withConfig(configWithFallback).withTemplate(templateURI).build(); } catch (URISyntaxException e) { throw new FlowConfigLoggedException(HttpStatus.S_400_BAD_REQUEST, "bad URI " + flowConfig.getTemplateUris(), e); } }
[ "public", "static", "FlowSpec", "createFlowSpecForConfig", "(", "FlowConfig", "flowConfig", ")", "{", "ConfigBuilder", "configBuilder", "=", "ConfigBuilder", ".", "create", "(", ")", ".", "addPrimitive", "(", "ConfigurationKeys", ".", "FLOW_GROUP_KEY", ",", "flowConfi...
Build a {@link FlowSpec} from a {@link FlowConfig} @param flowConfig flow configuration @return {@link FlowSpec} created with attributes from flowConfig
[ "Build", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigResourceLocalHandler.java#L197-L240
fozziethebeat/S-Space
hadoop/src/main/java/edu/ucla/sspace/ri/HadoopRandomIndexing.java
HadoopRandomIndexing.setWordToIndexVector
public void setWordToIndexVector(Map<String,TernaryVector> m) { wordToIndexVector.clear(); wordToIndexVector.putAll(m); }
java
public void setWordToIndexVector(Map<String,TernaryVector> m) { wordToIndexVector.clear(); wordToIndexVector.putAll(m); }
[ "public", "void", "setWordToIndexVector", "(", "Map", "<", "String", ",", "TernaryVector", ">", "m", ")", "{", "wordToIndexVector", ".", "clear", "(", ")", ";", "wordToIndexVector", ".", "putAll", "(", "m", ")", ";", "}" ]
Assigns the token to {@link IntegerVector} mapping to be used by this instance. The contents of the map are copied, so any additions of new index words by this instance will not be reflected in the parameter's mapping. @param m a mapping from token to the {@code IntegerVector} that should be used represent it when calculating other word's semantics
[ "Assigns", "the", "token", "to", "{", "@link", "IntegerVector", "}", "mapping", "to", "be", "used", "by", "this", "instance", ".", "The", "contents", "of", "the", "map", "are", "copied", "so", "any", "additions", "of", "new", "index", "words", "by", "thi...
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/hadoop/src/main/java/edu/ucla/sspace/ri/HadoopRandomIndexing.java#L410-L413
konvergeio/cofoja
src/main/java/com/google/java/contract/core/util/Elements.java
Elements.getUriForClass
@Requires({ "name != null", "!name.isEmpty()", "kind != null" }) public static URI getUriForClass(String name, Kind kind) { try { return new URI("com.google.java.contract://com.google.java.contract/" + name + kind.extension); } catch (URISyntaxException e) { throw new IllegalArgumentException(); } }
java
@Requires({ "name != null", "!name.isEmpty()", "kind != null" }) public static URI getUriForClass(String name, Kind kind) { try { return new URI("com.google.java.contract://com.google.java.contract/" + name + kind.extension); } catch (URISyntaxException e) { throw new IllegalArgumentException(); } }
[ "@", "Requires", "(", "{", "\"name != null\"", ",", "\"!name.isEmpty()\"", ",", "\"kind != null\"", "}", ")", "public", "static", "URI", "getUriForClass", "(", "String", "name", ",", "Kind", "kind", ")", "{", "try", "{", "return", "new", "URI", "(", "\"com.g...
Returns a Contracts for Java private URI for the specified class name and kind.
[ "Returns", "a", "Contracts", "for", "Java", "private", "URI", "for", "the", "specified", "class", "name", "and", "kind", "." ]
train
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/util/Elements.java#L119-L130
fuinorg/srcgen4javassist
src/main/java/org/fuin/srcgen4javassist/ByteCodeGenerator.java
ByteCodeGenerator.createInstance
@SuppressWarnings("unchecked") public final Object createInstance(final SgClass clasz) { final Class newClass = createClass(clasz); return createInstance(newClass, new Class[] {}, new Object[] {}); }
java
@SuppressWarnings("unchecked") public final Object createInstance(final SgClass clasz) { final Class newClass = createClass(clasz); return createInstance(newClass, new Class[] {}, new Object[] {}); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "Object", "createInstance", "(", "final", "SgClass", "clasz", ")", "{", "final", "Class", "newClass", "=", "createClass", "(", "clasz", ")", ";", "return", "createInstance", "(", "newClass", ...
Creates an instance from a model class with it's no argument constructor and maps all exceptions into <code>RuntimeException</code>. @param clasz Class to create an instance for. @return New instance.
[ "Creates", "an", "instance", "from", "a", "model", "class", "with", "it", "s", "no", "argument", "constructor", "and", "maps", "all", "exceptions", "into", "<code", ">", "RuntimeException<", "/", "code", ">", "." ]
train
https://github.com/fuinorg/srcgen4javassist/blob/355828113cfce3cdd3d69ba242c5bdfc7d899f2f/src/main/java/org/fuin/srcgen4javassist/ByteCodeGenerator.java#L337-L343
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java
JFXTreeTableView.unGroup
public void unGroup(TreeTableColumn<S, ?>... treeTableColumns) { try { lock.lock(); if (groupOrder.size() > 0) { groupOrder.removeAll(treeTableColumns); List<TreeTableColumn<S, ?>> grouped = new ArrayList<>(); grouped.addAll(groupOrder); groupOrder.clear(); JFXUtilities.runInFXAndWait(() -> { ArrayList<TreeTableColumn<S, ?>> sortOrder = new ArrayList<>(); sortOrder.addAll(getSortOrder()); // needs to reset the children in order to update the parent List children = Arrays.asList(originalRoot.getChildren().toArray()); originalRoot.getChildren().clear(); originalRoot.getChildren().setAll(children); // reset the original root internalSetRoot = true; setRoot(originalRoot); internalSetRoot = false; getSelectionModel().select(0); getSortOrder().addAll(sortOrder); if (grouped.size() != 0) { refreshGroups(grouped); } }); } } finally { lock.unlock(); } }
java
public void unGroup(TreeTableColumn<S, ?>... treeTableColumns) { try { lock.lock(); if (groupOrder.size() > 0) { groupOrder.removeAll(treeTableColumns); List<TreeTableColumn<S, ?>> grouped = new ArrayList<>(); grouped.addAll(groupOrder); groupOrder.clear(); JFXUtilities.runInFXAndWait(() -> { ArrayList<TreeTableColumn<S, ?>> sortOrder = new ArrayList<>(); sortOrder.addAll(getSortOrder()); // needs to reset the children in order to update the parent List children = Arrays.asList(originalRoot.getChildren().toArray()); originalRoot.getChildren().clear(); originalRoot.getChildren().setAll(children); // reset the original root internalSetRoot = true; setRoot(originalRoot); internalSetRoot = false; getSelectionModel().select(0); getSortOrder().addAll(sortOrder); if (grouped.size() != 0) { refreshGroups(grouped); } }); } } finally { lock.unlock(); } }
[ "public", "void", "unGroup", "(", "TreeTableColumn", "<", "S", ",", "?", ">", "...", "treeTableColumns", ")", "{", "try", "{", "lock", ".", "lock", "(", ")", ";", "if", "(", "groupOrder", ".", "size", "(", ")", ">", "0", ")", "{", "groupOrder", "."...
this is a blocking method so it should not be called from the ui thread, it will ungroup the tree table view @param treeTableColumns
[ "this", "is", "a", "blocking", "method", "so", "it", "should", "not", "be", "called", "from", "the", "ui", "thread", "it", "will", "ungroup", "the", "tree", "table", "view" ]
train
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java#L246-L275
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/ElementSelectors.java
ElementSelectors.byXPath
public static ElementSelector byXPath(String xpath, ElementSelector childSelector) { return byXPath(xpath, null, childSelector); }
java
public static ElementSelector byXPath(String xpath, ElementSelector childSelector) { return byXPath(xpath, null, childSelector); }
[ "public", "static", "ElementSelector", "byXPath", "(", "String", "xpath", ",", "ElementSelector", "childSelector", ")", "{", "return", "byXPath", "(", "xpath", ",", "null", ",", "childSelector", ")", ";", "}" ]
Selects two elements as matching if the child elements selected via XPath match using the given childSelector. <p>The xpath expression should yield elements. Two elements match if a DefaultNodeMatcher applied to the selected children finds matching pairs for all children.</p> @param xpath XPath expression applied in the context of the elements to chose from that selects the children to compare. @param childSelector ElementSelector to apply to the selected children.
[ "Selects", "two", "elements", "as", "matching", "if", "the", "child", "elements", "selected", "via", "XPath", "match", "using", "the", "given", "childSelector", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/ElementSelectors.java#L381-L383
jenkinsci/jenkins
core/src/main/java/hudson/FilePath.java
FilePath.act
public <V,E extends Throwable> V act(Callable<V,E> callable) throws IOException, InterruptedException, E { if(channel!=null) { // run this on a remote system return channel.call(callable); } else { // the file is on the local machine return callable.call(); } }
java
public <V,E extends Throwable> V act(Callable<V,E> callable) throws IOException, InterruptedException, E { if(channel!=null) { // run this on a remote system return channel.call(callable); } else { // the file is on the local machine return callable.call(); } }
[ "public", "<", "V", ",", "E", "extends", "Throwable", ">", "V", "act", "(", "Callable", "<", "V", ",", "E", ">", "callable", ")", "throws", "IOException", ",", "InterruptedException", ",", "E", "{", "if", "(", "channel", "!=", "null", ")", "{", "// r...
Executes some program on the machine that this {@link FilePath} exists, so that one can perform local file operations.
[ "Executes", "some", "program", "on", "the", "machine", "that", "this", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L1156-L1164
aws/aws-sdk-java
aws-java-sdk-iot1clickdevices/src/main/java/com/amazonaws/services/iot1clickdevices/model/DeviceDescription.java
DeviceDescription.withAttributes
public DeviceDescription withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
java
public DeviceDescription withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
[ "public", "DeviceDescription", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
<p> An array of zero or more elements of DeviceAttribute objects providing user specified device attributes. </p> @param attributes An array of zero or more elements of DeviceAttribute objects providing user specified device attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "An", "array", "of", "zero", "or", "more", "elements", "of", "DeviceAttribute", "objects", "providing", "user", "specified", "device", "attributes", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickdevices/src/main/java/com/amazonaws/services/iot1clickdevices/model/DeviceDescription.java#L146-L149
lets-blade/blade
src/main/java/com/blade/kit/ReflectKit.java
ReflectKit.hasInterface
public static boolean hasInterface(Class<?> cls, Class<?> inter) { return Stream.of(cls.getInterfaces()).anyMatch(c -> c.equals(inter)); }
java
public static boolean hasInterface(Class<?> cls, Class<?> inter) { return Stream.of(cls.getInterfaces()).anyMatch(c -> c.equals(inter)); }
[ "public", "static", "boolean", "hasInterface", "(", "Class", "<", "?", ">", "cls", ",", "Class", "<", "?", ">", "inter", ")", "{", "return", "Stream", ".", "of", "(", "cls", ".", "getInterfaces", "(", ")", ")", ".", "anyMatch", "(", "c", "->", "c",...
Determine whether CLS is an implementation of an inteface Type. @param cls @param inter @return
[ "Determine", "whether", "CLS", "is", "an", "implementation", "of", "an", "inteface", "Type", "." ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L230-L232
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.cut
public static void cut(Image srcImage, File destFile, Rectangle rectangle) throws IORuntimeException { write(cut(srcImage, rectangle), destFile); }
java
public static void cut(Image srcImage, File destFile, Rectangle rectangle) throws IORuntimeException { write(cut(srcImage, rectangle), destFile); }
[ "public", "static", "void", "cut", "(", "Image", "srcImage", ",", "File", "destFile", ",", "Rectangle", "rectangle", ")", "throws", "IORuntimeException", "{", "write", "(", "cut", "(", "srcImage", ",", "rectangle", ")", ",", "destFile", ")", ";", "}" ]
图像切割(按指定起点坐标和宽高切割),此方法并不关闭流 @param srcImage 源图像 @param destFile 输出的文件 @param rectangle 矩形对象,表示矩形区域的x,y,width,height @since 3.2.2 @throws IORuntimeException IO异常
[ "图像切割", "(", "按指定起点坐标和宽高切割", ")", ",此方法并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L293-L295
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java
Resources.getBoolean
public boolean getBoolean( String key, boolean defaultValue ) throws MissingResourceException { try { return getBoolean( key ); } catch( MissingResourceException mre ) { return defaultValue; } }
java
public boolean getBoolean( String key, boolean defaultValue ) throws MissingResourceException { try { return getBoolean( key ); } catch( MissingResourceException mre ) { return defaultValue; } }
[ "public", "boolean", "getBoolean", "(", "String", "key", ",", "boolean", "defaultValue", ")", "throws", "MissingResourceException", "{", "try", "{", "return", "getBoolean", "(", "key", ")", ";", "}", "catch", "(", "MissingResourceException", "mre", ")", "{", "...
Retrieve a boolean from bundle. @param key the key of resource @param defaultValue the default value if key is missing @return the resource boolean @throws MissingResourceException if the requested key is unknown
[ "Retrieve", "a", "boolean", "from", "bundle", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L136-L147
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java
Organizer.addAll
public static void addAll(Collection<Object> list, Object[] objects) { list.addAll(Arrays.asList(objects)); }
java
public static void addAll(Collection<Object> list, Object[] objects) { list.addAll(Arrays.asList(objects)); }
[ "public", "static", "void", "addAll", "(", "Collection", "<", "Object", ">", "list", ",", "Object", "[", "]", "objects", ")", "{", "list", ".", "addAll", "(", "Arrays", ".", "asList", "(", "objects", ")", ")", ";", "}" ]
Add object to a list @param list where objects will be added @param objects the object add
[ "Add", "object", "to", "a", "list" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java#L525-L528
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/MultiPartContentProvider.java
MultiPartContentProvider.addFieldPart
public void addFieldPart(String name, ContentProvider content, HttpFields fields) { addPart(new Part(name, null, "text/plain", content, fields)); }
java
public void addFieldPart(String name, ContentProvider content, HttpFields fields) { addPart(new Part(name, null, "text/plain", content, fields)); }
[ "public", "void", "addFieldPart", "(", "String", "name", ",", "ContentProvider", "content", ",", "HttpFields", "fields", ")", "{", "addPart", "(", "new", "Part", "(", "name", ",", "null", ",", "\"text/plain\"", ",", "content", ",", "fields", ")", ")", ";",...
<p>Adds a field part with the given {@code name} as field name, and the given {@code content} as part content.</p> @param name the part name @param content the part content @param fields the headers associated with this part
[ "<p", ">", "Adds", "a", "field", "part", "with", "the", "given", "{", "@code", "name", "}", "as", "field", "name", "and", "the", "given", "{", "@code", "content", "}", "as", "part", "content", ".", "<", "/", "p", ">" ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/MultiPartContentProvider.java#L70-L72
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/replace/CmsReplaceDialog.java
CmsReplaceDialog.startLoadingAnimation
private void startLoadingAnimation(final String msg, int delayMillis) { m_loadingTimer = new Timer() { @Override public void run() { m_mainPanel.showLoadingAnimation(msg); } }; if (delayMillis > 0) { m_loadingTimer.schedule(delayMillis); } else { m_loadingTimer.run(); } }
java
private void startLoadingAnimation(final String msg, int delayMillis) { m_loadingTimer = new Timer() { @Override public void run() { m_mainPanel.showLoadingAnimation(msg); } }; if (delayMillis > 0) { m_loadingTimer.schedule(delayMillis); } else { m_loadingTimer.run(); } }
[ "private", "void", "startLoadingAnimation", "(", "final", "String", "msg", ",", "int", "delayMillis", ")", "{", "m_loadingTimer", "=", "new", "Timer", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "m_mainPanel", ".", "showLoadingAni...
Starts the loading animation.<p> Used while client is loading files from hard disk into memory.<p> @param msg the message that should be displayed below the loading animation (can also be HTML as String) @param delayMillis the delay to start the animation with
[ "Starts", "the", "loading", "animation", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/replace/CmsReplaceDialog.java#L638-L653
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitRelation.java
IntBitRelation.addRightWhere
public void addRightWhere(int left, IntBitSet result) { if (line[left] != null) { result.addAll(line[left]); } }
java
public void addRightWhere(int left, IntBitSet result) { if (line[left] != null) { result.addAll(line[left]); } }
[ "public", "void", "addRightWhere", "(", "int", "left", ",", "IntBitSet", "result", ")", "{", "if", "(", "line", "[", "left", "]", "!=", "null", ")", "{", "result", ".", "addAll", "(", "line", "[", "left", "]", ")", ";", "}", "}" ]
Returns all right values from the relation that have the left value specified. @param left left value required @param result where to return the result
[ "Returns", "all", "right", "values", "from", "the", "relation", "that", "have", "the", "left", "value", "specified", "." ]
train
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L112-L116
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraValidationClassMapper.java
CassandraValidationClassMapper.getValueTypeName
public static String getValueTypeName(Class<?> dataType, List<Class<?>> genericClasses, boolean isCql3Enabled) throws SyntaxException, ConfigurationException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { String valueType; Class<?> validation_class = getValidationClassInstance(dataType, isCql3Enabled); valueType = validation_class.toString(); if (validation_class.equals(ListType.class)) { TypeParser parser = new TypeParser(getValidationClass(genericClasses.get(0), isCql3Enabled)); valueType = ListType.getInstance(parser.parse(), true).toString(); } else if (validation_class.equals(SetType.class)) { TypeParser parser = new TypeParser(getValidationClass(genericClasses.get(0), isCql3Enabled)); valueType = SetType.getInstance(parser.parse(), true).toString(); } else if (validation_class.equals(MapType.class)) { Class keyClass = CassandraValidationClassMapper.getValidationClassInstance(genericClasses.get(0), true); Class valueClass = CassandraValidationClassMapper.getValidationClassInstance(genericClasses.get(1), true); Object keyClassInstance = keyClass.getDeclaredField("instance").get(null); Object valueClassInstance = valueClass.getDeclaredField("instance").get(null); valueType = MapType.getInstance((AbstractType) keyClassInstance, (AbstractType) valueClassInstance, true) .toString(); // TypeParser keyParser = new // TypeParser(getValidationClass(genericClasses.get(0), // isCql3Enabled)); // TypeParser valueParser = new // TypeParser(getValidationClass(genericClasses.get(1), // isCql3Enabled)); // valueType = MapType.getInstance(keyParser, // valueParser).toString(); } return valueType; }
java
public static String getValueTypeName(Class<?> dataType, List<Class<?>> genericClasses, boolean isCql3Enabled) throws SyntaxException, ConfigurationException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { String valueType; Class<?> validation_class = getValidationClassInstance(dataType, isCql3Enabled); valueType = validation_class.toString(); if (validation_class.equals(ListType.class)) { TypeParser parser = new TypeParser(getValidationClass(genericClasses.get(0), isCql3Enabled)); valueType = ListType.getInstance(parser.parse(), true).toString(); } else if (validation_class.equals(SetType.class)) { TypeParser parser = new TypeParser(getValidationClass(genericClasses.get(0), isCql3Enabled)); valueType = SetType.getInstance(parser.parse(), true).toString(); } else if (validation_class.equals(MapType.class)) { Class keyClass = CassandraValidationClassMapper.getValidationClassInstance(genericClasses.get(0), true); Class valueClass = CassandraValidationClassMapper.getValidationClassInstance(genericClasses.get(1), true); Object keyClassInstance = keyClass.getDeclaredField("instance").get(null); Object valueClassInstance = valueClass.getDeclaredField("instance").get(null); valueType = MapType.getInstance((AbstractType) keyClassInstance, (AbstractType) valueClassInstance, true) .toString(); // TypeParser keyParser = new // TypeParser(getValidationClass(genericClasses.get(0), // isCql3Enabled)); // TypeParser valueParser = new // TypeParser(getValidationClass(genericClasses.get(1), // isCql3Enabled)); // valueType = MapType.getInstance(keyParser, // valueParser).toString(); } return valueType; }
[ "public", "static", "String", "getValueTypeName", "(", "Class", "<", "?", ">", "dataType", ",", "List", "<", "Class", "<", "?", ">", ">", "genericClasses", ",", "boolean", "isCql3Enabled", ")", "throws", "SyntaxException", ",", "ConfigurationException", ",", "...
Gets the value type name. @param dataType the data type @param genericClasses the generic classes @param isCql3Enabled the is cql3 enabled @return the value type name @throws SyntaxException the syntax exception @throws ConfigurationException the configuration exception @throws IllegalArgumentException the illegal argument exception @throws IllegalAccessException the illegal access exception @throws NoSuchFieldException the no such field exception @throws SecurityException the security exception
[ "Gets", "the", "value", "type", "name", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraValidationClassMapper.java#L264-L303
EMCECS/nfs-client-java
src/main/java/com/emc/ecs/nfsclient/nfs/io/LinkTracker.java
LinkTracker.addResolvedPath
synchronized void addResolvedPath(String path, F file) { _resolvedPaths.put(path, file); _unresolvedPaths.remove(path); }
java
synchronized void addResolvedPath(String path, F file) { _resolvedPaths.put(path, file); _unresolvedPaths.remove(path); }
[ "synchronized", "void", "addResolvedPath", "(", "String", "path", ",", "F", "file", ")", "{", "_resolvedPaths", ".", "put", "(", "path", ",", "file", ")", ";", "_unresolvedPaths", ".", "remove", "(", "path", ")", ";", "}" ]
After each link is completely resolved, the linkTracker caller should call this method to store that resolved path so that it can be resolved directly the next time is is seen. @param path The path to the original symbolic link. @param file The file to which that link was finally resolved.
[ "After", "each", "link", "is", "completely", "resolved", "the", "linkTracker", "caller", "should", "call", "this", "method", "to", "store", "that", "resolved", "path", "so", "that", "it", "can", "be", "resolved", "directly", "the", "next", "time", "is", "is"...
train
https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/nfs/io/LinkTracker.java#L95-L98
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java
JobHistoryService.getJobByJobID
public JobDetails getJobByJobID(String cluster, String jobId) throws IOException { return getJobByJobID(cluster, jobId, false); }
java
public JobDetails getJobByJobID(String cluster, String jobId) throws IOException { return getJobByJobID(cluster, jobId, false); }
[ "public", "JobDetails", "getJobByJobID", "(", "String", "cluster", ",", "String", "jobId", ")", "throws", "IOException", "{", "return", "getJobByJobID", "(", "cluster", ",", "jobId", ",", "false", ")", ";", "}" ]
Returns a specific job's data by job ID. This version does not populate the job's task data. @param cluster the cluster identifier @param cluster the job ID
[ "Returns", "a", "specific", "job", "s", "data", "by", "job", "ID", ".", "This", "version", "does", "not", "populate", "the", "job", "s", "task", "data", "." ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java#L401-L404