repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/Branch.java
Branch.redeemRewards
public void redeemRewards(@NonNull final String bucket, final int count, BranchReferralStateChangedListener callback) { ServerRequestRedeemRewards req = new ServerRequestRedeemRewards(context_, bucket, count, callback); if (!req.constructError_ && !req.handleErrors(context_)) { handleNewRequest(req); } }
java
public void redeemRewards(@NonNull final String bucket, final int count, BranchReferralStateChangedListener callback) { ServerRequestRedeemRewards req = new ServerRequestRedeemRewards(context_, bucket, count, callback); if (!req.constructError_ && !req.handleErrors(context_)) { handleNewRequest(req); } }
[ "public", "void", "redeemRewards", "(", "@", "NonNull", "final", "String", "bucket", ",", "final", "int", "count", ",", "BranchReferralStateChangedListener", "callback", ")", "{", "ServerRequestRedeemRewards", "req", "=", "new", "ServerRequestRedeemRewards", "(", "con...
<p>Redeems the specified number of credits from the named bucket, if there are sufficient credits within it. If the number to redeem exceeds the number available in the bucket, all of the available credits will be redeemed instead.</p> @param bucket A {@link String} value containing the name of the referral bucket to attempt to redeem credits from. @param count A {@link Integer} specifying the number of credits to attempt to redeem from the specified bucket. @param callback A {@link BranchReferralStateChangedListener} callback instance that will trigger actions defined therein upon a executing redeem rewards.
[ "<p", ">", "Redeems", "the", "specified", "number", "of", "credits", "from", "the", "named", "bucket", "if", "there", "are", "sufficient", "credits", "within", "it", ".", "If", "the", "number", "to", "redeem", "exceeds", "the", "number", "available", "in", ...
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1916-L1922
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getStream
public GetStreamResponse getStream(GetStreamRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); checkStringNotEmpty(request.getApp(), "App should NOT be empty."); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); return invokeHttpClient(internalRequest, GetStreamResponse.class); }
java
public GetStreamResponse getStream(GetStreamRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); checkStringNotEmpty(request.getApp(), "App should NOT be empty."); checkStringNotEmpty(request.getStream(), "Stream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_APP, request.getApp(), LIVE_STREAM, request.getStream()); return invokeHttpClient(internalRequest, GetStreamResponse.class); }
[ "public", "GetStreamResponse", "getStream", "(", "GetStreamRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPlayDomain", "(", ")", ",", "\"playD...
Get detail of stream in the live stream service. @param request The request object containing all options for querying detail of stream @return the response
[ "Get", "detail", "of", "stream", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1463-L1475
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/VirtualLayoutManager.java
VirtualLayoutManager.updateSpecWithExtra
private int updateSpecWithExtra(int spec, int startInset, int endInset) { if (startInset == 0 && endInset == 0) { return spec; } final int mode = View.MeasureSpec.getMode(spec); if (mode == View.MeasureSpec.AT_MOST || mode == View.MeasureSpec.EXACTLY) { int size = View.MeasureSpec.getSize(spec); if (size - startInset - endInset < 0) { return View.MeasureSpec.makeMeasureSpec(0, mode); } else { return View.MeasureSpec.makeMeasureSpec( View.MeasureSpec.getSize(spec) - startInset - endInset, mode); } } return spec; }
java
private int updateSpecWithExtra(int spec, int startInset, int endInset) { if (startInset == 0 && endInset == 0) { return spec; } final int mode = View.MeasureSpec.getMode(spec); if (mode == View.MeasureSpec.AT_MOST || mode == View.MeasureSpec.EXACTLY) { int size = View.MeasureSpec.getSize(spec); if (size - startInset - endInset < 0) { return View.MeasureSpec.makeMeasureSpec(0, mode); } else { return View.MeasureSpec.makeMeasureSpec( View.MeasureSpec.getSize(spec) - startInset - endInset, mode); } } return spec; }
[ "private", "int", "updateSpecWithExtra", "(", "int", "spec", ",", "int", "startInset", ",", "int", "endInset", ")", "{", "if", "(", "startInset", "==", "0", "&&", "endInset", "==", "0", ")", "{", "return", "spec", ";", "}", "final", "int", "mode", "=",...
Update measure spec with insets @param spec @param startInset @param endInset @return
[ "Update", "measure", "spec", "with", "insets" ]
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/VirtualLayoutManager.java#L1531-L1546
op4j/op4j-jodatime
src/main/java/org/op4j/jodatime/functions/FnPeriod.java
FnPeriod.baseDateTimeFieldCollectionToPeriod
public static final Function<Collection<? extends BaseDateTime>, Period> baseDateTimeFieldCollectionToPeriod(final PeriodType periodType, final Chronology chronology) { return new BaseDateTimeFieldCollectionToPeriod(periodType, chronology); }
java
public static final Function<Collection<? extends BaseDateTime>, Period> baseDateTimeFieldCollectionToPeriod(final PeriodType periodType, final Chronology chronology) { return new BaseDateTimeFieldCollectionToPeriod(periodType, chronology); }
[ "public", "static", "final", "Function", "<", "Collection", "<", "?", "extends", "BaseDateTime", ">", ",", "Period", ">", "baseDateTimeFieldCollectionToPeriod", "(", "final", "PeriodType", "periodType", ",", "final", "Chronology", "chronology", ")", "{", "return", ...
<p> It creates a {@link Period} with the specified {@link PeriodType} and {@link Chronology}. The input received by the {@link Function} must have size 2 and represents the start and end instants of the {@link Period} </p> @param periodType the {@link PeriodType} to be created. It specifies which duration fields are to be used @param chronology {@link Chronology} to be used @return the {@link Period} created from the input and arguments
[ "<p", ">", "It", "creates", "a", "{", "@link", "Period", "}", "with", "the", "specified", "{", "@link", "PeriodType", "}", "and", "{", "@link", "Chronology", "}", ".", "The", "input", "received", "by", "the", "{", "@link", "Function", "}", "must", "hav...
train
https://github.com/op4j/op4j-jodatime/blob/26e5b8cda8553fb3b5a4a64b3109dbbf5df21194/src/main/java/org/op4j/jodatime/functions/FnPeriod.java#L614-L616
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.functionalInterfaceBridges
public List<Symbol> functionalInterfaceBridges(TypeSymbol origin) { Assert.check(isFunctionalInterface(origin)); Symbol descSym = findDescriptorSymbol(origin); CompoundScope members = membersClosure(origin.type, false); ListBuffer<Symbol> overridden = new ListBuffer<>(); outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) { if (m2 == descSym) continue; else if (descSym.overrides(m2, origin, Types.this, false)) { for (Symbol m3 : overridden) { if (isSameType(m3.erasure(Types.this), m2.erasure(Types.this)) || (m3.overrides(m2, origin, Types.this, false) && (pendingBridges((ClassSymbol)origin, m3.enclClass()) || (((MethodSymbol)m2).binaryImplementation((ClassSymbol)m3.owner, Types.this) != null)))) { continue outer; } } overridden.add(m2); } } return overridden.toList(); }
java
public List<Symbol> functionalInterfaceBridges(TypeSymbol origin) { Assert.check(isFunctionalInterface(origin)); Symbol descSym = findDescriptorSymbol(origin); CompoundScope members = membersClosure(origin.type, false); ListBuffer<Symbol> overridden = new ListBuffer<>(); outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) { if (m2 == descSym) continue; else if (descSym.overrides(m2, origin, Types.this, false)) { for (Symbol m3 : overridden) { if (isSameType(m3.erasure(Types.this), m2.erasure(Types.this)) || (m3.overrides(m2, origin, Types.this, false) && (pendingBridges((ClassSymbol)origin, m3.enclClass()) || (((MethodSymbol)m2).binaryImplementation((ClassSymbol)m3.owner, Types.this) != null)))) { continue outer; } } overridden.add(m2); } } return overridden.toList(); }
[ "public", "List", "<", "Symbol", ">", "functionalInterfaceBridges", "(", "TypeSymbol", "origin", ")", "{", "Assert", ".", "check", "(", "isFunctionalInterface", "(", "origin", ")", ")", ";", "Symbol", "descSym", "=", "findDescriptorSymbol", "(", "origin", ")", ...
Find the minimal set of methods that are overridden by the functional descriptor in 'origin'. All returned methods are assumed to have different erased signatures.
[ "Find", "the", "minimal", "set", "of", "methods", "that", "are", "overridden", "by", "the", "functional", "descriptor", "in", "origin", ".", "All", "returned", "methods", "are", "assumed", "to", "have", "different", "erased", "signatures", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L658-L678
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java
RubyBundleAuditAnalyzer.addReferenceToVulnerability
private void addReferenceToVulnerability(String parentName, Vulnerability vulnerability, String nextLine) { final String url = nextLine.substring("URL: ".length()); if (null != vulnerability) { final Reference ref = new Reference(); ref.setName(vulnerability.getName()); ref.setSource("bundle-audit"); ref.setUrl(url); vulnerability.getReferences().add(ref); } LOGGER.debug("bundle-audit ({}): {}", parentName, nextLine); }
java
private void addReferenceToVulnerability(String parentName, Vulnerability vulnerability, String nextLine) { final String url = nextLine.substring("URL: ".length()); if (null != vulnerability) { final Reference ref = new Reference(); ref.setName(vulnerability.getName()); ref.setSource("bundle-audit"); ref.setUrl(url); vulnerability.getReferences().add(ref); } LOGGER.debug("bundle-audit ({}): {}", parentName, nextLine); }
[ "private", "void", "addReferenceToVulnerability", "(", "String", "parentName", ",", "Vulnerability", "vulnerability", ",", "String", "nextLine", ")", "{", "final", "String", "url", "=", "nextLine", ".", "substring", "(", "\"URL: \"", ".", "length", "(", ")", ")"...
Adds a reference to the vulnerability. @param parentName the parent name @param vulnerability the vulnerability @param nextLine the line to parse
[ "Adds", "a", "reference", "to", "the", "vulnerability", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java#L398-L408
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java
StringConcatenation.appendSegments
protected void appendSegments(int index, List<String> otherSegments) { growSegments(otherSegments.size()); if (segments.addAll(index, otherSegments)) { cachedToString = null; } }
java
protected void appendSegments(int index, List<String> otherSegments) { growSegments(otherSegments.size()); if (segments.addAll(index, otherSegments)) { cachedToString = null; } }
[ "protected", "void", "appendSegments", "(", "int", "index", ",", "List", "<", "String", ">", "otherSegments", ")", "{", "growSegments", "(", "otherSegments", ".", "size", "(", ")", ")", ";", "if", "(", "segments", ".", "addAll", "(", "index", ",", "other...
Add the list of segments to this sequence at the given index. The given indentation will be prepended to each line except the first one if the object has a multi-line string representation. @param index the index in this instance's list of segments. @param otherSegments the to-be-appended segments. May not be <code>null</code>. @since 2.5
[ "Add", "the", "list", "of", "segments", "to", "this", "sequence", "at", "the", "given", "index", ".", "The", "given", "indentation", "will", "be", "prepended", "to", "each", "line", "except", "the", "first", "one", "if", "the", "object", "has", "a", "mul...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java#L435-L440
infinispan/infinispan
server/core/src/main/java/org/infinispan/server/core/security/simple/SimpleServerAuthenticationProvider.java
SimpleServerAuthenticationProvider.addUser
public void addUser(String userName, String userRealm, char[] password, String... groups) { if (userName == null) { throw new IllegalArgumentException("userName is null"); } if (userRealm == null) { throw new IllegalArgumentException("userRealm is null"); } if (password == null) { throw new IllegalArgumentException("password is null"); } final String canonUserRealm = userRealm.toLowerCase().trim(); final String canonUserName = userName.toLowerCase().trim(); synchronized (map) { Map<String, Entry> realmMap = map.get(canonUserRealm); if (realmMap == null) { realmMap = new HashMap<String, Entry>(); map.put(canonUserRealm, realmMap); } realmMap.put(canonUserName, new Entry(canonUserName, canonUserRealm, password, groups != null ? groups : new String[0])); } }
java
public void addUser(String userName, String userRealm, char[] password, String... groups) { if (userName == null) { throw new IllegalArgumentException("userName is null"); } if (userRealm == null) { throw new IllegalArgumentException("userRealm is null"); } if (password == null) { throw new IllegalArgumentException("password is null"); } final String canonUserRealm = userRealm.toLowerCase().trim(); final String canonUserName = userName.toLowerCase().trim(); synchronized (map) { Map<String, Entry> realmMap = map.get(canonUserRealm); if (realmMap == null) { realmMap = new HashMap<String, Entry>(); map.put(canonUserRealm, realmMap); } realmMap.put(canonUserName, new Entry(canonUserName, canonUserRealm, password, groups != null ? groups : new String[0])); } }
[ "public", "void", "addUser", "(", "String", "userName", ",", "String", "userRealm", ",", "char", "[", "]", "password", ",", "String", "...", "groups", ")", "{", "if", "(", "userName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(",...
Add a user to the authentication table. @param userName the user name @param userRealm the user realm @param password the password @param groups the groups the user belongs to
[ "Add", "a", "user", "to", "the", "authentication", "table", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/core/src/main/java/org/infinispan/server/core/security/simple/SimpleServerAuthenticationProvider.java#L126-L146
jOOQ/jOOX
jOOX-java-6/src/main/java/org/joox/Util.java
Util.createContent
static final DocumentFragment createContent(Document doc, String text) { // [#150] Text might hold XML content, which can be leniently identified by the presence // of either < or & characters (other entities, like >, ", ' are not stricly XML content) if (text != null && (text.contains("<") || text.contains("&"))) { DocumentBuilder builder = JOOX.builder(); try { // [#128] Trimming will get rid of leading and trailing whitespace, which would // otherwise cause a HIERARCHY_REQUEST_ERR raised by the parser text = text.trim(); // There is a processing instruction. We can safely assume // valid XML and parse it as such if (text.startsWith("<?xml")) { Document parsed = builder.parse(new InputSource(new StringReader(text))); DocumentFragment fragment = parsed.createDocumentFragment(); fragment.appendChild(parsed.getDocumentElement()); return (DocumentFragment) doc.importNode(fragment, true); } // Any XML document fragment. To be on the safe side, fragments // are wrapped in a dummy root node else { String wrapped = "<dummy>" + text + "</dummy>"; Document parsed = builder.parse(new InputSource(new StringReader(wrapped))); DocumentFragment fragment = parsed.createDocumentFragment(); NodeList children = parsed.getDocumentElement().getChildNodes(); // appendChild removes children also from NodeList! while (children.getLength() > 0) { fragment.appendChild(children.item(0)); } return (DocumentFragment) doc.importNode(fragment, true); } } // This does not occur catch (IOException ignore) {} // The XML content is invalid catch (SAXException ignore) {} } // Plain text or invalid XML return null; }
java
static final DocumentFragment createContent(Document doc, String text) { // [#150] Text might hold XML content, which can be leniently identified by the presence // of either < or & characters (other entities, like >, ", ' are not stricly XML content) if (text != null && (text.contains("<") || text.contains("&"))) { DocumentBuilder builder = JOOX.builder(); try { // [#128] Trimming will get rid of leading and trailing whitespace, which would // otherwise cause a HIERARCHY_REQUEST_ERR raised by the parser text = text.trim(); // There is a processing instruction. We can safely assume // valid XML and parse it as such if (text.startsWith("<?xml")) { Document parsed = builder.parse(new InputSource(new StringReader(text))); DocumentFragment fragment = parsed.createDocumentFragment(); fragment.appendChild(parsed.getDocumentElement()); return (DocumentFragment) doc.importNode(fragment, true); } // Any XML document fragment. To be on the safe side, fragments // are wrapped in a dummy root node else { String wrapped = "<dummy>" + text + "</dummy>"; Document parsed = builder.parse(new InputSource(new StringReader(wrapped))); DocumentFragment fragment = parsed.createDocumentFragment(); NodeList children = parsed.getDocumentElement().getChildNodes(); // appendChild removes children also from NodeList! while (children.getLength() > 0) { fragment.appendChild(children.item(0)); } return (DocumentFragment) doc.importNode(fragment, true); } } // This does not occur catch (IOException ignore) {} // The XML content is invalid catch (SAXException ignore) {} } // Plain text or invalid XML return null; }
[ "static", "final", "DocumentFragment", "createContent", "(", "Document", "doc", ",", "String", "text", ")", "{", "// [#150] Text might hold XML content, which can be leniently identified by the presence", "// of either < or & characters (other entities, like >, \", ' are not stricly...
Create some content in the context of a given document @return <ul> <li>A {@link DocumentFragment} if <code>text</code> is well-formed.</li> <li><code>null</code>, if <code>text</code> is plain text or not well formed</li> </ul>
[ "Create", "some", "content", "in", "the", "context", "of", "a", "given", "document" ]
train
https://github.com/jOOQ/jOOX/blob/3793b96f0cee126f64074da4d7fad63f91d2440e/jOOX-java-6/src/main/java/org/joox/Util.java#L99-L148
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
DocBookBuildUtilities.addLevelsToDatabase
public static void addLevelsToDatabase(final BuildDatabase buildDatabase, final Level level) { // Add the level to the database buildDatabase.add(level); // Add the child levels to the database for (final Level childLevel : level.getChildLevels()) { addLevelsToDatabase(buildDatabase, childLevel); } }
java
public static void addLevelsToDatabase(final BuildDatabase buildDatabase, final Level level) { // Add the level to the database buildDatabase.add(level); // Add the child levels to the database for (final Level childLevel : level.getChildLevels()) { addLevelsToDatabase(buildDatabase, childLevel); } }
[ "public", "static", "void", "addLevelsToDatabase", "(", "final", "BuildDatabase", "buildDatabase", ",", "final", "Level", "level", ")", "{", "// Add the level to the database", "buildDatabase", ".", "add", "(", "level", ")", ";", "// Add the child levels to the database",...
Adds the levels in the provided Level object to the content spec database. @param buildDatabase @param level The content spec level to be added to the database.
[ "Adds", "the", "levels", "in", "the", "provided", "Level", "object", "to", "the", "content", "spec", "database", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L76-L84
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java
MethodUtils.isAssignmentCompatible
public static final boolean isAssignmentCompatible(Class<?> parameterType, Class<?> parameterization) { // try plain assignment if (parameterType.isAssignableFrom(parameterization)) { return true; } if (parameterType.isPrimitive()) { // this method does *not* do widening - you must specify exactly // is this the right behaviour? Class<?> parameterWrapperClazz = getPrimitiveWrapper(parameterType); if (parameterWrapperClazz != null) { return parameterWrapperClazz.equals(parameterization); } } return false; }
java
public static final boolean isAssignmentCompatible(Class<?> parameterType, Class<?> parameterization) { // try plain assignment if (parameterType.isAssignableFrom(parameterization)) { return true; } if (parameterType.isPrimitive()) { // this method does *not* do widening - you must specify exactly // is this the right behaviour? Class<?> parameterWrapperClazz = getPrimitiveWrapper(parameterType); if (parameterWrapperClazz != null) { return parameterWrapperClazz.equals(parameterization); } } return false; }
[ "public", "static", "final", "boolean", "isAssignmentCompatible", "(", "Class", "<", "?", ">", "parameterType", ",", "Class", "<", "?", ">", "parameterization", ")", "{", "// try plain assignment\r", "if", "(", "parameterType", ".", "isAssignableFrom", "(", "param...
<p>Determine whether a type can be used as a parameter in a method invocation. This method handles primitive conversions correctly.</p> <p>In order words, it will match a <code>Boolean</code> to a <code>boolean</code>, a <code>Long</code> to a <code>long</code>, a <code>Float</code> to a <code>float</code>, a <code>Integer</code> to a <code>int</code>, and a <code>Double</code> to a <code>double</code>. Now logic widening matches are allowed. For example, a <code>Long</code> will not match a <code>int</code>. @param parameterType the type of parameter accepted by the method @param parameterization the type of parameter being tested @return true if the assignment is compatible.
[ "<p", ">", "Determine", "whether", "a", "type", "can", "be", "used", "as", "a", "parameter", "in", "a", "method", "invocation", ".", "This", "method", "handles", "primitive", "conversions", "correctly", ".", "<", "/", "p", ">" ]
train
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L1175-L1191
agmip/translator-dssat
src/main/java/org/agmip/translators/dssat/DssatBatchFileOutput.java
DssatBatchFileOutput.writeFile
@Override public void writeFile(String arg0, Map result) { // Initial variables BufferedWriter bwB; // output object StringBuilder sbData = new StringBuilder(); // construct the data info in the output try { // Set default value for missing data setDefVal(); // Get version number if (dssatVerStr == null) { dssatVerStr = getObjectOr(result, "crop_model_version", "").replaceAll("\\D", ""); if (!dssatVerStr.matches("\\d+")) { dssatVerStr = DssatVersion.DSSAT45.toString(); } } // Initial BufferedWriter arg0 = revisePath(arg0); outputFile = new File(arg0 + "DSSBatch.v" + dssatVerStr); bwB = new BufferedWriter(new FileWriter(outputFile)); // Output Batch File // Titel Section String crop = getCropName(result); String dssatPath = "C:\\DSSAT" + dssatVerStr + "\\"; String exFileName = getFileName(result, "X"); int expNo = 1; // Write title section sbData.append("$BATCH(").append(crop).append(")\r\n!\r\n"); sbData.append(String.format("! Command Line : %1$sDSCSM0%2$s.EXE B DSSBatch.v%2$s\r\n", dssatPath, dssatVerStr)); sbData.append("! Crop : ").append(crop).append("\r\n"); sbData.append("! Experiment : ").append(exFileName).append("\r\n"); sbData.append("! ExpNo : ").append(expNo).append("\r\n"); sbData.append(String.format("! Debug : %1$sDSCSM0%2$s.EXE \" B DSSBatch.v%2$s\"\r\n!\r\n", dssatPath, dssatVerStr)); // Body Section sbData.append("@FILEX TRTNO RP SQ OP CO\r\n"); // Get DSSAT Sequence info HashMap dssatSeqData = getObjectOr(result, "dssat_sequence", new HashMap()); ArrayList<HashMap> dssatSeqArr = getObjectOr(dssatSeqData, "data", new ArrayList<HashMap>()); // If missing, set default value if (dssatSeqArr.isEmpty()) { HashMap tmp = new HashMap(); tmp.put("sq", "1"); tmp.put("op", "1"); tmp.put("co", "0"); dssatSeqArr.add(tmp); } // Output all info for (HashMap dssatSeqSubData : dssatSeqArr) { sbData.append(String.format("%1$-92s %2$6s %3$6s %4$6s %5$6s %6$6s", exFileName, "1", "1", getObjectOr(dssatSeqSubData, "sq", "1"), getObjectOr(dssatSeqSubData, "op", "1"), getObjectOr(dssatSeqSubData, "co", "0"))); } // Output finish bwB.write(sbError.toString()); bwB.write(sbData.toString()); bwB.close(); } catch (IOException e) { LOG.error(DssatCommonOutput.getStackTrace(e)); } }
java
@Override public void writeFile(String arg0, Map result) { // Initial variables BufferedWriter bwB; // output object StringBuilder sbData = new StringBuilder(); // construct the data info in the output try { // Set default value for missing data setDefVal(); // Get version number if (dssatVerStr == null) { dssatVerStr = getObjectOr(result, "crop_model_version", "").replaceAll("\\D", ""); if (!dssatVerStr.matches("\\d+")) { dssatVerStr = DssatVersion.DSSAT45.toString(); } } // Initial BufferedWriter arg0 = revisePath(arg0); outputFile = new File(arg0 + "DSSBatch.v" + dssatVerStr); bwB = new BufferedWriter(new FileWriter(outputFile)); // Output Batch File // Titel Section String crop = getCropName(result); String dssatPath = "C:\\DSSAT" + dssatVerStr + "\\"; String exFileName = getFileName(result, "X"); int expNo = 1; // Write title section sbData.append("$BATCH(").append(crop).append(")\r\n!\r\n"); sbData.append(String.format("! Command Line : %1$sDSCSM0%2$s.EXE B DSSBatch.v%2$s\r\n", dssatPath, dssatVerStr)); sbData.append("! Crop : ").append(crop).append("\r\n"); sbData.append("! Experiment : ").append(exFileName).append("\r\n"); sbData.append("! ExpNo : ").append(expNo).append("\r\n"); sbData.append(String.format("! Debug : %1$sDSCSM0%2$s.EXE \" B DSSBatch.v%2$s\"\r\n!\r\n", dssatPath, dssatVerStr)); // Body Section sbData.append("@FILEX TRTNO RP SQ OP CO\r\n"); // Get DSSAT Sequence info HashMap dssatSeqData = getObjectOr(result, "dssat_sequence", new HashMap()); ArrayList<HashMap> dssatSeqArr = getObjectOr(dssatSeqData, "data", new ArrayList<HashMap>()); // If missing, set default value if (dssatSeqArr.isEmpty()) { HashMap tmp = new HashMap(); tmp.put("sq", "1"); tmp.put("op", "1"); tmp.put("co", "0"); dssatSeqArr.add(tmp); } // Output all info for (HashMap dssatSeqSubData : dssatSeqArr) { sbData.append(String.format("%1$-92s %2$6s %3$6s %4$6s %5$6s %6$6s", exFileName, "1", "1", getObjectOr(dssatSeqSubData, "sq", "1"), getObjectOr(dssatSeqSubData, "op", "1"), getObjectOr(dssatSeqSubData, "co", "0"))); } // Output finish bwB.write(sbError.toString()); bwB.write(sbData.toString()); bwB.close(); } catch (IOException e) { LOG.error(DssatCommonOutput.getStackTrace(e)); } }
[ "@", "Override", "public", "void", "writeFile", "(", "String", "arg0", ",", "Map", "result", ")", "{", "// Initial variables", "BufferedWriter", "bwB", ";", "// output object", "StringBuilder", "sbData", "=", "new", "StringBuilder", "(", ")", ";", "// construct th...
DSSAT Batch File Output method @param arg0 file output path @param result data holder object
[ "DSSAT", "Batch", "File", "Output", "method" ]
train
https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatBatchFileOutput.java#L145-L210
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java
CmsGalleryController.setIncludeExpired
public void setIncludeExpired(boolean includeExpired, boolean fireEvent) { m_searchObject.setIncludeExpired(includeExpired); m_searchObjectChanged = true; if (fireEvent) { ValueChangeEvent.fire(this, m_searchObject); } }
java
public void setIncludeExpired(boolean includeExpired, boolean fireEvent) { m_searchObject.setIncludeExpired(includeExpired); m_searchObjectChanged = true; if (fireEvent) { ValueChangeEvent.fire(this, m_searchObject); } }
[ "public", "void", "setIncludeExpired", "(", "boolean", "includeExpired", ",", "boolean", "fireEvent", ")", "{", "m_searchObject", ".", "setIncludeExpired", "(", "includeExpired", ")", ";", "m_searchObjectChanged", "=", "true", ";", "if", "(", "fireEvent", ")", "{"...
Sets if the search should include expired or unreleased resources.<p> @param includeExpired if the search should include expired or unreleased resources @param fireEvent true if a change event should be fired after setting the value
[ "Sets", "if", "the", "search", "should", "include", "expired", "or", "unreleased", "resources", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1288-L1296
lets-blade/blade
src/main/java/com/blade/kit/StringKit.java
StringKit.noNullElseGet
public static <T> T noNullElseGet(@NonNull Supplier<T> s1, @NonNull Supplier<T> s2) { T t1 = s1.get(); if (t1 != null) { return t1; } return s2.get(); }
java
public static <T> T noNullElseGet(@NonNull Supplier<T> s1, @NonNull Supplier<T> s2) { T t1 = s1.get(); if (t1 != null) { return t1; } return s2.get(); }
[ "public", "static", "<", "T", ">", "T", "noNullElseGet", "(", "@", "NonNull", "Supplier", "<", "T", ">", "s1", ",", "@", "NonNull", "Supplier", "<", "T", ">", "s2", ")", "{", "T", "t1", "=", "s1", ".", "get", "(", ")", ";", "if", "(", "t1", "...
we can replace if(doMethod1()!= null) { return doMethod1() } else { return doMethod2() } with return notBlankElse(bar::getName, bar::getNickName) @param s1 Supplier @param s2 Supplier
[ "we", "can", "replace", "if(doMethod1", "()", "!", "=", "null)", "{", "return", "doMethod1", "()", "}", "else", "{", "return", "doMethod2", "()", "}", "with", "return", "notBlankElse", "(", "bar", "::", "getName", "bar", "::", "getNickName", ")" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L143-L149
rollbar/rollbar-java
rollbar-java/src/main/java/com/rollbar/notifier/util/ObjectsUtils.java
ObjectsUtils.requireNonNull
public static <T> T requireNonNull(T object, String errorMessage) { if (object == null) { throw new NullPointerException(errorMessage); } else { return object; } }
java
public static <T> T requireNonNull(T object, String errorMessage) { if (object == null) { throw new NullPointerException(errorMessage); } else { return object; } }
[ "public", "static", "<", "T", ">", "T", "requireNonNull", "(", "T", "object", ",", "String", "errorMessage", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "errorMessage", ")", ";", "}", "else", "{", ...
Checks that the specified object reference is not null. @param object the object reference to check for nullity @param errorMessage detail message to be used in the event that a NullPointerException is thrown @param <T> the type of the reference @return object if not null
[ "Checks", "that", "the", "specified", "object", "reference", "is", "not", "null", "." ]
train
https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-java/src/main/java/com/rollbar/notifier/util/ObjectsUtils.java#L33-L39
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.countByG_B_A
@Override public int countByG_B_A(long groupId, boolean billingAllowed, boolean active) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_B_A; Object[] finderArgs = new Object[] { groupId, billingAllowed, active }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCECOUNTRY_WHERE); query.append(_FINDER_COLUMN_G_B_A_GROUPID_2); query.append(_FINDER_COLUMN_G_B_A_BILLINGALLOWED_2); query.append(_FINDER_COLUMN_G_B_A_ACTIVE_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(billingAllowed); qPos.add(active); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_B_A(long groupId, boolean billingAllowed, boolean active) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_B_A; Object[] finderArgs = new Object[] { groupId, billingAllowed, active }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCECOUNTRY_WHERE); query.append(_FINDER_COLUMN_G_B_A_GROUPID_2); query.append(_FINDER_COLUMN_G_B_A_BILLINGALLOWED_2); query.append(_FINDER_COLUMN_G_B_A_ACTIVE_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(billingAllowed); qPos.add(active); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_B_A", "(", "long", "groupId", ",", "boolean", "billingAllowed", ",", "boolean", "active", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_B_A", ";", "Object", "[", "]", "finderArgs", "=", "new", "Obj...
Returns the number of commerce countries where groupId = &#63; and billingAllowed = &#63; and active = &#63;. @param groupId the group ID @param billingAllowed the billing allowed @param active the active @return the number of matching commerce countries
[ "Returns", "the", "number", "of", "commerce", "countries", "where", "groupId", "=", "&#63", ";", "and", "billingAllowed", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L3538-L3589
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/extraction/SIFTExtractor.java
SIFTExtractor.extractFeaturesInternal
protected double[][] extractFeaturesInternal(BufferedImage image) { ImageFloat32 boofcvImage = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class); // create the SIFT detector and descriptor in BoofCV v0.15 ConfigSiftDetector conf = new ConfigSiftDetector(2, detectThreshold, maxFeaturesPerScale, 5); DetectDescribePoint<ImageFloat32, SurfFeature> sift = FactoryDetectDescribe.sift(null, conf, null, null); // specify the image to process sift.detect(boofcvImage); int numPoints = sift.getNumberOfFeatures(); double[][] descriptions = new double[numPoints][SIFTLength]; for (int i = 0; i < numPoints; i++) { descriptions[i] = sift.getDescription(i).getValue(); } return descriptions; }
java
protected double[][] extractFeaturesInternal(BufferedImage image) { ImageFloat32 boofcvImage = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class); // create the SIFT detector and descriptor in BoofCV v0.15 ConfigSiftDetector conf = new ConfigSiftDetector(2, detectThreshold, maxFeaturesPerScale, 5); DetectDescribePoint<ImageFloat32, SurfFeature> sift = FactoryDetectDescribe.sift(null, conf, null, null); // specify the image to process sift.detect(boofcvImage); int numPoints = sift.getNumberOfFeatures(); double[][] descriptions = new double[numPoints][SIFTLength]; for (int i = 0; i < numPoints; i++) { descriptions[i] = sift.getDescription(i).getValue(); } return descriptions; }
[ "protected", "double", "[", "]", "[", "]", "extractFeaturesInternal", "(", "BufferedImage", "image", ")", "{", "ImageFloat32", "boofcvImage", "=", "ConvertBufferedImage", ".", "convertFromSingle", "(", "image", ",", "null", ",", "ImageFloat32", ".", "class", ")", ...
Detects key points inside the image and computes descriptions at those points.
[ "Detects", "key", "points", "inside", "the", "image", "and", "computes", "descriptions", "at", "those", "points", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/extraction/SIFTExtractor.java#L47-L62
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.leftShift
public static File leftShift(File file, InputStream data) throws IOException { append(file, data); return file; }
java
public static File leftShift(File file, InputStream data) throws IOException { append(file, data); return file; }
[ "public", "static", "File", "leftShift", "(", "File", "file", ",", "InputStream", "data", ")", "throws", "IOException", "{", "append", "(", "file", ",", "data", ")", ";", "return", "file", ";", "}" ]
Append binary data to the file. See {@link #append(java.io.File, java.io.InputStream)} @param file a File @param data an InputStream of data to write to the file @return the file @throws IOException if an IOException occurs. @since 1.5.0
[ "Append", "binary", "data", "to", "the", "file", ".", "See", "{", "@link", "#append", "(", "java", ".", "io", ".", "File", "java", ".", "io", ".", "InputStream", ")", "}" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L821-L824
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java
ChineseCalendar.offsetMonth
private void offsetMonth(int newMoon, int dom, int delta) { // Move to the middle of the month before our target month. newMoon += (int) (CalendarAstronomer.SYNODIC_MONTH * (delta - 0.5)); // Search forward to the target month's new moon newMoon = newMoonNear(newMoon, true); // Find the target dom int jd = newMoon + EPOCH_JULIAN_DAY - 1 + dom; // Pin the dom. In this calendar all months are 29 or 30 days // so pinning just means handling dom 30. if (dom > 29) { set(JULIAN_DAY, jd-1); // TODO Fix this. We really shouldn't ever have to // explicitly call complete(). This is either a bug in // this method, in ChineseCalendar, or in // Calendar.getActualMaximum(). I suspect the last. complete(); if (getActualMaximum(DAY_OF_MONTH) >= dom) { set(JULIAN_DAY, jd); } } else { set(JULIAN_DAY, jd); } }
java
private void offsetMonth(int newMoon, int dom, int delta) { // Move to the middle of the month before our target month. newMoon += (int) (CalendarAstronomer.SYNODIC_MONTH * (delta - 0.5)); // Search forward to the target month's new moon newMoon = newMoonNear(newMoon, true); // Find the target dom int jd = newMoon + EPOCH_JULIAN_DAY - 1 + dom; // Pin the dom. In this calendar all months are 29 or 30 days // so pinning just means handling dom 30. if (dom > 29) { set(JULIAN_DAY, jd-1); // TODO Fix this. We really shouldn't ever have to // explicitly call complete(). This is either a bug in // this method, in ChineseCalendar, or in // Calendar.getActualMaximum(). I suspect the last. complete(); if (getActualMaximum(DAY_OF_MONTH) >= dom) { set(JULIAN_DAY, jd); } } else { set(JULIAN_DAY, jd); } }
[ "private", "void", "offsetMonth", "(", "int", "newMoon", ",", "int", "dom", ",", "int", "delta", ")", "{", "// Move to the middle of the month before our target month.", "newMoon", "+=", "(", "int", ")", "(", "CalendarAstronomer", ".", "SYNODIC_MONTH", "*", "(", "...
Adjust this calendar to be delta months before or after a given start position, pinning the day of month if necessary. The start position is given as a local days number for the start of the month and a day-of-month. Used by add() and roll(). @param newMoon the local days of the first day of the month of the start position (days after January 1, 1970 0:00 Asia/Shanghai) @param dom the 1-based day-of-month of the start position @param delta the number of months to move forward or backward from the start position
[ "Adjust", "this", "calendar", "to", "be", "delta", "months", "before", "or", "after", "a", "given", "start", "position", "pinning", "the", "day", "of", "month", "if", "necessary", ".", "The", "start", "position", "is", "given", "as", "a", "local", "days", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L514-L539
softindex/datakernel
core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java
ByteBuf.drainTo
public int drainTo(@NotNull byte[] array, int offset, int length) { assert !isRecycled() : "Attempt to use recycled bytebuf"; assert length >= 0 && (offset + length) <= array.length; assert head + length <= tail; System.arraycopy(this.array, head, array, offset, length); head += length; return length; }
java
public int drainTo(@NotNull byte[] array, int offset, int length) { assert !isRecycled() : "Attempt to use recycled bytebuf"; assert length >= 0 && (offset + length) <= array.length; assert head + length <= tail; System.arraycopy(this.array, head, array, offset, length); head += length; return length; }
[ "public", "int", "drainTo", "(", "@", "NotNull", "byte", "[", "]", "array", ",", "int", "offset", ",", "int", "length", ")", "{", "assert", "!", "isRecycled", "(", ")", ":", "\"Attempt to use recycled bytebuf\"", ";", "assert", "length", ">=", "0", "&&", ...
Drains bytes from this {@code ByteBuf} starting from current {@link #head} to a given byte array with specified offset and length. This {@code ByteBuf} must be not recycled. @param array array to which bytes will be drained to @param offset starting position in the destination data. The sum of the value and the {@code length} parameter must be smaller or equal to {@link #array} length @param length number of bytes to be drained to given array. Must be greater or equal to 0. The sum of the value and {@link #head} must be smaller or equal to {@link #tail} @return number of bytes that were drained.
[ "Drains", "bytes", "from", "this", "{", "@code", "ByteBuf", "}", "starting", "from", "current", "{", "@link", "#head", "}", "to", "a", "given", "byte", "array", "with", "specified", "offset", "and", "length", "." ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java#L576-L583
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.encodedOutputStreamWriter
public static Writer encodedOutputStreamWriter(OutputStream stream, String encoding) throws IOException { // OutputStreamWriter doesn't allow encoding to be null; if (encoding == null) { return new OutputStreamWriter(stream); } else { return new OutputStreamWriter(stream, encoding); } }
java
public static Writer encodedOutputStreamWriter(OutputStream stream, String encoding) throws IOException { // OutputStreamWriter doesn't allow encoding to be null; if (encoding == null) { return new OutputStreamWriter(stream); } else { return new OutputStreamWriter(stream, encoding); } }
[ "public", "static", "Writer", "encodedOutputStreamWriter", "(", "OutputStream", "stream", ",", "String", "encoding", ")", "throws", "IOException", "{", "// OutputStreamWriter doesn't allow encoding to be null;\r", "if", "(", "encoding", "==", "null", ")", "{", "return", ...
Create a Reader with an explicit encoding around an InputStream. This static method will treat null as meaning to use the platform default, unlike the Java library methods that disallow a null encoding. @param stream An InputStream @param encoding A charset encoding @return A Reader @throws IOException If any IO problem
[ "Create", "a", "Reader", "with", "an", "explicit", "encoding", "around", "an", "InputStream", ".", "This", "static", "method", "will", "treat", "null", "as", "meaning", "to", "use", "the", "platform", "default", "unlike", "the", "Java", "library", "methods", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L1339-L1346
Credntia/MVBarcodeReader
mvbarcodereader/src/main/java/devliving/online/mvbarcodereader/BarcodeGraphicTracker.java
BarcodeGraphicTracker.onNewItem
@Override public void onNewItem(int id, Barcode item) { mGraphic.setId(id); if (mListener != null) mListener.onNewBarcodeDetected(id, item); }
java
@Override public void onNewItem(int id, Barcode item) { mGraphic.setId(id); if (mListener != null) mListener.onNewBarcodeDetected(id, item); }
[ "@", "Override", "public", "void", "onNewItem", "(", "int", "id", ",", "Barcode", "item", ")", "{", "mGraphic", ".", "setId", "(", "id", ")", ";", "if", "(", "mListener", "!=", "null", ")", "mListener", ".", "onNewBarcodeDetected", "(", "id", ",", "ite...
Start tracking the detected item instance within the item overlay.
[ "Start", "tracking", "the", "detected", "item", "instance", "within", "the", "item", "overlay", "." ]
train
https://github.com/Credntia/MVBarcodeReader/blob/2a2561f1c3b4d4e3c046a341fbf23a31eabfda8d/mvbarcodereader/src/main/java/devliving/online/mvbarcodereader/BarcodeGraphicTracker.java#L50-L54
stratosphere/stratosphere
stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java
VertexCentricIteration.setInput
@Override public void setInput(DataSet<Tuple2<VertexKey, VertexValue>> inputData) { // sanity check that we really have two tuples TypeInformation<Tuple2<VertexKey, VertexValue>> inputType = inputData.getType(); Validate.isTrue(inputType.isTupleType() && inputType.getArity() == 2, "The input data set (the initial vertices) must consist of 2-tuples."); // check that the key type here is the same as for the edges TypeInformation<VertexKey> keyType = ((TupleTypeInfo<?>) inputType).getTypeAt(0); TypeInformation<?> edgeType = edgesWithoutValue != null ? edgesWithoutValue.getType() : edgesWithValue.getType(); TypeInformation<VertexKey> edgeKeyType = ((TupleTypeInfo<?>) edgeType).getTypeAt(0); Validate.isTrue(keyType.equals(edgeKeyType), "The first tuple field (the vertex id) of the input data set (the initial vertices) " + "must be the same data type as the first fields of the edge data set (the source vertex id). " + "Here, the key type for the vertex ids is '%s' and the key type for the edges is '%s'.", keyType, edgeKeyType); this.initialVertices = inputData; }
java
@Override public void setInput(DataSet<Tuple2<VertexKey, VertexValue>> inputData) { // sanity check that we really have two tuples TypeInformation<Tuple2<VertexKey, VertexValue>> inputType = inputData.getType(); Validate.isTrue(inputType.isTupleType() && inputType.getArity() == 2, "The input data set (the initial vertices) must consist of 2-tuples."); // check that the key type here is the same as for the edges TypeInformation<VertexKey> keyType = ((TupleTypeInfo<?>) inputType).getTypeAt(0); TypeInformation<?> edgeType = edgesWithoutValue != null ? edgesWithoutValue.getType() : edgesWithValue.getType(); TypeInformation<VertexKey> edgeKeyType = ((TupleTypeInfo<?>) edgeType).getTypeAt(0); Validate.isTrue(keyType.equals(edgeKeyType), "The first tuple field (the vertex id) of the input data set (the initial vertices) " + "must be the same data type as the first fields of the edge data set (the source vertex id). " + "Here, the key type for the vertex ids is '%s' and the key type for the edges is '%s'.", keyType, edgeKeyType); this.initialVertices = inputData; }
[ "@", "Override", "public", "void", "setInput", "(", "DataSet", "<", "Tuple2", "<", "VertexKey", ",", "VertexValue", ">", ">", "inputData", ")", "{", "// sanity check that we really have two tuples", "TypeInformation", "<", "Tuple2", "<", "VertexKey", ",", "VertexVal...
Sets the input data set for this operator. In the case of this operator this input data set represents the set of vertices with their initial state. @param inputData The input data set, which in the case of this operator represents the set of vertices with their initial state. @see eu.stratosphere.api.java.operators.CustomUnaryOperation#setInput(eu.stratosphere.api.java.DataSet)
[ "Sets", "the", "input", "data", "set", "for", "this", "operator", ".", "In", "the", "case", "of", "this", "operator", "this", "input", "data", "set", "represents", "the", "set", "of", "vertices", "with", "their", "initial", "state", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java#L244-L260
knowm/XChart
xchart/src/main/java/org/knowm/xchart/CSVExporter.java
CSVExporter.writeCSVRows
public static void writeCSVRows(XYSeries series, String path2Dir) { File newFile = new File(path2Dir + series.getName() + ".csv"); Writer out = null; try { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile), "UTF8")); String csv = join(series.getXData(), ",") + System.getProperty("line.separator"); out.write(csv); csv = join(series.getYData(), ",") + System.getProperty("line.separator"); out.write(csv); if (series.getExtraValues() != null) { csv = join(series.getExtraValues(), ",") + System.getProperty("line.separator"); out.write(csv); } } catch (Exception e) { e.printStackTrace(); } finally { if (out != null) { try { out.flush(); out.close(); } catch (IOException e) { // NOP } } } }
java
public static void writeCSVRows(XYSeries series, String path2Dir) { File newFile = new File(path2Dir + series.getName() + ".csv"); Writer out = null; try { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile), "UTF8")); String csv = join(series.getXData(), ",") + System.getProperty("line.separator"); out.write(csv); csv = join(series.getYData(), ",") + System.getProperty("line.separator"); out.write(csv); if (series.getExtraValues() != null) { csv = join(series.getExtraValues(), ",") + System.getProperty("line.separator"); out.write(csv); } } catch (Exception e) { e.printStackTrace(); } finally { if (out != null) { try { out.flush(); out.close(); } catch (IOException e) { // NOP } } } }
[ "public", "static", "void", "writeCSVRows", "(", "XYSeries", "series", ",", "String", "path2Dir", ")", "{", "File", "newFile", "=", "new", "File", "(", "path2Dir", "+", "series", ".", "getName", "(", ")", "+", "\".csv\"", ")", ";", "Writer", "out", "=", ...
Export a XYChart series into rows in a CSV file. @param series @param path2Dir - ex. "./path/to/directory/" *make sure you have the '/' on the end
[ "Export", "a", "XYChart", "series", "into", "rows", "in", "a", "CSV", "file", "." ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CSVExporter.java#L33-L60
xwiki/xwiki-rendering
xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/link/AbstractXHTMLLinkTypeRenderer.java
AbstractXHTMLLinkTypeRenderer.handleTargetAttribute
private void handleTargetAttribute(Map<String, String> anchorAttributes) { String target = anchorAttributes.get("target"); // Target can have these values: // // "_blank" which opens the link in a new window // "_self" which opens the link in the same window (default) // "_top" and "_parent" which control the top or the parent window of some frame // "frame-name" (it could be anything) which opens the link in the frame called "frame-name". // // "_self", "_top" and "_parent" are the only safe values. So we need to handle any other value... if (StringUtils.isNotBlank(target) && !"_self".equals(target) && !"_parent".equals(target) && !"_top".equals(target)) { List<String> relAttributes = new ArrayList<>(); // Parse the current values String relAttribute = anchorAttributes.get(REL); if (relAttribute != null) { relAttributes.addAll(Arrays.asList(relAttribute.split(" "))); } // Add the "noopener" attribute if (!relAttributes.contains(NOOPENER)) { relAttributes.add(NOOPENER); } // Add the "noreferrer" attribute if (!relAttributes.contains(NOREFERRER)) { relAttributes.add(NOREFERRER); } // Serialize the attributes if (!relAttributes.isEmpty()) { anchorAttributes.put(REL, String.join(" ", relAttributes)); } } }
java
private void handleTargetAttribute(Map<String, String> anchorAttributes) { String target = anchorAttributes.get("target"); // Target can have these values: // // "_blank" which opens the link in a new window // "_self" which opens the link in the same window (default) // "_top" and "_parent" which control the top or the parent window of some frame // "frame-name" (it could be anything) which opens the link in the frame called "frame-name". // // "_self", "_top" and "_parent" are the only safe values. So we need to handle any other value... if (StringUtils.isNotBlank(target) && !"_self".equals(target) && !"_parent".equals(target) && !"_top".equals(target)) { List<String> relAttributes = new ArrayList<>(); // Parse the current values String relAttribute = anchorAttributes.get(REL); if (relAttribute != null) { relAttributes.addAll(Arrays.asList(relAttribute.split(" "))); } // Add the "noopener" attribute if (!relAttributes.contains(NOOPENER)) { relAttributes.add(NOOPENER); } // Add the "noreferrer" attribute if (!relAttributes.contains(NOREFERRER)) { relAttributes.add(NOREFERRER); } // Serialize the attributes if (!relAttributes.isEmpty()) { anchorAttributes.put(REL, String.join(" ", relAttributes)); } } }
[ "private", "void", "handleTargetAttribute", "(", "Map", "<", "String", ",", "String", ">", "anchorAttributes", ")", "{", "String", "target", "=", "anchorAttributes", ".", "get", "(", "\"target\"", ")", ";", "// Target can have these values:", "//", "// \"_blank\" wh...
When a link is open in an other window or in an other frame, the loaded page has some restricted access to the parent window. Among other things, it has the ability to redirect it to an other page, which can lead to dangerous phishing attacks. See: https://mathiasbynens.github.io/rel-noopener/ or https://dev.to/phishing or https://jira.xwiki.org/browse/XRENDERING-462 To avoid this vulnerability, we automatically add the "noopener" value to the "rel" attribute of the anchor. But because Firefox does not handle it, we also need to add the "noreferer" value. @param anchorAttributes the anchor attributes (that going to be changed) @since 7.4.5 @since 8.2.2 @since 8.3M2
[ "When", "a", "link", "is", "open", "in", "an", "other", "window", "or", "in", "an", "other", "frame", "the", "loaded", "page", "has", "some", "restricted", "access", "to", "the", "parent", "window", ".", "Among", "other", "things", "it", "has", "the", ...
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/link/AbstractXHTMLLinkTypeRenderer.java#L180-L217
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getAccountAdjustments
public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type, final Adjustments.AdjustmentState state, final QueryParams params) { final String url = Account.ACCOUNT_RESOURCE + "/" + accountCode + Adjustments.ADJUSTMENTS_RESOURCE; if (type != null) params.put("type", type.getType()); if (state != null) params.put("state", state.getState()); return doGET(url, Adjustments.class, params); }
java
public Adjustments getAccountAdjustments(final String accountCode, final Adjustments.AdjustmentType type, final Adjustments.AdjustmentState state, final QueryParams params) { final String url = Account.ACCOUNT_RESOURCE + "/" + accountCode + Adjustments.ADJUSTMENTS_RESOURCE; if (type != null) params.put("type", type.getType()); if (state != null) params.put("state", state.getState()); return doGET(url, Adjustments.class, params); }
[ "public", "Adjustments", "getAccountAdjustments", "(", "final", "String", "accountCode", ",", "final", "Adjustments", ".", "AdjustmentType", "type", ",", "final", "Adjustments", ".", "AdjustmentState", "state", ",", "final", "QueryParams", "params", ")", "{", "final...
Get Account Adjustments <p> @param accountCode recurly account id @param type {@link com.ning.billing.recurly.model.Adjustments.AdjustmentType} @param state {@link com.ning.billing.recurly.model.Adjustments.AdjustmentState} @param params {@link QueryParams} @return the adjustments on the account
[ "Get", "Account", "Adjustments", "<p", ">" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L414-L421
mapbox/mapbox-plugins-android
plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/MapLocale.java
MapLocale.addMapLocale
public static void addMapLocale(@NonNull Locale locale, @NonNull MapLocale mapLocale) { LOCALE_SET.put(locale, mapLocale); }
java
public static void addMapLocale(@NonNull Locale locale, @NonNull MapLocale mapLocale) { LOCALE_SET.put(locale, mapLocale); }
[ "public", "static", "void", "addMapLocale", "(", "@", "NonNull", "Locale", "locale", ",", "@", "NonNull", "MapLocale", "mapLocale", ")", "{", "LOCALE_SET", ".", "put", "(", "locale", ",", "mapLocale", ")", ";", "}" ]
When creating a new MapLocale, you'll need to associate a {@link Locale} so that {@link Locale#getDefault()} will find the correct corresponding {@link MapLocale}. @param locale a valid {@link Locale} instance shares a 1 to 1 relationship with the {@link MapLocale} @param mapLocale the {@link MapLocale} which shares a 1 to 1 relationship with the {@link Locale} @since 0.1.0
[ "When", "creating", "a", "new", "MapLocale", "you", "ll", "need", "to", "associate", "a", "{", "@link", "Locale", "}", "so", "that", "{", "@link", "Locale#getDefault", "()", "}", "will", "find", "the", "correct", "corresponding", "{", "@link", "MapLocale", ...
train
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/MapLocale.java#L384-L386
couchbaselabs/couchbase-lite-java-forestdb
src/main/java/com/couchbase/lite/store/ForestBridge.java
ForestBridge.revisionObject
public static RevisionInternal revisionObject( Document doc, String docID, String revID, boolean withBody) { boolean deleted = doc.selectedRevDeleted(); if (revID == null) revID = doc.getSelectedRevID(); RevisionInternal rev = new RevisionInternal(docID, revID, deleted); rev.setSequence(doc.getSelectedSequence()); if (withBody) { Status status = loadBodyOfRevisionObject(rev, doc); if (status.isError() && status.getCode() != Status.GONE) return null; } return rev; }
java
public static RevisionInternal revisionObject( Document doc, String docID, String revID, boolean withBody) { boolean deleted = doc.selectedRevDeleted(); if (revID == null) revID = doc.getSelectedRevID(); RevisionInternal rev = new RevisionInternal(docID, revID, deleted); rev.setSequence(doc.getSelectedSequence()); if (withBody) { Status status = loadBodyOfRevisionObject(rev, doc); if (status.isError() && status.getCode() != Status.GONE) return null; } return rev; }
[ "public", "static", "RevisionInternal", "revisionObject", "(", "Document", "doc", ",", "String", "docID", ",", "String", "revID", ",", "boolean", "withBody", ")", "{", "boolean", "deleted", "=", "doc", ".", "selectedRevDeleted", "(", ")", ";", "if", "(", "re...
in CBLForestBridge.m + (CBL_MutableRevision*) revisionObjectFromForestDoc: (VersionedDocument&)doc revID: (NSString*)revID withBody: (BOOL)withBody
[ "in", "CBLForestBridge", ".", "m", "+", "(", "CBL_MutableRevision", "*", ")", "revisionObjectFromForestDoc", ":", "(", "VersionedDocument&", ")", "doc", "revID", ":", "(", "NSString", "*", ")", "revID", "withBody", ":", "(", "BOOL", ")", "withBody" ]
train
https://github.com/couchbaselabs/couchbase-lite-java-forestdb/blob/fd806b251dd7dcc7a76ab7a8db618e30c3419f06/src/main/java/com/couchbase/lite/store/ForestBridge.java#L40-L57
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java
CategoryGraph.getLCS
public Category getLCS(Category category1, Category category2) throws WikiApiException { return getLCS(category1.getPageId(),category2.getPageId()); }
java
public Category getLCS(Category category1, Category category2) throws WikiApiException { return getLCS(category1.getPageId(),category2.getPageId()); }
[ "public", "Category", "getLCS", "(", "Category", "category1", ",", "Category", "category2", ")", "throws", "WikiApiException", "{", "return", "getLCS", "(", "category1", ".", "getPageId", "(", ")", ",", "category2", ".", "getPageId", "(", ")", ")", ";", "}" ...
Gets the lowest common subsumer (LCS) of two nodes. The LCS of two nodes is first node on the path to the root, that has both nodes as sons. Nodes that are not in the same connected component as the root node are defined to have no LCS. @param category1 The first category node. @param category2 The second category node. @return The lowest common subsumer of the two nodes, or null if there is no LCS.
[ "Gets", "the", "lowest", "common", "subsumer", "(", "LCS", ")", "of", "two", "nodes", ".", "The", "LCS", "of", "two", "nodes", "is", "first", "node", "on", "the", "path", "to", "the", "root", "that", "has", "both", "nodes", "as", "sons", ".", "Nodes"...
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java#L397-L399
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/historic/AbstractChartBuilder.java
AbstractChartBuilder.addSubTitle
protected void addSubTitle(JFreeChart chart, String subTitle, Font font) { if (StringUtils.isNotEmpty(subTitle)) { TextTitle chartSubTitle = new TextTitle(subTitle); customizeTitle(chartSubTitle, font); chart.addSubtitle(chartSubTitle); } }
java
protected void addSubTitle(JFreeChart chart, String subTitle, Font font) { if (StringUtils.isNotEmpty(subTitle)) { TextTitle chartSubTitle = new TextTitle(subTitle); customizeTitle(chartSubTitle, font); chart.addSubtitle(chartSubTitle); } }
[ "protected", "void", "addSubTitle", "(", "JFreeChart", "chart", ",", "String", "subTitle", ",", "Font", "font", ")", "{", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "subTitle", ")", ")", "{", "TextTitle", "chartSubTitle", "=", "new", "TextTitle", "(",...
<p>addSubTitle.</p> @param chart a {@link org.jfree.chart.JFreeChart} object. @param subTitle a {@link java.lang.String} object. @param font a {@link java.awt.Font} object.
[ "<p", ">", "addSubTitle", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/historic/AbstractChartBuilder.java#L180-L188
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java
DepTreeNode.toStringTree
private void toStringTree(String indent, StringBuffer sb) { sb.append(toString()); if (children != null) { for (Entry<String, DepTreeNode> entry : children.entrySet()) { entry.getValue().toStringTree(indent + "\t", sb); //$NON-NLS-1$ } } }
java
private void toStringTree(String indent, StringBuffer sb) { sb.append(toString()); if (children != null) { for (Entry<String, DepTreeNode> entry : children.entrySet()) { entry.getValue().toStringTree(indent + "\t", sb); //$NON-NLS-1$ } } }
[ "private", "void", "toStringTree", "(", "String", "indent", ",", "StringBuffer", "sb", ")", "{", "sb", ".", "append", "(", "toString", "(", ")", ")", ";", "if", "(", "children", "!=", "null", ")", "{", "for", "(", "Entry", "<", "String", ",", "DepTre...
Prints the string representaton of the tree rooted at this node to the specified {@link StringBuffer}. @param indent String for indenting nodes @param sb The StringBuffer to output to
[ "Prints", "the", "string", "representaton", "of", "the", "tree", "rooted", "at", "this", "node", "to", "the", "specified", "{", "@link", "StringBuffer", "}", "." ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/deps/DepTreeNode.java#L569-L576
IBM-Cloud/gp-java-client
src/main/java/com/ibm/g11n/pipeline/iam/TokenLifeCycleManager.java
TokenLifeCycleManager.getInstance
static TokenLifeCycleManager getInstance(final String jsonCredentials) { final JsonObject credentials = new JsonParser().parse(jsonCredentials) .getAsJsonObject(); if(credentials.get("apikey")==null || credentials.get("apikey").isJsonNull()||credentials.get("apikey").getAsString().isEmpty()) { throw new IllegalArgumentException( "IAM API Key value is either not available, or null or is empty in credentials JSON."); } if(credentials.get("iam_endpoint")==null || credentials.get("iam_endpoint").isJsonNull()||credentials.get("iam_endpoint").getAsString().isEmpty()) { throw new IllegalArgumentException( "IAM endpoint Key value is either not available, or null or is empty in credentials JSON."); } final String apiKey = credentials.get("apikey").getAsString(); final String iamEndpoint = credentials.get("iam_endpoint").getAsString(); return getInstanceUnchecked(iamEndpoint, apiKey); }
java
static TokenLifeCycleManager getInstance(final String jsonCredentials) { final JsonObject credentials = new JsonParser().parse(jsonCredentials) .getAsJsonObject(); if(credentials.get("apikey")==null || credentials.get("apikey").isJsonNull()||credentials.get("apikey").getAsString().isEmpty()) { throw new IllegalArgumentException( "IAM API Key value is either not available, or null or is empty in credentials JSON."); } if(credentials.get("iam_endpoint")==null || credentials.get("iam_endpoint").isJsonNull()||credentials.get("iam_endpoint").getAsString().isEmpty()) { throw new IllegalArgumentException( "IAM endpoint Key value is either not available, or null or is empty in credentials JSON."); } final String apiKey = credentials.get("apikey").getAsString(); final String iamEndpoint = credentials.get("iam_endpoint").getAsString(); return getInstanceUnchecked(iamEndpoint, apiKey); }
[ "static", "TokenLifeCycleManager", "getInstance", "(", "final", "String", "jsonCredentials", ")", "{", "final", "JsonObject", "credentials", "=", "new", "JsonParser", "(", ")", ".", "parse", "(", "jsonCredentials", ")", ".", "getAsJsonObject", "(", ")", ";", "if...
Get an instance of TokenLifeCylceManager. Single instance is maintained for each unique pair of iamEndpoint and apiKey. The method and the returned instance is thread safe. @param jsonCredentials Credentials in JSON format. The credentials should at minimum have these <key>:<value> pairs in the credentials json: { "apikey":"<IAM_API_KEY>", "iam_endpoint":"<IAM_ENDPOINT>" } @return Instance of TokenLifeCylceManager.
[ "Get", "an", "instance", "of", "TokenLifeCylceManager", ".", "Single", "instance", "is", "maintained", "for", "each", "unique", "pair", "of", "iamEndpoint", "and", "apiKey", ".", "The", "method", "and", "the", "returned", "instance", "is", "thread", "safe", "....
train
https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/iam/TokenLifeCycleManager.java#L222-L237
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.updateSubregion
public static void updateSubregion(SynthContext state, Graphics g, Rectangle bounds) { paintRegion(state, g, bounds); }
java
public static void updateSubregion(SynthContext state, Graphics g, Rectangle bounds) { paintRegion(state, g, bounds); }
[ "public", "static", "void", "updateSubregion", "(", "SynthContext", "state", ",", "Graphics", "g", ",", "Rectangle", "bounds", ")", "{", "paintRegion", "(", "state", ",", "g", ",", "bounds", ")", ";", "}" ]
A convenience method that handles painting of the background for subregions. All SynthUI's that have subregions should invoke this method, than paint the foreground. @param state the SynthContext describing the component, region, and state. @param g the Graphics context used to paint the subregion. @param bounds the bounds to paint in.
[ "A", "convenience", "method", "that", "handles", "painting", "of", "the", "background", "for", "subregions", ".", "All", "SynthUI", "s", "that", "have", "subregions", "should", "invoke", "this", "method", "than", "paint", "the", "foreground", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2792-L2794
SUSE/salt-netapi-client
src/main/java/com/suse/salt/netapi/calls/modules/File.java
File.mkdir
public static LocalCall<String> mkdir(String path) { return mkdir(path, Optional.empty(), Optional.empty(), Optional.empty()); }
java
public static LocalCall<String> mkdir(String path) { return mkdir(path, Optional.empty(), Optional.empty(), Optional.empty()); }
[ "public", "static", "LocalCall", "<", "String", ">", "mkdir", "(", "String", "path", ")", "{", "return", "mkdir", "(", "path", ",", "Optional", ".", "empty", "(", ")", ",", "Optional", ".", "empty", "(", ")", ",", "Optional", ".", "empty", "(", ")", ...
Ensures that a directory is available @param path Path to directory @return The {@link LocalCall} object to make the call
[ "Ensures", "that", "a", "directory", "is", "available" ]
train
https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L240-L242
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java
CoverageDataCore.getCubicInterpolationValue
protected Double getCubicInterpolationValue(Double[] values, double offset) { Double value = null; if (values != null) { value = getCubicInterpolationValue(values[0], values[1], values[2], values[3], offset); } return value; }
java
protected Double getCubicInterpolationValue(Double[] values, double offset) { Double value = null; if (values != null) { value = getCubicInterpolationValue(values[0], values[1], values[2], values[3], offset); } return value; }
[ "protected", "Double", "getCubicInterpolationValue", "(", "Double", "[", "]", "values", ",", "double", "offset", ")", "{", "Double", "value", "=", "null", ";", "if", "(", "values", "!=", "null", ")", "{", "value", "=", "getCubicInterpolationValue", "(", "val...
Interpolate 4 values using the offset between value1 and value2 @param values coverage data values @param offset offset between the middle two pixels @return value coverage data value
[ "Interpolate", "4", "values", "using", "the", "offset", "between", "value1", "and", "value2" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1243-L1250
igniterealtime/Smack
smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java
ChatManager.createChat
public Chat createChat(EntityJid userJID, ChatMessageListener listener) { return createChat(userJID, null, listener); }
java
public Chat createChat(EntityJid userJID, ChatMessageListener listener) { return createChat(userJID, null, listener); }
[ "public", "Chat", "createChat", "(", "EntityJid", "userJID", ",", "ChatMessageListener", "listener", ")", "{", "return", "createChat", "(", "userJID", ",", "null", ",", "listener", ")", ";", "}" ]
Creates a new chat and returns it. @param userJID the user this chat is with. @param listener the optional listener which will listen for new messages from this chat. @return the created chat.
[ "Creates", "a", "new", "chat", "and", "returns", "it", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java#L235-L237
alkacon/opencms-core
src/org/opencms/ui/dialogs/permissions/CmsPermissionView.java
CmsPermissionView.isAllowed
protected Boolean isAllowed(CmsPermissionSet p, int value) { if ((p.getAllowedPermissions() & value) > 0) { return Boolean.TRUE; } return Boolean.FALSE; }
java
protected Boolean isAllowed(CmsPermissionSet p, int value) { if ((p.getAllowedPermissions() & value) > 0) { return Boolean.TRUE; } return Boolean.FALSE; }
[ "protected", "Boolean", "isAllowed", "(", "CmsPermissionSet", "p", ",", "int", "value", ")", "{", "if", "(", "(", "p", ".", "getAllowedPermissions", "(", ")", "&", "value", ")", ">", "0", ")", "{", "return", "Boolean", ".", "TRUE", ";", "}", "return", ...
Checks if a certain permission of a permission set is allowed.<p> @param p the current CmsPermissionSet @param value the int value of the permission to check @return true if the permission is allowed, otherwise false
[ "Checks", "if", "a", "certain", "permission", "of", "a", "permission", "set", "is", "allowed", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/permissions/CmsPermissionView.java#L414-L420
glyptodon/guacamole-client
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java
ModeledUser.asCalendar
private Calendar asCalendar(Calendar base, Time time) { // Get calendar from given SQL time Calendar timeCalendar = Calendar.getInstance(); timeCalendar.setTime(time); // Apply given time to base calendar base.set(Calendar.HOUR_OF_DAY, timeCalendar.get(Calendar.HOUR_OF_DAY)); base.set(Calendar.MINUTE, timeCalendar.get(Calendar.MINUTE)); base.set(Calendar.SECOND, timeCalendar.get(Calendar.SECOND)); base.set(Calendar.MILLISECOND, timeCalendar.get(Calendar.MILLISECOND)); return base; }
java
private Calendar asCalendar(Calendar base, Time time) { // Get calendar from given SQL time Calendar timeCalendar = Calendar.getInstance(); timeCalendar.setTime(time); // Apply given time to base calendar base.set(Calendar.HOUR_OF_DAY, timeCalendar.get(Calendar.HOUR_OF_DAY)); base.set(Calendar.MINUTE, timeCalendar.get(Calendar.MINUTE)); base.set(Calendar.SECOND, timeCalendar.get(Calendar.SECOND)); base.set(Calendar.MILLISECOND, timeCalendar.get(Calendar.MILLISECOND)); return base; }
[ "private", "Calendar", "asCalendar", "(", "Calendar", "base", ",", "Time", "time", ")", "{", "// Get calendar from given SQL time", "Calendar", "timeCalendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "timeCalendar", ".", "setTime", "(", "time", ")", ...
Converts a SQL Time to a Calendar, independently of time zone, using the given Calendar as a base. The time components will be copied to the given Calendar verbatim, leaving the date and time zone components of the given Calendar otherwise intact. @param base The Calendar object to use as a base for the conversion. @param time The SQL Time object containing the time components to be applied to the given Calendar. @return The given Calendar, now modified to represent the given time.
[ "Converts", "a", "SQL", "Time", "to", "a", "Calendar", "independently", "of", "time", "zone", "using", "the", "given", "Calendar", "as", "a", "base", ".", "The", "time", "components", "will", "be", "copied", "to", "the", "given", "Calendar", "verbatim", "l...
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java#L554-L568
TheHortonMachine/hortonmachine
dbs/src/main/java/jsqlite/Database.java
Database.get_table
public TableResult get_table( String sql, String args[] ) throws jsqlite.Exception { return get_table(sql, 0, args); }
java
public TableResult get_table( String sql, String args[] ) throws jsqlite.Exception { return get_table(sql, 0, args); }
[ "public", "TableResult", "get_table", "(", "String", "sql", ",", "String", "args", "[", "]", ")", "throws", "jsqlite", ".", "Exception", "{", "return", "get_table", "(", "sql", ",", "0", ",", "args", ")", ";", "}" ]
Convenience method to retrieve an entire result set into memory. @param sql the SQL statement to be executed @param args arguments for the SQL statement, '%q' substitution @return result set
[ "Convenience", "method", "to", "retrieve", "an", "entire", "result", "set", "into", "memory", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/jsqlite/Database.java#L375-L377
weld/core
environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/Listener.java
Listener.using
public static Listener using(BeanManager manager) { return new Listener(Collections.singletonList(initAction(WeldServletLifecycle.BEAN_MANAGER_ATTRIBUTE_NAME, manager))); }
java
public static Listener using(BeanManager manager) { return new Listener(Collections.singletonList(initAction(WeldServletLifecycle.BEAN_MANAGER_ATTRIBUTE_NAME, manager))); }
[ "public", "static", "Listener", "using", "(", "BeanManager", "manager", ")", "{", "return", "new", "Listener", "(", "Collections", ".", "singletonList", "(", "initAction", "(", "WeldServletLifecycle", ".", "BEAN_MANAGER_ATTRIBUTE_NAME", ",", "manager", ")", ")", "...
Creates a new Listener that uses the given {@link BeanManager} instead of initializing a new Weld container instance. @param manager the bean manager to be used @return a new Listener instance
[ "Creates", "a", "new", "Listener", "that", "uses", "the", "given", "{", "@link", "BeanManager", "}", "instead", "of", "initializing", "a", "new", "Weld", "container", "instance", "." ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/Listener.java#L61-L63
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRGearCursorController.java
GVRGearCursorController.setPosition
@Override public void setPosition(float x, float y, float z) { position.set(x, y, z); pickDir.set(x, y, z); pickDir.normalize(); invalidate(); }
java
@Override public void setPosition(float x, float y, float z) { position.set(x, y, z); pickDir.set(x, y, z); pickDir.normalize(); invalidate(); }
[ "@", "Override", "public", "void", "setPosition", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "position", ".", "set", "(", "x", ",", "y", ",", "z", ")", ";", "pickDir", ".", "set", "(", "x", ",", "y", ",", "z", ")", ";"...
Set the position of the pick ray. This function is used internally to update the pick ray with the new controller position. @param x the x value of the position. @param y the y value of the position. @param z the z value of the position.
[ "Set", "the", "position", "of", "the", "pick", "ray", ".", "This", "function", "is", "used", "internally", "to", "update", "the", "pick", "ray", "with", "the", "new", "controller", "position", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRGearCursorController.java#L338-L345
atteo/classindex
classindex/src/main/java/org/atteo/classindex/processor/ClassIndexProcessor.java
ClassIndexProcessor.indexSupertypes
private void indexSupertypes(TypeElement rootElement, TypeElement element) throws IOException { for (TypeMirror mirror : types.directSupertypes(element.asType())) { if (mirror.getKind() != TypeKind.DECLARED) { continue; } DeclaredType superType = (DeclaredType) mirror; TypeElement superTypeElement = (TypeElement) superType.asElement(); storeSubclass(superTypeElement, rootElement); for (AnnotationMirror annotationMirror : superTypeElement.getAnnotationMirrors()) { TypeElement annotationElement = (TypeElement) annotationMirror.getAnnotationType() .asElement(); if (hasAnnotation(annotationElement, Inherited.class)) { storeAnnotation(annotationElement, rootElement); } } indexSupertypes(rootElement, superTypeElement); } }
java
private void indexSupertypes(TypeElement rootElement, TypeElement element) throws IOException { for (TypeMirror mirror : types.directSupertypes(element.asType())) { if (mirror.getKind() != TypeKind.DECLARED) { continue; } DeclaredType superType = (DeclaredType) mirror; TypeElement superTypeElement = (TypeElement) superType.asElement(); storeSubclass(superTypeElement, rootElement); for (AnnotationMirror annotationMirror : superTypeElement.getAnnotationMirrors()) { TypeElement annotationElement = (TypeElement) annotationMirror.getAnnotationType() .asElement(); if (hasAnnotation(annotationElement, Inherited.class)) { storeAnnotation(annotationElement, rootElement); } } indexSupertypes(rootElement, superTypeElement); } }
[ "private", "void", "indexSupertypes", "(", "TypeElement", "rootElement", ",", "TypeElement", "element", ")", "throws", "IOException", "{", "for", "(", "TypeMirror", "mirror", ":", "types", ".", "directSupertypes", "(", "element", ".", "asType", "(", ")", ")", ...
Index super types for {@link IndexSubclasses} and any {@link IndexAnnotated} additionally accompanied by {@link Inherited}.
[ "Index", "super", "types", "for", "{" ]
train
https://github.com/atteo/classindex/blob/ad76c6bd8b4e84c594d94e48f466a095ffe2306a/classindex/src/main/java/org/atteo/classindex/processor/ClassIndexProcessor.java#L309-L331
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common.jsonwebkey/src/com/ibm/ws/security/common/jwk/impl/Jose4jRsaJWK.java
Jose4jRsaJWK.getInstance
public static Jose4jRsaJWK getInstance(int size, String alg, String use, String type) { String kid = RandomUtils.getRandomAlphaNumeric(KID_LENGTH); KeyPairGenerator keyGenerator = null; try { keyGenerator = KeyPairGenerator.getInstance("RSA"); } catch (NoSuchAlgorithmException e) { // This should not happen, since we hardcoded as "RSA" if (tc.isDebugEnabled()) { Tr.debug(tc, "Caught unexpected exception: " + e.getLocalizedMessage(), e); } return null; } keyGenerator.initialize(size); KeyPair keypair = keyGenerator.generateKeyPair(); RSAPublicKey pubKey = (RSAPublicKey) keypair.getPublic(); RSAPrivateKey priKey = (RSAPrivateKey) keypair.getPrivate(); Jose4jRsaJWK jwk = new Jose4jRsaJWK(pubKey); jwk.setPrivateKey(priKey); jwk.setAlgorithm(alg); jwk.setKeyId(kid); jwk.setUse((use == null) ? JwkConstants.sig : use); return jwk; }
java
public static Jose4jRsaJWK getInstance(int size, String alg, String use, String type) { String kid = RandomUtils.getRandomAlphaNumeric(KID_LENGTH); KeyPairGenerator keyGenerator = null; try { keyGenerator = KeyPairGenerator.getInstance("RSA"); } catch (NoSuchAlgorithmException e) { // This should not happen, since we hardcoded as "RSA" if (tc.isDebugEnabled()) { Tr.debug(tc, "Caught unexpected exception: " + e.getLocalizedMessage(), e); } return null; } keyGenerator.initialize(size); KeyPair keypair = keyGenerator.generateKeyPair(); RSAPublicKey pubKey = (RSAPublicKey) keypair.getPublic(); RSAPrivateKey priKey = (RSAPrivateKey) keypair.getPrivate(); Jose4jRsaJWK jwk = new Jose4jRsaJWK(pubKey); jwk.setPrivateKey(priKey); jwk.setAlgorithm(alg); jwk.setKeyId(kid); jwk.setUse((use == null) ? JwkConstants.sig : use); return jwk; }
[ "public", "static", "Jose4jRsaJWK", "getInstance", "(", "int", "size", ",", "String", "alg", ",", "String", "use", ",", "String", "type", ")", "{", "String", "kid", "=", "RandomUtils", ".", "getRandomAlphaNumeric", "(", "KID_LENGTH", ")", ";", "KeyPairGenerato...
generate a new JWK with the specified parameters @param size @param alg @param use @param type @return
[ "generate", "a", "new", "JWK", "with", "the", "specified", "parameters" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common.jsonwebkey/src/com/ibm/ws/security/common/jwk/impl/Jose4jRsaJWK.java#L60-L87
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java
LongTermRetentionBackupsInner.deleteAsync
public Observable<Void> deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { return deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deleteAsync(String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName, String backupName) { return deleteWithServiceResponseAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteAsync", "(", "String", "locationName", ",", "String", "longTermRetentionServerName", ",", "String", "longTermRetentionDatabaseName", ",", "String", "backupName", ")", "{", "return", "deleteWithServiceResponseAsync", "(", ...
Deletes a long term retention backup. @param locationName The location of the database @param longTermRetentionServerName the String value @param longTermRetentionDatabaseName the String value @param backupName The backup name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Deletes", "a", "long", "term", "retention", "backup", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java#L240-L247
alkacon/opencms-core
src/org/opencms/module/CmsModuleManager.java
CmsModuleManager.deleteModule
public synchronized void deleteModule(CmsObject cms, String moduleName, boolean replace, I_CmsReport report) throws CmsRoleViolationException, CmsConfigurationException, CmsLockException { deleteModule(cms, moduleName, replace, false, report); }
java
public synchronized void deleteModule(CmsObject cms, String moduleName, boolean replace, I_CmsReport report) throws CmsRoleViolationException, CmsConfigurationException, CmsLockException { deleteModule(cms, moduleName, replace, false, report); }
[ "public", "synchronized", "void", "deleteModule", "(", "CmsObject", "cms", ",", "String", "moduleName", ",", "boolean", "replace", ",", "I_CmsReport", "report", ")", "throws", "CmsRoleViolationException", ",", "CmsConfigurationException", ",", "CmsLockException", "{", ...
Deletes a module from the configuration.<p> @param cms must be initialized with "Admin" permissions @param moduleName the name of the module to delete @param replace indicates if the module is replaced (true) or finally deleted (false) @param report the report to print progress messages to @throws CmsRoleViolationException if the required module manager role permissions are not available @throws CmsConfigurationException if a module with this name is not available for deleting @throws CmsLockException if the module resources can not be locked
[ "Deletes", "a", "module", "from", "the", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleManager.java#L747-L751
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AttachmentVersioningResourcesImpl.java
AttachmentVersioningResourcesImpl.attachNewVersion
private Attachment attachNewVersion (long sheetId, long attachmentId, InputStream inputStream, String contentType, long contentLength, String attachmentName) throws SmartsheetException { return super.attachFile("sheets/"+ sheetId + "/attachments/"+ attachmentId +"/versions", inputStream, contentType, contentLength, attachmentName); }
java
private Attachment attachNewVersion (long sheetId, long attachmentId, InputStream inputStream, String contentType, long contentLength, String attachmentName) throws SmartsheetException { return super.attachFile("sheets/"+ sheetId + "/attachments/"+ attachmentId +"/versions", inputStream, contentType, contentLength, attachmentName); }
[ "private", "Attachment", "attachNewVersion", "(", "long", "sheetId", ",", "long", "attachmentId", ",", "InputStream", "inputStream", ",", "String", "contentType", ",", "long", "contentLength", ",", "String", "attachmentName", ")", "throws", "SmartsheetException", "{",...
Attach a new version of an attachment. It mirrors to the following Smartsheet REST API method: POST /attachment/{id}/versions @param sheetId the id of the sheet @param attachmentId the id of the object @param inputStream the {@link InputStream} of the file to attach @param contentType the content type of the file @param contentLength the size of the file in bytes. @param attachmentName the name of the file. @return the created attachment @throws IllegalArgumentException if any argument is null or empty string @throws InvalidRequestException if there is any problem with the REST API request @throws AuthorizationException if there is any problem with the REST API authorization (access token) @throws ResourceNotFoundException if the resource cannot be found @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting) @throws SmartsheetException if there is any other error during the operation
[ "Attach", "a", "new", "version", "of", "an", "attachment", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AttachmentVersioningResourcesImpl.java#L139-L142
baasbox/Android-SDK
library/src/main/java/com/baasbox/android/BaasDocument.java
BaasDocument.doCount
private static RequestToken doCount(String collection, BaasQuery.Criteria filter, int flags, final BaasHandler<Long> handler) { BaasBox box = BaasBox.getDefaultChecked(); filter = filter==null?BaasQuery.builder().count(true).criteria() :filter.buildUpon().count(true).criteria(); if (collection == null) throw new IllegalArgumentException("collection cannot be null"); Count count = new Count(box, collection, filter, flags, handler); return box.submitAsync(count); }
java
private static RequestToken doCount(String collection, BaasQuery.Criteria filter, int flags, final BaasHandler<Long> handler) { BaasBox box = BaasBox.getDefaultChecked(); filter = filter==null?BaasQuery.builder().count(true).criteria() :filter.buildUpon().count(true).criteria(); if (collection == null) throw new IllegalArgumentException("collection cannot be null"); Count count = new Count(box, collection, filter, flags, handler); return box.submitAsync(count); }
[ "private", "static", "RequestToken", "doCount", "(", "String", "collection", ",", "BaasQuery", ".", "Criteria", "filter", ",", "int", "flags", ",", "final", "BaasHandler", "<", "Long", ">", "handler", ")", "{", "BaasBox", "box", "=", "BaasBox", ".", "getDefa...
Asynchronously retrieves the number of documents readable to the user that match the <code>filter</code> in <code>collection</code> @param collection the collection to doCount not <code>null</code> @param filter a {@link BaasQuery.Criteria} to apply to the request. May be <code>null</code> @param handler a callback to be invoked with the result of the request @return a {@link com.baasbox.android.RequestToken} to handle the asynchronous request
[ "Asynchronously", "retrieves", "the", "number", "of", "documents", "readable", "to", "the", "user", "that", "match", "the", "<code", ">", "filter<", "/", "code", ">", "in", "<code", ">", "collection<", "/", "code", ">" ]
train
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L328-L337
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/cql/Cql.java
Cql.toStaticFilter
public static Filter toStaticFilter(String cqlExpression, Class clazz) throws ParseException { try { Parser p = new Parser( new Lexer( new PushbackReader(new StringReader(cqlExpression), 1024))); // Parse the input. Start tree = p.parse(); // Build the filter expression FilterExpressionBuilder builder = new FilterExpressionBuilder(); tree.apply(builder); // Wrap in a filter return new Filter(builder.getExp()); } catch(ParserException e) { ParseException parseException = new ParseException(e.getMessage(), e.getToken().getPos()); parseException.initCause(e); throw parseException; } catch (LexerException e) { ParseException parseException = new ParseException(e.getMessage(), 0); parseException.initCause(e); throw parseException; } catch (IOException e) { ParseException parseException = new ParseException(e.getMessage(), 0); parseException.initCause(e); throw parseException; } }
java
public static Filter toStaticFilter(String cqlExpression, Class clazz) throws ParseException { try { Parser p = new Parser( new Lexer( new PushbackReader(new StringReader(cqlExpression), 1024))); // Parse the input. Start tree = p.parse(); // Build the filter expression FilterExpressionBuilder builder = new FilterExpressionBuilder(); tree.apply(builder); // Wrap in a filter return new Filter(builder.getExp()); } catch(ParserException e) { ParseException parseException = new ParseException(e.getMessage(), e.getToken().getPos()); parseException.initCause(e); throw parseException; } catch (LexerException e) { ParseException parseException = new ParseException(e.getMessage(), 0); parseException.initCause(e); throw parseException; } catch (IOException e) { ParseException parseException = new ParseException(e.getMessage(), 0); parseException.initCause(e); throw parseException; } }
[ "public", "static", "Filter", "toStaticFilter", "(", "String", "cqlExpression", ",", "Class", "clazz", ")", "throws", "ParseException", "{", "try", "{", "Parser", "p", "=", "new", "Parser", "(", "new", "Lexer", "(", "new", "PushbackReader", "(", "new", "Stri...
Creates an executable object filter based on the given CQL expression. This filter is only applicable for the given class. @param cqlExpression The CQL expression. @param clazz The type for which to construct the filter. @return An object filter that behaves according to the given CQL expression. @throws java.text.ParseException When parsing fails for any reason (parser, lexer, IO)
[ "Creates", "an", "executable", "object", "filter", "based", "on", "the", "given", "CQL", "expression", ".", "This", "filter", "is", "only", "applicable", "for", "the", "given", "class", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/cql/Cql.java#L72-L104
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java
IOUtil.stringToFile
public void stringToFile(String content, String filename) throws IOException { stringToOutputStream(content, new FileOutputStream(filename)); }
java
public void stringToFile(String content, String filename) throws IOException { stringToOutputStream(content, new FileOutputStream(filename)); }
[ "public", "void", "stringToFile", "(", "String", "content", ",", "String", "filename", ")", "throws", "IOException", "{", "stringToOutputStream", "(", "content", ",", "new", "FileOutputStream", "(", "filename", ")", ")", ";", "}" ]
Save a string to a file. @param content the string to be written to file @param filename the full or relative path to the file.
[ "Save", "a", "string", "to", "a", "file", "." ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java#L73-L75
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java
MessageRetriever.printWarning
private void printWarning(SourcePosition pos, String msg) { configuration.root.printWarning(pos, msg); }
java
private void printWarning(SourcePosition pos, String msg) { configuration.root.printWarning(pos, msg); }
[ "private", "void", "printWarning", "(", "SourcePosition", "pos", ",", "String", "msg", ")", "{", "configuration", ".", "root", ".", "printWarning", "(", "pos", ",", "msg", ")", ";", "}" ]
Print warning message, increment warning count. @param pos the position of the source @param msg message to print
[ "Print", "warning", "message", "increment", "warning", "count", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java#L154-L156
alkacon/opencms-core
src/org/opencms/importexport/A_CmsImport.java
A_CmsImport.getChildElementTextValue
public String getChildElementTextValue(Element parentElement, String elementName) { try { // get the first child element matching the specified name Element childElement = (Element)parentElement.selectNodes("./" + elementName).get(0); // return the value of the child element return childElement.getTextTrim(); } catch (Exception e) { return null; } }
java
public String getChildElementTextValue(Element parentElement, String elementName) { try { // get the first child element matching the specified name Element childElement = (Element)parentElement.selectNodes("./" + elementName).get(0); // return the value of the child element return childElement.getTextTrim(); } catch (Exception e) { return null; } }
[ "public", "String", "getChildElementTextValue", "(", "Element", "parentElement", ",", "String", "elementName", ")", "{", "try", "{", "// get the first child element matching the specified name", "Element", "childElement", "=", "(", "Element", ")", "parentElement", ".", "s...
Returns the value of a child element with a specified name for a given parent element.<p> @param parentElement the parent element @param elementName the child element name @return the value of the child node, or null if something went wrong
[ "Returns", "the", "value", "of", "a", "child", "element", "with", "a", "specified", "name", "for", "a", "given", "parent", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/A_CmsImport.java#L323-L333
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/profile/DefaultOAuth20UserProfileDataCreator.java
DefaultOAuth20UserProfileDataCreator.finalizeProfileResponse
protected void finalizeProfileResponse(final AccessToken accessTokenTicket, final Map<String, Object> map, final Principal principal) { val service = accessTokenTicket.getService(); val registeredService = servicesManager.findServiceBy(service); if (registeredService instanceof OAuthRegisteredService) { val oauth = (OAuthRegisteredService) registeredService; map.put(OAuth20Constants.CLIENT_ID, oauth.getClientId()); map.put(CasProtocolConstants.PARAMETER_SERVICE, service.getId()); } }
java
protected void finalizeProfileResponse(final AccessToken accessTokenTicket, final Map<String, Object> map, final Principal principal) { val service = accessTokenTicket.getService(); val registeredService = servicesManager.findServiceBy(service); if (registeredService instanceof OAuthRegisteredService) { val oauth = (OAuthRegisteredService) registeredService; map.put(OAuth20Constants.CLIENT_ID, oauth.getClientId()); map.put(CasProtocolConstants.PARAMETER_SERVICE, service.getId()); } }
[ "protected", "void", "finalizeProfileResponse", "(", "final", "AccessToken", "accessTokenTicket", ",", "final", "Map", "<", "String", ",", "Object", ">", "map", ",", "final", "Principal", "principal", ")", "{", "val", "service", "=", "accessTokenTicket", ".", "g...
Finalize profile response. @param accessTokenTicket the access token ticket @param map the map @param principal the authentication principal
[ "Finalize", "profile", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/profile/DefaultOAuth20UserProfileDataCreator.java#L85-L93
apache/incubator-druid
core/src/main/java/org/apache/druid/collections/StupidPool.java
StupidPool.impossibleOffsetFailed
private void impossibleOffsetFailed(T object, ObjectId objectId, Cleaners.Cleanable cleanable, ObjectLeakNotifier notifier) { poolSize.decrementAndGet(); notifier.disable(); // Effectively does nothing, because notifier is disabled above. The purpose of this call is to deregister the // cleaner from the internal global linked list of all cleaners in the JVM, and let it be reclaimed itself. cleanable.clean(); log.error( new ISE("Queue offer failed"), "Could not offer object [%s] back into the queue, objectId [%s]", object, objectId ); }
java
private void impossibleOffsetFailed(T object, ObjectId objectId, Cleaners.Cleanable cleanable, ObjectLeakNotifier notifier) { poolSize.decrementAndGet(); notifier.disable(); // Effectively does nothing, because notifier is disabled above. The purpose of this call is to deregister the // cleaner from the internal global linked list of all cleaners in the JVM, and let it be reclaimed itself. cleanable.clean(); log.error( new ISE("Queue offer failed"), "Could not offer object [%s] back into the queue, objectId [%s]", object, objectId ); }
[ "private", "void", "impossibleOffsetFailed", "(", "T", "object", ",", "ObjectId", "objectId", ",", "Cleaners", ".", "Cleanable", "cleanable", ",", "ObjectLeakNotifier", "notifier", ")", "{", "poolSize", ".", "decrementAndGet", "(", ")", ";", "notifier", ".", "di...
This should be impossible, because {@link ConcurrentLinkedQueue#offer(Object)} event don't have `return false;` in it's body in OpenJDK 8.
[ "This", "should", "be", "impossible", "because", "{" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/collections/StupidPool.java#L163-L176
BlueBrain/bluima
modules/bluima_pdf/src/main/java/edu/psu/seersuite/extractors/tableextractor/Debug.java
Debug.printTableMeta
public static void printTableMeta(String outputDirPath, File pdfFile, String meta) { try { File middleDir = new File(outputDirPath, "metadata"); if (!middleDir.exists()) { middleDir.mkdirs(); } File tableMetaFile = new File(middleDir, pdfFile.getName() + ".metadata"); BufferedWriter bw0 = new BufferedWriter(new FileWriter(tableMetaFile)); //System.out.println(meta); bw0.write(meta); bw0.close(); } catch (IOException e){ System.out.printf("[Debug Error] IOException\n"); } }
java
public static void printTableMeta(String outputDirPath, File pdfFile, String meta) { try { File middleDir = new File(outputDirPath, "metadata"); if (!middleDir.exists()) { middleDir.mkdirs(); } File tableMetaFile = new File(middleDir, pdfFile.getName() + ".metadata"); BufferedWriter bw0 = new BufferedWriter(new FileWriter(tableMetaFile)); //System.out.println(meta); bw0.write(meta); bw0.close(); } catch (IOException e){ System.out.printf("[Debug Error] IOException\n"); } }
[ "public", "static", "void", "printTableMeta", "(", "String", "outputDirPath", ",", "File", "pdfFile", ",", "String", "meta", ")", "{", "try", "{", "File", "middleDir", "=", "new", "File", "(", "outputDirPath", ",", "\"metadata\"", ")", ";", "if", "(", "!",...
After detecting and extracting a table, this method enables us to save the table metadata file locally for later performance evaluation. @param outputDirPath the directory path where the middle-stage results will go to @param pdfFile the PDF file being processed @param meta the table metadata to be printed @throws IOException
[ "After", "detecting", "and", "extracting", "a", "table", "this", "method", "enables", "us", "to", "save", "the", "table", "metadata", "file", "locally", "for", "later", "performance", "evaluation", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/edu/psu/seersuite/extractors/tableextractor/Debug.java#L116-L131
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/GeomFactory1dfx.java
GeomFactory1dfx.newPoint
@SuppressWarnings("static-method") public Point1dfx newPoint(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) { return new Point1dfx(segment, x, y); }
java
@SuppressWarnings("static-method") public Point1dfx newPoint(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) { return new Point1dfx(segment, x, y); }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "public", "Point1dfx", "newPoint", "(", "ObjectProperty", "<", "WeakReference", "<", "Segment1D", "<", "?", ",", "?", ">", ">", ">", "segment", ",", "DoubleProperty", "x", ",", "DoubleProperty", "y", ")",...
Create a point with properties. @param segment the segment property. @param x the x property. @param y the y property. @return the point.
[ "Create", "a", "point", "with", "properties", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/GeomFactory1dfx.java#L104-L107
spring-projects/spring-social
spring-social-web/src/main/java/org/springframework/social/connect/web/ProviderSignInAttempt.java
ProviderSignInAttempt.addConnection
void addConnection(String userId, ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository connectionRepository) { connectionRepository.createConnectionRepository(userId).addConnection(getConnection(connectionFactoryLocator)); }
java
void addConnection(String userId, ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository connectionRepository) { connectionRepository.createConnectionRepository(userId).addConnection(getConnection(connectionFactoryLocator)); }
[ "void", "addConnection", "(", "String", "userId", ",", "ConnectionFactoryLocator", "connectionFactoryLocator", ",", "UsersConnectionRepository", "connectionRepository", ")", "{", "connectionRepository", ".", "createConnectionRepository", "(", "userId", ")", ".", "addConnectio...
Connect the new local user to the provider. @param userId the local user ID @param connectionFactoryLocator A {@link ConnectionFactoryLocator} used to lookup the connection @param connectionRepository a {@link UsersConnectionRepository} @throws DuplicateConnectionException if the user already has this connection
[ "Connect", "the", "new", "local", "user", "to", "the", "provider", "." ]
train
https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-web/src/main/java/org/springframework/social/connect/web/ProviderSignInAttempt.java#L66-L68
fuzzylite/jfuzzylite
jfuzzylite/src/main/java/com/fuzzylite/imex/Exporter.java
Exporter.toFile
public void toFile(File file, Engine engine) throws IOException { if (!file.createNewFile()) { FuzzyLite.logger().log(Level.FINE, "Replacing file: {0}", file.getAbsolutePath()); } BufferedWriter writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(file), FuzzyLite.UTF_8)); try { writer.write(toString(engine)); } catch (IOException ex) { throw ex; } finally { writer.close(); } }
java
public void toFile(File file, Engine engine) throws IOException { if (!file.createNewFile()) { FuzzyLite.logger().log(Level.FINE, "Replacing file: {0}", file.getAbsolutePath()); } BufferedWriter writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(file), FuzzyLite.UTF_8)); try { writer.write(toString(engine)); } catch (IOException ex) { throw ex; } finally { writer.close(); } }
[ "public", "void", "toFile", "(", "File", "file", ",", "Engine", "engine", ")", "throws", "IOException", "{", "if", "(", "!", "file", ".", "createNewFile", "(", ")", ")", "{", "FuzzyLite", ".", "logger", "(", ")", ".", "log", "(", "Level", ".", "FINE"...
Stores the string representation of the engine into the specified file @param file is the file to export the engine to @param engine is the engine to export @throws IOException if any problem occurs upon creation or writing to the file
[ "Stores", "the", "string", "representation", "of", "the", "engine", "into", "the", "specified", "file" ]
train
https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/imex/Exporter.java#L58-L71
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/AbstractApplicationPage.java
AbstractApplicationPage.createPageComponent
protected PageComponent createPageComponent(PageComponentDescriptor descriptor) { PageComponent pageComponent = descriptor.createPageComponent(); pageComponent.setContext(new DefaultViewContext(this, createPageComponentPane(pageComponent))); if (pageComponent instanceof ApplicationListener && getApplicationEventMulticaster() != null) { getApplicationEventMulticaster().addApplicationListener((ApplicationListener) pageComponent); } return pageComponent; }
java
protected PageComponent createPageComponent(PageComponentDescriptor descriptor) { PageComponent pageComponent = descriptor.createPageComponent(); pageComponent.setContext(new DefaultViewContext(this, createPageComponentPane(pageComponent))); if (pageComponent instanceof ApplicationListener && getApplicationEventMulticaster() != null) { getApplicationEventMulticaster().addApplicationListener((ApplicationListener) pageComponent); } return pageComponent; }
[ "protected", "PageComponent", "createPageComponent", "(", "PageComponentDescriptor", "descriptor", ")", "{", "PageComponent", "pageComponent", "=", "descriptor", ".", "createPageComponent", "(", ")", ";", "pageComponent", ".", "setContext", "(", "new", "DefaultViewContext...
Creates a PageComponent for the given PageComponentDescriptor. @param descriptor the descriptor @return the created PageComponent
[ "Creates", "a", "PageComponent", "for", "the", "given", "PageComponentDescriptor", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/AbstractApplicationPage.java#L363-L371
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java
CommonOps_DDF5.elementMult
public static void elementMult( DMatrix5 a , DMatrix5 b , DMatrix5 c ) { c.a1 = a.a1*b.a1; c.a2 = a.a2*b.a2; c.a3 = a.a3*b.a3; c.a4 = a.a4*b.a4; c.a5 = a.a5*b.a5; }
java
public static void elementMult( DMatrix5 a , DMatrix5 b , DMatrix5 c ) { c.a1 = a.a1*b.a1; c.a2 = a.a2*b.a2; c.a3 = a.a3*b.a3; c.a4 = a.a4*b.a4; c.a5 = a.a5*b.a5; }
[ "public", "static", "void", "elementMult", "(", "DMatrix5", "a", ",", "DMatrix5", "b", ",", "DMatrix5", "c", ")", "{", "c", ".", "a1", "=", "a", ".", "a1", "*", "b", ".", "a1", ";", "c", ".", "a2", "=", "a", ".", "a2", "*", "b", ".", "a2", ...
<p>Performs an element by element multiplication operation:<br> <br> c<sub>i</sub> = a<sub>i</sub> * b<sub>j</sub> <br> </p> @param a The left vector in the multiplication operation. Not modified. @param b The right vector in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "an", "element", "by", "element", "multiplication", "operation", ":", "<br", ">", "<br", ">", "c<sub", ">", "i<", "/", "sub", ">", "=", "a<sub", ">", "i<", "/", "sub", ">", "*", "b<sub", ">", "j<", "/", "sub", ">", "<br", "...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java#L1652-L1658
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/ValidatingStreamReader.java
ValidatingStreamReader.resolveExtSubsetPath
private URI resolveExtSubsetPath(String systemId) throws IOException { // Do we have a context to use for resolving? URL ctxt = (mInput == null) ? null : mInput.getSource(); /* Ok, either got a context or not; let's create the URL based on * the id, and optional context: */ if (ctxt == null) { /* Call will try to figure out if system id has the protocol * in it; if not, create a relative file, if it does, try to * resolve it. */ return URLUtil.uriFromSystemId(systemId); } URL url = URLUtil.urlFromSystemId(systemId, ctxt); try { return new URI(url.toExternalForm()); } catch (URISyntaxException e) { // should never occur... throw new IOException("Failed to construct URI for external subset, URL = "+url.toExternalForm()+": "+e.getMessage()); } }
java
private URI resolveExtSubsetPath(String systemId) throws IOException { // Do we have a context to use for resolving? URL ctxt = (mInput == null) ? null : mInput.getSource(); /* Ok, either got a context or not; let's create the URL based on * the id, and optional context: */ if (ctxt == null) { /* Call will try to figure out if system id has the protocol * in it; if not, create a relative file, if it does, try to * resolve it. */ return URLUtil.uriFromSystemId(systemId); } URL url = URLUtil.urlFromSystemId(systemId, ctxt); try { return new URI(url.toExternalForm()); } catch (URISyntaxException e) { // should never occur... throw new IOException("Failed to construct URI for external subset, URL = "+url.toExternalForm()+": "+e.getMessage()); } }
[ "private", "URI", "resolveExtSubsetPath", "(", "String", "systemId", ")", "throws", "IOException", "{", "// Do we have a context to use for resolving?", "URL", "ctxt", "=", "(", "mInput", "==", "null", ")", "?", "null", ":", "mInput", ".", "getSource", "(", ")", ...
Method called to resolve path to external DTD subset, given system identifier.
[ "Method", "called", "to", "resolve", "path", "to", "external", "DTD", "subset", "given", "system", "identifier", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/ValidatingStreamReader.java#L507-L528
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectFile.java
ProjectFile.getDuration
@Deprecated public Duration getDuration(Date startDate, Date endDate) throws MPXJException { return (getDuration("Standard", startDate, endDate)); }
java
@Deprecated public Duration getDuration(Date startDate, Date endDate) throws MPXJException { return (getDuration("Standard", startDate, endDate)); }
[ "@", "Deprecated", "public", "Duration", "getDuration", "(", "Date", "startDate", ",", "Date", "endDate", ")", "throws", "MPXJException", "{", "return", "(", "getDuration", "(", "\"Standard\"", ",", "startDate", ",", "endDate", ")", ")", ";", "}" ]
This method is used to calculate the duration of work between two fixed dates according to the work schedule defined in the named calendar. The calendar used is the "Standard" calendar. If this calendar does not exist, and exception will be thrown. @param startDate start of the period @param endDate end of the period @return new Duration object @throws MPXJException normally when no Standard calendar is available @deprecated use calendar.getDuration(startDate, endDate)
[ "This", "method", "is", "used", "to", "calculate", "the", "duration", "of", "work", "between", "two", "fixed", "dates", "according", "to", "the", "work", "schedule", "defined", "in", "the", "named", "calendar", ".", "The", "calendar", "used", "is", "the", ...
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectFile.java#L336-L339
apache/incubator-gobblin
gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/qualitychecker/InstrumentedRowLevelPolicyBase.java
InstrumentedRowLevelPolicyBase.afterCheck
public void afterCheck(Result result, long startTimeNanos) { switch (result) { case FAILED: Instrumented.markMeter(this.failedRecordsMeter); break; case PASSED: Instrumented.markMeter(this.passedRecordsMeter); break; default: } Instrumented.updateTimer(this.policyTimer, System.nanoTime() - startTimeNanos, TimeUnit.NANOSECONDS); }
java
public void afterCheck(Result result, long startTimeNanos) { switch (result) { case FAILED: Instrumented.markMeter(this.failedRecordsMeter); break; case PASSED: Instrumented.markMeter(this.passedRecordsMeter); break; default: } Instrumented.updateTimer(this.policyTimer, System.nanoTime() - startTimeNanos, TimeUnit.NANOSECONDS); }
[ "public", "void", "afterCheck", "(", "Result", "result", ",", "long", "startTimeNanos", ")", "{", "switch", "(", "result", ")", "{", "case", "FAILED", ":", "Instrumented", ".", "markMeter", "(", "this", ".", "failedRecordsMeter", ")", ";", "break", ";", "c...
Called after check is run. @param result result from check. @param startTimeNanos start time of check.
[ "Called", "after", "check", "is", "run", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/qualitychecker/InstrumentedRowLevelPolicyBase.java#L144-L156
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.makeSyntheticVar
private VarSymbol makeSyntheticVar(long flags, Name name, Type type, Symbol owner) { return new VarSymbol(flags | SYNTHETIC, name, type, owner); }
java
private VarSymbol makeSyntheticVar(long flags, Name name, Type type, Symbol owner) { return new VarSymbol(flags | SYNTHETIC, name, type, owner); }
[ "private", "VarSymbol", "makeSyntheticVar", "(", "long", "flags", ",", "Name", "name", ",", "Type", "type", ",", "Symbol", "owner", ")", "{", "return", "new", "VarSymbol", "(", "flags", "|", "SYNTHETIC", ",", "name", ",", "type", ",", "owner", ")", ";", ...
Create new synthetic variable with given flags, name, type, owner
[ "Create", "new", "synthetic", "variable", "with", "given", "flags", "name", "type", "owner" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L782-L784
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
ProxyFactory.setBeanInstance
public static <T> void setBeanInstance(String contextId, T proxy, BeanInstance beanInstance, Bean<?> bean) { if (proxy instanceof ProxyObject) { ProxyObject proxyView = (ProxyObject) proxy; proxyView.weld_setHandler(new ProxyMethodHandler(contextId, beanInstance, bean)); } }
java
public static <T> void setBeanInstance(String contextId, T proxy, BeanInstance beanInstance, Bean<?> bean) { if (proxy instanceof ProxyObject) { ProxyObject proxyView = (ProxyObject) proxy; proxyView.weld_setHandler(new ProxyMethodHandler(contextId, beanInstance, bean)); } }
[ "public", "static", "<", "T", ">", "void", "setBeanInstance", "(", "String", "contextId", ",", "T", "proxy", ",", "BeanInstance", "beanInstance", ",", "Bean", "<", "?", ">", "bean", ")", "{", "if", "(", "proxy", "instanceof", "ProxyObject", ")", "{", "Pr...
Convenience method to set the underlying bean instance for a proxy. @param proxy the proxy instance @param beanInstance the instance of the bean
[ "Convenience", "method", "to", "set", "the", "underlying", "bean", "instance", "for", "a", "proxy", "." ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L400-L405
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/CompressionUtil.java
CompressionUtil.decompress
public static File decompress(CompressionMethod _method, String _compressedFile, String _outputFileName) { if (_method == null || _compressedFile == null) { return null; } File inputFile = new File(_compressedFile); if (!inputFile.exists()) { return null; } try { Constructor<? extends InputStream> constructor = _method.getInputStreamClass().getConstructor(InputStream.class); if (constructor != null) { InputStream inputStream = constructor.newInstance(new FileInputStream(inputFile)); // write decompressed stream to new file Path destPath = Paths.get(_outputFileName); Files.copy(inputStream, destPath, StandardCopyOption.REPLACE_EXISTING); return destPath.toFile(); } } catch (IOException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException iOException) { LOGGER.error("Cannot uncompress file: ", iOException); } return null; }
java
public static File decompress(CompressionMethod _method, String _compressedFile, String _outputFileName) { if (_method == null || _compressedFile == null) { return null; } File inputFile = new File(_compressedFile); if (!inputFile.exists()) { return null; } try { Constructor<? extends InputStream> constructor = _method.getInputStreamClass().getConstructor(InputStream.class); if (constructor != null) { InputStream inputStream = constructor.newInstance(new FileInputStream(inputFile)); // write decompressed stream to new file Path destPath = Paths.get(_outputFileName); Files.copy(inputStream, destPath, StandardCopyOption.REPLACE_EXISTING); return destPath.toFile(); } } catch (IOException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException iOException) { LOGGER.error("Cannot uncompress file: ", iOException); } return null; }
[ "public", "static", "File", "decompress", "(", "CompressionMethod", "_method", ",", "String", "_compressedFile", ",", "String", "_outputFileName", ")", "{", "if", "(", "_method", "==", "null", "||", "_compressedFile", "==", "null", ")", "{", "return", "null", ...
Extract a file using the given {@link CompressionMethod}. @param _method @param _compressedFile @param _outputFileName @return file object which represents the uncompressed file or null on error
[ "Extract", "a", "file", "using", "the", "given", "{" ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/CompressionUtil.java#L63-L90
cycorp/api-suite
core-api/src/main/java/com/cyc/session/exception/SessionInitializationException.java
SessionInitializationException.fromThrowable
public static SessionInitializationException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionInitializationException && Objects.equals(message, cause.getMessage())) ? (SessionInitializationException) cause : new SessionInitializationException(message, cause); }
java
public static SessionInitializationException fromThrowable(String message, Throwable cause) { return (cause instanceof SessionInitializationException && Objects.equals(message, cause.getMessage())) ? (SessionInitializationException) cause : new SessionInitializationException(message, cause); }
[ "public", "static", "SessionInitializationException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "SessionInitializationException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ...
Converts a Throwable to a SessionInitializationException with the specified detail message. If the Throwable is a SessionInitializationException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new SessionInitializationException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a SessionInitializationException
[ "Converts", "a", "Throwable", "to", "a", "SessionInitializationException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "SessionInitializationException", "and", "if", "the", "Throwable", "s", "message", "is", "identical"...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionInitializationException.java#L62-L66
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java
IndexImage.getIndexedImage
public static BufferedImage getIndexedImage(BufferedImage pImage, IndexColorModel pColors, int pHints) { return getIndexedImage(pImage, pColors, null, pHints); }
java
public static BufferedImage getIndexedImage(BufferedImage pImage, IndexColorModel pColors, int pHints) { return getIndexedImage(pImage, pColors, null, pHints); }
[ "public", "static", "BufferedImage", "getIndexedImage", "(", "BufferedImage", "pImage", ",", "IndexColorModel", "pColors", ",", "int", "pHints", ")", "{", "return", "getIndexedImage", "(", "pImage", ",", "pColors", ",", "null", ",", "pHints", ")", ";", "}" ]
Converts the input image (must be {@code TYPE_INT_RGB} or {@code TYPE_INT_ARGB}) to an indexed image. Using the supplied {@code IndexColorModel}'s palette. Dithering, transparency and color selection is controlled with the {@code pHints}parameter. <p/> The image returned is a new image, the input image is not modified. @param pImage the BufferedImage to index @param pColors an {@code IndexColorModel} containing the color information @param pHints RenderingHints that control output quality and speed. @return the indexed BufferedImage. The image will be of type {@code BufferedImage.TYPE_BYTE_INDEXED} or {@code BufferedImage.TYPE_BYTE_BINARY}, and use an {@code IndexColorModel}. @see #DITHER_DIFFUSION @see #DITHER_NONE @see #COLOR_SELECTION_FAST @see #COLOR_SELECTION_QUALITY @see #TRANSPARENCY_OPAQUE @see #TRANSPARENCY_BITMASK @see BufferedImage#TYPE_BYTE_INDEXED @see BufferedImage#TYPE_BYTE_BINARY @see IndexColorModel
[ "Converts", "the", "input", "image", "(", "must", "be", "{", "@code", "TYPE_INT_RGB", "}", "or", "{", "@code", "TYPE_INT_ARGB", "}", ")", "to", "an", "indexed", "image", ".", "Using", "the", "supplied", "{", "@code", "IndexColorModel", "}", "s", "palette",...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java#L1122-L1124
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsEditMenuEntry.java
CmsEditMenuEntry.createEntryEditor
protected A_CmsPropertyEditor createEntryEditor( I_CmsPropertyEditorHandler handler, Map<String, CmsXmlContentProperty> propConfig) { if (CmsSitemapView.getInstance().isNavigationMode()) { return new CmsNavModePropertyEditor(propConfig, handler); } else { boolean isFolder = handler.isFolder(); CmsVfsModePropertyEditor result = new CmsVfsModePropertyEditor(propConfig, handler); result.setShowResourceProperties(!isFolder); return result; } }
java
protected A_CmsPropertyEditor createEntryEditor( I_CmsPropertyEditorHandler handler, Map<String, CmsXmlContentProperty> propConfig) { if (CmsSitemapView.getInstance().isNavigationMode()) { return new CmsNavModePropertyEditor(propConfig, handler); } else { boolean isFolder = handler.isFolder(); CmsVfsModePropertyEditor result = new CmsVfsModePropertyEditor(propConfig, handler); result.setShowResourceProperties(!isFolder); return result; } }
[ "protected", "A_CmsPropertyEditor", "createEntryEditor", "(", "I_CmsPropertyEditorHandler", "handler", ",", "Map", "<", "String", ",", "CmsXmlContentProperty", ">", "propConfig", ")", "{", "if", "(", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "isNavigationMo...
Creates the right sitemap entry editor for the current mode.<p> @param handler the entry editor handler @param propConfig the property configuration to use @return a sitemap entry editor instance
[ "Creates", "the", "right", "sitemap", "entry", "editor", "for", "the", "current", "mode", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/hoverbar/CmsEditMenuEntry.java#L202-L214
google/closure-templates
java/src/com/google/template/soy/jbcsrc/runtime/JbcSrcRuntime.java
JbcSrcRuntime.propagateClose
public static ClosePropagatingAppendable propagateClose( LoggingAdvisingAppendable delegate, ImmutableList<Closeable> closeables) { return new ClosePropagatingAppendable(delegate, closeables); }
java
public static ClosePropagatingAppendable propagateClose( LoggingAdvisingAppendable delegate, ImmutableList<Closeable> closeables) { return new ClosePropagatingAppendable(delegate, closeables); }
[ "public", "static", "ClosePropagatingAppendable", "propagateClose", "(", "LoggingAdvisingAppendable", "delegate", ",", "ImmutableList", "<", "Closeable", ">", "closeables", ")", "{", "return", "new", "ClosePropagatingAppendable", "(", "delegate", ",", "closeables", ")", ...
Returns a {@link LoggingAdvisingAppendable} that: <ul> <li>Forwards all {@link LoggingAdvisingAppendable} methods to {@code delegate} <li>Implements {@link Closeable} and forwards all {@link Closeable#close} calls to the given closeables in order. </ul> <p>This strategy allows us to make certain directives closeable without requiring them all to be since this wrapper can propagate the close signals in the rare case that a closeable directive is wrapped with a non closeable one (or multiple closeable wrappers are composed)
[ "Returns", "a", "{", "@link", "LoggingAdvisingAppendable", "}", "that", ":" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/runtime/JbcSrcRuntime.java#L736-L739
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/WePayApi.java
WePayApi.getAuthorizationUri
public String getAuthorizationUri(List<Scope> scopes, String redirectUri, String state, String userName, String userEmail) { // this method must use www instead of just naked domain for security reasons. String host = key.isProduction() ? "https://www.wepay.com" : "https://stage.wepay.com"; String uri = host + "/v2/oauth2/authorize?"; uri += "client_id=" + urlEncode(key.getClientId()) + "&"; uri += "redirect_uri=" + urlEncode(redirectUri) + "&"; uri += "scope=" + urlEncode(StringUtils.join(scopes, ",")); if (state != null || userName != null || userEmail != null) uri += "&"; uri += state != null ? "state=" + urlEncode(state) + "&" : ""; uri += userName != null ? "user_name=" + urlEncode(userName) + "&" : ""; uri += userEmail != null ? "user_email=" + urlEncode(userEmail) : ""; return uri; }
java
public String getAuthorizationUri(List<Scope> scopes, String redirectUri, String state, String userName, String userEmail) { // this method must use www instead of just naked domain for security reasons. String host = key.isProduction() ? "https://www.wepay.com" : "https://stage.wepay.com"; String uri = host + "/v2/oauth2/authorize?"; uri += "client_id=" + urlEncode(key.getClientId()) + "&"; uri += "redirect_uri=" + urlEncode(redirectUri) + "&"; uri += "scope=" + urlEncode(StringUtils.join(scopes, ",")); if (state != null || userName != null || userEmail != null) uri += "&"; uri += state != null ? "state=" + urlEncode(state) + "&" : ""; uri += userName != null ? "user_name=" + urlEncode(userName) + "&" : ""; uri += userEmail != null ? "user_email=" + urlEncode(userEmail) : ""; return uri; }
[ "public", "String", "getAuthorizationUri", "(", "List", "<", "Scope", ">", "scopes", ",", "String", "redirectUri", ",", "String", "state", ",", "String", "userName", ",", "String", "userEmail", ")", "{", "// this method must use www instead of just naked domain for secu...
Generate URI used during oAuth authorization Redirect your user to this URI where they can grant your application permission to make API calls @see <a href="https://www.wepay.com/developer/reference/oauth2">https://www.wepay.com/developer/reference/oauth2</a> @param scopes List of scope fields for which your application wants access @param redirectUri Where user goes after logging in at WePay (domain must match application settings) @param userName user_name,user_email which will be pre-filled on login form, state to be returned in querystring of redirect_uri @return string URI to which you must redirect your user to grant access to your application
[ "Generate", "URI", "used", "during", "oAuth", "authorization", "Redirect", "your", "user", "to", "this", "URI", "where", "they", "can", "grant", "your", "application", "permission", "to", "make", "API", "calls" ]
train
https://github.com/lookfirst/WePay-Java-SDK/blob/3c0a47d6fa051d531c8fdbbfd54a0ef2891aa8f0/src/main/java/com/lookfirst/wepay/WePayApi.java#L176-L191
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java
MyImageUtils.resizeToHeight
public static BufferedImage resizeToHeight(BufferedImage originalImage, int heightOut) { int width = originalImage.getWidth(); int height = originalImage.getHeight(); int heightPercent = (heightOut * 100) / height; int newWidth = (width * heightPercent) / 100; BufferedImage resizedImage = new BufferedImage(newWidth, heightOut, BufferedImage.TYPE_INT_ARGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(originalImage, 0, 0, newWidth, heightOut, null); g.dispose(); return resizedImage; }
java
public static BufferedImage resizeToHeight(BufferedImage originalImage, int heightOut) { int width = originalImage.getWidth(); int height = originalImage.getHeight(); int heightPercent = (heightOut * 100) / height; int newWidth = (width * heightPercent) / 100; BufferedImage resizedImage = new BufferedImage(newWidth, heightOut, BufferedImage.TYPE_INT_ARGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(originalImage, 0, 0, newWidth, heightOut, null); g.dispose(); return resizedImage; }
[ "public", "static", "BufferedImage", "resizeToHeight", "(", "BufferedImage", "originalImage", ",", "int", "heightOut", ")", "{", "int", "width", "=", "originalImage", ".", "getWidth", "(", ")", ";", "int", "height", "=", "originalImage", ".", "getHeight", "(", ...
Resizes an image to the specified height, changing width in the same proportion @param originalImage Image in memory @param heightOut The height to resize @return New Image in memory
[ "Resizes", "an", "image", "to", "the", "specified", "height", "changing", "width", "in", "the", "same", "proportion" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyImageUtils.java#L165-L182
jblas-project/jblas
src/main/java/org/jblas/Singular.java
Singular.SVDValues
public static FloatMatrix SVDValues(FloatMatrix A) { int m = A.rows; int n = A.columns; FloatMatrix S = new FloatMatrix(min(m, n)); int info = NativeBlas.sgesvd('N', 'N', m, n, A.dup().data, 0, m, S.data, 0, null, 0, 1, null, 0, 1); if (info > 0) { throw new LapackConvergenceException("GESVD", info + " superdiagonals of an intermediate bidiagonal form failed to converge."); } return S; }
java
public static FloatMatrix SVDValues(FloatMatrix A) { int m = A.rows; int n = A.columns; FloatMatrix S = new FloatMatrix(min(m, n)); int info = NativeBlas.sgesvd('N', 'N', m, n, A.dup().data, 0, m, S.data, 0, null, 0, 1, null, 0, 1); if (info > 0) { throw new LapackConvergenceException("GESVD", info + " superdiagonals of an intermediate bidiagonal form failed to converge."); } return S; }
[ "public", "static", "FloatMatrix", "SVDValues", "(", "FloatMatrix", "A", ")", "{", "int", "m", "=", "A", ".", "rows", ";", "int", "n", "=", "A", ".", "columns", ";", "FloatMatrix", "S", "=", "new", "FloatMatrix", "(", "min", "(", "m", ",", "n", ")"...
Compute the singular values of a matrix. @param A FloatMatrix of dimension m * n @return A min(m, n) vector of singular values.
[ "Compute", "the", "singular", "values", "of", "a", "matrix", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Singular.java#L263-L275
apache/flink
flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java
KvStateSerializer.deserializeValue
public static <T> T deserializeValue(byte[] serializedValue, TypeSerializer<T> serializer) throws IOException { if (serializedValue == null) { return null; } else { final DataInputDeserializer deser = new DataInputDeserializer( serializedValue, 0, serializedValue.length); final T value = serializer.deserialize(deser); if (deser.available() > 0) { throw new IOException( "Unconsumed bytes in the deserialized value. " + "This indicates a mismatch in the value serializers " + "used by the KvState instance and this access."); } return value; } }
java
public static <T> T deserializeValue(byte[] serializedValue, TypeSerializer<T> serializer) throws IOException { if (serializedValue == null) { return null; } else { final DataInputDeserializer deser = new DataInputDeserializer( serializedValue, 0, serializedValue.length); final T value = serializer.deserialize(deser); if (deser.available() > 0) { throw new IOException( "Unconsumed bytes in the deserialized value. " + "This indicates a mismatch in the value serializers " + "used by the KvState instance and this access."); } return value; } }
[ "public", "static", "<", "T", ">", "T", "deserializeValue", "(", "byte", "[", "]", "serializedValue", ",", "TypeSerializer", "<", "T", ">", "serializer", ")", "throws", "IOException", "{", "if", "(", "serializedValue", "==", "null", ")", "{", "return", "nu...
Deserializes the value with the given serializer. @param serializedValue Serialized value of type T @param serializer Serializer for T @param <T> Type of the value @return Deserialized value or <code>null</code> if the serialized value is <code>null</code> @throws IOException On failure during deserialization
[ "Deserializes", "the", "value", "with", "the", "given", "serializer", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java#L145-L160
iipc/webarchive-commons
src/main/java/org/archive/util/TextUtils.java
TextUtils.writeEscapedForHTML
public static void writeEscapedForHTML(String s, Writer w) throws IOException { PrintWriter out = new PrintWriter(w); BufferedReader reader = new BufferedReader(new StringReader(s)); String line; while((line=reader.readLine()) != null){ out.println(StringEscapeUtils.escapeHtml(line)); } }
java
public static void writeEscapedForHTML(String s, Writer w) throws IOException { PrintWriter out = new PrintWriter(w); BufferedReader reader = new BufferedReader(new StringReader(s)); String line; while((line=reader.readLine()) != null){ out.println(StringEscapeUtils.escapeHtml(line)); } }
[ "public", "static", "void", "writeEscapedForHTML", "(", "String", "s", ",", "Writer", "w", ")", "throws", "IOException", "{", "PrintWriter", "out", "=", "new", "PrintWriter", "(", "w", ")", ";", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", ...
Utility method for writing a (potentially large) String to a JspWriter, escaping it for HTML display, without constructing another large String of the whole content. @param s String to write @param out destination JspWriter @throws IOException
[ "Utility", "method", "for", "writing", "a", "(", "potentially", "large", ")", "String", "to", "a", "JspWriter", "escaping", "it", "for", "HTML", "display", "without", "constructing", "another", "large", "String", "of", "the", "whole", "content", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/TextUtils.java#L236-L244
agapsys/embedded-servlet-container
src/main/java/com/agapsys/jee/AbstractFileServlet.java
AbstractFileServlet.onUncaughtException
protected void onUncaughtException(HttpServletRequest request, HttpServletResponse response, RuntimeException error) throws IOException { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); response.getWriter().print(__getStackTrace(error)); }
java
protected void onUncaughtException(HttpServletRequest request, HttpServletResponse response, RuntimeException error) throws IOException { response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); response.getWriter().print(__getStackTrace(error)); }
[ "protected", "void", "onUncaughtException", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "RuntimeException", "error", ")", "throws", "IOException", "{", "response", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_INTERNAL_SERVE...
Called if an uncaught error was detected while processing given request. Default implementation just sends a {@linkplain HttpServletResponse#SC_INTERNAL_SERVER_ERROR} status and the error stack trace embedded in response body. @param request HTTP request. @param response HTTP response. @param error uncaught error. @throws IOException
[ "Called", "if", "an", "uncaught", "error", "was", "detected", "while", "processing", "given", "request", ".", "Default", "implementation", "just", "sends", "a", "{", "@linkplain", "HttpServletResponse#SC_INTERNAL_SERVER_ERROR", "}", "status", "and", "the", "error", ...
train
https://github.com/agapsys/embedded-servlet-container/blob/28314a2600ad8550ed2c901d8e35d86583c26bb0/src/main/java/com/agapsys/jee/AbstractFileServlet.java#L1331-L1334
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/csv/internal/CsvParser.java
CsvParser.isNextCharacterEscapable
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) { return inQuotes // we are in quotes, therefore there can be escaped // quotes in here. && nextLine.length() > (i + 1) // there is indeed another // character to check. && (format.isDelimiter(nextLine.charAt(i + 1)) || format.isEscape(nextLine.charAt(i + 1))); }
java
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) { return inQuotes // we are in quotes, therefore there can be escaped // quotes in here. && nextLine.length() > (i + 1) // there is indeed another // character to check. && (format.isDelimiter(nextLine.charAt(i + 1)) || format.isEscape(nextLine.charAt(i + 1))); }
[ "protected", "boolean", "isNextCharacterEscapable", "(", "String", "nextLine", ",", "boolean", "inQuotes", ",", "int", "i", ")", "{", "return", "inQuotes", "// we are in quotes, therefore there can be escaped", "// quotes in here.", "&&", "nextLine", ".", "length", "(", ...
precondition: the current character is an escape @param nextLine the current line @param inQuotes true if the current context is quoted @param i current index in line @return true if the following character is a quote
[ "precondition", ":", "the", "current", "character", "is", "an", "escape" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/csv/internal/CsvParser.java#L218-L224
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
SkbShellFactory.newShell
public static SkbShell newShell(String id, boolean useConsole){ return SkbShellFactory.newShell(id, null, useConsole); }
java
public static SkbShell newShell(String id, boolean useConsole){ return SkbShellFactory.newShell(id, null, useConsole); }
[ "public", "static", "SkbShell", "newShell", "(", "String", "id", ",", "boolean", "useConsole", ")", "{", "return", "SkbShellFactory", ".", "newShell", "(", "id", ",", "null", ",", "useConsole", ")", ";", "}" ]
Returns a new shell with given identifier and console flag with standard STGroup. @param id new shell with identifier, uses default if given STG is not valid @param useConsole flag to use (true) or not to use (false) console, of false then no output will happen @return new shell
[ "Returns", "a", "new", "shell", "with", "given", "identifier", "and", "console", "flag", "with", "standard", "STGroup", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L75-L77
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspDateSeriesBean.java
CmsJspDateSeriesBean.getParentSeries
public CmsJspDateSeriesBean getParentSeries() { if ((m_parentSeries == null) && getIsExtractedDate()) { CmsObject cms = m_value.getCmsObject(); try { CmsResource res = cms.readResource(m_seriesDefinition.getParentSeriesId()); CmsJspContentAccessBean content = new CmsJspContentAccessBean(cms, m_value.getLocale(), res); CmsJspContentAccessValueWrapper value = content.getValue().get(m_value.getPath()); return new CmsJspDateSeriesBean(value, m_locale); } catch (NullPointerException | CmsException e) { LOG.warn("Parent series with id " + m_seriesDefinition.getParentSeriesId() + " could not be read.", e); } } return null; }
java
public CmsJspDateSeriesBean getParentSeries() { if ((m_parentSeries == null) && getIsExtractedDate()) { CmsObject cms = m_value.getCmsObject(); try { CmsResource res = cms.readResource(m_seriesDefinition.getParentSeriesId()); CmsJspContentAccessBean content = new CmsJspContentAccessBean(cms, m_value.getLocale(), res); CmsJspContentAccessValueWrapper value = content.getValue().get(m_value.getPath()); return new CmsJspDateSeriesBean(value, m_locale); } catch (NullPointerException | CmsException e) { LOG.warn("Parent series with id " + m_seriesDefinition.getParentSeriesId() + " could not be read.", e); } } return null; }
[ "public", "CmsJspDateSeriesBean", "getParentSeries", "(", ")", "{", "if", "(", "(", "m_parentSeries", "==", "null", ")", "&&", "getIsExtractedDate", "(", ")", ")", "{", "CmsObject", "cms", "=", "m_value", ".", "getCmsObject", "(", ")", ";", "try", "{", "Cm...
Returns the parent series, if it is present, otherwise <code>null</code>.<p> @return the parent series, if it is present, otherwise <code>null</code>
[ "Returns", "the", "parent", "series", "if", "it", "is", "present", "otherwise", "<code", ">", "null<", "/", "code", ">", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspDateSeriesBean.java#L293-L308
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/Stream.java
Stream.parallelConcatt
public static <T> Stream<T> parallelConcatt(final Collection<? extends Iterator<? extends T>> c, final int readThreadNum) { return parallelConcatt(c, readThreadNum, calculateQueueSize(c.size())); }
java
public static <T> Stream<T> parallelConcatt(final Collection<? extends Iterator<? extends T>> c, final int readThreadNum) { return parallelConcatt(c, readThreadNum, calculateQueueSize(c.size())); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "parallelConcatt", "(", "final", "Collection", "<", "?", "extends", "Iterator", "<", "?", "extends", "T", ">", ">", "c", ",", "final", "int", "readThreadNum", ")", "{", "return", "parallelConcat...
Put the stream in try-catch to stop the back-end reading thread if error happens <br /> <code> try (Stream<Integer> stream = Stream.parallelConcat(a,b, ...)) { stream.forEach(N::println); } </code> @param c @param readThreadNum @return
[ "Put", "the", "stream", "in", "try", "-", "catch", "to", "stop", "the", "back", "-", "end", "reading", "thread", "if", "error", "happens", "<br", "/", ">", "<code", ">", "try", "(", "Stream<Integer", ">", "stream", "=", "Stream", ".", "parallelConcat", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Stream.java#L4408-L4410
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeap.java
ByteBufferMinMaxOffsetHeap.findMinGrandChild
private int findMinGrandChild(Comparator comparator, int index) { int leftChildIndex = getLeftChildIndex(index); if (leftChildIndex < 0) { return -1; } return findMin(comparator, getLeftChildIndex(leftChildIndex), 4); }
java
private int findMinGrandChild(Comparator comparator, int index) { int leftChildIndex = getLeftChildIndex(index); if (leftChildIndex < 0) { return -1; } return findMin(comparator, getLeftChildIndex(leftChildIndex), 4); }
[ "private", "int", "findMinGrandChild", "(", "Comparator", "comparator", ",", "int", "index", ")", "{", "int", "leftChildIndex", "=", "getLeftChildIndex", "(", "index", ")", ";", "if", "(", "leftChildIndex", "<", "0", ")", "{", "return", "-", "1", ";", "}",...
Returns the minimum grand child or -1 if no grand child exists.
[ "Returns", "the", "minimum", "grand", "child", "or", "-", "1", "if", "no", "grand", "child", "exists", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/epinephelinae/ByteBufferMinMaxOffsetHeap.java#L383-L390
UrielCh/ovh-java-sdk
ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java
ApiOvhPrice.xdsl_addressMove_fee_option_GET
public OvhPrice xdsl_addressMove_fee_option_GET(net.minidev.ovh.api.price.xdsl.addressmove.OvhFeeEnum option) throws IOException { String qPath = "/price/xdsl/addressMove/fee/{option}"; StringBuilder sb = path(qPath, option); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
java
public OvhPrice xdsl_addressMove_fee_option_GET(net.minidev.ovh.api.price.xdsl.addressmove.OvhFeeEnum option) throws IOException { String qPath = "/price/xdsl/addressMove/fee/{option}"; StringBuilder sb = path(qPath, option); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
[ "public", "OvhPrice", "xdsl_addressMove_fee_option_GET", "(", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "price", ".", "xdsl", ".", "addressmove", ".", "OvhFeeEnum", "option", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/price/xdsl/add...
Get the price of address move option fee REST: GET /price/xdsl/addressMove/fee/{option} @param option [required] The option name
[ "Get", "the", "price", "of", "address", "move", "option", "fee" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L37-L42
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonConsoleRequestProcessor.java
SimonConsoleRequestProcessor.processRequest
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String path = request.getRequestURI().substring(request.getContextPath().length() + urlPrefix.length()); ActionContext actionContext = new ActionContext(request, response, path); actionContext.setManager(manager); actionContext.setPluginManager(pluginManager); processContext(actionContext); }
java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String path = request.getRequestURI().substring(request.getContextPath().length() + urlPrefix.length()); ActionContext actionContext = new ActionContext(request, response, path); actionContext.setManager(manager); actionContext.setPluginManager(pluginManager); processContext(actionContext); }
[ "protected", "void", "processRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "String", "path", "=", "request", ".", "getRequestURI", "(", ")", ".", "substring", "(", ...
Processes requests for both HTTP {@code GET} and {@code POST} methods. @param request servlet request @param response servlet response @throws javax.servlet.ServletException if a servlet-specific error occurs @throws java.io.IOException if an I/O error occurs
[ "Processes", "requests", "for", "both", "HTTP", "{", "@code", "GET", "}", "and", "{", "@code", "POST", "}", "methods", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonConsoleRequestProcessor.java#L206-L214
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java
CouchDatabaseBase.removeAttachment
public Response removeAttachment(String id, String rev, String attachmentName) { assertNotEmpty(id, "id"); assertNotEmpty(rev, "rev"); assertNotEmpty(attachmentName, "attachmentName"); final URI uri = new DatabaseURIHelper(dbUri).attachmentUri(id, rev, attachmentName); return couchDbClient.delete(uri); }
java
public Response removeAttachment(String id, String rev, String attachmentName) { assertNotEmpty(id, "id"); assertNotEmpty(rev, "rev"); assertNotEmpty(attachmentName, "attachmentName"); final URI uri = new DatabaseURIHelper(dbUri).attachmentUri(id, rev, attachmentName); return couchDbClient.delete(uri); }
[ "public", "Response", "removeAttachment", "(", "String", "id", ",", "String", "rev", ",", "String", "attachmentName", ")", "{", "assertNotEmpty", "(", "id", ",", "\"id\"", ")", ";", "assertNotEmpty", "(", "rev", ",", "\"rev\"", ")", ";", "assertNotEmpty", "(...
Removes an attachment from a document given both a document <code>_id</code> and <code>_rev</code> and <code>attachmentName</code> values. @param id The document _id field. @param rev The document _rev field. @param attachmentName The document attachment field. @return {@link Response} @throws NoDocumentException If the document is not found in the database. @throws DocumentConflictException If a conflict is found during attachment removal.
[ "Removes", "an", "attachment", "from", "a", "document", "given", "both", "a", "document", "<code", ">", "_id<", "/", "code", ">", "and", "<code", ">", "_rev<", "/", "code", ">", "and", "<code", ">", "attachmentName<", "/", "code", ">", "values", "." ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java#L411-L417
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_secondaryDnsDomains_POST
public void serviceName_secondaryDnsDomains_POST(String serviceName, String domain, String ip) throws IOException { String qPath = "/dedicated/server/{serviceName}/secondaryDnsDomains"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "domain", domain); addBody(o, "ip", ip); exec(qPath, "POST", sb.toString(), o); }
java
public void serviceName_secondaryDnsDomains_POST(String serviceName, String domain, String ip) throws IOException { String qPath = "/dedicated/server/{serviceName}/secondaryDnsDomains"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "domain", domain); addBody(o, "ip", ip); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "serviceName_secondaryDnsDomains_POST", "(", "String", "serviceName", ",", "String", "domain", ",", "String", "ip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/secondaryDnsDomains\"", ";", "StringBuilder", ...
add a domain on secondary dns REST: POST /dedicated/server/{serviceName}/secondaryDnsDomains @param domain [required] The domain to add @param ip [required] @param serviceName [required] The internal name of your dedicated server
[ "add", "a", "domain", "on", "secondary", "dns" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2003-L2010
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java
ArchiveUtils.getLicenseAgreement
public static String getLicenseAgreement(final JarFile jar, final Map<String, String> manifestAttrs) { String licenseAgreement = null; if (manifestAttrs.isEmpty()) { return licenseAgreement; } String licenseAgreementPrefix = manifestAttrs.get(ArchiveUtils.LICENSE_AGREEMENT); LicenseProvider licenseProvider = (licenseAgreementPrefix != null) ? ZipLicenseProvider.createInstance(jar, licenseAgreementPrefix) : null; if (licenseProvider != null) licenseAgreement = new InstallLicenseImpl("", LicenseType.UNSPECIFIED, licenseProvider).getAgreement(); return licenseAgreement; }
java
public static String getLicenseAgreement(final JarFile jar, final Map<String, String> manifestAttrs) { String licenseAgreement = null; if (manifestAttrs.isEmpty()) { return licenseAgreement; } String licenseAgreementPrefix = manifestAttrs.get(ArchiveUtils.LICENSE_AGREEMENT); LicenseProvider licenseProvider = (licenseAgreementPrefix != null) ? ZipLicenseProvider.createInstance(jar, licenseAgreementPrefix) : null; if (licenseProvider != null) licenseAgreement = new InstallLicenseImpl("", LicenseType.UNSPECIFIED, licenseProvider).getAgreement(); return licenseAgreement; }
[ "public", "static", "String", "getLicenseAgreement", "(", "final", "JarFile", "jar", ",", "final", "Map", "<", "String", ",", "String", ">", "manifestAttrs", ")", "{", "String", "licenseAgreement", "=", "null", ";", "if", "(", "manifestAttrs", ".", "isEmpty", ...
Gets the license agreement for the jar file. @param jar the jar file @param manifestAttrs the manifest file for the jar file @return the license agreement as a String
[ "Gets", "the", "license", "agreement", "for", "the", "jar", "file", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ArchiveUtils.java#L168-L183
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java
FilterList.findInList
public boolean findInList(int[] address) { int len = address.length; if (len < IP_ADDR_NUMBERS) { int j = IP_ADDR_NUMBERS - 1; // for performace, hard code the size here int a[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // int a[] = new int[IP_ADDR_NUMBERS]; // for (int i = 0; i < IP_ADDR_NUMBERS; i++) // { // a[i] = 0; // } for (int i = len; i > 0; i--, j--) { a[j] = address[i - 1]; } return findInList(a, 0, firstCell, 7); } return findInList(address, 0, firstCell, (address.length - 1)); }
java
public boolean findInList(int[] address) { int len = address.length; if (len < IP_ADDR_NUMBERS) { int j = IP_ADDR_NUMBERS - 1; // for performace, hard code the size here int a[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; // int a[] = new int[IP_ADDR_NUMBERS]; // for (int i = 0; i < IP_ADDR_NUMBERS; i++) // { // a[i] = 0; // } for (int i = len; i > 0; i--, j--) { a[j] = address[i - 1]; } return findInList(a, 0, firstCell, 7); } return findInList(address, 0, firstCell, (address.length - 1)); }
[ "public", "boolean", "findInList", "(", "int", "[", "]", "address", ")", "{", "int", "len", "=", "address", ".", "length", ";", "if", "(", "len", "<", "IP_ADDR_NUMBERS", ")", "{", "int", "j", "=", "IP_ADDR_NUMBERS", "-", "1", ";", "// for performace, har...
Determine if an address, represented by an integer array, is in the address tree @param address integer array representing the address, leftmost number in the address should start at array offset 0. @return true if this address is found in the address tree, false if it is not.
[ "Determine", "if", "an", "address", "represented", "by", "an", "integer", "array", "is", "in", "the", "address", "tree" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/tcpchannel/internal/FilterList.java#L228-L249
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/html/Table.java
Table.addCell
public Table addCell(Object o, String attributes) { addCell(o); cell.attribute(attributes); return this; }
java
public Table addCell(Object o, String attributes) { addCell(o); cell.attribute(attributes); return this; }
[ "public", "Table", "addCell", "(", "Object", "o", ",", "String", "attributes", ")", "{", "addCell", "(", "o", ")", ";", "cell", ".", "attribute", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
/* Add a new Cell in the current row. Adds to the table after this call and before next call to newRow, newCell or newHeader are added to the cell. @return This table for call chaining
[ "/", "*", "Add", "a", "new", "Cell", "in", "the", "current", "row", ".", "Adds", "to", "the", "table", "after", "this", "call", "and", "before", "next", "call", "to", "newRow", "newCell", "or", "newHeader", "are", "added", "to", "the", "cell", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/Table.java#L171-L176
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/DisparityScoreRowFormat.java
DisparityScoreRowFormat.process
public void process( Input left , Input right , Disparity disparity ) { // initialize data structures InputSanityCheck.checkSameShape(left, right, disparity); if( maxDisparity > left.width-2*radiusX ) throw new RuntimeException( "The maximum disparity is too large for this image size: max size "+(left.width-2*radiusX)); lengthHorizontal = left.width*rangeDisparity; _process(left,right,disparity); }
java
public void process( Input left , Input right , Disparity disparity ) { // initialize data structures InputSanityCheck.checkSameShape(left, right, disparity); if( maxDisparity > left.width-2*radiusX ) throw new RuntimeException( "The maximum disparity is too large for this image size: max size "+(left.width-2*radiusX)); lengthHorizontal = left.width*rangeDisparity; _process(left,right,disparity); }
[ "public", "void", "process", "(", "Input", "left", ",", "Input", "right", ",", "Disparity", "disparity", ")", "{", "// initialize data structures", "InputSanityCheck", ".", "checkSameShape", "(", "left", ",", "right", ",", "disparity", ")", ";", "if", "(", "ma...
Computes disparity between two stereo images @param left Left rectified stereo image. Input @param right Right rectified stereo image. Input @param disparity Disparity between the two images. Output
[ "Computes", "disparity", "between", "two", "stereo", "images" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/DisparityScoreRowFormat.java#L92-L103
erlang/otp
lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java
OtpInputStream.read_atom
@SuppressWarnings("fallthrough") public String read_atom() throws OtpErlangDecodeException { int tag; int len = -1; byte[] strbuf; String atom; tag = read1skip_version(); switch (tag) { case OtpExternal.atomTag: len = read2BE(); strbuf = new byte[len]; this.readN(strbuf); try { atom = new String(strbuf, "ISO-8859-1"); } catch (final java.io.UnsupportedEncodingException e) { throw new OtpErlangDecodeException( "Failed to decode ISO-8859-1 atom"); } if (atom.length() > OtpExternal.maxAtomLength) { /* * Throwing an exception would be better I think, but truncation * seems to be the way it has been done in other parts of OTP... */ atom = atom.substring(0, OtpExternal.maxAtomLength); } break; case OtpExternal.smallAtomUtf8Tag: len = read1(); // fall-through case OtpExternal.atomUtf8Tag: if (len < 0) { len = read2BE(); } strbuf = new byte[len]; this.readN(strbuf); try { atom = new String(strbuf, "UTF-8"); } catch (final java.io.UnsupportedEncodingException e) { throw new OtpErlangDecodeException( "Failed to decode UTF-8 atom"); } if (atom.codePointCount(0, atom.length()) > OtpExternal.maxAtomLength) { /* * Throwing an exception would be better I think, but truncation * seems to be the way it has been done in other parts of OTP... */ final int[] cps = OtpErlangString.stringToCodePoints(atom); atom = new String(cps, 0, OtpExternal.maxAtomLength); } break; default: throw new OtpErlangDecodeException( "wrong tag encountered, expected " + OtpExternal.atomTag + ", or " + OtpExternal.atomUtf8Tag + ", got " + tag); } return atom; }
java
@SuppressWarnings("fallthrough") public String read_atom() throws OtpErlangDecodeException { int tag; int len = -1; byte[] strbuf; String atom; tag = read1skip_version(); switch (tag) { case OtpExternal.atomTag: len = read2BE(); strbuf = new byte[len]; this.readN(strbuf); try { atom = new String(strbuf, "ISO-8859-1"); } catch (final java.io.UnsupportedEncodingException e) { throw new OtpErlangDecodeException( "Failed to decode ISO-8859-1 atom"); } if (atom.length() > OtpExternal.maxAtomLength) { /* * Throwing an exception would be better I think, but truncation * seems to be the way it has been done in other parts of OTP... */ atom = atom.substring(0, OtpExternal.maxAtomLength); } break; case OtpExternal.smallAtomUtf8Tag: len = read1(); // fall-through case OtpExternal.atomUtf8Tag: if (len < 0) { len = read2BE(); } strbuf = new byte[len]; this.readN(strbuf); try { atom = new String(strbuf, "UTF-8"); } catch (final java.io.UnsupportedEncodingException e) { throw new OtpErlangDecodeException( "Failed to decode UTF-8 atom"); } if (atom.codePointCount(0, atom.length()) > OtpExternal.maxAtomLength) { /* * Throwing an exception would be better I think, but truncation * seems to be the way it has been done in other parts of OTP... */ final int[] cps = OtpErlangString.stringToCodePoints(atom); atom = new String(cps, 0, OtpExternal.maxAtomLength); } break; default: throw new OtpErlangDecodeException( "wrong tag encountered, expected " + OtpExternal.atomTag + ", or " + OtpExternal.atomUtf8Tag + ", got " + tag); } return atom; }
[ "@", "SuppressWarnings", "(", "\"fallthrough\"", ")", "public", "String", "read_atom", "(", ")", "throws", "OtpErlangDecodeException", "{", "int", "tag", ";", "int", "len", "=", "-", "1", ";", "byte", "[", "]", "strbuf", ";", "String", "atom", ";", "tag", ...
Read an Erlang atom from the stream. @return a String containing the value of the atom. @exception OtpErlangDecodeException if the next term in the stream is not an atom.
[ "Read", "an", "Erlang", "atom", "from", "the", "stream", "." ]
train
https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java#L350-L413
primefaces/primefaces
src/main/java/org/primefaces/util/CalendarUtils.java
CalendarUtils.encodeListValue
public static void encodeListValue(FacesContext context, UICalendar uicalendar, String optionName, List<Object> values) throws IOException { if (values == null) { return; } ResponseWriter writer = context.getResponseWriter(); writer.write("," + optionName + ":["); for (int i = 0; i < values.size(); i++) { Object item = values.get(i); Object preText = (i == 0) ? "" : ","; if (item instanceof Date) { writer.write(preText + "\"" + EscapeUtils.forJavaScript(getValueAsString(context, uicalendar, item)) + "\""); } else { writer.write(preText + "" + item); } } writer.write("]"); }
java
public static void encodeListValue(FacesContext context, UICalendar uicalendar, String optionName, List<Object> values) throws IOException { if (values == null) { return; } ResponseWriter writer = context.getResponseWriter(); writer.write("," + optionName + ":["); for (int i = 0; i < values.size(); i++) { Object item = values.get(i); Object preText = (i == 0) ? "" : ","; if (item instanceof Date) { writer.write(preText + "\"" + EscapeUtils.forJavaScript(getValueAsString(context, uicalendar, item)) + "\""); } else { writer.write(preText + "" + item); } } writer.write("]"); }
[ "public", "static", "void", "encodeListValue", "(", "FacesContext", "context", ",", "UICalendar", "uicalendar", ",", "String", "optionName", ",", "List", "<", "Object", ">", "values", ")", "throws", "IOException", "{", "if", "(", "values", "==", "null", ")", ...
Write the value of Calendar options @param context @param uicalendar component @param optionName the name of an option @param values the List values of an option @throws java.io.IOException if writer is null
[ "Write", "the", "value", "of", "Calendar", "options" ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/CalendarUtils.java#L221-L242
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/util/PathTokenizer.java
PathTokenizer.getRemainingPath
protected static String getRemainingPath(List<String> tokens, int i, int end) { if (tokens == null) { throw MESSAGES.nullArgument("tokens"); } if (i < 0 || i >= end) { throw new IllegalArgumentException("i is not in the range of tokens: 0-" + (end - 1)); } if (i == end - 1) { return tokens.get(end - 1); } StringBuilder buffer = new StringBuilder(); for (; i < end - 1; ++i) { buffer.append(tokens.get(i)); buffer.append("/"); } buffer.append(tokens.get(end - 1)); return buffer.toString(); }
java
protected static String getRemainingPath(List<String> tokens, int i, int end) { if (tokens == null) { throw MESSAGES.nullArgument("tokens"); } if (i < 0 || i >= end) { throw new IllegalArgumentException("i is not in the range of tokens: 0-" + (end - 1)); } if (i == end - 1) { return tokens.get(end - 1); } StringBuilder buffer = new StringBuilder(); for (; i < end - 1; ++i) { buffer.append(tokens.get(i)); buffer.append("/"); } buffer.append(tokens.get(end - 1)); return buffer.toString(); }
[ "protected", "static", "String", "getRemainingPath", "(", "List", "<", "String", ">", "tokens", ",", "int", "i", ",", "int", "end", ")", "{", "if", "(", "tokens", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"tokens\"", ")", ...
Get the remaining path from some tokens @param tokens the tokens @param i the current location @param end the end index @return the remaining path @throws IllegalArgumentException for null tokens or i is out of range
[ "Get", "the", "remaining", "path", "from", "some", "tokens" ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/util/PathTokenizer.java#L71-L84
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/controller/FeatureInfoController.java
FeatureInfoController.onMouseUp
public void onMouseUp(MouseUpEvent event) { Coordinate worldPosition = getWorldPosition(event); Point point = mapWidget.getMapModel().getGeometryFactory().createPoint(worldPosition); SearchByLocationRequest request = new SearchByLocationRequest(); request.setLocation(GeometryConverter.toDto(point)); request.setCrs(mapWidget.getMapModel().getCrs()); request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS); request.setSearchType(SearchByLocationRequest.SEARCH_FIRST_LAYER); request.setBuffer(calculateBufferFromPixelTolerance()); request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect()); request.setLayerIds(getServerLayerIds(mapWidget.getMapModel())); for (Layer<?> layer : mapWidget.getMapModel().getLayers()) { if (layer.isShowing() && layer instanceof VectorLayer) { request.setFilter(layer.getServerLayerId(), ((VectorLayer) layer).getFilter()); } } GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse response) { Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap(); for (String serverLayerId : featureMap.keySet()) { List<VectorLayer> layers = mapWidget.getMapModel().getVectorLayersByServerId(serverLayerId); for (VectorLayer vectorLayer : layers) { List<org.geomajas.layer.feature.Feature> orgFeatures = featureMap.get(serverLayerId); if (orgFeatures.size() > 0) { Feature feature = new Feature(orgFeatures.get(0), vectorLayer); vectorLayer.getFeatureStore().addFeature(feature); FeatureAttributeWindow window = new FeatureAttributeWindow(feature, false); window.setPageTop(mapWidget.getAbsoluteTop() + 10); window.setPageLeft(mapWidget.getAbsoluteLeft() + 10); window.draw(); } } } } }); }
java
public void onMouseUp(MouseUpEvent event) { Coordinate worldPosition = getWorldPosition(event); Point point = mapWidget.getMapModel().getGeometryFactory().createPoint(worldPosition); SearchByLocationRequest request = new SearchByLocationRequest(); request.setLocation(GeometryConverter.toDto(point)); request.setCrs(mapWidget.getMapModel().getCrs()); request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS); request.setSearchType(SearchByLocationRequest.SEARCH_FIRST_LAYER); request.setBuffer(calculateBufferFromPixelTolerance()); request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect()); request.setLayerIds(getServerLayerIds(mapWidget.getMapModel())); for (Layer<?> layer : mapWidget.getMapModel().getLayers()) { if (layer.isShowing() && layer instanceof VectorLayer) { request.setFilter(layer.getServerLayerId(), ((VectorLayer) layer).getFilter()); } } GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse response) { Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap(); for (String serverLayerId : featureMap.keySet()) { List<VectorLayer> layers = mapWidget.getMapModel().getVectorLayersByServerId(serverLayerId); for (VectorLayer vectorLayer : layers) { List<org.geomajas.layer.feature.Feature> orgFeatures = featureMap.get(serverLayerId); if (orgFeatures.size() > 0) { Feature feature = new Feature(orgFeatures.get(0), vectorLayer); vectorLayer.getFeatureStore().addFeature(feature); FeatureAttributeWindow window = new FeatureAttributeWindow(feature, false); window.setPageTop(mapWidget.getAbsoluteTop() + 10); window.setPageLeft(mapWidget.getAbsoluteLeft() + 10); window.draw(); } } } } }); }
[ "public", "void", "onMouseUp", "(", "MouseUpEvent", "event", ")", "{", "Coordinate", "worldPosition", "=", "getWorldPosition", "(", "event", ")", ";", "Point", "point", "=", "mapWidget", ".", "getMapModel", "(", ")", ".", "getGeometryFactory", "(", ")", ".", ...
On mouse up, execute the search by location, and display a {@link org.geomajas.gwt.client.widget.FeatureAttributeWindow} if a result is found.
[ "On", "mouse", "up", "execute", "the", "search", "by", "location", "and", "display", "a", "{" ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/FeatureInfoController.java#L57-L98
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/LinkUtil.java
LinkUtil.getUrl
public static String getUrl(SlingHttpServletRequest request, String url, String selectors, String extension) { LinkMapper mapper = (LinkMapper) request.getAttribute(LinkMapper.LINK_MAPPER_REQUEST_ATTRIBUTE); return getUrl(request, url, selectors, extension, mapper != null ? mapper : LinkMapper.RESOLVER); }
java
public static String getUrl(SlingHttpServletRequest request, String url, String selectors, String extension) { LinkMapper mapper = (LinkMapper) request.getAttribute(LinkMapper.LINK_MAPPER_REQUEST_ATTRIBUTE); return getUrl(request, url, selectors, extension, mapper != null ? mapper : LinkMapper.RESOLVER); }
[ "public", "static", "String", "getUrl", "(", "SlingHttpServletRequest", "request", ",", "String", "url", ",", "String", "selectors", ",", "String", "extension", ")", "{", "LinkMapper", "mapper", "=", "(", "LinkMapper", ")", "request", ".", "getAttribute", "(", ...
Builds a mapped link to the path (resource path) with optional selectors and extension. @param request the request context for path mapping (the result is always mapped) @param url the URL to use (complete) or the path to an addressed resource (without any extension) @param selectors an optional selector string with all necessary selectors (can be 'null') @param extension an optional extension (can be 'null' for extension determination) @return the mapped url for the referenced resource
[ "Builds", "a", "mapped", "link", "to", "the", "path", "(", "resource", "path", ")", "with", "optional", "selectors", "and", "extension", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/LinkUtil.java#L101-L105
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosSuggestionsApi.java
PhotosSuggestionsApi.getList
public Suggestions getList(String photoId, JinxConstants.SuggestionStatus status) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.suggestions.getList"); if (!JinxUtils.isNullOrEmpty(photoId)) { params.put("photo_id", photoId); } if (status != null) { params.put("status_id", JinxUtils.suggestionStatusToFlickrSuggestionStatusId(status).toString()); } return jinx.flickrPost(params, Suggestions.class); }
java
public Suggestions getList(String photoId, JinxConstants.SuggestionStatus status) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.suggestions.getList"); if (!JinxUtils.isNullOrEmpty(photoId)) { params.put("photo_id", photoId); } if (status != null) { params.put("status_id", JinxUtils.suggestionStatusToFlickrSuggestionStatusId(status).toString()); } return jinx.flickrPost(params, Suggestions.class); }
[ "public", "Suggestions", "getList", "(", "String", "photoId", ",", "JinxConstants", ".", "SuggestionStatus", "status", ")", "throws", "JinxException", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>", "(", ")", ";", "param...
Return a list of suggestions for a user that are pending approval. <br> This method requires authentication with 'read' permission. @param photoId (Optional) Only show suggestions for this photo. @param status (Optional) Only show suggestions with a given status. If this is null, the default is pending. @return object with a list of the suggestions. @throws JinxException if required parameters are missing or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.suggestions.getList.html">flickr.photos.suggestions.getList</a>
[ "Return", "a", "list", "of", "suggestions", "for", "a", "user", "that", "are", "pending", "approval", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "read", "permission", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosSuggestionsApi.java#L75-L85
forge/core
parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/beans/FieldOperations.java
FieldOperations.removeField
public void removeField(final JavaClassSource targetClass, final Field<JavaClassSource> field) { PropertySource<JavaClassSource> property = targetClass.getProperty(field.getName()); property.setMutable(false).setAccessible(false); targetClass.removeProperty(property); updateToString(targetClass); }
java
public void removeField(final JavaClassSource targetClass, final Field<JavaClassSource> field) { PropertySource<JavaClassSource> property = targetClass.getProperty(field.getName()); property.setMutable(false).setAccessible(false); targetClass.removeProperty(property); updateToString(targetClass); }
[ "public", "void", "removeField", "(", "final", "JavaClassSource", "targetClass", ",", "final", "Field", "<", "JavaClassSource", ">", "field", ")", "{", "PropertySource", "<", "JavaClassSource", ">", "property", "=", "targetClass", ".", "getProperty", "(", "field",...
Removes the field, including its getters and setters and updating toString() @param targetClass The class, which field will be removed @param field The field to be removed
[ "Removes", "the", "field", "including", "its", "getters", "and", "setters", "and", "updating", "toString", "()" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/beans/FieldOperations.java#L39-L45
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java
NominatimSearchRequest.setViewBox
public void setViewBox(final double west, final double north, final double east, final double south) { this.viewBox = new BoundingBox(); this.viewBox.setWest(west); this.viewBox.setNorth(north); this.viewBox.setEast(east); this.viewBox.setSouth(south); }
java
public void setViewBox(final double west, final double north, final double east, final double south) { this.viewBox = new BoundingBox(); this.viewBox.setWest(west); this.viewBox.setNorth(north); this.viewBox.setEast(east); this.viewBox.setSouth(south); }
[ "public", "void", "setViewBox", "(", "final", "double", "west", ",", "final", "double", "north", ",", "final", "double", "east", ",", "final", "double", "south", ")", "{", "this", ".", "viewBox", "=", "new", "BoundingBox", "(", ")", ";", "this", ".", "...
Sets the preferred area to find search results; @param west the west bound @param north the north bound @param east the east bound @param south the south bound
[ "Sets", "the", "preferred", "area", "to", "find", "search", "results", ";" ]
train
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java#L215-L221
netty/netty
transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java
EmbeddedChannel.writeOneInbound
public ChannelFuture writeOneInbound(Object msg, ChannelPromise promise) { if (checkOpen(true)) { pipeline().fireChannelRead(msg); } return checkException(promise); }
java
public ChannelFuture writeOneInbound(Object msg, ChannelPromise promise) { if (checkOpen(true)) { pipeline().fireChannelRead(msg); } return checkException(promise); }
[ "public", "ChannelFuture", "writeOneInbound", "(", "Object", "msg", ",", "ChannelPromise", "promise", ")", "{", "if", "(", "checkOpen", "(", "true", ")", ")", "{", "pipeline", "(", ")", ".", "fireChannelRead", "(", "msg", ")", ";", "}", "return", "checkExc...
Writes one message to the inbound of this {@link Channel} and does not flush it. This method is conceptually equivalent to {@link #write(Object, ChannelPromise)}. @see #writeOneOutbound(Object, ChannelPromise)
[ "Writes", "one", "message", "to", "the", "inbound", "of", "this", "{", "@link", "Channel", "}", "and", "does", "not", "flush", "it", ".", "This", "method", "is", "conceptually", "equivalent", "to", "{", "@link", "#write", "(", "Object", "ChannelPromise", "...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java#L348-L353
camunda/camunda-bpm-platform
distro/wildfly/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/util/JBossCompatibilityExtension.java
JBossCompatibilityExtension.addServerExecutorDependency
public static void addServerExecutorDependency(ServiceBuilder<?> serviceBuilder, InjectedValue<ExecutorService> injector, boolean optional) { ServiceBuilder.DependencyType type = optional ? ServiceBuilder.DependencyType.OPTIONAL : ServiceBuilder.DependencyType.REQUIRED; serviceBuilder.addDependency(type, JBOSS_SERVER_EXECUTOR, ExecutorService.class, injector); }
java
public static void addServerExecutorDependency(ServiceBuilder<?> serviceBuilder, InjectedValue<ExecutorService> injector, boolean optional) { ServiceBuilder.DependencyType type = optional ? ServiceBuilder.DependencyType.OPTIONAL : ServiceBuilder.DependencyType.REQUIRED; serviceBuilder.addDependency(type, JBOSS_SERVER_EXECUTOR, ExecutorService.class, injector); }
[ "public", "static", "void", "addServerExecutorDependency", "(", "ServiceBuilder", "<", "?", ">", "serviceBuilder", ",", "InjectedValue", "<", "ExecutorService", ">", "injector", ",", "boolean", "optional", ")", "{", "ServiceBuilder", ".", "DependencyType", "type", "...
Adds the JBoss server executor as a dependency to the given service. Copied from org.jboss.as.server.Services - JBoss 7.2.0.Final
[ "Adds", "the", "JBoss", "server", "executor", "as", "a", "dependency", "to", "the", "given", "service", ".", "Copied", "from", "org", ".", "jboss", ".", "as", ".", "server", ".", "Services", "-", "JBoss", "7", ".", "2", ".", "0", ".", "Final" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/distro/wildfly/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/util/JBossCompatibilityExtension.java#L47-L50
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java
FactoryKernelGaussian.gaussian2D
public static <T extends ImageGray<T>, K extends Kernel2D> K gaussian2D(Class<T> imageType, double sigma, int radius ) { boolean isFloat = GeneralizedImageOps.isFloatingPoint(imageType); int numBits = Math.max(32, GeneralizedImageOps.getNumBits(imageType)); return gaussian(2,isFloat, numBits, sigma,radius); }
java
public static <T extends ImageGray<T>, K extends Kernel2D> K gaussian2D(Class<T> imageType, double sigma, int radius ) { boolean isFloat = GeneralizedImageOps.isFloatingPoint(imageType); int numBits = Math.max(32, GeneralizedImageOps.getNumBits(imageType)); return gaussian(2,isFloat, numBits, sigma,radius); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ",", "K", "extends", "Kernel2D", ">", "K", "gaussian2D", "(", "Class", "<", "T", ">", "imageType", ",", "double", "sigma", ",", "int", "radius", ")", "{", "boolean", "isFloat", "=", ...
Creates a 2D Gaussian kernel of the specified type. @param imageType The type of image which is to be convolved by this kernel. @param sigma The distributions stdev. If &le; 0 then the sigma will be computed from the radius. @param radius Number of pixels in the kernel's radius. If &le; 0 then the sigma will be computed from the sigma. @return The computed Gaussian kernel.
[ "Creates", "a", "2D", "Gaussian", "kernel", "of", "the", "specified", "type", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L95-L101
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/UserAlias.java
UserAlias.initMapping
private void initMapping(String attributePath, String aliasPath) { Iterator aliasSegmentItr = pathToSegments(aliasPath).iterator(); String currPath = ""; String separator = ""; while (aliasSegmentItr.hasNext()) { currPath = currPath + separator + (String) aliasSegmentItr.next(); int beginIndex = attributePath.indexOf(currPath); if (beginIndex == -1) { break; } int endIndex = beginIndex + currPath.length(); m_mapping.put(attributePath.substring(0, endIndex), m_name); separator = "."; } }
java
private void initMapping(String attributePath, String aliasPath) { Iterator aliasSegmentItr = pathToSegments(aliasPath).iterator(); String currPath = ""; String separator = ""; while (aliasSegmentItr.hasNext()) { currPath = currPath + separator + (String) aliasSegmentItr.next(); int beginIndex = attributePath.indexOf(currPath); if (beginIndex == -1) { break; } int endIndex = beginIndex + currPath.length(); m_mapping.put(attributePath.substring(0, endIndex), m_name); separator = "."; } }
[ "private", "void", "initMapping", "(", "String", "attributePath", ",", "String", "aliasPath", ")", "{", "Iterator", "aliasSegmentItr", "=", "pathToSegments", "(", "aliasPath", ")", ".", "iterator", "(", ")", ";", "String", "currPath", "=", "\"\"", ";", "String...
generates the mapping from the aliasPath @param aliasPath the portion of attributePath which should be aliased
[ "generates", "the", "mapping", "from", "the", "aliasPath", "@param", "aliasPath", "the", "portion", "of", "attributePath", "which", "should", "be", "aliased" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/UserAlias.java#L94-L111