repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java
FSImage.confirmFormat
boolean confirmFormat(boolean force, boolean interactive) throws IOException { List<FormatConfirmable> confirms = Lists.newArrayList(); for (StorageDirectory sd : storage.dirIterable(null)) { confirms.add(sd); } confirms.addAll(editLog.getFormatConfirmables()); return Storage.confirmFormat(confirms, force, interactive); }
java
boolean confirmFormat(boolean force, boolean interactive) throws IOException { List<FormatConfirmable> confirms = Lists.newArrayList(); for (StorageDirectory sd : storage.dirIterable(null)) { confirms.add(sd); } confirms.addAll(editLog.getFormatConfirmables()); return Storage.confirmFormat(confirms, force, interactive); }
[ "boolean", "confirmFormat", "(", "boolean", "force", ",", "boolean", "interactive", ")", "throws", "IOException", "{", "List", "<", "FormatConfirmable", ">", "confirms", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "StorageDirectory", "sd", ":...
Check whether the storage directories and non-file journals exist. If running in interactive mode, will prompt the user for each directory to allow them to format anyway. Otherwise, returns false, unless 'force' is specified. @param interactive prompt the user when a dir exists @return true if formatting should proceed @throws IOException if some storage cannot be accessed
[ "Check", "whether", "the", "storage", "directories", "and", "non", "-", "file", "journals", "exist", ".", "If", "running", "in", "interactive", "mode", "will", "prompt", "the", "user", "for", "each", "directory", "to", "allow", "them", "to", "format", "anywa...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L1112-L1119
elki-project/elki
addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/data/uncertain/AbstractUncertainObject.java
AbstractUncertainObject.computeBounds
protected static HyperBoundingBox computeBounds(NumberVector[] samples) { assert(samples.length > 0) : "Cannot compute bounding box of empty set."; // Compute bounds: final int dimensions = samples[0].getDimensionality(); final double[] min = new double[dimensions]; final double[] max = new double[dimensions]; NumberVector first = samples[0]; for(int d = 0; d < dimensions; d++) { min[d] = max[d] = first.doubleValue(d); } for(int i = 1; i < samples.length; i++) { NumberVector v = samples[i]; for(int d = 0; d < dimensions; d++) { final double c = v.doubleValue(d); min[d] = c < min[d] ? c : min[d]; max[d] = c > max[d] ? c : max[d]; } } return new HyperBoundingBox(min, max); }
java
protected static HyperBoundingBox computeBounds(NumberVector[] samples) { assert(samples.length > 0) : "Cannot compute bounding box of empty set."; // Compute bounds: final int dimensions = samples[0].getDimensionality(); final double[] min = new double[dimensions]; final double[] max = new double[dimensions]; NumberVector first = samples[0]; for(int d = 0; d < dimensions; d++) { min[d] = max[d] = first.doubleValue(d); } for(int i = 1; i < samples.length; i++) { NumberVector v = samples[i]; for(int d = 0; d < dimensions; d++) { final double c = v.doubleValue(d); min[d] = c < min[d] ? c : min[d]; max[d] = c > max[d] ? c : max[d]; } } return new HyperBoundingBox(min, max); }
[ "protected", "static", "HyperBoundingBox", "computeBounds", "(", "NumberVector", "[", "]", "samples", ")", "{", "assert", "(", "samples", ".", "length", ">", "0", ")", ":", "\"Cannot compute bounding box of empty set.\"", ";", "// Compute bounds:", "final", "int", "...
Compute the bounding box for some samples. @param samples Samples @return Bounding box.
[ "Compute", "the", "bounding", "box", "for", "some", "samples", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/uncertain/src/main/java/de/lmu/ifi/dbs/elki/data/uncertain/AbstractUncertainObject.java#L50-L69
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/util/GraphicUtils.java
GraphicUtils.drawCircle
public static void drawCircle(Graphics g, int centerX, int centerY, int diameter){ g.drawOval((int) (centerX-diameter/2), (int) (centerY-diameter/2), diameter, diameter); }
java
public static void drawCircle(Graphics g, int centerX, int centerY, int diameter){ g.drawOval((int) (centerX-diameter/2), (int) (centerY-diameter/2), diameter, diameter); }
[ "public", "static", "void", "drawCircle", "(", "Graphics", "g", ",", "int", "centerX", ",", "int", "centerY", ",", "int", "diameter", ")", "{", "g", ".", "drawOval", "(", "(", "int", ")", "(", "centerX", "-", "diameter", "/", "2", ")", ",", "(", "i...
Draws a circle with the specified diameter using the given point coordinates as center. @param g Graphics context @param centerX X coordinate of circle center @param centerY Y coordinate of circle center @param diameter Circle diameter
[ "Draws", "a", "circle", "with", "the", "specified", "diameter", "using", "the", "given", "point", "coordinates", "as", "center", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L30-L32
zeroturnaround/zt-exec
src/main/java/org/zeroturnaround/exec/ProcessExecutor.java
ProcessExecutor.redirectOutputAlsoTo
private static PumpStreamHandler redirectOutputAlsoTo(PumpStreamHandler pumps, OutputStream output) { if (output == null) throw new IllegalArgumentException("OutputStream must be provided."); OutputStream current = pumps.getOut(); if (current != null && !(current instanceof NullOutputStream)) { output = new TeeOutputStream(current, output); } return new PumpStreamHandler(output, pumps.getErr(), pumps.getInput()); }
java
private static PumpStreamHandler redirectOutputAlsoTo(PumpStreamHandler pumps, OutputStream output) { if (output == null) throw new IllegalArgumentException("OutputStream must be provided."); OutputStream current = pumps.getOut(); if (current != null && !(current instanceof NullOutputStream)) { output = new TeeOutputStream(current, output); } return new PumpStreamHandler(output, pumps.getErr(), pumps.getInput()); }
[ "private", "static", "PumpStreamHandler", "redirectOutputAlsoTo", "(", "PumpStreamHandler", "pumps", ",", "OutputStream", "output", ")", "{", "if", "(", "output", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"OutputStream must be provided.\"", "...
Redirects the process' output stream also to a given output stream. @return new stream handler created.
[ "Redirects", "the", "process", "output", "stream", "also", "to", "a", "given", "output", "stream", "." ]
train
https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/ProcessExecutor.java#L560-L568
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByMobilePhone
public Iterable<DContact> queryByMobilePhone(Object parent, java.lang.String mobilePhone) { return queryByField(parent, DContactMapper.Field.MOBILEPHONE.getFieldName(), mobilePhone); }
java
public Iterable<DContact> queryByMobilePhone(Object parent, java.lang.String mobilePhone) { return queryByField(parent, DContactMapper.Field.MOBILEPHONE.getFieldName(), mobilePhone); }
[ "public", "Iterable", "<", "DContact", ">", "queryByMobilePhone", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "mobilePhone", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "MOBILEPHONE", ".", ...
query-by method for field mobilePhone @param mobilePhone the specified attribute @return an Iterable of DContacts for the specified mobilePhone
[ "query", "-", "by", "method", "for", "field", "mobilePhone" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L223-L225
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/session/impl/HttpSessionContextImpl.java
HttpSessionContextImpl.isRequestedSessionIdValid
public boolean isRequestedSessionIdValid(HttpServletRequest _request, HttpSession sess) { SessionAffinityContext sac = getSessionAffinityContext(_request); String sessionId = sac.getRequestedSessionID(); if ((sessionId != null) && (sess != null) && (!sess.isNew() || !_smc.checkSessionNewOnIsValidRequest()) && sessionId.equals(sess.getId())) { return true; } return false; }
java
public boolean isRequestedSessionIdValid(HttpServletRequest _request, HttpSession sess) { SessionAffinityContext sac = getSessionAffinityContext(_request); String sessionId = sac.getRequestedSessionID(); if ((sessionId != null) && (sess != null) && (!sess.isNew() || !_smc.checkSessionNewOnIsValidRequest()) && sessionId.equals(sess.getId())) { return true; } return false; }
[ "public", "boolean", "isRequestedSessionIdValid", "(", "HttpServletRequest", "_request", ",", "HttpSession", "sess", ")", "{", "SessionAffinityContext", "sac", "=", "getSessionAffinityContext", "(", "_request", ")", ";", "String", "sessionId", "=", "sac", ".", "getReq...
/* Determine if the requested session id is valid. We will get the session passed in if it exists -- we know that getSession has been called
[ "/", "*", "Determine", "if", "the", "requested", "session", "id", "is", "valid", ".", "We", "will", "get", "the", "session", "passed", "in", "if", "it", "exists", "--", "we", "know", "that", "getSession", "has", "been", "called" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/session/impl/HttpSessionContextImpl.java#L422-L433
sarxos/v4l4j
src/main/java/au/edu/jcu/v4l4j/ImageFormatList.java
ImageFormatList.moveToFirstIfNative
private void moveToFirstIfNative(List<ImageFormat> v, int format){ for(ImageFormat i : v) if((i.getIndex()==format) && (formats.contains(i))){ v.remove(i); v.add(0, i); break; } }
java
private void moveToFirstIfNative(List<ImageFormat> v, int format){ for(ImageFormat i : v) if((i.getIndex()==format) && (formats.contains(i))){ v.remove(i); v.add(0, i); break; } }
[ "private", "void", "moveToFirstIfNative", "(", "List", "<", "ImageFormat", ">", "v", ",", "int", "format", ")", "{", "for", "(", "ImageFormat", "i", ":", "v", ")", "if", "(", "(", "i", ".", "getIndex", "(", ")", "==", "format", ")", "&&", "(", "for...
This method moves the given image format <code>format</code> in the first position of the vector. @param v the vector if image format @param format the index of the format to be moved in first position
[ "This", "method", "moves", "the", "given", "image", "format", "<code", ">", "format<", "/", "code", ">", "in", "the", "first", "position", "of", "the", "vector", "." ]
train
https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/ImageFormatList.java#L162-L169
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java
PyExpressionGenerator._generate
protected XExpression _generate(AnonymousClass anonClass, IAppendable it, IExtraLanguageGeneratorContext context) { if (it.hasName(anonClass)) { appendReturnIfExpectedReturnedExpression(it, context); it.append(it.getName(anonClass)).append("("); //$NON-NLS-1$ boolean firstArg = true; for (final XExpression arg : anonClass.getConstructorCall().getArguments()) { if (firstArg) { firstArg = false; } else { it.append(", "); //$NON-NLS-1$ } generate(arg, it, context); } it.append(")"); //$NON-NLS-1$ } return anonClass; }
java
protected XExpression _generate(AnonymousClass anonClass, IAppendable it, IExtraLanguageGeneratorContext context) { if (it.hasName(anonClass)) { appendReturnIfExpectedReturnedExpression(it, context); it.append(it.getName(anonClass)).append("("); //$NON-NLS-1$ boolean firstArg = true; for (final XExpression arg : anonClass.getConstructorCall().getArguments()) { if (firstArg) { firstArg = false; } else { it.append(", "); //$NON-NLS-1$ } generate(arg, it, context); } it.append(")"); //$NON-NLS-1$ } return anonClass; }
[ "protected", "XExpression", "_generate", "(", "AnonymousClass", "anonClass", ",", "IAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "if", "(", "it", ".", "hasName", "(", "anonClass", ")", ")", "{", "appendReturnIfExpectedReturnedExpressi...
Generate the given object. @param anonClass the anonymous class. @param it the target for the generated content. @param context the context. @return the class definition.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L256-L272
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/crf/FactorTable.java
FactorTable.conditionalLogProbGivenFirst
public double conditionalLogProbGivenFirst(int given, int[] of) { if (of.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbGivenFirst requires of one less than clique size (" + windowSize + ") but was " + Arrays.toString(of)); } // compute P(given, of) int[] labels = new int[windowSize]; labels[0] = given; System.arraycopy(of, 0, labels, 1, windowSize - 1); // double probAll = logProb(labels); double probAll = unnormalizedLogProb(labels); // compute P(given) // double probGiven = logProbFront(given); double probGiven = unnormalizedLogProbFront(given); // compute P(given, of) / P(given) return probAll - probGiven; }
java
public double conditionalLogProbGivenFirst(int given, int[] of) { if (of.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbGivenFirst requires of one less than clique size (" + windowSize + ") but was " + Arrays.toString(of)); } // compute P(given, of) int[] labels = new int[windowSize]; labels[0] = given; System.arraycopy(of, 0, labels, 1, windowSize - 1); // double probAll = logProb(labels); double probAll = unnormalizedLogProb(labels); // compute P(given) // double probGiven = logProbFront(given); double probGiven = unnormalizedLogProbFront(given); // compute P(given, of) / P(given) return probAll - probGiven; }
[ "public", "double", "conditionalLogProbGivenFirst", "(", "int", "given", ",", "int", "[", "]", "of", ")", "{", "if", "(", "of", ".", "length", "!=", "windowSize", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"conditionalLogProbGivenFi...
Computes the probability of the sequence OF being at the end of the table given that the first tag in table is GIVEN. given is at the beginning, of is at the end @return the probability of the sequence of being at the end of the table
[ "Computes", "the", "probability", "of", "the", "sequence", "OF", "being", "at", "the", "end", "of", "the", "table", "given", "that", "the", "first", "tag", "in", "table", "is", "GIVEN", ".", "given", "is", "at", "the", "beginning", "of", "is", "at", "t...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/crf/FactorTable.java#L283-L301
googleapis/google-cloud-java
google-cloud-clients/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java
TraceServiceClient.batchWriteSpans
public final void batchWriteSpans(ProjectName name, List<Span> spans) { BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder() .setName(name == null ? null : name.toString()) .addAllSpans(spans) .build(); batchWriteSpans(request); }
java
public final void batchWriteSpans(ProjectName name, List<Span> spans) { BatchWriteSpansRequest request = BatchWriteSpansRequest.newBuilder() .setName(name == null ? null : name.toString()) .addAllSpans(spans) .build(); batchWriteSpans(request); }
[ "public", "final", "void", "batchWriteSpans", "(", "ProjectName", "name", ",", "List", "<", "Span", ">", "spans", ")", "{", "BatchWriteSpansRequest", "request", "=", "BatchWriteSpansRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "==", "nul...
Sends new spans to new or existing traces. You cannot update existing spans. <p>Sample code: <pre><code> try (TraceServiceClient traceServiceClient = TraceServiceClient.create()) { ProjectName name = ProjectName.of("[PROJECT]"); List&lt;Span&gt; spans = new ArrayList&lt;&gt;(); traceServiceClient.batchWriteSpans(name, spans); } </code></pre> @param name Required. The name of the project where the spans belong. The format is `projects/[PROJECT_ID]`. @param spans A list of new spans. The span names must not match existing spans, or the results are undefined. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Sends", "new", "spans", "to", "new", "or", "existing", "traces", ".", "You", "cannot", "update", "existing", "spans", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-trace/src/main/java/com/google/cloud/trace/v2/TraceServiceClient.java#L175-L183
jbundle/jbundle
main/db/src/main/java/org/jbundle/main/db/Person.java
Person.addListeners
public void addListeners() { super.addListeners(); this.addListener(new DateChangedHandler((DateTimeField)this.getField(Person.DATE_CHANGED))); this.addListener(new SetUserIDHandler(Person.CHANGED_ID, false)); this.getField(Person.NAME).addListener(new CopyLastHandler(this.getField(Person.NAME_SORT))); // Only if dest is null (ie., company name is null) this.getField(Person.NAME_SORT).addListener(new FieldToUpperHandler(null)); this.getField(Person.POSTAL_CODE).addListener(new CopyFieldHandler(this.getField(Person.POSTAL_CODE_SORT))); }
java
public void addListeners() { super.addListeners(); this.addListener(new DateChangedHandler((DateTimeField)this.getField(Person.DATE_CHANGED))); this.addListener(new SetUserIDHandler(Person.CHANGED_ID, false)); this.getField(Person.NAME).addListener(new CopyLastHandler(this.getField(Person.NAME_SORT))); // Only if dest is null (ie., company name is null) this.getField(Person.NAME_SORT).addListener(new FieldToUpperHandler(null)); this.getField(Person.POSTAL_CODE).addListener(new CopyFieldHandler(this.getField(Person.POSTAL_CODE_SORT))); }
[ "public", "void", "addListeners", "(", ")", "{", "super", ".", "addListeners", "(", ")", ";", "this", ".", "addListener", "(", "new", "DateChangedHandler", "(", "(", "DateTimeField", ")", "this", ".", "getField", "(", "Person", ".", "DATE_CHANGED", ")", ")...
Add all standard file & field behaviors. Override this to add record listeners and filters.
[ "Add", "all", "standard", "file", "&", "field", "behaviors", ".", "Override", "this", "to", "add", "record", "listeners", "and", "filters", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/Person.java#L129-L140
CloudSlang/cs-actions
cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java
WSManRemoteShellService.getResourceId
private String getResourceId(String response, String resourceResponseAction, String resourceIdXpath, String resourceIdExceptionMessage) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { if (WSManUtils.isSpecificResponseAction(response, resourceResponseAction)) { String shellId = XMLUtils.parseXml(response, resourceIdXpath); if (StringUtils.isNotBlank(shellId)) { return shellId; } else { throw new RuntimeException(resourceIdExceptionMessage); } } else if (WSManUtils.isFaultResponse(response)) { throw new RuntimeException(WSManUtils.getResponseFault(response)); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + response); } }
java
private String getResourceId(String response, String resourceResponseAction, String resourceIdXpath, String resourceIdExceptionMessage) throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { if (WSManUtils.isSpecificResponseAction(response, resourceResponseAction)) { String shellId = XMLUtils.parseXml(response, resourceIdXpath); if (StringUtils.isNotBlank(shellId)) { return shellId; } else { throw new RuntimeException(resourceIdExceptionMessage); } } else if (WSManUtils.isFaultResponse(response)) { throw new RuntimeException(WSManUtils.getResponseFault(response)); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + response); } }
[ "private", "String", "getResourceId", "(", "String", "response", ",", "String", "resourceResponseAction", ",", "String", "resourceIdXpath", ",", "String", "resourceIdExceptionMessage", ")", "throws", "ParserConfigurationException", ",", "SAXException", ",", "XPathExpression...
This method retrieves the resource id from the create resource request response and throws the appropriate exceptions in case of failure. @param response @param resourceResponseAction @param resourceIdXpath @param resourceIdExceptionMessage @return @throws ParserConfigurationException @throws SAXException @throws XPathExpressionException @throws IOException
[ "This", "method", "retrieves", "the", "resource", "id", "from", "the", "create", "resource", "request", "response", "and", "throws", "the", "appropriate", "exceptions", "in", "case", "of", "failure", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java#L289-L302
lucee/Lucee
core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java
ASMUtil.getAttributeBoolean
public static Boolean getAttributeBoolean(Tag tag, String attrName) throws EvaluatorException { Boolean b = getAttributeLiteral(tag, attrName).getBoolean(null); if (b == null) throw new EvaluatorException("attribute [" + attrName + "] must be a constant boolean value"); return b; }
java
public static Boolean getAttributeBoolean(Tag tag, String attrName) throws EvaluatorException { Boolean b = getAttributeLiteral(tag, attrName).getBoolean(null); if (b == null) throw new EvaluatorException("attribute [" + attrName + "] must be a constant boolean value"); return b; }
[ "public", "static", "Boolean", "getAttributeBoolean", "(", "Tag", "tag", ",", "String", "attrName", ")", "throws", "EvaluatorException", "{", "Boolean", "b", "=", "getAttributeLiteral", "(", "tag", ",", "attrName", ")", ".", "getBoolean", "(", "null", ")", ";"...
extract the content of a attribut @param cfxdTag @param attrName @return attribute value @throws EvaluatorException
[ "extract", "the", "content", "of", "a", "attribut" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/bytecode/util/ASMUtil.java#L317-L321
jenkinsci/support-core-plugin
src/main/java/com/cloudbees/jenkins/support/configfiles/SecretHandler.java
SecretHandler.findSecrets
public static String findSecrets(File xmlFile) throws SAXException, IOException, TransformerException { XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) { private String tagName = ""; @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { tagName = qName; super.startElement(uri, localName, qName, atts); } public void endElement(String uri, String localName, String qName) throws SAXException { tagName = ""; super.endElement(uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { if (!"".equals(tagName)) { String value = new String(ch, start, length).trim(); //if it's a secret, then use a place holder // convenience check !"{}".equals(value) because of JENKINS-47500 if (!"".equals(value) && !"{}".equals(value)) { if ((Secret.decrypt(value)) != null || SecretBytes.isSecretBytes(value)) { ch = SECRET_MARKER.toCharArray(); start = 0; length = ch.length; } } } super.characters(ch, start, length); } }; String str = FileUtils.readFileToString(xmlFile); Source src = createSafeSource(xr, new InputSource(new StringReader(str))); final ByteArrayOutputStream result = new ByteArrayOutputStream(); Result res = new StreamResult(result); TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); Transformer transformer = factory.newTransformer(); //omit xml declaration because of https://bugs.openjdk.java.net/browse/JDK-8035437 transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, OUTPUT_ENCODING); try { transformer.transform(src, res); return result.toString("UTF-8"); } catch (TransformerException e) { if (ENABLE_FALLBACK) { return findSecretFallback(str); } else { throw e; } } }
java
public static String findSecrets(File xmlFile) throws SAXException, IOException, TransformerException { XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) { private String tagName = ""; @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { tagName = qName; super.startElement(uri, localName, qName, atts); } public void endElement(String uri, String localName, String qName) throws SAXException { tagName = ""; super.endElement(uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { if (!"".equals(tagName)) { String value = new String(ch, start, length).trim(); //if it's a secret, then use a place holder // convenience check !"{}".equals(value) because of JENKINS-47500 if (!"".equals(value) && !"{}".equals(value)) { if ((Secret.decrypt(value)) != null || SecretBytes.isSecretBytes(value)) { ch = SECRET_MARKER.toCharArray(); start = 0; length = ch.length; } } } super.characters(ch, start, length); } }; String str = FileUtils.readFileToString(xmlFile); Source src = createSafeSource(xr, new InputSource(new StringReader(str))); final ByteArrayOutputStream result = new ByteArrayOutputStream(); Result res = new StreamResult(result); TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); Transformer transformer = factory.newTransformer(); //omit xml declaration because of https://bugs.openjdk.java.net/browse/JDK-8035437 transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, OUTPUT_ENCODING); try { transformer.transform(src, res); return result.toString("UTF-8"); } catch (TransformerException e) { if (ENABLE_FALLBACK) { return findSecretFallback(str); } else { throw e; } } }
[ "public", "static", "String", "findSecrets", "(", "File", "xmlFile", ")", "throws", "SAXException", ",", "IOException", ",", "TransformerException", "{", "XMLReader", "xr", "=", "new", "XMLFilterImpl", "(", "XMLReaderFactory", ".", "createXMLReader", "(", ")", ")"...
find the secret in the xml file and replace it with the place holder @param xmlFile we want to parse @return the patched xml content with redacted secrets @throws SAXException if some XML parsing issue occurs. @throws IOException if some issue occurs while reading the providing file. @throws TransformerException if an issue occurs while writing the result.
[ "find", "the", "secret", "in", "the", "xml", "file", "and", "replace", "it", "with", "the", "place", "holder" ]
train
https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/configfiles/SecretHandler.java#L62-L117
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/impl/bridge/WebSocketNativeBridgeHandler.java
WebSocketNativeBridgeHandler.processAuthorize
@Override public void processAuthorize(WebSocketChannel channel, String authorizeToken) { LOG.entering(CLASS_NAME, "processAuthorize"); WebSocketNativeChannel nativeChannel = (WebSocketNativeChannel)channel; Proxy proxy = nativeChannel.getProxy(); proxy.processEvent(XoaEventKind.AUTHORIZE, new String[] { authorizeToken }); }
java
@Override public void processAuthorize(WebSocketChannel channel, String authorizeToken) { LOG.entering(CLASS_NAME, "processAuthorize"); WebSocketNativeChannel nativeChannel = (WebSocketNativeChannel)channel; Proxy proxy = nativeChannel.getProxy(); proxy.processEvent(XoaEventKind.AUTHORIZE, new String[] { authorizeToken }); }
[ "@", "Override", "public", "void", "processAuthorize", "(", "WebSocketChannel", "channel", ",", "String", "authorizeToken", ")", "{", "LOG", ".", "entering", "(", "CLASS_NAME", ",", "\"processAuthorize\"", ")", ";", "WebSocketNativeChannel", "nativeChannel", "=", "(...
Set the authorize token for future requests for "Basic" authentication.
[ "Set", "the", "authorize", "token", "for", "future", "requests", "for", "Basic", "authentication", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/impl/bridge/WebSocketNativeBridgeHandler.java#L95-L102
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java
BoxApiComment.getUpdateRequest
public BoxRequestsComment.UpdateComment getUpdateRequest(String id, String newMessage) { BoxRequestsComment.UpdateComment request = new BoxRequestsComment.UpdateComment(id, newMessage, getCommentInfoUrl(id), mSession); return request; }
java
public BoxRequestsComment.UpdateComment getUpdateRequest(String id, String newMessage) { BoxRequestsComment.UpdateComment request = new BoxRequestsComment.UpdateComment(id, newMessage, getCommentInfoUrl(id), mSession); return request; }
[ "public", "BoxRequestsComment", ".", "UpdateComment", "getUpdateRequest", "(", "String", "id", ",", "String", "newMessage", ")", "{", "BoxRequestsComment", ".", "UpdateComment", "request", "=", "new", "BoxRequestsComment", ".", "UpdateComment", "(", "id", ",", "newM...
Gets a request that updates a comment's information @param id id of comment to update information on @param newMessage new message for the comment @return request to update a comment's information
[ "Gets", "a", "request", "that", "updates", "a", "comment", "s", "information" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiComment.java#L56-L59
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java
PrimaveraDatabaseReader.listProjects
public Map<Integer, String> listProjects() throws MPXJException { try { Map<Integer, String> result = new HashMap<Integer, String>(); List<Row> rows = getRows("select proj_id, proj_short_name from " + m_schema + "project where delete_date is null"); for (Row row : rows) { Integer id = row.getInteger("proj_id"); String name = row.getString("proj_short_name"); result.put(id, name); } return result; } catch (SQLException ex) { throw new MPXJException(MPXJException.READ_ERROR, ex); } }
java
public Map<Integer, String> listProjects() throws MPXJException { try { Map<Integer, String> result = new HashMap<Integer, String>(); List<Row> rows = getRows("select proj_id, proj_short_name from " + m_schema + "project where delete_date is null"); for (Row row : rows) { Integer id = row.getInteger("proj_id"); String name = row.getString("proj_short_name"); result.put(id, name); } return result; } catch (SQLException ex) { throw new MPXJException(MPXJException.READ_ERROR, ex); } }
[ "public", "Map", "<", "Integer", ",", "String", ">", "listProjects", "(", ")", "throws", "MPXJException", "{", "try", "{", "Map", "<", "Integer", ",", "String", ">", "result", "=", "new", "HashMap", "<", "Integer", ",", "String", ">", "(", ")", ";", ...
Populates a Map instance representing the IDs and names of projects available in the current database. @return Map instance containing ID and name pairs @throws MPXJException
[ "Populates", "a", "Map", "instance", "representing", "the", "IDs", "and", "names", "of", "projects", "available", "in", "the", "current", "database", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L76-L97
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedhousing/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedhousing.java
ApiOvhDedicatedhousing.serviceName_features_backupFTP_access_ipBlock_PUT
public void serviceName_features_backupFTP_access_ipBlock_PUT(String serviceName, String ipBlock, OvhBackupFtpAcl body) throws IOException { String qPath = "/dedicated/housing/{serviceName}/features/backupFTP/access/{ipBlock}"; StringBuilder sb = path(qPath, serviceName, ipBlock); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_features_backupFTP_access_ipBlock_PUT(String serviceName, String ipBlock, OvhBackupFtpAcl body) throws IOException { String qPath = "/dedicated/housing/{serviceName}/features/backupFTP/access/{ipBlock}"; StringBuilder sb = path(qPath, serviceName, ipBlock); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_features_backupFTP_access_ipBlock_PUT", "(", "String", "serviceName", ",", "String", "ipBlock", ",", "OvhBackupFtpAcl", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/housing/{serviceName}/features/backupFTP/acces...
Alter this object properties REST: PUT /dedicated/housing/{serviceName}/features/backupFTP/access/{ipBlock} @param body [required] New object properties @param serviceName [required] The internal name of your Housing bay @param ipBlock [required] The IP Block specific to this ACL
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedhousing/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedhousing.java#L195-L199
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgEllipse.java
DwgEllipse.readDwgEllipseV15
public void readDwgEllipseV15(int[] data, int offset) throws Exception { int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); Vector v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double z = ((Double)v.get(1)).doubleValue(); double[] coord = new double[]{x, y, z}; center = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); z = ((Double)v.get(1)).doubleValue(); coord = new double[]{x, y, z}; majorAxisVector = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); z = ((Double)v.get(1)).doubleValue(); coord = new double[]{x, y, z}; extrusion = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double val = ((Double)v.get(1)).doubleValue(); axisRatio = val; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); initAngle = val; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); endAngle = val; bitPos = readObjectTailV15(data, bitPos); }
java
public void readDwgEllipseV15(int[] data, int offset) throws Exception { int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); Vector v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double z = ((Double)v.get(1)).doubleValue(); double[] coord = new double[]{x, y, z}; center = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); z = ((Double)v.get(1)).doubleValue(); coord = new double[]{x, y, z}; majorAxisVector = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); z = ((Double)v.get(1)).doubleValue(); coord = new double[]{x, y, z}; extrusion = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double val = ((Double)v.get(1)).doubleValue(); axisRatio = val; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); initAngle = val; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); endAngle = val; bitPos = readObjectTailV15(data, bitPos); }
[ "public", "void", "readDwgEllipseV15", "(", "int", "[", "]", "data", ",", "int", "offset", ")", "throws", "Exception", "{", "int", "bitPos", "=", "offset", ";", "bitPos", "=", "readObjectHeaderV15", "(", "data", ",", "bitPos", ")", ";", "Vector", "v", "=...
Read a Ellipse in the DWG format Version 15 @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines.
[ "Read", "a", "Ellipse", "in", "the", "DWG", "format", "Version", "15" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgEllipse.java#L47-L96
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java
DateContext.dateToString
public String dateToString(Date date, String inputFormat) { return FastDateFormat.getInstance(inputFormat).format(date); }
java
public String dateToString(Date date, String inputFormat) { return FastDateFormat.getInstance(inputFormat).format(date); }
[ "public", "String", "dateToString", "(", "Date", "date", ",", "String", "inputFormat", ")", "{", "return", "FastDateFormat", ".", "getInstance", "(", "inputFormat", ")", ".", "format", "(", "date", ")", ";", "}" ]
Create a string of the given date using the given format. If the given format is invalid, then {@link IllegalArgumentException} is thrown. @param date The date to create the value from @param inputFormat The format to use in formatting the date @return The string instance representing the date in the given format
[ "Create", "a", "string", "of", "the", "given", "date", "using", "the", "given", "format", ".", "If", "the", "given", "format", "is", "invalid", "then", "{", "@link", "IllegalArgumentException", "}", "is", "thrown", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java#L396-L398
emilsjolander/StickyListHeaders
library/src/se/emilsjolander/stickylistheaders/AdapterWrapper.java
AdapterWrapper.configureHeader
private View configureHeader(WrapperView wv, final int position) { View header = wv.mHeader == null ? popHeader() : wv.mHeader; header = mDelegate.getHeaderView(position, header, wv); if (header == null) { throw new NullPointerException("Header view must not be null."); } //if the header isn't clickable, the listselector will be drawn on top of the header header.setClickable(true); header.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(mOnHeaderClickListener != null){ long headerId = mDelegate.getHeaderId(position); mOnHeaderClickListener.onHeaderClick(v, position, headerId); } } }); return header; }
java
private View configureHeader(WrapperView wv, final int position) { View header = wv.mHeader == null ? popHeader() : wv.mHeader; header = mDelegate.getHeaderView(position, header, wv); if (header == null) { throw new NullPointerException("Header view must not be null."); } //if the header isn't clickable, the listselector will be drawn on top of the header header.setClickable(true); header.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(mOnHeaderClickListener != null){ long headerId = mDelegate.getHeaderId(position); mOnHeaderClickListener.onHeaderClick(v, position, headerId); } } }); return header; }
[ "private", "View", "configureHeader", "(", "WrapperView", "wv", ",", "final", "int", "position", ")", "{", "View", "header", "=", "wv", ".", "mHeader", "==", "null", "?", "popHeader", "(", ")", ":", "wv", ".", "mHeader", ";", "header", "=", "mDelegate", ...
Get a header view. This optionally pulls a header from the supplied {@link WrapperView} and will also recycle the divider if it exists.
[ "Get", "a", "header", "view", ".", "This", "optionally", "pulls", "a", "header", "from", "the", "supplied", "{" ]
train
https://github.com/emilsjolander/StickyListHeaders/blob/cec8d6a6ddfc29c530df5864794a5a0a2d2f3675/library/src/se/emilsjolander/stickylistheaders/AdapterWrapper.java#L126-L145
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java
TitlePaneCloseButtonPainter.paintClosePressed
private void paintClosePressed(Graphics2D g, JComponent c, int width, int height) { paintClose(g, c, width, height, pressed); }
java
private void paintClosePressed(Graphics2D g, JComponent c, int width, int height) { paintClose(g, c, width, height, pressed); }
[ "private", "void", "paintClosePressed", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "paintClose", "(", "g", ",", "c", ",", "width", ",", "height", ",", "pressed", ")", ";", "}" ]
Paint the background pressed state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "background", "pressed", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneCloseButtonPainter.java#L139-L141
Axway/Grapes
utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java
GrapesClient.getModuleAncestors
public List<Dependency> getModuleAncestors(final String moduleName, final String moduleVersion) throws GrapesCommunicationException { final Client client = getClient(); final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactAncestors(moduleName, moduleVersion)); final ClientResponse response = resource.queryParam(ServerAPI.SCOPE_COMPILE_PARAM, "true") .queryParam(ServerAPI.SCOPE_PROVIDED_PARAM, "true") .queryParam(ServerAPI.SCOPE_RUNTIME_PARAM, "true") .queryParam(ServerAPI.SCOPE_TEST_PARAM, "true") .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); client.destroy(); if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){ final String message = String.format(FAILED_TO_GET_MODULE, "get module ancestors", moduleName, moduleVersion); if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } return response.getEntity(new GenericType<List<Dependency>>(){}); }
java
public List<Dependency> getModuleAncestors(final String moduleName, final String moduleVersion) throws GrapesCommunicationException { final Client client = getClient(); final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactAncestors(moduleName, moduleVersion)); final ClientResponse response = resource.queryParam(ServerAPI.SCOPE_COMPILE_PARAM, "true") .queryParam(ServerAPI.SCOPE_PROVIDED_PARAM, "true") .queryParam(ServerAPI.SCOPE_RUNTIME_PARAM, "true") .queryParam(ServerAPI.SCOPE_TEST_PARAM, "true") .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); client.destroy(); if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){ final String message = String.format(FAILED_TO_GET_MODULE, "get module ancestors", moduleName, moduleVersion); if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } return response.getEntity(new GenericType<List<Dependency>>(){}); }
[ "public", "List", "<", "Dependency", ">", "getModuleAncestors", "(", "final", "String", "moduleName", ",", "final", "String", "moduleVersion", ")", "throws", "GrapesCommunicationException", "{", "final", "Client", "client", "=", "getClient", "(", ")", ";", "final"...
Return the list of module ancestors @param moduleName @param moduleVersion @return List<Dependency> @throws GrapesCommunicationException
[ "Return", "the", "list", "of", "module", "ancestors" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L760-L779
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/query/impl/getters/Getter.java
Getter.getValue
Object getValue(Object obj, String attributePath, Object metadata) throws Exception { return getValue(obj, attributePath); }
java
Object getValue(Object obj, String attributePath, Object metadata) throws Exception { return getValue(obj, attributePath); }
[ "Object", "getValue", "(", "Object", "obj", ",", "String", "attributePath", ",", "Object", "metadata", ")", "throws", "Exception", "{", "return", "getValue", "(", "obj", ",", "attributePath", ")", ";", "}" ]
Method for generic getters that can make use of metadata if available. These getters must gracefully fallback to not using metadata if unavailable.
[ "Method", "for", "generic", "getters", "that", "can", "make", "use", "of", "metadata", "if", "available", ".", "These", "getters", "must", "gracefully", "fallback", "to", "not", "using", "metadata", "if", "unavailable", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/getters/Getter.java#L47-L49
square/tape
tape/src/main/java/com/squareup/tape2/QueueFile.java
QueueFile.writeHeader
private void writeHeader(long fileLength, int elementCount, long firstPosition, long lastPosition) throws IOException { raf.seek(0); if (versioned) { writeInt(buffer, 0, VERSIONED_HEADER); writeLong(buffer, 4, fileLength); writeInt(buffer, 12, elementCount); writeLong(buffer, 16, firstPosition); writeLong(buffer, 24, lastPosition); raf.write(buffer, 0, 32); return; } // Legacy queue header. writeInt(buffer, 0, (int) fileLength); // Signed, so leading bit is always 0 aka legacy. writeInt(buffer, 4, elementCount); writeInt(buffer, 8, (int) firstPosition); writeInt(buffer, 12, (int) lastPosition); raf.write(buffer, 0, 16); }
java
private void writeHeader(long fileLength, int elementCount, long firstPosition, long lastPosition) throws IOException { raf.seek(0); if (versioned) { writeInt(buffer, 0, VERSIONED_HEADER); writeLong(buffer, 4, fileLength); writeInt(buffer, 12, elementCount); writeLong(buffer, 16, firstPosition); writeLong(buffer, 24, lastPosition); raf.write(buffer, 0, 32); return; } // Legacy queue header. writeInt(buffer, 0, (int) fileLength); // Signed, so leading bit is always 0 aka legacy. writeInt(buffer, 4, elementCount); writeInt(buffer, 8, (int) firstPosition); writeInt(buffer, 12, (int) lastPosition); raf.write(buffer, 0, 16); }
[ "private", "void", "writeHeader", "(", "long", "fileLength", ",", "int", "elementCount", ",", "long", "firstPosition", ",", "long", "lastPosition", ")", "throws", "IOException", "{", "raf", ".", "seek", "(", "0", ")", ";", "if", "(", "versioned", ")", "{",...
Writes header atomically. The arguments contain the updated values. The class member fields should not have changed yet. This only updates the state in the file. It's up to the caller to update the class member variables *after* this call succeeds. Assumes segment writes are atomic in the underlying file system.
[ "Writes", "header", "atomically", ".", "The", "arguments", "contain", "the", "updated", "values", ".", "The", "class", "member", "fields", "should", "not", "have", "changed", "yet", ".", "This", "only", "updates", "the", "state", "in", "the", "file", ".", ...
train
https://github.com/square/tape/blob/445cd3fd0a7b3ec48c9ea3e0e86663fe6d3735d8/tape/src/main/java/com/squareup/tape2/QueueFile.java#L265-L285
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.pixelXToLongitudeWithScaleFactor
public static double pixelXToLongitudeWithScaleFactor(double pixelX, double scaleFactor, int tileSize) { long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); if (pixelX < 0 || pixelX > mapSize) { throw new IllegalArgumentException("invalid pixelX coordinate at scale " + scaleFactor + ": " + pixelX); } return 360 * ((pixelX / mapSize) - 0.5); }
java
public static double pixelXToLongitudeWithScaleFactor(double pixelX, double scaleFactor, int tileSize) { long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); if (pixelX < 0 || pixelX > mapSize) { throw new IllegalArgumentException("invalid pixelX coordinate at scale " + scaleFactor + ": " + pixelX); } return 360 * ((pixelX / mapSize) - 0.5); }
[ "public", "static", "double", "pixelXToLongitudeWithScaleFactor", "(", "double", "pixelX", ",", "double", "scaleFactor", ",", "int", "tileSize", ")", "{", "long", "mapSize", "=", "getMapSizeWithScaleFactor", "(", "scaleFactor", ",", "tileSize", ")", ";", "if", "("...
Converts a pixel X coordinate at a certain scale to a longitude coordinate. @param pixelX the pixel X coordinate that should be converted. @param scaleFactor the scale factor at which the coordinate should be converted. @return the longitude value of the pixel X coordinate. @throws IllegalArgumentException if the given pixelX coordinate is invalid.
[ "Converts", "a", "pixel", "X", "coordinate", "at", "a", "certain", "scale", "to", "a", "longitude", "coordinate", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L336-L342
SonarSource/sonarqube
server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java
DatabaseUtils.executeLargeInputs
public static <OUTPUT, INPUT extends Comparable<INPUT>> List<OUTPUT> executeLargeInputs(Collection<INPUT> input, Function<List<INPUT>, List<OUTPUT>> function, IntFunction<Integer> partitionSizeManipulations) { return executeLargeInputs(input, function, size -> size == 0 ? Collections.emptyList() : new ArrayList<>(size), partitionSizeManipulations); }
java
public static <OUTPUT, INPUT extends Comparable<INPUT>> List<OUTPUT> executeLargeInputs(Collection<INPUT> input, Function<List<INPUT>, List<OUTPUT>> function, IntFunction<Integer> partitionSizeManipulations) { return executeLargeInputs(input, function, size -> size == 0 ? Collections.emptyList() : new ArrayList<>(size), partitionSizeManipulations); }
[ "public", "static", "<", "OUTPUT", ",", "INPUT", "extends", "Comparable", "<", "INPUT", ">", ">", "List", "<", "OUTPUT", ">", "executeLargeInputs", "(", "Collection", "<", "INPUT", ">", "input", ",", "Function", "<", "List", "<", "INPUT", ">", ",", "List...
Partition by 1000 elements a list of input and execute a function on each part. The goal is to prevent issue with ORACLE when there's more than 1000 elements in a 'in ('X', 'Y', ...)' and with MsSQL when there's more than 2000 parameters in a query
[ "Partition", "by", "1000", "elements", "a", "list", "of", "input", "and", "execute", "a", "function", "on", "each", "part", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java#L117-L120
jenkinsci/jenkins
core/src/main/java/hudson/slaves/NodeDescriptor.java
NodeDescriptor.handleNewNodePage
public void handleNewNodePage(ComputerSet computerSet, String name, StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { computerSet.checkName(name); req.setAttribute("descriptor", this); req.getView(computerSet,"_new.jelly").forward(req,rsp); }
java
public void handleNewNodePage(ComputerSet computerSet, String name, StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { computerSet.checkName(name); req.setAttribute("descriptor", this); req.getView(computerSet,"_new.jelly").forward(req,rsp); }
[ "public", "void", "handleNewNodePage", "(", "ComputerSet", "computerSet", ",", "String", "name", ",", "StaplerRequest", "req", ",", "StaplerResponse", "rsp", ")", "throws", "IOException", ",", "ServletException", "{", "computerSet", ".", "checkName", "(", "name", ...
Handles the form submission from the "/computer/new" page, which is the first form for creating a new node. By default, it shows the configuration page for entering details, but subtypes can override this differently. @param name Name of the new node.
[ "Handles", "the", "form", "submission", "from", "the", "/", "computer", "/", "new", "page", "which", "is", "the", "first", "form", "for", "creating", "a", "new", "node", ".", "By", "default", "it", "shows", "the", "configuration", "page", "for", "entering"...
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/slaves/NodeDescriptor.java#L88-L92
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/EntityFieldAnnotationRule.java
EntityFieldAnnotationRule.validateGeneratedValueAnnotation
private void validateGeneratedValueAnnotation(final Class<?> clazz, Field field) { Table table = clazz.getAnnotation(Table.class); // Still we need to validate for this after post metadata // population. if (table != null) { String schemaName = table.schema(); if (schemaName != null && schemaName.indexOf('@') > 0) { schemaName = schemaName.substring(0, schemaName.indexOf('@')); GeneratedValue generatedValue = field.getAnnotation(GeneratedValue.class); if (generatedValue != null && generatedValue.generator() != null && !generatedValue.generator().isEmpty()) { if (!(field.isAnnotationPresent(TableGenerator.class) || field.isAnnotationPresent(SequenceGenerator.class) || clazz.isAnnotationPresent(TableGenerator.class) || clazz .isAnnotationPresent(SequenceGenerator.class))) { throw new IllegalArgumentException("Unknown Id.generator: " + generatedValue.generator()); } else { checkForGenerator(clazz, field, generatedValue, schemaName); } } } } }
java
private void validateGeneratedValueAnnotation(final Class<?> clazz, Field field) { Table table = clazz.getAnnotation(Table.class); // Still we need to validate for this after post metadata // population. if (table != null) { String schemaName = table.schema(); if (schemaName != null && schemaName.indexOf('@') > 0) { schemaName = schemaName.substring(0, schemaName.indexOf('@')); GeneratedValue generatedValue = field.getAnnotation(GeneratedValue.class); if (generatedValue != null && generatedValue.generator() != null && !generatedValue.generator().isEmpty()) { if (!(field.isAnnotationPresent(TableGenerator.class) || field.isAnnotationPresent(SequenceGenerator.class) || clazz.isAnnotationPresent(TableGenerator.class) || clazz .isAnnotationPresent(SequenceGenerator.class))) { throw new IllegalArgumentException("Unknown Id.generator: " + generatedValue.generator()); } else { checkForGenerator(clazz, field, generatedValue, schemaName); } } } } }
[ "private", "void", "validateGeneratedValueAnnotation", "(", "final", "Class", "<", "?", ">", "clazz", ",", "Field", "field", ")", "{", "Table", "table", "=", "clazz", ".", "getAnnotation", "(", "Table", ".", "class", ")", ";", "// Still we need to validate for t...
validate generated value annotation if given. @param clazz @param field @throws RuleValidationException
[ "validate", "generated", "value", "annotation", "if", "given", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/EntityFieldAnnotationRule.java#L205-L237
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/ExponentiallyModifiedGaussianDistribution.java
ExponentiallyModifiedGaussianDistribution.logpdf
public static double logpdf(double x, double mu, double sigma, double lambda) { final double dx = x - mu; final double lss = lambda * sigma * sigma; final double erfc = NormalDistribution.erfc((lss - dx) / (sigma * MathUtil.SQRT2)); return erfc > 0 ? FastMath.log(.5 * lambda * erfc) + lambda * (lss * .5 - dx) : (x == x) ? Double.NEGATIVE_INFINITY : Double.NaN; }
java
public static double logpdf(double x, double mu, double sigma, double lambda) { final double dx = x - mu; final double lss = lambda * sigma * sigma; final double erfc = NormalDistribution.erfc((lss - dx) / (sigma * MathUtil.SQRT2)); return erfc > 0 ? FastMath.log(.5 * lambda * erfc) + lambda * (lss * .5 - dx) : (x == x) ? Double.NEGATIVE_INFINITY : Double.NaN; }
[ "public", "static", "double", "logpdf", "(", "double", "x", ",", "double", "mu", ",", "double", "sigma", ",", "double", "lambda", ")", "{", "final", "double", "dx", "=", "x", "-", "mu", ";", "final", "double", "lss", "=", "lambda", "*", "sigma", "*",...
Probability density function of the ExGaussian distribution. @param x The value. @param mu The mean. @param sigma The standard deviation. @param lambda Rate parameter. @return PDF of the given exgauss distribution at x.
[ "Probability", "density", "function", "of", "the", "ExGaussian", "distribution", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/ExponentiallyModifiedGaussianDistribution.java#L185-L190
google/auto
value/src/main/java/com/google/auto/value/processor/AutoValueOrOneOfProcessor.java
AutoValueOrOneOfProcessor.equalsParameterType
static String equalsParameterType(Map<ObjectMethod, ExecutableElement> methodsToGenerate) { ExecutableElement equals = methodsToGenerate.get(ObjectMethod.EQUALS); if (equals == null) { return ""; // this will not be referenced because no equals method will be generated } TypeMirror parameterType = equals.getParameters().get(0).asType(); return TypeEncoder.encodeWithAnnotations(parameterType); }
java
static String equalsParameterType(Map<ObjectMethod, ExecutableElement> methodsToGenerate) { ExecutableElement equals = methodsToGenerate.get(ObjectMethod.EQUALS); if (equals == null) { return ""; // this will not be referenced because no equals method will be generated } TypeMirror parameterType = equals.getParameters().get(0).asType(); return TypeEncoder.encodeWithAnnotations(parameterType); }
[ "static", "String", "equalsParameterType", "(", "Map", "<", "ObjectMethod", ",", "ExecutableElement", ">", "methodsToGenerate", ")", "{", "ExecutableElement", "equals", "=", "methodsToGenerate", ".", "get", "(", "ObjectMethod", ".", "EQUALS", ")", ";", "if", "(", ...
Returns the encoded parameter type of the {@code equals(Object)} method that is to be generated, or an empty string if the method is not being generated. The parameter type includes any type annotations, for example {@code @Nullable}.
[ "Returns", "the", "encoded", "parameter", "type", "of", "the", "{" ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/AutoValueOrOneOfProcessor.java#L682-L689
authorjapps/zerocode
core/src/main/java/org/jsmart/zerocode/core/runner/ZeroCodePackageRunner.java
ZeroCodePackageRunner.runChild
@Override protected void runChild(ScenarioSpec child, RunNotifier notifier) { final Description description = Description.createTestDescription(testClass, child.getScenarioName()); // ---------------------------------------------- // Notify that this single test has been started. // Supply the scenario/journey name // ---------------------------------------------- notifier.fireTestStarted(description); passed = zeroCodeMultiStepsScenarioRunner.runScenario(child, notifier, description); testRunCompleted = true; if (passed) { LOGGER.info(String.format("\nPackageRunner- **FINISHED executing all Steps for [%s] **.\nSteps were:%s", child.getScenarioName(), child.getSteps().stream().map(step -> step.getName()).collect(Collectors.toList()))); } notifier.fireTestFinished(description); }
java
@Override protected void runChild(ScenarioSpec child, RunNotifier notifier) { final Description description = Description.createTestDescription(testClass, child.getScenarioName()); // ---------------------------------------------- // Notify that this single test has been started. // Supply the scenario/journey name // ---------------------------------------------- notifier.fireTestStarted(description); passed = zeroCodeMultiStepsScenarioRunner.runScenario(child, notifier, description); testRunCompleted = true; if (passed) { LOGGER.info(String.format("\nPackageRunner- **FINISHED executing all Steps for [%s] **.\nSteps were:%s", child.getScenarioName(), child.getSteps().stream().map(step -> step.getName()).collect(Collectors.toList()))); } notifier.fireTestFinished(description); }
[ "@", "Override", "protected", "void", "runChild", "(", "ScenarioSpec", "child", ",", "RunNotifier", "notifier", ")", "{", "final", "Description", "description", "=", "Description", ".", "createTestDescription", "(", "testClass", ",", "child", ".", "getScenarioName",...
Runs the test corresponding to {@code child}, which can be assumed to be an element of the list returned by {@link ParentRunner#getChildren()}. Subclasses are responsible for making sure that relevant test events are reported through {@code notifier} @param child @param notifier
[ "Runs", "the", "test", "corresponding", "to", "{", "@code", "child", "}", "which", "can", "be", "assumed", "to", "be", "an", "element", "of", "the", "list", "returned", "by", "{", "@link", "ParentRunner#getChildren", "()", "}", ".", "Subclasses", "are", "r...
train
https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/runner/ZeroCodePackageRunner.java#L159-L182
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java
TypeUtility.mergeTypeNameWithSuffix
public static ClassName mergeTypeNameWithSuffix(TypeName typeName, String typeNameSuffix) { ClassName className = className(typeName.toString()); return classNameWithSuffix(className.packageName(), className.simpleName(), typeNameSuffix); }
java
public static ClassName mergeTypeNameWithSuffix(TypeName typeName, String typeNameSuffix) { ClassName className = className(typeName.toString()); return classNameWithSuffix(className.packageName(), className.simpleName(), typeNameSuffix); }
[ "public", "static", "ClassName", "mergeTypeNameWithSuffix", "(", "TypeName", "typeName", ",", "String", "typeNameSuffix", ")", "{", "ClassName", "className", "=", "className", "(", "typeName", ".", "toString", "(", ")", ")", ";", "return", "classNameWithSuffix", "...
Merge type name with suffix. @param typeName the type name @param typeNameSuffix the type name suffix @return the class name
[ "Merge", "type", "name", "with", "suffix", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java#L287-L291
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseFloat
public static float parseFloat (@Nullable final String sStr, final float fDefault) { // parseDouble throws a NPE if parameter is null if (sStr != null && sStr.length () > 0) try { // Single point where we replace "," with "." for parsing! return Float.parseFloat (_getUnifiedDecimal (sStr)); } catch (final NumberFormatException ex) { // Fall through } return fDefault; }
java
public static float parseFloat (@Nullable final String sStr, final float fDefault) { // parseDouble throws a NPE if parameter is null if (sStr != null && sStr.length () > 0) try { // Single point where we replace "," with "." for parsing! return Float.parseFloat (_getUnifiedDecimal (sStr)); } catch (final NumberFormatException ex) { // Fall through } return fDefault; }
[ "public", "static", "float", "parseFloat", "(", "@", "Nullable", "final", "String", "sStr", ",", "final", "float", "fDefault", ")", "{", "// parseDouble throws a NPE if parameter is null", "if", "(", "sStr", "!=", "null", "&&", "sStr", ".", "length", "(", ")", ...
Parse the given {@link String} as float. @param sStr The string to parse. May be <code>null</code>. @param fDefault The default value to be returned if the passed object could not be converted to a valid value. @return The default value if the string does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "String", "}", "as", "float", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L607-L621
tvesalainen/util
util/src/main/java/org/vesalainen/nio/RingByteBuffer.java
RingByteBuffer.writeTo
public int writeTo(RingByteBuffer ring) throws IOException { return writeTo((srcs, offset, length)->ring.fill(srcs, offset, length), writeToSplitter); }
java
public int writeTo(RingByteBuffer ring) throws IOException { return writeTo((srcs, offset, length)->ring.fill(srcs, offset, length), writeToSplitter); }
[ "public", "int", "writeTo", "(", "RingByteBuffer", "ring", ")", "throws", "IOException", "{", "return", "writeTo", "(", "(", "srcs", ",", "offset", ",", "length", ")", "->", "ring", ".", "fill", "(", "srcs", ",", "offset", ",", "length", ")", ",", "wri...
Write this buffers content from mark (included) to position (excluded). Returns count of actual written items. @param ring @return @throws java.io.IOException
[ "Write", "this", "buffers", "content", "from", "mark", "(", "included", ")", "to", "position", "(", "excluded", ")", ".", "Returns", "count", "of", "actual", "written", "items", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/RingByteBuffer.java#L171-L174
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/DBService.java
DBService.getAllRows
public Iterable<DRow> getAllRows(String storeName) { return new SequenceIterable<DRow>(new RowSequence(m_tenant, storeName, 65536)); }
java
public Iterable<DRow> getAllRows(String storeName) { return new SequenceIterable<DRow>(new RowSequence(m_tenant, storeName, 65536)); }
[ "public", "Iterable", "<", "DRow", ">", "getAllRows", "(", "String", "storeName", ")", "{", "return", "new", "SequenceIterable", "<", "DRow", ">", "(", "new", "RowSequence", "(", "m_tenant", ",", "storeName", ",", "65536", ")", ")", ";", "}" ]
Get {@link DRow} object for the given row key. the object will be returned even if the row has no columns or does not exist @param storeName Name of physical store to query. @return {@link DRow} object. May be empty but not null.
[ "Get", "{", "@link", "DRow", "}", "object", "for", "the", "given", "row", "key", ".", "the", "object", "will", "be", "returned", "even", "if", "the", "row", "has", "no", "columns", "or", "does", "not", "exist" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBService.java#L298-L300
actorapp/actor-platform
actor-sdk/sdk-core-android/android-app/src/main/java/im/actor/tour/VerticalViewPager.java
VerticalViewPager.smoothScrollTo
void smoothScrollTo(int x, int y, int velocity) { if (getChildCount() == 0) { // Nothing to do. setScrollingCacheEnabled(false); return; } int sx = getScrollX(); int sy = getScrollY(); int dx = x - sx; int dy = y - sy; if (dx == 0 && dy == 0) { completeScroll(false); populate(); setScrollState(SCROLL_STATE_IDLE); return; } setScrollingCacheEnabled(true); setScrollState(SCROLL_STATE_SETTLING); final int height = getClientHeight(); final int halfHeight = height / 2; final float distanceRatio = Math.min(1f, 1.0f * Math.abs(dx) / height); final float distance = halfHeight + halfHeight * distanceInfluenceForSnapDuration(distanceRatio); int duration = 0; velocity = Math.abs(velocity); if (velocity > 0) { duration = 4 * Math.round(1000 * Math.abs(distance / velocity)); } else { final float pageHeight = height * mAdapter.getPageWidth(mCurItem); final float pageDelta = (float) Math.abs(dx) / (pageHeight + mPageMargin); duration = (int) ((pageDelta + 1) * 100); } duration = Math.min(duration, MAX_SETTLE_DURATION); mScroller.startScroll(sx, sy, dx, dy, duration); ViewCompat.postInvalidateOnAnimation(this); }
java
void smoothScrollTo(int x, int y, int velocity) { if (getChildCount() == 0) { // Nothing to do. setScrollingCacheEnabled(false); return; } int sx = getScrollX(); int sy = getScrollY(); int dx = x - sx; int dy = y - sy; if (dx == 0 && dy == 0) { completeScroll(false); populate(); setScrollState(SCROLL_STATE_IDLE); return; } setScrollingCacheEnabled(true); setScrollState(SCROLL_STATE_SETTLING); final int height = getClientHeight(); final int halfHeight = height / 2; final float distanceRatio = Math.min(1f, 1.0f * Math.abs(dx) / height); final float distance = halfHeight + halfHeight * distanceInfluenceForSnapDuration(distanceRatio); int duration = 0; velocity = Math.abs(velocity); if (velocity > 0) { duration = 4 * Math.round(1000 * Math.abs(distance / velocity)); } else { final float pageHeight = height * mAdapter.getPageWidth(mCurItem); final float pageDelta = (float) Math.abs(dx) / (pageHeight + mPageMargin); duration = (int) ((pageDelta + 1) * 100); } duration = Math.min(duration, MAX_SETTLE_DURATION); mScroller.startScroll(sx, sy, dx, dy, duration); ViewCompat.postInvalidateOnAnimation(this); }
[ "void", "smoothScrollTo", "(", "int", "x", ",", "int", "y", ",", "int", "velocity", ")", "{", "if", "(", "getChildCount", "(", ")", "==", "0", ")", "{", "// Nothing to do.", "setScrollingCacheEnabled", "(", "false", ")", ";", "return", ";", "}", "int", ...
Like {@link View#scrollBy}, but scroll smoothly instead of immediately. @param x the number of pixels to scroll by on the X axis @param y the number of pixels to scroll by on the Y axis @param velocity the velocity associated with a fling, if applicable. (0 otherwise)
[ "Like", "{", "@link", "View#scrollBy", "}", "but", "scroll", "smoothly", "instead", "of", "immediately", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-app/src/main/java/im/actor/tour/VerticalViewPager.java#L653-L692
geomajas/geomajas-project-server
api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java
ManyToOneAttribute.setCurrencyAttribute
public void setCurrencyAttribute(String name, String value) { ensureValue(); Attribute attribute = new CurrencyAttribute(value); attribute.setEditable(isEditable(name)); getValue().getAllAttributes().put(name, attribute); }
java
public void setCurrencyAttribute(String name, String value) { ensureValue(); Attribute attribute = new CurrencyAttribute(value); attribute.setEditable(isEditable(name)); getValue().getAllAttributes().put(name, attribute); }
[ "public", "void", "setCurrencyAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "ensureValue", "(", ")", ";", "Attribute", "attribute", "=", "new", "CurrencyAttribute", "(", "value", ")", ";", "attribute", ".", "setEditable", "(", "isEditabl...
Sets the specified currency attribute to the specified value. @param name name of the attribute @param value value of the attribute @since 1.9.0
[ "Sets", "the", "specified", "currency", "attribute", "to", "the", "specified", "value", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java#L132-L137
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.addSubResources
private void addSubResources(CmsDbContext dbc, CmsPublishList publishList, CmsResource directPublishResource) throws CmsDataAccessException { int flags = CmsDriverManager.READMODE_INCLUDE_TREE | CmsDriverManager.READMODE_EXCLUDE_STATE; if (!directPublishResource.getState().isDeleted()) { // fix for org.opencms.file.TestPublishIssues#testPublishFolderWithDeletedFileFromOtherProject flags = flags | CmsDriverManager.READMODE_INCLUDE_PROJECT; } // add all sub resources of the folder List<CmsResource> folderList = getVfsDriver(dbc).readResourceTree( dbc, dbc.currentProject().getUuid(), directPublishResource.getRootPath(), CmsDriverManager.READ_IGNORE_TYPE, CmsResource.STATE_UNCHANGED, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, flags | CmsDriverManager.READMODE_ONLY_FOLDERS); publishList.addAll(filterResources(dbc, publishList, folderList), true); List<CmsResource> fileList = getVfsDriver(dbc).readResourceTree( dbc, dbc.currentProject().getUuid(), directPublishResource.getRootPath(), CmsDriverManager.READ_IGNORE_TYPE, CmsResource.STATE_UNCHANGED, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, flags | CmsDriverManager.READMODE_ONLY_FILES); publishList.addAll(filterResources(dbc, publishList, fileList), true); }
java
private void addSubResources(CmsDbContext dbc, CmsPublishList publishList, CmsResource directPublishResource) throws CmsDataAccessException { int flags = CmsDriverManager.READMODE_INCLUDE_TREE | CmsDriverManager.READMODE_EXCLUDE_STATE; if (!directPublishResource.getState().isDeleted()) { // fix for org.opencms.file.TestPublishIssues#testPublishFolderWithDeletedFileFromOtherProject flags = flags | CmsDriverManager.READMODE_INCLUDE_PROJECT; } // add all sub resources of the folder List<CmsResource> folderList = getVfsDriver(dbc).readResourceTree( dbc, dbc.currentProject().getUuid(), directPublishResource.getRootPath(), CmsDriverManager.READ_IGNORE_TYPE, CmsResource.STATE_UNCHANGED, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, flags | CmsDriverManager.READMODE_ONLY_FOLDERS); publishList.addAll(filterResources(dbc, publishList, folderList), true); List<CmsResource> fileList = getVfsDriver(dbc).readResourceTree( dbc, dbc.currentProject().getUuid(), directPublishResource.getRootPath(), CmsDriverManager.READ_IGNORE_TYPE, CmsResource.STATE_UNCHANGED, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, CmsDriverManager.READ_IGNORE_TIME, flags | CmsDriverManager.READMODE_ONLY_FILES); publishList.addAll(filterResources(dbc, publishList, fileList), true); }
[ "private", "void", "addSubResources", "(", "CmsDbContext", "dbc", ",", "CmsPublishList", "publishList", ",", "CmsResource", "directPublishResource", ")", "throws", "CmsDataAccessException", "{", "int", "flags", "=", "CmsDriverManager", ".", "READMODE_INCLUDE_TREE", "|", ...
Adds all sub-resources of the given resource to the publish list.<p> @param dbc the database context @param publishList the publish list @param directPublishResource the resource to get the sub-resources for @throws CmsDataAccessException if something goes wrong accessing the database
[ "Adds", "all", "sub", "-", "resources", "of", "the", "given", "resource", "to", "the", "publish", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10661-L10702
lucee/Lucee
core/src/main/java/lucee/runtime/writer/CFMLWriterImpl.java
CFMLWriterImpl.setBufferConfig
@Override public void setBufferConfig(int bufferSize, boolean autoFlush) throws IOException { this.bufferSize = bufferSize; this.autoFlush = autoFlush; _check(); }
java
@Override public void setBufferConfig(int bufferSize, boolean autoFlush) throws IOException { this.bufferSize = bufferSize; this.autoFlush = autoFlush; _check(); }
[ "@", "Override", "public", "void", "setBufferConfig", "(", "int", "bufferSize", ",", "boolean", "autoFlush", ")", "throws", "IOException", "{", "this", ".", "bufferSize", "=", "bufferSize", ";", "this", ".", "autoFlush", "=", "autoFlush", ";", "_check", "(", ...
reset configuration of buffer @param bufferSize size of the buffer @param autoFlush does the buffer autoflush @throws IOException
[ "reset", "configuration", "of", "buffer" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/writer/CFMLWriterImpl.java#L121-L126
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/AbstractGreenPepperMacro.java
AbstractGreenPepperMacro.getPageTitle
@SuppressWarnings("unchecked") protected String getPageTitle(@SuppressWarnings("rawtypes") Map parameters, RenderContext renderContext, String spaceKey) throws GreenPepperServerException { return getPage(parameters, renderContext, spaceKey).getTitle().trim(); }
java
@SuppressWarnings("unchecked") protected String getPageTitle(@SuppressWarnings("rawtypes") Map parameters, RenderContext renderContext, String spaceKey) throws GreenPepperServerException { return getPage(parameters, renderContext, spaceKey).getTitle().trim(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "String", "getPageTitle", "(", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Map", "parameters", ",", "RenderContext", "renderContext", ",", "String", "spaceKey", ")", "throws", "GreenPepperServerE...
<p>getPageTitle.</p> @param parameters a {@link java.util.Map} object. @param renderContext a {@link com.atlassian.renderer.RenderContext} object. @param spaceKey a {@link java.lang.String} object. @return a {@link java.lang.String} object. @throws com.greenpepper.server.GreenPepperServerException if any.
[ "<p", ">", "getPageTitle", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/AbstractGreenPepperMacro.java#L177-L181
structurizr/java
structurizr-core/src/com/structurizr/model/ContainerInstance.java
ContainerInstance.addHealthCheck
@Nonnull public HttpHealthCheck addHealthCheck(String name, String url) { return addHealthCheck(name, url, DEFAULT_HEALTH_CHECK_INTERVAL_IN_SECONDS, DEFAULT_HEALTH_CHECK_TIMEOUT_IN_MILLISECONDS); }
java
@Nonnull public HttpHealthCheck addHealthCheck(String name, String url) { return addHealthCheck(name, url, DEFAULT_HEALTH_CHECK_INTERVAL_IN_SECONDS, DEFAULT_HEALTH_CHECK_TIMEOUT_IN_MILLISECONDS); }
[ "@", "Nonnull", "public", "HttpHealthCheck", "addHealthCheck", "(", "String", "name", ",", "String", "url", ")", "{", "return", "addHealthCheck", "(", "name", ",", "url", ",", "DEFAULT_HEALTH_CHECK_INTERVAL_IN_SECONDS", ",", "DEFAULT_HEALTH_CHECK_TIMEOUT_IN_MILLISECONDS",...
Adds a new health check, with the default interval (60 seconds) and timeout (0 milliseconds). @param name the name of the health check @param url the URL of the health check @return a HttpHealthCheck instance representing the health check that has been added @throws IllegalArgumentException if the name is empty, or the URL is not a well-formed URL
[ "Adds", "a", "new", "health", "check", "with", "the", "default", "interval", "(", "60", "seconds", ")", "and", "timeout", "(", "0", "milliseconds", ")", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/ContainerInstance.java#L130-L133
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.writeXML
public static void writeXML(DocumentFragment fragment, OutputStream stream) throws IOException { assert fragment != null : AssertMessages.notNullParameter(0); assert stream != null : AssertMessages.notNullParameter(1); writeNode(fragment, stream); }
java
public static void writeXML(DocumentFragment fragment, OutputStream stream) throws IOException { assert fragment != null : AssertMessages.notNullParameter(0); assert stream != null : AssertMessages.notNullParameter(1); writeNode(fragment, stream); }
[ "public", "static", "void", "writeXML", "(", "DocumentFragment", "fragment", ",", "OutputStream", "stream", ")", "throws", "IOException", "{", "assert", "fragment", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "assert", "stre...
Write the given node tree into a XML file. @param fragment is the object that contains the node tree @param stream is the target stream @throws IOException if the stream cannot be read.
[ "Write", "the", "given", "node", "tree", "into", "a", "XML", "file", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2417-L2421
wcm-io/wcm-io-handler
url/src/main/java/io/wcm/handler/url/impl/modes/AbstractUrlMode.java
AbstractUrlMode.getUrlConfigForTarget
protected UrlConfig getUrlConfigForTarget(Adaptable adaptable, Resource targetResource) { UrlConfig config = null; if (targetResource != null) { config = new UrlConfig(targetResource); } if (config == null || !config.isValid()) { config = new UrlConfig(adaptable); } return config; }
java
protected UrlConfig getUrlConfigForTarget(Adaptable adaptable, Resource targetResource) { UrlConfig config = null; if (targetResource != null) { config = new UrlConfig(targetResource); } if (config == null || !config.isValid()) { config = new UrlConfig(adaptable); } return config; }
[ "protected", "UrlConfig", "getUrlConfigForTarget", "(", "Adaptable", "adaptable", ",", "Resource", "targetResource", ")", "{", "UrlConfig", "config", "=", "null", ";", "if", "(", "targetResource", "!=", "null", ")", "{", "config", "=", "new", "UrlConfig", "(", ...
Get URL configuration for target resource. If this is invalid or not available, get it from adaptable. @param adaptable Adaptable (request or resource) @param targetResource Target resource (may be null) @return Url config (never null)
[ "Get", "URL", "configuration", "for", "target", "resource", ".", "If", "this", "is", "invalid", "or", "not", "available", "get", "it", "from", "adaptable", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/impl/modes/AbstractUrlMode.java#L69-L78
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushRaw
public WnsNotificationResponse pushRaw(String channelUri, WnsNotificationRequestOptional optional, WnsRaw raw) throws WnsException { return this.client.push(rawResourceBuilder, channelUri, raw, this.retryPolicy, optional); }
java
public WnsNotificationResponse pushRaw(String channelUri, WnsNotificationRequestOptional optional, WnsRaw raw) throws WnsException { return this.client.push(rawResourceBuilder, channelUri, raw, this.retryPolicy, optional); }
[ "public", "WnsNotificationResponse", "pushRaw", "(", "String", "channelUri", ",", "WnsNotificationRequestOptional", "optional", ",", "WnsRaw", "raw", ")", "throws", "WnsException", "{", "return", "this", ".", "client", ".", "push", "(", "rawResourceBuilder", ",", "c...
Pushes a raw message to channelUri using optional headers @param channelUri @param optional @param raw which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsRawBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "raw", "message", "to", "channelUri", "using", "optional", "headers" ]
train
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L226-L228
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/reflect/RecursiveObjectWriter.java
RecursiveObjectWriter.copyProperties
public static void copyProperties(Object dest, Object src) { if (dest == null || src == null) return; Map<String, Object> values = RecursiveObjectReader.getProperties(src); setProperties(dest, values); }
java
public static void copyProperties(Object dest, Object src) { if (dest == null || src == null) return; Map<String, Object> values = RecursiveObjectReader.getProperties(src); setProperties(dest, values); }
[ "public", "static", "void", "copyProperties", "(", "Object", "dest", ",", "Object", "src", ")", "{", "if", "(", "dest", "==", "null", "||", "src", "==", "null", ")", "return", ";", "Map", "<", "String", ",", "Object", ">", "values", "=", "RecursiveObje...
Copies content of one object to another object by recursively reading all properties from source object and then recursively writing them to destination object. @param dest a destination object to write properties to. @param src a source object to read properties from
[ "Copies", "content", "of", "one", "object", "to", "another", "object", "by", "recursively", "reading", "all", "properties", "from", "source", "object", "and", "then", "recursively", "writing", "them", "to", "destination", "object", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/RecursiveObjectWriter.java#L95-L101
belaban/JGroups
src/org/jgroups/protocols/FRAG.java
FRAG.unfragment
private Message unfragment(Message msg, FragHeader hdr) { Address sender=msg.getSrc(); FragmentationTable frag_table=fragment_list.get(sender); if(frag_table == null) { frag_table=new FragmentationTable(sender); try { fragment_list.add(sender, frag_table); } catch(IllegalArgumentException x) { // the entry has already been added, probably in parallel from another thread frag_table=fragment_list.get(sender); } } num_received_frags++; byte[] buf=frag_table.add(hdr.id, hdr.frag_id, hdr.num_frags, msg.getBuffer()); if(buf == null) return null; try { DataInput in=new ByteArrayDataInputStream(buf); Message assembled_msg=new Message(false); assembled_msg.readFrom(in); assembled_msg.setSrc(sender); // needed ? YES, because fragments have a null src !! if(log.isTraceEnabled()) log.trace("assembled_msg is " + assembled_msg); num_received_msgs++; return assembled_msg; } catch(Exception e) { log.error(Util.getMessage("FailedUnfragmentingAMessage"), e); return null; } }
java
private Message unfragment(Message msg, FragHeader hdr) { Address sender=msg.getSrc(); FragmentationTable frag_table=fragment_list.get(sender); if(frag_table == null) { frag_table=new FragmentationTable(sender); try { fragment_list.add(sender, frag_table); } catch(IllegalArgumentException x) { // the entry has already been added, probably in parallel from another thread frag_table=fragment_list.get(sender); } } num_received_frags++; byte[] buf=frag_table.add(hdr.id, hdr.frag_id, hdr.num_frags, msg.getBuffer()); if(buf == null) return null; try { DataInput in=new ByteArrayDataInputStream(buf); Message assembled_msg=new Message(false); assembled_msg.readFrom(in); assembled_msg.setSrc(sender); // needed ? YES, because fragments have a null src !! if(log.isTraceEnabled()) log.trace("assembled_msg is " + assembled_msg); num_received_msgs++; return assembled_msg; } catch(Exception e) { log.error(Util.getMessage("FailedUnfragmentingAMessage"), e); return null; } }
[ "private", "Message", "unfragment", "(", "Message", "msg", ",", "FragHeader", "hdr", ")", "{", "Address", "sender", "=", "msg", ".", "getSrc", "(", ")", ";", "FragmentationTable", "frag_table", "=", "fragment_list", ".", "get", "(", "sender", ")", ";", "if...
1. Get all the fragment buffers 2. When all are received -> Assemble them into one big buffer 3. Read headers and byte buffer from big buffer 4. Set headers and buffer in msg 5. Pass msg up the stack
[ "1", ".", "Get", "all", "the", "fragment", "buffers", "2", ".", "When", "all", "are", "received", "-", ">", "Assemble", "them", "into", "one", "big", "buffer", "3", ".", "Read", "headers", "and", "byte", "buffer", "from", "big", "buffer", "4", ".", "...
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/FRAG.java#L234-L264
knightliao/disconf
disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/inner/ConnectionWatcher.java
ConnectionWatcher.connect
public void connect(String hosts) throws IOException, InterruptedException { internalHost = hosts; zk = new ZooKeeper(internalHost, SESSION_TIMEOUT, this); // 连接有超时哦 connectedSignal.await(CONNECT_TIMEOUT, TimeUnit.MILLISECONDS); LOGGER.info("zookeeper: " + hosts + " , connected."); }
java
public void connect(String hosts) throws IOException, InterruptedException { internalHost = hosts; zk = new ZooKeeper(internalHost, SESSION_TIMEOUT, this); // 连接有超时哦 connectedSignal.await(CONNECT_TIMEOUT, TimeUnit.MILLISECONDS); LOGGER.info("zookeeper: " + hosts + " , connected."); }
[ "public", "void", "connect", "(", "String", "hosts", ")", "throws", "IOException", ",", "InterruptedException", "{", "internalHost", "=", "hosts", ";", "zk", "=", "new", "ZooKeeper", "(", "internalHost", ",", "SESSION_TIMEOUT", ",", "this", ")", ";", "// 连接有超时...
@param hosts @return void @throws IOException @throws InterruptedException @Description: 连接ZK @author liaoqiqi @date 2013-6-14
[ "@param", "hosts" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/inner/ConnectionWatcher.java#L56-L64
JakeWharton/ActionBarSherlock
actionbarsherlock/src/com/actionbarsherlock/internal/widget/IcsAbsSpinner.java
IcsAbsSpinner.pointToPosition
public int pointToPosition(int x, int y) { Rect frame = mTouchFrame; if (frame == null) { mTouchFrame = new Rect(); frame = mTouchFrame; } final int count = getChildCount(); for (int i = count - 1; i >= 0; i--) { View child = getChildAt(i); if (child.getVisibility() == View.VISIBLE) { child.getHitRect(frame); if (frame.contains(x, y)) { return mFirstPosition + i; } } } return INVALID_POSITION; }
java
public int pointToPosition(int x, int y) { Rect frame = mTouchFrame; if (frame == null) { mTouchFrame = new Rect(); frame = mTouchFrame; } final int count = getChildCount(); for (int i = count - 1; i >= 0; i--) { View child = getChildAt(i); if (child.getVisibility() == View.VISIBLE) { child.getHitRect(frame); if (frame.contains(x, y)) { return mFirstPosition + i; } } } return INVALID_POSITION; }
[ "public", "int", "pointToPosition", "(", "int", "x", ",", "int", "y", ")", "{", "Rect", "frame", "=", "mTouchFrame", ";", "if", "(", "frame", "==", "null", ")", "{", "mTouchFrame", "=", "new", "Rect", "(", ")", ";", "frame", "=", "mTouchFrame", ";", ...
Maps a point to a position in the list. @param x X in local coordinate @param y Y in local coordinate @return The position of the item which contains the specified point, or {@link #INVALID_POSITION} if the point does not intersect an item.
[ "Maps", "a", "point", "to", "a", "position", "in", "the", "list", "." ]
train
https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/internal/widget/IcsAbsSpinner.java#L352-L370
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java
IndexUpdater.updateAllIndexes
public static void updateAllIndexes(List<Index> indexes, Database database, SQLDatabaseQueue queue) throws QueryException { IndexUpdater updater = new IndexUpdater(database, queue); updater.updateAllIndexes(indexes); }
java
public static void updateAllIndexes(List<Index> indexes, Database database, SQLDatabaseQueue queue) throws QueryException { IndexUpdater updater = new IndexUpdater(database, queue); updater.updateAllIndexes(indexes); }
[ "public", "static", "void", "updateAllIndexes", "(", "List", "<", "Index", ">", "indexes", ",", "Database", "database", ",", "SQLDatabaseQueue", "queue", ")", "throws", "QueryException", "{", "IndexUpdater", "updater", "=", "new", "IndexUpdater", "(", "database", ...
Update all indexes in a set. These indexes are assumed to already exist. @param indexes Map of indexes and their definitions. @param database The local {@link Database} @param queue The executor service queue @return index update success status (true/false)
[ "Update", "all", "indexes", "in", "a", "set", "." ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java#L67-L73
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnMetaCodeGen.java
ConnMetaCodeGen.writeEIS
private void writeEIS(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns product name of the underlying EIS instance connected\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Product name of the EIS instance\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get the information\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public String getEISProductName() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return null; //TODO"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns product version of the underlying EIS instance.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Product version of the EIS instance\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get the information\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public String getEISProductVersion() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return null; //TODO"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeEIS(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns product name of the underlying EIS instance connected\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Product name of the EIS instance\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get the information\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public String getEISProductName() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return null; //TODO"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Returns product version of the underlying EIS instance.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Product version of the EIS instance\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get the information\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public String getEISProductVersion() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return null; //TODO"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeEIS", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ...
Output eis info method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "eis", "info", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnMetaCodeGen.java#L94-L123
Javen205/IJPay
src/main/java/com/jpay/util/HttpKitExt.java
HttpKitExt.uploadMedia
protected static String uploadMedia(String url, File file, String params) throws IOException { URL urlGet = new URL(url); HttpURLConnection conn = (HttpURLConnection) urlGet.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); conn.setUseCaches(false); conn.setRequestMethod("POST"); conn.setRequestProperty("connection", "Keep-Alive"); conn.setRequestProperty("user-agent", DEFAULT_USER_AGENT); conn.setRequestProperty("Charsert", "UTF-8"); // 定义数据分隔线 String BOUNDARY = "----WebKitFormBoundaryiDGnV9zdZA1eM1yL"; conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY); OutputStream out = new DataOutputStream(conn.getOutputStream()); // 定义最后数据分隔线 StringBuilder mediaData = new StringBuilder(); mediaData.append("--").append(BOUNDARY).append("\r\n"); mediaData.append("Content-Disposition: form-data;name=\"media\";filename=\"" + file.getName() + "\"\r\n"); mediaData.append("Content-Type:application/octet-stream\r\n\r\n"); byte[] mediaDatas = mediaData.toString().getBytes(); out.write(mediaDatas); DataInputStream fs = new DataInputStream(new FileInputStream(file)); int bytes = 0; byte[] bufferOut = new byte[1024]; while ((bytes = fs.read(bufferOut)) != -1) { out.write(bufferOut, 0, bytes); } IOUtils.closeQuietly(fs); // 多个文件时,二个文件之间加入这个 out.write("\r\n".getBytes()); if (StrKit.notBlank(params)) { StringBuilder paramData = new StringBuilder(); paramData.append("--").append(BOUNDARY).append("\r\n"); paramData.append("Content-Disposition: form-data;name=\"description\";"); byte[] paramDatas = paramData.toString().getBytes(); out.write(paramDatas); out.write(params.getBytes(Charsets.UTF_8)); } byte[] end_data = ("\r\n--" + BOUNDARY + "--\r\n").getBytes(); out.write(end_data); out.flush(); IOUtils.closeQuietly(out); // 定义BufferedReader输入流来读取URL的响应 InputStream in = conn.getInputStream(); BufferedReader read = new BufferedReader(new InputStreamReader(in, Charsets.UTF_8)); String valueString = null; StringBuffer bufferRes = null; bufferRes = new StringBuffer(); while ((valueString = read.readLine()) != null) { bufferRes.append(valueString); } IOUtils.closeQuietly(in); // 关闭连接 if (conn != null) { conn.disconnect(); } return bufferRes.toString(); }
java
protected static String uploadMedia(String url, File file, String params) throws IOException { URL urlGet = new URL(url); HttpURLConnection conn = (HttpURLConnection) urlGet.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); conn.setUseCaches(false); conn.setRequestMethod("POST"); conn.setRequestProperty("connection", "Keep-Alive"); conn.setRequestProperty("user-agent", DEFAULT_USER_AGENT); conn.setRequestProperty("Charsert", "UTF-8"); // 定义数据分隔线 String BOUNDARY = "----WebKitFormBoundaryiDGnV9zdZA1eM1yL"; conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY); OutputStream out = new DataOutputStream(conn.getOutputStream()); // 定义最后数据分隔线 StringBuilder mediaData = new StringBuilder(); mediaData.append("--").append(BOUNDARY).append("\r\n"); mediaData.append("Content-Disposition: form-data;name=\"media\";filename=\"" + file.getName() + "\"\r\n"); mediaData.append("Content-Type:application/octet-stream\r\n\r\n"); byte[] mediaDatas = mediaData.toString().getBytes(); out.write(mediaDatas); DataInputStream fs = new DataInputStream(new FileInputStream(file)); int bytes = 0; byte[] bufferOut = new byte[1024]; while ((bytes = fs.read(bufferOut)) != -1) { out.write(bufferOut, 0, bytes); } IOUtils.closeQuietly(fs); // 多个文件时,二个文件之间加入这个 out.write("\r\n".getBytes()); if (StrKit.notBlank(params)) { StringBuilder paramData = new StringBuilder(); paramData.append("--").append(BOUNDARY).append("\r\n"); paramData.append("Content-Disposition: form-data;name=\"description\";"); byte[] paramDatas = paramData.toString().getBytes(); out.write(paramDatas); out.write(params.getBytes(Charsets.UTF_8)); } byte[] end_data = ("\r\n--" + BOUNDARY + "--\r\n").getBytes(); out.write(end_data); out.flush(); IOUtils.closeQuietly(out); // 定义BufferedReader输入流来读取URL的响应 InputStream in = conn.getInputStream(); BufferedReader read = new BufferedReader(new InputStreamReader(in, Charsets.UTF_8)); String valueString = null; StringBuffer bufferRes = null; bufferRes = new StringBuffer(); while ((valueString = read.readLine()) != null) { bufferRes.append(valueString); } IOUtils.closeQuietly(in); // 关闭连接 if (conn != null) { conn.disconnect(); } return bufferRes.toString(); }
[ "protected", "static", "String", "uploadMedia", "(", "String", "url", ",", "File", "file", ",", "String", "params", ")", "throws", "IOException", "{", "URL", "urlGet", "=", "new", "URL", "(", "url", ")", ";", "HttpURLConnection", "conn", "=", "(", "HttpURL...
上传临时素材,本段代码来自老版本(____′↘夏悸 / wechat),致敬! @param url 图片上传地址 @param file 需要上传的文件 @return ApiResult @throws IOException
[ "上传临时素材,本段代码来自老版本(____′↘夏悸", "/", "wechat),致敬!" ]
train
https://github.com/Javen205/IJPay/blob/78da6be4b70675abc6a41df74817532fa257ef29/src/main/java/com/jpay/util/HttpKitExt.java#L43-L102
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java
FileUtils.loadFileList
public static ImmutableList<File> loadFileList(final File fileList) throws IOException { return loadFileList(Files.asCharSource(fileList, Charsets.UTF_8)); }
java
public static ImmutableList<File> loadFileList(final File fileList) throws IOException { return loadFileList(Files.asCharSource(fileList, Charsets.UTF_8)); }
[ "public", "static", "ImmutableList", "<", "File", ">", "loadFileList", "(", "final", "File", "fileList", ")", "throws", "IOException", "{", "return", "loadFileList", "(", "Files", ".", "asCharSource", "(", "fileList", ",", "Charsets", ".", "UTF_8", ")", ")", ...
Takes a file with filenames listed one per line and returns a list of the corresponding File objects. Ignores blank lines and lines beginning with "#". Treats the file as UTF-8 encoded.
[ "Takes", "a", "file", "with", "filenames", "listed", "one", "per", "line", "and", "returns", "a", "list", "of", "the", "corresponding", "File", "objects", ".", "Ignores", "blank", "lines", "and", "lines", "beginning", "with", "#", ".", "Treats", "the", "fi...
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L102-L104
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/category/IssueCategoryRegistry.java
IssueCategoryRegistry.loadFromGraph
@SuppressWarnings("unchecked") public static IssueCategoryModel loadFromGraph(FramedGraph framedGraph, String issueCategoryID) { Iterable<Vertex> vertices = (Iterable<Vertex>)framedGraph.traverse(g -> framedGraph.getTypeResolver().hasType(g.V(), IssueCategoryModel.class)) .traverse(g -> g.has(IssueCategoryModel.CATEGORY_ID, issueCategoryID)).getRawTraversal().toList(); IssueCategoryModel result = null; for (Vertex vertex : vertices) { if (result != null) throw new DuplicateIssueCategoryException("Found more than one issue category for this id: " + issueCategoryID); result = framedGraph.frameElement(vertex, IssueCategoryModel.class); } return result; }
java
@SuppressWarnings("unchecked") public static IssueCategoryModel loadFromGraph(FramedGraph framedGraph, String issueCategoryID) { Iterable<Vertex> vertices = (Iterable<Vertex>)framedGraph.traverse(g -> framedGraph.getTypeResolver().hasType(g.V(), IssueCategoryModel.class)) .traverse(g -> g.has(IssueCategoryModel.CATEGORY_ID, issueCategoryID)).getRawTraversal().toList(); IssueCategoryModel result = null; for (Vertex vertex : vertices) { if (result != null) throw new DuplicateIssueCategoryException("Found more than one issue category for this id: " + issueCategoryID); result = framedGraph.frameElement(vertex, IssueCategoryModel.class); } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "IssueCategoryModel", "loadFromGraph", "(", "FramedGraph", "framedGraph", ",", "String", "issueCategoryID", ")", "{", "Iterable", "<", "Vertex", ">", "vertices", "=", "(", "Iterable", "<", "Ve...
Loads the related graph vertex for the given {@link IssueCategory#getCategoryID()}.
[ "Loads", "the", "related", "graph", "vertex", "for", "the", "given", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/category/IssueCategoryRegistry.java#L89-L104
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java
StereoTool.getNormal
public static Vector3d getNormal(Point3d ptA, Point3d ptB, Point3d ptC) { Vector3d vectorAB = new Vector3d(); Vector3d vectorAC = new Vector3d(); Vector3d normal = new Vector3d(); StereoTool.getRawNormal(ptA, ptB, ptC, normal, vectorAB, vectorAC); normal.normalize(); return normal; }
java
public static Vector3d getNormal(Point3d ptA, Point3d ptB, Point3d ptC) { Vector3d vectorAB = new Vector3d(); Vector3d vectorAC = new Vector3d(); Vector3d normal = new Vector3d(); StereoTool.getRawNormal(ptA, ptB, ptC, normal, vectorAB, vectorAC); normal.normalize(); return normal; }
[ "public", "static", "Vector3d", "getNormal", "(", "Point3d", "ptA", ",", "Point3d", "ptB", ",", "Point3d", "ptC", ")", "{", "Vector3d", "vectorAB", "=", "new", "Vector3d", "(", ")", ";", "Vector3d", "vectorAC", "=", "new", "Vector3d", "(", ")", ";", "Vec...
<p>Given three points (A, B, C), makes the vectors A-B and A-C, and makes the cross product of these two vectors; this has the effect of making a third vector at right angles to AB and AC.</p> <p>NOTE : the returned normal is normalized; that is, it has been divided by its length.</p> @param ptA the 'middle' point @param ptB one of the end points @param ptC one of the end points @return the vector at right angles to AB and AC
[ "<p", ">", "Given", "three", "points", "(", "A", "B", "C", ")", "makes", "the", "vectors", "A", "-", "B", "and", "A", "-", "C", "and", "makes", "the", "cross", "product", "of", "these", "two", "vectors", ";", "this", "has", "the", "effect", "of", ...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java#L388-L395
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getDeletedStorageAccountAsync
public ServiceFuture<DeletedStorageBundle> getDeletedStorageAccountAsync(String vaultBaseUrl, String storageAccountName, final ServiceCallback<DeletedStorageBundle> serviceCallback) { return ServiceFuture.fromResponse(getDeletedStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName), serviceCallback); }
java
public ServiceFuture<DeletedStorageBundle> getDeletedStorageAccountAsync(String vaultBaseUrl, String storageAccountName, final ServiceCallback<DeletedStorageBundle> serviceCallback) { return ServiceFuture.fromResponse(getDeletedStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName), serviceCallback); }
[ "public", "ServiceFuture", "<", "DeletedStorageBundle", ">", "getDeletedStorageAccountAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "final", "ServiceCallback", "<", "DeletedStorageBundle", ">", "serviceCallback", ")", "{", "return", "Ser...
Gets the specified deleted storage account. The Get Deleted Storage Account operation returns the specified deleted storage account along with its attributes. This operation requires the storage/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Gets", "the", "specified", "deleted", "storage", "account", ".", "The", "Get", "Deleted", "Storage", "Account", "operation", "returns", "the", "specified", "deleted", "storage", "account", "along", "with", "its", "attributes", ".", "This", "operation", "requires"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9271-L9273
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/AbstractRectangularShape2ifx.java
AbstractRectangularShape2ifx.maxYProperty
@Pure public IntegerProperty maxYProperty() { if (this.maxY == null) { this.maxY = new SimpleIntegerProperty(this, MathFXAttributeNames.MAXIMUM_Y) { @Override protected void invalidated() { final int currentMax = get(); final int currentMin = getMinY(); if (currentMax < currentMin) { // min-max constrain is broken minYProperty().set(currentMax); } } }; } return this.maxY; }
java
@Pure public IntegerProperty maxYProperty() { if (this.maxY == null) { this.maxY = new SimpleIntegerProperty(this, MathFXAttributeNames.MAXIMUM_Y) { @Override protected void invalidated() { final int currentMax = get(); final int currentMin = getMinY(); if (currentMax < currentMin) { // min-max constrain is broken minYProperty().set(currentMax); } } }; } return this.maxY; }
[ "@", "Pure", "public", "IntegerProperty", "maxYProperty", "(", ")", "{", "if", "(", "this", ".", "maxY", "==", "null", ")", "{", "this", ".", "maxY", "=", "new", "SimpleIntegerProperty", "(", "this", ",", "MathFXAttributeNames", ".", "MAXIMUM_Y", ")", "{",...
Replies the property that is the maximum y coordinate of the box. @return the maxY property.
[ "Replies", "the", "property", "that", "is", "the", "maximum", "y", "coordinate", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/AbstractRectangularShape2ifx.java#L240-L256
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java
H2StreamProcessor.isValidH2Request
private boolean isValidH2Request(HashMap<String, String> pseudoHeaders) { if (MethodValues.CONNECT.getName().equals(pseudoHeaders.get(HpackConstants.METHOD))) { if (pseudoHeaders.get(HpackConstants.PATH) == null && pseudoHeaders.get(HpackConstants.SCHEME) == null && pseudoHeaders.get(HpackConstants.AUTHORITY) != null) { this.isConnectStream = true; return true; } return false; } if (pseudoHeaders.get(HpackConstants.METHOD) != null && pseudoHeaders.get(HpackConstants.PATH) != null && pseudoHeaders.get(HpackConstants.SCHEME) != null) { return true; } return false; }
java
private boolean isValidH2Request(HashMap<String, String> pseudoHeaders) { if (MethodValues.CONNECT.getName().equals(pseudoHeaders.get(HpackConstants.METHOD))) { if (pseudoHeaders.get(HpackConstants.PATH) == null && pseudoHeaders.get(HpackConstants.SCHEME) == null && pseudoHeaders.get(HpackConstants.AUTHORITY) != null) { this.isConnectStream = true; return true; } return false; } if (pseudoHeaders.get(HpackConstants.METHOD) != null && pseudoHeaders.get(HpackConstants.PATH) != null && pseudoHeaders.get(HpackConstants.SCHEME) != null) { return true; } return false; }
[ "private", "boolean", "isValidH2Request", "(", "HashMap", "<", "String", ",", "String", ">", "pseudoHeaders", ")", "{", "if", "(", "MethodValues", ".", "CONNECT", ".", "getName", "(", ")", ".", "equals", "(", "pseudoHeaders", ".", "get", "(", "HpackConstants...
Check to see if the passed headers contain values for :method, :scheme, and :path If the CONNECT method header was found, :path and :scheme are not allowed, and :authority is required @param HashMap<String, String> headers @return true if :method, :scheme, and :path are found
[ "Check", "to", "see", "if", "the", "passed", "headers", "contain", "values", "for", ":", "method", ":", "scheme", "and", ":", "path", "If", "the", "CONNECT", "method", "header", "was", "found", ":", "path", "and", ":", "scheme", "are", "not", "allowed", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2StreamProcessor.java#L1504-L1518
spotify/scio
scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java
PatchedBigQueryTableRowIterator.fromQuery
static PatchedBigQueryTableRowIterator fromQuery( JobConfigurationQuery queryConfig, String projectId, Bigquery client) { checkNotNull(queryConfig, "queryConfig"); checkNotNull(projectId, "projectId"); checkNotNull(client, "client"); return new PatchedBigQueryTableRowIterator(/* ref */null, queryConfig, projectId, client); }
java
static PatchedBigQueryTableRowIterator fromQuery( JobConfigurationQuery queryConfig, String projectId, Bigquery client) { checkNotNull(queryConfig, "queryConfig"); checkNotNull(projectId, "projectId"); checkNotNull(client, "client"); return new PatchedBigQueryTableRowIterator(/* ref */null, queryConfig, projectId, client); }
[ "static", "PatchedBigQueryTableRowIterator", "fromQuery", "(", "JobConfigurationQuery", "queryConfig", ",", "String", "projectId", ",", "Bigquery", "client", ")", "{", "checkNotNull", "(", "queryConfig", ",", "\"queryConfig\"", ")", ";", "checkNotNull", "(", "projectId"...
Constructs a {@code PatchedBigQueryTableRowIterator} that reads from the results of executing the specified query in the specified project.
[ "Constructs", "a", "{" ]
train
https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-bigquery/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryTableRowIterator.java#L126-L132
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/util/ClassUtils.java
ClassUtils.addResourcePathToPackagePath
public static String addResourcePathToPackagePath(Class<?> clazz, String resourceName) { Assert.notNull(resourceName, "Resource name must not be null"); if (!resourceName.startsWith("/")) { return classPackageAsResourcePath(clazz) + "/" + resourceName; } return classPackageAsResourcePath(clazz) + resourceName; }
java
public static String addResourcePathToPackagePath(Class<?> clazz, String resourceName) { Assert.notNull(resourceName, "Resource name must not be null"); if (!resourceName.startsWith("/")) { return classPackageAsResourcePath(clazz) + "/" + resourceName; } return classPackageAsResourcePath(clazz) + resourceName; }
[ "public", "static", "String", "addResourcePathToPackagePath", "(", "Class", "<", "?", ">", "clazz", ",", "String", "resourceName", ")", "{", "Assert", ".", "notNull", "(", "resourceName", ",", "\"Resource name must not be null\"", ")", ";", "if", "(", "!", "reso...
Return a path suitable for use with {@code ClassLoader.getResource} (also suitable for use with {@code Class.getResource} by prepending a slash ('/') to the return value). Built by taking the package of the specified class file, converting all dots ('.') to slashes ('/'), adding a trailing slash if necessary, and concatenating the specified resource name to this. <br/>As such, this function may be used to build a path suitable for loading a resource file that is in the same package as a class file, although {@link org.springframework.core.io.ClassPathResource} is usually even more convenient. @param clazz the Class whose package will be used as the base @param resourceName the resource name to append. A leading slash is optional. @return the built-up resource path @see ClassLoader#getResource @see Class#getResource
[ "Return", "a", "path", "suitable", "for", "use", "with", "{" ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ClassUtils.java#L972-L978
jOOQ/jOOX
jOOX-java-6/src/main/java/org/joox/selector/CSS2XPath.java
CSS2XPath.endsWith
private static void endsWith(StringBuilder sb, String attr, String value) { sb.append("'"); sb.append(value.replace("'", "\\'")); sb.append("' = substring(@"); sb.append(attr); sb.append(", string-length(@"); sb.append(attr); sb.append(") - string-length('"); sb.append(value.replace("'", "\\'")); sb.append("') + 1)"); }
java
private static void endsWith(StringBuilder sb, String attr, String value) { sb.append("'"); sb.append(value.replace("'", "\\'")); sb.append("' = substring(@"); sb.append(attr); sb.append(", string-length(@"); sb.append(attr); sb.append(") - string-length('"); sb.append(value.replace("'", "\\'")); sb.append("') + 1)"); }
[ "private", "static", "void", "endsWith", "(", "StringBuilder", "sb", ",", "String", "attr", ",", "String", "value", ")", "{", "sb", ".", "append", "(", "\"'\"", ")", ";", "sb", ".", "append", "(", "value", ".", "replace", "(", "\"'\"", ",", "\"\\\\'\""...
XPath 2.0<br/><br/><code>ends-with($str1, $str2)</code><br/><br/> is equivalent to XPath 1.0<br/><br/> <code>$str2 = substring($str1, string-length($str1) - string-length($str2) + 1)</code>
[ "XPath", "2", ".", "0<br", "/", ">", "<br", "/", ">", "<code", ">", "ends", "-", "with", "(", "$str1", "$str2", ")", "<", "/", "code", ">", "<br", "/", ">", "<br", "/", ">", "is", "equivalent", "to", "XPath", "1", ".", "0<br", "/", ">", "<br"...
train
https://github.com/jOOQ/jOOX/blob/3793b96f0cee126f64074da4d7fad63f91d2440e/jOOX-java-6/src/main/java/org/joox/selector/CSS2XPath.java#L219-L229
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/Trash.java
Trash.createTrashLocation
protected Path createTrashLocation(FileSystem fs, Properties props, String user) throws IOException { Path trashLocation; if (props.containsKey(TRASH_LOCATION_KEY)) { trashLocation = new Path(props.getProperty(TRASH_LOCATION_KEY).replaceAll("\\$USER", user)); } else { trashLocation = new Path(fs.getHomeDirectory(), DEFAULT_TRASH_DIRECTORY); LOG.info("Using default trash location at " + trashLocation); } if (!trashLocation.isAbsolute()) { throw new IllegalArgumentException("Trash location must be absolute. Found " + trashLocation.toString()); } Path qualifiedTrashLocation = fs.makeQualified(trashLocation); ensureTrashLocationExists(fs, qualifiedTrashLocation); return qualifiedTrashLocation; }
java
protected Path createTrashLocation(FileSystem fs, Properties props, String user) throws IOException { Path trashLocation; if (props.containsKey(TRASH_LOCATION_KEY)) { trashLocation = new Path(props.getProperty(TRASH_LOCATION_KEY).replaceAll("\\$USER", user)); } else { trashLocation = new Path(fs.getHomeDirectory(), DEFAULT_TRASH_DIRECTORY); LOG.info("Using default trash location at " + trashLocation); } if (!trashLocation.isAbsolute()) { throw new IllegalArgumentException("Trash location must be absolute. Found " + trashLocation.toString()); } Path qualifiedTrashLocation = fs.makeQualified(trashLocation); ensureTrashLocationExists(fs, qualifiedTrashLocation); return qualifiedTrashLocation; }
[ "protected", "Path", "createTrashLocation", "(", "FileSystem", "fs", ",", "Properties", "props", ",", "String", "user", ")", "throws", "IOException", "{", "Path", "trashLocation", ";", "if", "(", "props", ".", "containsKey", "(", "TRASH_LOCATION_KEY", ")", ")", ...
Create location of Trash directory. Parsed from props at key {@link #TRASH_LOCATION_KEY}, defaulting to /home/directory/_GOBBLIN_TRASH. @param fs {@link org.apache.hadoop.fs.FileSystem} where trash should be found. @param props {@link java.util.Properties} containing trash configuration. @param user If the trash location contains the token $USER, the token will be replaced by the value of user. @return {@link org.apache.hadoop.fs.Path} for trash directory. @throws java.io.IOException
[ "Create", "location", "of", "Trash", "directory", ".", "Parsed", "from", "props", "at", "key", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/Trash.java#L95-L109
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/jetty/Server.java
Server.addWebApplications
public WebApplicationContext[] addWebApplications(String webapps) throws IOException { return addWebApplications(null,webapps,null,false); }
java
public WebApplicationContext[] addWebApplications(String webapps) throws IOException { return addWebApplications(null,webapps,null,false); }
[ "public", "WebApplicationContext", "[", "]", "addWebApplications", "(", "String", "webapps", ")", "throws", "IOException", "{", "return", "addWebApplications", "(", "null", ",", "webapps", ",", "null", ",", "false", ")", ";", "}" ]
Add Web Applications. Add auto webapplications to the server. The name of the webapp directory or war is used as the context name. If a webapp is called "root" it is added at "/". @param webapps Directory file name or URL to look for auto webapplication. @exception IOException
[ "Add", "Web", "Applications", ".", "Add", "auto", "webapplications", "to", "the", "server", ".", "The", "name", "of", "the", "webapp", "directory", "or", "war", "is", "used", "as", "the", "context", "name", ".", "If", "a", "webapp", "is", "called", "root...
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/jetty/Server.java#L275-L279
QSFT/Doradus
doradus-server/src/examples/java/com/dell/doradus/service/olap/mono/OLAPMonoService.java
OLAPMonoService.addBatch
public BatchResult addBatch(ApplicationDefinition appDef, OlapBatch batch, Map<String, String> options) { return OLAPService.instance().addBatch(appDef, MONO_SHARD_NAME, batch, options); }
java
public BatchResult addBatch(ApplicationDefinition appDef, OlapBatch batch, Map<String, String> options) { return OLAPService.instance().addBatch(appDef, MONO_SHARD_NAME, batch, options); }
[ "public", "BatchResult", "addBatch", "(", "ApplicationDefinition", "appDef", ",", "OlapBatch", "batch", ",", "Map", "<", "String", ",", "String", ">", "options", ")", "{", "return", "OLAPService", ".", "instance", "(", ")", ".", "addBatch", "(", "appDef", ",...
Add the given batch of object updates for the given application. The updates may be new, updated, or deleted objects. The updates are applied to the application's mono shard. @param appDef Application to which update batch is applied. @param batch {@link OlapBatch} of object adds, updates, and/or deletes. @param options Optional batcgh options such as overwrite=false. @return {@link BatchResult} reflecting status of update.
[ "Add", "the", "given", "batch", "of", "object", "updates", "for", "the", "given", "application", ".", "The", "updates", "may", "be", "new", "updated", "or", "deleted", "objects", ".", "The", "updates", "are", "applied", "to", "the", "application", "s", "mo...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/examples/java/com/dell/doradus/service/olap/mono/OLAPMonoService.java#L175-L177
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/utils/PluginRepositoryUtil.java
PluginRepositoryUtil.loadFromXmlPluginPackageDefinitions
public static void loadFromXmlPluginPackageDefinitions(final IPluginRepository repo, final ClassLoader cl, final InputStream in) throws PluginConfigurationException { for (PluginDefinition pd : loadFromXmlPluginPackageDefinitions(cl, in)) { repo.addPluginDefinition(pd); } }
java
public static void loadFromXmlPluginPackageDefinitions(final IPluginRepository repo, final ClassLoader cl, final InputStream in) throws PluginConfigurationException { for (PluginDefinition pd : loadFromXmlPluginPackageDefinitions(cl, in)) { repo.addPluginDefinition(pd); } }
[ "public", "static", "void", "loadFromXmlPluginPackageDefinitions", "(", "final", "IPluginRepository", "repo", ",", "final", "ClassLoader", "cl", ",", "final", "InputStream", "in", ")", "throws", "PluginConfigurationException", "{", "for", "(", "PluginDefinition", "pd", ...
Loads a full repository definition from an XML file. @param repo The repository that must be loaded @param cl The classloader to be used to instantiate the plugin classes @param in The stream to the XML file @throws PluginConfigurationException -
[ "Loads", "a", "full", "repository", "definition", "from", "an", "XML", "file", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/utils/PluginRepositoryUtil.java#L69-L74
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.indexOfDifference
public static int indexOfDifference(final String a, final String b) { if (N.equals(a, b) || (N.isNullOrEmpty(a) && N.isNullOrEmpty(b))) { return N.INDEX_NOT_FOUND; } if (N.isNullOrEmpty(a) || N.isNullOrEmpty(b)) { return 0; } int i = 0; for (int len = N.min(a.length(), b.length()); i < len; i++) { if (a.charAt(i) != b.charAt(i)) { break; } } if (i < b.length() || i < a.length()) { return i; } return N.INDEX_NOT_FOUND; }
java
public static int indexOfDifference(final String a, final String b) { if (N.equals(a, b) || (N.isNullOrEmpty(a) && N.isNullOrEmpty(b))) { return N.INDEX_NOT_FOUND; } if (N.isNullOrEmpty(a) || N.isNullOrEmpty(b)) { return 0; } int i = 0; for (int len = N.min(a.length(), b.length()); i < len; i++) { if (a.charAt(i) != b.charAt(i)) { break; } } if (i < b.length() || i < a.length()) { return i; } return N.INDEX_NOT_FOUND; }
[ "public", "static", "int", "indexOfDifference", "(", "final", "String", "a", ",", "final", "String", "b", ")", "{", "if", "(", "N", ".", "equals", "(", "a", ",", "b", ")", "||", "(", "N", ".", "isNullOrEmpty", "(", "a", ")", "&&", "N", ".", "isNu...
<p> Compares two Strings, and returns the index at which the Stringss begin to differ. </p> <p> For example, {@code indexOfDifference("i am a machine", "i am a robot") -> 7} </p> <pre> N.indexOfDifference(null, null) = -1 N.indexOfDifference("", "") = -1 N.indexOfDifference("", "abc") = 0 N.indexOfDifference("abc", "") = 0 N.indexOfDifference("abc", "abc") = -1 N.indexOfDifference("ab", "abxyz") = 2 N.indexOfDifference("abcde", "abxyz") = 2 N.indexOfDifference("abcde", "xyz") = 0 </pre> @param a the first String, may be null @param b the second String, may be null @return the index where cs1 and cs2 begin to differ; -1 if they are equal
[ "<p", ">", "Compares", "two", "Strings", "and", "returns", "the", "index", "at", "which", "the", "Stringss", "begin", "to", "differ", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L4065-L4086
infinispan/infinispan
core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java
CacheNotifierImpl.addListenerAsync
@Override public <C> CompletionStage<Void> addListenerAsync(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { return addListenerInternal(listener, DataConversion.IDENTITY_KEY, DataConversion.IDENTITY_VALUE, filter, converter, classLoader, false); }
java
@Override public <C> CompletionStage<Void> addListenerAsync(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { return addListenerInternal(listener, DataConversion.IDENTITY_KEY, DataConversion.IDENTITY_VALUE, filter, converter, classLoader, false); }
[ "@", "Override", "public", "<", "C", ">", "CompletionStage", "<", "Void", ">", "addListenerAsync", "(", "Object", "listener", ",", "CacheEventFilter", "<", "?", "super", "K", ",", "?", "super", "V", ">", "filter", ",", "CacheEventConverter", "<", "?", "sup...
Adds the listener using the provided filter converter and class loader. The provided builder is used to add additional configuration including (clustered, onlyPrimary & identifier) which can be used after this method is completed to see what values were used in the addition of this listener @param listener @param filter @param converter @param classLoader @param <C> @return
[ "Adds", "the", "listener", "using", "the", "provided", "filter", "converter", "and", "class", "loader", ".", "The", "provided", "builder", "is", "used", "to", "add", "additional", "configuration", "including", "(", "clustered", "onlyPrimary", "&", "identifier", ...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java#L1183-L1187
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/Bootstrap.java
Bootstrap.runAsApplication
public static void runAsApplication(Game game, int width, int height, boolean fullscreen) { try { AppGameContainer container = new AppGameContainer(game, width, height, fullscreen); container.start(); } catch (Exception e) { e.printStackTrace(); } }
java
public static void runAsApplication(Game game, int width, int height, boolean fullscreen) { try { AppGameContainer container = new AppGameContainer(game, width, height, fullscreen); container.start(); } catch (Exception e) { e.printStackTrace(); } }
[ "public", "static", "void", "runAsApplication", "(", "Game", "game", ",", "int", "width", ",", "int", "height", ",", "boolean", "fullscreen", ")", "{", "try", "{", "AppGameContainer", "container", "=", "new", "AppGameContainer", "(", "game", ",", "width", ",...
Start the game as an application @param game The game to be started @param width The width of the window @param height The height of the window @param fullscreen True if the window should be fullscreen
[ "Start", "the", "game", "as", "an", "application" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/Bootstrap.java#L21-L28
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleAssetCategoryRelPersistenceImpl.java
CPRuleAssetCategoryRelPersistenceImpl.findByAssetCategoryId
@Override public List<CPRuleAssetCategoryRel> findByAssetCategoryId( long assetCategoryId, int start, int end) { return findByAssetCategoryId(assetCategoryId, start, end, null); }
java
@Override public List<CPRuleAssetCategoryRel> findByAssetCategoryId( long assetCategoryId, int start, int end) { return findByAssetCategoryId(assetCategoryId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPRuleAssetCategoryRel", ">", "findByAssetCategoryId", "(", "long", "assetCategoryId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByAssetCategoryId", "(", "assetCategoryId", ",", "start", ",", "end", ...
Returns a range of all the cp rule asset category rels where assetCategoryId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPRuleAssetCategoryRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param assetCategoryId the asset category ID @param start the lower bound of the range of cp rule asset category rels @param end the upper bound of the range of cp rule asset category rels (not inclusive) @return the range of matching cp rule asset category rels
[ "Returns", "a", "range", "of", "all", "the", "cp", "rule", "asset", "category", "rels", "where", "assetCategoryId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleAssetCategoryRelPersistenceImpl.java#L655-L659
legsem/legstar.avro
legstar.avro.translator/src/main/java/com/legstar/avro/translator/Xsd2AvroTranslatorMain.java
Xsd2AvroTranslatorMain.processLine
private boolean processLine(final CommandLine line, final Options options) throws Exception { if (line.hasOption(OPTION_VERSION)) { log.info(getVersion(true)); return false; } if (line.hasOption(OPTION_HELP)) { produceHelp(options); return false; } if (line.hasOption(OPTION_INPUT)) { setXsdInput(line.getOptionValue(OPTION_INPUT).trim()); } if (line.hasOption(OPTION_OUTPUT)) { setOutput(line.getOptionValue(OPTION_OUTPUT).trim()); } if (line.hasOption(OPTION_AVRO_NAMESPACE_PREFIX)) { setAvroNamespacePrefix(line.getOptionValue(OPTION_AVRO_NAMESPACE_PREFIX).trim()); } return true; }
java
private boolean processLine(final CommandLine line, final Options options) throws Exception { if (line.hasOption(OPTION_VERSION)) { log.info(getVersion(true)); return false; } if (line.hasOption(OPTION_HELP)) { produceHelp(options); return false; } if (line.hasOption(OPTION_INPUT)) { setXsdInput(line.getOptionValue(OPTION_INPUT).trim()); } if (line.hasOption(OPTION_OUTPUT)) { setOutput(line.getOptionValue(OPTION_OUTPUT).trim()); } if (line.hasOption(OPTION_AVRO_NAMESPACE_PREFIX)) { setAvroNamespacePrefix(line.getOptionValue(OPTION_AVRO_NAMESPACE_PREFIX).trim()); } return true; }
[ "private", "boolean", "processLine", "(", "final", "CommandLine", "line", ",", "final", "Options", "options", ")", "throws", "Exception", "{", "if", "(", "line", ".", "hasOption", "(", "OPTION_VERSION", ")", ")", "{", "log", ".", "info", "(", "getVersion", ...
Process the command line options selected. @param line the parsed command line @param options available @return false if processing needs to stop, true if its ok to continue @throws Exception if line cannot be processed
[ "Process", "the", "command", "line", "options", "selected", "." ]
train
https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.translator/src/main/java/com/legstar/avro/translator/Xsd2AvroTranslatorMain.java#L171-L192
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java
ObjectOutputStream.removeUnsharedReference
private void removeUnsharedReference(Object obj, int previousHandle) { if (previousHandle != -1) { objectsWritten.put(obj, previousHandle); } else { objectsWritten.remove(obj); } }
java
private void removeUnsharedReference(Object obj, int previousHandle) { if (previousHandle != -1) { objectsWritten.put(obj, previousHandle); } else { objectsWritten.remove(obj); } }
[ "private", "void", "removeUnsharedReference", "(", "Object", "obj", ",", "int", "previousHandle", ")", "{", "if", "(", "previousHandle", "!=", "-", "1", ")", "{", "objectsWritten", ".", "put", "(", "obj", ",", "previousHandle", ")", ";", "}", "else", "{", ...
Remove the unshared object from the table, and restore any previous handle. @param obj Non-null object being dumped. @param previousHandle The handle of the previous identical object dumped
[ "Remove", "the", "unshared", "object", "from", "the", "table", "and", "restore", "any", "previous", "handle", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/ObjectOutputStream.java#L506-L512
jetty-project/jetty-npn
npn-boot/src/main/java/sun/security/ssl/Handshaker.java
Handshaker.calculateKeys
void calculateKeys(SecretKey preMasterSecret, ProtocolVersion version) { SecretKey master = calculateMasterSecret(preMasterSecret, version); session.setMasterSecret(master); calculateConnectionKeys(master); }
java
void calculateKeys(SecretKey preMasterSecret, ProtocolVersion version) { SecretKey master = calculateMasterSecret(preMasterSecret, version); session.setMasterSecret(master); calculateConnectionKeys(master); }
[ "void", "calculateKeys", "(", "SecretKey", "preMasterSecret", ",", "ProtocolVersion", "version", ")", "{", "SecretKey", "master", "=", "calculateMasterSecret", "(", "preMasterSecret", ",", "version", ")", ";", "session", ".", "setMasterSecret", "(", "master", ")", ...
/* Single access point to key calculation logic. Given the pre-master secret and the nonces from client and server, produce all the keying material to be used.
[ "/", "*", "Single", "access", "point", "to", "key", "calculation", "logic", ".", "Given", "the", "pre", "-", "master", "secret", "and", "the", "nonces", "from", "client", "and", "server", "produce", "all", "the", "keying", "material", "to", "be", "used", ...
train
https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L1055-L1059
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.checkStringConstant
private void checkStringConstant(DiagnosticPosition pos, Object constValue) { if (nerrs != 0 || // only complain about a long string once constValue == null || !(constValue instanceof String) || ((String)constValue).length() < Pool.MAX_STRING_LENGTH) return; log.error(pos, "limit.string"); nerrs++; }
java
private void checkStringConstant(DiagnosticPosition pos, Object constValue) { if (nerrs != 0 || // only complain about a long string once constValue == null || !(constValue instanceof String) || ((String)constValue).length() < Pool.MAX_STRING_LENGTH) return; log.error(pos, "limit.string"); nerrs++; }
[ "private", "void", "checkStringConstant", "(", "DiagnosticPosition", "pos", ",", "Object", "constValue", ")", "{", "if", "(", "nerrs", "!=", "0", "||", "// only complain about a long string once", "constValue", "==", "null", "||", "!", "(", "constValue", "instanceof...
Check a constant value and report if it is a string that is too large.
[ "Check", "a", "constant", "value", "and", "report", "if", "it", "is", "a", "string", "that", "is", "too", "large", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L513-L521
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/DashboardResources.java
DashboardResources.deleteDashboard
@DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/{dashboardId}") @Description("Deletes the dashboard having the given ID.") public Response deleteDashboard(@Context HttpServletRequest req, @PathParam("dashboardId") BigInteger dashboardId) { if (dashboardId == null || dashboardId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Dashboard Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } Dashboard dashboard = dService.findDashboardByPrimaryKey(dashboardId); if (dashboard != null) { validateResourceAuthorization(req, dashboard.getOwner(), getRemoteUser(req)); for(Chart c:_chartService.getChartsByOwnerForEntity(getRemoteUser(req),dashboard.getId())) { _chartService.deleteChart(c); } dService.deleteDashboard(dashboard); return Response.status(Status.OK).build(); } throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); }
java
@DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/{dashboardId}") @Description("Deletes the dashboard having the given ID.") public Response deleteDashboard(@Context HttpServletRequest req, @PathParam("dashboardId") BigInteger dashboardId) { if (dashboardId == null || dashboardId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Dashboard Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } Dashboard dashboard = dService.findDashboardByPrimaryKey(dashboardId); if (dashboard != null) { validateResourceAuthorization(req, dashboard.getOwner(), getRemoteUser(req)); for(Chart c:_chartService.getChartsByOwnerForEntity(getRemoteUser(req),dashboard.getId())) { _chartService.deleteChart(c); } dService.deleteDashboard(dashboard); return Response.status(Status.OK).build(); } throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); }
[ "@", "DELETE", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Path", "(", "\"/{dashboardId}\"", ")", "@", "Description", "(", "\"Deletes the dashboard having the given ID.\"", ")", "public", "Response", "deleteDashboard", "(", "@", "Context", ...
Deletes the dashboard having the given ID. @param req The HTTP request. @param dashboardId The dashboard ID to delete. @return An empty body if the delete was successful. @throws WebApplicationException If an error occurs.
[ "Deletes", "the", "dashboard", "having", "the", "given", "ID", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/DashboardResources.java#L348-L370
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/schema/columns/DataColumnsDao.java
DataColumnsDao.queryByConstraintName
public List<DataColumns> queryByConstraintName(String constraintName) throws SQLException { return queryForEq(DataColumns.COLUMN_CONSTRAINT_NAME, constraintName); }
java
public List<DataColumns> queryByConstraintName(String constraintName) throws SQLException { return queryForEq(DataColumns.COLUMN_CONSTRAINT_NAME, constraintName); }
[ "public", "List", "<", "DataColumns", ">", "queryByConstraintName", "(", "String", "constraintName", ")", "throws", "SQLException", "{", "return", "queryForEq", "(", "DataColumns", ".", "COLUMN_CONSTRAINT_NAME", ",", "constraintName", ")", ";", "}" ]
Query by the constraint name @param constraintName constraint name @return data columns @throws SQLException upon failure
[ "Query", "by", "the", "constraint", "name" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/schema/columns/DataColumnsDao.java#L188-L191
zaproxy/zaproxy
src/org/zaproxy/zap/view/panels/AbstractContextSelectToolbarStatusPanel.java
AbstractContextSelectToolbarStatusPanel.setupToolbarElements
protected void setupToolbarElements(JToolBar toolbar) { int x = 0; Insets insets = new Insets(0, 4, 0, 2); x = this.addToolBarElements(toolbar, TOOLBAR_LOCATION_START, x); toolbar.add(new JLabel(Constant.messages.getString(panelPrefix + ".toolbar.context.label")), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); toolbar.add(getContextSelectComboBox(), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); x = this.addToolBarElements(toolbar, TOOLBAR_LOCATION_AFTER_CONTEXTS_SELECT, x); toolbar.add(new JLabel(), LayoutHelper.getGBC(x++, 0, 1, 1.0)); // Spacer if (hasOptions()) { toolbar.add(getOptionsButton(), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); } this.addToolBarElements(toolbar, TOOLBAR_LOCATION_END, x); }
java
protected void setupToolbarElements(JToolBar toolbar) { int x = 0; Insets insets = new Insets(0, 4, 0, 2); x = this.addToolBarElements(toolbar, TOOLBAR_LOCATION_START, x); toolbar.add(new JLabel(Constant.messages.getString(panelPrefix + ".toolbar.context.label")), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); toolbar.add(getContextSelectComboBox(), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); x = this.addToolBarElements(toolbar, TOOLBAR_LOCATION_AFTER_CONTEXTS_SELECT, x); toolbar.add(new JLabel(), LayoutHelper.getGBC(x++, 0, 1, 1.0)); // Spacer if (hasOptions()) { toolbar.add(getOptionsButton(), LayoutHelper.getGBC(x++, 0, 1, 0, insets)); } this.addToolBarElements(toolbar, TOOLBAR_LOCATION_END, x); }
[ "protected", "void", "setupToolbarElements", "(", "JToolBar", "toolbar", ")", "{", "int", "x", "=", "0", ";", "Insets", "insets", "=", "new", "Insets", "(", "0", ",", "4", ",", "0", ",", "2", ")", ";", "x", "=", "this", ".", "addToolBarElements", "("...
Method used to setup the toolbar elements. Should not usually be overriden. Instead, use the {@link #addToolBarElements(JToolBar, short, int)} method to add elements at various points. @param toolbar the tool bar of the status panel
[ "Method", "used", "to", "setup", "the", "toolbar", "elements", ".", "Should", "not", "usually", "be", "overriden", ".", "Instead", "use", "the", "{" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/panels/AbstractContextSelectToolbarStatusPanel.java#L120-L138
sd4324530/fastweixin
src/main/java/com/github/sd4324530/fastweixin/api/BaseAPI.java
BaseAPI.executePost
protected BaseResponse executePost(String url, String json, File file) { BaseResponse response; BeanUtil.requireNonNull(url, "url is null"); List<File> files = null; if (null != file) { files = CollectionUtil.newArrayList(file); } //需要传token String postUrl = url.replace("#", config.getAccessToken()); response = NetWorkCenter.post(postUrl, json, files); return response; }
java
protected BaseResponse executePost(String url, String json, File file) { BaseResponse response; BeanUtil.requireNonNull(url, "url is null"); List<File> files = null; if (null != file) { files = CollectionUtil.newArrayList(file); } //需要传token String postUrl = url.replace("#", config.getAccessToken()); response = NetWorkCenter.post(postUrl, json, files); return response; }
[ "protected", "BaseResponse", "executePost", "(", "String", "url", ",", "String", "json", ",", "File", "file", ")", "{", "BaseResponse", "response", ";", "BeanUtil", ".", "requireNonNull", "(", "url", ",", "\"url is null\"", ")", ";", "List", "<", "File", ">"...
通用post请求 @param url 地址,其中token用#代替 @param json 参数,json格式 @param file 上传的文件 @return 请求结果
[ "通用post请求" ]
train
https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/BaseAPI.java#L55-L66
openengsb/openengsb
api/edb/src/main/java/org/openengsb/core/edb/api/EDBObject.java
EDBObject.appendEntry
private void appendEntry(Map.Entry<String, EDBObjectEntry> entry, StringBuilder builder) { if (builder.length() > 2) { builder.append(","); } builder.append(" \"").append(entry.getKey()).append("\""); builder.append(" : ").append(entry.getValue()); }
java
private void appendEntry(Map.Entry<String, EDBObjectEntry> entry, StringBuilder builder) { if (builder.length() > 2) { builder.append(","); } builder.append(" \"").append(entry.getKey()).append("\""); builder.append(" : ").append(entry.getValue()); }
[ "private", "void", "appendEntry", "(", "Map", ".", "Entry", "<", "String", ",", "EDBObjectEntry", ">", "entry", ",", "StringBuilder", "builder", ")", "{", "if", "(", "builder", ".", "length", "(", ")", ">", "2", ")", "{", "builder", ".", "append", "(",...
Analyzes the entry and write the specific information into the StringBuilder.
[ "Analyzes", "the", "entry", "and", "write", "the", "specific", "information", "into", "the", "StringBuilder", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/edb/src/main/java/org/openengsb/core/edb/api/EDBObject.java#L210-L216
mgormley/prim
src/main/java/edu/jhu/prim/util/math/FastMath.java
FastMath.logSubtract
public static double logSubtract(double x, double y) { if (FastMath.useLogAddTable) { return SmoothedLogAddTable.logSubtract(x,y); } else { return FastMath.logSubtractExact(x,y); } }
java
public static double logSubtract(double x, double y) { if (FastMath.useLogAddTable) { return SmoothedLogAddTable.logSubtract(x,y); } else { return FastMath.logSubtractExact(x,y); } }
[ "public", "static", "double", "logSubtract", "(", "double", "x", ",", "double", "y", ")", "{", "if", "(", "FastMath", ".", "useLogAddTable", ")", "{", "return", "SmoothedLogAddTable", ".", "logSubtract", "(", "x", ",", "y", ")", ";", "}", "else", "{", ...
Subtracts two probabilities that are stored as log probabilities. Note that x >= y. @param x log(p) @param y log(q) @return log(p - q) = log(exp(x) - exp(y)) @throws IllegalStateException if x < y
[ "Subtracts", "two", "probabilities", "that", "are", "stored", "as", "log", "probabilities", ".", "Note", "that", "x", ">", "=", "y", "." ]
train
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/util/math/FastMath.java#L44-L50
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java
CheckpointListener.availableCheckpoints
public static List<Checkpoint> availableCheckpoints(File directory){ File checkpointRecordFile = new File(directory, "checkpointInfo.txt"); Preconditions.checkState(checkpointRecordFile.exists(), "Could not find checkpoint record file at expected path %s", checkpointRecordFile.getAbsolutePath()); List<String> lines; try(InputStream is = new BufferedInputStream(new FileInputStream(checkpointRecordFile))){ lines = IOUtils.readLines(is); } catch (IOException e){ throw new RuntimeException("Error loading checkpoint data from file: " + checkpointRecordFile.getAbsolutePath(), e); } List<Checkpoint> out = new ArrayList<>(lines.size()-1); //Assume first line is header for( int i=1; i<lines.size(); i++ ){ Checkpoint c = Checkpoint.fromFileString(lines.get(i)); if(new File(directory, c.getFilename()).exists()){ out.add(c); } } return out; }
java
public static List<Checkpoint> availableCheckpoints(File directory){ File checkpointRecordFile = new File(directory, "checkpointInfo.txt"); Preconditions.checkState(checkpointRecordFile.exists(), "Could not find checkpoint record file at expected path %s", checkpointRecordFile.getAbsolutePath()); List<String> lines; try(InputStream is = new BufferedInputStream(new FileInputStream(checkpointRecordFile))){ lines = IOUtils.readLines(is); } catch (IOException e){ throw new RuntimeException("Error loading checkpoint data from file: " + checkpointRecordFile.getAbsolutePath(), e); } List<Checkpoint> out = new ArrayList<>(lines.size()-1); //Assume first line is header for( int i=1; i<lines.size(); i++ ){ Checkpoint c = Checkpoint.fromFileString(lines.get(i)); if(new File(directory, c.getFilename()).exists()){ out.add(c); } } return out; }
[ "public", "static", "List", "<", "Checkpoint", ">", "availableCheckpoints", "(", "File", "directory", ")", "{", "File", "checkpointRecordFile", "=", "new", "File", "(", "directory", ",", "\"checkpointInfo.txt\"", ")", ";", "Preconditions", ".", "checkState", "(", ...
List all available checkpoints. A checkpoint is 'available' if the file can be loaded. Any checkpoint files that have been automatically deleted (given the configuration) will not be returned here. Note that the checkpointInfo.txt file must exist, as this stores checkpoint information @return List of checkpoint files that can be loaded from the specified directory
[ "List", "all", "available", "checkpoints", ".", "A", "checkpoint", "is", "available", "if", "the", "file", "can", "be", "loaded", ".", "Any", "checkpoint", "files", "that", "have", "been", "automatically", "deleted", "(", "given", "the", "configuration", ")", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java#L348-L367
jhunters/jprotobuf
android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java
StringUtils.removeEnd
public static String removeEnd(String str, String remove) { if (isEmpty(str) || isEmpty(remove)) { return str; } if (str.endsWith(remove)) { return str.substring(0, str.length() - remove.length()); } return str; }
java
public static String removeEnd(String str, String remove) { if (isEmpty(str) || isEmpty(remove)) { return str; } if (str.endsWith(remove)) { return str.substring(0, str.length() - remove.length()); } return str; }
[ "public", "static", "String", "removeEnd", "(", "String", "str", ",", "String", "remove", ")", "{", "if", "(", "isEmpty", "(", "str", ")", "||", "isEmpty", "(", "remove", ")", ")", "{", "return", "str", ";", "}", "if", "(", "str", ".", "endsWith", ...
<p> Removes a substring only if it is at the end of a source string, otherwise returns the source string. </p> <p> A <code>null</code> source string will return <code>null</code>. An empty ("") source string will return the empty string. A <code>null</code> search string will return the source string. </p> <pre> StringUtils.removeEnd(null, *) = null StringUtils.removeEnd("", *) = "" StringUtils.removeEnd(*, null) = * StringUtils.removeEnd("www.domain.com", ".com.") = "www.domain.com" StringUtils.removeEnd("www.domain.com", ".com") = "www.domain" StringUtils.removeEnd("www.domain.com", "domain") = "www.domain.com" StringUtils.removeEnd("abc", "") = "abc" </pre> @param str the source String to search, may be null @param remove the String to search for and remove, may be null @return the substring with the string removed if found, <code>null</code> if null String input @since 2.1
[ "<p", ">", "Removes", "a", "substring", "only", "if", "it", "is", "at", "the", "end", "of", "a", "source", "string", "otherwise", "returns", "the", "source", "string", ".", "<", "/", "p", ">" ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java#L158-L166
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/config/StormConfigGenerator.java
StormConfigGenerator.readYaml
@SuppressWarnings("unchecked") public static Map<String, Object> readYaml(File targetFile) throws IOException { Map<String, Object> configObject = null; Yaml yaml = new Yaml(); InputStream inputStream = null; InputStreamReader steamReader = null; try { inputStream = new FileInputStream(targetFile); steamReader = new InputStreamReader(inputStream, "UTF-8"); configObject = (Map<String, Object>) yaml.load(steamReader); } catch (ScannerException ex) { // ScannerException/IOException are occured. // throw IOException because handling is same. throw new IOException(ex); } finally { IOUtils.closeQuietly(inputStream); } return configObject; }
java
@SuppressWarnings("unchecked") public static Map<String, Object> readYaml(File targetFile) throws IOException { Map<String, Object> configObject = null; Yaml yaml = new Yaml(); InputStream inputStream = null; InputStreamReader steamReader = null; try { inputStream = new FileInputStream(targetFile); steamReader = new InputStreamReader(inputStream, "UTF-8"); configObject = (Map<String, Object>) yaml.load(steamReader); } catch (ScannerException ex) { // ScannerException/IOException are occured. // throw IOException because handling is same. throw new IOException(ex); } finally { IOUtils.closeQuietly(inputStream); } return configObject; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Map", "<", "String", ",", "Object", ">", "readYaml", "(", "File", "targetFile", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "Object", ">", "configObject", "=", "null",...
Read yaml config object from the yaml file at specified file. @param targetFile target file @return config read from yaml @throws IOException Fail read yaml file or convert to config object.
[ "Read", "yaml", "config", "object", "from", "the", "yaml", "file", "at", "specified", "file", "." ]
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/config/StormConfigGenerator.java#L129-L156
alkacon/opencms-core
src/org/opencms/pdftools/CmsPdfResourceHandler.java
CmsPdfResourceHandler.handlePdfLink
protected void handlePdfLink(CmsObject cms, HttpServletRequest request, HttpServletResponse response, String uri) throws Exception { CmsPdfLink linkObj = new CmsPdfLink(cms, uri); CmsResource formatter = linkObj.getFormatter(); CmsResource content = linkObj.getContent(); LOG.info("Trying to render " + content.getRootPath() + " using " + formatter.getRootPath()); Locale locale = linkObj.getLocale(); CmsObject cmsForJspExecution = OpenCms.initCmsObject(cms); cmsForJspExecution.getRequestContext().setLocale(locale); cmsForJspExecution.getRequestContext().setSiteRoot(""); byte[] result = null; String cacheParams = formatter.getStructureId() + ";" + formatter.getDateLastModified() + ";" + locale + ";" + request.getQueryString(); String cacheName = m_pdfCache.getCacheName(content, cacheParams); if (cms.getRequestContext().getCurrentProject().isOnlineProject()) { result = m_pdfCache.getCacheContent(cacheName); } if (result == null) { cmsForJspExecution.getRequestContext().setUri(content.getRootPath()); byte[] xhtmlData = CmsPdfFormatterUtils.executeJsp( cmsForJspExecution, request, response, formatter, content); LOG.info("Rendered XHTML from " + content.getRootPath() + " using " + formatter.getRootPath()); if (LOG.isDebugEnabled()) { logXhtmlOutput(formatter, content, xhtmlData); } // Use the same CmsObject we used for executing the JSP, because the same site root is needed to resolve external resources like images result = m_pdfConverter.convertXhtmlToPdf(cmsForJspExecution, xhtmlData, "opencms://" + uri); LOG.info("Converted XHTML to PDF, size=" + result.length); m_pdfCache.saveCacheFile(cacheName, result); } else { LOG.info( "Retrieved PDF data from cache for content " + content.getRootPath() + " and formatter " + formatter.getRootPath()); } response.setContentType("application/pdf"); response.getOutputStream().write(result); CmsResourceInitException initEx = new CmsResourceInitException(CmsPdfResourceHandler.class); initEx.setClearErrors(true); throw initEx; }
java
protected void handlePdfLink(CmsObject cms, HttpServletRequest request, HttpServletResponse response, String uri) throws Exception { CmsPdfLink linkObj = new CmsPdfLink(cms, uri); CmsResource formatter = linkObj.getFormatter(); CmsResource content = linkObj.getContent(); LOG.info("Trying to render " + content.getRootPath() + " using " + formatter.getRootPath()); Locale locale = linkObj.getLocale(); CmsObject cmsForJspExecution = OpenCms.initCmsObject(cms); cmsForJspExecution.getRequestContext().setLocale(locale); cmsForJspExecution.getRequestContext().setSiteRoot(""); byte[] result = null; String cacheParams = formatter.getStructureId() + ";" + formatter.getDateLastModified() + ";" + locale + ";" + request.getQueryString(); String cacheName = m_pdfCache.getCacheName(content, cacheParams); if (cms.getRequestContext().getCurrentProject().isOnlineProject()) { result = m_pdfCache.getCacheContent(cacheName); } if (result == null) { cmsForJspExecution.getRequestContext().setUri(content.getRootPath()); byte[] xhtmlData = CmsPdfFormatterUtils.executeJsp( cmsForJspExecution, request, response, formatter, content); LOG.info("Rendered XHTML from " + content.getRootPath() + " using " + formatter.getRootPath()); if (LOG.isDebugEnabled()) { logXhtmlOutput(formatter, content, xhtmlData); } // Use the same CmsObject we used for executing the JSP, because the same site root is needed to resolve external resources like images result = m_pdfConverter.convertXhtmlToPdf(cmsForJspExecution, xhtmlData, "opencms://" + uri); LOG.info("Converted XHTML to PDF, size=" + result.length); m_pdfCache.saveCacheFile(cacheName, result); } else { LOG.info( "Retrieved PDF data from cache for content " + content.getRootPath() + " and formatter " + formatter.getRootPath()); } response.setContentType("application/pdf"); response.getOutputStream().write(result); CmsResourceInitException initEx = new CmsResourceInitException(CmsPdfResourceHandler.class); initEx.setClearErrors(true); throw initEx; }
[ "protected", "void", "handlePdfLink", "(", "CmsObject", "cms", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "String", "uri", ")", "throws", "Exception", "{", "CmsPdfLink", "linkObj", "=", "new", "CmsPdfLink", "(", "cms", ",", ...
Handles a link for generating a PDF.<p> @param cms the current CMS context @param request the servlet request @param response the servlet response @param uri the current uri @throws Exception if something goes wrong @throws CmsResourceInitException if the resource initialization is cancelled
[ "Handles", "a", "link", "for", "generating", "a", "PDF", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/pdftools/CmsPdfResourceHandler.java#L160-L212
googleapis/google-cloud-java
google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java
ClusterManagerClient.deleteCluster
public final Operation deleteCluster(String projectId, String zone, String clusterId) { DeleteClusterRequest request = DeleteClusterRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setClusterId(clusterId) .build(); return deleteCluster(request); }
java
public final Operation deleteCluster(String projectId, String zone, String clusterId) { DeleteClusterRequest request = DeleteClusterRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setClusterId(clusterId) .build(); return deleteCluster(request); }
[ "public", "final", "Operation", "deleteCluster", "(", "String", "projectId", ",", "String", "zone", ",", "String", "clusterId", ")", "{", "DeleteClusterRequest", "request", "=", "DeleteClusterRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projec...
Deletes the cluster, including the Kubernetes endpoint and all worker nodes. <p>Firewalls and routes that were configured during cluster creation are also deleted. <p>Other Google Compute Engine resources that might be in use by the cluster (e.g. load balancer resources) will not be deleted if they weren't present at the initial create time. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; String clusterId = ""; Operation response = clusterManagerClient.deleteCluster(projectId, zone, clusterId); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field. @param clusterId Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Deletes", "the", "cluster", "including", "the", "Kubernetes", "endpoint", "and", "all", "worker", "nodes", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L1300-L1309
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNamedNodeMap.java
DTMNamedNodeMap.removeNamedItemNS
public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR); }
java
public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { throw new DTMException(DTMException.NO_MODIFICATION_ALLOWED_ERR); }
[ "public", "Node", "removeNamedItemNS", "(", "String", "namespaceURI", ",", "String", "localName", ")", "throws", "DOMException", "{", "throw", "new", "DTMException", "(", "DTMException", ".", "NO_MODIFICATION_ALLOWED_ERR", ")", ";", "}" ]
Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of the <code>Node</code> interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable. <br>HTML-only DOM implementations do not need to implement this method. @param namespaceURI The namespace URI of the node to remove. @param localName The local name of the node to remove. @return The node removed from this map if a node with such a local name and namespace URI exists. @exception DOMException NOT_FOUND_ERR: Raised if there is no node with the specified <code>namespaceURI</code> and <code>localName</code> in this map. <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly. @since DOM Level 2
[ "Removes", "a", "node", "specified", "by", "local", "name", "and", "namespace", "URI", ".", "A", "removed", "attribute", "may", "be", "known", "to", "have", "a", "default", "value", "when", "this", "map", "contains", "the", "attributes", "attached", "to", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNamedNodeMap.java#L265-L269
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageCreator.java
ImageCreator.loadImages
private void loadImages(TextView textView, List<BannerComponentNode> bannerComponentNodes) { if (!hasImages()) { return; } updateShieldUrlIndices(bannerComponentNodes); createTargets(textView); loadTargets(); }
java
private void loadImages(TextView textView, List<BannerComponentNode> bannerComponentNodes) { if (!hasImages()) { return; } updateShieldUrlIndices(bannerComponentNodes); createTargets(textView); loadTargets(); }
[ "private", "void", "loadImages", "(", "TextView", "textView", ",", "List", "<", "BannerComponentNode", ">", "bannerComponentNodes", ")", "{", "if", "(", "!", "hasImages", "(", ")", ")", "{", "return", ";", "}", "updateShieldUrlIndices", "(", "bannerComponentNode...
Takes the given components from the {@link BannerText} and creates a new {@link Spannable} with text / {@link ImageSpan}s which is loaded into the given {@link TextView}. @param textView target for the banner text @since 0.9.0
[ "Takes", "the", "given", "components", "from", "the", "{", "@link", "BannerText", "}", "and", "creates", "a", "new", "{", "@link", "Spannable", "}", "with", "text", "/", "{", "@link", "ImageSpan", "}", "s", "which", "is", "loaded", "into", "the", "given"...
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ImageCreator.java#L115-L123
spring-projects/spring-mobile
spring-mobile-device/src/main/java/org/springframework/mobile/device/util/ResolverUtils.java
ResolverUtils.isMobile
public static boolean isMobile(Device device, SitePreference sitePreference) { return sitePreference == SitePreference.MOBILE || device != null && device.isMobile() && sitePreference == null; }
java
public static boolean isMobile(Device device, SitePreference sitePreference) { return sitePreference == SitePreference.MOBILE || device != null && device.isMobile() && sitePreference == null; }
[ "public", "static", "boolean", "isMobile", "(", "Device", "device", ",", "SitePreference", "sitePreference", ")", "{", "return", "sitePreference", "==", "SitePreference", ".", "MOBILE", "||", "device", "!=", "null", "&&", "device", ".", "isMobile", "(", ")", "...
Should the combination of {@link Device} and {@link SitePreference} be handled as a mobile device @param device the resolved device @param sitePreference the specified site preference @return true if mobile
[ "Should", "the", "combination", "of", "{" ]
train
https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/util/ResolverUtils.java#L48-L50
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/json/JSON.java
JSON.parseObject
public static <T> T parseObject(String text, Class<T> clazz) { Object obj = JSONSerializer.deserialize(text); return BeanSerializer.deserializeByType(obj, clazz); }
java
public static <T> T parseObject(String text, Class<T> clazz) { Object obj = JSONSerializer.deserialize(text); return BeanSerializer.deserializeByType(obj, clazz); }
[ "public", "static", "<", "T", ">", "T", "parseObject", "(", "String", "text", ",", "Class", "<", "T", ">", "clazz", ")", "{", "Object", "obj", "=", "JSONSerializer", ".", "deserialize", "(", "text", ")", ";", "return", "BeanSerializer", ".", "deserialize...
解析为指定对象 @param text json字符串 @param clazz 指定类 @param <T> 指定对象 @return 指定对象
[ "解析为指定对象" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/json/JSON.java#L62-L65
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.callMethod
public static Object callMethod(Object obj, Collection.Key methodName, Object[] args, Object defaultValue) { if (obj == null) { return defaultValue; } // checkAccesibility(obj,methodName); MethodInstance mi = getMethodInstanceEL(obj, obj.getClass(), methodName, args); if (mi == null) return defaultValue; try { return mi.invoke(obj); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); return defaultValue; } }
java
public static Object callMethod(Object obj, Collection.Key methodName, Object[] args, Object defaultValue) { if (obj == null) { return defaultValue; } // checkAccesibility(obj,methodName); MethodInstance mi = getMethodInstanceEL(obj, obj.getClass(), methodName, args); if (mi == null) return defaultValue; try { return mi.invoke(obj); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); return defaultValue; } }
[ "public", "static", "Object", "callMethod", "(", "Object", "obj", ",", "Collection", ".", "Key", "methodName", ",", "Object", "[", "]", "args", ",", "Object", "defaultValue", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "defaultValue", "...
/* private static void checkAccesibilityx(Object obj, Key methodName) { if(methodName.equals(SET_ACCESSIBLE) && obj instanceof Member) { if(true) return; Member member=(Member) obj; Class<?> cls = member.getDeclaringClass(); if(cls.getPackage().getName().startsWith("lucee.")) { throw new PageRuntimeException(new SecurityException("Changing the accesibility of an object's members in the Lucee.* package is not allowed" )); } } }
[ "/", "*", "private", "static", "void", "checkAccesibilityx", "(", "Object", "obj", "Key", "methodName", ")", "{", "if", "(", "methodName", ".", "equals", "(", "SET_ACCESSIBLE", ")", "&&", "obj", "instanceof", "Member", ")", "{", "if", "(", "true", ")", "...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L889-L904
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java
UserGroupManager.renameUserGroup
@Nonnull public EChange renameUserGroup (@Nullable final String sUserGroupID, @Nonnull @Nonempty final String sNewName) { // Resolve user group final UserGroup aUserGroup = getOfID (sUserGroupID); if (aUserGroup == null) { AuditHelper.onAuditModifyFailure (UserGroup.OT, sUserGroupID, "no-such-usergroup-id", "name"); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (aUserGroup.setName (sNewName).isUnchanged ()) return EChange.UNCHANGED; BusinessObjectHelper.setLastModificationNow (aUserGroup); internalUpdateItem (aUserGroup); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditModifySuccess (UserGroup.OT, "name", sUserGroupID, sNewName); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserGroupRenamed (aUserGroup)); return EChange.CHANGED; }
java
@Nonnull public EChange renameUserGroup (@Nullable final String sUserGroupID, @Nonnull @Nonempty final String sNewName) { // Resolve user group final UserGroup aUserGroup = getOfID (sUserGroupID); if (aUserGroup == null) { AuditHelper.onAuditModifyFailure (UserGroup.OT, sUserGroupID, "no-such-usergroup-id", "name"); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (aUserGroup.setName (sNewName).isUnchanged ()) return EChange.UNCHANGED; BusinessObjectHelper.setLastModificationNow (aUserGroup); internalUpdateItem (aUserGroup); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditModifySuccess (UserGroup.OT, "name", sUserGroupID, sNewName); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onUserGroupRenamed (aUserGroup)); return EChange.CHANGED; }
[ "@", "Nonnull", "public", "EChange", "renameUserGroup", "(", "@", "Nullable", "final", "String", "sUserGroupID", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sNewName", ")", "{", "// Resolve user group", "final", "UserGroup", "aUserGroup", "=", "getOf...
Rename the user group with the specified ID @param sUserGroupID The ID of the user group. May be <code>null</code>. @param sNewName The new name of the user group. May neither be <code>null</code> nor empty. @return {@link EChange#CHANGED} if the user group ID was valid, and the new name was different from the old name
[ "Rename", "the", "user", "group", "with", "the", "specified", "ID" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java#L329-L359
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.getObjectProp
public static Object getObjectProp(Object obj, String property, Context cx, Scriptable scope) { Scriptable sobj = toObjectOrNull(cx, obj, scope); if (sobj == null) { throw undefReadError(obj, property); } return getObjectProp(sobj, property, cx); }
java
public static Object getObjectProp(Object obj, String property, Context cx, Scriptable scope) { Scriptable sobj = toObjectOrNull(cx, obj, scope); if (sobj == null) { throw undefReadError(obj, property); } return getObjectProp(sobj, property, cx); }
[ "public", "static", "Object", "getObjectProp", "(", "Object", "obj", ",", "String", "property", ",", "Context", "cx", ",", "Scriptable", "scope", ")", "{", "Scriptable", "sobj", "=", "toObjectOrNull", "(", "cx", ",", "obj", ",", "scope", ")", ";", "if", ...
Version of getObjectElem when elem is a valid JS identifier name. @param scope the scope that should be used to resolve primitive prototype
[ "Version", "of", "getObjectElem", "when", "elem", "is", "a", "valid", "JS", "identifier", "name", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1575-L1583
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfCell.java
PdfCell.getImages
public ArrayList getImages(float top, float bottom) { // if the bottom of the page is higher than the top of the cell: do nothing if (getTop() < bottom) { return new ArrayList(); } top = Math.min(getTop(), top); // initializations Image image; float height; ArrayList result = new ArrayList(); // we loop over the images for (Iterator i = images.iterator(); i.hasNext() && !header;) { image = (Image) i.next(); height = image.getAbsoluteY(); // if the currentPosition is higher than the bottom, we add the line to the result if (top - height > (bottom + cellpadding)) { image.setAbsolutePosition(image.getAbsoluteX(), top - height); result.add(image); i.remove(); } } return result; }
java
public ArrayList getImages(float top, float bottom) { // if the bottom of the page is higher than the top of the cell: do nothing if (getTop() < bottom) { return new ArrayList(); } top = Math.min(getTop(), top); // initializations Image image; float height; ArrayList result = new ArrayList(); // we loop over the images for (Iterator i = images.iterator(); i.hasNext() && !header;) { image = (Image) i.next(); height = image.getAbsoluteY(); // if the currentPosition is higher than the bottom, we add the line to the result if (top - height > (bottom + cellpadding)) { image.setAbsolutePosition(image.getAbsoluteX(), top - height); result.add(image); i.remove(); } } return result; }
[ "public", "ArrayList", "getImages", "(", "float", "top", ",", "float", "bottom", ")", "{", "// if the bottom of the page is higher than the top of the cell: do nothing", "if", "(", "getTop", "(", ")", "<", "bottom", ")", "{", "return", "new", "ArrayList", "(", ")", ...
Gets the images of a cell that can be drawn between certain limits. <P> Remark: all the lines that can be drawn are removed from the object! @param top the top of the part of the table that can be drawn @param bottom the bottom of the part of the table that can be drawn @return an <CODE>ArrayList</CODE> of <CODE>Image</CODE>s
[ "Gets", "the", "images", "of", "a", "cell", "that", "can", "be", "drawn", "between", "certain", "limits", ".", "<P", ">", "Remark", ":", "all", "the", "lines", "that", "can", "be", "drawn", "are", "removed", "from", "the", "object!" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfCell.java#L624-L647
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/utilities/FileUtils.java
FileUtils.createTempDir
public static File createTempDir(String prefix, File directory) throws IOException { File tempFile = File.createTempFile(prefix, "", directory); if (!tempFile.delete()) throw new IOException(); if (!tempFile.mkdir()) throw new IOException(); return tempFile; }
java
public static File createTempDir(String prefix, File directory) throws IOException { File tempFile = File.createTempFile(prefix, "", directory); if (!tempFile.delete()) throw new IOException(); if (!tempFile.mkdir()) throw new IOException(); return tempFile; }
[ "public", "static", "File", "createTempDir", "(", "String", "prefix", ",", "File", "directory", ")", "throws", "IOException", "{", "File", "tempFile", "=", "File", ".", "createTempFile", "(", "prefix", ",", "\"\"", ",", "directory", ")", ";", "if", "(", "!...
Create a temporary directory. @param prefix @param directory @return java.io.File temporary directory @throws IOException
[ "Create", "a", "temporary", "directory", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/FileUtils.java#L117-L124
windup/windup
graph/api/src/main/java/org/jboss/windup/graph/service/OrganizationService.java
OrganizationService.attachOrganization
public OrganizationModel attachOrganization(OrganizationModel organizationModel, ArchiveModel archiveModel) { for (OrganizationModel existingOrganizationModel : archiveModel.getOrganizationModels()) { if (existingOrganizationModel.equals(organizationModel)) return organizationModel; } organizationModel.addArchiveModel(archiveModel); return organizationModel; }
java
public OrganizationModel attachOrganization(OrganizationModel organizationModel, ArchiveModel archiveModel) { for (OrganizationModel existingOrganizationModel : archiveModel.getOrganizationModels()) { if (existingOrganizationModel.equals(organizationModel)) return organizationModel; } organizationModel.addArchiveModel(archiveModel); return organizationModel; }
[ "public", "OrganizationModel", "attachOrganization", "(", "OrganizationModel", "organizationModel", ",", "ArchiveModel", "archiveModel", ")", "{", "for", "(", "OrganizationModel", "existingOrganizationModel", ":", "archiveModel", ".", "getOrganizationModels", "(", ")", ")",...
This method just attaches the {@link OrganizationModel} to the {@link FileModel}. It will only do so if this link is not already present.
[ "This", "method", "just", "attaches", "the", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/graph/api/src/main/java/org/jboss/windup/graph/service/OrganizationService.java#L47-L56
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.copy
public static long copy(Reader input, StringBuilder output) throws IOException { return copy(input, output, new char[DEFAULT_BUFFER_SIZE]); }
java
public static long copy(Reader input, StringBuilder output) throws IOException { return copy(input, output, new char[DEFAULT_BUFFER_SIZE]); }
[ "public", "static", "long", "copy", "(", "Reader", "input", ",", "StringBuilder", "output", ")", "throws", "IOException", "{", "return", "copy", "(", "input", ",", "output", ",", "new", "char", "[", "DEFAULT_BUFFER_SIZE", "]", ")", ";", "}" ]
Transfers data from Reader into StringBuilder Uses {@link #DEFAULT_BUFFER_SIZE} to define buffer size @param input Reader which would be read @param output StringBuilder which would be filled @return amount of bytes transferred @throws IOException
[ "Transfers", "data", "from", "Reader", "into", "StringBuilder", "Uses", "{", "@link", "#DEFAULT_BUFFER_SIZE", "}", "to", "define", "buffer", "size" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L595-L598
Stratio/deep-spark
deep-cassandra/src/main/java/com/stratio/deep/cassandra/config/EntityDeepJobConfig.java
EntityDeepJobConfig.setInstancePropertyFromDbName
public void setInstancePropertyFromDbName(T instance, String dbName, Object value) { Map<String, Cell> cfs = columnDefinitions(); Cell metadataCell = cfs.get(dbName); String f = mapDBNameToEntityName.get(dbName); if (StringUtils.isEmpty(f)) { // DB column is not mapped in the testentity return; } try { Method setter = Utils.findSetter(f, entityClass, value.getClass()); setter.invoke(instance, value); } catch (DeepIOException e) { Utils.setFieldWithReflection(instance, f, value); } catch (Exception e1) { throw new DeepGenericException(e1); } }
java
public void setInstancePropertyFromDbName(T instance, String dbName, Object value) { Map<String, Cell> cfs = columnDefinitions(); Cell metadataCell = cfs.get(dbName); String f = mapDBNameToEntityName.get(dbName); if (StringUtils.isEmpty(f)) { // DB column is not mapped in the testentity return; } try { Method setter = Utils.findSetter(f, entityClass, value.getClass()); setter.invoke(instance, value); } catch (DeepIOException e) { Utils.setFieldWithReflection(instance, f, value); } catch (Exception e1) { throw new DeepGenericException(e1); } }
[ "public", "void", "setInstancePropertyFromDbName", "(", "T", "instance", ",", "String", "dbName", ",", "Object", "value", ")", "{", "Map", "<", "String", ",", "Cell", ">", "cfs", "=", "columnDefinitions", "(", ")", ";", "Cell", "metadataCell", "=", "cfs", ...
Given an instance of the generic object mapped to this configurtion object, sets the instance property whose name is the name specified by dbName. Since the provided dbName is the name of the field in the database, we first try to resolve the property name using the fieldName property of the DeepField annotation. If we don't find any property whose DeepField.fieldName.equals(dbName) we fallback to the name of the Java property. @param instance instance object. @param dbName name of the field as known by the data store. @param value value to set in the property field of the provided instance object.
[ "Given", "an", "instance", "of", "the", "generic", "object", "mapped", "to", "this", "configurtion", "object", "sets", "the", "instance", "property", "whose", "name", "is", "the", "name", "specified", "by", "dbName", ".", "Since", "the", "provided", "dbName", ...
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/config/EntityDeepJobConfig.java#L150-L171
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateTimeUtil.java
LocalDateTimeUtil.addDays
public static LocalDateTime addDays(String localDate, long days) { LocalDateTime parse = parse(localDate, DEFAULT_PATTERN); return parse.plusDays(days); }
java
public static LocalDateTime addDays(String localDate, long days) { LocalDateTime parse = parse(localDate, DEFAULT_PATTERN); return parse.plusDays(days); }
[ "public", "static", "LocalDateTime", "addDays", "(", "String", "localDate", ",", "long", "days", ")", "{", "LocalDateTime", "parse", "=", "parse", "(", "localDate", ",", "DEFAULT_PATTERN", ")", ";", "return", "parse", ".", "plusDays", "(", "days", ")", ";", ...
addDays @param localDate 时间 @param days 天数 @return localDate
[ "addDays" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateTimeUtil.java#L92-L95
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/context/ResponseWriterWrapper.java
ResponseWriterWrapper.writeText
@Override public void writeText(Object text, UIComponent component, String property) throws IOException { getWrapped().writeText(text, component, property); }
java
@Override public void writeText(Object text, UIComponent component, String property) throws IOException { getWrapped().writeText(text, component, property); }
[ "@", "Override", "public", "void", "writeText", "(", "Object", "text", ",", "UIComponent", "component", ",", "String", "property", ")", "throws", "IOException", "{", "getWrapped", "(", ")", ".", "writeText", "(", "text", ",", "component", ",", "property", ")...
<p>The default behavior of this method is to call {@link ResponseWriter#writeText(Object, UIComponent, String)} on the wrapped {@link ResponseWriter} object.</p> @see ResponseWriter#writeText(Object, String) @since 1.2
[ "<p", ">", "The", "default", "behavior", "of", "this", "method", "is", "to", "call", "{", "@link", "ResponseWriter#writeText", "(", "Object", "UIComponent", "String", ")", "}", "on", "the", "wrapped", "{", "@link", "ResponseWriter", "}", "object", ".", "<", ...
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/context/ResponseWriterWrapper.java#L311-L315
craigwblake/redline
src/main/java/org/redline_rpm/Builder.java
Builder.addDependency
public void addDependency( final String name, final int comparison, final String version ) { requires.add(new Dependency(name, version, comparison)); }
java
public void addDependency( final String name, final int comparison, final String version ) { requires.add(new Dependency(name, version, comparison)); }
[ "public", "void", "addDependency", "(", "final", "String", "name", ",", "final", "int", "comparison", ",", "final", "String", "version", ")", "{", "requires", ".", "add", "(", "new", "Dependency", "(", "name", ",", "version", ",", "comparison", ")", ")", ...
Adds a dependency to the RPM package. This dependency version will be marked as the exact requirement, and the package will require the named dependency with exactly this version at install time. @param name the name of the dependency. @param comparison the comparison flag. @param version the version identifier.
[ "Adds", "a", "dependency", "to", "the", "RPM", "package", ".", "This", "dependency", "version", "will", "be", "marked", "as", "the", "exact", "requirement", "and", "the", "package", "will", "require", "the", "named", "dependency", "with", "exactly", "this", ...
train
https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L169-L171
alibaba/jstorm
jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/HdfsSpout.java
HdfsSpout.getFileForLockFile
private Path getFileForLockFile(Path lockFile, Path sourceDirPath) throws IOException { String lockFileName = lockFile.getName(); Path dataFile = new Path(sourceDirPath + Path.SEPARATOR + lockFileName + inprogress_suffix); if( hdfs.exists(dataFile) ) { return dataFile; } dataFile = new Path(sourceDirPath + Path.SEPARATOR + lockFileName); if(hdfs.exists(dataFile)) { return dataFile; } return null; }
java
private Path getFileForLockFile(Path lockFile, Path sourceDirPath) throws IOException { String lockFileName = lockFile.getName(); Path dataFile = new Path(sourceDirPath + Path.SEPARATOR + lockFileName + inprogress_suffix); if( hdfs.exists(dataFile) ) { return dataFile; } dataFile = new Path(sourceDirPath + Path.SEPARATOR + lockFileName); if(hdfs.exists(dataFile)) { return dataFile; } return null; }
[ "private", "Path", "getFileForLockFile", "(", "Path", "lockFile", ",", "Path", "sourceDirPath", ")", "throws", "IOException", "{", "String", "lockFileName", "=", "lockFile", ".", "getName", "(", ")", ";", "Path", "dataFile", "=", "new", "Path", "(", "sourceDir...
Returns the corresponding input file in the 'sourceDirPath' for the specified lock file. If no such file is found then returns null
[ "Returns", "the", "corresponding", "input", "file", "in", "the", "sourceDirPath", "for", "the", "specified", "lock", "file", ".", "If", "no", "such", "file", "is", "found", "then", "returns", "null" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/HdfsSpout.java#L663-L675