repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.addHours
private void addHours(ProjectCalendarDateRanges ranges, Record hoursRecord) { if (hoursRecord.getValue() != null) { String[] wh = hoursRecord.getValue().split("\\|"); try { String startText; String endText; if (wh[0].equals("s")) { startText = wh[1]; endText = wh[3]; } else { startText = wh[3]; endText = wh[1]; } // for end time treat midnight as midnight next day if (endText.equals("00:00")) { endText = "24:00"; } Date start = m_calendarTimeFormat.parse(startText); Date end = m_calendarTimeFormat.parse(endText); ranges.addRange(new DateRange(start, end)); } catch (ParseException e) { // silently ignore date parse exceptions } } }
java
private void addHours(ProjectCalendarDateRanges ranges, Record hoursRecord) { if (hoursRecord.getValue() != null) { String[] wh = hoursRecord.getValue().split("\\|"); try { String startText; String endText; if (wh[0].equals("s")) { startText = wh[1]; endText = wh[3]; } else { startText = wh[3]; endText = wh[1]; } // for end time treat midnight as midnight next day if (endText.equals("00:00")) { endText = "24:00"; } Date start = m_calendarTimeFormat.parse(startText); Date end = m_calendarTimeFormat.parse(endText); ranges.addRange(new DateRange(start, end)); } catch (ParseException e) { // silently ignore date parse exceptions } } }
[ "private", "void", "addHours", "(", "ProjectCalendarDateRanges", "ranges", ",", "Record", "hoursRecord", ")", "{", "if", "(", "hoursRecord", ".", "getValue", "(", ")", "!=", "null", ")", "{", "String", "[", "]", "wh", "=", "hoursRecord", ".", "getValue", "...
Parses a record containing hours and add them to a container. @param ranges hours container @param hoursRecord hours record
[ "Parses", "a", "record", "containing", "hours", "and", "add", "them", "to", "a", "container", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L410-L446
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java
DistributedFileSystem.setQuota
public void setQuota(Path src, long namespaceQuota, long diskspaceQuota) throws IOException { dfs.setQuota(getPathName(src), namespaceQuota, diskspaceQuota); }
java
public void setQuota(Path src, long namespaceQuota, long diskspaceQuota) throws IOException { dfs.setQuota(getPathName(src), namespaceQuota, diskspaceQuota); }
[ "public", "void", "setQuota", "(", "Path", "src", ",", "long", "namespaceQuota", ",", "long", "diskspaceQuota", ")", "throws", "IOException", "{", "dfs", ".", "setQuota", "(", "getPathName", "(", "src", ")", ",", "namespaceQuota", ",", "diskspaceQuota", ")", ...
Set a directory's quotas @see org.apache.hadoop.hdfs.protocol.ClientProtocol#setQuota(String, long, long)
[ "Set", "a", "directory", "s", "quotas" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java#L501-L504
haifengl/smile
plot/src/main/java/smile/plot/Graphics.java
Graphics.fillRectBaseRatio
public void fillRectBaseRatio(double[] topLeft, double[] rightBottom) { if (!(projection instanceof Projection2D)) { throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles."); } int[] sc = projection.screenProjectionBaseRatio(topLeft); int[] sc2 = projection.screenProjectionBaseRatio(rightBottom); g2d.fillRect(sc[0], sc[1], sc2[0] - sc[0], sc2[1] - sc[1]); }
java
public void fillRectBaseRatio(double[] topLeft, double[] rightBottom) { if (!(projection instanceof Projection2D)) { throw new UnsupportedOperationException("Only 2D graphics supports drawing rectangles."); } int[] sc = projection.screenProjectionBaseRatio(topLeft); int[] sc2 = projection.screenProjectionBaseRatio(rightBottom); g2d.fillRect(sc[0], sc[1], sc2[0] - sc[0], sc2[1] - sc[1]); }
[ "public", "void", "fillRectBaseRatio", "(", "double", "[", "]", "topLeft", ",", "double", "[", "]", "rightBottom", ")", "{", "if", "(", "!", "(", "projection", "instanceof", "Projection2D", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ...
Fill the specified rectangle. The logical coordinates are proportional to the base coordinates.
[ "Fill", "the", "specified", "rectangle", ".", "The", "logical", "coordinates", "are", "proportional", "to", "the", "base", "coordinates", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L562-L571
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/BinaryImageOps.java
BinaryImageOps.edge4
public static GrayU8 edge4(GrayU8 input, GrayU8 output, boolean outsideZero ) { output = InputSanityCheck.checkDeclare(input, output); if( BoofConcurrency.USE_CONCURRENT ) { ImplBinaryInnerOps_MT.edge4(input, output); } else { ImplBinaryInnerOps.edge4(input, output); } ImplBinaryBorderOps.edge4(input, output, outsideZero); return output; }
java
public static GrayU8 edge4(GrayU8 input, GrayU8 output, boolean outsideZero ) { output = InputSanityCheck.checkDeclare(input, output); if( BoofConcurrency.USE_CONCURRENT ) { ImplBinaryInnerOps_MT.edge4(input, output); } else { ImplBinaryInnerOps.edge4(input, output); } ImplBinaryBorderOps.edge4(input, output, outsideZero); return output; }
[ "public", "static", "GrayU8", "edge4", "(", "GrayU8", "input", ",", "GrayU8", "output", ",", "boolean", "outsideZero", ")", "{", "output", "=", "InputSanityCheck", ".", "checkDeclare", "(", "input", ",", "output", ")", ";", "if", "(", "BoofConcurrency", ".",...
<p> Binary operation which is designed to remove all pixels but ones which are on the edge of an object. The edge is defined as lying on the object and not being surrounded by a pixel along a 4-neighborhood. </p> <p/> <p> NOTE: There are many ways to define an edge, this is just one of them. </p> @param input Input image. Not modified. @param output If not null, the output image. If null a new image is declared and returned. Modified. @param outsideZero if true then pixels outside the image are treated as zero, otherwise one @return Output image.
[ "<p", ">", "Binary", "operation", "which", "is", "designed", "to", "remove", "all", "pixels", "but", "ones", "which", "are", "on", "the", "edge", "of", "an", "object", ".", "The", "edge", "is", "defined", "as", "lying", "on", "the", "object", "and", "n...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/BinaryImageOps.java#L258-L269
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Betner.java
Betner.between
protected Betner between(String left, String right, Character sameTagMatch) { return inrange(left, right, sameTagMatch); }
java
protected Betner between(String left, String right, Character sameTagMatch) { return inrange(left, right, sameTagMatch); }
[ "protected", "Betner", "between", "(", "String", "left", ",", "String", "right", ",", "Character", "sameTagMatch", ")", "{", "return", "inrange", "(", "left", ",", "right", ",", "sameTagMatch", ")", ";", "}" ]
Reset the range from the given left and right with same tag match way 'N': NEXT, 'E': LAST, 'R': NOLEFT, 'L': NORIGHT @param left @param right @param sameTagMatch @return
[ "Reset", "the", "range", "from", "the", "given", "left", "and", "right", "with", "same", "tag", "match", "way", "N", ":", "NEXT", "E", ":", "LAST", "R", ":", "NOLEFT", "L", ":", "NORIGHT" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Betner.java#L336-L338
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/loaders/context/SimpleXMLDeDupContextLoader.java
SimpleXMLDeDupContextLoader.moveChildren
private void moveChildren(INode source, INode target) { List<INode> children = new ArrayList<INode>(source.getChildrenList()); while (0 < children.size()) { INode child = children.remove(0); int idx = target.getChildIndex(child); if (-1 == idx) { target.addChild(child); } else { moveChildren(child, target.getChildAt(idx)); } } }
java
private void moveChildren(INode source, INode target) { List<INode> children = new ArrayList<INode>(source.getChildrenList()); while (0 < children.size()) { INode child = children.remove(0); int idx = target.getChildIndex(child); if (-1 == idx) { target.addChild(child); } else { moveChildren(child, target.getChildAt(idx)); } } }
[ "private", "void", "moveChildren", "(", "INode", "source", ",", "INode", "target", ")", "{", "List", "<", "INode", ">", "children", "=", "new", "ArrayList", "<", "INode", ">", "(", "source", ".", "getChildrenList", "(", ")", ")", ";", "while", "(", "0"...
Move children from <var>source</var> to <var>target</var>. @param source source node @param target target node
[ "Move", "children", "from", "<var", ">", "source<", "/", "var", ">", "to", "<var", ">", "target<", "/", "var", ">", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/context/SimpleXMLDeDupContextLoader.java#L95-L106
Jasig/uPortal
uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/LayoutStructure.java
LayoutStructure.addParameter
public void addParameter(String paramName, String paramValue) { this.parameters.add(new StructureParameter(paramName, paramValue)); }
java
public void addParameter(String paramName, String paramValue) { this.parameters.add(new StructureParameter(paramName, paramValue)); }
[ "public", "void", "addParameter", "(", "String", "paramName", ",", "String", "paramValue", ")", "{", "this", ".", "parameters", ".", "add", "(", "new", "StructureParameter", "(", "paramName", ",", "paramValue", ")", ")", ";", "}" ]
Add a parameter to this LayoutStructure. @param paramName the name of the parameter @param paramValue the value of the parameter
[ "Add", "a", "parameter", "to", "this", "LayoutStructure", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/LayoutStructure.java#L168-L170
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBoxUtils.java
BeanBoxUtils.getInjectAnnotationAsArray
private static Object[] getInjectAnnotationAsArray(Object target, boolean allowSpringJsrAnno) { Annotation[] anno = getAnnotations(target); return getInjectAsArray(anno, allowSpringJsrAnno); }
java
private static Object[] getInjectAnnotationAsArray(Object target, boolean allowSpringJsrAnno) { Annotation[] anno = getAnnotations(target); return getInjectAsArray(anno, allowSpringJsrAnno); }
[ "private", "static", "Object", "[", "]", "getInjectAnnotationAsArray", "(", "Object", "target", ",", "boolean", "allowSpringJsrAnno", ")", "{", "Annotation", "[", "]", "anno", "=", "getAnnotations", "(", "target", ")", ";", "return", "getInjectAsArray", "(", "an...
Get @INJECT or @POSTCONSTRUCT or @PARAM or @PREDESTROY or @PROTOTYPE annotation values, return Object[3] or null if no above annotations found
[ "Get" ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBoxUtils.java#L218-L221
eclipse/xtext-extras
org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java
AbstractXbaseSemanticSequencer.sequence_XThrowExpression
protected void sequence_XThrowExpression(ISerializationContext context, XThrowExpression semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XTHROW_EXPRESSION__EXPRESSION) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XTHROW_EXPRESSION__EXPRESSION)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXThrowExpressionAccess().getExpressionXExpressionParserRuleCall_2_0(), semanticObject.getExpression()); feeder.finish(); }
java
protected void sequence_XThrowExpression(ISerializationContext context, XThrowExpression semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XTHROW_EXPRESSION__EXPRESSION) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XTHROW_EXPRESSION__EXPRESSION)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXThrowExpressionAccess().getExpressionXExpressionParserRuleCall_2_0(), semanticObject.getExpression()); feeder.finish(); }
[ "protected", "void", "sequence_XThrowExpression", "(", "ISerializationContext", "context", ",", "XThrowExpression", "semanticObject", ")", "{", "if", "(", "errorAcceptor", "!=", "null", ")", "{", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanticObj...
Contexts: XExpression returns XThrowExpression XAssignment returns XThrowExpression XAssignment.XBinaryOperation_1_1_0_0_0 returns XThrowExpression XOrExpression returns XThrowExpression XOrExpression.XBinaryOperation_1_0_0_0 returns XThrowExpression XAndExpression returns XThrowExpression XAndExpression.XBinaryOperation_1_0_0_0 returns XThrowExpression XEqualityExpression returns XThrowExpression XEqualityExpression.XBinaryOperation_1_0_0_0 returns XThrowExpression XRelationalExpression returns XThrowExpression XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XThrowExpression XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XThrowExpression XOtherOperatorExpression returns XThrowExpression XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XThrowExpression XAdditiveExpression returns XThrowExpression XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XThrowExpression XMultiplicativeExpression returns XThrowExpression XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XThrowExpression XUnaryOperation returns XThrowExpression XCastedExpression returns XThrowExpression XCastedExpression.XCastedExpression_1_0_0_0 returns XThrowExpression XPostfixOperation returns XThrowExpression XPostfixOperation.XPostfixOperation_1_0_0 returns XThrowExpression XMemberFeatureCall returns XThrowExpression XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XThrowExpression XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XThrowExpression XPrimaryExpression returns XThrowExpression XParenthesizedExpression returns XThrowExpression XExpressionOrVarDeclaration returns XThrowExpression XThrowExpression returns XThrowExpression Constraint: expression=XExpression
[ "Contexts", ":", "XExpression", "returns", "XThrowExpression", "XAssignment", "returns", "XThrowExpression", "XAssignment", ".", "XBinaryOperation_1_1_0_0_0", "returns", "XThrowExpression", "XOrExpression", "returns", "XThrowExpression", "XOrExpression", ".", "XBinaryOperation_1_...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java#L1620-L1628
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/IntCounter.java
IntCounter.setCount
public void setCount(E key, int count) { if (tempMInteger == null) { tempMInteger = new MutableInteger(); } tempMInteger.set(count); tempMInteger = map.put(key, tempMInteger); totalCount += count; if (tempMInteger != null) { totalCount -= tempMInteger.intValue(); } }
java
public void setCount(E key, int count) { if (tempMInteger == null) { tempMInteger = new MutableInteger(); } tempMInteger.set(count); tempMInteger = map.put(key, tempMInteger); totalCount += count; if (tempMInteger != null) { totalCount -= tempMInteger.intValue(); } }
[ "public", "void", "setCount", "(", "E", "key", ",", "int", "count", ")", "{", "if", "(", "tempMInteger", "==", "null", ")", "{", "tempMInteger", "=", "new", "MutableInteger", "(", ")", ";", "}", "tempMInteger", ".", "set", "(", "count", ")", ";", "te...
Sets the current count for the given key. This will wipe out any existing count for that key. <p/> To add to a count instead of replacing it, use {@link #incrementCount(Object,int)}.
[ "Sets", "the", "current", "count", "for", "the", "given", "key", ".", "This", "will", "wipe", "out", "any", "existing", "count", "for", "that", "key", ".", "<p", "/", ">", "To", "add", "to", "a", "count", "instead", "of", "replacing", "it", "use", "{...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/IntCounter.java#L189-L202
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java
AbstractEventSerializer.readArrayHeader
protected void readArrayHeader() throws IOException { if (jsonParser.nextToken() != JsonToken.START_OBJECT) { throw new JsonParseException("Not a Json object", jsonParser.getCurrentLocation()); } jsonParser.nextToken(); if (!jsonParser.getText().equals(RECORDS)) { throw new JsonParseException("Not a CloudTrail log", jsonParser.getCurrentLocation()); } if (jsonParser.nextToken() != JsonToken.START_ARRAY) { throw new JsonParseException("Not a CloudTrail log", jsonParser.getCurrentLocation()); } }
java
protected void readArrayHeader() throws IOException { if (jsonParser.nextToken() != JsonToken.START_OBJECT) { throw new JsonParseException("Not a Json object", jsonParser.getCurrentLocation()); } jsonParser.nextToken(); if (!jsonParser.getText().equals(RECORDS)) { throw new JsonParseException("Not a CloudTrail log", jsonParser.getCurrentLocation()); } if (jsonParser.nextToken() != JsonToken.START_ARRAY) { throw new JsonParseException("Not a CloudTrail log", jsonParser.getCurrentLocation()); } }
[ "protected", "void", "readArrayHeader", "(", ")", "throws", "IOException", "{", "if", "(", "jsonParser", ".", "nextToken", "(", ")", "!=", "JsonToken", ".", "START_OBJECT", ")", "{", "throw", "new", "JsonParseException", "(", "\"Not a Json object\"", ",", "jsonP...
Read the header of an AWS CloudTrail log. @throws JsonParseException if the log could not be parsed. @throws IOException if the log could not be opened or accessed.
[ "Read", "the", "header", "of", "an", "AWS", "CloudTrail", "log", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java#L76-L89
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.beginDelete
public void beginDelete(String resourceGroupName, String virtualNetworkGatewayConnectionName) { beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String virtualNetworkGatewayConnectionName) { beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayConnectionName", ")", ".", "toBlocking", "(", ")", ...
Deletes the specified virtual network Gateway connection. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @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
[ "Deletes", "the", "specified", "virtual", "network", "Gateway", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L455-L457
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java
TrajectoryUtil.splitTrackInSubTracks
public static ArrayList<Trajectory> splitTrackInSubTracks(Trajectory t, int windowWidth, boolean overlapping){ int increment = 1; if(overlapping==false){ increment=windowWidth; } ArrayList<Trajectory> subTrajectories = new ArrayList<Trajectory>(); boolean trackEndReached = false; for(int i = 0; i < t.size(); i=i+increment) { int upperBound = i+(windowWidth); if(upperBound>t.size()){ upperBound=t.size(); trackEndReached=true; } Trajectory help = new Trajectory(2, i); for(int j = i; j < upperBound; j++){ help.add(t.get(j)); } subTrajectories.add(help); if(trackEndReached){ i=t.size(); } } return subTrajectories; }
java
public static ArrayList<Trajectory> splitTrackInSubTracks(Trajectory t, int windowWidth, boolean overlapping){ int increment = 1; if(overlapping==false){ increment=windowWidth; } ArrayList<Trajectory> subTrajectories = new ArrayList<Trajectory>(); boolean trackEndReached = false; for(int i = 0; i < t.size(); i=i+increment) { int upperBound = i+(windowWidth); if(upperBound>t.size()){ upperBound=t.size(); trackEndReached=true; } Trajectory help = new Trajectory(2, i); for(int j = i; j < upperBound; j++){ help.add(t.get(j)); } subTrajectories.add(help); if(trackEndReached){ i=t.size(); } } return subTrajectories; }
[ "public", "static", "ArrayList", "<", "Trajectory", ">", "splitTrackInSubTracks", "(", "Trajectory", "t", ",", "int", "windowWidth", ",", "boolean", "overlapping", ")", "{", "int", "increment", "=", "1", ";", "if", "(", "overlapping", "==", "false", ")", "{"...
Splits a trajectory in overlapping / non-overlapping sub-trajectories. @param t @param windowWidth Window width. Each sub-trajectory will have this length @param overlapping Allows the window to overlap @return ArrayList with sub-trajectories
[ "Splits", "a", "trajectory", "in", "overlapping", "/", "non", "-", "overlapping", "sub", "-", "trajectories", "." ]
train
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java#L131-L156
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java
DefaultJsonQueryLogEntryCreator.writeBatchEntry
protected void writeBatchEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { sb.append("\"batch\":"); sb.append(execInfo.isBatch() ? "true" : "false"); sb.append(", "); }
java
protected void writeBatchEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { sb.append("\"batch\":"); sb.append(execInfo.isBatch() ? "true" : "false"); sb.append(", "); }
[ "protected", "void", "writeBatchEntry", "(", "StringBuilder", "sb", ",", "ExecutionInfo", "execInfo", ",", "List", "<", "QueryInfo", ">", "queryInfoList", ")", "{", "sb", ".", "append", "(", "\"\\\"batch\\\":\"", ")", ";", "sb", ".", "append", "(", "execInfo",...
Write whether batch execution or not as json. <p>default: "batch": true, @param sb StringBuilder to write @param execInfo execution info @param queryInfoList query info list
[ "Write", "whether", "batch", "execution", "or", "not", "as", "json", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java#L152-L156
knowm/Sundial
src/main/java/org/knowm/sundial/SundialJobScheduler.java
SundialJobScheduler.createScheduler
public static Scheduler createScheduler(int threadPoolSize, String annotatedJobsPackageName) throws SundialSchedulerException { if (scheduler == null) { try { scheduler = new SchedulerFactory().getScheduler(threadPoolSize, annotatedJobsPackageName); } catch (SchedulerException e) { throw new SundialSchedulerException("COULD NOT CREATE SUNDIAL SCHEDULER!!!", e); } } return scheduler; }
java
public static Scheduler createScheduler(int threadPoolSize, String annotatedJobsPackageName) throws SundialSchedulerException { if (scheduler == null) { try { scheduler = new SchedulerFactory().getScheduler(threadPoolSize, annotatedJobsPackageName); } catch (SchedulerException e) { throw new SundialSchedulerException("COULD NOT CREATE SUNDIAL SCHEDULER!!!", e); } } return scheduler; }
[ "public", "static", "Scheduler", "createScheduler", "(", "int", "threadPoolSize", ",", "String", "annotatedJobsPackageName", ")", "throws", "SundialSchedulerException", "{", "if", "(", "scheduler", "==", "null", ")", "{", "try", "{", "scheduler", "=", "new", "Sche...
Creates the Sundial Scheduler @param threadPoolSize the thread pool size used by the scheduler @param annotatedJobsPackageName A comma(,) or colon(:) can be used to specify multiple packages to scan for Jobs. @return
[ "Creates", "the", "Sundial", "Scheduler" ]
train
https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/knowm/sundial/SundialJobScheduler.java#L103-L115
voldemort/voldemort
src/java/voldemort/utils/RebalanceUtils.java
RebalanceUtils.printErrorLog
public static void printErrorLog(int taskId, Logger logger, String message, Exception e) { if(e == null) { logger.error("Task id " + Integer.toString(taskId) + "] " + message); } else { logger.error("Task id " + Integer.toString(taskId) + "] " + message, e); } }
java
public static void printErrorLog(int taskId, Logger logger, String message, Exception e) { if(e == null) { logger.error("Task id " + Integer.toString(taskId) + "] " + message); } else { logger.error("Task id " + Integer.toString(taskId) + "] " + message, e); } }
[ "public", "static", "void", "printErrorLog", "(", "int", "taskId", ",", "Logger", "logger", ",", "String", "message", ",", "Exception", "e", ")", "{", "if", "(", "e", "==", "null", ")", "{", "logger", ".", "error", "(", "\"Task id \"", "+", "Integer", ...
Print log to the following logger ( Error level ) @param taskId Stealer node id @param logger Logger class @param message The message to print
[ "Print", "log", "to", "the", "following", "logger", "(", "Error", "level", ")" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L475-L481
DDTH/ddth-kafka
src/main/java/com/github/ddth/kafka/KafkaClient.java
KafkaClient.consumeMessage
public KafkaMessage consumeMessage(String consumerGroupId, String topic, long waitTime, TimeUnit waitTimeUnit) { return consumeMessage(consumerGroupId, true, topic, waitTime, waitTimeUnit); }
java
public KafkaMessage consumeMessage(String consumerGroupId, String topic, long waitTime, TimeUnit waitTimeUnit) { return consumeMessage(consumerGroupId, true, topic, waitTime, waitTimeUnit); }
[ "public", "KafkaMessage", "consumeMessage", "(", "String", "consumerGroupId", ",", "String", "topic", ",", "long", "waitTime", ",", "TimeUnit", "waitTimeUnit", ")", "{", "return", "consumeMessage", "(", "consumerGroupId", ",", "true", ",", "topic", ",", "waitTime"...
Consumes one message from a topic, wait up to specified wait-time. @param consumerGroupId @param topic @param waitTime @param waitTimeUnit @return @since 1.2.0
[ "Consumes", "one", "message", "from", "a", "topic", "wait", "up", "to", "specified", "wait", "-", "time", "." ]
train
https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/KafkaClient.java#L475-L478
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/resource/util/DataPointParser.java
DataPointParser.parse
public static List<DataPoint> parse(int[] values, long ts) { List<DataPoint> ret = new ArrayList<DataPoint>(values.length); for (int v : values) { ret.add(new DataPoint(ts, v)); } return ret; }
java
public static List<DataPoint> parse(int[] values, long ts) { List<DataPoint> ret = new ArrayList<DataPoint>(values.length); for (int v : values) { ret.add(new DataPoint(ts, v)); } return ret; }
[ "public", "static", "List", "<", "DataPoint", ">", "parse", "(", "int", "[", "]", "values", ",", "long", "ts", ")", "{", "List", "<", "DataPoint", ">", "ret", "=", "new", "ArrayList", "<", "DataPoint", ">", "(", "values", ".", "length", ")", ";", "...
Takes an array of values and converts it into a list of `DataPoint`s with the same timestamp. @param values Array of values to be converted @param ts Timestamp to use. @return A List of DataPoints with the same timestamp.
[ "Takes", "an", "array", "of", "values", "and", "converts", "it", "into", "a", "list", "of", "DataPoint", "s", "with", "the", "same", "timestamp", "." ]
train
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/util/DataPointParser.java#L150-L156
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/promotion/UnifiedPromoteBuildAction.java
UnifiedPromoteBuildAction.doIndex
@SuppressWarnings({"UnusedDeclaration"}) public void doIndex(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException { req.getView(this, chooseAction()).forward(req, resp); }
java
@SuppressWarnings({"UnusedDeclaration"}) public void doIndex(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException { req.getView(this, chooseAction()).forward(req, resp); }
[ "@", "SuppressWarnings", "(", "{", "\"UnusedDeclaration\"", "}", ")", "public", "void", "doIndex", "(", "StaplerRequest", "req", ",", "StaplerResponse", "resp", ")", "throws", "IOException", ",", "ServletException", "{", "req", ".", "getView", "(", "this", ",", ...
Select which view to display based on the state of the promotion. Will return the form if user selects to perform promotion. Progress will be returned if the promotion is currently in progress.
[ "Select", "which", "view", "to", "display", "based", "on", "the", "state", "of", "the", "promotion", ".", "Will", "return", "the", "form", "if", "user", "selects", "to", "perform", "promotion", ".", "Progress", "will", "be", "returned", "if", "the", "promo...
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/promotion/UnifiedPromoteBuildAction.java#L270-L273
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.sendInstantiationProposal
public Collection<ProposalResponse> sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest) throws InvalidArgumentException, ProposalException { return sendInstantiationProposal(instantiateProposalRequest, getChaincodePeers()); }
java
public Collection<ProposalResponse> sendInstantiationProposal(InstantiateProposalRequest instantiateProposalRequest) throws InvalidArgumentException, ProposalException { return sendInstantiationProposal(instantiateProposalRequest, getChaincodePeers()); }
[ "public", "Collection", "<", "ProposalResponse", ">", "sendInstantiationProposal", "(", "InstantiateProposalRequest", "instantiateProposalRequest", ")", "throws", "InvalidArgumentException", ",", "ProposalException", "{", "return", "sendInstantiationProposal", "(", "instantiatePr...
Send instantiate request to the channel. Chaincode is created and initialized. @param instantiateProposalRequest send instantiate chaincode proposal request. @return Collections of proposal responses @throws InvalidArgumentException @throws ProposalException @deprecated See new lifecycle chaincode management. {@link LifecycleInstallChaincodeRequest}
[ "Send", "instantiate", "request", "to", "the", "channel", ".", "Chaincode", "is", "created", "and", "initialized", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L2430-L2433
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/tiles/features/FeatureTiles.java
FeatureTiles.drawTileQueryIndex
public BufferedImage drawTileQueryIndex(int x, int y, int zoom) { // Get the web mercator bounding box BoundingBox webMercatorBoundingBox = TileBoundingBoxUtils .getWebMercatorBoundingBox(x, y, zoom); BufferedImage image = null; // Query for the geometry count matching the bounds in the index long tileCount = queryIndexedFeaturesCount(webMercatorBoundingBox); // Draw if at least one geometry exists if (tileCount > 0) { // Query for geometries matching the bounds in the index CloseableIterator<GeometryIndex> results = queryIndexedFeatures(webMercatorBoundingBox); try { if (maxFeaturesPerTile == null || tileCount <= maxFeaturesPerTile.longValue()) { // Draw the tile image image = drawTile(zoom, webMercatorBoundingBox, results); } else if (maxFeaturesTileDraw != null) { // Draw the max features tile image = maxFeaturesTileDraw.drawTile(tileWidth, tileHeight, tileCount, results); } } finally { try { results.close(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to close result set for query on x: " + x + ", y: " + y + ", zoom: " + zoom, e); } } } return image; }
java
public BufferedImage drawTileQueryIndex(int x, int y, int zoom) { // Get the web mercator bounding box BoundingBox webMercatorBoundingBox = TileBoundingBoxUtils .getWebMercatorBoundingBox(x, y, zoom); BufferedImage image = null; // Query for the geometry count matching the bounds in the index long tileCount = queryIndexedFeaturesCount(webMercatorBoundingBox); // Draw if at least one geometry exists if (tileCount > 0) { // Query for geometries matching the bounds in the index CloseableIterator<GeometryIndex> results = queryIndexedFeatures(webMercatorBoundingBox); try { if (maxFeaturesPerTile == null || tileCount <= maxFeaturesPerTile.longValue()) { // Draw the tile image image = drawTile(zoom, webMercatorBoundingBox, results); } else if (maxFeaturesTileDraw != null) { // Draw the max features tile image = maxFeaturesTileDraw.drawTile(tileWidth, tileHeight, tileCount, results); } } finally { try { results.close(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to close result set for query on x: " + x + ", y: " + y + ", zoom: " + zoom, e); } } } return image; }
[ "public", "BufferedImage", "drawTileQueryIndex", "(", "int", "x", ",", "int", "y", ",", "int", "zoom", ")", "{", "// Get the web mercator bounding box", "BoundingBox", "webMercatorBoundingBox", "=", "TileBoundingBoxUtils", ".", "getWebMercatorBoundingBox", "(", "x", ","...
Draw a tile image from the x, y, and zoom level by querying features in the tile location @param x x coordinate @param y y coordinate @param zoom zoom level @return drawn image, or null
[ "Draw", "a", "tile", "image", "from", "the", "x", "y", "and", "zoom", "level", "by", "querying", "features", "in", "the", "tile", "location" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/features/FeatureTiles.java#L947-L990
jcustenborder/connect-utils
connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java
ConfigUtils.hostAndPorts
public static List<HostAndPort> hostAndPorts(AbstractConfig config, String key) { return hostAndPorts(config, key, null); }
java
public static List<HostAndPort> hostAndPorts(AbstractConfig config, String key) { return hostAndPorts(config, key, null); }
[ "public", "static", "List", "<", "HostAndPort", ">", "hostAndPorts", "(", "AbstractConfig", "config", ",", "String", "key", ")", "{", "return", "hostAndPorts", "(", "config", ",", "key", ",", "null", ")", ";", "}" ]
Method is used to parse hosts and ports @param config @param key @return
[ "Method", "is", "used", "to", "parse", "hosts", "and", "ports" ]
train
https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java#L199-L201
duracloud/duracloud
irodsstorageprovider/src/main/java/org/duracloud/irodsstorage/IrodsStorageProvider.java
IrodsStorageProvider.addContent
@Override public String addContent(String spaceId, String contentId, String contentMimeType, Map<String, String> userProperties, long contentSize, String contentChecksum, InputStream content) { String path = baseDirectory + "/" + spaceId + "/" + contentId; log.trace("Writing to irods path: " + path + " resource: " + storageResource); ConnectOperation co = new ConnectOperation(host, port, username, password, zone); byte[] buffer = new byte[BLOCK_SIZE]; try { OutputStream ios; if (contentSize > 0) { ios = new IrodsOutputStream(co.getConnection(), path, storageResource, contentSize); } else { ios = new UnknownSizeOutputStream(co.getConnection(), path, storageResource, true); } int read = 0; long total = 0; while ((read = content.read(buffer)) > -1) { total += read; ios.write(buffer, 0, read); } ios.close(); log.trace("Finished writing irods path: " + path + " resource: " + storageResource + " actual read: " + total + " contentSize: " + contentSize); if (userProperties != null) { MetaDataMap mDataMap = new MetaDataMap(path, co); mDataMap.clear(); for (String e : userProperties.keySet()) { mDataMap.put(e, userProperties.get(e), null); } } return new IrodsOperations(co).stat(path).getChksum(); } catch (IOException e) { log.error("Error ingesting file", e); throw new StorageException(e); } }
java
@Override public String addContent(String spaceId, String contentId, String contentMimeType, Map<String, String> userProperties, long contentSize, String contentChecksum, InputStream content) { String path = baseDirectory + "/" + spaceId + "/" + contentId; log.trace("Writing to irods path: " + path + " resource: " + storageResource); ConnectOperation co = new ConnectOperation(host, port, username, password, zone); byte[] buffer = new byte[BLOCK_SIZE]; try { OutputStream ios; if (contentSize > 0) { ios = new IrodsOutputStream(co.getConnection(), path, storageResource, contentSize); } else { ios = new UnknownSizeOutputStream(co.getConnection(), path, storageResource, true); } int read = 0; long total = 0; while ((read = content.read(buffer)) > -1) { total += read; ios.write(buffer, 0, read); } ios.close(); log.trace("Finished writing irods path: " + path + " resource: " + storageResource + " actual read: " + total + " contentSize: " + contentSize); if (userProperties != null) { MetaDataMap mDataMap = new MetaDataMap(path, co); mDataMap.clear(); for (String e : userProperties.keySet()) { mDataMap.put(e, userProperties.get(e), null); } } return new IrodsOperations(co).stat(path).getChksum(); } catch (IOException e) { log.error("Error ingesting file", e); throw new StorageException(e); } }
[ "@", "Override", "public", "String", "addContent", "(", "String", "spaceId", ",", "String", "contentId", ",", "String", "contentMimeType", ",", "Map", "<", "String", ",", "String", ">", "userProperties", ",", "long", "contentSize", ",", "String", "contentChecksu...
Add new content to irods, content path is baseDirectory /spaceId/contentId @param spaceId @param contentId @param contentMimeType @param contentSize may be set to 0 in some cases (entry through admin client) @param contentChecksum @param content @return
[ "Add", "new", "content", "to", "irods", "content", "path", "is", "baseDirectory", "/", "spaceId", "/", "contentId" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/irodsstorageprovider/src/main/java/org/duracloud/irodsstorage/IrodsStorageProvider.java#L306-L359
RogerParkinson/madura-objects-parent
madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java
ParsePackage.processConstraint
private AbstractRule processConstraint(RulesTextProvider textProvider) throws ParserException { log.debug("processConstraint"); Constraint rule = new Constraint(); int start = textProvider.getPos(); LoadCommonRuleData(rule,textProvider); textProvider.addTOCElement(null, rule.getDescription(), start, textProvider.getPos(), TYPE_CONSTRAINT); exactOrError("{",textProvider); Expression condition = processAction(textProvider); if (condition.isAssign()) { throw new ParserException("Found an assignment in a condition ",textProvider); } exactOrError("}",textProvider); rule.addCondition(condition); return rule; }
java
private AbstractRule processConstraint(RulesTextProvider textProvider) throws ParserException { log.debug("processConstraint"); Constraint rule = new Constraint(); int start = textProvider.getPos(); LoadCommonRuleData(rule,textProvider); textProvider.addTOCElement(null, rule.getDescription(), start, textProvider.getPos(), TYPE_CONSTRAINT); exactOrError("{",textProvider); Expression condition = processAction(textProvider); if (condition.isAssign()) { throw new ParserException("Found an assignment in a condition ",textProvider); } exactOrError("}",textProvider); rule.addCondition(condition); return rule; }
[ "private", "AbstractRule", "processConstraint", "(", "RulesTextProvider", "textProvider", ")", "throws", "ParserException", "{", "log", ".", "debug", "(", "\"processConstraint\"", ")", ";", "Constraint", "rule", "=", "new", "Constraint", "(", ")", ";", "int", "sta...
Method processConstraint. A constraint is a list of conditions and an explanation. @return Rule @throws ParserException
[ "Method", "processConstraint", ".", "A", "constraint", "is", "a", "list", "of", "conditions", "and", "an", "explanation", "." ]
train
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java#L273-L291
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java
EvaluatorManager.onEvaluatorFailed
private synchronized void onEvaluatorFailed(final EvaluatorStatusPOJO evaluatorStatus) { assert evaluatorStatus.getState() == State.FAILED; final EvaluatorException evaluatorException; if (evaluatorStatus.hasError()) { final Optional<Throwable> exception = this.exceptionCodec.fromBytes(evaluatorStatus.getError()); evaluatorException = new EvaluatorException(getId(), exception.isPresent() ? exception.get() : new NonSerializableException("Exception sent, but can't be deserialized", evaluatorStatus.getError())); } else { evaluatorException = new EvaluatorException(getId(), new Exception("No exception sent")); } this.onEvaluatorException(evaluatorException); }
java
private synchronized void onEvaluatorFailed(final EvaluatorStatusPOJO evaluatorStatus) { assert evaluatorStatus.getState() == State.FAILED; final EvaluatorException evaluatorException; if (evaluatorStatus.hasError()) { final Optional<Throwable> exception = this.exceptionCodec.fromBytes(evaluatorStatus.getError()); evaluatorException = new EvaluatorException(getId(), exception.isPresent() ? exception.get() : new NonSerializableException("Exception sent, but can't be deserialized", evaluatorStatus.getError())); } else { evaluatorException = new EvaluatorException(getId(), new Exception("No exception sent")); } this.onEvaluatorException(evaluatorException); }
[ "private", "synchronized", "void", "onEvaluatorFailed", "(", "final", "EvaluatorStatusPOJO", "evaluatorStatus", ")", "{", "assert", "evaluatorStatus", ".", "getState", "(", ")", "==", "State", ".", "FAILED", ";", "final", "EvaluatorException", "evaluatorException", ";...
Process an evaluator message that indicates a crash. @param evaluatorStatus
[ "Process", "an", "evaluator", "message", "that", "indicates", "a", "crash", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L522-L541
JOML-CI/JOML
src/org/joml/Vector2d.java
Vector2d.set
public Vector2d set(int index, DoubleBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
java
public Vector2d set(int index, DoubleBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
[ "public", "Vector2d", "set", "(", "int", "index", ",", "DoubleBuffer", "buffer", ")", "{", "MemUtil", ".", "INSTANCE", ".", "get", "(", "this", ",", "index", ",", "buffer", ")", ";", "return", "this", ";", "}" ]
Read this vector from the supplied {@link DoubleBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given DoubleBuffer. @param index the absolute position into the DoubleBuffer @param buffer values will be read in <code>x, y</code> order @return this
[ "Read", "this", "vector", "from", "the", "supplied", "{", "@link", "DoubleBuffer", "}", "starting", "at", "the", "specified", "absolute", "buffer", "position", "/", "index", ".", "<p", ">", "This", "method", "will", "not", "increment", "the", "position", "of...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2d.java#L337-L340
aol/cyclops
cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/LazyFutureStreamFunctions.java
LazyFutureStreamFunctions.takeWhile
public static <T> ReactiveSeq<T> takeWhile(final Stream<T> stream, final Predicate<? super T> predicate) { return takeUntil(stream, predicate.negate()); }
java
public static <T> ReactiveSeq<T> takeWhile(final Stream<T> stream, final Predicate<? super T> predicate) { return takeUntil(stream, predicate.negate()); }
[ "public", "static", "<", "T", ">", "ReactiveSeq", "<", "T", ">", "takeWhile", "(", "final", "Stream", "<", "T", ">", "stream", ",", "final", "Predicate", "<", "?", "super", "T", ">", "predicate", ")", "{", "return", "takeUntil", "(", "stream", ",", "...
Returns a stream limited to all elements for which a predicate evaluates to <code>true</code>. <p> <code> // (1, 2) Seq.of(1, 2, 3, 4, 5).limitWhile(i -&gt; i &lt; 3) </code>
[ "Returns", "a", "stream", "limited", "to", "all", "elements", "for", "which", "a", "predicate", "evaluates", "to", "<code", ">", "true<", "/", "code", ">", ".", "<p", ">", "<code", ">", "//", "(", "1", "2", ")", "Seq", ".", "of", "(", "1", "2", "...
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/types/futurestream/LazyFutureStreamFunctions.java#L85-L87
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.processTaskEnterpriseColumns
private void processTaskEnterpriseColumns(Integer id, Task task, Var2Data taskVarData, byte[] metaData2) { if (metaData2 != null) { int bits = MPPUtility.getInt(metaData2, 29); task.set(TaskField.ENTERPRISE_FLAG1, Boolean.valueOf((bits & 0x0000800) != 0)); task.set(TaskField.ENTERPRISE_FLAG2, Boolean.valueOf((bits & 0x0001000) != 0)); task.set(TaskField.ENTERPRISE_FLAG3, Boolean.valueOf((bits & 0x0002000) != 0)); task.set(TaskField.ENTERPRISE_FLAG4, Boolean.valueOf((bits & 0x0004000) != 0)); task.set(TaskField.ENTERPRISE_FLAG5, Boolean.valueOf((bits & 0x0008000) != 0)); task.set(TaskField.ENTERPRISE_FLAG6, Boolean.valueOf((bits & 0x0001000) != 0)); task.set(TaskField.ENTERPRISE_FLAG7, Boolean.valueOf((bits & 0x0002000) != 0)); task.set(TaskField.ENTERPRISE_FLAG8, Boolean.valueOf((bits & 0x0004000) != 0)); task.set(TaskField.ENTERPRISE_FLAG9, Boolean.valueOf((bits & 0x0008000) != 0)); task.set(TaskField.ENTERPRISE_FLAG10, Boolean.valueOf((bits & 0x0010000) != 0)); task.set(TaskField.ENTERPRISE_FLAG11, Boolean.valueOf((bits & 0x0020000) != 0)); task.set(TaskField.ENTERPRISE_FLAG12, Boolean.valueOf((bits & 0x0040000) != 0)); task.set(TaskField.ENTERPRISE_FLAG13, Boolean.valueOf((bits & 0x0080000) != 0)); task.set(TaskField.ENTERPRISE_FLAG14, Boolean.valueOf((bits & 0x0100000) != 0)); task.set(TaskField.ENTERPRISE_FLAG15, Boolean.valueOf((bits & 0x0200000) != 0)); task.set(TaskField.ENTERPRISE_FLAG16, Boolean.valueOf((bits & 0x0400000) != 0)); task.set(TaskField.ENTERPRISE_FLAG17, Boolean.valueOf((bits & 0x0800000) != 0)); task.set(TaskField.ENTERPRISE_FLAG18, Boolean.valueOf((bits & 0x1000000) != 0)); task.set(TaskField.ENTERPRISE_FLAG19, Boolean.valueOf((bits & 0x2000000) != 0)); task.set(TaskField.ENTERPRISE_FLAG20, Boolean.valueOf((bits & 0x4000000) != 0)); } }
java
private void processTaskEnterpriseColumns(Integer id, Task task, Var2Data taskVarData, byte[] metaData2) { if (metaData2 != null) { int bits = MPPUtility.getInt(metaData2, 29); task.set(TaskField.ENTERPRISE_FLAG1, Boolean.valueOf((bits & 0x0000800) != 0)); task.set(TaskField.ENTERPRISE_FLAG2, Boolean.valueOf((bits & 0x0001000) != 0)); task.set(TaskField.ENTERPRISE_FLAG3, Boolean.valueOf((bits & 0x0002000) != 0)); task.set(TaskField.ENTERPRISE_FLAG4, Boolean.valueOf((bits & 0x0004000) != 0)); task.set(TaskField.ENTERPRISE_FLAG5, Boolean.valueOf((bits & 0x0008000) != 0)); task.set(TaskField.ENTERPRISE_FLAG6, Boolean.valueOf((bits & 0x0001000) != 0)); task.set(TaskField.ENTERPRISE_FLAG7, Boolean.valueOf((bits & 0x0002000) != 0)); task.set(TaskField.ENTERPRISE_FLAG8, Boolean.valueOf((bits & 0x0004000) != 0)); task.set(TaskField.ENTERPRISE_FLAG9, Boolean.valueOf((bits & 0x0008000) != 0)); task.set(TaskField.ENTERPRISE_FLAG10, Boolean.valueOf((bits & 0x0010000) != 0)); task.set(TaskField.ENTERPRISE_FLAG11, Boolean.valueOf((bits & 0x0020000) != 0)); task.set(TaskField.ENTERPRISE_FLAG12, Boolean.valueOf((bits & 0x0040000) != 0)); task.set(TaskField.ENTERPRISE_FLAG13, Boolean.valueOf((bits & 0x0080000) != 0)); task.set(TaskField.ENTERPRISE_FLAG14, Boolean.valueOf((bits & 0x0100000) != 0)); task.set(TaskField.ENTERPRISE_FLAG15, Boolean.valueOf((bits & 0x0200000) != 0)); task.set(TaskField.ENTERPRISE_FLAG16, Boolean.valueOf((bits & 0x0400000) != 0)); task.set(TaskField.ENTERPRISE_FLAG17, Boolean.valueOf((bits & 0x0800000) != 0)); task.set(TaskField.ENTERPRISE_FLAG18, Boolean.valueOf((bits & 0x1000000) != 0)); task.set(TaskField.ENTERPRISE_FLAG19, Boolean.valueOf((bits & 0x2000000) != 0)); task.set(TaskField.ENTERPRISE_FLAG20, Boolean.valueOf((bits & 0x4000000) != 0)); } }
[ "private", "void", "processTaskEnterpriseColumns", "(", "Integer", "id", ",", "Task", "task", ",", "Var2Data", "taskVarData", ",", "byte", "[", "]", "metaData2", ")", "{", "if", "(", "metaData2", "!=", "null", ")", "{", "int", "bits", "=", "MPPUtility", "....
Extracts task enterprise column values. @param id task unique ID @param task task instance @param taskVarData task var data @param metaData2 task meta data
[ "Extracts", "task", "enterprise", "column", "values", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L1386-L1412
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.genExpr
public Item genExpr(JCTree tree, Type pt) { Type prevPt = this.pt; try { if (tree.type.constValue() != null) { // Short circuit any expressions which are constants tree.accept(classReferenceVisitor); checkStringConstant(tree.pos(), tree.type.constValue()); result = items.makeImmediateItem(tree.type, tree.type.constValue()); } else { this.pt = pt; tree.accept(this); } return result.coerce(pt); } catch (CompletionFailure ex) { chk.completionError(tree.pos(), ex); code.state.stacksize = 1; return items.makeStackItem(pt); } finally { this.pt = prevPt; } }
java
public Item genExpr(JCTree tree, Type pt) { Type prevPt = this.pt; try { if (tree.type.constValue() != null) { // Short circuit any expressions which are constants tree.accept(classReferenceVisitor); checkStringConstant(tree.pos(), tree.type.constValue()); result = items.makeImmediateItem(tree.type, tree.type.constValue()); } else { this.pt = pt; tree.accept(this); } return result.coerce(pt); } catch (CompletionFailure ex) { chk.completionError(tree.pos(), ex); code.state.stacksize = 1; return items.makeStackItem(pt); } finally { this.pt = prevPt; } }
[ "public", "Item", "genExpr", "(", "JCTree", "tree", ",", "Type", "pt", ")", "{", "Type", "prevPt", "=", "this", ".", "pt", ";", "try", "{", "if", "(", "tree", ".", "type", ".", "constValue", "(", ")", "!=", "null", ")", "{", "// Short circuit any exp...
Visitor method: generate code for an expression, catching and reporting any completion failures. @param tree The expression to be visited. @param pt The expression's expected type (proto-type).
[ "Visitor", "method", ":", "generate", "code", "for", "an", "expression", "catching", "and", "reporting", "any", "completion", "failures", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L805-L825
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsync
public static <T1, T2, T3, R> Func3<T1, T2, T3, Observable<R>> toAsync(Func3<? super T1, ? super T2, ? super T3, ? extends R> func) { return toAsync(func, Schedulers.computation()); }
java
public static <T1, T2, T3, R> Func3<T1, T2, T3, Observable<R>> toAsync(Func3<? super T1, ? super T2, ? super T3, ? extends R> func) { return toAsync(func, Schedulers.computation()); }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "R", ">", "Func3", "<", "T1", ",", "T2", ",", "T3", ",", "Observable", "<", "R", ">", ">", "toAsync", "(", "Func3", "<", "?", "super", "T1", ",", "?", "super", "T2", ",", "?", "super",...
Convert a synchronous function call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.png" alt=""> @param <T1> the first parameter type @param <T2> the second parameter type @param <T3> the third parameter type @param <R> the result type @param func the function to convert @return a function that returns an Observable that executes the {@code func} and emits its returned value @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh229450.aspx">MSDN: Observable.ToAsync</a>
[ "Convert", "a", "synchronous", "function", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki"...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L308-L310
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResult.java
CreateIntegrationResult.withRequestTemplates
public CreateIntegrationResult withRequestTemplates(java.util.Map<String, String> requestTemplates) { setRequestTemplates(requestTemplates); return this; }
java
public CreateIntegrationResult withRequestTemplates(java.util.Map<String, String> requestTemplates) { setRequestTemplates(requestTemplates); return this; }
[ "public", "CreateIntegrationResult", "withRequestTemplates", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestTemplates", ")", "{", "setRequestTemplates", "(", "requestTemplates", ")", ";", "return", "this", ";", "}" ]
<p> Represents a map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client. The content type value is the key in this map, and the template (as a String) is the value. </p> @param requestTemplates Represents a map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client. The content type value is the key in this map, and the template (as a String) is the value. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Represents", "a", "map", "of", "Velocity", "templates", "that", "are", "applied", "on", "the", "request", "payload", "based", "on", "the", "value", "of", "the", "Content", "-", "Type", "header", "sent", "by", "the", "client", ".", "The", "con...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationResult.java#L1219-L1222
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java
GridBagLayoutBuilder.appendLabel
public GridBagLayoutBuilder appendLabel(JLabel label, int colSpan) { return append(label, colSpan, 1, false, false); }
java
public GridBagLayoutBuilder appendLabel(JLabel label, int colSpan) { return append(label, colSpan, 1, false, false); }
[ "public", "GridBagLayoutBuilder", "appendLabel", "(", "JLabel", "label", ",", "int", "colSpan", ")", "{", "return", "append", "(", "label", ",", "colSpan", ",", "1", ",", "false", ",", "false", ")", ";", "}" ]
Appends the given label to the end of the current line. The label does not "grow." @param label the label to append @param colSpan the number of columns to span @return "this" to make it easier to string together append calls
[ "Appends", "the", "given", "label", "to", "the", "end", "of", "the", "current", "line", ".", "The", "label", "does", "not", "grow", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java#L471-L473
alkacon/opencms-core
src/org/opencms/workplace/tools/A_CmsHtmlIconButton.java
A_CmsHtmlIconButton.defaultHelpHtml
public static String defaultHelpHtml(String helpId, String helpText) { StringBuffer html = new StringBuffer(1024); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(helpText)) { html.append("<div class='help' id='help"); html.append(helpId); html.append("' onMouseOut=\"hMH('"); html.append(helpId); html.append("');\">"); html.append(helpText); html.append("</div>\n"); } return html.toString(); }
java
public static String defaultHelpHtml(String helpId, String helpText) { StringBuffer html = new StringBuffer(1024); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(helpText)) { html.append("<div class='help' id='help"); html.append(helpId); html.append("' onMouseOut=\"hMH('"); html.append(helpId); html.append("');\">"); html.append(helpText); html.append("</div>\n"); } return html.toString(); }
[ "public", "static", "String", "defaultHelpHtml", "(", "String", "helpId", ",", "String", "helpText", ")", "{", "StringBuffer", "html", "=", "new", "StringBuffer", "(", "1024", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "helpTex...
Generates html for the helptext when having one helptext for several buttons.<p> @param helpId the id of the help text @param helpText the help text @return html code
[ "Generates", "html", "for", "the", "helptext", "when", "having", "one", "helptext", "for", "several", "buttons", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/A_CmsHtmlIconButton.java#L299-L312
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.scaleIntrinsic
public static void scaleIntrinsic(CameraPinhole param , double scale ) { param.width = (int)(param.width*scale); param.height = (int)(param.height*scale); param.cx *= scale; param.cy *= scale; param.fx *= scale; param.fy *= scale; param.skew *= scale; }
java
public static void scaleIntrinsic(CameraPinhole param , double scale ) { param.width = (int)(param.width*scale); param.height = (int)(param.height*scale); param.cx *= scale; param.cy *= scale; param.fx *= scale; param.fy *= scale; param.skew *= scale; }
[ "public", "static", "void", "scaleIntrinsic", "(", "CameraPinhole", "param", ",", "double", "scale", ")", "{", "param", ".", "width", "=", "(", "int", ")", "(", "param", ".", "width", "*", "scale", ")", ";", "param", ".", "height", "=", "(", "int", "...
Multiplies each element of the intrinsic parameters by the provided scale factor. Useful if the image has been rescaled. @param param Intrinsic parameters @param scale Scale factor that input image is being scaled by.
[ "Multiplies", "each", "element", "of", "the", "intrinsic", "parameters", "by", "the", "provided", "scale", "factor", ".", "Useful", "if", "the", "image", "has", "been", "rescaled", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L137-L145
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.escapeUriPath
public static void escapeUriPath(final Reader reader, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.escape(reader, writer, UriEscapeUtil.UriEscapeType.PATH, encoding); }
java
public static void escapeUriPath(final Reader reader, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.escape(reader, writer, UriEscapeUtil.UriEscapeType.PATH, encoding); }
[ "public", "static", "void", "escapeUriPath", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgum...
<p> Perform am URI path <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> The following are the only allowed chars in an URI path (will not be escaped): </p> <ul> <li><tt>A-Z a-z 0-9</tt></li> <li><tt>- . _ ~</tt></li> <li><tt>! $ &amp; ' ( ) * + , ; =</tt></li> <li><tt>: @</tt></li> <li><tt>/</tt></li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified <em>encoding</em> and then representing each byte in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param encoding the encoding to be used for escaping. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "path", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/",...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L835-L848
kaazing/gateway
transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameUtils.java
WsFrameUtils.xor
public static void xor(ByteBuffer src, ByteBuffer dst, int mask) { int remainder = src.remaining() % 4; int remaining = src.remaining() - remainder; int end = remaining + src.position(); // xor a 32bit word at a time as long as possible while (src.position() < end) { int masked = src.getInt() ^ mask; dst.putInt(masked); } // xor the remaining 3, 2, or 1 bytes byte b; switch (remainder) { case 3: b = (byte) (src.get() ^ ((mask >> 24) & 0xff)); dst.put(b); b = (byte) (src.get() ^ ((mask >> 16) & 0xff)); dst.put(b); b = (byte) (src.get() ^ ((mask >> 8) & 0xff)); dst.put(b); break; case 2: b = (byte) (src.get() ^ ((mask >> 24) & 0xff)); dst.put(b); b = (byte) (src.get() ^ ((mask >> 16) & 0xff)); dst.put(b); break; case 1: b = (byte) (src.get() ^ (mask >> 24)); dst.put(b); break; case 0: default: break; } }
java
public static void xor(ByteBuffer src, ByteBuffer dst, int mask) { int remainder = src.remaining() % 4; int remaining = src.remaining() - remainder; int end = remaining + src.position(); // xor a 32bit word at a time as long as possible while (src.position() < end) { int masked = src.getInt() ^ mask; dst.putInt(masked); } // xor the remaining 3, 2, or 1 bytes byte b; switch (remainder) { case 3: b = (byte) (src.get() ^ ((mask >> 24) & 0xff)); dst.put(b); b = (byte) (src.get() ^ ((mask >> 16) & 0xff)); dst.put(b); b = (byte) (src.get() ^ ((mask >> 8) & 0xff)); dst.put(b); break; case 2: b = (byte) (src.get() ^ ((mask >> 24) & 0xff)); dst.put(b); b = (byte) (src.get() ^ ((mask >> 16) & 0xff)); dst.put(b); break; case 1: b = (byte) (src.get() ^ (mask >> 24)); dst.put(b); break; case 0: default: break; } }
[ "public", "static", "void", "xor", "(", "ByteBuffer", "src", ",", "ByteBuffer", "dst", ",", "int", "mask", ")", "{", "int", "remainder", "=", "src", ".", "remaining", "(", ")", "%", "4", ";", "int", "remaining", "=", "src", ".", "remaining", "(", ")"...
Masks source buffer into destination buffer. @param src the buffer containing readable bytes to be masked @param dst the buffer where masked bytes are written @param mask the mask to apply
[ "Masks", "source", "buffer", "into", "destination", "buffer", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameUtils.java#L32-L68
alkacon/opencms-core
src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBContentTables.java
CmsUpdateDBContentTables.transferOnlineContents
protected void transferOnlineContents(CmsSetupDb dbCon, int pubTag) throws SQLException { String query = readQuery(QUERY_TRANSFER_ONLINE_CONTENTS); Map<String, String> replacer = Collections.singletonMap("${pubTag}", "" + pubTag); dbCon.updateSqlStatement(query, replacer, null); }
java
protected void transferOnlineContents(CmsSetupDb dbCon, int pubTag) throws SQLException { String query = readQuery(QUERY_TRANSFER_ONLINE_CONTENTS); Map<String, String> replacer = Collections.singletonMap("${pubTag}", "" + pubTag); dbCon.updateSqlStatement(query, replacer, null); }
[ "protected", "void", "transferOnlineContents", "(", "CmsSetupDb", "dbCon", ",", "int", "pubTag", ")", "throws", "SQLException", "{", "String", "query", "=", "readQuery", "(", "QUERY_TRANSFER_ONLINE_CONTENTS", ")", ";", "Map", "<", "String", ",", "String", ">", "...
Transfers the online content.<p> @param dbCon the db connection interface @param pubTag the publish tag to use @throws SQLException if something goes wrong
[ "Transfers", "the", "online", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBContentTables.java#L158-L163
apache/reef
lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/task/OperatorTopologyImpl.java
OperatorTopologyImpl.updateBaseTopology
private void updateBaseTopology() throws ParentDeadException { LOG.entering("OperatorTopologyImpl", "updateBaseTopology", getQualifiedName()); LOG.finest(getQualifiedName() + "Waiting to acquire topoLock"); synchronized (topologyLock) { LOG.finest(getQualifiedName() + "Acquired topoLock"); try { assert baseTopology != null; LOG.finest(getQualifiedName() + "Updating base topology. So setting dirty bit"); baseTopology.setChanges(true); LOG.finest(getQualifiedName() + "Waiting for ctrl msgs"); for (GroupCommunicationMessage msg = deltas.take(); msg.getType() != ReefNetworkGroupCommProtos.GroupCommMessage.Type.TopologySetup; msg = deltas.take()) { LOG.finest(getQualifiedName() + "Got " + msg.getType() + " msg from " + msg.getSrcid()); if (effectiveTopology == null && msg.getType() == ReefNetworkGroupCommProtos.GroupCommMessage.Type.ParentDead) { /** * If effectiveTopology!=null, this method is being called from the BaseTopologyUpdateStage * And exception thrown will be caught by uncaughtExceptionHandler leading to System.exit */ LOG.finer(getQualifiedName() + "Throwing ParentDeadException"); throw new ParentDeadException(getQualifiedName() + "Parent dead. Current behavior is for the child to die too."); } else { LOG.finest(getQualifiedName() + "Updating baseTopology struct"); baseTopology.update(msg); sendAckToDriver(msg); } LOG.finest(getQualifiedName() + "Waiting for ctrl msgs"); } updateEffTopologyFromBaseTopology(); } catch (final InterruptedException e) { throw new RuntimeException("InterruptedException while waiting for delta msg from driver", e); } LOG.finest(getQualifiedName() + "Released topoLock"); } LOG.exiting("OperatorTopologyImpl", "updateBaseTopology", getQualifiedName()); }
java
private void updateBaseTopology() throws ParentDeadException { LOG.entering("OperatorTopologyImpl", "updateBaseTopology", getQualifiedName()); LOG.finest(getQualifiedName() + "Waiting to acquire topoLock"); synchronized (topologyLock) { LOG.finest(getQualifiedName() + "Acquired topoLock"); try { assert baseTopology != null; LOG.finest(getQualifiedName() + "Updating base topology. So setting dirty bit"); baseTopology.setChanges(true); LOG.finest(getQualifiedName() + "Waiting for ctrl msgs"); for (GroupCommunicationMessage msg = deltas.take(); msg.getType() != ReefNetworkGroupCommProtos.GroupCommMessage.Type.TopologySetup; msg = deltas.take()) { LOG.finest(getQualifiedName() + "Got " + msg.getType() + " msg from " + msg.getSrcid()); if (effectiveTopology == null && msg.getType() == ReefNetworkGroupCommProtos.GroupCommMessage.Type.ParentDead) { /** * If effectiveTopology!=null, this method is being called from the BaseTopologyUpdateStage * And exception thrown will be caught by uncaughtExceptionHandler leading to System.exit */ LOG.finer(getQualifiedName() + "Throwing ParentDeadException"); throw new ParentDeadException(getQualifiedName() + "Parent dead. Current behavior is for the child to die too."); } else { LOG.finest(getQualifiedName() + "Updating baseTopology struct"); baseTopology.update(msg); sendAckToDriver(msg); } LOG.finest(getQualifiedName() + "Waiting for ctrl msgs"); } updateEffTopologyFromBaseTopology(); } catch (final InterruptedException e) { throw new RuntimeException("InterruptedException while waiting for delta msg from driver", e); } LOG.finest(getQualifiedName() + "Released topoLock"); } LOG.exiting("OperatorTopologyImpl", "updateBaseTopology", getQualifiedName()); }
[ "private", "void", "updateBaseTopology", "(", ")", "throws", "ParentDeadException", "{", "LOG", ".", "entering", "(", "\"OperatorTopologyImpl\"", ",", "\"updateBaseTopology\"", ",", "getQualifiedName", "(", ")", ")", ";", "LOG", ".", "finest", "(", "getQualifiedName...
Blocking method that waits till the base topology is updated Unblocks when. we receive a TopologySetup msg from driver <p> Will also update the effective topology when the base topology is updated so that creation of effective topology is limited to just this method and refresh will only refresh the effective topology with deletion msgs from deletionDeltas queue @throws ParentDeadException
[ "Blocking", "method", "that", "waits", "till", "the", "base", "topology", "is", "updated", "Unblocks", "when", ".", "we", "receive", "a", "TopologySetup", "msg", "from", "driver", "<p", ">", "Will", "also", "update", "the", "effective", "topology", "when", "...
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/task/OperatorTopologyImpl.java#L305-L345
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addCountToMonomerNotation
public final static void addCountToMonomerNotation(PolymerNotation polymer, int position, String count) { polymer.getPolymerElements().getListOfElements().get(position).setCount(count); }
java
public final static void addCountToMonomerNotation(PolymerNotation polymer, int position, String count) { polymer.getPolymerElements().getListOfElements().get(position).setCount(count); }
[ "public", "final", "static", "void", "addCountToMonomerNotation", "(", "PolymerNotation", "polymer", ",", "int", "position", ",", "String", "count", ")", "{", "polymer", ".", "getPolymerElements", "(", ")", ".", "getListOfElements", "(", ")", ".", "get", "(", ...
method to set the count of a MonomerNotation @param polymer PolymerNotation @param position position of the MonomerNotation @param count new count of the MonomerNotation
[ "method", "to", "set", "the", "count", "of", "a", "MonomerNotation" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L340-L342
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.replaceEntries
public static boolean replaceEntries(final File zip, final ZipEntrySource[] entries) { return operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { return replaceEntries(zip, entries, tmpFile); } }); }
java
public static boolean replaceEntries(final File zip, final ZipEntrySource[] entries) { return operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { return replaceEntries(zip, entries, tmpFile); } }); }
[ "public", "static", "boolean", "replaceEntries", "(", "final", "File", "zip", ",", "final", "ZipEntrySource", "[", "]", "entries", ")", "{", "return", "operateInPlace", "(", "zip", ",", "new", "InPlaceAction", "(", ")", "{", "public", "boolean", "act", "(", ...
Changes an existing ZIP file: replaces a given entry in it. @param zip an existing ZIP file. @param entries new ZIP entries to be replaced with. @return <code>true</code> if at least one entry was replaced.
[ "Changes", "an", "existing", "ZIP", "file", ":", "replaces", "a", "given", "entry", "in", "it", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2673-L2679
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McCodeGen.java
McCodeGen.writeTransaction
private void writeTransaction(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns an <code>javax.resource.spi.LocalTransaction</code> instance.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return LocalTransaction instance\n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception if operation fails\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public LocalTransaction getLocalTransaction() throws ResourceException"); writeLeftCurlyBracket(out, indent); if (def.getSupportTransaction().equals("NoTransaction")) { writeWithIndent(out, indent + 1, "throw new NotSupportedException(\"getLocalTransaction() not supported\");"); } else { writeLogging(def, out, indent + 1, "trace", "getLocalTransaction"); writeWithIndent(out, indent + 1, "return null;"); } writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns an <code>javax.transaction.xa.XAresource</code> instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return XAResource instance\n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception if operation fails\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public XAResource getXAResource() throws ResourceException"); writeLeftCurlyBracket(out, indent); if (def.getSupportTransaction().equals("NoTransaction")) { writeWithIndent(out, indent + 1, "throw new NotSupportedException(\"getXAResource() not supported\");"); } else { writeLogging(def, out, indent + 1, "trace", "getXAResource"); writeWithIndent(out, indent + 1, "return null;"); } writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeTransaction(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns an <code>javax.resource.spi.LocalTransaction</code> instance.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return LocalTransaction instance\n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception if operation fails\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public LocalTransaction getLocalTransaction() throws ResourceException"); writeLeftCurlyBracket(out, indent); if (def.getSupportTransaction().equals("NoTransaction")) { writeWithIndent(out, indent + 1, "throw new NotSupportedException(\"getLocalTransaction() not supported\");"); } else { writeLogging(def, out, indent + 1, "trace", "getLocalTransaction"); writeWithIndent(out, indent + 1, "return null;"); } writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns an <code>javax.transaction.xa.XAresource</code> instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return XAResource instance\n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception if operation fails\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public XAResource getXAResource() throws ResourceException"); writeLeftCurlyBracket(out, indent); if (def.getSupportTransaction().equals("NoTransaction")) { writeWithIndent(out, indent + 1, "throw new NotSupportedException(\"getXAResource() not supported\");"); } else { writeLogging(def, out, indent + 1, "trace", "getXAResource"); writeWithIndent(out, indent + 1, "return null;"); } writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeTransaction", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "in...
Output Transaction method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "Transaction", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McCodeGen.java#L391-L435
Erudika/para
para-core/src/main/java/com/erudika/para/core/App.java
App.setResourcePermissions
public void setResourcePermissions(Map<String, Map<String, List<String>>> resourcePermissions) { this.resourcePermissions = resourcePermissions; }
java
public void setResourcePermissions(Map<String, Map<String, List<String>>> resourcePermissions) { this.resourcePermissions = resourcePermissions; }
[ "public", "void", "setResourcePermissions", "(", "Map", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", ">", "resourcePermissions", ")", "{", "this", ".", "resourcePermissions", "=", "resourcePermissions", ";", "}" ]
Sets the permissions map. @param resourcePermissions permissions map
[ "Sets", "the", "permissions", "map", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/App.java#L297-L299
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_sqlserver_serviceName_upgrade_duration_POST
public OvhOrder license_sqlserver_serviceName_upgrade_duration_POST(String serviceName, String duration, OvhSqlServerVersionEnum version) throws IOException { String qPath = "/order/license/sqlserver/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "version", version); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder license_sqlserver_serviceName_upgrade_duration_POST(String serviceName, String duration, OvhSqlServerVersionEnum version) throws IOException { String qPath = "/order/license/sqlserver/{serviceName}/upgrade/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "version", version); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "license_sqlserver_serviceName_upgrade_duration_POST", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhSqlServerVersionEnum", "version", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/license/sqlserver/{serviceName}/...
Create order REST: POST /order/license/sqlserver/{serviceName}/upgrade/{duration} @param version [required] This license version @param serviceName [required] The name of your SQL Server license @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1427-L1434
trellis-ldp/trellis
components/webdav/src/main/java/org/trellisldp/webdav/TrellisWebDAV.java
TrellisWebDAV.getProperties
@PROPFIND @Consumes({APPLICATION_XML}) @Produces({APPLICATION_XML}) @Timed public void getProperties(@Suspended final AsyncResponse response, @Context final Request request, @Context final UriInfo uriInfo, @Context final HttpHeaders headers, final DavPropFind propfind) throws ParserConfigurationException { final TrellisRequest req = new TrellisRequest(request, uriInfo, headers); final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath()); final String location = fromUri(getBaseUrl(req)).path(req.getPath()).build().toString(); final Document doc = getDocument(); services.getResourceService().get(identifier) .thenApply(this::checkResource) .thenApply(propertiesToMultiStatus(doc, location, propfind)) .thenApply(multistatus -> status(MULTI_STATUS).entity(multistatus).build()) .exceptionally(this::handleException).thenApply(response::resume); }
java
@PROPFIND @Consumes({APPLICATION_XML}) @Produces({APPLICATION_XML}) @Timed public void getProperties(@Suspended final AsyncResponse response, @Context final Request request, @Context final UriInfo uriInfo, @Context final HttpHeaders headers, final DavPropFind propfind) throws ParserConfigurationException { final TrellisRequest req = new TrellisRequest(request, uriInfo, headers); final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath()); final String location = fromUri(getBaseUrl(req)).path(req.getPath()).build().toString(); final Document doc = getDocument(); services.getResourceService().get(identifier) .thenApply(this::checkResource) .thenApply(propertiesToMultiStatus(doc, location, propfind)) .thenApply(multistatus -> status(MULTI_STATUS).entity(multistatus).build()) .exceptionally(this::handleException).thenApply(response::resume); }
[ "@", "PROPFIND", "@", "Consumes", "(", "{", "APPLICATION_XML", "}", ")", "@", "Produces", "(", "{", "APPLICATION_XML", "}", ")", "@", "Timed", "public", "void", "getProperties", "(", "@", "Suspended", "final", "AsyncResponse", "response", ",", "@", "Context"...
Get properties for a resource. @param response the response @param request the request @param uriInfo the URI info @param headers the headers @param propfind the propfind @throws ParserConfigurationException if the XML parser is not properly configured
[ "Get", "properties", "for", "a", "resource", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/components/webdav/src/main/java/org/trellisldp/webdav/TrellisWebDAV.java#L238-L254
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsReplace.java
CmsReplace.getContextMenuCommand
public static I_CmsContextMenuCommand getContextMenuCommand() { return new I_CmsContextMenuCommand() { public void execute(CmsUUID structureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { // nothing to do, will be handled by the widget } public A_CmsContextMenuItem getItemWidget( CmsUUID structureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { return new CmsReplace(structureId, handler, bean); } public boolean hasItemWidget() { return true; } }; }
java
public static I_CmsContextMenuCommand getContextMenuCommand() { return new I_CmsContextMenuCommand() { public void execute(CmsUUID structureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { // nothing to do, will be handled by the widget } public A_CmsContextMenuItem getItemWidget( CmsUUID structureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { return new CmsReplace(structureId, handler, bean); } public boolean hasItemWidget() { return true; } }; }
[ "public", "static", "I_CmsContextMenuCommand", "getContextMenuCommand", "(", ")", "{", "return", "new", "I_CmsContextMenuCommand", "(", ")", "{", "public", "void", "execute", "(", "CmsUUID", "structureId", ",", "I_CmsContextMenuHandler", "handler", ",", "CmsContextMenuE...
Returns the context menu command according to {@link org.opencms.gwt.client.ui.contextmenu.I_CmsHasContextMenuCommand}.<p> @return the context menu command
[ "Returns", "the", "context", "menu", "command", "according", "to", "{", "@link", "org", ".", "opencms", ".", "gwt", ".", "client", ".", "ui", ".", "contextmenu", ".", "I_CmsHasContextMenuCommand", "}", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsReplace.java#L87-L109
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/Evaluation.java
Evaluation.getPredictionsByActualClass
public List<Prediction> getPredictionsByActualClass(int actualClass) { if (confusionMatrixMetaData == null) return null; List<Prediction> out = new ArrayList<>(); for (Map.Entry<Pair<Integer, Integer>, List<Object>> entry : confusionMatrixMetaData.entrySet()) { //Entry Pair: (Actual,Predicted) if (entry.getKey().getFirst() == actualClass) { int actual = entry.getKey().getFirst(); int predicted = entry.getKey().getSecond(); for (Object m : entry.getValue()) { out.add(new Prediction(actual, predicted, m)); } } } return out; }
java
public List<Prediction> getPredictionsByActualClass(int actualClass) { if (confusionMatrixMetaData == null) return null; List<Prediction> out = new ArrayList<>(); for (Map.Entry<Pair<Integer, Integer>, List<Object>> entry : confusionMatrixMetaData.entrySet()) { //Entry Pair: (Actual,Predicted) if (entry.getKey().getFirst() == actualClass) { int actual = entry.getKey().getFirst(); int predicted = entry.getKey().getSecond(); for (Object m : entry.getValue()) { out.add(new Prediction(actual, predicted, m)); } } } return out; }
[ "public", "List", "<", "Prediction", ">", "getPredictionsByActualClass", "(", "int", "actualClass", ")", "{", "if", "(", "confusionMatrixMetaData", "==", "null", ")", "return", "null", ";", "List", "<", "Prediction", ">", "out", "=", "new", "ArrayList", "<>", ...
Get a list of predictions, for all data with the specified <i>actual</i> class, regardless of the predicted class. <p> <b>Note</b>: Prediction errors are ONLY available if the "evaluate with metadata" method is used: {@link #eval(INDArray, INDArray, List)} Otherwise (if the metadata hasn't been recorded via that previously mentioned eval method), there is no value in splitting each prediction out into a separate Prediction object - instead, use the confusion matrix to get the counts, via {@link #getConfusionMatrix()} @param actualClass Actual class to get predictions for @return List of predictions, or null if the "evaluate with metadata" method was not used
[ "Get", "a", "list", "of", "predictions", "for", "all", "data", "with", "the", "specified", "<i", ">", "actual<", "/", "i", ">", "class", "regardless", "of", "the", "predicted", "class", ".", "<p", ">", "<b", ">", "Note<", "/", "b", ">", ":", "Predict...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/Evaluation.java#L1771-L1786
jenkinsci/jenkins
cli/src/main/java/hudson/cli/PrivateKeyProvider.java
PrivateKeyProvider.readFromDefaultLocations
public boolean readFromDefaultLocations() { final File home = new File(System.getProperty("user.home")); boolean read = false; for (String path : new String[] {".ssh/id_rsa", ".ssh/id_dsa", ".ssh/identity"}) { final File key = new File(home, path); if (!key.exists()) continue; try { readFrom(key); read = true; } catch (IOException e) { LOGGER.log(FINE, "Failed to load " + key, e); } catch (GeneralSecurityException e) { LOGGER.log(FINE, "Failed to load " + key, e); } } return read; }
java
public boolean readFromDefaultLocations() { final File home = new File(System.getProperty("user.home")); boolean read = false; for (String path : new String[] {".ssh/id_rsa", ".ssh/id_dsa", ".ssh/identity"}) { final File key = new File(home, path); if (!key.exists()) continue; try { readFrom(key); read = true; } catch (IOException e) { LOGGER.log(FINE, "Failed to load " + key, e); } catch (GeneralSecurityException e) { LOGGER.log(FINE, "Failed to load " + key, e); } } return read; }
[ "public", "boolean", "readFromDefaultLocations", "(", ")", "{", "final", "File", "home", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"user.home\"", ")", ")", ";", "boolean", "read", "=", "false", ";", "for", "(", "String", "path", ":", ...
Read keys from default keyFiles {@code .ssh/id_rsa}, {@code .ssh/id_dsa} and {@code .ssh/identity}. @return true if some key was read successfully.
[ "Read", "keys", "from", "default", "keyFiles" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/cli/src/main/java/hudson/cli/PrivateKeyProvider.java#L77-L99
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/WikisApi.java
WikisApi.uploadAttachment
public WikiAttachment uploadAttachment(Object projectIdOrPath, File fileToUpload, String branch) throws GitLabApiException { URL url; try { url = getApiClient().getApiUrl("projects", getProjectIdOrPath(projectIdOrPath), "wikis", "attachments"); } catch (IOException ioe) { throw new GitLabApiException(ioe); } GitLabApiForm formData = new GitLabApiForm().withParam("branch", branch); Response response = upload(Response.Status.CREATED, "file", fileToUpload, null, formData, url); return (response.readEntity(WikiAttachment.class)); }
java
public WikiAttachment uploadAttachment(Object projectIdOrPath, File fileToUpload, String branch) throws GitLabApiException { URL url; try { url = getApiClient().getApiUrl("projects", getProjectIdOrPath(projectIdOrPath), "wikis", "attachments"); } catch (IOException ioe) { throw new GitLabApiException(ioe); } GitLabApiForm formData = new GitLabApiForm().withParam("branch", branch); Response response = upload(Response.Status.CREATED, "file", fileToUpload, null, formData, url); return (response.readEntity(WikiAttachment.class)); }
[ "public", "WikiAttachment", "uploadAttachment", "(", "Object", "projectIdOrPath", ",", "File", "fileToUpload", ",", "String", "branch", ")", "throws", "GitLabApiException", "{", "URL", "url", ";", "try", "{", "url", "=", "getApiClient", "(", ")", ".", "getApiUrl...
Uploads a file to the attachment folder inside the wiki’s repository. The attachment folder is the uploads folder. <pre><code>POST /projects/:id/wikis/attachments</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param fileToUpload the File instance of the file to upload, required @param branch the name of the branch, defaults to the wiki repository default branch, optional @return a FileUpload instance with information on the just uploaded file @throws GitLabApiException if any exception occurs
[ "Uploads", "a", "file", "to", "the", "attachment", "folder", "inside", "the", "wiki’s", "repository", ".", "The", "attachment", "folder", "is", "the", "uploads", "folder", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/WikisApi.java#L196-L208
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/action/menu/DeleteFeatureAction.java
DeleteFeatureAction.onClick
public void onClick(MenuItemClickEvent event) { if (feature != null && feature.isSelected()) { SC.confirm( I18nProvider.getGlobal().confirmDeleteFeature(feature.getLabel(), feature.getLayer().getLabel()), new BooleanCallback() { public void execute(Boolean value) { if (value) { feature.getLayer().deselectFeature(feature); mapWidget.getMapModel().getFeatureEditor() .startEditing(new Feature[] { feature }, null); SaveEditingAction action = new SaveEditingAction(mapWidget, controller); action.onClick(null); } } }); } }
java
public void onClick(MenuItemClickEvent event) { if (feature != null && feature.isSelected()) { SC.confirm( I18nProvider.getGlobal().confirmDeleteFeature(feature.getLabel(), feature.getLayer().getLabel()), new BooleanCallback() { public void execute(Boolean value) { if (value) { feature.getLayer().deselectFeature(feature); mapWidget.getMapModel().getFeatureEditor() .startEditing(new Feature[] { feature }, null); SaveEditingAction action = new SaveEditingAction(mapWidget, controller); action.onClick(null); } } }); } }
[ "public", "void", "onClick", "(", "MenuItemClickEvent", "event", ")", "{", "if", "(", "feature", "!=", "null", "&&", "feature", ".", "isSelected", "(", ")", ")", "{", "SC", ".", "confirm", "(", "I18nProvider", ".", "getGlobal", "(", ")", ".", "confirmDel...
Prepare a FeatureTransaction for deletion of the selected feature, and ask if the user wants to continue. If he/she does, the feature will be deselected and then the FeatureTransaction will be committed.
[ "Prepare", "a", "FeatureTransaction", "for", "deletion", "of", "the", "selected", "feature", "and", "ask", "if", "the", "user", "wants", "to", "continue", ".", "If", "he", "/", "she", "does", "the", "feature", "will", "be", "deselected", "and", "then", "th...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/DeleteFeatureAction.java#L62-L79
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java
CollationRootElements.getTertiaryAfter
int getTertiaryAfter(int index, int s, int t) { long secTer; int terLimit; if(index == 0) { // primary = 0 if(s == 0) { assert(t != 0); index = (int)elements[IX_FIRST_TERTIARY_INDEX]; // Gap at the end of the tertiary CE range. terLimit = 0x4000; } else { index = (int)elements[IX_FIRST_SECONDARY_INDEX]; // Gap for tertiaries of primary/secondary CEs. terLimit = getTertiaryBoundary(); } secTer = elements[index] & ~SEC_TER_DELTA_FLAG; } else { assert(index >= (int)elements[IX_FIRST_PRIMARY_INDEX]); secTer = getFirstSecTerForPrimary(index + 1); // If this is an explicit sec/ter unit, then it will be read once more. terLimit = getTertiaryBoundary(); } long st = (((long)s & 0xffffffffL) << 16) | t; for(;;) { if(secTer > st) { assert((secTer >> 16) == s); return (int)secTer & 0xffff; } secTer = elements[++index]; // No tertiary greater than t for this primary+secondary. if((secTer & SEC_TER_DELTA_FLAG) == 0 || (secTer >> 16) > s) { return terLimit; } secTer &= ~SEC_TER_DELTA_FLAG; } }
java
int getTertiaryAfter(int index, int s, int t) { long secTer; int terLimit; if(index == 0) { // primary = 0 if(s == 0) { assert(t != 0); index = (int)elements[IX_FIRST_TERTIARY_INDEX]; // Gap at the end of the tertiary CE range. terLimit = 0x4000; } else { index = (int)elements[IX_FIRST_SECONDARY_INDEX]; // Gap for tertiaries of primary/secondary CEs. terLimit = getTertiaryBoundary(); } secTer = elements[index] & ~SEC_TER_DELTA_FLAG; } else { assert(index >= (int)elements[IX_FIRST_PRIMARY_INDEX]); secTer = getFirstSecTerForPrimary(index + 1); // If this is an explicit sec/ter unit, then it will be read once more. terLimit = getTertiaryBoundary(); } long st = (((long)s & 0xffffffffL) << 16) | t; for(;;) { if(secTer > st) { assert((secTer >> 16) == s); return (int)secTer & 0xffff; } secTer = elements[++index]; // No tertiary greater than t for this primary+secondary. if((secTer & SEC_TER_DELTA_FLAG) == 0 || (secTer >> 16) > s) { return terLimit; } secTer &= ~SEC_TER_DELTA_FLAG; } }
[ "int", "getTertiaryAfter", "(", "int", "index", ",", "int", "s", ",", "int", "t", ")", "{", "long", "secTer", ";", "int", "terLimit", ";", "if", "(", "index", "==", "0", ")", "{", "// primary = 0", "if", "(", "s", "==", "0", ")", "{", "assert", "...
Returns the tertiary weight after [p, s, t] where index=findPrimary(p) except use index=0 for p=0. <p>Must return a weight for every root [p, s, t] as well as for every weight returned by getTertiaryBefore(). If s!=0 then t can be BEFORE_WEIGHT16. <p>Exception: [0, 0, 0] is handled by the CollationBuilder: Both its lower and upper boundaries are special.
[ "Returns", "the", "tertiary", "weight", "after", "[", "p", "s", "t", "]", "where", "index", "=", "findPrimary", "(", "p", ")", "except", "use", "index", "=", "0", "for", "p", "=", "0", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java#L387-L420
drewwills/cernunnos
cernunnos-core/src/main/java/org/danann/cernunnos/runtime/PojoTask.java
PojoTask.afterPropertiesSet
public synchronized void afterPropertiesSet() { // Subsequent calls are no-ops... if (task == null) { // Be sure we have what we need... if (location == null) { String msg = "Property 'location' not set. You must specify " + "a Cernunnos XML document."; throw new IllegalStateException(msg); } if (log.isDebugEnabled()) { log.debug("Bootstrapping Cernunnos XML [context=" + context + " location=" + location); } try { URL u = ResourceHelper.evaluate(context, location); origin = u.toExternalForm(); task = runner.compileTask(u.toExternalForm()); } catch (Throwable t) { String msg = "Unable to read the specified Cernunnos XML" + "\n\t\tcontext=" + context + "\n\t\tlocation=" + location; throw new RuntimeException(msg, t); } } }
java
public synchronized void afterPropertiesSet() { // Subsequent calls are no-ops... if (task == null) { // Be sure we have what we need... if (location == null) { String msg = "Property 'location' not set. You must specify " + "a Cernunnos XML document."; throw new IllegalStateException(msg); } if (log.isDebugEnabled()) { log.debug("Bootstrapping Cernunnos XML [context=" + context + " location=" + location); } try { URL u = ResourceHelper.evaluate(context, location); origin = u.toExternalForm(); task = runner.compileTask(u.toExternalForm()); } catch (Throwable t) { String msg = "Unable to read the specified Cernunnos XML" + "\n\t\tcontext=" + context + "\n\t\tlocation=" + location; throw new RuntimeException(msg, t); } } }
[ "public", "synchronized", "void", "afterPropertiesSet", "(", ")", "{", "// Subsequent calls are no-ops...", "if", "(", "task", "==", "null", ")", "{", "// Be sure we have what we need...", "if", "(", "location", "==", "null", ")", "{", "String", "msg", "=", "\"Pro...
This method <em>must</em> be invoked after all POJO properties have been supplied. If this <code>Task</code> has been defined using Spring Dependency Injection, this method will be called for you by the Spring context. Additional calls to this method are no-ops.
[ "This", "method", "<em", ">", "must<", "/", "em", ">", "be", "invoked", "after", "all", "POJO", "properties", "have", "been", "supplied", ".", "If", "this", "<code", ">", "Task<", "/", "code", ">", "has", "been", "defined", "using", "Spring", "Dependency...
train
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/runtime/PojoTask.java#L121-L151
grpc/grpc-java
cronet/src/main/java/io/grpc/cronet/CronetChannelBuilder.java
CronetChannelBuilder.forAddress
public static CronetChannelBuilder forAddress(String host, int port, CronetEngine cronetEngine) { Preconditions.checkNotNull(cronetEngine, "cronetEngine"); return new CronetChannelBuilder(host, port, cronetEngine); }
java
public static CronetChannelBuilder forAddress(String host, int port, CronetEngine cronetEngine) { Preconditions.checkNotNull(cronetEngine, "cronetEngine"); return new CronetChannelBuilder(host, port, cronetEngine); }
[ "public", "static", "CronetChannelBuilder", "forAddress", "(", "String", "host", ",", "int", "port", ",", "CronetEngine", "cronetEngine", ")", "{", "Preconditions", ".", "checkNotNull", "(", "cronetEngine", ",", "\"cronetEngine\"", ")", ";", "return", "new", "Cron...
Creates a new builder for the given server host, port and CronetEngine.
[ "Creates", "a", "new", "builder", "for", "the", "given", "server", "host", "port", "and", "CronetEngine", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/cronet/src/main/java/io/grpc/cronet/CronetChannelBuilder.java#L56-L59
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/sender/http2/OutboundMsgHolder.java
OutboundMsgHolder.addPushResponse
public void addPushResponse(int streamId, HttpCarbonResponse pushResponse) { pushResponsesMap.put(streamId, pushResponse); responseFuture.notifyPushResponse(streamId, pushResponse); }
java
public void addPushResponse(int streamId, HttpCarbonResponse pushResponse) { pushResponsesMap.put(streamId, pushResponse); responseFuture.notifyPushResponse(streamId, pushResponse); }
[ "public", "void", "addPushResponse", "(", "int", "streamId", ",", "HttpCarbonResponse", "pushResponse", ")", "{", "pushResponsesMap", ".", "put", "(", "streamId", ",", "pushResponse", ")", ";", "responseFuture", ".", "notifyPushResponse", "(", "streamId", ",", "pu...
Adds a push response message. @param streamId id of the stream in which the push response received @param pushResponse push response message
[ "Adds", "a", "push", "response", "message", "." ]
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/sender/http2/OutboundMsgHolder.java#L106-L109
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java
ConfigUtils.getString
public static String getString(Config config, String path, String def) { if (config.hasPath(path)) { return config.getString(path); } return def; }
java
public static String getString(Config config, String path, String def) { if (config.hasPath(path)) { return config.getString(path); } return def; }
[ "public", "static", "String", "getString", "(", "Config", "config", ",", "String", "path", ",", "String", "def", ")", "{", "if", "(", "config", ".", "hasPath", "(", "path", ")", ")", "{", "return", "config", ".", "getString", "(", "path", ")", ";", "...
Return string value at <code>path</code> if <code>config</code> has path. If not return <code>def</code> @param config in which the path may be present @param path key to look for in the config object @return string value at <code>path</code> if <code>config</code> has path. If not return <code>def</code>
[ "Return", "string", "value", "at", "<code", ">", "path<", "/", "code", ">", "if", "<code", ">", "config<", "/", "code", ">", "has", "path", ".", "If", "not", "return", "<code", ">", "def<", "/", "code", ">" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java#L322-L327
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindM2MBuilder.java
BindM2MBuilder.generateInsert
private void generateInsert(M2MEntity entity, String packageName) { if (!isMethodAlreadyDefined(entity, "insert")) { // @formatter:off MethodSpec methodSpec = MethodSpec.methodBuilder("insert").addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.ABSTRACT).addAnnotation(AnnotationSpec.builder(BindSqlInsert.class).build()) .addParameter(ParameterSpec.builder(TypeUtility.className(packageName, entity.name), "bean") .addAnnotation( AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", "bean").build()) .build()) .returns(Integer.TYPE).build(); // @formatter:on classBuilder.addMethod(methodSpec); } }
java
private void generateInsert(M2MEntity entity, String packageName) { if (!isMethodAlreadyDefined(entity, "insert")) { // @formatter:off MethodSpec methodSpec = MethodSpec.methodBuilder("insert").addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.ABSTRACT).addAnnotation(AnnotationSpec.builder(BindSqlInsert.class).build()) .addParameter(ParameterSpec.builder(TypeUtility.className(packageName, entity.name), "bean") .addAnnotation( AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", "bean").build()) .build()) .returns(Integer.TYPE).build(); // @formatter:on classBuilder.addMethod(methodSpec); } }
[ "private", "void", "generateInsert", "(", "M2MEntity", "entity", ",", "String", "packageName", ")", "{", "if", "(", "!", "isMethodAlreadyDefined", "(", "entity", ",", "\"insert\"", ")", ")", "{", "// @formatter:off", "MethodSpec", "methodSpec", "=", "MethodSpec", ...
Generate insert. @param entity the entity @param packageName the package name
[ "Generate", "insert", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindM2MBuilder.java#L414-L427
Hygieia/Hygieia
collectors/feature/versionone/src/main/java/com/capitalone/dashboard/datafactory/versionone/VersionOneDataFactoryImpl.java
VersionOneDataFactoryImpl.versionOneAuthentication
private V1Connector versionOneAuthentication(Map<String, String> auth) throws HygieiaException { V1Connector connector; try { if (!StringUtils.isEmpty(auth.get("v1ProxyUrl"))) { ProxyProvider proxyProvider = new ProxyProvider(new URI(auth.get("v1ProxyUrl")), "", ""); connector = V1Connector.withInstanceUrl(auth.get("v1BaseUri")) .withUserAgentHeader(FeatureCollectorConstants.AGENT_NAME, FeatureCollectorConstants.AGENT_VER) .withAccessToken(auth.get("v1AccessToken")) .withProxy(proxyProvider) .build(); } else { connector = V1Connector.withInstanceUrl(auth.get("v1BaseUri")) .withUserAgentHeader(FeatureCollectorConstants.AGENT_NAME, FeatureCollectorConstants.AGENT_VER) .withAccessToken(auth.get("v1AccessToken")).build(); } } catch (V1Exception ve) { throw new HygieiaException("FAILED: VersionOne was not able to authenticate", ve, HygieiaException.INVALID_CONFIGURATION); } catch (MalformedURLException | URISyntaxException me) { throw new HygieiaException("FAILED: Invalid VersionOne URL.", me, HygieiaException.INVALID_CONFIGURATION); } return connector; }
java
private V1Connector versionOneAuthentication(Map<String, String> auth) throws HygieiaException { V1Connector connector; try { if (!StringUtils.isEmpty(auth.get("v1ProxyUrl"))) { ProxyProvider proxyProvider = new ProxyProvider(new URI(auth.get("v1ProxyUrl")), "", ""); connector = V1Connector.withInstanceUrl(auth.get("v1BaseUri")) .withUserAgentHeader(FeatureCollectorConstants.AGENT_NAME, FeatureCollectorConstants.AGENT_VER) .withAccessToken(auth.get("v1AccessToken")) .withProxy(proxyProvider) .build(); } else { connector = V1Connector.withInstanceUrl(auth.get("v1BaseUri")) .withUserAgentHeader(FeatureCollectorConstants.AGENT_NAME, FeatureCollectorConstants.AGENT_VER) .withAccessToken(auth.get("v1AccessToken")).build(); } } catch (V1Exception ve) { throw new HygieiaException("FAILED: VersionOne was not able to authenticate", ve, HygieiaException.INVALID_CONFIGURATION); } catch (MalformedURLException | URISyntaxException me) { throw new HygieiaException("FAILED: Invalid VersionOne URL.", me, HygieiaException.INVALID_CONFIGURATION); } return connector; }
[ "private", "V1Connector", "versionOneAuthentication", "(", "Map", "<", "String", ",", "String", ">", "auth", ")", "throws", "HygieiaException", "{", "V1Connector", "connector", ";", "try", "{", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "auth", ".", ...
Used for establishing connection to VersionOne based on authentication @param auth A key-value pairing of authentication values @return A V1Connector connection instance
[ "Used", "for", "establishing", "connection", "to", "VersionOne", "based", "on", "authentication" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/feature/versionone/src/main/java/com/capitalone/dashboard/datafactory/versionone/VersionOneDataFactoryImpl.java#L90-L116
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java
HadoopLogParser.parseDate
protected Calendar parseDate(String strDate, String strTime) { Calendar retval = Calendar.getInstance(); // set date String[] fields = strDate.split("-"); retval.set(Calendar.YEAR, Integer.parseInt(fields[0])); retval.set(Calendar.MONTH, Integer.parseInt(fields[1])); retval.set(Calendar.DATE, Integer.parseInt(fields[2])); // set time fields = strTime.split(":"); retval.set(Calendar.HOUR_OF_DAY, Integer.parseInt(fields[0])); retval.set(Calendar.MINUTE, Integer.parseInt(fields[1])); retval.set(Calendar.SECOND, Integer.parseInt(fields[2])); return retval; }
java
protected Calendar parseDate(String strDate, String strTime) { Calendar retval = Calendar.getInstance(); // set date String[] fields = strDate.split("-"); retval.set(Calendar.YEAR, Integer.parseInt(fields[0])); retval.set(Calendar.MONTH, Integer.parseInt(fields[1])); retval.set(Calendar.DATE, Integer.parseInt(fields[2])); // set time fields = strTime.split(":"); retval.set(Calendar.HOUR_OF_DAY, Integer.parseInt(fields[0])); retval.set(Calendar.MINUTE, Integer.parseInt(fields[1])); retval.set(Calendar.SECOND, Integer.parseInt(fields[2])); return retval; }
[ "protected", "Calendar", "parseDate", "(", "String", "strDate", ",", "String", "strTime", ")", "{", "Calendar", "retval", "=", "Calendar", ".", "getInstance", "(", ")", ";", "// set date", "String", "[", "]", "fields", "=", "strDate", ".", "split", "(", "\...
Parse a date found in the Hadoop log. @return a Calendar representing the date
[ "Parse", "a", "date", "found", "in", "the", "Hadoop", "log", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/HadoopLogParser.java#L94-L107
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java
base_resource.post_requestEx
private base_resource post_requestEx(nitro_service service, options option) throws Exception { String sessionid = service.get_sessionid(); String request = resource_to_string(service, sessionid, option); return post_dataEx(service, request); }
java
private base_resource post_requestEx(nitro_service service, options option) throws Exception { String sessionid = service.get_sessionid(); String request = resource_to_string(service, sessionid, option); return post_dataEx(service, request); }
[ "private", "base_resource", "post_requestEx", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "String", "sessionid", "=", "service", ".", "get_sessionid", "(", ")", ";", "String", "request", "=", "resource_to_string", "(...
Use this method to perform a POST operation on netscaler resource. @param service nitro_service object. @param option Options class object. @return requested resource. @throws Exception if invalid input is given.
[ "Use", "this", "method", "to", "perform", "a", "POST", "operation", "on", "netscaler", "resource", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L108-L113
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/loader/PersistenceXMLLoader.java
PersistenceXMLLoader.parseDocument
private static Document parseDocument(final InputStream is) throws InvalidConfigurationException { Document persistenceXmlDoc; final List parsingErrors = new ArrayList(); final InputSource source = new InputSource(is); final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setNamespaceAware(true); try { DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); docBuilder.setErrorHandler(new ErrorLogger("XML InputStream", parsingErrors)); persistenceXmlDoc = docBuilder.parse(source); } catch (ParserConfigurationException e) { log.error("Error during parsing, Caused by: {}.", e); throw new PersistenceLoaderException("Error during parsing persistence.xml, caused by: ", e); } catch (IOException e) { throw new InvalidConfigurationException("Error reading persistence.xml, caused by: ", e); } catch (SAXException e) { throw new InvalidConfigurationException("Error parsing persistence.xml, caused by: ", e); } if (!parsingErrors.isEmpty()) { throw new InvalidConfigurationException("Invalid persistence.xml", (Throwable) parsingErrors.get(0)); } return persistenceXmlDoc; }
java
private static Document parseDocument(final InputStream is) throws InvalidConfigurationException { Document persistenceXmlDoc; final List parsingErrors = new ArrayList(); final InputSource source = new InputSource(is); final DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setNamespaceAware(true); try { DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); docBuilder.setErrorHandler(new ErrorLogger("XML InputStream", parsingErrors)); persistenceXmlDoc = docBuilder.parse(source); } catch (ParserConfigurationException e) { log.error("Error during parsing, Caused by: {}.", e); throw new PersistenceLoaderException("Error during parsing persistence.xml, caused by: ", e); } catch (IOException e) { throw new InvalidConfigurationException("Error reading persistence.xml, caused by: ", e); } catch (SAXException e) { throw new InvalidConfigurationException("Error parsing persistence.xml, caused by: ", e); } if (!parsingErrors.isEmpty()) { throw new InvalidConfigurationException("Invalid persistence.xml", (Throwable) parsingErrors.get(0)); } return persistenceXmlDoc; }
[ "private", "static", "Document", "parseDocument", "(", "final", "InputStream", "is", ")", "throws", "InvalidConfigurationException", "{", "Document", "persistenceXmlDoc", ";", "final", "List", "parsingErrors", "=", "new", "ArrayList", "(", ")", ";", "final", "InputS...
Reads the content of the persistence.xml file into an object model, with the root node of type {@link Document}. @param is {@link InputStream} of the persistence.xml content @return root node of the parsed xml content @throws InvalidConfigurationException if the content could not be read due to an I/O error or could not be parsedÏ
[ "Reads", "the", "content", "of", "the", "persistence", ".", "xml", "file", "into", "an", "object", "model", "with", "the", "root", "node", "of", "type", "{", "@link", "Document", "}", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/loader/PersistenceXMLLoader.java#L139-L173
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java
WebServiceEndpoint.addSoapBody
private void addSoapBody(SoapMessage response, Message replyMessage) throws TransformerException { if (!(replyMessage.getPayload() instanceof String) || StringUtils.hasText(replyMessage.getPayload(String.class))) { Source responseSource = getPayloadAsSource(replyMessage.getPayload()); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.transform(responseSource, response.getPayloadResult()); } }
java
private void addSoapBody(SoapMessage response, Message replyMessage) throws TransformerException { if (!(replyMessage.getPayload() instanceof String) || StringUtils.hasText(replyMessage.getPayload(String.class))) { Source responseSource = getPayloadAsSource(replyMessage.getPayload()); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.transform(responseSource, response.getPayloadResult()); } }
[ "private", "void", "addSoapBody", "(", "SoapMessage", "response", ",", "Message", "replyMessage", ")", "throws", "TransformerException", "{", "if", "(", "!", "(", "replyMessage", ".", "getPayload", "(", ")", "instanceof", "String", ")", "||", "StringUtils", ".",...
Add message payload as SOAP body element to the SOAP response. @param response @param replyMessage
[ "Add", "message", "payload", "as", "SOAP", "body", "element", "to", "the", "SOAP", "response", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java#L201-L211
alkacon/opencms-core
src/org/opencms/util/CmsStringUtil.java
CmsStringUtil.collectionAsString
public static String collectionAsString(Collection<?> collection, String separator) { StringBuffer string = new StringBuffer(128); Iterator<?> it = collection.iterator(); while (it.hasNext()) { string.append(it.next()); if (it.hasNext()) { string.append(separator); } } return string.toString(); }
java
public static String collectionAsString(Collection<?> collection, String separator) { StringBuffer string = new StringBuffer(128); Iterator<?> it = collection.iterator(); while (it.hasNext()) { string.append(it.next()); if (it.hasNext()) { string.append(separator); } } return string.toString(); }
[ "public", "static", "String", "collectionAsString", "(", "Collection", "<", "?", ">", "collection", ",", "String", "separator", ")", "{", "StringBuffer", "string", "=", "new", "StringBuffer", "(", "128", ")", ";", "Iterator", "<", "?", ">", "it", "=", "col...
Returns a string representation for the given collection using the given separator.<p> @param collection the collection to print @param separator the item separator @return the string representation for the given collection
[ "Returns", "a", "string", "representation", "for", "the", "given", "collection", "using", "the", "given", "separator", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L303-L314
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java
RecommendationsInner.disableRecommendationForSite
public void disableRecommendationForSite(String resourceGroupName, String siteName, String name) { disableRecommendationForSiteWithServiceResponseAsync(resourceGroupName, siteName, name).toBlocking().single().body(); }
java
public void disableRecommendationForSite(String resourceGroupName, String siteName, String name) { disableRecommendationForSiteWithServiceResponseAsync(resourceGroupName, siteName, name).toBlocking().single().body(); }
[ "public", "void", "disableRecommendationForSite", "(", "String", "resourceGroupName", ",", "String", "siteName", ",", "String", "name", ")", "{", "disableRecommendationForSiteWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ",", "name", ")", ".", "t...
Disables the specific rule for a web site permanently. Disables the specific rule for a web site permanently. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site name @param name Rule name @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
[ "Disables", "the", "specific", "rule", "for", "a", "web", "site", "permanently", ".", "Disables", "the", "specific", "rule", "for", "a", "web", "site", "permanently", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1406-L1408
shekhargulati/strman-java
src/main/java/strman/Strman.java
Strman.containsAny
public static boolean containsAny(final String value, final String[] needles, final boolean caseSensitive) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); return Arrays.stream(needles).anyMatch(needle -> contains(value, needle, caseSensitive)); }
java
public static boolean containsAny(final String value, final String[] needles, final boolean caseSensitive) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); return Arrays.stream(needles).anyMatch(needle -> contains(value, needle, caseSensitive)); }
[ "public", "static", "boolean", "containsAny", "(", "final", "String", "value", ",", "final", "String", "[", "]", "needles", ",", "final", "boolean", "caseSensitive", ")", "{", "validate", "(", "value", ",", "NULL_STRING_PREDICATE", ",", "NULL_STRING_MSG_SUPPLIER",...
Verifies that one or more of needles are contained in value. @param value input @param needles needles to search @param caseSensitive true or false @return boolean true if any needle is found else false
[ "Verifies", "that", "one", "or", "more", "of", "needles", "are", "contained", "in", "value", "." ]
train
https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L217-L220
google/closure-compiler
src/com/google/javascript/jscomp/parsing/parser/Parser.java
Parser.reportError
@FormatMethod private void reportError(ParseTree parseTree, @FormatString String message, Object... arguments) { if (parseTree == null) { reportError(message, arguments); } else { errorReporter.reportError(parseTree.location.start, message, arguments); } }
java
@FormatMethod private void reportError(ParseTree parseTree, @FormatString String message, Object... arguments) { if (parseTree == null) { reportError(message, arguments); } else { errorReporter.reportError(parseTree.location.start, message, arguments); } }
[ "@", "FormatMethod", "private", "void", "reportError", "(", "ParseTree", "parseTree", ",", "@", "FormatString", "String", "message", ",", "Object", "...", "arguments", ")", "{", "if", "(", "parseTree", "==", "null", ")", "{", "reportError", "(", "message", "...
Reports an error message at a given parse tree's location. @param parseTree The location to report the message at. @param message The message to report in String.format style. @param arguments The arguments to fill in the message format.
[ "Reports", "an", "error", "message", "at", "a", "given", "parse", "tree", "s", "location", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/parser/Parser.java#L4243-L4250
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.newBuilder
public static Builder newBuilder( TableId destinationTable, String sourceUri, FormatOptions format) { return newBuilder(destinationTable, ImmutableList.of(sourceUri), format); }
java
public static Builder newBuilder( TableId destinationTable, String sourceUri, FormatOptions format) { return newBuilder(destinationTable, ImmutableList.of(sourceUri), format); }
[ "public", "static", "Builder", "newBuilder", "(", "TableId", "destinationTable", ",", "String", "sourceUri", ",", "FormatOptions", "format", ")", "{", "return", "newBuilder", "(", "destinationTable", ",", "ImmutableList", ".", "of", "(", "sourceUri", ")", ",", "...
Creates a builder for a BigQuery Load Job configuration given the destination table, format and source URI.
[ "Creates", "a", "builder", "for", "a", "BigQuery", "Load", "Job", "configuration", "given", "the", "destination", "table", "format", "and", "source", "URI", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L526-L529
apereo/cas
support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/SamlRegisteredServiceMetadataExpirationPolicy.java
SamlRegisteredServiceMetadataExpirationPolicy.getCacheDurationForServiceProvider
protected long getCacheDurationForServiceProvider(final SamlRegisteredService service, final MetadataResolver chainingMetadataResolver) { try { val set = new CriteriaSet(); set.add(new EntityIdCriterion(service.getServiceId())); set.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME)); val entitySp = chainingMetadataResolver.resolveSingle(set); if (entitySp != null && entitySp.getCacheDuration() != null) { LOGGER.debug("Located cache duration [{}] specified in SP metadata for [{}]", entitySp.getCacheDuration(), entitySp.getEntityID()); return TimeUnit.MILLISECONDS.toNanos(entitySp.getCacheDuration()); } set.clear(); set.add(new EntityIdCriterion(service.getServiceId())); val entity = chainingMetadataResolver.resolveSingle(set); if (entity != null && entity.getCacheDuration() != null) { LOGGER.debug("Located cache duration [{}] specified in entity metadata for [{}]", entity.getCacheDuration(), entity.getEntityID()); return TimeUnit.MILLISECONDS.toNanos(entity.getCacheDuration()); } } catch (final Exception e) { LOGGER.debug(e.getMessage(), e); } return -1; }
java
protected long getCacheDurationForServiceProvider(final SamlRegisteredService service, final MetadataResolver chainingMetadataResolver) { try { val set = new CriteriaSet(); set.add(new EntityIdCriterion(service.getServiceId())); set.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME)); val entitySp = chainingMetadataResolver.resolveSingle(set); if (entitySp != null && entitySp.getCacheDuration() != null) { LOGGER.debug("Located cache duration [{}] specified in SP metadata for [{}]", entitySp.getCacheDuration(), entitySp.getEntityID()); return TimeUnit.MILLISECONDS.toNanos(entitySp.getCacheDuration()); } set.clear(); set.add(new EntityIdCriterion(service.getServiceId())); val entity = chainingMetadataResolver.resolveSingle(set); if (entity != null && entity.getCacheDuration() != null) { LOGGER.debug("Located cache duration [{}] specified in entity metadata for [{}]", entity.getCacheDuration(), entity.getEntityID()); return TimeUnit.MILLISECONDS.toNanos(entity.getCacheDuration()); } } catch (final Exception e) { LOGGER.debug(e.getMessage(), e); } return -1; }
[ "protected", "long", "getCacheDurationForServiceProvider", "(", "final", "SamlRegisteredService", "service", ",", "final", "MetadataResolver", "chainingMetadataResolver", ")", "{", "try", "{", "val", "set", "=", "new", "CriteriaSet", "(", ")", ";", "set", ".", "add"...
Gets cache duration for service provider. @param service the service @param chainingMetadataResolver the chaining metadata resolver @return the cache duration for service provider
[ "Gets", "cache", "duration", "for", "service", "provider", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/SamlRegisteredServiceMetadataExpirationPolicy.java#L75-L97
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDefinitionInventoryPersistenceImpl.java
CPDefinitionInventoryPersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPDefinitionInventory cpDefinitionInventory : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionInventory); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPDefinitionInventory cpDefinitionInventory : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionInventory); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CPDefinitionInventory", "cpDefinitionInventory", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",...
Removes all the cp definition inventories where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "cp", "definition", "inventories", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDefinitionInventoryPersistenceImpl.java#L1411-L1417
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/injection/InjectionHelper.java
InjectionHelper.setField
private static void setField(final Object instance, final Field field, final Object value) { final boolean accessability = field.isAccessible(); try { field.setAccessible(true); field.set(instance, value); } catch (Exception e) { InjectionException.rethrow(e); } finally { field.setAccessible(accessability); } }
java
private static void setField(final Object instance, final Field field, final Object value) { final boolean accessability = field.isAccessible(); try { field.setAccessible(true); field.set(instance, value); } catch (Exception e) { InjectionException.rethrow(e); } finally { field.setAccessible(accessability); } }
[ "private", "static", "void", "setField", "(", "final", "Object", "instance", ",", "final", "Field", "field", ",", "final", "Object", "value", ")", "{", "final", "boolean", "accessability", "=", "field", ".", "isAccessible", "(", ")", ";", "try", "{", "fiel...
Sets field on object with specified value. @param instance to set field on @param field to set @param value to be set
[ "Sets", "field", "on", "object", "with", "specified", "value", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/InjectionHelper.java#L188-L205
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/UcsApi.java
UcsApi.getContactHistory
public ApiSuccessResponse getContactHistory(String id, ContactHistoryData contactHistoryData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = getContactHistoryWithHttpInfo(id, contactHistoryData); return resp.getData(); }
java
public ApiSuccessResponse getContactHistory(String id, ContactHistoryData contactHistoryData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = getContactHistoryWithHttpInfo(id, contactHistoryData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "getContactHistory", "(", "String", "id", ",", "ContactHistoryData", "contactHistoryData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "getContactHistoryWithHttpInfo", "(", "id", ",", "c...
Get the history of interactions for a contact @param id id of the Contact (required) @param contactHistoryData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "the", "history", "of", "interactions", "for", "a", "contact" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UcsApi.java#L1033-L1036
sniffy/sniffy
sniffy-web/src/main/java/io/sniffy/servlet/SniffyRequestProcessor.java
SniffyRequestProcessor.generateFooterHtml
protected StringBuilder generateFooterHtml(int executedQueries, long serverTime) { return new StringBuilder(). append("<data id=\"sniffy\" data-sql-queries=\""). append(executedQueries). append("\" data-server-time=\""). append(serverTime) .append("\"/>"); }
java
protected StringBuilder generateFooterHtml(int executedQueries, long serverTime) { return new StringBuilder(). append("<data id=\"sniffy\" data-sql-queries=\""). append(executedQueries). append("\" data-server-time=\""). append(serverTime) .append("\"/>"); }
[ "protected", "StringBuilder", "generateFooterHtml", "(", "int", "executedQueries", ",", "long", "serverTime", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"<data id=\\\"sniffy\\\" data-sql-queries=\\\"\"", ")", ".", "append", "(", "execu...
Generates following HTML snippet <pre> {@code <data id="sniffy" data-sql-queries="5"/> } </pre> @param executedQueries number of executed queries @return StringBuilder with generated HTML
[ "Generates", "following", "HTML", "snippet", "<pre", ">", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-web/src/main/java/io/sniffy/servlet/SniffyRequestProcessor.java#L392-L399
OpenLiberty/open-liberty
dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java
InjectionProcessor.validateMissingJndiName
protected void validateMissingJndiName(Class<?> instanceClass, A annotation) throws InjectionException { if (isValidationLoggable()) // F50309.6 { Tr.error(tc, "MISSING_CLASS_LEVEL_ANNOTATION_NAME_CWNEN0073E", '@' + annotation.annotationType().getSimpleName(), instanceClass.getName(), ivNameSpaceConfig.getModuleName(), ivNameSpaceConfig.getApplicationName()); if (isValidationFailable()) { throw new InjectionException("The @" + annotation.annotationType().getSimpleName() + " class-level annotation on the " + instanceClass.getName() + " class in the " + ivNameSpaceConfig.getModuleName() + " module of the " + ivNameSpaceConfig.getApplicationName() + " application does not specify a JNDI name."); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "ignoring class-level annotation without name"); } }
java
protected void validateMissingJndiName(Class<?> instanceClass, A annotation) throws InjectionException { if (isValidationLoggable()) // F50309.6 { Tr.error(tc, "MISSING_CLASS_LEVEL_ANNOTATION_NAME_CWNEN0073E", '@' + annotation.annotationType().getSimpleName(), instanceClass.getName(), ivNameSpaceConfig.getModuleName(), ivNameSpaceConfig.getApplicationName()); if (isValidationFailable()) { throw new InjectionException("The @" + annotation.annotationType().getSimpleName() + " class-level annotation on the " + instanceClass.getName() + " class in the " + ivNameSpaceConfig.getModuleName() + " module of the " + ivNameSpaceConfig.getApplicationName() + " application does not specify a JNDI name."); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "ignoring class-level annotation without name"); } }
[ "protected", "void", "validateMissingJndiName", "(", "Class", "<", "?", ">", "instanceClass", ",", "A", "annotation", ")", "throws", "InjectionException", "{", "if", "(", "isValidationLoggable", "(", ")", ")", "// F50309.6", "{", "Tr", ".", "error", "(", "tc",...
Perform validation on a class-level annotation for which {@link #getJndiName} returned the empty string. By default, this method performs no validation for backwards compatibility. @param instanceClass the class containing the annotation @param annotation the annotation @throws InjectionException
[ "Perform", "validation", "on", "a", "class", "-", "level", "annotation", "for", "which", "{", "@link", "#getJndiName", "}", "returned", "the", "empty", "string", ".", "By", "default", "this", "method", "performs", "no", "validation", "for", "backwards", "compa...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionProcessor.java#L564-L588
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java
PresentationManager.logItem
public void logItem(String s1, String s2, String symbol) { info(String.format("(%s) %-25s %s", symbol, s1, (s2 != null) ? s2 : "")); }
java
public void logItem(String s1, String s2, String symbol) { info(String.format("(%s) %-25s %s", symbol, s1, (s2 != null) ? s2 : "")); }
[ "public", "void", "logItem", "(", "String", "s1", ",", "String", "s2", ",", "String", "symbol", ")", "{", "info", "(", "String", ".", "format", "(", "\"(%s) %-25s %s\"", ",", "symbol", ",", "s1", ",", "(", "s2", "!=", "null", ")", "?", "s2", ":", "...
Formatting helper for startup @param evt The event @param s1 Text @param s2 Extra description @param symbol Status symbol
[ "Formatting", "helper", "for", "startup" ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PresentationManager.java#L222-L224
alkacon/opencms-core
src/org/opencms/search/documents/CmsDocumentHtml.java
CmsDocumentHtml.extractContent
public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsIndexException, CmsException { logContentExtraction(resource, index); CmsFile file = readFile(cms, resource); try { CmsProperty encProp = cms.readPropertyObject( resource, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true); String encoding = encProp.getValue(OpenCms.getSystemInfo().getDefaultEncoding()); return CmsExtractorHtml.getExtractor().extractText(file.getContents(), encoding); } catch (Exception e) { throw new CmsIndexException( Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), e); } }
java
public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsIndexException, CmsException { logContentExtraction(resource, index); CmsFile file = readFile(cms, resource); try { CmsProperty encProp = cms.readPropertyObject( resource, CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING, true); String encoding = encProp.getValue(OpenCms.getSystemInfo().getDefaultEncoding()); return CmsExtractorHtml.getExtractor().extractText(file.getContents(), encoding); } catch (Exception e) { throw new CmsIndexException( Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), e); } }
[ "public", "I_CmsExtractionResult", "extractContent", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "I_CmsSearchIndex", "index", ")", "throws", "CmsIndexException", ",", "CmsException", "{", "logContentExtraction", "(", "resource", ",", "index", ")", ";...
Returns the raw text content of a given VFS resource containing HTML data.<p> @see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex)
[ "Returns", "the", "raw", "text", "content", "of", "a", "given", "VFS", "resource", "containing", "HTML", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentHtml.java#L65-L82
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/rewrite/rewritepolicy_binding.java
rewritepolicy_binding.get
public static rewritepolicy_binding get(nitro_service service, String name) throws Exception{ rewritepolicy_binding obj = new rewritepolicy_binding(); obj.set_name(name); rewritepolicy_binding response = (rewritepolicy_binding) obj.get_resource(service); return response; }
java
public static rewritepolicy_binding get(nitro_service service, String name) throws Exception{ rewritepolicy_binding obj = new rewritepolicy_binding(); obj.set_name(name); rewritepolicy_binding response = (rewritepolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "rewritepolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "rewritepolicy_binding", "obj", "=", "new", "rewritepolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ...
Use this API to fetch rewritepolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "rewritepolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/rewrite/rewritepolicy_binding.java#L136-L141
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/LocalTxManager.java
LocalTxManager.getCurrentTransaction
public TransactionImpl getCurrentTransaction() { TransactionImpl tx = tx_table.get(Thread.currentThread()); if(tx == null) { throw new TransactionNotInProgressException("Calling method needed transaction, but no transaction found for current thread :-("); } return tx; }
java
public TransactionImpl getCurrentTransaction() { TransactionImpl tx = tx_table.get(Thread.currentThread()); if(tx == null) { throw new TransactionNotInProgressException("Calling method needed transaction, but no transaction found for current thread :-("); } return tx; }
[ "public", "TransactionImpl", "getCurrentTransaction", "(", ")", "{", "TransactionImpl", "tx", "=", "tx_table", ".", "get", "(", "Thread", ".", "currentThread", "(", ")", ")", ";", "if", "(", "tx", "==", "null", ")", "{", "throw", "new", "TransactionNotInProg...
Returns the current transaction for the calling thread. @throws org.odmg.TransactionNotInProgressException {@link org.odmg.TransactionNotInProgressException} if no transaction was found.
[ "Returns", "the", "current", "transaction", "for", "the", "calling", "thread", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/LocalTxManager.java#L54-L62
opentable/otj-jaxrs
client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java
JaxRsClientFactory.newBuilder
public synchronized ClientBuilder newBuilder(String clientName, Collection<JaxRsFeatureGroup> featureGroupsIn) { final JaxRsClientConfig jaxRsConfig = configForClient(clientName); return newBuilder(clientName, jaxRsConfig, featureGroupsIn); }
java
public synchronized ClientBuilder newBuilder(String clientName, Collection<JaxRsFeatureGroup> featureGroupsIn) { final JaxRsClientConfig jaxRsConfig = configForClient(clientName); return newBuilder(clientName, jaxRsConfig, featureGroupsIn); }
[ "public", "synchronized", "ClientBuilder", "newBuilder", "(", "String", "clientName", ",", "Collection", "<", "JaxRsFeatureGroup", ">", "featureGroupsIn", ")", "{", "final", "JaxRsClientConfig", "jaxRsConfig", "=", "configForClient", "(", "clientName", ")", ";", "retu...
Create a new {@link ClientBuilder} instance with the given name and groups. You own the returned client and are responsible for managing its cleanup.
[ "Create", "a", "new", "{" ]
train
https://github.com/opentable/otj-jaxrs/blob/384e7094fe5a56d41b2a9970bfd783fa85cbbcb8/client/src/main/java/com/opentable/jaxrs/JaxRsClientFactory.java#L171-L174
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java
Smoothing.simpleExponentialSmoothingQuick
public static double simpleExponentialSmoothingQuick(double Ytminus1, double Stminus1, double a) { double EMA=a*Ytminus1+(1-a)*Stminus1; return EMA; }
java
public static double simpleExponentialSmoothingQuick(double Ytminus1, double Stminus1, double a) { double EMA=a*Ytminus1+(1-a)*Stminus1; return EMA; }
[ "public", "static", "double", "simpleExponentialSmoothingQuick", "(", "double", "Ytminus1", ",", "double", "Stminus1", ",", "double", "a", ")", "{", "double", "EMA", "=", "a", "*", "Ytminus1", "+", "(", "1", "-", "a", ")", "*", "Stminus1", ";", "return", ...
Simple Explonential Smoothing: Calculates Ft+1 by using previous results. A quick version of the simpleExponentialSmoothing @param Ytminus1 @param Stminus1 @param a @return
[ "Simple", "Explonential", "Smoothing", ":", "Calculates", "Ft", "+", "1", "by", "using", "previous", "results", ".", "A", "quick", "version", "of", "the", "simpleExponentialSmoothing" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java#L126-L130
Netflix/astyanax
astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java
ShardedDistributedMessageQueue.peekMessages
private Collection<Message> peekMessages(String shardName, int itemsToPeek) throws MessageQueueException { try { ColumnList<MessageQueueEntry> result = keyspace.prepareQuery(queueColumnFamily) .setConsistencyLevel(consistencyLevel) .getKey(shardName) .withColumnRange(new RangeBuilder() .setLimit(itemsToPeek) .setStart(entrySerializer .makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.GREATER_THAN_EQUALS) .toBytes()) .setEnd(entrySerializer .makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.LESS_THAN_EQUALS) .toBytes()) .build()) .execute() .getResult(); List<Message> messages = Lists.newArrayListWithCapacity(result.size()); for (Column<MessageQueueEntry> column : result) { Message message = extractMessageFromColumn(column); if (message != null) messages.add(message); } return messages; } catch (ConnectionException e) { throw new MessageQueueException("Error peeking for messages from shard " + shardName, e); } }
java
private Collection<Message> peekMessages(String shardName, int itemsToPeek) throws MessageQueueException { try { ColumnList<MessageQueueEntry> result = keyspace.prepareQuery(queueColumnFamily) .setConsistencyLevel(consistencyLevel) .getKey(shardName) .withColumnRange(new RangeBuilder() .setLimit(itemsToPeek) .setStart(entrySerializer .makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.GREATER_THAN_EQUALS) .toBytes()) .setEnd(entrySerializer .makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.LESS_THAN_EQUALS) .toBytes()) .build()) .execute() .getResult(); List<Message> messages = Lists.newArrayListWithCapacity(result.size()); for (Column<MessageQueueEntry> column : result) { Message message = extractMessageFromColumn(column); if (message != null) messages.add(message); } return messages; } catch (ConnectionException e) { throw new MessageQueueException("Error peeking for messages from shard " + shardName, e); } }
[ "private", "Collection", "<", "Message", ">", "peekMessages", "(", "String", "shardName", ",", "int", "itemsToPeek", ")", "throws", "MessageQueueException", "{", "try", "{", "ColumnList", "<", "MessageQueueEntry", ">", "result", "=", "keyspace", ".", "prepareQuery...
Peek into messages contained in the shard. This call does not take trigger time into account and will return messages that are not yet due to be executed @param shardName @param itemsToPeek @return @throws MessageQueueException
[ "Peek", "into", "messages", "contained", "in", "the", "shard", ".", "This", "call", "does", "not", "take", "trigger", "time", "into", "account", "and", "will", "return", "messages", "that", "are", "not", "yet", "due", "to", "be", "executed" ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L1042-L1069
bwkimmel/java-util
src/main/java/ca/eandb/util/ByteArray.java
ByteArray.setAll
public void setAll(int index, ByteArray items) { rangeCheck(index, index + items.size); for (int i = index, j = 0; j < items.size; i++, j++) { elements[i] = items.elements[j]; } }
java
public void setAll(int index, ByteArray items) { rangeCheck(index, index + items.size); for (int i = index, j = 0; j < items.size; i++, j++) { elements[i] = items.elements[j]; } }
[ "public", "void", "setAll", "(", "int", "index", ",", "ByteArray", "items", ")", "{", "rangeCheck", "(", "index", ",", "index", "+", "items", ".", "size", ")", ";", "for", "(", "int", "i", "=", "index", ",", "j", "=", "0", ";", "j", "<", "items",...
Sets a range of elements of this array. @param index The index of the first element to set. @param items The values to set. @throws IndexOutOfBoundsException if <code>index &lt; 0 || index + items.size() &gt; size()</code>.
[ "Sets", "a", "range", "of", "elements", "of", "this", "array", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/ByteArray.java#L273-L278
kohsuke/jcifs
src/jcifs/http/NtlmSsp.java
NtlmSsp.authenticate
public static NtlmPasswordAuthentication authenticate( HttpServletRequest req, HttpServletResponse resp, byte[] challenge) throws IOException, ServletException { String msg = req.getHeader("Authorization"); if (msg != null && msg.startsWith("NTLM ")) { byte[] src = Base64.decode(msg.substring(5)); if (src[8] == 1) { Type1Message type1 = new Type1Message(src); Type2Message type2 = new Type2Message(type1, challenge, null); msg = Base64.encode(type2.toByteArray()); resp.setHeader( "WWW-Authenticate", "NTLM " + msg ); } else if (src[8] == 3) { Type3Message type3 = new Type3Message(src); byte[] lmResponse = type3.getLMResponse(); if (lmResponse == null) lmResponse = new byte[0]; byte[] ntResponse = type3.getNTResponse(); if (ntResponse == null) ntResponse = new byte[0]; return new NtlmPasswordAuthentication(type3.getDomain(), type3.getUser(), challenge, lmResponse, ntResponse); } } else { resp.setHeader("WWW-Authenticate", "NTLM"); } resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED); resp.setContentLength(0); resp.flushBuffer(); return null; }
java
public static NtlmPasswordAuthentication authenticate( HttpServletRequest req, HttpServletResponse resp, byte[] challenge) throws IOException, ServletException { String msg = req.getHeader("Authorization"); if (msg != null && msg.startsWith("NTLM ")) { byte[] src = Base64.decode(msg.substring(5)); if (src[8] == 1) { Type1Message type1 = new Type1Message(src); Type2Message type2 = new Type2Message(type1, challenge, null); msg = Base64.encode(type2.toByteArray()); resp.setHeader( "WWW-Authenticate", "NTLM " + msg ); } else if (src[8] == 3) { Type3Message type3 = new Type3Message(src); byte[] lmResponse = type3.getLMResponse(); if (lmResponse == null) lmResponse = new byte[0]; byte[] ntResponse = type3.getNTResponse(); if (ntResponse == null) ntResponse = new byte[0]; return new NtlmPasswordAuthentication(type3.getDomain(), type3.getUser(), challenge, lmResponse, ntResponse); } } else { resp.setHeader("WWW-Authenticate", "NTLM"); } resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED); resp.setContentLength(0); resp.flushBuffer(); return null; }
[ "public", "static", "NtlmPasswordAuthentication", "authenticate", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ",", "byte", "[", "]", "challenge", ")", "throws", "IOException", ",", "ServletException", "{", "String", "msg", "=", "req", ".", ...
Performs NTLM authentication for the servlet request. @param req The request being serviced. @param resp The response. @param challenge The domain controller challenge. @throws IOException If an IO error occurs. @throws ServletException If an error occurs.
[ "Performs", "NTLM", "authentication", "for", "the", "servlet", "request", "." ]
train
https://github.com/kohsuke/jcifs/blob/7751f4e4826c35614d237a70c2582553f95b58de/src/jcifs/http/NtlmSsp.java#L81-L108
openengsb/openengsb
components/ekb/common/src/main/java/org/openengsb/core/ekb/common/EDBConverter.java
EDBConverter.checkEDBObjectModelType
private boolean checkEDBObjectModelType(EDBObject object, Class<?> model) { String modelClass = object.getString(EDBConstants.MODEL_TYPE); if (modelClass == null) { LOGGER.warn(String.format("The EDBObject with the oid %s has no model type information." + "The resulting model may be a different model type than expected.", object.getOID())); } if (modelClass != null && !modelClass.equals(model.getName())) { return false; } return true; }
java
private boolean checkEDBObjectModelType(EDBObject object, Class<?> model) { String modelClass = object.getString(EDBConstants.MODEL_TYPE); if (modelClass == null) { LOGGER.warn(String.format("The EDBObject with the oid %s has no model type information." + "The resulting model may be a different model type than expected.", object.getOID())); } if (modelClass != null && !modelClass.equals(model.getName())) { return false; } return true; }
[ "private", "boolean", "checkEDBObjectModelType", "(", "EDBObject", "object", ",", "Class", "<", "?", ">", "model", ")", "{", "String", "modelClass", "=", "object", ".", "getString", "(", "EDBConstants", ".", "MODEL_TYPE", ")", ";", "if", "(", "modelClass", "...
Tests if an EDBObject has the correct model class in which it should be converted. Returns false if the model type is not fitting, returns true if the model type is fitting or model type is unknown.
[ "Tests", "if", "an", "EDBObject", "has", "the", "correct", "model", "class", "in", "which", "it", "should", "be", "converted", ".", "Returns", "false", "if", "the", "model", "type", "is", "not", "fitting", "returns", "true", "if", "the", "model", "type", ...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/common/src/main/java/org/openengsb/core/ekb/common/EDBConverter.java#L100-L110
spring-projects/spring-ldap
core/src/main/java/org/springframework/ldap/pool2/factory/PooledContextSource.java
PooledContextSource.getContext
protected DirContext getContext(DirContextType dirContextType) { final DirContext dirContext; try { dirContext = (DirContext) this.keyedObjectPool.borrowObject(dirContextType); } catch (Exception e) { throw new DataAccessResourceFailureException("Failed to borrow DirContext from pool.", e); } if (dirContext instanceof LdapContext) { return new DelegatingLdapContext(this.keyedObjectPool, (LdapContext) dirContext, dirContextType); } return new DelegatingDirContext(this.keyedObjectPool, dirContext, dirContextType); }
java
protected DirContext getContext(DirContextType dirContextType) { final DirContext dirContext; try { dirContext = (DirContext) this.keyedObjectPool.borrowObject(dirContextType); } catch (Exception e) { throw new DataAccessResourceFailureException("Failed to borrow DirContext from pool.", e); } if (dirContext instanceof LdapContext) { return new DelegatingLdapContext(this.keyedObjectPool, (LdapContext) dirContext, dirContextType); } return new DelegatingDirContext(this.keyedObjectPool, dirContext, dirContextType); }
[ "protected", "DirContext", "getContext", "(", "DirContextType", "dirContextType", ")", "{", "final", "DirContext", "dirContext", ";", "try", "{", "dirContext", "=", "(", "DirContext", ")", "this", ".", "keyedObjectPool", ".", "borrowObject", "(", "dirContextType", ...
Gets a DirContext of the specified type from the keyed object pool. @param dirContextType The type of context to return. @return A wrapped DirContext of the specified type. @throws DataAccessResourceFailureException If retrieving the object from the pool throws an exception
[ "Gets", "a", "DirContext", "of", "the", "specified", "type", "from", "the", "keyed", "object", "pool", "." ]
train
https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/pool2/factory/PooledContextSource.java#L257-L271
haraldk/TwelveMonkeys
sandbox/sandbox-servlet/src/main/java/com/twelvemonkeys/servlet/jsp/taglib/logic/IteratorProviderTEI.java
IteratorProviderTEI.getVariableInfo
public VariableInfo[] getVariableInfo(TagData pData) { // Get attribute name String attributeName = pData.getId(); if (attributeName == null) { attributeName = IteratorProviderTag.getDefaultIteratorName(); } // Get type String type = pData.getAttributeString(IteratorProviderTag.ATTRIBUTE_TYPE); if (type == null) { type = IteratorProviderTag.getDefaultIteratorType(); } // Return the variable info return new VariableInfo[]{ new VariableInfo(attributeName, type, true, VariableInfo.AT_END), }; }
java
public VariableInfo[] getVariableInfo(TagData pData) { // Get attribute name String attributeName = pData.getId(); if (attributeName == null) { attributeName = IteratorProviderTag.getDefaultIteratorName(); } // Get type String type = pData.getAttributeString(IteratorProviderTag.ATTRIBUTE_TYPE); if (type == null) { type = IteratorProviderTag.getDefaultIteratorType(); } // Return the variable info return new VariableInfo[]{ new VariableInfo(attributeName, type, true, VariableInfo.AT_END), }; }
[ "public", "VariableInfo", "[", "]", "getVariableInfo", "(", "TagData", "pData", ")", "{", "// Get attribute name\r", "String", "attributeName", "=", "pData", ".", "getId", "(", ")", ";", "if", "(", "attributeName", "==", "null", ")", "{", "attributeName", "=",...
Gets the variable info for IteratorProvider tags. The attribute with the name defined by the "id" attribute and type defined by the "type" attribute is declared with scope {@code VariableInfo.AT_END}. @param pData TagData instance provided by container @return an VariableInfo array of lenght 1, containing the attribute defined by the id parameter, declared, and with scope {@code VariableInfo.AT_END}.
[ "Gets", "the", "variable", "info", "for", "IteratorProvider", "tags", ".", "The", "attribute", "with", "the", "name", "defined", "by", "the", "id", "attribute", "and", "type", "defined", "by", "the", "type", "attribute", "is", "declared", "with", "scope", "{...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-servlet/src/main/java/com/twelvemonkeys/servlet/jsp/taglib/logic/IteratorProviderTEI.java#L22-L39
PureSolTechnologies/parsers
parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java
GrammarConverter.createNewIdentifier
private String createNewIdentifier(ParseTreeNode productionPart, String suffix) throws TreeException { String identifier = ""; if (productionPart.hasChild("IDENTIFIER")) { identifier = productionPart.getChild("IDENTIFIER").getText(); } else if (productionPart.hasChild("STRING_LITERAL")) { identifier = productionPart.getChild("STRING_LITERAL").getText(); } return createIdentifierName(identifier, suffix); }
java
private String createNewIdentifier(ParseTreeNode productionPart, String suffix) throws TreeException { String identifier = ""; if (productionPart.hasChild("IDENTIFIER")) { identifier = productionPart.getChild("IDENTIFIER").getText(); } else if (productionPart.hasChild("STRING_LITERAL")) { identifier = productionPart.getChild("STRING_LITERAL").getText(); } return createIdentifierName(identifier, suffix); }
[ "private", "String", "createNewIdentifier", "(", "ParseTreeNode", "productionPart", ",", "String", "suffix", ")", "throws", "TreeException", "{", "String", "identifier", "=", "\"\"", ";", "if", "(", "productionPart", ".", "hasChild", "(", "\"IDENTIFIER\"", ")", ")...
This method generates a new construction identifier for an automatically generated BNF production for optionals, optional lists and lists. @param productionPart @param suffix @return @throws TreeException
[ "This", "method", "generates", "a", "new", "construction", "identifier", "for", "an", "automatically", "generated", "BNF", "production", "for", "optionals", "optional", "lists", "and", "lists", "." ]
train
https://github.com/PureSolTechnologies/parsers/blob/61077223b90d3768ff9445ae13036343c98b63cd/parsers/src/main/java/com/puresoltechnologies/parsers/grammar/GrammarConverter.java#L499-L508
geomajas/geomajas-project-server
common-servlet/src/main/java/org/geomajas/servlet/ResourceServlet.java
ResourceServlet.configureCaching
private void configureCaching(HttpServletResponse response, int seconds) { // HTTP 1.0 header response.setDateHeader(HTTP_EXPIRES_HEADER, System.currentTimeMillis() + seconds * 1000L); if (seconds > 0) { // HTTP 1.1 header response.setHeader(HTTP_CACHE_CONTROL_HEADER, "max-age=" + seconds); } else { // HTTP 1.1 header response.setHeader(HTTP_CACHE_CONTROL_HEADER, "no-cache"); } }
java
private void configureCaching(HttpServletResponse response, int seconds) { // HTTP 1.0 header response.setDateHeader(HTTP_EXPIRES_HEADER, System.currentTimeMillis() + seconds * 1000L); if (seconds > 0) { // HTTP 1.1 header response.setHeader(HTTP_CACHE_CONTROL_HEADER, "max-age=" + seconds); } else { // HTTP 1.1 header response.setHeader(HTTP_CACHE_CONTROL_HEADER, "no-cache"); } }
[ "private", "void", "configureCaching", "(", "HttpServletResponse", "response", ",", "int", "seconds", ")", "{", "// HTTP 1.0 header", "response", ".", "setDateHeader", "(", "HTTP_EXPIRES_HEADER", ",", "System", ".", "currentTimeMillis", "(", ")", "+", "seconds", "*"...
Set HTTP headers to allow caching for the given number of seconds. @param response where to set the caching settings @param seconds number of seconds into the future that the response should be cacheable for
[ "Set", "HTTP", "headers", "to", "allow", "caching", "for", "the", "given", "number", "of", "seconds", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/common-servlet/src/main/java/org/geomajas/servlet/ResourceServlet.java#L337-L348
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java
ScriptContext.processCsvFile
@Cmd public void processCsvFile(final String csvFile, final String delimiter, final char quoteChar, final Charset charset, final Closure<Void> closure) { File f = new File(csvFile); try { config.extractFromArchive(f, true); checkState(f.exists(), "CSV file not found: " + f); Reader reader = Files.newReader(f, charset == null ? defaultCharset : charset); csvDataProcessor.processFile(reader, delimiter, quoteChar, closure); } catch (IOException ex) { throw new IllegalStateException("Error reading CSV file: " + f, ex); } }
java
@Cmd public void processCsvFile(final String csvFile, final String delimiter, final char quoteChar, final Charset charset, final Closure<Void> closure) { File f = new File(csvFile); try { config.extractFromArchive(f, true); checkState(f.exists(), "CSV file not found: " + f); Reader reader = Files.newReader(f, charset == null ? defaultCharset : charset); csvDataProcessor.processFile(reader, delimiter, quoteChar, closure); } catch (IOException ex) { throw new IllegalStateException("Error reading CSV file: " + f, ex); } }
[ "@", "Cmd", "public", "void", "processCsvFile", "(", "final", "String", "csvFile", ",", "final", "String", "delimiter", ",", "final", "char", "quoteChar", ",", "final", "Charset", "charset", ",", "final", "Closure", "<", "Void", ">", "closure", ")", "{", "...
Processes a CSV file. @param csvFile the file @param delimiter the @param quoteChar the quote character ('\0' for no quoting) @param charset the character set @param closure the {@link Closure} representing a Groovy block
[ "Processes", "a", "CSV", "file", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java#L448-L460
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setKnots
public void setKnots(int[] x, int[] rgb, byte[] types) { numKnots = rgb.length+2; xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; if (x != null) System.arraycopy(x, 0, xKnots, 1, numKnots-2); else for (int i = 1; i > numKnots-1; i++) xKnots[i] = 255*i/(numKnots-2); System.arraycopy(rgb, 0, yKnots, 1, numKnots-2); if (types != null) System.arraycopy(types, 0, knotTypes, 1, numKnots-2); else for (int i = 0; i > numKnots; i++) knotTypes[i] = RGB|SPLINE; sortKnots(); rebuildGradient(); }
java
public void setKnots(int[] x, int[] rgb, byte[] types) { numKnots = rgb.length+2; xKnots = new int[numKnots]; yKnots = new int[numKnots]; knotTypes = new byte[numKnots]; if (x != null) System.arraycopy(x, 0, xKnots, 1, numKnots-2); else for (int i = 1; i > numKnots-1; i++) xKnots[i] = 255*i/(numKnots-2); System.arraycopy(rgb, 0, yKnots, 1, numKnots-2); if (types != null) System.arraycopy(types, 0, knotTypes, 1, numKnots-2); else for (int i = 0; i > numKnots; i++) knotTypes[i] = RGB|SPLINE; sortKnots(); rebuildGradient(); }
[ "public", "void", "setKnots", "(", "int", "[", "]", "x", ",", "int", "[", "]", "rgb", ",", "byte", "[", "]", "types", ")", "{", "numKnots", "=", "rgb", ".", "length", "+", "2", ";", "xKnots", "=", "new", "int", "[", "numKnots", "]", ";", "yKnot...
Set the values of all the knots. This version does not require the "extra" knots at -1 and 256 @param x the knot positions @param rgb the knot colors @param types the knot types
[ "Set", "the", "values", "of", "all", "the", "knots", ".", "This", "version", "does", "not", "require", "the", "extra", "knots", "at", "-", "1", "and", "256" ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L288-L306
infinispan/infinispan
server/integration/commons/src/main/java/org/infinispan/server/commons/dmr/ModelNodes.java
ModelNodes.asModuleIdentifier
public static ModuleIdentifier asModuleIdentifier(ModelNode value, ModuleIdentifier defaultValue) { return value.isDefined() ? ModuleIdentifier.fromString(value.asString()) : defaultValue; }
java
public static ModuleIdentifier asModuleIdentifier(ModelNode value, ModuleIdentifier defaultValue) { return value.isDefined() ? ModuleIdentifier.fromString(value.asString()) : defaultValue; }
[ "public", "static", "ModuleIdentifier", "asModuleIdentifier", "(", "ModelNode", "value", ",", "ModuleIdentifier", "defaultValue", ")", "{", "return", "value", ".", "isDefined", "(", ")", "?", "ModuleIdentifier", ".", "fromString", "(", "value", ".", "asString", "(...
Returns the value of the node as a module identifier, or the specified default if the node is undefined. @param value a model node @return the value of the node as a module identifier, or the specified default if the node is undefined.
[ "Returns", "the", "value", "of", "the", "node", "as", "a", "module", "identifier", "or", "the", "specified", "default", "if", "the", "node", "is", "undefined", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/commons/src/main/java/org/infinispan/server/commons/dmr/ModelNodes.java#L102-L104
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static Container leftShift(Container self, Component c) { self.add(c); return self; }
java
public static Container leftShift(Container self, Component c) { self.add(c); return self; }
[ "public", "static", "Container", "leftShift", "(", "Container", "self", ",", "Component", "c", ")", "{", "self", ".", "add", "(", "c", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add components to a Container. @param self a Container @param c a Component to be added to the container. @return same container, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "components", "to", "a", "Container", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L76-L79
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.doubleToBytes
public static final void doubleToBytes( double d, byte[] data, int[] offset ) { long bits = Double.doubleToLongBits(d); longToBytes(bits, data, offset); }
java
public static final void doubleToBytes( double d, byte[] data, int[] offset ) { long bits = Double.doubleToLongBits(d); longToBytes(bits, data, offset); }
[ "public", "static", "final", "void", "doubleToBytes", "(", "double", "d", ",", "byte", "[", "]", "data", ",", "int", "[", "]", "offset", ")", "{", "long", "bits", "=", "Double", ".", "doubleToLongBits", "(", "d", ")", ";", "longToBytes", "(", "bits", ...
Write the bytes representing <code>d</code> into the byte array <code>data</code>, starting at index <code>offset [0]</code>, and increment <code>offset [0]</code> by the number of bytes written; if <code>data == null</code>, increment <code>offset [0]</code> by the number of bytes that would have been written otherwise. @param d the <code>double</code> to encode @param data The byte array to store into, or <code>null</code>. @param offset A single element array whose first element is the index in data to begin writing at on function entry, and which on function exit has been incremented by the number of bytes written.
[ "Write", "the", "bytes", "representing", "<code", ">", "d<", "/", "code", ">", "into", "the", "byte", "array", "<code", ">", "data<", "/", "code", ">", "starting", "at", "index", "<code", ">", "offset", "[", "0", "]", "<", "/", "code", ">", "and", ...
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L237-L240
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/PipelineImageTransform.java
PipelineImageTransform.doTransform
@Override protected ImageWritable doTransform(ImageWritable image, Random random) { if (shuffle) { Collections.shuffle(imageTransforms); } currentTransforms.clear(); // execute each item in the pipeline for (Pair<ImageTransform, Double> tuple : imageTransforms) { if (tuple.getSecond() == 1.0 || rng.nextDouble() < tuple.getSecond()) { // probability of execution currentTransforms.add(tuple.getFirst()); image = random != null ? tuple.getFirst().transform(image, random) : tuple.getFirst().transform(image); } } return image; }
java
@Override protected ImageWritable doTransform(ImageWritable image, Random random) { if (shuffle) { Collections.shuffle(imageTransforms); } currentTransforms.clear(); // execute each item in the pipeline for (Pair<ImageTransform, Double> tuple : imageTransforms) { if (tuple.getSecond() == 1.0 || rng.nextDouble() < tuple.getSecond()) { // probability of execution currentTransforms.add(tuple.getFirst()); image = random != null ? tuple.getFirst().transform(image, random) : tuple.getFirst().transform(image); } } return image; }
[ "@", "Override", "protected", "ImageWritable", "doTransform", "(", "ImageWritable", "image", ",", "Random", "random", ")", "{", "if", "(", "shuffle", ")", "{", "Collections", ".", "shuffle", "(", "imageTransforms", ")", ";", "}", "currentTransforms", ".", "cle...
Takes an image and executes a pipeline of combined transforms. @param image to transform, null == end of stream @param random object to use (or null for deterministic) @return transformed image
[ "Takes", "an", "image", "and", "executes", "a", "pipeline", "of", "combined", "transforms", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/PipelineImageTransform.java#L105-L123
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.hasMethod
public static boolean hasMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) { try { clazz.getDeclaredMethod(methodName, parameterTypes); return true; } catch(SecurityException e) { throw new BugError(e); } catch(NoSuchMethodException expectable) { // ignore exception since is expected } return false; }
java
public static boolean hasMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) { try { clazz.getDeclaredMethod(methodName, parameterTypes); return true; } catch(SecurityException e) { throw new BugError(e); } catch(NoSuchMethodException expectable) { // ignore exception since is expected } return false; }
[ "public", "static", "boolean", "hasMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "try", "{", "clazz", ".", "getDeclaredMethod", "(", "methodName", ",", "parameter...
Predicate to test if a class do possess a given method. Java language support for method discovery throws {@link NoSuchMethodException} if method not found. This method does not throws exception but returns a boolean. @param clazz reflexive class, @param methodName method name, @param parameterTypes formal parameters list. @return true if class has requested method.
[ "Predicate", "to", "test", "if", "a", "class", "do", "possess", "a", "given", "method", ".", "Java", "language", "support", "for", "method", "discovery", "throws", "{", "@link", "NoSuchMethodException", "}", "if", "method", "not", "found", ".", "This", "meth...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L509-L522
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java
SyncRemoteTable.remove
public void remove(Object data, int iOpenMode) throws DBException, RemoteException { synchronized(m_objSync) { m_tableRemote.remove(data, iOpenMode); } }
java
public void remove(Object data, int iOpenMode) throws DBException, RemoteException { synchronized(m_objSync) { m_tableRemote.remove(data, iOpenMode); } }
[ "public", "void", "remove", "(", "Object", "data", ",", "int", "iOpenMode", ")", "throws", "DBException", ",", "RemoteException", "{", "synchronized", "(", "m_objSync", ")", "{", "m_tableRemote", ".", "remove", "(", "data", ",", "iOpenMode", ")", ";", "}", ...
Delete the current record. @param - This is a dummy param, because this call conflicts with a call in EJBHome. @exception DBException File exception.
[ "Delete", "the", "current", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java#L148-L154
twitter/chill
chill-java/src/main/java/com/twitter/chill/KryoPool.java
KryoPool.withBuffer
public static KryoPool withBuffer(int poolSize, final KryoInstantiator ki, final int outBufferMin, final int outBufferMax) { return new KryoPool(poolSize) { protected SerDeState newInstance() { return new SerDeState(ki.newKryo(), new Input(), new Output(outBufferMin, outBufferMax)); } }; }
java
public static KryoPool withBuffer(int poolSize, final KryoInstantiator ki, final int outBufferMin, final int outBufferMax) { return new KryoPool(poolSize) { protected SerDeState newInstance() { return new SerDeState(ki.newKryo(), new Input(), new Output(outBufferMin, outBufferMax)); } }; }
[ "public", "static", "KryoPool", "withBuffer", "(", "int", "poolSize", ",", "final", "KryoInstantiator", "ki", ",", "final", "int", "outBufferMin", ",", "final", "int", "outBufferMax", ")", "{", "return", "new", "KryoPool", "(", "poolSize", ")", "{", "protected...
Output is created with new Output(outBufferMin, outBufferMax);
[ "Output", "is", "created", "with", "new", "Output", "(", "outBufferMin", "outBufferMax", ")", ";" ]
train
https://github.com/twitter/chill/blob/0919984ec3aeb320ff522911c726425e9f18ea41/chill-java/src/main/java/com/twitter/chill/KryoPool.java#L41-L50
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/media/spi/MediaSource.java
MediaSource.resolveRenditions
protected final boolean resolveRenditions(Media media, Asset asset, MediaArgs mediaArgs) { if (mediaArgs.getMediaFormats() != null && mediaArgs.getMediaFormats().length > 1 && (mediaArgs.isMediaFormatsMandatory() || mediaArgs.getImageSizes() != null || mediaArgs.getPictureSources() != null)) { return resolveAllRenditions(media, asset, mediaArgs); } else { return resolveFirstMatchRenditions(media, asset, mediaArgs); } }
java
protected final boolean resolveRenditions(Media media, Asset asset, MediaArgs mediaArgs) { if (mediaArgs.getMediaFormats() != null && mediaArgs.getMediaFormats().length > 1 && (mediaArgs.isMediaFormatsMandatory() || mediaArgs.getImageSizes() != null || mediaArgs.getPictureSources() != null)) { return resolveAllRenditions(media, asset, mediaArgs); } else { return resolveFirstMatchRenditions(media, asset, mediaArgs); } }
[ "protected", "final", "boolean", "resolveRenditions", "(", "Media", "media", ",", "Asset", "asset", ",", "MediaArgs", "mediaArgs", ")", "{", "if", "(", "mediaArgs", ".", "getMediaFormats", "(", ")", "!=", "null", "&&", "mediaArgs", ".", "getMediaFormats", "(",...
Resolves single rendition (or multiple renditions if {@link MediaArgs#isMediaFormatsMandatory()} is true and sets the resolved rendition and the URL of the first (best-matching) rendition in the media object. @param media Media object @param asset Asset @param mediaArgs Media args @return true if all requested renditions could be resolved (at least one or all if {@link MediaArgs#isMediaFormatsMandatory()} was set to true)
[ "Resolves", "single", "rendition", "(", "or", "multiple", "renditions", "if", "{" ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/spi/MediaSource.java#L301-L309
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ChainedResponse.java
ChainedResponse.getChainedRequest
@SuppressWarnings("unchecked") public HttpServletRequest getChainedRequest() throws IOException, ServletException{ if (super.containsError()) { throw super.getError(); } ChainedRequest req = new ChainedRequest(this, _req); //transfer any auto transfer headers Hashtable headers = getAutoTransferringHeaders(); Enumeration names = headers.keys(); while (names.hasMoreElements()) { String name = (String)names.nextElement(); String value = (String)headers.get(name); req.setHeader(name, value); } //get headers from response and add to request Iterable<String> headerNames = getHeaderNames(); for (String name:headerNames) { String value = (String)getHeader(name); req.setHeader(name, value); } return req; }
java
@SuppressWarnings("unchecked") public HttpServletRequest getChainedRequest() throws IOException, ServletException{ if (super.containsError()) { throw super.getError(); } ChainedRequest req = new ChainedRequest(this, _req); //transfer any auto transfer headers Hashtable headers = getAutoTransferringHeaders(); Enumeration names = headers.keys(); while (names.hasMoreElements()) { String name = (String)names.nextElement(); String value = (String)headers.get(name); req.setHeader(name, value); } //get headers from response and add to request Iterable<String> headerNames = getHeaderNames(); for (String name:headerNames) { String value = (String)getHeader(name); req.setHeader(name, value); } return req; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "HttpServletRequest", "getChainedRequest", "(", ")", "throws", "IOException", ",", "ServletException", "{", "if", "(", "super", ".", "containsError", "(", ")", ")", "{", "throw", "super", ".", "getErr...
Returns a chained request that contains the data that was written to this response.
[ "Returns", "a", "chained", "request", "that", "contains", "the", "data", "that", "was", "written", "to", "this", "response", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ChainedResponse.java#L66-L93
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java
JournalCreator.modifyObject
public Date modifyObject(Context context, String pid, String state, String label, String ownerId, String logMessage, Date lastModifiedDate) throws ServerException { try { CreatorJournalEntry cje = new CreatorJournalEntry(METHOD_MODIFY_OBJECT, context); cje.addArgument(ARGUMENT_NAME_PID, pid); cje.addArgument(ARGUMENT_NAME_STATE, state); cje.addArgument(ARGUMENT_NAME_LABEL, label); cje.addArgument(ARGUMENT_NAME_OWNERID, ownerId); cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage); cje.addArgument(ARGUMENT_NAME_LAST_MODIFIED_DATE, lastModifiedDate); return (Date) cje.invokeAndClose(delegate, writer); } catch (JournalException e) { throw new GeneralException("Problem creating the Journal", e); } }
java
public Date modifyObject(Context context, String pid, String state, String label, String ownerId, String logMessage, Date lastModifiedDate) throws ServerException { try { CreatorJournalEntry cje = new CreatorJournalEntry(METHOD_MODIFY_OBJECT, context); cje.addArgument(ARGUMENT_NAME_PID, pid); cje.addArgument(ARGUMENT_NAME_STATE, state); cje.addArgument(ARGUMENT_NAME_LABEL, label); cje.addArgument(ARGUMENT_NAME_OWNERID, ownerId); cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage); cje.addArgument(ARGUMENT_NAME_LAST_MODIFIED_DATE, lastModifiedDate); return (Date) cje.invokeAndClose(delegate, writer); } catch (JournalException e) { throw new GeneralException("Problem creating the Journal", e); } }
[ "public", "Date", "modifyObject", "(", "Context", "context", ",", "String", "pid", ",", "String", "state", ",", "String", "label", ",", "String", "ownerId", ",", "String", "logMessage", ",", "Date", "lastModifiedDate", ")", "throws", "ServerException", "{", "t...
Create a journal entry, add the arguments, and invoke the method.
[ "Create", "a", "journal", "entry", "add", "the", "arguments", "and", "invoke", "the", "method", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java#L123-L143
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.addMonths
public static <T extends java.util.Date> T addMonths(final T date, final int amount) { return roll(date, amount, CalendarUnit.MONTH); }
java
public static <T extends java.util.Date> T addMonths(final T date, final int amount) { return roll(date, amount, CalendarUnit.MONTH); }
[ "public", "static", "<", "T", "extends", "java", ".", "util", ".", "Date", ">", "T", "addMonths", "(", "final", "T", "date", ",", "final", "int", "amount", ")", "{", "return", "roll", "(", "date", ",", "amount", ",", "CalendarUnit", ".", "MONTH", ")"...
Adds a number of months to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to add, may be negative @return the new {@code Date} with the amount added @throws IllegalArgumentException if the date is null
[ "Adds", "a", "number", "of", "months", "to", "a", "date", "returning", "a", "new", "object", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L965-L967
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/env/Diagnostics.java
Diagnostics.gcInfo
public static void gcInfo(final Map<String, Object> infos) { List<GarbageCollectorMXBean> mxBeans = ManagementFactory.getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean mxBean : mxBeans) { infos.put("gc." + mxBean.getName().toLowerCase() + ".collectionCount", mxBean.getCollectionCount()); infos.put("gc." + mxBean.getName().toLowerCase() + ".collectionTime", mxBean.getCollectionTime()); } }
java
public static void gcInfo(final Map<String, Object> infos) { List<GarbageCollectorMXBean> mxBeans = ManagementFactory.getGarbageCollectorMXBeans(); for (GarbageCollectorMXBean mxBean : mxBeans) { infos.put("gc." + mxBean.getName().toLowerCase() + ".collectionCount", mxBean.getCollectionCount()); infos.put("gc." + mxBean.getName().toLowerCase() + ".collectionTime", mxBean.getCollectionTime()); } }
[ "public", "static", "void", "gcInfo", "(", "final", "Map", "<", "String", ",", "Object", ">", "infos", ")", "{", "List", "<", "GarbageCollectorMXBean", ">", "mxBeans", "=", "ManagementFactory", ".", "getGarbageCollectorMXBeans", "(", ")", ";", "for", "(", "G...
Collects system information as delivered from the {@link GarbageCollectorMXBean}. @param infos a map where the infos are passed in.
[ "Collects", "system", "information", "as", "delivered", "from", "the", "{", "@link", "GarbageCollectorMXBean", "}", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L84-L91
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java
ImageModerationsImpl.oCRFileInput
public OCR oCRFileInput(String language, byte[] imageStream, OCRFileInputOptionalParameter oCRFileInputOptionalParameter) { return oCRFileInputWithServiceResponseAsync(language, imageStream, oCRFileInputOptionalParameter).toBlocking().single().body(); }
java
public OCR oCRFileInput(String language, byte[] imageStream, OCRFileInputOptionalParameter oCRFileInputOptionalParameter) { return oCRFileInputWithServiceResponseAsync(language, imageStream, oCRFileInputOptionalParameter).toBlocking().single().body(); }
[ "public", "OCR", "oCRFileInput", "(", "String", "language", ",", "byte", "[", "]", "imageStream", ",", "OCRFileInputOptionalParameter", "oCRFileInputOptionalParameter", ")", "{", "return", "oCRFileInputWithServiceResponseAsync", "(", "language", ",", "imageStream", ",", ...
Returns any text found in the image for the language specified. If no language is specified in input then the detection defaults to English. @param language Language of the terms. @param imageStream The image file. @param oCRFileInputOptionalParameter the object representing the optional parameters to be set before calling this API @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 OCR object if successful.
[ "Returns", "any", "text", "found", "in", "the", "image", "for", "the", "language", "specified", ".", "If", "no", "language", "is", "specified", "in", "input", "then", "the", "detection", "defaults", "to", "English", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1246-L1248