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
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java
ReplicationLinksInner.beginFailoverAllowDataLoss
public void beginFailoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); }
java
public void beginFailoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().single().body(); }
[ "public", "void", "beginFailoverAllowDataLoss", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "linkId", ")", "{", "beginFailoverAllowDataLossWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverNam...
Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Sets", "which", "replica", "database", "is", "primary", "by", "failing", "over", "from", "the", "current", "primary", "replica", "database", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java#L562-L564
landawn/AbacusUtil
src/com/landawn/abacus/util/Primitives.java
Primitives.unbox
public static short[] unbox(final Short[] a, final short valueForNull) { if (a == null) { return null; } return unbox(a, 0, a.length, valueForNull); }
java
public static short[] unbox(final Short[] a, final short valueForNull) { if (a == null) { return null; } return unbox(a, 0, a.length, valueForNull); }
[ "public", "static", "short", "[", "]", "unbox", "(", "final", "Short", "[", "]", "a", ",", "final", "short", "valueForNull", ")", "{", "if", "(", "a", "==", "null", ")", "{", "return", "null", ";", "}", "return", "unbox", "(", "a", ",", "0", ",",...
<p> Converts an array of object Short to primitives handling {@code null}. </p> <p> This method returns {@code null} for a {@code null} input array. </p> @param a a {@code Short} array, may be {@code null} @param valueForNull the value to insert if {@code null} found @return a {@code byte} array, {@code null} if null array input
[ "<p", ">", "Converts", "an", "array", "of", "object", "Short", "to", "primitives", "handling", "{", "@code", "null", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Primitives.java#L960-L966
milaboratory/milib
src/main/java/com/milaboratory/core/alignment/Alignment.java
Alignment.convertToSeq1Range
public Range convertToSeq1Range(Range rangeInSeq2) { int from = aabs(convertToSeq1Position(rangeInSeq2.getFrom())); int to = aabs(convertToSeq1Position(rangeInSeq2.getTo())); if (from == -1 || to == -1) return null; return new Range(from, to); }
java
public Range convertToSeq1Range(Range rangeInSeq2) { int from = aabs(convertToSeq1Position(rangeInSeq2.getFrom())); int to = aabs(convertToSeq1Position(rangeInSeq2.getTo())); if (from == -1 || to == -1) return null; return new Range(from, to); }
[ "public", "Range", "convertToSeq1Range", "(", "Range", "rangeInSeq2", ")", "{", "int", "from", "=", "aabs", "(", "convertToSeq1Position", "(", "rangeInSeq2", ".", "getFrom", "(", ")", ")", ")", ";", "int", "to", "=", "aabs", "(", "convertToSeq1Position", "("...
Converts range in sequence2 to range in sequence1, or returns null if input range is not fully covered by alignment @param rangeInSeq2 range in sequence 2 @return range in sequence1 or null if rangeInSeq2 is not fully covered by alignment
[ "Converts", "range", "in", "sequence2", "to", "range", "in", "sequence1", "or", "returns", "null", "if", "input", "range", "is", "not", "fully", "covered", "by", "alignment" ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/alignment/Alignment.java#L231-L239
Stratio/bdt
src/main/java/com/stratio/qa/specs/SeleniumSpec.java
SeleniumSpec.seleniumIdFrame
@Given("^I switch to iframe with '([^:]*?):(.+?)'$") public void seleniumIdFrame(String method, String idframe) throws IllegalAccessException, NoSuchFieldException, ClassNotFoundException { assertThat(commonspec.locateElement(method, idframe, 1)); if (method.equals("id") || method.equals("name")) { commonspec.getDriver().switchTo().frame(idframe); } else { throw new ClassNotFoundException("Can not use this method to switch iframe"); } }
java
@Given("^I switch to iframe with '([^:]*?):(.+?)'$") public void seleniumIdFrame(String method, String idframe) throws IllegalAccessException, NoSuchFieldException, ClassNotFoundException { assertThat(commonspec.locateElement(method, idframe, 1)); if (method.equals("id") || method.equals("name")) { commonspec.getDriver().switchTo().frame(idframe); } else { throw new ClassNotFoundException("Can not use this method to switch iframe"); } }
[ "@", "Given", "(", "\"^I switch to iframe with '([^:]*?):(.+?)'$\"", ")", "public", "void", "seleniumIdFrame", "(", "String", "method", ",", "String", "idframe", ")", "throws", "IllegalAccessException", ",", "NoSuchFieldException", ",", "ClassNotFoundException", "{", "ass...
Swith to the iFrame where id matches idframe @param idframe iframe to swith to @throws IllegalAccessException exception @throws NoSuchFieldException exception @throws ClassNotFoundException exception
[ "Swith", "to", "the", "iFrame", "where", "id", "matches", "idframe" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L132-L141
zerodhatech/javakiteconnect
kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java
KiteConnect.convertPosition
public JSONObject convertPosition(String tradingSymbol, String exchange, String transactionType, String positionType, String oldProduct, String newProduct, int quantity) throws KiteException, JSONException, IOException { Map<String, Object> params = new HashMap<>(); params.put("tradingsymbol", tradingSymbol); params.put("exchange", exchange); params.put("transaction_type", transactionType); params.put("position_type", positionType); params.put("old_product", oldProduct); params.put("new_product", newProduct); params.put("quantity", quantity); KiteRequestHandler kiteRequestHandler = new KiteRequestHandler(proxy); return kiteRequestHandler.putRequest(routes.get("portfolio.positions.modify"), params, apiKey, accessToken); }
java
public JSONObject convertPosition(String tradingSymbol, String exchange, String transactionType, String positionType, String oldProduct, String newProduct, int quantity) throws KiteException, JSONException, IOException { Map<String, Object> params = new HashMap<>(); params.put("tradingsymbol", tradingSymbol); params.put("exchange", exchange); params.put("transaction_type", transactionType); params.put("position_type", positionType); params.put("old_product", oldProduct); params.put("new_product", newProduct); params.put("quantity", quantity); KiteRequestHandler kiteRequestHandler = new KiteRequestHandler(proxy); return kiteRequestHandler.putRequest(routes.get("portfolio.positions.modify"), params, apiKey, accessToken); }
[ "public", "JSONObject", "convertPosition", "(", "String", "tradingSymbol", ",", "String", "exchange", ",", "String", "transactionType", ",", "String", "positionType", ",", "String", "oldProduct", ",", "String", "newProduct", ",", "int", "quantity", ")", "throws", ...
Modifies an open position's product type. Only an MIS, CNC, and NRML positions can be converted. @param tradingSymbol Tradingsymbol of the instrument (ex. RELIANCE, INFY). @param exchange Exchange in which instrument is listed (NSE, BSE, NFO, BFO, CDS, MCX). @param transactionType Transaction type (BUY or SELL). @param positionType day or overnight position @param oldProduct Product code (NRML, MIS, CNC). @param newProduct Product code (NRML, MIS, CNC). @param quantity Order quantity @return JSONObject which will have status. @throws KiteException is thrown for all Kite trade related errors. @throws JSONException is thrown when there is exception while parsing response. @throws IOException is thrown when there is connection error.
[ "Modifies", "an", "open", "position", "s", "product", "type", ".", "Only", "an", "MIS", "CNC", "and", "NRML", "positions", "can", "be", "converted", "." ]
train
https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java#L458-L470
Azure/azure-sdk-for-java
sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsInner.java
ServerVulnerabilityAssessmentsInner.getAsync
public Observable<ServerVulnerabilityAssessmentInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerVulnerabilityAssessmentInner>, ServerVulnerabilityAssessmentInner>() { @Override public ServerVulnerabilityAssessmentInner call(ServiceResponse<ServerVulnerabilityAssessmentInner> response) { return response.body(); } }); }
java
public Observable<ServerVulnerabilityAssessmentInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerVulnerabilityAssessmentInner>, ServerVulnerabilityAssessmentInner>() { @Override public ServerVulnerabilityAssessmentInner call(ServiceResponse<ServerVulnerabilityAssessmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerVulnerabilityAssessmentInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "...
Gets the server's vulnerability assessment. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server for which the vulnerability assessment is defined. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerVulnerabilityAssessmentInner object
[ "Gets", "the", "server", "s", "vulnerability", "assessment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ServerVulnerabilityAssessmentsInner.java#L122-L129
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java
ST_AsGeoJSON.toGeojsonCoordinates
public static void toGeojsonCoordinates(Coordinate[] coords, StringBuilder sb) { sb.append("["); for (int i = 0; i < coords.length; i++) { toGeojsonCoordinate(coords[i], sb); if (i < coords.length - 1) { sb.append(","); } } sb.append("]"); }
java
public static void toGeojsonCoordinates(Coordinate[] coords, StringBuilder sb) { sb.append("["); for (int i = 0; i < coords.length; i++) { toGeojsonCoordinate(coords[i], sb); if (i < coords.length - 1) { sb.append(","); } } sb.append("]"); }
[ "public", "static", "void", "toGeojsonCoordinates", "(", "Coordinate", "[", "]", "coords", ",", "StringBuilder", "sb", ")", "{", "sb", ".", "append", "(", "\"[\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "coords", ".", "length", ";...
Convert a jts array of coordinates to a GeoJSON coordinates representation. Syntax: [[X1,Y1],[X2,Y2]] @param coords @param sb
[ "Convert", "a", "jts", "array", "of", "coordinates", "to", "a", "GeoJSON", "coordinates", "representation", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/ST_AsGeoJSON.java#L285-L294
albfernandez/itext2
src/main/java/com/lowagie/text/Table.java
Table.addCell
public void addCell(String content, Point location) throws BadElementException { addCell(new Phrase(content), location); }
java
public void addCell(String content, Point location) throws BadElementException { addCell(new Phrase(content), location); }
[ "public", "void", "addCell", "(", "String", "content", ",", "Point", "location", ")", "throws", "BadElementException", "{", "addCell", "(", "new", "Phrase", "(", "content", ")", ",", "location", ")", ";", "}" ]
Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE>. <P> This is a shortcut for <CODE>addCell(Cell cell, Point location)</CODE>. The <CODE>String</CODE> will be converted to a <CODE>Cell</CODE>. @param content a <CODE>String</CODE> @param location a <CODE>Point</CODE> @throws BadElementException this should never happen
[ "Adds", "a", "<CODE", ">", "Cell<", "/", "CODE", ">", "to", "the", "<CODE", ">", "Table<", "/", "CODE", ">", ".", "<P", ">", "This", "is", "a", "shortcut", "for", "<CODE", ">", "addCell", "(", "Cell", "cell", "Point", "location", ")", "<", "/", "...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Table.java#L785-L787
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/message/netty/StormClientHandler.java
StormClientHandler.channelConnected
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent event) { // register the newly established channel Channel channel = event.getChannel(); LOG.info("connection established to :{}, local port:{}", client.getRemoteAddr(), channel.getLocalAddress()); client.connectChannel(ctx.getChannel()); client.handleResponse(ctx.getChannel(), null); }
java
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent event) { // register the newly established channel Channel channel = event.getChannel(); LOG.info("connection established to :{}, local port:{}", client.getRemoteAddr(), channel.getLocalAddress()); client.connectChannel(ctx.getChannel()); client.handleResponse(ctx.getChannel(), null); }
[ "@", "Override", "public", "void", "channelConnected", "(", "ChannelHandlerContext", "ctx", ",", "ChannelStateEvent", "event", ")", "{", "// register the newly established channel", "Channel", "channel", "=", "event", ".", "getChannel", "(", ")", ";", "LOG", ".", "i...
Sometime when connecting to a bad channel which isn't writable, this method will be called
[ "Sometime", "when", "connecting", "to", "a", "bad", "channel", "which", "isn", "t", "writable", "this", "method", "will", "be", "called" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/message/netty/StormClientHandler.java#L53-L61
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/BeanUtil.java
BeanUtil.getGetterMethod
public static Method getGetterMethod(Class<?> beanClass, String property){ try{ return beanClass.getMethod(GET+getMethodSuffix(property)); }catch(NoSuchMethodException ex1){ try{ return beanClass.getMethod(IS+getMethodSuffix(property)); }catch(NoSuchMethodException ex2){ return null; } } }
java
public static Method getGetterMethod(Class<?> beanClass, String property){ try{ return beanClass.getMethod(GET+getMethodSuffix(property)); }catch(NoSuchMethodException ex1){ try{ return beanClass.getMethod(IS+getMethodSuffix(property)); }catch(NoSuchMethodException ex2){ return null; } } }
[ "public", "static", "Method", "getGetterMethod", "(", "Class", "<", "?", ">", "beanClass", ",", "String", "property", ")", "{", "try", "{", "return", "beanClass", ".", "getMethod", "(", "GET", "+", "getMethodSuffix", "(", "property", ")", ")", ";", "}", ...
Returns getter method for <code>property</code> in specified <code>beanClass</code> @param beanClass bean class @param property name of the property @return getter method. null if <code>property</code> is not found @see #getGetterMethod(Class, String, Class)
[ "Returns", "getter", "method", "for", "<code", ">", "property<", "/", "code", ">", "in", "specified", "<code", ">", "beanClass<", "/", "code", ">" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/BeanUtil.java#L97-L107
payneteasy/superfly
superfly-service/src/main/java/com/payneteasy/superfly/utils/PGPKeyValidator.java
PGPKeyValidator.validatePublicKey
public static void validatePublicKey(String value, PublicKeyCrypto crypto) throws BadPublicKeyException { if (org.springframework.util.StringUtils.hasText(value)) { int open = value.indexOf("-----BEGIN PGP PUBLIC KEY BLOCK-----"); int close = value.indexOf("-----END PGP PUBLIC KEY BLOCK-----"); if (open < 0) { throw new BadPublicKeyException("PublicKeyValidator.noBeginBlock"); } if (close < 0) { throw new BadPublicKeyException("PublicKeyValidator.noEndBlock"); } if (open >= 0 && close >= 0 &&open >= close) { throw new BadPublicKeyException("PublicKeyValidator.wrongBlockOrder"); } if (!crypto.isPublicKeyValid(value)) { throw new BadPublicKeyException("PublicKeyValidator.invalidKey"); } } }
java
public static void validatePublicKey(String value, PublicKeyCrypto crypto) throws BadPublicKeyException { if (org.springframework.util.StringUtils.hasText(value)) { int open = value.indexOf("-----BEGIN PGP PUBLIC KEY BLOCK-----"); int close = value.indexOf("-----END PGP PUBLIC KEY BLOCK-----"); if (open < 0) { throw new BadPublicKeyException("PublicKeyValidator.noBeginBlock"); } if (close < 0) { throw new BadPublicKeyException("PublicKeyValidator.noEndBlock"); } if (open >= 0 && close >= 0 &&open >= close) { throw new BadPublicKeyException("PublicKeyValidator.wrongBlockOrder"); } if (!crypto.isPublicKeyValid(value)) { throw new BadPublicKeyException("PublicKeyValidator.invalidKey"); } } }
[ "public", "static", "void", "validatePublicKey", "(", "String", "value", ",", "PublicKeyCrypto", "crypto", ")", "throws", "BadPublicKeyException", "{", "if", "(", "org", ".", "springframework", ".", "util", ".", "StringUtils", ".", "hasText", "(", "value", ")", ...
Validates a PGP public key. @param value value to validate @param crypto crypto implementation to carry out additional checks @throws BadPublicKeyException thrown if validation fails; getMessage() contains error code
[ "Validates", "a", "PGP", "public", "key", "." ]
train
https://github.com/payneteasy/superfly/blob/4cad6d0f8e951a61f3c302c49b13a51d179076f8/superfly-service/src/main/java/com/payneteasy/superfly/utils/PGPKeyValidator.java#L20-L38
lawloretienne/ImageGallery
library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java
TouchImageView.transformCoordBitmapToTouch
private PointF transformCoordBitmapToTouch(float bx, float by) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float px = bx / origW; float py = by / origH; float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px; float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py; return new PointF(finalX, finalY); }
java
private PointF transformCoordBitmapToTouch(float bx, float by) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float px = bx / origW; float py = by / origH; float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px; float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py; return new PointF(finalX, finalY); }
[ "private", "PointF", "transformCoordBitmapToTouch", "(", "float", "bx", ",", "float", "by", ")", "{", "matrix", ".", "getValues", "(", "m", ")", ";", "float", "origW", "=", "getDrawable", "(", ")", ".", "getIntrinsicWidth", "(", ")", ";", "float", "origH",...
Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the drawable's coordinate system to the view's coordinate system. @param bx x-coordinate in original bitmap coordinate system @param by y-coordinate in original bitmap coordinate system @return Coordinates of the point in the view's coordinate system.
[ "Inverse", "of", "transformCoordTouchToBitmap", ".", "This", "function", "will", "transform", "the", "coordinates", "in", "the", "drawable", "s", "coordinate", "system", "to", "the", "view", "s", "coordinate", "system", "." ]
train
https://github.com/lawloretienne/ImageGallery/blob/960d68dfb2b81d05322a576723ac4f090e10eda7/library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java#L1102-L1111
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java
MessageProcessInfo.createReplyMessage
public Message createReplyMessage(Message message) { Object objResponseID = ((BaseMessage)message).getMessageHeader().get(TrxMessageHeader.MESSAGE_RESPONSE_ID); if (objResponseID == null) return null; // TODO (don) FIX this - return an error. MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getMessageProcessInfo(objResponseID.toString()); MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); BaseMessage replyMessage = new TreeMessage(null, null); MessageRecordDesc messageRecordDesc = recMessageInfo.createNewMessage(replyMessage, null); return replyMessage; }
java
public Message createReplyMessage(Message message) { Object objResponseID = ((BaseMessage)message).getMessageHeader().get(TrxMessageHeader.MESSAGE_RESPONSE_ID); if (objResponseID == null) return null; // TODO (don) FIX this - return an error. MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getMessageProcessInfo(objResponseID.toString()); MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); BaseMessage replyMessage = new TreeMessage(null, null); MessageRecordDesc messageRecordDesc = recMessageInfo.createNewMessage(replyMessage, null); return replyMessage; }
[ "public", "Message", "createReplyMessage", "(", "Message", "message", ")", "{", "Object", "objResponseID", "=", "(", "(", "BaseMessage", ")", "message", ")", ".", "getMessageHeader", "(", ")", ".", "get", "(", "TrxMessageHeader", ".", "MESSAGE_RESPONSE_ID", ")",...
Create the response message for this message. @return the response message (or null if none).
[ "Create", "the", "response", "message", "for", "this", "message", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java#L708-L718
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.dateTimeTemplate
public static <T extends Comparable<?>> DateTimeTemplate<T> dateTimeTemplate(Class<? extends T> cl, Template template, Object... args) { return dateTimeTemplate(cl, template, ImmutableList.copyOf(args)); }
java
public static <T extends Comparable<?>> DateTimeTemplate<T> dateTimeTemplate(Class<? extends T> cl, Template template, Object... args) { return dateTimeTemplate(cl, template, ImmutableList.copyOf(args)); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", ">", ">", "DateTimeTemplate", "<", "T", ">", "dateTimeTemplate", "(", "Class", "<", "?", "extends", "T", ">", "cl", ",", "Template", "template", ",", "Object", "...", "args", ")", "{", "r...
Create a new Template expression @param cl type of expression @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L603-L606
ACRA/acra
acra-core/src/main/java/org/acra/collector/ReflectionCollector.java
ReflectionCollector.collectConstants
private static void collectConstants(@NonNull Class<?> someClass, @NonNull JSONObject container) throws JSONException { final Field[] fields = someClass.getFields(); for (final Field field : fields) { try { final Object value = field.get(null); if (value != null) { if (field.getType().isArray()) { container.put(field.getName(), new JSONArray(Arrays.asList((Object[]) value))); } else { container.put(field.getName(), value); } } } catch (IllegalArgumentException ignored) { // NOOP } catch (IllegalAccessException ignored) { // NOOP } } }
java
private static void collectConstants(@NonNull Class<?> someClass, @NonNull JSONObject container) throws JSONException { final Field[] fields = someClass.getFields(); for (final Field field : fields) { try { final Object value = field.get(null); if (value != null) { if (field.getType().isArray()) { container.put(field.getName(), new JSONArray(Arrays.asList((Object[]) value))); } else { container.put(field.getName(), value); } } } catch (IllegalArgumentException ignored) { // NOOP } catch (IllegalAccessException ignored) { // NOOP } } }
[ "private", "static", "void", "collectConstants", "(", "@", "NonNull", "Class", "<", "?", ">", "someClass", ",", "@", "NonNull", "JSONObject", "container", ")", "throws", "JSONException", "{", "final", "Field", "[", "]", "fields", "=", "someClass", ".", "getF...
Retrieves key/value pairs from static fields of a class. @param someClass the class to be inspected.
[ "Retrieves", "key", "/", "value", "pairs", "from", "static", "fields", "of", "a", "class", "." ]
train
https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/collector/ReflectionCollector.java#L82-L100
morimekta/providence
it-serialization/src/main/java/net/morimekta/providence/it/serialization/FormatStatistics.java
FormatStatistics.colorHeader
public static String colorHeader() { return Color.BOLD + HEADER_L1 + "\n" + new Color(Color.YELLOW, Color.UNDERLINE) + HEADER_L2 + " " + Color.CLEAR; }
java
public static String colorHeader() { return Color.BOLD + HEADER_L1 + "\n" + new Color(Color.YELLOW, Color.UNDERLINE) + HEADER_L2 + " " + Color.CLEAR; }
[ "public", "static", "String", "colorHeader", "(", ")", "{", "return", "Color", ".", "BOLD", "+", "HEADER_L1", "+", "\"\\n\"", "+", "new", "Color", "(", "Color", ".", "YELLOW", ",", "Color", ".", "UNDERLINE", ")", "+", "HEADER_L2", "+", "\" \"", "+", ...
Header string that matches the asString output. @return The asString header.
[ "Header", "string", "that", "matches", "the", "asString", "output", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/it-serialization/src/main/java/net/morimekta/providence/it/serialization/FormatStatistics.java#L94-L100
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.andLikePattern
public ZealotKhala andLikePattern(String field, String pattern) { return this.doLikePattern(ZealotConst.AND_PREFIX, field, pattern, true, true); }
java
public ZealotKhala andLikePattern(String field, String pattern) { return this.doLikePattern(ZealotConst.AND_PREFIX, field, pattern, true, true); }
[ "public", "ZealotKhala", "andLikePattern", "(", "String", "field", ",", "String", "pattern", ")", "{", "return", "this", ".", "doLikePattern", "(", "ZealotConst", ".", "AND_PREFIX", ",", "field", ",", "pattern", ",", "true", ",", "true", ")", ";", "}" ]
根据指定的模式字符串生成带" AND "前缀的like模糊查询的SQL片段. <p>示例:传入 {"b.title", "Java%"} 两个参数,生成的SQL片段为:" AND b.title LIKE 'Java%' "</p> @param field 数据库字段 @param pattern 模式字符串 @return ZealotKhala实例
[ "根据指定的模式字符串生成带", "AND", "前缀的like模糊查询的SQL片段", ".", "<p", ">", "示例:传入", "{", "b", ".", "title", "Java%", "}", "两个参数,生成的SQL片段为:", "AND", "b", ".", "title", "LIKE", "Java%", "<", "/", "p", ">" ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1066-L1068
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java
COSAPIClient.copyFile
private void copyFile(String srcKey, String dstKey, long size) throws IOException, InterruptedIOException, AmazonClientException { LOG.debug("copyFile {} -> {} ", srcKey, dstKey); CopyObjectRequest copyObjectRequest = new CopyObjectRequest(mBucket, srcKey, mBucket, dstKey); try { ObjectMetadata srcmd = getObjectMetadata(srcKey); if (srcmd != null) { copyObjectRequest.setNewObjectMetadata(srcmd); } ProgressListener progressListener = new ProgressListener() { public void progressChanged(ProgressEvent progressEvent) { switch (progressEvent.getEventType()) { case TRANSFER_PART_COMPLETED_EVENT: break; default: break; } } }; Copy copy = transfers.copy(copyObjectRequest); copy.addProgressListener(progressListener); try { copy.waitForCopyResult(); } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted copying " + srcKey + " to " + dstKey + ", cancelling"); } } catch (AmazonClientException e) { throw translateException("copyFile(" + srcKey + ", " + dstKey + ")", srcKey, e); } }
java
private void copyFile(String srcKey, String dstKey, long size) throws IOException, InterruptedIOException, AmazonClientException { LOG.debug("copyFile {} -> {} ", srcKey, dstKey); CopyObjectRequest copyObjectRequest = new CopyObjectRequest(mBucket, srcKey, mBucket, dstKey); try { ObjectMetadata srcmd = getObjectMetadata(srcKey); if (srcmd != null) { copyObjectRequest.setNewObjectMetadata(srcmd); } ProgressListener progressListener = new ProgressListener() { public void progressChanged(ProgressEvent progressEvent) { switch (progressEvent.getEventType()) { case TRANSFER_PART_COMPLETED_EVENT: break; default: break; } } }; Copy copy = transfers.copy(copyObjectRequest); copy.addProgressListener(progressListener); try { copy.waitForCopyResult(); } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted copying " + srcKey + " to " + dstKey + ", cancelling"); } } catch (AmazonClientException e) { throw translateException("copyFile(" + srcKey + ", " + dstKey + ")", srcKey, e); } }
[ "private", "void", "copyFile", "(", "String", "srcKey", ",", "String", "dstKey", ",", "long", "size", ")", "throws", "IOException", ",", "InterruptedIOException", ",", "AmazonClientException", "{", "LOG", ".", "debug", "(", "\"copyFile {} -> {} \"", ",", "srcKey",...
Copy a single object in the bucket via a COPY operation. @param srcKey source object path @param dstKey destination object path @param size object size @throws AmazonClientException on failures inside the AWS SDK @throws InterruptedIOException the operation was interrupted @throws IOException Other IO problems
[ "Copy", "a", "single", "object", "in", "the", "bucket", "via", "a", "COPY", "operation", "." ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java#L1604-L1637
apache/incubator-atlas
webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java
SetupSteps.runSetup
@PostConstruct public void runSetup() throws SetupException { HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration); InterProcessMutex lock = curatorFactory.lockInstance(zookeeperProperties.getZkRoot()); try { LOG.info("Trying to acquire lock for running setup."); lock.acquire(); LOG.info("Acquired lock for running setup."); handleSetupInProgress(configuration, zookeeperProperties); for (SetupStep step : setupSteps) { LOG.info("Running setup step: {}", step); step.run(); } clearSetupInProgress(zookeeperProperties); } catch (SetupException se) { LOG.error("Got setup exception while trying to setup", se); throw se; } catch (Throwable e) { LOG.error("Error running setup steps", e); throw new SetupException("Error running setup steps", e); } finally { releaseLock(lock); curatorFactory.close(); } }
java
@PostConstruct public void runSetup() throws SetupException { HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration); InterProcessMutex lock = curatorFactory.lockInstance(zookeeperProperties.getZkRoot()); try { LOG.info("Trying to acquire lock for running setup."); lock.acquire(); LOG.info("Acquired lock for running setup."); handleSetupInProgress(configuration, zookeeperProperties); for (SetupStep step : setupSteps) { LOG.info("Running setup step: {}", step); step.run(); } clearSetupInProgress(zookeeperProperties); } catch (SetupException se) { LOG.error("Got setup exception while trying to setup", se); throw se; } catch (Throwable e) { LOG.error("Error running setup steps", e); throw new SetupException("Error running setup steps", e); } finally { releaseLock(lock); curatorFactory.close(); } }
[ "@", "PostConstruct", "public", "void", "runSetup", "(", ")", "throws", "SetupException", "{", "HAConfiguration", ".", "ZookeeperProperties", "zookeeperProperties", "=", "HAConfiguration", ".", "getZookeeperProperties", "(", "configuration", ")", ";", "InterProcessMutex",...
Call each registered {@link SetupStep} one after the other. @throws SetupException Thrown with any error during running setup, including Zookeeper interactions, and individual failures in the {@link SetupStep}.
[ "Call", "each", "registered", "{" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/setup/SetupSteps.java#L75-L99
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/component/UIComponent.java
UIComponent.getComponentAt
public UIComponent getComponentAt(int x, int y) { //control components take precedence over regular components for (IControlComponent c : controlComponents) { UIComponent component = c.getComponentAt(x, y); if (component != null) return component; } return isInsideBounds(x, y) ? this : null; }
java
public UIComponent getComponentAt(int x, int y) { //control components take precedence over regular components for (IControlComponent c : controlComponents) { UIComponent component = c.getComponentAt(x, y); if (component != null) return component; } return isInsideBounds(x, y) ? this : null; }
[ "public", "UIComponent", "getComponentAt", "(", "int", "x", ",", "int", "y", ")", "{", "//control components take precedence over regular components", "for", "(", "IControlComponent", "c", ":", "controlComponents", ")", "{", "UIComponent", "component", "=", "c", ".", ...
Gets the {@link UIComponent} at the specified coordinates.<br> Will return a {@link IControlComponent} if any. Checks if inside bounds, visible and not disabled. @param x the x @param y the y @return this {@link UIComponent} or null if outside its bounds.
[ "Gets", "the", "{", "@link", "UIComponent", "}", "at", "the", "specified", "coordinates", ".", "<br", ">", "Will", "return", "a", "{", "@link", "IControlComponent", "}", "if", "any", ".", "Checks", "if", "inside", "bounds", "visible", "and", "not", "disabl...
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/component/UIComponent.java#L702-L713
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setCacheConfigs
public Config setCacheConfigs(Map<String, CacheSimpleConfig> cacheConfigs) { this.cacheConfigs.clear(); this.cacheConfigs.putAll(cacheConfigs); for (final Entry<String, CacheSimpleConfig> entry : this.cacheConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public Config setCacheConfigs(Map<String, CacheSimpleConfig> cacheConfigs) { this.cacheConfigs.clear(); this.cacheConfigs.putAll(cacheConfigs); for (final Entry<String, CacheSimpleConfig> entry : this.cacheConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "Config", "setCacheConfigs", "(", "Map", "<", "String", ",", "CacheSimpleConfig", ">", "cacheConfigs", ")", "{", "this", ".", "cacheConfigs", ".", "clear", "(", ")", ";", "this", ".", "cacheConfigs", ".", "putAll", "(", "cacheConfigs", ")", ";", ...
Sets the map of cache configurations, mapped by config name. The config name may be a pattern with which the configuration was initially obtained. @param cacheConfigs the cacheConfigs to set @return this config instance
[ "Sets", "the", "map", "of", "cache", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "was", "initially", "obtained", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L608-L615
sualeh/credit_card_number
src/main/java/us/fatehi/creditcardnumber/DisposableStringData.java
DisposableStringData.disposeData
public void disposeData(final int fromIndex, final int toIndex) { Arrays.fill(data, max(0, fromIndex), min(data.length, toIndex), (char) 0); }
java
public void disposeData(final int fromIndex, final int toIndex) { Arrays.fill(data, max(0, fromIndex), min(data.length, toIndex), (char) 0); }
[ "public", "void", "disposeData", "(", "final", "int", "fromIndex", ",", "final", "int", "toIndex", ")", "{", "Arrays", ".", "fill", "(", "data", ",", "max", "(", "0", ",", "fromIndex", ")", ",", "min", "(", "data", ".", "length", ",", "toIndex", ")",...
Wipes the data from memory, starting from the provided index, inclusive, and until the second index. Following recommendations from the <a href= "http://docs.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#PBEEx">Java Cryptography Architecture (JCA) Reference Guide</a> Also wipes raw data.
[ "Wipes", "the", "data", "from", "memory", "starting", "from", "the", "provided", "index", "inclusive", "and", "until", "the", "second", "index", ".", "Following", "recommendations", "from", "the", "<a", "href", "=", "http", ":", "//", "docs", ".", "oracle", ...
train
https://github.com/sualeh/credit_card_number/blob/75238a84bbfdfe9163a70fd5673cba627e8972b6/src/main/java/us/fatehi/creditcardnumber/DisposableStringData.java#L87-L90
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.scaleAroundLocal
public Matrix4f scaleAroundLocal(float factor, float ox, float oy, float oz, Matrix4f dest) { return scaleAroundLocal(factor, factor, factor, ox, oy, oz, dest); }
java
public Matrix4f scaleAroundLocal(float factor, float ox, float oy, float oz, Matrix4f dest) { return scaleAroundLocal(factor, factor, factor, ox, oy, oz, dest); }
[ "public", "Matrix4f", "scaleAroundLocal", "(", "float", "factor", ",", "float", "ox", ",", "float", "oy", ",", "float", "oz", ",", "Matrix4f", "dest", ")", "{", "return", "scaleAroundLocal", "(", "factor", ",", "factor", ",", "factor", ",", "ox", ",", "o...
/* (non-Javadoc) @see org.joml.Matrix4fc#scaleAroundLocal(float, float, float, float, org.joml.Matrix4f)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L5051-L5053
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java
NamedResolverMap.getIntegerOrDefault
public int getIntegerOrDefault(int key, int dfl) { Any3<Boolean, Integer, String> value = data.getOrDefault(Any2.<Integer, String>left(key), Any3.<Boolean, Integer, String>create2(dfl)); return value.get2().orElseThrow(() -> new IllegalArgumentException("expected integer argument for param " + key)); }
java
public int getIntegerOrDefault(int key, int dfl) { Any3<Boolean, Integer, String> value = data.getOrDefault(Any2.<Integer, String>left(key), Any3.<Boolean, Integer, String>create2(dfl)); return value.get2().orElseThrow(() -> new IllegalArgumentException("expected integer argument for param " + key)); }
[ "public", "int", "getIntegerOrDefault", "(", "int", "key", ",", "int", "dfl", ")", "{", "Any3", "<", "Boolean", ",", "Integer", ",", "String", ">", "value", "=", "data", ".", "getOrDefault", "(", "Any2", ".", "<", "Integer", ",", "String", ">", "left",...
Return the integer value indicated by the given numeric key. @param key The key of the value to return. @param dfl The default value to return, if the key is absent. @return The integer value stored under the given key, or dfl. @throws IllegalArgumentException if the value is present, but not an integer.
[ "Return", "the", "integer", "value", "indicated", "by", "the", "given", "numeric", "key", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L73-L76
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.getElemFunctionAndThis
public static Callable getElemFunctionAndThis(Object obj, Object elem, Context cx, Scriptable scope) { Scriptable thisObj; Object value; if (isSymbol(elem)) { thisObj = toObjectOrNull(cx, obj, scope); if (thisObj == null) { throw undefCallError(obj, String.valueOf(elem)); } value = ScriptableObject.getProperty(thisObj, (Symbol)elem); } else { String str = toStringIdOrIndex(cx, elem); if (str != null) { return getPropFunctionAndThis(obj, str, cx, scope); } int index = lastIndexResult(cx); thisObj = toObjectOrNull(cx, obj, scope); if (thisObj == null) { throw undefCallError(obj, String.valueOf(elem)); } value = ScriptableObject.getProperty(thisObj, index); } if (!(value instanceof Callable)) { throw notFunctionError(value, elem); } storeScriptable(cx, thisObj); return (Callable)value; }
java
public static Callable getElemFunctionAndThis(Object obj, Object elem, Context cx, Scriptable scope) { Scriptable thisObj; Object value; if (isSymbol(elem)) { thisObj = toObjectOrNull(cx, obj, scope); if (thisObj == null) { throw undefCallError(obj, String.valueOf(elem)); } value = ScriptableObject.getProperty(thisObj, (Symbol)elem); } else { String str = toStringIdOrIndex(cx, elem); if (str != null) { return getPropFunctionAndThis(obj, str, cx, scope); } int index = lastIndexResult(cx); thisObj = toObjectOrNull(cx, obj, scope); if (thisObj == null) { throw undefCallError(obj, String.valueOf(elem)); } value = ScriptableObject.getProperty(thisObj, index); } if (!(value instanceof Callable)) { throw notFunctionError(value, elem); } storeScriptable(cx, thisObj); return (Callable)value; }
[ "public", "static", "Callable", "getElemFunctionAndThis", "(", "Object", "obj", ",", "Object", "elem", ",", "Context", "cx", ",", "Scriptable", "scope", ")", "{", "Scriptable", "thisObj", ";", "Object", "value", ";", "if", "(", "isSymbol", "(", "elem", ")", ...
Prepare for calling obj[id](...): return function corresponding to obj[id] and make obj properly converted to Scriptable available as ScriptRuntime.lastStoredScriptable() for consumption as thisObj. The caller must call ScriptRuntime.lastStoredScriptable() immediately after calling this method.
[ "Prepare", "for", "calling", "obj", "[", "id", "]", "(", "...", ")", ":", "return", "function", "corresponding", "to", "obj", "[", "id", "]", "and", "make", "obj", "properly", "converted", "to", "Scriptable", "available", "as", "ScriptRuntime", ".", "lastS...
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L2495-L2529
huahang/crypto-utils
crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java
Rc4Utils.createRC4DropCipher
public static StreamCipher createRC4DropCipher(byte[] key, int drop) { checkArgument(key.length >= 5 && key.length <= 256); checkArgument(drop > 0); RC4Engine rc4Engine = new RC4Engine(); rc4Engine.init(true, new KeyParameter(key)); byte[] dropBytes = new byte[drop]; Arrays.fill(dropBytes, (byte) 0); rc4Engine.processBytes(dropBytes, 0, dropBytes.length, dropBytes, 0); return rc4Engine; }
java
public static StreamCipher createRC4DropCipher(byte[] key, int drop) { checkArgument(key.length >= 5 && key.length <= 256); checkArgument(drop > 0); RC4Engine rc4Engine = new RC4Engine(); rc4Engine.init(true, new KeyParameter(key)); byte[] dropBytes = new byte[drop]; Arrays.fill(dropBytes, (byte) 0); rc4Engine.processBytes(dropBytes, 0, dropBytes.length, dropBytes, 0); return rc4Engine; }
[ "public", "static", "StreamCipher", "createRC4DropCipher", "(", "byte", "[", "]", "key", ",", "int", "drop", ")", "{", "checkArgument", "(", "key", ".", "length", ">=", "5", "&&", "key", ".", "length", "<=", "256", ")", ";", "checkArgument", "(", "drop",...
Creates an RC4-drop cipher @param key rc4 key (40..2048 bits) @param drop number of bytes to drop @return decrypted input stream
[ "Creates", "an", "RC4", "-", "drop", "cipher" ]
train
https://github.com/huahang/crypto-utils/blob/5f158478612698ecfd65fb0a0f9862a54ca17a8d/crypto-utils/src/main/java/im/chic/utils/crypto/Rc4Utils.java#L116-L125
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagProperty.java
CmsJspTagProperty.propertiesTagAction
public static Map<String, String> propertiesTagAction(String action, ServletRequest req) throws CmsException { CmsFlexController controller = CmsFlexController.getController(req); // now read the property from the VFS Map<String, String> value = new HashMap<String, String>(); CmsPropertyAction propertyAction = new CmsPropertyAction(req, action); if (null != propertyAction.getVfsUri()) { value = CmsProperty.toMap( controller.getCmsObject().readPropertyObjects(propertyAction.getVfsUri(), propertyAction.isSearch())); } return value; }
java
public static Map<String, String> propertiesTagAction(String action, ServletRequest req) throws CmsException { CmsFlexController controller = CmsFlexController.getController(req); // now read the property from the VFS Map<String, String> value = new HashMap<String, String>(); CmsPropertyAction propertyAction = new CmsPropertyAction(req, action); if (null != propertyAction.getVfsUri()) { value = CmsProperty.toMap( controller.getCmsObject().readPropertyObjects(propertyAction.getVfsUri(), propertyAction.isSearch())); } return value; }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "propertiesTagAction", "(", "String", "action", ",", "ServletRequest", "req", ")", "throws", "CmsException", "{", "CmsFlexController", "controller", "=", "CmsFlexController", ".", "getController", "(", ...
Internal action method.<p> @param action the search action @param req the current request @return String the value of the property or <code>null</code> if not found (and no defaultValue provided) @throws CmsException if something goes wrong
[ "Internal", "action", "method", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagProperty.java#L276-L288
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric_ca/sdk/HFCAClient.java
HFCAClient.getHFCAIdentities
public Collection<HFCAIdentity> getHFCAIdentities(User registrar) throws IdentityException, InvalidArgumentException { if (registrar == null) { throw new InvalidArgumentException("Registrar should be a valid member"); } logger.debug(format("identity url: %s, registrar: %s", url, registrar.getName())); try { JsonObject result = httpGet(HFCAIdentity.HFCA_IDENTITY, registrar); Collection<HFCAIdentity> allIdentities = new ArrayList<>(); JsonArray identities = result.getJsonArray("identities"); if (identities != null && !identities.isEmpty()) { for (int i = 0; i < identities.size(); i++) { JsonObject identity = identities.getJsonObject(i); HFCAIdentity idObj = new HFCAIdentity(identity); allIdentities.add(idObj); } } logger.debug(format("identity url: %s, registrar: %s done.", url, registrar)); return allIdentities; } catch (HTTPException e) { String msg = format("[HTTP Status Code: %d] - Error while getting all users from url '%s': %s", e.getStatusCode(), url, e.getMessage()); IdentityException identityException = new IdentityException(msg, e); logger.error(msg); throw identityException; } catch (Exception e) { String msg = format("Error while getting all users from url '%s': %s", url, e.getMessage()); IdentityException identityException = new IdentityException(msg, e); logger.error(msg); throw identityException; } }
java
public Collection<HFCAIdentity> getHFCAIdentities(User registrar) throws IdentityException, InvalidArgumentException { if (registrar == null) { throw new InvalidArgumentException("Registrar should be a valid member"); } logger.debug(format("identity url: %s, registrar: %s", url, registrar.getName())); try { JsonObject result = httpGet(HFCAIdentity.HFCA_IDENTITY, registrar); Collection<HFCAIdentity> allIdentities = new ArrayList<>(); JsonArray identities = result.getJsonArray("identities"); if (identities != null && !identities.isEmpty()) { for (int i = 0; i < identities.size(); i++) { JsonObject identity = identities.getJsonObject(i); HFCAIdentity idObj = new HFCAIdentity(identity); allIdentities.add(idObj); } } logger.debug(format("identity url: %s, registrar: %s done.", url, registrar)); return allIdentities; } catch (HTTPException e) { String msg = format("[HTTP Status Code: %d] - Error while getting all users from url '%s': %s", e.getStatusCode(), url, e.getMessage()); IdentityException identityException = new IdentityException(msg, e); logger.error(msg); throw identityException; } catch (Exception e) { String msg = format("Error while getting all users from url '%s': %s", url, e.getMessage()); IdentityException identityException = new IdentityException(msg, e); logger.error(msg); throw identityException; } }
[ "public", "Collection", "<", "HFCAIdentity", ">", "getHFCAIdentities", "(", "User", "registrar", ")", "throws", "IdentityException", ",", "InvalidArgumentException", "{", "if", "(", "registrar", "==", "null", ")", "{", "throw", "new", "InvalidArgumentException", "("...
gets all identities that the registrar is allowed to see @param registrar The identity of the registrar (i.e. who is performing the registration). @return the identity that was requested @throws IdentityException if adding an identity fails. @throws InvalidArgumentException Invalid (null) argument specified
[ "gets", "all", "identities", "that", "the", "registrar", "is", "allowed", "to", "see" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAClient.java#L1000-L1035
EdwardRaff/JSAT
JSAT/src/jsat/distributions/LogUniform.java
LogUniform.setMinMax
public void setMinMax(double min, double max) { if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min)) throw new IllegalArgumentException("min value must be positive, not " + min); else if(min >= max || Double.isNaN(max) || Double.isInfinite(max)) throw new IllegalArgumentException("max (" + max + ") must be larger than min (" + min+")" ); this.max = max; this.min = min; this.logMax = Math.log(max); this.logMin = Math.log(min); this.logDiff = logMax-logMin; this.diff = max-min; }
java
public void setMinMax(double min, double max) { if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min)) throw new IllegalArgumentException("min value must be positive, not " + min); else if(min >= max || Double.isNaN(max) || Double.isInfinite(max)) throw new IllegalArgumentException("max (" + max + ") must be larger than min (" + min+")" ); this.max = max; this.min = min; this.logMax = Math.log(max); this.logMin = Math.log(min); this.logDiff = logMax-logMin; this.diff = max-min; }
[ "public", "void", "setMinMax", "(", "double", "min", ",", "double", "max", ")", "{", "if", "(", "min", "<=", "0", "||", "Double", ".", "isNaN", "(", "min", ")", "||", "Double", ".", "isInfinite", "(", "min", ")", ")", "throw", "new", "IllegalArgument...
Sets the minimum and maximum values for this distribution @param min the minimum value, must be positive @param max the maximum value, must be larger than {@code min}
[ "Sets", "the", "minimum", "and", "maximum", "values", "for", "this", "distribution" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/LogUniform.java#L59-L71
classgraph/classgraph
src/main/java/io/github/classgraph/ClassInfo.java
ClassInfo.getAllAnnotationClasses
static ClassInfoList getAllAnnotationClasses(final Collection<ClassInfo> classes, final ScanSpec scanSpec) { return new ClassInfoList( ClassInfo.filterClassInfo(classes, scanSpec, /* strictWhitelist = */ true, ClassType.ANNOTATION), /* sortByName = */ true); }
java
static ClassInfoList getAllAnnotationClasses(final Collection<ClassInfo> classes, final ScanSpec scanSpec) { return new ClassInfoList( ClassInfo.filterClassInfo(classes, scanSpec, /* strictWhitelist = */ true, ClassType.ANNOTATION), /* sortByName = */ true); }
[ "static", "ClassInfoList", "getAllAnnotationClasses", "(", "final", "Collection", "<", "ClassInfo", ">", "classes", ",", "final", "ScanSpec", "scanSpec", ")", "{", "return", "new", "ClassInfoList", "(", "ClassInfo", ".", "filterClassInfo", "(", "classes", ",", "sc...
Get all annotation classes found during the scan. See also {@link #getAllInterfacesOrAnnotationClasses(Collection, ScanSpec, ScanResult)} ()}. @param classes the classes @param scanSpec the scan spec @return A list of all annotation classes found during the scan, or the empty list if none.
[ "Get", "all", "annotation", "classes", "found", "during", "the", "scan", ".", "See", "also", "{", "@link", "#getAllInterfacesOrAnnotationClasses", "(", "Collection", "ScanSpec", "ScanResult", ")", "}", "()", "}", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassInfo.java#L870-L874
ologolo/streamline-engine
src/org/daisy/streamline/engine/PathTools.java
PathTools.deleteRecursive
public static void deleteRecursive(Path start, boolean deleteStart) throws IOException { Files.walkFileTree(start, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e == null) { if (deleteStart || !Files.isSameFile(dir, start)) { Files.delete(dir); } return FileVisitResult.CONTINUE; } else { // directory iteration failed throw e; } } }); }
java
public static void deleteRecursive(Path start, boolean deleteStart) throws IOException { Files.walkFileTree(start, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e == null) { if (deleteStart || !Files.isSameFile(dir, start)) { Files.delete(dir); } return FileVisitResult.CONTINUE; } else { // directory iteration failed throw e; } } }); }
[ "public", "static", "void", "deleteRecursive", "(", "Path", "start", ",", "boolean", "deleteStart", ")", "throws", "IOException", "{", "Files", ".", "walkFileTree", "(", "start", ",", "new", "SimpleFileVisitor", "<", "Path", ">", "(", ")", "{", "@", "Overrid...
Deletes files and folders at the specified path. @param start the path @param deleteStart true if the start path should also be deleted, false if only the contents should be deleted @throws IOException if an I/O error occurs
[ "Deletes", "files", "and", "folders", "at", "the", "specified", "path", "." ]
train
https://github.com/ologolo/streamline-engine/blob/04b7adc85d84d91dc5f0eaaa401d2738f9401b17/src/org/daisy/streamline/engine/PathTools.java#L70-L90
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java
BootstrapConfig.addMissingProperties
protected void addMissingProperties(Properties source, Map<String, String> target) { if (source == null || source.isEmpty() || target == null) return; // only add "new" properties (first value wins) for (String key : source.stringPropertyNames()) { if (!target.containsKey(key) && key.length() > 0) { // Check for a System property override first. String value = System.getProperty(key); if (value == null) { value = source.getProperty(key); } // store the value in the target map target.put(key, value); } } }
java
protected void addMissingProperties(Properties source, Map<String, String> target) { if (source == null || source.isEmpty() || target == null) return; // only add "new" properties (first value wins) for (String key : source.stringPropertyNames()) { if (!target.containsKey(key) && key.length() > 0) { // Check for a System property override first. String value = System.getProperty(key); if (value == null) { value = source.getProperty(key); } // store the value in the target map target.put(key, value); } } }
[ "protected", "void", "addMissingProperties", "(", "Properties", "source", ",", "Map", "<", "String", ",", "String", ">", "target", ")", "{", "if", "(", "source", "==", "null", "||", "source", ".", "isEmpty", "(", ")", "||", "target", "==", "null", ")", ...
Add properties from source to target if the target map does not already contain a property with that value. When a new attribute is discovered, System properties are checked to see if an override has been specified. If the property is present as a System property (from the command line or jvm.options), that value is used instead of bootstrap.properties. @param source The source properties file (bootstrap.properties or include) @param target The target map
[ "Add", "properties", "from", "source", "to", "target", "if", "the", "target", "map", "does", "not", "already", "contain", "a", "property", "with", "that", "value", ".", "When", "a", "new", "attribute", "is", "discovered", "System", "properties", "are", "chec...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L706-L722
tvesalainen/util
util/src/main/java/org/vesalainen/math/AbstractLine.java
AbstractLine.crossPoint
public static Point crossPoint(Line l1, Line l2) { return crossPoint(l1, l2, null); }
java
public static Point crossPoint(Line l1, Line l2) { return crossPoint(l1, l2, null); }
[ "public", "static", "Point", "crossPoint", "(", "Line", "l1", ",", "Line", "l2", ")", "{", "return", "crossPoint", "(", "l1", ",", "l2", ",", "null", ")", ";", "}" ]
Returns the crosspoint of lines l1 and l2. If lines don't cross returns null. <p>Note returns null if lines are parallel and also when lines ate equal.! @param l1 @param l2 @return
[ "Returns", "the", "crosspoint", "of", "lines", "l1", "and", "l2", ".", "If", "lines", "don", "t", "cross", "returns", "null", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractLine.java#L157-L160
soi-toolkit/soi-toolkit-mule
commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java
MonitorEndpointHelper.pingJmsEndpoint
public static String pingJmsEndpoint(MuleContext muleContext, String queueName) { return pingJmsEndpoint(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName); }
java
public static String pingJmsEndpoint(MuleContext muleContext, String queueName) { return pingJmsEndpoint(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName); }
[ "public", "static", "String", "pingJmsEndpoint", "(", "MuleContext", "muleContext", ",", "String", "queueName", ")", "{", "return", "pingJmsEndpoint", "(", "muleContext", ",", "DEFAULT_MULE_JMS_CONNECTOR", ",", "queueName", ")", ";", "}" ]
Verify access to a JMS endpoint by browsing a specified queue for messages.
[ "Verify", "access", "to", "a", "JMS", "endpoint", "by", "browsing", "a", "specified", "queue", "for", "messages", "." ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java#L117-L119
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/cloning/implementor/AbstractCloneStrategy.java
AbstractCloneStrategy.performCloneForCloneableMethod
protected <T> T performCloneForCloneableMethod(T object, CloneDriver context) { Class<?> clazz = object.getClass(); final T result; try { MethodHandle handle = context.getCloneMethod(clazz); result = (T) handle.invoke(object); } catch (Throwable e) { throw new IllegalStateException("Could not invoke clone() for instance of: " + clazz.getName(), e); } return result; }
java
protected <T> T performCloneForCloneableMethod(T object, CloneDriver context) { Class<?> clazz = object.getClass(); final T result; try { MethodHandle handle = context.getCloneMethod(clazz); result = (T) handle.invoke(object); } catch (Throwable e) { throw new IllegalStateException("Could not invoke clone() for instance of: " + clazz.getName(), e); } return result; }
[ "protected", "<", "T", ">", "T", "performCloneForCloneableMethod", "(", "T", "object", ",", "CloneDriver", "context", ")", "{", "Class", "<", "?", ">", "clazz", "=", "object", ".", "getClass", "(", ")", ";", "final", "T", "result", ";", "try", "{", "Me...
Helper method for performing cloning for objects of classes implementing java.lang.Cloneable @param object The object to be cloned. @param context The CloneDriver to be used @param <T> The type being copied @return The cloned object
[ "Helper", "method", "for", "performing", "cloning", "for", "objects", "of", "classes", "implementing", "java", ".", "lang", ".", "Cloneable" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/cloning/implementor/AbstractCloneStrategy.java#L271-L283
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/AnimationConfig.java
AnimationConfig.createAnimation
public static Animation createAnimation(XmlReader node) { Check.notNull(node); final String name = node.readString(ANIMATION_NAME); final int start = node.readInteger(ANIMATION_START); final int end = node.readInteger(ANIMATION_END); final double speed = node.readDouble(ANIMATION_SPEED); final boolean reversed = node.readBoolean(ANIMATION_REVERSED); final boolean repeat = node.readBoolean(ANIMATION_REPEAT); return new Animation(name, start, end, speed, reversed, repeat); }
java
public static Animation createAnimation(XmlReader node) { Check.notNull(node); final String name = node.readString(ANIMATION_NAME); final int start = node.readInteger(ANIMATION_START); final int end = node.readInteger(ANIMATION_END); final double speed = node.readDouble(ANIMATION_SPEED); final boolean reversed = node.readBoolean(ANIMATION_REVERSED); final boolean repeat = node.readBoolean(ANIMATION_REPEAT); return new Animation(name, start, end, speed, reversed, repeat); }
[ "public", "static", "Animation", "createAnimation", "(", "XmlReader", "node", ")", "{", "Check", ".", "notNull", "(", "node", ")", ";", "final", "String", "name", "=", "node", ".", "readString", "(", "ANIMATION_NAME", ")", ";", "final", "int", "start", "="...
Create animation data from node. @param node The animation node (must not be <code>null</code>). @return The animation instance. @throws LionEngineException If error when reading animation data.
[ "Create", "animation", "data", "from", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/AnimationConfig.java#L103-L115
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java
AbstractCreator.methodCallCodeWithJMapperTypeParameters
private CodeBlock methodCallCodeWithJMapperTypeParameters( MapperInstance instance, ImmutableList<? extends JMapperType> parameters ) { CodeBlock.Builder builder = initMethodCallCode( instance ); return methodCallCodeWithJMapperTypeParameters( builder, parameters ); }
java
private CodeBlock methodCallCodeWithJMapperTypeParameters( MapperInstance instance, ImmutableList<? extends JMapperType> parameters ) { CodeBlock.Builder builder = initMethodCallCode( instance ); return methodCallCodeWithJMapperTypeParameters( builder, parameters ); }
[ "private", "CodeBlock", "methodCallCodeWithJMapperTypeParameters", "(", "MapperInstance", "instance", ",", "ImmutableList", "<", "?", "extends", "JMapperType", ">", "parameters", ")", "{", "CodeBlock", ".", "Builder", "builder", "=", "initMethodCallCode", "(", "instance...
Build the code to create a mapper. @param instance the class to call @param parameters the parameters of the method @return the code to create the mapper
[ "Build", "the", "code", "to", "create", "a", "mapper", "." ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java#L917-L920
wcm-io/wcm-io-handler
url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java
SuffixParser.getPage
public @Nullable Page getPage(@Nullable Predicate<Page> filter, @Nullable Page basePage) { List<Page> suffixPages = getPages(filter, basePage); if (suffixPages.isEmpty()) { return null; } else { return suffixPages.get(0); } }
java
public @Nullable Page getPage(@Nullable Predicate<Page> filter, @Nullable Page basePage) { List<Page> suffixPages = getPages(filter, basePage); if (suffixPages.isEmpty()) { return null; } else { return suffixPages.get(0); } }
[ "public", "@", "Nullable", "Page", "getPage", "(", "@", "Nullable", "Predicate", "<", "Page", ">", "filter", ",", "@", "Nullable", "Page", "basePage", ")", "{", "List", "<", "Page", ">", "suffixPages", "=", "getPages", "(", "filter", ",", "basePage", ")"...
Get the first item returned by {@link #getPages(Predicate, Page)} or null if list is empty @param filter the resource filter @param basePage the suffix path is relative to this page path (null for current page) @return the first {@link Page} or null
[ "Get", "the", "first", "item", "returned", "by", "{" ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java#L312-L320
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java
ServicesInner.getByResourceGroup
public DataMigrationServiceInner getByResourceGroup(String groupName, String serviceName) { return getByResourceGroupWithServiceResponseAsync(groupName, serviceName).toBlocking().single().body(); }
java
public DataMigrationServiceInner getByResourceGroup(String groupName, String serviceName) { return getByResourceGroupWithServiceResponseAsync(groupName, serviceName).toBlocking().single().body(); }
[ "public", "DataMigrationServiceInner", "getByResourceGroup", "(", "String", "groupName", ",", "String", "serviceName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "groupName", ",", "serviceName", ")", ".", "toBlocking", "(", ")", ".", "single"...
Get DMS Service Instance. The services resource is the top-level resource that represents the Data Migration Service. The GET method retrieves information about a service instance. @param groupName Name of the resource group @param serviceName Name of the service @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DataMigrationServiceInner object if successful.
[ "Get", "DMS", "Service", "Instance", ".", "The", "services", "resource", "is", "the", "top", "-", "level", "resource", "that", "represents", "the", "Data", "Migration", "Service", ".", "The", "GET", "method", "retrieves", "information", "about", "a", "service"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L344-L346
hal/core
gui/src/main/java/org/jboss/as/console/client/widgets/CollapsibleSplitLayoutPanel.java
CollapsibleSplitLayoutPanel.setWidgetSnapClosedSize
public void setWidgetSnapClosedSize(Widget child, int snapClosedSize) { assertIsChild(child); Splitter splitter = getAssociatedSplitter(child); // The splitter is null for the center element. if (splitter != null) { splitter.setSnapClosedSize(snapClosedSize); } }
java
public void setWidgetSnapClosedSize(Widget child, int snapClosedSize) { assertIsChild(child); Splitter splitter = getAssociatedSplitter(child); // The splitter is null for the center element. if (splitter != null) { splitter.setSnapClosedSize(snapClosedSize); } }
[ "public", "void", "setWidgetSnapClosedSize", "(", "Widget", "child", ",", "int", "snapClosedSize", ")", "{", "assertIsChild", "(", "child", ")", ";", "Splitter", "splitter", "=", "getAssociatedSplitter", "(", "child", ")", ";", "// The splitter is null for the center ...
Sets a size below which the slider will close completely. This can be used in conjunction with {@link #setWidgetMinSize} to provide a speed-bump effect where the slider will stick to a preferred minimum size before closing completely. <p> This method has no effect for the {@link DockLayoutPanel.Direction#CENTER} widget. </p> @param child the child whose slider should snap closed @param snapClosedSize the width below which the widget will close or -1 to disable.
[ "Sets", "a", "size", "below", "which", "the", "slider", "will", "close", "completely", ".", "This", "can", "be", "used", "in", "conjunction", "with", "{", "@link", "#setWidgetMinSize", "}", "to", "provide", "a", "speed", "-", "bump", "effect", "where", "th...
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/widgets/CollapsibleSplitLayoutPanel.java#L440-L447
osglworks/java-tool
src/main/java/org/osgl/util/IO.java
IO.registerInputStreamHandler
public static void registerInputStreamHandler(MimeType type, InputStreamHandler handler) { $.requireNotNull(handler); InputStreamHandlerDispatcher dispatcher = inputStreamHandlerLookup.get(type); if (null == dispatcher) { dispatcher = new InputStreamHandlerDispatcher(handler); inputStreamHandlerLookup.put(type, dispatcher); } else { dispatcher.add(handler); } }
java
public static void registerInputStreamHandler(MimeType type, InputStreamHandler handler) { $.requireNotNull(handler); InputStreamHandlerDispatcher dispatcher = inputStreamHandlerLookup.get(type); if (null == dispatcher) { dispatcher = new InputStreamHandlerDispatcher(handler); inputStreamHandlerLookup.put(type, dispatcher); } else { dispatcher.add(handler); } }
[ "public", "static", "void", "registerInputStreamHandler", "(", "MimeType", "type", ",", "InputStreamHandler", "handler", ")", "{", "$", ".", "requireNotNull", "(", "handler", ")", ";", "InputStreamHandlerDispatcher", "dispatcher", "=", "inputStreamHandlerLookup", ".", ...
Associate an {@link InputStreamHandler} with a specific {@link MimeType} @param type The mimetype the handler listen to @param handler the handler
[ "Associate", "an", "{" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/IO.java#L160-L169
indeedeng/util
util-core/src/main/java/com/indeed/util/core/TreeTimer.java
TreeTimer.leftpad
@Nonnull private static String leftpad(@Nonnull String s, int n, char padChar) { int diff = n - s.length(); if (diff <= 0) { return s; } StringBuilder buf = new StringBuilder(n); for (int i = 0; i < diff; ++i) { buf.append(padChar); } buf.append(s); return buf.toString(); }
java
@Nonnull private static String leftpad(@Nonnull String s, int n, char padChar) { int diff = n - s.length(); if (diff <= 0) { return s; } StringBuilder buf = new StringBuilder(n); for (int i = 0; i < diff; ++i) { buf.append(padChar); } buf.append(s); return buf.toString(); }
[ "@", "Nonnull", "private", "static", "String", "leftpad", "(", "@", "Nonnull", "String", "s", ",", "int", "n", ",", "char", "padChar", ")", "{", "int", "diff", "=", "n", "-", "s", ".", "length", "(", ")", ";", "if", "(", "diff", "<=", "0", ")", ...
Left-pads a String with the specific padChar so it is length <code>n</code>. If the String is already at least length n, no padding is done.
[ "Left", "-", "pads", "a", "String", "with", "the", "specific", "padChar", "so", "it", "is", "length", "<code", ">", "n<", "/", "code", ">", ".", "If", "the", "String", "is", "already", "at", "least", "length", "n", "no", "padding", "is", "done", "." ...
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/TreeTimer.java#L90-L103
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/Zealot.java
Zealot.getSqlInfoSimply
public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) { String[] arr = nsAtZealotId.split(ZealotConst.SP_AT); if (arr.length != LEN) { throw new ValidFailException("nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值," + "如:'student@@queryStudentById'.其中student为nameSpace, queryStudentById为XML文件中SQL的zealotId."); } return getSqlInfo(arr[0], arr[1], paramObj); }
java
public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) { String[] arr = nsAtZealotId.split(ZealotConst.SP_AT); if (arr.length != LEN) { throw new ValidFailException("nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值," + "如:'student@@queryStudentById'.其中student为nameSpace, queryStudentById为XML文件中SQL的zealotId."); } return getSqlInfo(arr[0], arr[1], paramObj); }
[ "public", "static", "SqlInfo", "getSqlInfoSimply", "(", "String", "nsAtZealotId", ",", "Object", "paramObj", ")", "{", "String", "[", "]", "arr", "=", "nsAtZealotId", ".", "split", "(", "ZealotConst", ".", "SP_AT", ")", ";", "if", "(", "arr", ".", "length"...
通过传入zealot xml文件对应的命名空间、zealot节点的ID以及参数对象(一般是JavaBean或者Map)的结合体,来简单快速的生成和获取sqlInfo信息(有参的SQL). @param nsAtZealotId xml命名空间nameSpace+@@+zealotId的值.如:"student@@queryStudentById" @param paramObj 参数对象(一般是JavaBean对象或者Map) @return 返回SqlInfo对象
[ "通过传入zealot", "xml文件对应的命名空间、zealot节点的ID以及参数对象", "(", "一般是JavaBean或者Map", ")", "的结合体,来简单快速的生成和获取sqlInfo信息", "(", "有参的SQL", ")", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/Zealot.java#L52-L59
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java
StructureTools.addGroupToStructure
public static Chain addGroupToStructure(Structure s, Group g, int model, Chain chainGuess, boolean clone ) { synchronized(s) { // Find or create the chain String chainId = g.getChainId(); assert !chainId.isEmpty(); Chain chain; if(chainGuess != null && chainGuess.getId() == chainId) { // previously guessed chain chain = chainGuess; } else { // Try to guess chain = s.getChain(chainId, model); if(chain == null) { // no chain found chain = new ChainImpl(); chain.setId(chainId); Chain oldChain = g.getChain(); chain.setName(oldChain.getName()); EntityInfo oldEntityInfo = oldChain.getEntityInfo(); EntityInfo newEntityInfo; if(oldEntityInfo == null) { newEntityInfo = new EntityInfo(); s.addEntityInfo(newEntityInfo); } else { newEntityInfo = s.getEntityById(oldEntityInfo.getMolId()); if( newEntityInfo == null ) { newEntityInfo = new EntityInfo(oldEntityInfo); s.addEntityInfo(newEntityInfo); } } newEntityInfo.addChain(chain); chain.setEntityInfo(newEntityInfo); // TODO Do the seqres need to be cloned too? -SB 2016-10-7 chain.setSeqResGroups(oldChain.getSeqResGroups()); chain.setSeqMisMatches(oldChain.getSeqMisMatches()); s.addChain(chain,model); } } // Add cloned group if(clone) { g = (Group)g.clone(); } chain.addGroup(g); return chain; } }
java
public static Chain addGroupToStructure(Structure s, Group g, int model, Chain chainGuess, boolean clone ) { synchronized(s) { // Find or create the chain String chainId = g.getChainId(); assert !chainId.isEmpty(); Chain chain; if(chainGuess != null && chainGuess.getId() == chainId) { // previously guessed chain chain = chainGuess; } else { // Try to guess chain = s.getChain(chainId, model); if(chain == null) { // no chain found chain = new ChainImpl(); chain.setId(chainId); Chain oldChain = g.getChain(); chain.setName(oldChain.getName()); EntityInfo oldEntityInfo = oldChain.getEntityInfo(); EntityInfo newEntityInfo; if(oldEntityInfo == null) { newEntityInfo = new EntityInfo(); s.addEntityInfo(newEntityInfo); } else { newEntityInfo = s.getEntityById(oldEntityInfo.getMolId()); if( newEntityInfo == null ) { newEntityInfo = new EntityInfo(oldEntityInfo); s.addEntityInfo(newEntityInfo); } } newEntityInfo.addChain(chain); chain.setEntityInfo(newEntityInfo); // TODO Do the seqres need to be cloned too? -SB 2016-10-7 chain.setSeqResGroups(oldChain.getSeqResGroups()); chain.setSeqMisMatches(oldChain.getSeqMisMatches()); s.addChain(chain,model); } } // Add cloned group if(clone) { g = (Group)g.clone(); } chain.addGroup(g); return chain; } }
[ "public", "static", "Chain", "addGroupToStructure", "(", "Structure", "s", ",", "Group", "g", ",", "int", "model", ",", "Chain", "chainGuess", ",", "boolean", "clone", ")", "{", "synchronized", "(", "s", ")", "{", "// Find or create the chain", "String", "chai...
Adds a particular group to a structure. A new chain will be created if necessary. <p>When adding multiple groups, pass the return value of one call as the chainGuess parameter of the next call for efficiency. <pre> Chain guess = null; for(Group g : groups) { guess = addGroupToStructure(s, g, guess ); } </pre> @param s structure to receive the group @param g group to add @param chainGuess (optional) If not null, should be a chain from s. Used to improve performance when adding many groups from the same chain @param clone Indicates whether the input group should be cloned before being added to the new chain @return the chain g was added to
[ "Adds", "a", "particular", "group", "to", "a", "structure", ".", "A", "new", "chain", "will", "be", "created", "if", "necessary", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java#L525-L577
Terracotta-OSS/statistics
src/main/java/org/terracotta/statistics/derived/latency/DefaultLatencyHistogramStatistic.java
DefaultLatencyHistogramStatistic.tryExpire
private void tryExpire(boolean force, LongSupplier time) { long now = time.getAsLong(); if (force || now >= nextPruning) { nextPruning = now + pruningDelay; histogram.expire(now); } }
java
private void tryExpire(boolean force, LongSupplier time) { long now = time.getAsLong(); if (force || now >= nextPruning) { nextPruning = now + pruningDelay; histogram.expire(now); } }
[ "private", "void", "tryExpire", "(", "boolean", "force", ",", "LongSupplier", "time", ")", "{", "long", "now", "=", "time", ".", "getAsLong", "(", ")", ";", "if", "(", "force", "||", "now", ">=", "nextPruning", ")", "{", "nextPruning", "=", "now", "+",...
Expire the histogram if it is time to expire it, or if force is true AND it is dirty
[ "Expire", "the", "histogram", "if", "it", "is", "time", "to", "expire", "it", "or", "if", "force", "is", "true", "AND", "it", "is", "dirty" ]
train
https://github.com/Terracotta-OSS/statistics/blob/d24e4989b8c8dbe4f5210e49c7945d51b6585881/src/main/java/org/terracotta/statistics/derived/latency/DefaultLatencyHistogramStatistic.java#L169-L175
nextreports/nextreports-engine
src/ro/nextreports/engine/util/ReportUtil.java
ReportUtil.foundFunctionInGroupHeader
public static boolean foundFunctionInGroupHeader(ReportLayout layout, String groupName) { List<Band> groupHeaderBands = layout.getGroupHeaderBands(); for (Band band : groupHeaderBands) { if (band.getName().equals(ReportLayout.GROUP_HEADER_BAND_NAME_PREFIX + groupName)) { return foundFunctionInBand(band); } } return false; }
java
public static boolean foundFunctionInGroupHeader(ReportLayout layout, String groupName) { List<Band> groupHeaderBands = layout.getGroupHeaderBands(); for (Band band : groupHeaderBands) { if (band.getName().equals(ReportLayout.GROUP_HEADER_BAND_NAME_PREFIX + groupName)) { return foundFunctionInBand(band); } } return false; }
[ "public", "static", "boolean", "foundFunctionInGroupHeader", "(", "ReportLayout", "layout", ",", "String", "groupName", ")", "{", "List", "<", "Band", ">", "groupHeaderBands", "=", "layout", ".", "getGroupHeaderBands", "(", ")", ";", "for", "(", "Band", "band", ...
Test to see if a function is found in group header band @param layout report layout @param groupName group name @return true if a function is found in group header band, false otherwise
[ "Test", "to", "see", "if", "a", "function", "is", "found", "in", "group", "header", "band" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L1006-L1014
joniles/mpxj
src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java
PrimaveraConvert.processProject
private void processProject(PrimaveraDatabaseReader reader, int projectID, String outputFile) throws Exception { long start = System.currentTimeMillis(); reader.setProjectID(projectID); ProjectFile projectFile = reader.read(); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading database completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
java
private void processProject(PrimaveraDatabaseReader reader, int projectID, String outputFile) throws Exception { long start = System.currentTimeMillis(); reader.setProjectID(projectID); ProjectFile projectFile = reader.read(); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading database completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
[ "private", "void", "processProject", "(", "PrimaveraDatabaseReader", "reader", ",", "int", "projectID", ",", "String", "outputFile", ")", "throws", "Exception", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "reader", ".", "setProj...
Process a single project. @param reader Primavera reader @param projectID required project ID @param outputFile output file name
[ "Process", "a", "single", "project", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java#L114-L128
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/durableexecutor/impl/TaskRingBuffer.java
TaskRingBuffer.putBackup
void putBackup(int sequence, Callable task) { head = Math.max(head, sequence); callableCounter++; int index = toIndex(sequence); ringItems[index] = task; isTask[index] = true; sequences[index] = sequence; }
java
void putBackup(int sequence, Callable task) { head = Math.max(head, sequence); callableCounter++; int index = toIndex(sequence); ringItems[index] = task; isTask[index] = true; sequences[index] = sequence; }
[ "void", "putBackup", "(", "int", "sequence", ",", "Callable", "task", ")", "{", "head", "=", "Math", ".", "max", "(", "head", ",", "sequence", ")", ";", "callableCounter", "++", ";", "int", "index", "=", "toIndex", "(", "sequence", ")", ";", "ringItems...
Puts the task for the given sequence @param sequence The sequence @param task The task
[ "Puts", "the", "task", "for", "the", "given", "sequence" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/durableexecutor/impl/TaskRingBuffer.java#L101-L108
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.appendEventGuardEvaluators
protected void appendEventGuardEvaluators(JvmGenericType container) { final GenerationContext context = getContext(container); if (context != null) { final Collection<Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>>> allEvaluators = context.getGuardEvaluationCodes(); if (allEvaluators == null || allEvaluators.isEmpty()) { return; } final JvmTypeReference voidType = this._typeReferenceBuilder.typeRef(Void.TYPE); final JvmTypeReference runnableType = this._typeReferenceBuilder.typeRef(Runnable.class); final JvmTypeReference collectionType = this._typeReferenceBuilder.typeRef(Collection.class, runnableType); for (final Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>> evaluators : allEvaluators) { final SarlBehaviorUnit source = evaluators.getKey(); // Determine the name of the operation for the behavior output final String behName = Utils.createNameForHiddenGuardGeneralEvaluatorMethod(source.getName().getSimpleName()); // Create the main function final JvmOperation operation = this.typesFactory.createJvmOperation(); // Annotation for the event bus appendGeneratedAnnotation(operation, context); addAnnotationSafe(operation, PerceptGuardEvaluator.class); // Guard evaluator unit parameters // - Event occurrence JvmFormalParameter jvmParam = this.typesFactory.createJvmFormalParameter(); jvmParam.setName(this.grammarKeywordAccess.getOccurrenceKeyword()); jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(source.getName())); this.associator.associate(source, jvmParam); operation.getParameters().add(jvmParam); // - List of runnables jvmParam = this.typesFactory.createJvmFormalParameter(); jvmParam.setName(RUNNABLE_COLLECTION); jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(collectionType)); operation.getParameters().add(jvmParam); operation.setAbstract(false); operation.setNative(false); operation.setSynchronized(false); operation.setStrictFloatingPoint(false); operation.setFinal(false); operation.setVisibility(JvmVisibility.PRIVATE); operation.setStatic(false); operation.setSimpleName(behName); operation.setReturnType(this.typeBuilder.cloneWithProxies(voidType)); container.getMembers().add(operation); setBody(operation, it -> { it.append("assert "); //$NON-NLS-1$ it.append(this.grammarKeywordAccess.getOccurrenceKeyword()); it.append(" != null;"); //$NON-NLS-1$ it.newLine(); it.append("assert "); //$NON-NLS-1$ it.append(RUNNABLE_COLLECTION); it.append(" != null;"); //$NON-NLS-1$ for (final Procedure1<? super ITreeAppendable> code : evaluators.getValue()) { it.newLine(); code.apply(it); } }); this.associator.associatePrimary(source, operation); this.typeBuilder.copyDocumentationTo(source, operation); } } }
java
protected void appendEventGuardEvaluators(JvmGenericType container) { final GenerationContext context = getContext(container); if (context != null) { final Collection<Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>>> allEvaluators = context.getGuardEvaluationCodes(); if (allEvaluators == null || allEvaluators.isEmpty()) { return; } final JvmTypeReference voidType = this._typeReferenceBuilder.typeRef(Void.TYPE); final JvmTypeReference runnableType = this._typeReferenceBuilder.typeRef(Runnable.class); final JvmTypeReference collectionType = this._typeReferenceBuilder.typeRef(Collection.class, runnableType); for (final Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>> evaluators : allEvaluators) { final SarlBehaviorUnit source = evaluators.getKey(); // Determine the name of the operation for the behavior output final String behName = Utils.createNameForHiddenGuardGeneralEvaluatorMethod(source.getName().getSimpleName()); // Create the main function final JvmOperation operation = this.typesFactory.createJvmOperation(); // Annotation for the event bus appendGeneratedAnnotation(operation, context); addAnnotationSafe(operation, PerceptGuardEvaluator.class); // Guard evaluator unit parameters // - Event occurrence JvmFormalParameter jvmParam = this.typesFactory.createJvmFormalParameter(); jvmParam.setName(this.grammarKeywordAccess.getOccurrenceKeyword()); jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(source.getName())); this.associator.associate(source, jvmParam); operation.getParameters().add(jvmParam); // - List of runnables jvmParam = this.typesFactory.createJvmFormalParameter(); jvmParam.setName(RUNNABLE_COLLECTION); jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(collectionType)); operation.getParameters().add(jvmParam); operation.setAbstract(false); operation.setNative(false); operation.setSynchronized(false); operation.setStrictFloatingPoint(false); operation.setFinal(false); operation.setVisibility(JvmVisibility.PRIVATE); operation.setStatic(false); operation.setSimpleName(behName); operation.setReturnType(this.typeBuilder.cloneWithProxies(voidType)); container.getMembers().add(operation); setBody(operation, it -> { it.append("assert "); //$NON-NLS-1$ it.append(this.grammarKeywordAccess.getOccurrenceKeyword()); it.append(" != null;"); //$NON-NLS-1$ it.newLine(); it.append("assert "); //$NON-NLS-1$ it.append(RUNNABLE_COLLECTION); it.append(" != null;"); //$NON-NLS-1$ for (final Procedure1<? super ITreeAppendable> code : evaluators.getValue()) { it.newLine(); code.apply(it); } }); this.associator.associatePrimary(source, operation); this.typeBuilder.copyDocumentationTo(source, operation); } } }
[ "protected", "void", "appendEventGuardEvaluators", "(", "JvmGenericType", "container", ")", "{", "final", "GenerationContext", "context", "=", "getContext", "(", "container", ")", ";", "if", "(", "context", "!=", "null", ")", "{", "final", "Collection", "<", "Pa...
Append the guard evaluators. @param container the container type.
[ "Append", "the", "guard", "evaluators", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L2505-L2572
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.optionalToStream
public final static <T> Stream<T> optionalToStream(final Optional<T> optional) { if (optional.isPresent()) return Stream.of(optional.get()); return Stream.of(); }
java
public final static <T> Stream<T> optionalToStream(final Optional<T> optional) { if (optional.isPresent()) return Stream.of(optional.get()); return Stream.of(); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "T", ">", "optionalToStream", "(", "final", "Optional", "<", "T", ">", "optional", ")", "{", "if", "(", "optional", ".", "isPresent", "(", ")", ")", "return", "Stream", ".", "of", "(", "optio...
Convert an Optional to a Stream <pre> {@code Stream<Integer> stream = Streams.optionalToStream(Optional.of(1)); //Stream[1] Stream<Integer> zero = Streams.optionalToStream(Optional.zero()); //Stream[] } </pre> @param optional Optional to convert to a Stream @return Stream with a single value (if present) created from an Optional
[ "Convert", "an", "Optional", "to", "a", "Stream" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L497-L501
alkacon/opencms-core
src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java
CmsSetupXmlHelper.setValue
public int setValue(String xmlFilename, String xPath, String value, String nodeToInsert) throws CmsXmlException { return setValue(getDocument(xmlFilename), xPath, value, nodeToInsert); }
java
public int setValue(String xmlFilename, String xPath, String value, String nodeToInsert) throws CmsXmlException { return setValue(getDocument(xmlFilename), xPath, value, nodeToInsert); }
[ "public", "int", "setValue", "(", "String", "xmlFilename", ",", "String", "xPath", ",", "String", "value", ",", "String", "nodeToInsert", ")", "throws", "CmsXmlException", "{", "return", "setValue", "(", "getDocument", "(", "xmlFilename", ")", ",", "xPath", ",...
Sets the given value in all nodes identified by the given xpath of the given xml file.<p> If value is <code>null</code>, all nodes identified by the given xpath will be deleted.<p> If the node identified by the given xpath does not exists, the missing nodes will be created (if <code>value</code> not <code>null</code>).<p> @param xmlFilename the xml config file (could be relative to the base path) @param xPath the xpath to set @param value the value to set (can be <code>null</code> for deletion) @param nodeToInsert optional, if given it will be inserted after xPath with the given value @return the number of successful changed or deleted nodes @throws CmsXmlException if something goes wrong
[ "Sets", "the", "given", "value", "in", "all", "nodes", "identified", "by", "the", "given", "xpath", "of", "the", "given", "xml", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java#L486-L489
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/Identity.java
Identity.checkForPrimaryKeys
protected void checkForPrimaryKeys(final Object realObject) throws ClassNotPersistenceCapableException { // if no PKs are specified OJB can't handle this class ! if (m_pkValues == null || m_pkValues.length == 0) { throw createException("OJB needs at least one primary key attribute for class: ", realObject, null); } // arminw: should never happen // if(m_pkValues[0] instanceof ValueContainer) // throw new OJBRuntimeException("Can't handle pk values of type "+ValueContainer.class.getName()); }
java
protected void checkForPrimaryKeys(final Object realObject) throws ClassNotPersistenceCapableException { // if no PKs are specified OJB can't handle this class ! if (m_pkValues == null || m_pkValues.length == 0) { throw createException("OJB needs at least one primary key attribute for class: ", realObject, null); } // arminw: should never happen // if(m_pkValues[0] instanceof ValueContainer) // throw new OJBRuntimeException("Can't handle pk values of type "+ValueContainer.class.getName()); }
[ "protected", "void", "checkForPrimaryKeys", "(", "final", "Object", "realObject", ")", "throws", "ClassNotPersistenceCapableException", "{", "// if no PKs are specified OJB can't handle this class !\r", "if", "(", "m_pkValues", "==", "null", "||", "m_pkValues", ".", "length",...
OJB can handle only classes that declare at least one primary key attribute, this method checks this condition. @param realObject The real object to check @throws ClassNotPersistenceCapableException thrown if no primary key is specified for the objects class
[ "OJB", "can", "handle", "only", "classes", "that", "declare", "at", "least", "one", "primary", "key", "attribute", "this", "method", "checks", "this", "condition", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/Identity.java#L369-L379
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.smoothStep
public static float smoothStep(float a, float b, float x) { if (x < a) return 0; if (x >= b) return 1; x = (x - a) / (b - a); return x*x * (3 - 2*x); }
java
public static float smoothStep(float a, float b, float x) { if (x < a) return 0; if (x >= b) return 1; x = (x - a) / (b - a); return x*x * (3 - 2*x); }
[ "public", "static", "float", "smoothStep", "(", "float", "a", ",", "float", "b", ",", "float", "x", ")", "{", "if", "(", "x", "<", "a", ")", "return", "0", ";", "if", "(", "x", ">=", "b", ")", "return", "1", ";", "x", "=", "(", "x", "-", "a...
A smoothed step function. A cubic function is used to smooth the step between two thresholds. @param a the lower threshold position @param b the upper threshold position @param x the input parameter @return the output value
[ "A", "smoothed", "step", "function", ".", "A", "cubic", "function", "is", "used", "to", "smooth", "the", "step", "between", "two", "thresholds", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L132-L139
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.applyLanguageForContext
@NonNull public static Context applyLanguageForContext(@NonNull Context context, @NonNull Locale locale) { Resources resources = context.getResources(); Configuration config = resources.getConfiguration(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { config.setLocale(locale); return context.createConfigurationContext(config); } else { config.locale = locale; resources.updateConfiguration(config, resources.getDisplayMetrics()); return context; } }
java
@NonNull public static Context applyLanguageForContext(@NonNull Context context, @NonNull Locale locale) { Resources resources = context.getResources(); Configuration config = resources.getConfiguration(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { config.setLocale(locale); return context.createConfigurationContext(config); } else { config.locale = locale; resources.updateConfiguration(config, resources.getDisplayMetrics()); return context; } }
[ "@", "NonNull", "public", "static", "Context", "applyLanguageForContext", "(", "@", "NonNull", "Context", "context", ",", "@", "NonNull", "Locale", "locale", ")", "{", "Resources", "resources", "=", "context", ".", "getResources", "(", ")", ";", "Configuration",...
Setting {@link Locale} for {@link Context}. @param context to set the specified locale context. @param locale locale.
[ "Setting", "{", "@link", "Locale", "}", "for", "{", "@link", "Context", "}", "." ]
train
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L93-L105
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/http/ContextData.java
ContextData.addData
public ContextData addData(Object key, Object value) { if (key == null) { throw new IllegalArgumentException("key cannot be null"); } return new ContextData(this, key, value); }
java
public ContextData addData(Object key, Object value) { if (key == null) { throw new IllegalArgumentException("key cannot be null"); } return new ContextData(this, key, value); }
[ "public", "ContextData", "addData", "(", "Object", "key", ",", "Object", "value", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"key cannot be null\"", ")", ";", "}", "return", "new", "ContextData", "(...
Adds a new immutable {@link ContextData} object with the specified key-value pair to the existing {@link ContextData} chain. @param key the key @param value the value @return the new {@link ContextData} object containing the specified pair added to the set of pairs
[ "Adds", "a", "new", "immutable", "{", "@link", "ContextData", "}", "object", "with", "the", "specified", "key", "-", "value", "pair", "to", "the", "existing", "{", "@link", "ContextData", "}", "chain", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/http/ContextData.java#L56-L61
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java
ServerBlobAuditingPoliciesInner.getAsync
public Observable<ServerBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerBlobAuditingPolicyInner>, ServerBlobAuditingPolicyInner>() { @Override public ServerBlobAuditingPolicyInner call(ServiceResponse<ServerBlobAuditingPolicyInner> response) { return response.body(); } }); }
java
public Observable<ServerBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerBlobAuditingPolicyInner>, ServerBlobAuditingPolicyInner>() { @Override public ServerBlobAuditingPolicyInner call(ServiceResponse<ServerBlobAuditingPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerBlobAuditingPolicyInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "new",...
Gets a server's blob auditing policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerBlobAuditingPolicyInner object
[ "Gets", "a", "server", "s", "blob", "auditing", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java#L106-L113
structr/structr
structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java
AbstractCommand.getRelationship
public AbstractRelationship getRelationship(final String id, final String nodeId) { if (id == null) { return null; } if (nodeId == null) { return getRelationship(id); } final SecurityContext securityContext = getWebSocket().getSecurityContext(); final App app = StructrApp.getInstance(securityContext); try (final Tx tx = app.tx()) { final AbstractNode node = (AbstractNode) app.getNodeById(nodeId); for (final AbstractRelationship rel : node.getRelationships()) { if (rel.getUuid().equals(id)) { return rel; } } tx.success(); } catch (FrameworkException fex) { logger.warn("Unable to get relationship", fex); } return null; }
java
public AbstractRelationship getRelationship(final String id, final String nodeId) { if (id == null) { return null; } if (nodeId == null) { return getRelationship(id); } final SecurityContext securityContext = getWebSocket().getSecurityContext(); final App app = StructrApp.getInstance(securityContext); try (final Tx tx = app.tx()) { final AbstractNode node = (AbstractNode) app.getNodeById(nodeId); for (final AbstractRelationship rel : node.getRelationships()) { if (rel.getUuid().equals(id)) { return rel; } } tx.success(); } catch (FrameworkException fex) { logger.warn("Unable to get relationship", fex); } return null; }
[ "public", "AbstractRelationship", "getRelationship", "(", "final", "String", "id", ",", "final", "String", "nodeId", ")", "{", "if", "(", "id", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "nodeId", "==", "null", ")", "{", "return", "...
Returns the relationship with the given id by looking up a node with the given nodeId and filtering the relationships. This avoids the performance issues of getRelationshipById due to missing index support. If nodeId is null, the method falls back to {@link getRelationship(id)}. @param id @param nodeId @return the node
[ "Returns", "the", "relationship", "with", "the", "given", "id", "by", "looking", "up", "a", "node", "with", "the", "given", "nodeId", "and", "filtering", "the", "relationships", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java#L194-L226
thombergs/docx-stamper
src/main/java/org/wickedsource/docxstamper/util/IndexedRun.java
IndexedRun.isTouchedByRange
public boolean isTouchedByRange(int globalStartIndex, int globalEndIndex) { return ((startIndex >= globalStartIndex) && (startIndex <= globalEndIndex)) || ((endIndex >= globalStartIndex) && (endIndex <= globalEndIndex)) || ((startIndex <= globalStartIndex) && (endIndex >= globalEndIndex)); }
java
public boolean isTouchedByRange(int globalStartIndex, int globalEndIndex) { return ((startIndex >= globalStartIndex) && (startIndex <= globalEndIndex)) || ((endIndex >= globalStartIndex) && (endIndex <= globalEndIndex)) || ((startIndex <= globalStartIndex) && (endIndex >= globalEndIndex)); }
[ "public", "boolean", "isTouchedByRange", "(", "int", "globalStartIndex", ",", "int", "globalEndIndex", ")", "{", "return", "(", "(", "startIndex", ">=", "globalStartIndex", ")", "&&", "(", "startIndex", "<=", "globalEndIndex", ")", ")", "||", "(", "(", "endInd...
Determines whether the specified range of start and end index touches this run.
[ "Determines", "whether", "the", "specified", "range", "of", "start", "and", "end", "index", "touches", "this", "run", "." ]
train
https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/util/IndexedRun.java#L46-L51
dynjs/dynjs
src/main/java/org/dynjs/runtime/modules/ModuleProvider.java
ModuleProvider.getLocalVar
public static Object getLocalVar(ExecutionContext context, String name) { LexicalEnvironment localEnv = context.getLexicalEnvironment(); if (localEnv.getRecord().hasBinding(context, name)) { return localEnv.getRecord().getBindingValue(context, name, false); } return null; }
java
public static Object getLocalVar(ExecutionContext context, String name) { LexicalEnvironment localEnv = context.getLexicalEnvironment(); if (localEnv.getRecord().hasBinding(context, name)) { return localEnv.getRecord().getBindingValue(context, name, false); } return null; }
[ "public", "static", "Object", "getLocalVar", "(", "ExecutionContext", "context", ",", "String", "name", ")", "{", "LexicalEnvironment", "localEnv", "=", "context", ".", "getLexicalEnvironment", "(", ")", ";", "if", "(", "localEnv", ".", "getRecord", "(", ")", ...
A convenience for module providers. Gets a scoped variable from the provided ExecutionContext @param context The context to search for name @param name The name of the variable @return The value of the variable
[ "A", "convenience", "for", "module", "providers", ".", "Gets", "a", "scoped", "variable", "from", "the", "provided", "ExecutionContext" ]
train
https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/runtime/modules/ModuleProvider.java#L58-L64
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/cemi/CEMILDataEx.java
CEMILDataEx.addAdditionalInfo
public synchronized void addAdditionalInfo(int infoType, byte[] info) { if (infoType < 0 || infoType >= ADDINFO_ESC) throw new KNXIllegalArgumentException("info type out of range [0..254]"); if (!checkAddInfoLength(infoType, info.length)) throw new KNXIllegalArgumentException("wrong info data length, expected " + ADDINFO_LENGTHS[infoType] + " bytes"); putAddInfo(infoType, info); }
java
public synchronized void addAdditionalInfo(int infoType, byte[] info) { if (infoType < 0 || infoType >= ADDINFO_ESC) throw new KNXIllegalArgumentException("info type out of range [0..254]"); if (!checkAddInfoLength(infoType, info.length)) throw new KNXIllegalArgumentException("wrong info data length, expected " + ADDINFO_LENGTHS[infoType] + " bytes"); putAddInfo(infoType, info); }
[ "public", "synchronized", "void", "addAdditionalInfo", "(", "int", "infoType", ",", "byte", "[", "]", "info", ")", "{", "if", "(", "infoType", "<", "0", "||", "infoType", ">=", "ADDINFO_ESC", ")", "throw", "new", "KNXIllegalArgumentException", "(", "\"info typ...
Adds additional information to the message. <p> It replaces additional information of the same type, if any was previously added. @param infoType type ID of additional information @param info additional information data
[ "Adds", "additional", "information", "to", "the", "message", ".", "<p", ">", "It", "replaces", "additional", "information", "of", "the", "same", "type", "if", "any", "was", "previously", "added", "." ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/cemi/CEMILDataEx.java#L326-L334
Alluxio/alluxio
core/common/src/main/java/alluxio/conf/AlluxioProperties.java
AlluxioProperties.set
public void set(PropertyKey key, String value) { put(key, value, Source.RUNTIME); }
java
public void set(PropertyKey key, String value) { put(key, value, Source.RUNTIME); }
[ "public", "void", "set", "(", "PropertyKey", "key", ",", "String", "value", ")", "{", "put", "(", "key", ",", "value", ",", "Source", ".", "RUNTIME", ")", ";", "}" ]
Puts the key value pair specified by users. @param key key to put @param value value to put
[ "Puts", "the", "key", "value", "pair", "specified", "by", "users", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/conf/AlluxioProperties.java#L115-L117
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/MultiColumnText.java
MultiColumnText.addColumn
public void addColumn(float[] left, float[] right) { ColumnDef nextDef = new ColumnDef(left, right); if (!nextDef.isSimple()) simple = false; columnDefs.add(nextDef); }
java
public void addColumn(float[] left, float[] right) { ColumnDef nextDef = new ColumnDef(left, right); if (!nextDef.isSimple()) simple = false; columnDefs.add(nextDef); }
[ "public", "void", "addColumn", "(", "float", "[", "]", "left", ",", "float", "[", "]", "right", ")", "{", "ColumnDef", "nextDef", "=", "new", "ColumnDef", "(", "left", ",", "right", ")", ";", "if", "(", "!", "nextDef", ".", "isSimple", "(", ")", ")...
Add a new column. The parameters are limits for each column wall in the format of a sequence of points (x1,y1,x2,y2,...). @param left limits for left column @param right limits for right column
[ "Add", "a", "new", "column", ".", "The", "parameters", "are", "limits", "for", "each", "column", "wall", "in", "the", "format", "of", "a", "sequence", "of", "points", "(", "x1", "y1", "x2", "y2", "...", ")", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/MultiColumnText.java#L191-L195
msteiger/jxmapviewer2
jxmapviewer2/src/main/java/org/jxmapviewer/viewer/util/GeoUtil.java
GeoUtil.getBitmapCoordinate
public static Point2D getBitmapCoordinate(GeoPosition c, int zoomLevel, TileFactoryInfo info) { return getBitmapCoordinate(c.getLatitude(), c.getLongitude(), zoomLevel, info); }
java
public static Point2D getBitmapCoordinate(GeoPosition c, int zoomLevel, TileFactoryInfo info) { return getBitmapCoordinate(c.getLatitude(), c.getLongitude(), zoomLevel, info); }
[ "public", "static", "Point2D", "getBitmapCoordinate", "(", "GeoPosition", "c", ",", "int", "zoomLevel", ",", "TileFactoryInfo", "info", ")", "{", "return", "getBitmapCoordinate", "(", "c", ".", "getLatitude", "(", ")", ",", "c", ".", "getLongitude", "(", ")", ...
Given a position (latitude/longitude pair) and a zoom level, return the appropriate point in <em>pixels</em>. The zoom level is necessary because pixel coordinates are in terms of the zoom level @param c A lat/lon pair @param zoomLevel the zoom level to extract the pixel coordinate for @param info the tile factory info @return the coordinate
[ "Given", "a", "position", "(", "latitude", "/", "longitude", "pair", ")", "and", "a", "zoom", "level", "return", "the", "appropriate", "point", "in", "<em", ">", "pixels<", "/", "em", ">", ".", "The", "zoom", "level", "is", "necessary", "because", "pixel...
train
https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/util/GeoUtil.java#L84-L87
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ChangeOnChangeHandler.java
ChangeOnChangeHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { if (m_bSetModified) m_fldTarget.setModified(true); return m_fldTarget.handleFieldChanged(bDisplayOption, iMoveMode); // init dependent field }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { if (m_bSetModified) m_fldTarget.setModified(true); return m_fldTarget.handleFieldChanged(bDisplayOption, iMoveMode); // init dependent field }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "m_bSetModified", ")", "m_fldTarget", ".", "setModified", "(", "true", ")", ";", "return", "m_fldTarget", ".", "handleFieldChanged", "(", "bDisplayOp...
The Field has Changed. Initialize the target field also. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay). Field Changed, init the field.
[ "The", "Field", "has", "Changed", ".", "Initialize", "the", "target", "field", "also", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangeOnChangeHandler.java#L109-L114
craftercms/commons
utilities/src/main/java/org/craftercms/commons/zip/ZipUtils.java
ZipUtils.unZipFiles
public static void unZipFiles(File zipFile, File outputFolder) throws IOException { InputStream is = new BufferedInputStream(new FileInputStream(zipFile)); try { unZipFiles(is, outputFolder); } finally { IOUtils.closeQuietly(is); } }
java
public static void unZipFiles(File zipFile, File outputFolder) throws IOException { InputStream is = new BufferedInputStream(new FileInputStream(zipFile)); try { unZipFiles(is, outputFolder); } finally { IOUtils.closeQuietly(is); } }
[ "public", "static", "void", "unZipFiles", "(", "File", "zipFile", ",", "File", "outputFolder", ")", "throws", "IOException", "{", "InputStream", "is", "=", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "zipFile", ")", ")", ";", "try", "{", ...
Unzips a zip file into an output folder. @param zipFile the zip file @param outputFolder the output folder where the files @throws IOException
[ "Unzips", "a", "zip", "file", "into", "an", "output", "folder", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/zip/ZipUtils.java#L117-L124
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java
ReplyFactory.getReusableAudioAttachment
public static AttachmentMessageBuilder getReusableAudioAttachment(String attachmentId) { AttachmentPayload payload = new AttachmentPayload(); payload.setAttachmentId(attachmentId); return new AttachmentMessageBuilder(AttachmentType.AUDIO, payload); }
java
public static AttachmentMessageBuilder getReusableAudioAttachment(String attachmentId) { AttachmentPayload payload = new AttachmentPayload(); payload.setAttachmentId(attachmentId); return new AttachmentMessageBuilder(AttachmentType.AUDIO, payload); }
[ "public", "static", "AttachmentMessageBuilder", "getReusableAudioAttachment", "(", "String", "attachmentId", ")", "{", "AttachmentPayload", "payload", "=", "new", "AttachmentPayload", "(", ")", ";", "payload", ".", "setAttachmentId", "(", "attachmentId", ")", ";", "re...
Get the reusable audio attachment @param attachmentId the attachment id generated by the upload api @return a builder for the response. @see <a href= "https://developers.facebook.com/docs/messenger-platform/send-api-reference/audio-attachment" > Facebook's Messenger Platform Audio Attachment Documentation</a>
[ "Get", "the", "reusable", "audio", "attachment" ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java#L169-L173
XDean/Java-EX
src/main/java/xdean/jex/util/reflect/TypeVisitor.java
TypeVisitor.of
public static <T> T of(Type type, Function<TypeVisitor<T>, T> function) { return function.apply(create(type)); }
java
public static <T> T of(Type type, Function<TypeVisitor<T>, T> function) { return function.apply(create(type)); }
[ "public", "static", "<", "T", ">", "T", "of", "(", "Type", "type", ",", "Function", "<", "TypeVisitor", "<", "T", ">", ",", "T", ">", "function", ")", "{", "return", "function", ".", "apply", "(", "create", "(", "type", ")", ")", ";", "}" ]
Because eclipse's type inference is so bad, use this method you can free from angle brackets. @param type @param function @return
[ "Because", "eclipse", "s", "type", "inference", "is", "so", "bad", "use", "this", "method", "you", "can", "free", "from", "angle", "brackets", "." ]
train
https://github.com/XDean/Java-EX/blob/9208ba71c5b2af9f9bd979d01fab2ff5e433b3e7/src/main/java/xdean/jex/util/reflect/TypeVisitor.java#L26-L28
craftercms/deployer
src/main/java/org/craftercms/deployer/impl/rest/ExceptionHandlers.java
ExceptionHandlers.handleTargetNotFoundException
@ExceptionHandler(TargetNotFoundException.class) public ResponseEntity<Object> handleTargetNotFoundException(TargetNotFoundException ex, WebRequest request) { return handleExceptionInternal(ex, "Target not found", new HttpHeaders(), HttpStatus.NOT_FOUND, request); }
java
@ExceptionHandler(TargetNotFoundException.class) public ResponseEntity<Object> handleTargetNotFoundException(TargetNotFoundException ex, WebRequest request) { return handleExceptionInternal(ex, "Target not found", new HttpHeaders(), HttpStatus.NOT_FOUND, request); }
[ "@", "ExceptionHandler", "(", "TargetNotFoundException", ".", "class", ")", "public", "ResponseEntity", "<", "Object", ">", "handleTargetNotFoundException", "(", "TargetNotFoundException", "ex", ",", "WebRequest", "request", ")", "{", "return", "handleExceptionInternal", ...
Handles a {@link TargetNotFoundException} by returning a 404 NOT FOUND. @param ex the exception @param request the current request @return the response entity, with the body and status
[ "Handles", "a", "{", "@link", "TargetNotFoundException", "}", "by", "returning", "a", "404", "NOT", "FOUND", "." ]
train
https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/impl/rest/ExceptionHandlers.java#L47-L50
openengsb/openengsb
api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java
TransformationDescription.splitRegexField
public void splitRegexField(String sourceField, String targetField, String regexString, String index) { TransformationStep step = new TransformationStep(); step.setTargetField(targetField); step.setSourceFields(sourceField); step.setOperationParameter(TransformationConstants.REGEX_PARAM, regexString); step.setOperationParameter(TransformationConstants.INDEX_PARAM, index); step.setOperationName("splitRegex"); steps.add(step); }
java
public void splitRegexField(String sourceField, String targetField, String regexString, String index) { TransformationStep step = new TransformationStep(); step.setTargetField(targetField); step.setSourceFields(sourceField); step.setOperationParameter(TransformationConstants.REGEX_PARAM, regexString); step.setOperationParameter(TransformationConstants.INDEX_PARAM, index); step.setOperationName("splitRegex"); steps.add(step); }
[ "public", "void", "splitRegexField", "(", "String", "sourceField", ",", "String", "targetField", ",", "String", "regexString", ",", "String", "index", ")", "{", "TransformationStep", "step", "=", "new", "TransformationStep", "(", ")", ";", "step", ".", "setTarge...
Adds a split regex transformation step to the transformation description. The value of the source field is split based on the split string as regular expression into parts. Based on the given index, the result will be set to the target field. The index needs to be an integer value. All fields need to be of the type String.
[ "Adds", "a", "split", "regex", "transformation", "step", "to", "the", "transformation", "description", ".", "The", "value", "of", "the", "source", "field", "is", "split", "based", "on", "the", "split", "string", "as", "regular", "expression", "into", "parts", ...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/ekb/src/main/java/org/openengsb/core/ekb/api/transformation/TransformationDescription.java#L110-L118
vdurmont/emoji-java
src/main/java/com/vdurmont/emoji/EmojiParser.java
EmojiParser.parseToHtmlDecimal
public static String parseToHtmlDecimal( String input, final FitzpatrickAction fitzpatrickAction ) { EmojiTransformer emojiTransformer = new EmojiTransformer() { public String transform(UnicodeCandidate unicodeCandidate) { switch (fitzpatrickAction) { default: case PARSE: case REMOVE: return unicodeCandidate.getEmoji().getHtmlDecimal(); case IGNORE: return unicodeCandidate.getEmoji().getHtmlDecimal() + unicodeCandidate.getFitzpatrickUnicode(); } } }; return parseFromUnicode(input, emojiTransformer); }
java
public static String parseToHtmlDecimal( String input, final FitzpatrickAction fitzpatrickAction ) { EmojiTransformer emojiTransformer = new EmojiTransformer() { public String transform(UnicodeCandidate unicodeCandidate) { switch (fitzpatrickAction) { default: case PARSE: case REMOVE: return unicodeCandidate.getEmoji().getHtmlDecimal(); case IGNORE: return unicodeCandidate.getEmoji().getHtmlDecimal() + unicodeCandidate.getFitzpatrickUnicode(); } } }; return parseFromUnicode(input, emojiTransformer); }
[ "public", "static", "String", "parseToHtmlDecimal", "(", "String", "input", ",", "final", "FitzpatrickAction", "fitzpatrickAction", ")", "{", "EmojiTransformer", "emojiTransformer", "=", "new", "EmojiTransformer", "(", ")", "{", "public", "String", "transform", "(", ...
Replaces the emoji's unicode occurrences by their html representation.<br> Example: <code>😄</code> will be replaced by <code>&amp;#128516;</code><br> <br> When a fitzpatrick modifier is present with a PARSE or REMOVE action, the modifier will be deleted from the string.<br> Example: <code>👦🏿</code> will be replaced by <code>&amp;#128102;</code><br> <br> When a fitzpatrick modifier is present with a IGNORE action, the modifier will be ignored and will remain in the string.<br> Example: <code>👦🏿</code> will be replaced by <code>&amp;#128102;🏿</code> @param input the string to parse @param fitzpatrickAction the action to apply for the fitzpatrick modifiers @return the string with the emojis replaced by their html decimal representation.
[ "Replaces", "the", "emoji", "s", "unicode", "occurrences", "by", "their", "html", "representation", ".", "<br", ">", "Example", ":", "<code", ">", "😄<", "/", "code", ">", "will", "be", "replaced", "by", "<code", ">", "&amp", ";", "#128516", ";", "<", ...
train
https://github.com/vdurmont/emoji-java/blob/8cf5fbe0d7c1020b926791f2b342a263ed07bb0f/src/main/java/com/vdurmont/emoji/EmojiParser.java#L206-L225
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Consumers.java
Consumers.pipe
public static <E> void pipe(Iterator<E> iterator, OutputIterator<E> outputIterator) { new ConsumeIntoOutputIterator<>(outputIterator).apply(iterator); }
java
public static <E> void pipe(Iterator<E> iterator, OutputIterator<E> outputIterator) { new ConsumeIntoOutputIterator<>(outputIterator).apply(iterator); }
[ "public", "static", "<", "E", ">", "void", "pipe", "(", "Iterator", "<", "E", ">", "iterator", ",", "OutputIterator", "<", "E", ">", "outputIterator", ")", "{", "new", "ConsumeIntoOutputIterator", "<>", "(", "outputIterator", ")", ".", "apply", "(", "itera...
Consumes the input iterator to the output iterator. @param <E> the iterator element type @param iterator the iterator that will be consumed @param outputIterator the iterator that will be filled
[ "Consumes", "the", "input", "iterator", "to", "the", "output", "iterator", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Consumers.java#L311-L313
beangle/beangle3
ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java
BeanDefinitionParser.parsePropertySubElement
public Object parsePropertySubElement(Element ele, BeanDefinition bd) { return parsePropertySubElement(ele, bd, null); }
java
public Object parsePropertySubElement(Element ele, BeanDefinition bd) { return parsePropertySubElement(ele, bd, null); }
[ "public", "Object", "parsePropertySubElement", "(", "Element", "ele", ",", "BeanDefinition", "bd", ")", "{", "return", "parsePropertySubElement", "(", "ele", ",", "bd", ",", "null", ")", ";", "}" ]
<p> parsePropertySubElement. </p> @param ele a {@link org.w3c.dom.Element} object. @param bd a {@link org.springframework.beans.factory.config.BeanDefinition} object. @return a {@link java.lang.Object} object.
[ "<p", ">", "parsePropertySubElement", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L650-L652
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ExtensionScript.java
ExtensionScript.handleScriptException
public void handleScriptException(ScriptWrapper script, Exception exception) { handleScriptException(script, getWriters(script), exception); }
java
public void handleScriptException(ScriptWrapper script, Exception exception) { handleScriptException(script, getWriters(script), exception); }
[ "public", "void", "handleScriptException", "(", "ScriptWrapper", "script", ",", "Exception", "exception", ")", "{", "handleScriptException", "(", "script", ",", "getWriters", "(", "script", ")", ",", "exception", ")", ";", "}" ]
Handles exceptions thrown by scripts. <p> The given {@code exception} (if of type {@code ScriptException} the cause will be used instead) will be written to the the writer(s) associated with the given {@code script}, moreover it will be disabled and flagged that has an error. @param script the script that resulted in an exception, must not be {@code null} @param exception the exception thrown , must not be {@code null} @since 2.5.0 @see #setEnabled(ScriptWrapper, boolean) @see #setError(ScriptWrapper, Exception) @see #handleFailedScriptInterface(ScriptWrapper, String) @see ScriptException
[ "Handles", "exceptions", "thrown", "by", "scripts", ".", "<p", ">", "The", "given", "{", "@code", "exception", "}", "(", "if", "of", "type", "{", "@code", "ScriptException", "}", "the", "cause", "will", "be", "used", "instead", ")", "will", "be", "writte...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ExtensionScript.java#L1346-L1348
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/reflect/ReflectUtil.java
ReflectUtil.getClassPackageNames
private static void getClassPackageNames(Class<?> clazz, Map<String, Class<?>> packageNames) { if (isPrivate(clazz)) { throw new IllegalArgumentException(PrettyPrinter.format( "Unable to inject an instance of %s because it is a private class.", clazz)); } else if (!isPublic(clazz)) { packageNames.put(clazz.getPackage().getName(), clazz); } Class<?> enclosingClass = clazz.getEnclosingClass(); if (enclosingClass != null) { getClassPackageNames(enclosingClass, packageNames); } }
java
private static void getClassPackageNames(Class<?> clazz, Map<String, Class<?>> packageNames) { if (isPrivate(clazz)) { throw new IllegalArgumentException(PrettyPrinter.format( "Unable to inject an instance of %s because it is a private class.", clazz)); } else if (!isPublic(clazz)) { packageNames.put(clazz.getPackage().getName(), clazz); } Class<?> enclosingClass = clazz.getEnclosingClass(); if (enclosingClass != null) { getClassPackageNames(enclosingClass, packageNames); } }
[ "private", "static", "void", "getClassPackageNames", "(", "Class", "<", "?", ">", "clazz", ",", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "packageNames", ")", "{", "if", "(", "isPrivate", "(", "clazz", ")", ")", "{", "throw", "new", "Il...
Visits classes to collect package names. @see {@link #getTypePackageNames}.
[ "Visits", "classes", "to", "collect", "package", "names", "." ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/reflect/ReflectUtil.java#L235-L247
cattaka/CatHandsGendroid
cathandsgendroid-apt/src/main/java/net/cattaka/util/cathandsgendroid/apt/Bug300408.java
Bug300408.getEnclosedElementsDeclarationOrder
public static List<? extends Element> getEnclosedElementsDeclarationOrder(TypeElement type) { List<? extends Element> result = null; try { Object binding = field(type, "_binding"); Class<?> sourceTypeBinding = null; { Class<?> c = binding.getClass(); do { if (c.getCanonicalName().equals( "org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding")) { sourceTypeBinding = c; break; } } while ((c = c.getSuperclass()) != null); } final List<Object> declarationOrder; if (sourceTypeBinding != null) { declarationOrder = findSourceOrder(binding); List<Element> enclosedElements = new ArrayList<Element>(type.getEnclosedElements()); Collections.sort(enclosedElements, new Comparator<Element>() { public int compare(Element o1, Element o2) { try { Object o1Binding = field(o1, "_binding"); Object o2Binding = field(o2, "_binding"); int i1 = declarationOrder.indexOf(o1Binding); int i2 = declarationOrder.indexOf(o2Binding); return i1 - i2; } catch (Exception e) { return 0; } } }); result = enclosedElements; } } catch (Exception e) { // ignore } return (result != null) ? result : type.getEnclosedElements(); }
java
public static List<? extends Element> getEnclosedElementsDeclarationOrder(TypeElement type) { List<? extends Element> result = null; try { Object binding = field(type, "_binding"); Class<?> sourceTypeBinding = null; { Class<?> c = binding.getClass(); do { if (c.getCanonicalName().equals( "org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding")) { sourceTypeBinding = c; break; } } while ((c = c.getSuperclass()) != null); } final List<Object> declarationOrder; if (sourceTypeBinding != null) { declarationOrder = findSourceOrder(binding); List<Element> enclosedElements = new ArrayList<Element>(type.getEnclosedElements()); Collections.sort(enclosedElements, new Comparator<Element>() { public int compare(Element o1, Element o2) { try { Object o1Binding = field(o1, "_binding"); Object o2Binding = field(o2, "_binding"); int i1 = declarationOrder.indexOf(o1Binding); int i2 = declarationOrder.indexOf(o2Binding); return i1 - i2; } catch (Exception e) { return 0; } } }); result = enclosedElements; } } catch (Exception e) { // ignore } return (result != null) ? result : type.getEnclosedElements(); }
[ "public", "static", "List", "<", "?", "extends", "Element", ">", "getEnclosedElementsDeclarationOrder", "(", "TypeElement", "type", ")", "{", "List", "<", "?", "extends", "Element", ">", "result", "=", "null", ";", "try", "{", "Object", "binding", "=", "fiel...
If given TypeElement is SourceTypeBinding, the order of results are corrected. @param type target @return the enclosed elements, or an empty list if none
[ "If", "given", "TypeElement", "is", "SourceTypeBinding", "the", "order", "of", "results", "are", "corrected", "." ]
train
https://github.com/cattaka/CatHandsGendroid/blob/6e496cc5901e0e1be2142c69cab898f61974db4d/cathandsgendroid-apt/src/main/java/net/cattaka/util/cathandsgendroid/apt/Bug300408.java#L28-L73
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BloomFilter.java
BloomFilter.estimateFalsePositiveProbability
public static double estimateFalsePositiveProbability(long inputEntries, int bitSize) { int numFunction = optimalNumOfHashFunctions(inputEntries, bitSize); double p = Math.pow(Math.E, -(double) numFunction * inputEntries / bitSize); double estimatedFPP = Math.pow(1 - p, numFunction); return estimatedFPP; }
java
public static double estimateFalsePositiveProbability(long inputEntries, int bitSize) { int numFunction = optimalNumOfHashFunctions(inputEntries, bitSize); double p = Math.pow(Math.E, -(double) numFunction * inputEntries / bitSize); double estimatedFPP = Math.pow(1 - p, numFunction); return estimatedFPP; }
[ "public", "static", "double", "estimateFalsePositiveProbability", "(", "long", "inputEntries", ",", "int", "bitSize", ")", "{", "int", "numFunction", "=", "optimalNumOfHashFunctions", "(", "inputEntries", ",", "bitSize", ")", ";", "double", "p", "=", "Math", ".", ...
Compute the false positive probability based on given input entries and bits size. Note: this is just the math expected value, you should not expect the fpp in real case would under the return value for certain. @param inputEntries @param bitSize @return
[ "Compute", "the", "false", "positive", "probability", "based", "on", "given", "input", "entries", "and", "bits", "size", ".", "Note", ":", "this", "is", "just", "the", "math", "expected", "value", "you", "should", "not", "expect", "the", "fpp", "in", "real...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BloomFilter.java#L82-L87
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/ui/CmsToolbarGalleryMenu.java
CmsToolbarGalleryMenu.updateGalleryData
public void updateGalleryData(CmsContainerPageGalleryData galleryData, boolean viewChanged) { if (m_dialog != null) { if (viewChanged) { m_dialog.removeFromParent(); m_dialog = null; } else { m_dialog.updateGalleryData(galleryData.getGalleryData()); } } m_galleryData = galleryData.getGalleryData(); m_search = galleryData.getGallerySearch(); }
java
public void updateGalleryData(CmsContainerPageGalleryData galleryData, boolean viewChanged) { if (m_dialog != null) { if (viewChanged) { m_dialog.removeFromParent(); m_dialog = null; } else { m_dialog.updateGalleryData(galleryData.getGalleryData()); } } m_galleryData = galleryData.getGalleryData(); m_search = galleryData.getGallerySearch(); }
[ "public", "void", "updateGalleryData", "(", "CmsContainerPageGalleryData", "galleryData", ",", "boolean", "viewChanged", ")", "{", "if", "(", "m_dialog", "!=", "null", ")", "{", "if", "(", "viewChanged", ")", "{", "m_dialog", ".", "removeFromParent", "(", ")", ...
Updates the gallery data.<p> @param galleryData the gallery data @param viewChanged <code>true</code> in case the element view changed
[ "Updates", "the", "gallery", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/CmsToolbarGalleryMenu.java#L214-L226
apache/incubator-gobblin
gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryValueInspector.java
InMemoryValueInspector.getResolvedConfig
@Override public Config getResolvedConfig(final ConfigKeyPath configKey) { return getResolvedConfig(configKey, Optional.<Config>absent()); }
java
@Override public Config getResolvedConfig(final ConfigKeyPath configKey) { return getResolvedConfig(configKey, Optional.<Config>absent()); }
[ "@", "Override", "public", "Config", "getResolvedConfig", "(", "final", "ConfigKeyPath", "configKey", ")", "{", "return", "getResolvedConfig", "(", "configKey", ",", "Optional", ".", "<", "Config", ">", "absent", "(", ")", ")", ";", "}" ]
{@inheritDoc}. <p> If present in the cache, return the cached {@link com.typesafe.config.Config} for given input Otherwise, simply delegate the functionality to the internal {ConfigStoreValueInspector} and store the value into cache </p>
[ "{", "@inheritDoc", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryValueInspector.java#L96-L99
landawn/AbacusUtil
src/com/landawn/abacus/util/URLEncodedUtil.java
URLEncodedUtil.encodeFormFields
private static void encodeFormFields(final StringBuilder sb, final String content, final Charset charset) { urlEncode(sb, content, (charset != null) ? charset : Charsets.UTF_8, URLENCODER, true); }
java
private static void encodeFormFields(final StringBuilder sb, final String content, final Charset charset) { urlEncode(sb, content, (charset != null) ? charset : Charsets.UTF_8, URLENCODER, true); }
[ "private", "static", "void", "encodeFormFields", "(", "final", "StringBuilder", "sb", ",", "final", "String", "content", ",", "final", "Charset", "charset", ")", "{", "urlEncode", "(", "sb", ",", "content", ",", "(", "charset", "!=", "null", ")", "?", "cha...
Encode/escape www-url-form-encoded content. <p> Uses the {@link #URLENCODER} set of characters, rather than the {@link #UNRSERVED} set; this is for compatibilty with previous releases, URLEncoder.encode() and most browsers. @param content the content to encode, will convert space to '+' @param charset the charset to use @return encoded string
[ "Encode", "/", "escape", "www", "-", "url", "-", "form", "-", "encoded", "content", ".", "<p", ">", "Uses", "the", "{", "@link", "#URLENCODER", "}", "set", "of", "characters", "rather", "than", "the", "{", "@link", "#UNRSERVED", "}", "set", ";", "this"...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/URLEncodedUtil.java#L472-L474
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java
MultiUserChat.changeAffiliationByAdmin
private void changeAffiliationByAdmin(Jid jid, MUCAffiliation affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { changeAffiliationByAdmin(jid, affiliation, null); }
java
private void changeAffiliationByAdmin(Jid jid, MUCAffiliation affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { changeAffiliationByAdmin(jid, affiliation, null); }
[ "private", "void", "changeAffiliationByAdmin", "(", "Jid", "jid", ",", "MUCAffiliation", "affiliation", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "changeAffiliationByAdmin", "(", "jid", ...
Tries to change the affiliation with an 'muc#admin' namespace @param jid @param affiliation @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Tries", "to", "change", "the", "affiliation", "with", "an", "muc#admin", "namespace" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java#L1597-L1601
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserDefault.java
AbstractGpxParserDefault.startElement
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (localName.compareToIgnoreCase(GPXTags.GPX) == 0) { version = attributes.getValue(GPXTags.VERSION); creator = attributes.getValue(GPXTags.CREATOR); } else if (localName.compareToIgnoreCase(GPXTags.BOUNDS) == 0) { minLat = Double.parseDouble(attributes.getValue(GPXTags.MINLAT)); maxLat = Double.parseDouble(attributes.getValue(GPXTags.MAXLAT)); minLon = Double.parseDouble(attributes.getValue(GPXTags.MINLON)); maxLon = Double.parseDouble(attributes.getValue(GPXTags.MAXLON)); } // Clear content buffer getContentBuffer() .delete(0, getContentBuffer().length()); // Store name of current element in stack getElementNames() .push(qName); }
java
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (localName.compareToIgnoreCase(GPXTags.GPX) == 0) { version = attributes.getValue(GPXTags.VERSION); creator = attributes.getValue(GPXTags.CREATOR); } else if (localName.compareToIgnoreCase(GPXTags.BOUNDS) == 0) { minLat = Double.parseDouble(attributes.getValue(GPXTags.MINLAT)); maxLat = Double.parseDouble(attributes.getValue(GPXTags.MAXLAT)); minLon = Double.parseDouble(attributes.getValue(GPXTags.MINLON)); maxLon = Double.parseDouble(attributes.getValue(GPXTags.MAXLON)); } // Clear content buffer getContentBuffer() .delete(0, getContentBuffer().length()); // Store name of current element in stack getElementNames() .push(qName); }
[ "@", "Override", "public", "void", "startElement", "(", "String", "uri", ",", "String", "localName", ",", "String", "qName", ",", "Attributes", "attributes", ")", "throws", "SAXException", "{", "if", "(", "localName", ".", "compareToIgnoreCase", "(", "GPXTags", ...
Fires whenever an XML start markup is encountered. It takes general information about the document. It change the ContentHandler to parse specific informations when <wpt>, <rte> or <trk> markup are found. @param uri URI of the local element @param localName Name of the local element (without prefix) @param qName qName of the local element (with prefix) @param attributes Attributes of the local element (contained in the markup) @throws SAXException Any SAX exception, possibly wrapping another exception
[ "Fires", "whenever", "an", "XML", "start", "markup", "is", "encountered", ".", "It", "takes", "general", "information", "about", "the", "document", ".", "It", "change", "the", "ContentHandler", "to", "parse", "specific", "informations", "when", "<wpt", ">", "<...
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserDefault.java#L231-L249
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java
Las.getReader
public static ALasReader getReader( File lasFile, CoordinateReferenceSystem crs ) throws Exception { if (supportsNative()) { return new LiblasReader(lasFile, crs); } else { return new LasReaderBuffered(lasFile, crs); } }
java
public static ALasReader getReader( File lasFile, CoordinateReferenceSystem crs ) throws Exception { if (supportsNative()) { return new LiblasReader(lasFile, crs); } else { return new LasReaderBuffered(lasFile, crs); } }
[ "public", "static", "ALasReader", "getReader", "(", "File", "lasFile", ",", "CoordinateReferenceSystem", "crs", ")", "throws", "Exception", "{", "if", "(", "supportsNative", "(", ")", ")", "{", "return", "new", "LiblasReader", "(", "lasFile", ",", "crs", ")", ...
Get a las reader. <p>If available, a native reader is created. @param lasFile the file to read. @param crs the {@link CoordinateReferenceSystem} or <code>null</code> if the file has one. @return the las reader. @throws Exception if something goes wrong.
[ "Get", "a", "las", "reader", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java#L84-L90
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java
TreeScanner.visitAssignment
@Override public R visitAssignment(AssignmentTree node, P p) { R r = scan(node.getVariable(), p); r = scanAndReduce(node.getExpression(), p, r); return r; }
java
@Override public R visitAssignment(AssignmentTree node, P p) { R r = scan(node.getVariable(), p); r = scanAndReduce(node.getExpression(), p, r); return r; }
[ "@", "Override", "public", "R", "visitAssignment", "(", "AssignmentTree", "node", ",", "P", "p", ")", "{", "R", "r", "=", "scan", "(", "node", ".", "getVariable", "(", ")", ",", "p", ")", ";", "r", "=", "scanAndReduce", "(", "node", ".", "getExpressi...
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L582-L587
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.getLong
@PublicEvolving public long getLong(ConfigOption<Long> configOption) { Object o = getValueOrDefaultFromOption(configOption); return convertToLong(o, configOption.defaultValue()); }
java
@PublicEvolving public long getLong(ConfigOption<Long> configOption) { Object o = getValueOrDefaultFromOption(configOption); return convertToLong(o, configOption.defaultValue()); }
[ "@", "PublicEvolving", "public", "long", "getLong", "(", "ConfigOption", "<", "Long", ">", "configOption", ")", "{", "Object", "o", "=", "getValueOrDefaultFromOption", "(", "configOption", ")", ";", "return", "convertToLong", "(", "o", ",", "configOption", ".", ...
Returns the value associated with the given config option as a long integer. @param configOption The configuration option @return the (default) value associated with the given config option
[ "Returns", "the", "value", "associated", "with", "the", "given", "config", "option", "as", "a", "long", "integer", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L293-L297
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/protocol/file/FileURLConnection.java
FileURLConnection.getPermission
public Permission getPermission() throws IOException { if (permission == null) { String decodedPath = ParseUtil.decode(url.getPath()); if (File.separatorChar == '/') { permission = new FilePermission(decodedPath, "read"); } else { permission = new FilePermission( decodedPath.replace('/',File.separatorChar), "read"); } } return permission; }
java
public Permission getPermission() throws IOException { if (permission == null) { String decodedPath = ParseUtil.decode(url.getPath()); if (File.separatorChar == '/') { permission = new FilePermission(decodedPath, "read"); } else { permission = new FilePermission( decodedPath.replace('/',File.separatorChar), "read"); } } return permission; }
[ "public", "Permission", "getPermission", "(", ")", "throws", "IOException", "{", "if", "(", "permission", "==", "null", ")", "{", "String", "decodedPath", "=", "ParseUtil", ".", "decode", "(", "url", ".", "getPath", "(", ")", ")", ";", "if", "(", "File",...
/* since getOutputStream isn't supported, only read permission is relevant
[ "/", "*", "since", "getOutputStream", "isn", "t", "supported", "only", "read", "permission", "is", "relevant" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/protocol/file/FileURLConnection.java#L222-L233
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java
SerializerBase.subPartMatch
private static final boolean subPartMatch(String p, String t) { return (p == t) || ((null != p) && (p.equals(t))); }
java
private static final boolean subPartMatch(String p, String t) { return (p == t) || ((null != p) && (p.equals(t))); }
[ "private", "static", "final", "boolean", "subPartMatch", "(", "String", "p", ",", "String", "t", ")", "{", "return", "(", "p", "==", "t", ")", "||", "(", "(", "null", "!=", "p", ")", "&&", "(", "p", ".", "equals", "(", "t", ")", ")", ")", ";", ...
Tell if two strings are equal, without worry if the first string is null. @param p String reference, which may be null. @param t String reference, which may be null. @return true if strings are equal.
[ "Tell", "if", "two", "strings", "are", "equal", "without", "worry", "if", "the", "first", "string", "is", "null", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L805-L808
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Media.java
Media.saveMediaDataToFile
public static void saveMediaDataToFile(byte[] mediaData, String fileName) throws FileNotFoundException, IOException { saveMediaDataToFile(mediaData, new File(fileName)); }
java
public static void saveMediaDataToFile(byte[] mediaData, String fileName) throws FileNotFoundException, IOException { saveMediaDataToFile(mediaData, new File(fileName)); }
[ "public", "static", "void", "saveMediaDataToFile", "(", "byte", "[", "]", "mediaData", ",", "String", "fileName", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "saveMediaDataToFile", "(", "mediaData", ",", "new", "File", "(", "fileName", ")", ...
Saves media data downloaded from an API in {@code byte[]} format into a file on the file system. @param mediaData the media data {@code byte[]} to store on the file system @param fileName the name of the file on the file system to save the media data into @throws FileNotFoundException if the file exists but is a directory, does not exist but cannot be created, or cannot be opened for any reason @throws IOException if the file cannot be written to
[ "Saves", "media", "data", "downloaded", "from", "an", "API", "in", "{", "@code", "byte", "[]", "}", "format", "into", "a", "file", "on", "the", "file", "system", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Media.java#L114-L117
google/closure-compiler
src/com/google/javascript/jscomp/Linter.java
Linter.fixRepeatedly
void fixRepeatedly(String filename, ImmutableSet<DiagnosticType> unfixableErrors) throws IOException { for (int i = 0; i < MAX_FIXES; i++) { if (!fix(filename, unfixableErrors)) { break; } } }
java
void fixRepeatedly(String filename, ImmutableSet<DiagnosticType> unfixableErrors) throws IOException { for (int i = 0; i < MAX_FIXES; i++) { if (!fix(filename, unfixableErrors)) { break; } } }
[ "void", "fixRepeatedly", "(", "String", "filename", ",", "ImmutableSet", "<", "DiagnosticType", ">", "unfixableErrors", ")", "throws", "IOException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "MAX_FIXES", ";", "i", "++", ")", "{", "if", "(", ...
Keep applying fixes to the given file until no more fixes can be found, or until fixes have been applied {@code MAX_FIXES} times.
[ "Keep", "applying", "fixes", "to", "the", "given", "file", "until", "no", "more", "fixes", "can", "be", "found", "or", "until", "fixes", "have", "been", "applied", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Linter.java#L143-L150
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/crypto/PEMHelper.java
PEMHelper.loadCertificates
public static KeyStore loadCertificates(final File pemFile) { try (final PemReader pem = new PemReader(new FileReader(pemFile))) { final KeyStore ks = createEmptyKeyStore(); int certIndex = 0; Object obj; while ((obj = parse(pem.readPemObject())) != null) { if (obj instanceof Certificate) { final Certificate cert = (Certificate) obj; ks.setCertificateEntry("cert" + Integer.toString(certIndex++), cert); } else { throw new RuntimeException("Unknown PEM contents: " + obj + ". Expected a Certificate"); } } return ks; } catch (Exception e) { throw new RuntimeException("Error parsing PEM " + pemFile, e); } }
java
public static KeyStore loadCertificates(final File pemFile) { try (final PemReader pem = new PemReader(new FileReader(pemFile))) { final KeyStore ks = createEmptyKeyStore(); int certIndex = 0; Object obj; while ((obj = parse(pem.readPemObject())) != null) { if (obj instanceof Certificate) { final Certificate cert = (Certificate) obj; ks.setCertificateEntry("cert" + Integer.toString(certIndex++), cert); } else { throw new RuntimeException("Unknown PEM contents: " + obj + ". Expected a Certificate"); } } return ks; } catch (Exception e) { throw new RuntimeException("Error parsing PEM " + pemFile, e); } }
[ "public", "static", "KeyStore", "loadCertificates", "(", "final", "File", "pemFile", ")", "{", "try", "(", "final", "PemReader", "pem", "=", "new", "PemReader", "(", "new", "FileReader", "(", "pemFile", ")", ")", ")", "{", "final", "KeyStore", "ks", "=", ...
Load one or more X.509 Certificates from a PEM file @param pemFile A PKCS8 PEM file containing only <code>CERTIFICATE</code> / <code>X.509 CERTIFICATE</code> blocks @return a JKS KeyStore with the certificate aliases "cert<code>index</code>" where index is the 0-based index of the certificate in the PEM @throws RuntimeException if a problem occurs
[ "Load", "one", "or", "more", "X", ".", "509", "Certificates", "from", "a", "PEM", "file" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/crypto/PEMHelper.java#L40-L68
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java
DockerAgentUtils.updateImageParent
private static boolean updateImageParent(JenkinsBuildInfoLog log, String imageTag, String host, int buildInfoId) throws IOException { boolean parentUpdated = false; for (DockerImage image : getImagesByBuildId(buildInfoId)) { if (image.getImageTag().equals(imageTag)) { String parentId = DockerUtils.getParentId(image.getImageId(), host); if (StringUtils.isNotEmpty(parentId)) { Properties properties = new Properties(); properties.setProperty("docker.image.parent", DockerUtils.getShaValue(parentId)); image.addBuildInfoModuleProps(properties); } log.info("Docker build-info captured on '" + image.getAgentName() + "' agent."); parentUpdated = true; } } return parentUpdated; }
java
private static boolean updateImageParent(JenkinsBuildInfoLog log, String imageTag, String host, int buildInfoId) throws IOException { boolean parentUpdated = false; for (DockerImage image : getImagesByBuildId(buildInfoId)) { if (image.getImageTag().equals(imageTag)) { String parentId = DockerUtils.getParentId(image.getImageId(), host); if (StringUtils.isNotEmpty(parentId)) { Properties properties = new Properties(); properties.setProperty("docker.image.parent", DockerUtils.getShaValue(parentId)); image.addBuildInfoModuleProps(properties); } log.info("Docker build-info captured on '" + image.getAgentName() + "' agent."); parentUpdated = true; } } return parentUpdated; }
[ "private", "static", "boolean", "updateImageParent", "(", "JenkinsBuildInfoLog", "log", ",", "String", "imageTag", ",", "String", "host", ",", "int", "buildInfoId", ")", "throws", "IOException", "{", "boolean", "parentUpdated", "=", "false", ";", "for", "(", "Do...
Adds the docker image parent (the base image) as property on the docker image. This property will be later added to the generated build-info deployed to Artifactory. @param log @param imageTag @param host @param buildInfoId @return @throws IOException
[ "Adds", "the", "docker", "image", "parent", "(", "the", "base", "image", ")", "as", "property", "on", "the", "docker", "image", ".", "This", "property", "will", "be", "later", "added", "to", "the", "generated", "build", "-", "info", "deployed", "to", "Ar...
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java#L255-L270
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java
ServerTaskExecutor.executeOperation
protected boolean executeOperation(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, TransactionalProtocolClient client, final ServerIdentity identity, final ModelNode operation, final OperationResultTransformer transformer) { if(client == null) { return false; } final OperationMessageHandler messageHandler = new DelegatingMessageHandler(context); final OperationAttachments operationAttachments = new DelegatingOperationAttachments(context); final ServerOperation serverOperation = new ServerOperation(identity, operation, messageHandler, operationAttachments, transformer); try { DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Sending %s to %s", operation, identity); final Future<OperationResponse> result = client.execute(listener, serverOperation); recordExecutedRequest(new ExecutedServerRequest(identity, result, transformer)); } catch (IOException e) { final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e); listener.operationPrepared(result); recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), transformer)); } return true; }
java
protected boolean executeOperation(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, TransactionalProtocolClient client, final ServerIdentity identity, final ModelNode operation, final OperationResultTransformer transformer) { if(client == null) { return false; } final OperationMessageHandler messageHandler = new DelegatingMessageHandler(context); final OperationAttachments operationAttachments = new DelegatingOperationAttachments(context); final ServerOperation serverOperation = new ServerOperation(identity, operation, messageHandler, operationAttachments, transformer); try { DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Sending %s to %s", operation, identity); final Future<OperationResponse> result = client.execute(listener, serverOperation); recordExecutedRequest(new ExecutedServerRequest(identity, result, transformer)); } catch (IOException e) { final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e); listener.operationPrepared(result); recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), transformer)); } return true; }
[ "protected", "boolean", "executeOperation", "(", "final", "TransactionalProtocolClient", ".", "TransactionalOperationListener", "<", "ServerOperation", ">", "listener", ",", "TransactionalProtocolClient", "client", ",", "final", "ServerIdentity", "identity", ",", "final", "...
Execute the operation. @param listener the transactional operation listener @param client the transactional protocol client @param identity the server identity @param operation the operation @param transformer the operation result transformer @return whether the operation was executed
[ "Execute", "the", "operation", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L113-L130
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java
ToUnknownStream.elementDecl
public void elementDecl(String arg0, String arg1) throws SAXException { if (m_firstTagNotEmitted) { emitFirstTag(); } m_handler.elementDecl(arg0, arg1); }
java
public void elementDecl(String arg0, String arg1) throws SAXException { if (m_firstTagNotEmitted) { emitFirstTag(); } m_handler.elementDecl(arg0, arg1); }
[ "public", "void", "elementDecl", "(", "String", "arg0", ",", "String", "arg1", ")", "throws", "SAXException", "{", "if", "(", "m_firstTagNotEmitted", ")", "{", "emitFirstTag", "(", ")", ";", "}", "m_handler", ".", "elementDecl", "(", "arg0", ",", "arg1", "...
Pass the call on to the underlying handler @see org.xml.sax.ext.DeclHandler#elementDecl(String, String)
[ "Pass", "the", "call", "on", "to", "the", "underlying", "handler" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java#L733-L740
lucee/Lucee
core/src/main/java/lucee/runtime/db/HSQLDBHandler.java
HSQLDBHandler.removeTable
private static void removeTable(Connection conn, String name) throws SQLException { name = name.replace('.', '_'); Statement stat = conn.createStatement(); stat.execute("DROP TABLE " + name); DBUtil.commitEL(conn); }
java
private static void removeTable(Connection conn, String name) throws SQLException { name = name.replace('.', '_'); Statement stat = conn.createStatement(); stat.execute("DROP TABLE " + name); DBUtil.commitEL(conn); }
[ "private", "static", "void", "removeTable", "(", "Connection", "conn", ",", "String", "name", ")", "throws", "SQLException", "{", "name", "=", "name", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "Statement", "stat", "=", "conn", ".", "creat...
remove a table from the memory database @param conn @param name @throws DatabaseException
[ "remove", "a", "table", "from", "the", "memory", "database" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/db/HSQLDBHandler.java#L200-L205
apache/groovy
src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java
ExpressionUtils.isNumberOrArrayOfNumber
public static boolean isNumberOrArrayOfNumber(ClassNode targetType, boolean recurse) { if (targetType == null) return false; return targetType.isDerivedFrom(ClassHelper.Number_TYPE) || (targetType.isArray() && recurse ? isNumberOrArrayOfNumber(targetType.getComponentType(), recurse) : targetType.isArray() && targetType.getComponentType().isDerivedFrom(ClassHelper.Number_TYPE)); }
java
public static boolean isNumberOrArrayOfNumber(ClassNode targetType, boolean recurse) { if (targetType == null) return false; return targetType.isDerivedFrom(ClassHelper.Number_TYPE) || (targetType.isArray() && recurse ? isNumberOrArrayOfNumber(targetType.getComponentType(), recurse) : targetType.isArray() && targetType.getComponentType().isDerivedFrom(ClassHelper.Number_TYPE)); }
[ "public", "static", "boolean", "isNumberOrArrayOfNumber", "(", "ClassNode", "targetType", ",", "boolean", "recurse", ")", "{", "if", "(", "targetType", "==", "null", ")", "return", "false", ";", "return", "targetType", ".", "isDerivedFrom", "(", "ClassHelper", "...
Determine if a type is derived from Number (or array thereof). @param targetType the candidate type @param recurse true if we can have multi-dimension arrays; should be false for annotation member types @return true if the type equals the targetType or array thereof
[ "Determine", "if", "a", "type", "is", "derived", "from", "Number", "(", "or", "array", "thereof", ")", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java#L196-L202
GoogleCloudPlatform/appengine-plugins-core
src/main/java/com/google/cloud/tools/appengine/AppEngineDescriptor.java
AppEngineDescriptor.getEnvironment
public Map<String, String> getEnvironment() throws AppEngineException { Node environmentParentNode = getNode(document, "appengine-web-app", "env-variables"); if (environmentParentNode != null) { return getAttributeMap(environmentParentNode, "env-var", "name", "value"); } return new HashMap<>(); }
java
public Map<String, String> getEnvironment() throws AppEngineException { Node environmentParentNode = getNode(document, "appengine-web-app", "env-variables"); if (environmentParentNode != null) { return getAttributeMap(environmentParentNode, "env-var", "name", "value"); } return new HashMap<>(); }
[ "public", "Map", "<", "String", ",", "String", ">", "getEnvironment", "(", ")", "throws", "AppEngineException", "{", "Node", "environmentParentNode", "=", "getNode", "(", "document", ",", "\"appengine-web-app\"", ",", "\"env-variables\"", ")", ";", "if", "(", "e...
Given the following structure: <pre>{@code <env-variables> <env-var name="key" value="val" /> </env-variables> }</pre> <p>This will construct a map of the form {[key, value], ...}. @return a map representing the environment variable settings in the appengine-web.xml
[ "Given", "the", "following", "structure", ":" ]
train
https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/d22e9fa1103522409ab6fdfbf68c4a5a0bc5b97d/src/main/java/com/google/cloud/tools/appengine/AppEngineDescriptor.java#L134-L140
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/ColorUtils.java
ColorUtils.HSVtoRGB
public static Color HSVtoRGB (float h, float s, float v, Color targetColor) { if (h == 360) h = 359; int r, g, b; int i; float f, p, q, t; h = (float) Math.max(0.0, Math.min(360.0, h)); s = (float) Math.max(0.0, Math.min(100.0, s)); v = (float) Math.max(0.0, Math.min(100.0, v)); s /= 100; v /= 100; h /= 60; i = MathUtils.floor(h); f = h - i; p = v * (1 - s); q = v * (1 - s * f); t = v * (1 - s * (1 - f)); switch (i) { case 0: r = MathUtils.round(255 * v); g = MathUtils.round(255 * t); b = MathUtils.round(255 * p); break; case 1: r = MathUtils.round(255 * q); g = MathUtils.round(255 * v); b = MathUtils.round(255 * p); break; case 2: r = MathUtils.round(255 * p); g = MathUtils.round(255 * v); b = MathUtils.round(255 * t); break; case 3: r = MathUtils.round(255 * p); g = MathUtils.round(255 * q); b = MathUtils.round(255 * v); break; case 4: r = MathUtils.round(255 * t); g = MathUtils.round(255 * p); b = MathUtils.round(255 * v); break; default: r = MathUtils.round(255 * v); g = MathUtils.round(255 * p); b = MathUtils.round(255 * q); } targetColor.set(r / 255.0f, g / 255.0f, b / 255.0f, targetColor.a); return targetColor; }
java
public static Color HSVtoRGB (float h, float s, float v, Color targetColor) { if (h == 360) h = 359; int r, g, b; int i; float f, p, q, t; h = (float) Math.max(0.0, Math.min(360.0, h)); s = (float) Math.max(0.0, Math.min(100.0, s)); v = (float) Math.max(0.0, Math.min(100.0, v)); s /= 100; v /= 100; h /= 60; i = MathUtils.floor(h); f = h - i; p = v * (1 - s); q = v * (1 - s * f); t = v * (1 - s * (1 - f)); switch (i) { case 0: r = MathUtils.round(255 * v); g = MathUtils.round(255 * t); b = MathUtils.round(255 * p); break; case 1: r = MathUtils.round(255 * q); g = MathUtils.round(255 * v); b = MathUtils.round(255 * p); break; case 2: r = MathUtils.round(255 * p); g = MathUtils.round(255 * v); b = MathUtils.round(255 * t); break; case 3: r = MathUtils.round(255 * p); g = MathUtils.round(255 * q); b = MathUtils.round(255 * v); break; case 4: r = MathUtils.round(255 * t); g = MathUtils.round(255 * p); b = MathUtils.round(255 * v); break; default: r = MathUtils.round(255 * v); g = MathUtils.round(255 * p); b = MathUtils.round(255 * q); } targetColor.set(r / 255.0f, g / 255.0f, b / 255.0f, targetColor.a); return targetColor; }
[ "public", "static", "Color", "HSVtoRGB", "(", "float", "h", ",", "float", "s", ",", "float", "v", ",", "Color", "targetColor", ")", "{", "if", "(", "h", "==", "360", ")", "h", "=", "359", ";", "int", "r", ",", "g", ",", "b", ";", "int", "i", ...
Converts HSV color system to RGB @param h hue 0-360 @param s saturation 0-100 @param v value 0-100 @param targetColor color that result will be stored in @return targetColor
[ "Converts", "HSV", "color", "system", "to", "RGB" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/ColorUtils.java#L63-L113
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java
PhotosApi.setTags
public Response setTags(String photoId, List<String> tags) throws JinxException { JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.setTags"); params.put("photo_id", photoId); if (tags == null || tags.size() == 0) { params.put("tags", ""); } else { StringBuilder sb = new StringBuilder(); for (String tag : tags) { if (tag.contains(" ")) { sb.append('"').append(tag).append('"'); } else { sb.append(tag); } sb.append(' '); } sb.deleteCharAt(sb.length() - 1); params.put("tags", sb.toString()); } return this.jinx.flickrPost(params, Response.class); }
java
public Response setTags(String photoId, List<String> tags) throws JinxException { JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.setTags"); params.put("photo_id", photoId); if (tags == null || tags.size() == 0) { params.put("tags", ""); } else { StringBuilder sb = new StringBuilder(); for (String tag : tags) { if (tag.contains(" ")) { sb.append('"').append(tag).append('"'); } else { sb.append(tag); } sb.append(' '); } sb.deleteCharAt(sb.length() - 1); params.put("tags", sb.toString()); } return this.jinx.flickrPost(params, Response.class); }
[ "public", "Response", "setTags", "(", "String", "photoId", ",", "List", "<", "String", ">", "tags", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photoId", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", ...
Set the tags for a photo. <br> This method requires authentication with 'write' permission. <br> Each tag in the list will be treated as a single tag. This method will automatically add quotation marks as needed so that multi-word tags will be treated correctly by Flickr. This method can also be used to add machine tags. <br> This list of tags will replace the tags that currently exist on the photo. <br> If the tag list is null or empty, all tags will be removed from the photo. @param photoId id of the photo to set tags for. @param tags all tags for the photo, one tag per list element. If this parameter is null or empty, all tags will be removed from the photo. @return response object with status of the requested operation. @throws JinxException if photo id is null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.setTags.html">flickr.photos.setTags</a>
[ "Set", "the", "tags", "for", "a", "photo", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "write", "permission", ".", "<br", ">", "Each", "tag", "in", "the", "list", "will", "be", "treated", "as", "a", "single", "tag", ".", "T...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L1032-L1053
Azure/azure-sdk-for-java
mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java
ServersInner.getByResourceGroupAsync
public Observable<ServerInner> getByResourceGroupAsync(String resourceGroupName, String serverName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerInner>, ServerInner>() { @Override public ServerInner call(ServiceResponse<ServerInner> response) { return response.body(); } }); }
java
public Observable<ServerInner> getByResourceGroupAsync(String resourceGroupName, String serverName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerInner>, ServerInner>() { @Override public ServerInner call(ServiceResponse<ServerInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "...
Gets information about a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerInner object
[ "Gets", "information", "about", "a", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java#L640-L647
Addicticks/httpsupload
src/main/java/com/addicticks/net/httpsupload/HttpsFileUploaderConfig.java
HttpsFileUploaderConfig.setAdditionalHeaders
public void setAdditionalHeaders(Map<String,String> additionalHeaders) { Map<String, String> newMap = new HashMap<>(); for (Entry<String,String> e : additionalHeaders.entrySet()) { boolean found = false; for(String restrictedHeaderField : RESTRICTED_HTTP_HEADERS) { if (e.getKey().equalsIgnoreCase(restrictedHeaderField)) { found = true; break; } } if (!found) { newMap.put(e.getKey(), e.getValue()); } } this.additionalHeaders = newMap; }
java
public void setAdditionalHeaders(Map<String,String> additionalHeaders) { Map<String, String> newMap = new HashMap<>(); for (Entry<String,String> e : additionalHeaders.entrySet()) { boolean found = false; for(String restrictedHeaderField : RESTRICTED_HTTP_HEADERS) { if (e.getKey().equalsIgnoreCase(restrictedHeaderField)) { found = true; break; } } if (!found) { newMap.put(e.getKey(), e.getValue()); } } this.additionalHeaders = newMap; }
[ "public", "void", "setAdditionalHeaders", "(", "Map", "<", "String", ",", "String", ">", "additionalHeaders", ")", "{", "Map", "<", "String", ",", "String", ">", "newMap", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Entry", "<", "String", ...
Sets additional overall HTTP headers to add to the upload POST request. There's rarely a need to use this method. <p>The following header fields are automatically set: <pre> "Connection" "Cache-Control" "Content-Type" "Content-Length" "Authorization" </pre> and you must <i>never</i> set these here. (if you do they will be ignored) <p>However you might want to use this method to explicitly set e.g. {@code User-Agent} or non-standard header fields that are required for your particular endpoint. For example by overriding {@code User-Agent} you can make the upload operation look to the endpoint as if it comes from a browser. @param additionalHeaders Map of HTTP request headers. The key is the header field name and the value is the header field value.
[ "Sets", "additional", "overall", "HTTP", "headers", "to", "add", "to", "the", "upload", "POST", "request", ".", "There", "s", "rarely", "a", "need", "to", "use", "this", "method", "." ]
train
https://github.com/Addicticks/httpsupload/blob/261a8e63ec923482a74ffe1352024c1900c55a55/src/main/java/com/addicticks/net/httpsupload/HttpsFileUploaderConfig.java#L327-L343
ModeShape/modeshape
web/modeshape-web-explorer/src/main/java/org/modeshape/web/BackupUploadServlet.java
BackupUploadServlet.processRequest
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<FileItem> items; // Parse the request try { items = upload.parseRequest(request); } catch (FileUploadException e) { throw new ServletException(e); } String repository = getParameter(items, REPOSITORY_NAME_PARAMETER); String incBinaries = getParameter(items, INCLUDE_BINARY_PARAMETER); String reindexOnFinish = getParameter(items, REINDEX_ON_FINISH_PARAMETER); RestoreParams params = new RestoreParams(); params.setIncludeBinaries(Boolean.valueOf(incBinaries)); params.setReindexOnFinish(Boolean.valueOf(reindexOnFinish)); InputStream in = getStream(items); File dir = new File(tempDir.getAbsolutePath() + File.pathSeparator + Long.toString(System.currentTimeMillis())); FileUtil.unzip(in, dir.getAbsolutePath()); Connector connector = (Connector) request.getSession().getAttribute(REPOSITORY_CONNECTOR); try { connector.find(repository).restore(dir.getAbsolutePath(), params); } catch (Exception e) { throw new ServletException(e); } String uri = request.getContextPath() + String.format(DESTINATION_URL, repository); response.sendRedirect(uri); }
java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<FileItem> items; // Parse the request try { items = upload.parseRequest(request); } catch (FileUploadException e) { throw new ServletException(e); } String repository = getParameter(items, REPOSITORY_NAME_PARAMETER); String incBinaries = getParameter(items, INCLUDE_BINARY_PARAMETER); String reindexOnFinish = getParameter(items, REINDEX_ON_FINISH_PARAMETER); RestoreParams params = new RestoreParams(); params.setIncludeBinaries(Boolean.valueOf(incBinaries)); params.setReindexOnFinish(Boolean.valueOf(reindexOnFinish)); InputStream in = getStream(items); File dir = new File(tempDir.getAbsolutePath() + File.pathSeparator + Long.toString(System.currentTimeMillis())); FileUtil.unzip(in, dir.getAbsolutePath()); Connector connector = (Connector) request.getSession().getAttribute(REPOSITORY_CONNECTOR); try { connector.find(repository).restore(dir.getAbsolutePath(), params); } catch (Exception e) { throw new ServletException(e); } String uri = request.getContextPath() + String.format(DESTINATION_URL, repository); response.sendRedirect(uri); }
[ "protected", "void", "processRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "List", "<", "FileItem", ">", "items", ";", "// Parse the request", "try", "{", "items", ...
Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. @param request servlet request @param response servlet response @throws ServletException if a servlet-specific error occurs @throws IOException if an I/O error occurs
[ "Processes", "requests", "for", "both", "HTTP", "<code", ">", "GET<", "/", "code", ">", "and", "<code", ">", "POST<", "/", "code", ">", "methods", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/BackupUploadServlet.java#L61-L96