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
mike706574/java-map-support
src/main/java/fun/mike/map/alpha/Get.java
Get.populatedString
public static <T> String populatedString(Map<String, T> map, String key) { return populatedStringOfType(map, key, "string"); }
java
public static <T> String populatedString(Map<String, T> map, String key) { return populatedStringOfType(map, key, "string"); }
[ "public", "static", "<", "T", ">", "String", "populatedString", "(", "Map", "<", "String", ",", "T", ">", "map", ",", "String", "key", ")", "{", "return", "populatedStringOfType", "(", "map", ",", "key", ",", "\"string\"", ")", ";", "}" ]
Validates that the value from {@code map} for the given {@code key} is a populated string. Returns the value when valid; otherwise, throws an {@code IllegalArgumentException}. @param map A map @param key A key @param <T> The type of value @return The string value @throws java.util.NoSuchElementException if the required value is not present @throws java.lang.IllegalArgumentException if the value is in valid
[ "Validates", "that", "the", "value", "from", "{" ]
train
https://github.com/mike706574/java-map-support/blob/7cb09f34c24adfaca73ad25a3c3e05abec72eafe/src/main/java/fun/mike/map/alpha/Get.java#L71-L73
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SoftDeleteHandler.java
SoftDeleteHandler.init
public void init(Record record, BaseField fldDeleteFlag) { m_fldDeleteFlag = fldDeleteFlag; m_bFilterThisRecord = true; super.init(record); }
java
public void init(Record record, BaseField fldDeleteFlag) { m_fldDeleteFlag = fldDeleteFlag; m_bFilterThisRecord = true; super.init(record); }
[ "public", "void", "init", "(", "Record", "record", ",", "BaseField", "fldDeleteFlag", ")", "{", "m_fldDeleteFlag", "=", "fldDeleteFlag", ";", "m_bFilterThisRecord", "=", "true", ";", "super", ".", "init", "(", "record", ")", ";", "}" ]
Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()).
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SoftDeleteHandler.java#L61-L66
kiegroup/droolsjbpm-integration
kie-server-parent/kie-server-controller/kie-server-controller-client/src/main/java/org/kie/server/controller/client/KieServerControllerClientFactory.java
KieServerControllerClientFactory.newWebSocketClient
public static KieServerControllerClient newWebSocketClient(final String controllerUrl, final String login, final String password) { return new WebSocketKieServerControllerClient(controllerUrl, login, password, null, null); }
java
public static KieServerControllerClient newWebSocketClient(final String controllerUrl, final String login, final String password) { return new WebSocketKieServerControllerClient(controllerUrl, login, password, null, null); }
[ "public", "static", "KieServerControllerClient", "newWebSocketClient", "(", "final", "String", "controllerUrl", ",", "final", "String", "login", ",", "final", "String", "password", ")", "{", "return", "new", "WebSocketKieServerControllerClient", "(", "controllerUrl", ",...
Creates a new Kie Controller Client using Web Socket based service @param controllerUrl the URL to the server (e.g.: "ws://localhost:8080/kie-server-controller/websocket/controller") @param login user login @param password user password @return client instance
[ "Creates", "a", "new", "Kie", "Controller", "Client", "using", "Web", "Socket", "based", "service" ]
train
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-controller/kie-server-controller-client/src/main/java/org/kie/server/controller/client/KieServerControllerClientFactory.java#L92-L100
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_lusol.java
Scs_lusol.cs_lusol
public static boolean cs_lusol(int order, Scs A, float[] b, float tol) { float[] x; Scss S; Scsn N; int n; boolean ok; if (!Scs_util.CS_CSC(A) || b == null) return (false); /* check inputs */ n = A.n; S = Scs_sqr.cs_sqr(order, A, false); /* ordering and symbolic analysis */ N = Scs_lu.cs_lu(A, S, tol); /* numeric LU factorization */ x = new float[n]; /* get workspace */ ok = (S != null && N != null); if (ok) { Scs_ipvec.cs_ipvec(N.pinv, b, x, n); /* x = b(p) */ Scs_lsolve.cs_lsolve(N.L, x); /* x = L\x */ Scs_usolve.cs_usolve(N.U, x); /* x = U\x */ Scs_ipvec.cs_ipvec(S.q, x, b, n); /* b(q) = x */ } return (ok); }
java
public static boolean cs_lusol(int order, Scs A, float[] b, float tol) { float[] x; Scss S; Scsn N; int n; boolean ok; if (!Scs_util.CS_CSC(A) || b == null) return (false); /* check inputs */ n = A.n; S = Scs_sqr.cs_sqr(order, A, false); /* ordering and symbolic analysis */ N = Scs_lu.cs_lu(A, S, tol); /* numeric LU factorization */ x = new float[n]; /* get workspace */ ok = (S != null && N != null); if (ok) { Scs_ipvec.cs_ipvec(N.pinv, b, x, n); /* x = b(p) */ Scs_lsolve.cs_lsolve(N.L, x); /* x = L\x */ Scs_usolve.cs_usolve(N.U, x); /* x = U\x */ Scs_ipvec.cs_ipvec(S.q, x, b, n); /* b(q) = x */ } return (ok); }
[ "public", "static", "boolean", "cs_lusol", "(", "int", "order", ",", "Scs", "A", ",", "float", "[", "]", "b", ",", "float", "tol", ")", "{", "float", "[", "]", "x", ";", "Scss", "S", ";", "Scsn", "N", ";", "int", "n", ";", "boolean", "ok", ";",...
Solves Ax=b, where A is square and nonsingular. b overwritten with solution. Partial pivoting if tol = 1.f @param order ordering method to use (0 to 3) @param A column-compressed matrix @param b size n, b on input, x on output @param tol partial pivoting tolerance @return true if successful, false on error
[ "Solves", "Ax", "=", "b", "where", "A", "is", "square", "and", "nonsingular", ".", "b", "overwritten", "with", "solution", ".", "Partial", "pivoting", "if", "tol", "=", "1", ".", "f" ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_lusol.java#L53-L73
OpenLiberty/open-liberty
dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/SecurityFatHttpUtils.java
SecurityFatHttpUtils.getHttpConnectionWithAnyResponseCode
public static HttpURLConnection getHttpConnectionWithAnyResponseCode(LibertyServer server, String path) throws IOException { int timeout = DEFAULT_TIMEOUT; URL url = createURL(server, path); HttpURLConnection con = getHttpConnection(url, timeout, HTTPRequestMethod.GET); Log.info(SecurityFatHttpUtils.class, "getHttpConnection", "Connecting to " + url.toExternalForm() + " expecting http response in " + timeout + " seconds."); con.connect(); return con; }
java
public static HttpURLConnection getHttpConnectionWithAnyResponseCode(LibertyServer server, String path) throws IOException { int timeout = DEFAULT_TIMEOUT; URL url = createURL(server, path); HttpURLConnection con = getHttpConnection(url, timeout, HTTPRequestMethod.GET); Log.info(SecurityFatHttpUtils.class, "getHttpConnection", "Connecting to " + url.toExternalForm() + " expecting http response in " + timeout + " seconds."); con.connect(); return con; }
[ "public", "static", "HttpURLConnection", "getHttpConnectionWithAnyResponseCode", "(", "LibertyServer", "server", ",", "String", "path", ")", "throws", "IOException", "{", "int", "timeout", "=", "DEFAULT_TIMEOUT", ";", "URL", "url", "=", "createURL", "(", "server", "...
This method creates a connection to a webpage and then returns the connection, it doesn't care what the response code is. @param server The liberty server that is hosting the URL @param path The path to the URL with the output to test (excluding port and server information). For instance "/someContextRoot/servlet1" @return The connection to the http address
[ "This", "method", "creates", "a", "connection", "to", "a", "webpage", "and", "then", "returns", "the", "connection", "it", "doesn", "t", "care", "what", "the", "response", "code", "is", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/SecurityFatHttpUtils.java#L42-L49
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addSummaryComment
public void addSummaryComment(Element element, List<? extends DocTree> firstSentenceTags, Content htmltree) { addCommentTags(element, firstSentenceTags, false, true, htmltree); }
java
public void addSummaryComment(Element element, List<? extends DocTree> firstSentenceTags, Content htmltree) { addCommentTags(element, firstSentenceTags, false, true, htmltree); }
[ "public", "void", "addSummaryComment", "(", "Element", "element", ",", "List", "<", "?", "extends", "DocTree", ">", "firstSentenceTags", ",", "Content", "htmltree", ")", "{", "addCommentTags", "(", "element", ",", "firstSentenceTags", ",", "false", ",", "true", ...
Adds the summary content. @param element the Element for which the summary will be generated @param firstSentenceTags the first sentence tags for the doc @param htmltree the documentation tree to which the summary will be added
[ "Adds", "the", "summary", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1669-L1671
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/crdt/CRDTReplicationMigrationService.java
CRDTReplicationMigrationService.onShutdown
@Override public boolean onShutdown(long timeout, TimeUnit unit) { if (nodeEngine.getLocalMember().isLiteMember()) { return true; } long timeoutNanos = unit.toNanos(timeout); for (CRDTReplicationAwareService service : getReplicationServices()) { service.prepareToSafeShutdown(); final CRDTReplicationContainer replicationOperation = service.prepareReplicationOperation( replicationVectorClocks.getLatestReplicatedVectorClock(service.getName()), 0); if (replicationOperation == null) { logger.fine("Skipping replication since all CRDTs are replicated"); continue; } long start = System.nanoTime(); if (!tryProcessOnOtherMembers(replicationOperation.getOperation(), service.getName(), timeoutNanos)) { logger.warning("Failed replication of CRDTs for " + service.getName() + ". CRDT state may be lost."); } timeoutNanos -= (System.nanoTime() - start); if (timeoutNanos < 0) { return false; } } return true; }
java
@Override public boolean onShutdown(long timeout, TimeUnit unit) { if (nodeEngine.getLocalMember().isLiteMember()) { return true; } long timeoutNanos = unit.toNanos(timeout); for (CRDTReplicationAwareService service : getReplicationServices()) { service.prepareToSafeShutdown(); final CRDTReplicationContainer replicationOperation = service.prepareReplicationOperation( replicationVectorClocks.getLatestReplicatedVectorClock(service.getName()), 0); if (replicationOperation == null) { logger.fine("Skipping replication since all CRDTs are replicated"); continue; } long start = System.nanoTime(); if (!tryProcessOnOtherMembers(replicationOperation.getOperation(), service.getName(), timeoutNanos)) { logger.warning("Failed replication of CRDTs for " + service.getName() + ". CRDT state may be lost."); } timeoutNanos -= (System.nanoTime() - start); if (timeoutNanos < 0) { return false; } } return true; }
[ "@", "Override", "public", "boolean", "onShutdown", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "if", "(", "nodeEngine", ".", "getLocalMember", "(", ")", ".", "isLiteMember", "(", ")", ")", "{", "return", "true", ";", "}", "long", "timeout...
Attempts to replicate only the unreplicated CRDT state to any non-local member in the cluster. The state may be unreplicated because the CRDT state has been changed (via mutation or merge with an another CRDT) but has not yet been disseminated through the usual replication mechanism to any member. This method will iterate through the member list and try and replicate to at least one member. The method returns once all of the unreplicated state has been replicated successfully or when there are no more members to attempt processing. This method will replicate all of the unreplicated CRDT states to any data member in the cluster, regardless if that member is actually the replica for some CRDT (because of a configured replica count). It is the responsibility of that member to migrate the state for which it is not a replica. The configured replica count can therefore be broken during shutdown to increase the chance of survival of unreplicated CRDT data (if the actual replicas are unreachable). @see CRDTReplicationTask
[ "Attempts", "to", "replicate", "only", "the", "unreplicated", "CRDT", "state", "to", "any", "non", "-", "local", "member", "in", "the", "cluster", ".", "The", "state", "may", "be", "unreplicated", "because", "the", "CRDT", "state", "has", "been", "changed", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/crdt/CRDTReplicationMigrationService.java#L125-L149
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Model.java
Model.toXml
@Deprecated public String toXml(int spaces, boolean declaration, String... attributeNames) { return toXml(spaces > 0, declaration, attributeNames); }
java
@Deprecated public String toXml(int spaces, boolean declaration, String... attributeNames) { return toXml(spaces > 0, declaration, attributeNames); }
[ "@", "Deprecated", "public", "String", "toXml", "(", "int", "spaces", ",", "boolean", "declaration", ",", "String", "...", "attributeNames", ")", "{", "return", "toXml", "(", "spaces", ">", "0", ",", "declaration", ",", "attributeNames", ")", ";", "}" ]
Generates a XML document from content of this model. @param spaces by how many spaces to indent. @param declaration true to include XML declaration at the top @param attributeNames list of attributes to include. No arguments == include all attributes. @return generated XML. @deprecated use {@link #toXml(boolean, boolean, String...)} instead
[ "Generates", "a", "XML", "document", "from", "content", "of", "this", "model", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L1021-L1024
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java
MapTileCollisionLoader.loadCollisionGroups
private void loadCollisionGroups(MapTileCollision mapCollision, Media groupsConfig) { Verbose.info(INFO_LOAD_GROUPS, groupsConfig.getFile().getPath()); this.groupsConfig = groupsConfig; final Xml nodeGroups = new Xml(groupsConfig); final CollisionGroupConfig config = CollisionGroupConfig.imports(nodeGroups, mapCollision); loadCollisionGroups(config); }
java
private void loadCollisionGroups(MapTileCollision mapCollision, Media groupsConfig) { Verbose.info(INFO_LOAD_GROUPS, groupsConfig.getFile().getPath()); this.groupsConfig = groupsConfig; final Xml nodeGroups = new Xml(groupsConfig); final CollisionGroupConfig config = CollisionGroupConfig.imports(nodeGroups, mapCollision); loadCollisionGroups(config); }
[ "private", "void", "loadCollisionGroups", "(", "MapTileCollision", "mapCollision", ",", "Media", "groupsConfig", ")", "{", "Verbose", ".", "info", "(", "INFO_LOAD_GROUPS", ",", "groupsConfig", ".", "getFile", "(", ")", ".", "getPath", "(", ")", ")", ";", "this...
Load the collision groups. All previous groups will be cleared. @param mapCollision The map tile collision owner. @param groupsConfig The configuration collision groups file.
[ "Load", "the", "collision", "groups", ".", "All", "previous", "groups", "will", "be", "cleared", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java#L217-L225
xebialabs/overcast
src/main/java/com/xebialabs/overcast/support/libvirt/LibvirtUtil.java
LibvirtUtil.findVolume
public static StorageVol findVolume(Connect connection, String path) throws LibvirtException { log.debug("Looking up StorageVolume for path '{}'", path); for (String s : connection.listStoragePools()) { StoragePool sp = connection.storagePoolLookupByName(s); for (String v : sp.listVolumes()) { StorageVol vol = sp.storageVolLookupByName(v); if (vol.getPath().equals(path)) { log.debug("Found volume '{}' for path '{}'", vol.getName(), path); return vol; } } } throw new LibvirtRuntimeException("no volume found for path " + path); }
java
public static StorageVol findVolume(Connect connection, String path) throws LibvirtException { log.debug("Looking up StorageVolume for path '{}'", path); for (String s : connection.listStoragePools()) { StoragePool sp = connection.storagePoolLookupByName(s); for (String v : sp.listVolumes()) { StorageVol vol = sp.storageVolLookupByName(v); if (vol.getPath().equals(path)) { log.debug("Found volume '{}' for path '{}'", vol.getName(), path); return vol; } } } throw new LibvirtRuntimeException("no volume found for path " + path); }
[ "public", "static", "StorageVol", "findVolume", "(", "Connect", "connection", ",", "String", "path", ")", "throws", "LibvirtException", "{", "log", ".", "debug", "(", "\"Looking up StorageVolume for path '{}'\"", ",", "path", ")", ";", "for", "(", "String", "s", ...
Look up a disk image's {@link StorageVol} in the {@link StoragePool}s attached to connection.
[ "Look", "up", "a", "disk", "image", "s", "{" ]
train
https://github.com/xebialabs/overcast/blob/716e57b66870c9afe51edc3b6045863a34fb0061/src/main/java/com/xebialabs/overcast/support/libvirt/LibvirtUtil.java#L40-L53
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Spies.java
Spies.spy1st
public static <T1, T2, T3> TriPredicate<T1, T2, T3> spy1st(TriPredicate<T1, T2, T3> predicate, Box<T1> param1) { return spy(predicate, Box.<Boolean>empty(), param1, Box.<T2>empty(), Box.<T3>empty()); }
java
public static <T1, T2, T3> TriPredicate<T1, T2, T3> spy1st(TriPredicate<T1, T2, T3> predicate, Box<T1> param1) { return spy(predicate, Box.<Boolean>empty(), param1, Box.<T2>empty(), Box.<T3>empty()); }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ">", "TriPredicate", "<", "T1", ",", "T2", ",", "T3", ">", "spy1st", "(", "TriPredicate", "<", "T1", ",", "T2", ",", "T3", ">", "predicate", ",", "Box", "<", "T1", ">", "param1", ")", "{", "r...
Proxies a ternary predicate spying for first parameter. @param <T1> the predicate first parameter type @param <T2> the predicate second parameter type @param <T3> the predicate third parameter type @param predicate the predicate that will be spied @param param1 a box that will be containing the first spied parameter @return the proxied predicate
[ "Proxies", "a", "ternary", "predicate", "spying", "for", "first", "parameter", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L415-L417
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java
OcelotProcessor.writeJsFileToJsDir
void writeJsFileToJsDir(TypeElement element, ElementVisitor visitor, String packagePath, String fn, String dir) { if (null != dir) { try (Writer w = fws.getFileObjectWriter(dir + File.separatorChar + "srvs", packagePath + "." + fn)) { messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " javascript generation class : " + element + " to : " + dir); element.accept(visitor, w); } catch (IOException ioe) { messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " FAILED TO CREATE : " + packagePath + "." + fn); } } }
java
void writeJsFileToJsDir(TypeElement element, ElementVisitor visitor, String packagePath, String fn, String dir) { if (null != dir) { try (Writer w = fws.getFileObjectWriter(dir + File.separatorChar + "srvs", packagePath + "." + fn)) { messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " javascript generation class : " + element + " to : " + dir); element.accept(visitor, w); } catch (IOException ioe) { messager.printMessage(Diagnostic.Kind.MANDATORY_WARNING, " FAILED TO CREATE : " + packagePath + "." + fn); } } }
[ "void", "writeJsFileToJsDir", "(", "TypeElement", "element", ",", "ElementVisitor", "visitor", ",", "String", "packagePath", ",", "String", "fn", ",", "String", "dir", ")", "{", "if", "(", "null", "!=", "dir", ")", "{", "try", "(", "Writer", "w", "=", "f...
generate js service in packagePath.fn in classes directory/packagePath @param element @param visitor @param packagePath @param fn
[ "generate", "js", "service", "in", "packagePath", ".", "fn", "in", "classes", "directory", "/", "packagePath" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java#L234-L243
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/form/CmsFieldsetFormFieldPanel.java
CmsFieldsetFormFieldPanel.addGroupFieldSet
public void addGroupFieldSet(String group, CmsFieldSet fieldSet) { // can't add a group field set twice if (!m_groupFieldSets.containsKey(group)) { m_groupFieldSets.put(group, fieldSet); m_panel.add(fieldSet); } }
java
public void addGroupFieldSet(String group, CmsFieldSet fieldSet) { // can't add a group field set twice if (!m_groupFieldSets.containsKey(group)) { m_groupFieldSets.put(group, fieldSet); m_panel.add(fieldSet); } }
[ "public", "void", "addGroupFieldSet", "(", "String", "group", ",", "CmsFieldSet", "fieldSet", ")", "{", "// can't add a group field set twice\r", "if", "(", "!", "m_groupFieldSets", ".", "containsKey", "(", "group", ")", ")", "{", "m_groupFieldSets", ".", "put", "...
Adds a group specific field set.<p> @param group the group id @param fieldSet the field set
[ "Adds", "a", "group", "specific", "field", "set", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsFieldsetFormFieldPanel.java#L94-L101
kiegroup/drools
kie-pmml/src/main/java/org/kie/pmml/pmml_4_2/PMML4Compiler.java
PMML4Compiler.loadModel
public PMML loadModel(String model, InputStream source) { try { if (schema == null) { visitorBuildResults.add(new PMMLWarning(ResourceFactory.newInputStreamResource(source), "Could not validate PMML document, schema not available")); } final JAXBContext jc; final ClassLoader ccl = Thread.currentThread().getContextClassLoader(); XMLStreamReader reader = null; try { Thread.currentThread().setContextClassLoader(PMML4Compiler.class.getClassLoader()); Class c = PMML4Compiler.class.getClassLoader().loadClass("org.dmg.pmml.pmml_4_2.descr.PMML"); jc = JAXBContext.newInstance(c); XMLInputFactory xif = XMLInputFactory.newFactory(); xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); xif.setProperty(XMLInputFactory.SUPPORT_DTD, true); reader = xif.createXMLStreamReader(source); } finally { Thread.currentThread().setContextClassLoader(ccl); } Unmarshaller unmarshaller = jc.createUnmarshaller(); if (schema != null) { unmarshaller.setSchema(schema); } if (reader != null) { return (PMML) unmarshaller.unmarshal(reader); } else { this.results.add(new PMMLError("Unknown error in PMML")); return null; } } catch (ClassNotFoundException | XMLStreamException | JAXBException e) { this.results.add(new PMMLError(e.toString())); return null; } }
java
public PMML loadModel(String model, InputStream source) { try { if (schema == null) { visitorBuildResults.add(new PMMLWarning(ResourceFactory.newInputStreamResource(source), "Could not validate PMML document, schema not available")); } final JAXBContext jc; final ClassLoader ccl = Thread.currentThread().getContextClassLoader(); XMLStreamReader reader = null; try { Thread.currentThread().setContextClassLoader(PMML4Compiler.class.getClassLoader()); Class c = PMML4Compiler.class.getClassLoader().loadClass("org.dmg.pmml.pmml_4_2.descr.PMML"); jc = JAXBContext.newInstance(c); XMLInputFactory xif = XMLInputFactory.newFactory(); xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); xif.setProperty(XMLInputFactory.SUPPORT_DTD, true); reader = xif.createXMLStreamReader(source); } finally { Thread.currentThread().setContextClassLoader(ccl); } Unmarshaller unmarshaller = jc.createUnmarshaller(); if (schema != null) { unmarshaller.setSchema(schema); } if (reader != null) { return (PMML) unmarshaller.unmarshal(reader); } else { this.results.add(new PMMLError("Unknown error in PMML")); return null; } } catch (ClassNotFoundException | XMLStreamException | JAXBException e) { this.results.add(new PMMLError(e.toString())); return null; } }
[ "public", "PMML", "loadModel", "(", "String", "model", ",", "InputStream", "source", ")", "{", "try", "{", "if", "(", "schema", "==", "null", ")", "{", "visitorBuildResults", ".", "add", "(", "new", "PMMLWarning", "(", "ResourceFactory", ".", "newInputStream...
Imports a PMML source file, returning a Java descriptor @param model the PMML package name (classes derived from a specific schema) @param source the name of the PMML resource storing the predictive model @return the Java Descriptor of the PMML resource
[ "Imports", "a", "PMML", "source", "file", "returning", "a", "Java", "descriptor" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-pmml/src/main/java/org/kie/pmml/pmml_4_2/PMML4Compiler.java#L750-L784
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.getAccessControlList
public CmsAccessControlList getAccessControlList(String resourceName, boolean inheritedOnly) throws CmsException { CmsResource res = readResource(resourceName, CmsResourceFilter.ALL); return m_securityManager.getAccessControlList(m_context, res, inheritedOnly); }
java
public CmsAccessControlList getAccessControlList(String resourceName, boolean inheritedOnly) throws CmsException { CmsResource res = readResource(resourceName, CmsResourceFilter.ALL); return m_securityManager.getAccessControlList(m_context, res, inheritedOnly); }
[ "public", "CmsAccessControlList", "getAccessControlList", "(", "String", "resourceName", ",", "boolean", "inheritedOnly", ")", "throws", "CmsException", "{", "CmsResource", "res", "=", "readResource", "(", "resourceName", ",", "CmsResourceFilter", ".", "ALL", ")", ";"...
Returns the access control list (summarized access control entries) of a given resource.<p> If <code>inheritedOnly</code> is set, only inherited access control entries are returned.<p> @param resourceName the name of the resource @param inheritedOnly if set, the non-inherited entries are skipped @return the access control list of the resource @throws CmsException if something goes wrong
[ "Returns", "the", "access", "control", "list", "(", "summarized", "access", "control", "entries", ")", "of", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1291-L1295
icode/ameba
src/main/java/ameba/core/Requests.java
Requests.readEntity
public static <T> T readEntity(Class<T> rawType, PropertiesDelegate propertiesDelegate) { return getRequest().readEntity(rawType, propertiesDelegate); }
java
public static <T> T readEntity(Class<T> rawType, PropertiesDelegate propertiesDelegate) { return getRequest().readEntity(rawType, propertiesDelegate); }
[ "public", "static", "<", "T", ">", "T", "readEntity", "(", "Class", "<", "T", ">", "rawType", ",", "PropertiesDelegate", "propertiesDelegate", ")", "{", "return", "getRequest", "(", ")", ".", "readEntity", "(", "rawType", ",", "propertiesDelegate", ")", ";",...
<p>readEntity.</p> @param rawType a {@link java.lang.Class} object. @param propertiesDelegate a {@link org.glassfish.jersey.internal.PropertiesDelegate} object. @param <T> a T object. @return a T object.
[ "<p", ">", "readEntity", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/core/Requests.java#L416-L418
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setScorePoint
public static Last setScorePoint(int x, int y, int gep, int sub, int[][][] scores) { int d = scores[x - 1][y][0] + gep; int i = scores[x][y - 1][0] + gep; int s = scores[x - 1][y - 1][0] + sub; if (d >= s && d >= i) { scores[x][y][0] = d; return Last.DELETION; } else if (s >= i) { scores[x][y][0] = s; return Last.SUBSTITUTION; } else { scores[x][y][0] = i; return Last.INSERTION; } }
java
public static Last setScorePoint(int x, int y, int gep, int sub, int[][][] scores) { int d = scores[x - 1][y][0] + gep; int i = scores[x][y - 1][0] + gep; int s = scores[x - 1][y - 1][0] + sub; if (d >= s && d >= i) { scores[x][y][0] = d; return Last.DELETION; } else if (s >= i) { scores[x][y][0] = s; return Last.SUBSTITUTION; } else { scores[x][y][0] = i; return Last.INSERTION; } }
[ "public", "static", "Last", "setScorePoint", "(", "int", "x", ",", "int", "y", ",", "int", "gep", ",", "int", "sub", ",", "int", "[", "]", "[", "]", "[", "]", "scores", ")", "{", "int", "d", "=", "scores", "[", "x", "-", "1", "]", "[", "y", ...
Calculates the optimal alignment score for the given sequence positions and a linear gap penalty @param x position in query @param y position in target @param gep gap extension penalty @param sub compound match score @param scores dynamic programming score matrix to fill at the given position @return traceback directions for substitution, deletion and insertion respectively
[ "Calculates", "the", "optimal", "alignment", "score", "for", "the", "given", "sequence", "positions", "and", "a", "linear", "gap", "penalty" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L357-L371
zaproxy/zaproxy
src/org/parosproxy/paros/view/View.java
View.showSessionDialog
public void showSessionDialog(Session session, String panel, boolean recreateUISharedContexts, Runnable postInitRunnable) { if (sessionDialog == null) { this.getSessionDialog(); } if (recreateUISharedContexts) { sessionDialog.recreateUISharedContexts(session); } sessionDialog.initParam(session); if (postInitRunnable != null) { postInitRunnable.run(); } sessionDialog.setTitle(Constant.messages.getString("session.properties.title")); sessionDialog.showDialog(false, panel); }
java
public void showSessionDialog(Session session, String panel, boolean recreateUISharedContexts, Runnable postInitRunnable) { if (sessionDialog == null) { this.getSessionDialog(); } if (recreateUISharedContexts) { sessionDialog.recreateUISharedContexts(session); } sessionDialog.initParam(session); if (postInitRunnable != null) { postInitRunnable.run(); } sessionDialog.setTitle(Constant.messages.getString("session.properties.title")); sessionDialog.showDialog(false, panel); }
[ "public", "void", "showSessionDialog", "(", "Session", "session", ",", "String", "panel", ",", "boolean", "recreateUISharedContexts", ",", "Runnable", "postInitRunnable", ")", "{", "if", "(", "sessionDialog", "==", "null", ")", "{", "this", ".", "getSessionDialog"...
Shows the session properties dialog. If a panel is specified, the dialog is opened showing that panel. If {@code recreateUISharedContexts} is {@code true}, any old UI shared contexts are discarded and new ones are created as copies of the contexts. If a {@code postInitRunnable} is provided, its {@link Runnable#run} method is called after the initialization of all the panels of the session properties dialog. @param session the session @param panel the panel name to be shown @param recreateUISharedContexts if true, any old UI shared contexts are discarded and new ones are created as copies of the contexts @param postInitRunnable if provided, its {@link Runnable#run} method is called after the initialization of all the panels of the session properties dialog.
[ "Shows", "the", "session", "properties", "dialog", ".", "If", "a", "panel", "is", "specified", "the", "dialog", "is", "opened", "showing", "that", "panel", ".", "If", "{", "@code", "recreateUISharedContexts", "}", "is", "{", "@code", "true", "}", "any", "o...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/View.java#L697-L713
threerings/playn
html/src/playn/html/HtmlGraphics.java
HtmlGraphics.registerFontMetrics
public void registerFontMetrics(String name, Font.Style style, float size, float lineHeight) { HtmlFont font = new HtmlFont(this, name, style, size); HtmlFontMetrics metrics = getFontMetrics(font); // get emwidth via default measurement fontMetrics.put(font, new HtmlFontMetrics(font, lineHeight, metrics.emwidth)); }
java
public void registerFontMetrics(String name, Font.Style style, float size, float lineHeight) { HtmlFont font = new HtmlFont(this, name, style, size); HtmlFontMetrics metrics = getFontMetrics(font); // get emwidth via default measurement fontMetrics.put(font, new HtmlFontMetrics(font, lineHeight, metrics.emwidth)); }
[ "public", "void", "registerFontMetrics", "(", "String", "name", ",", "Font", ".", "Style", "style", ",", "float", "size", ",", "float", "lineHeight", ")", "{", "HtmlFont", "font", "=", "new", "HtmlFont", "(", "this", ",", "name", ",", "style", ",", "size...
Registers metrics for the specified font in the specified style and size. This overrides the default font metrics calculation (which is hacky and inaccurate). If you want to ensure somewhat consistent font layout across browsers, you should register font metrics for every combination of font, style and size that you use in your app. @param lineHeight the height of a line of text in the specified font (in pixels).
[ "Registers", "metrics", "for", "the", "specified", "font", "in", "the", "specified", "style", "and", "size", ".", "This", "overrides", "the", "default", "font", "metrics", "calculation", "(", "which", "is", "hacky", "and", "inaccurate", ")", ".", "If", "you"...
train
https://github.com/threerings/playn/blob/c266eeb39188dcada4b00992a0d1199759e03d42/html/src/playn/html/HtmlGraphics.java#L96-L100
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java
RingBuffer.tryPublishEvents
public <A> boolean tryPublishEvents(EventTranslatorOneArg<E, A> translator, int batchStartsAt, int batchSize, A[] arg0) { checkBounds(arg0, batchStartsAt, batchSize); try { final long finalSequence = sequencer.tryNext(batchSize); translateAndPublishBatch(translator, arg0, batchStartsAt, batchSize, finalSequence); return true; } catch (InsufficientCapacityException e) { return false; } }
java
public <A> boolean tryPublishEvents(EventTranslatorOneArg<E, A> translator, int batchStartsAt, int batchSize, A[] arg0) { checkBounds(arg0, batchStartsAt, batchSize); try { final long finalSequence = sequencer.tryNext(batchSize); translateAndPublishBatch(translator, arg0, batchStartsAt, batchSize, finalSequence); return true; } catch (InsufficientCapacityException e) { return false; } }
[ "public", "<", "A", ">", "boolean", "tryPublishEvents", "(", "EventTranslatorOneArg", "<", "E", ",", "A", ">", "translator", ",", "int", "batchStartsAt", ",", "int", "batchSize", ",", "A", "[", "]", "arg0", ")", "{", "checkBounds", "(", "arg0", ",", "bat...
Allows one user supplied argument. @param translator The user specified translation for each event @param batchStartsAt The first element of the array which is within the batch. @param batchSize The actual size of the batch @param arg0 An array of user supplied arguments, one element per event. @return true if the value was published, false if there was insufficient capacity. @see #tryPublishEvents(EventTranslator[])
[ "Allows", "one", "user", "supplied", "argument", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java#L612-L621
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java
ExecutionGraph.updateJobStatus
public void updateJobStatus(final InternalJobStatus newJobStatus, String optionalMessage) { // Check if the new job status equals the old one if (this.jobStatus.getAndSet(newJobStatus) == newJobStatus) { return; } // The task caused the entire job to fail, save the error description if (newJobStatus == InternalJobStatus.FAILING) { this.errorDescription = optionalMessage; } // If this is the final failure state change, reuse the saved error description if (newJobStatus == InternalJobStatus.FAILED) { optionalMessage = this.errorDescription; } final Iterator<JobStatusListener> it = this.jobStatusListeners.iterator(); while (it.hasNext()) { it.next().jobStatusHasChanged(this, newJobStatus, optionalMessage); } }
java
public void updateJobStatus(final InternalJobStatus newJobStatus, String optionalMessage) { // Check if the new job status equals the old one if (this.jobStatus.getAndSet(newJobStatus) == newJobStatus) { return; } // The task caused the entire job to fail, save the error description if (newJobStatus == InternalJobStatus.FAILING) { this.errorDescription = optionalMessage; } // If this is the final failure state change, reuse the saved error description if (newJobStatus == InternalJobStatus.FAILED) { optionalMessage = this.errorDescription; } final Iterator<JobStatusListener> it = this.jobStatusListeners.iterator(); while (it.hasNext()) { it.next().jobStatusHasChanged(this, newJobStatus, optionalMessage); } }
[ "public", "void", "updateJobStatus", "(", "final", "InternalJobStatus", "newJobStatus", ",", "String", "optionalMessage", ")", "{", "// Check if the new job status equals the old one", "if", "(", "this", ".", "jobStatus", ".", "getAndSet", "(", "newJobStatus", ")", "=="...
Updates the job status to given status and triggers the execution of the {@link JobStatusListener} objects. @param newJobStatus the new job status @param optionalMessage an optional message providing details on the reasons for the state change
[ "Updates", "the", "job", "status", "to", "given", "status", "and", "triggers", "the", "execution", "of", "the", "{", "@link", "JobStatusListener", "}", "objects", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java#L1221-L1242
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopsFlowToJobSpecCompiler.java
MultiHopsFlowToJobSpecCompiler.weightGraphGenerateHelper
private void weightGraphGenerateHelper(TopologySpec topologySpec) { try { Map<ServiceNode, ServiceNode> capabilities = topologySpec.getSpecExecutor().getCapabilities().get(); for (Map.Entry<ServiceNode, ServiceNode> capability : capabilities.entrySet()) { BaseServiceNodeImpl sourceNode = new BaseServiceNodeImpl(capability.getKey().getNodeName()); BaseServiceNodeImpl targetNode = new BaseServiceNodeImpl(capability.getValue().getNodeName()); if (!weightedGraph.containsVertex(sourceNode)) { weightedGraph.addVertex(sourceNode); } if (!weightedGraph.containsVertex(targetNode)) { weightedGraph.addVertex(targetNode); } FlowEdge flowEdge = new LoadBasedFlowEdgeImpl(sourceNode, targetNode, defaultFlowEdgeProps, topologySpec.getSpecExecutor()); // In Multi-Graph if flowEdge existed, just skip it. if (!weightedGraph.containsEdge(flowEdge)) { weightedGraph.addEdge(sourceNode, targetNode, flowEdge); } } } catch (InterruptedException | ExecutionException e) { Instrumented.markMeter(this.flowCompilationFailedMeter); throw new RuntimeException("Cannot determine topology capabilities", e); } }
java
private void weightGraphGenerateHelper(TopologySpec topologySpec) { try { Map<ServiceNode, ServiceNode> capabilities = topologySpec.getSpecExecutor().getCapabilities().get(); for (Map.Entry<ServiceNode, ServiceNode> capability : capabilities.entrySet()) { BaseServiceNodeImpl sourceNode = new BaseServiceNodeImpl(capability.getKey().getNodeName()); BaseServiceNodeImpl targetNode = new BaseServiceNodeImpl(capability.getValue().getNodeName()); if (!weightedGraph.containsVertex(sourceNode)) { weightedGraph.addVertex(sourceNode); } if (!weightedGraph.containsVertex(targetNode)) { weightedGraph.addVertex(targetNode); } FlowEdge flowEdge = new LoadBasedFlowEdgeImpl(sourceNode, targetNode, defaultFlowEdgeProps, topologySpec.getSpecExecutor()); // In Multi-Graph if flowEdge existed, just skip it. if (!weightedGraph.containsEdge(flowEdge)) { weightedGraph.addEdge(sourceNode, targetNode, flowEdge); } } } catch (InterruptedException | ExecutionException e) { Instrumented.markMeter(this.flowCompilationFailedMeter); throw new RuntimeException("Cannot determine topology capabilities", e); } }
[ "private", "void", "weightGraphGenerateHelper", "(", "TopologySpec", "topologySpec", ")", "{", "try", "{", "Map", "<", "ServiceNode", ",", "ServiceNode", ">", "capabilities", "=", "topologySpec", ".", "getSpecExecutor", "(", ")", ".", "getCapabilities", "(", ")", ...
Helper function for transform TopologySpecMap into a weightedDirectedGraph.
[ "Helper", "function", "for", "transform", "TopologySpecMap", "into", "a", "weightedDirectedGraph", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/MultiHopsFlowToJobSpecCompiler.java#L245-L272
RestComm/jdiameter
core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/WeightedLeastConnectionsRouter.java
WeightedLeastConnectionsRouter.getRecord
protected long getRecord(String record, IStatistic stats) { if (record == null || stats == null) { return 0; } IStatisticRecord statsRecord = stats.getRecordByName(record); if (statsRecord == null) { if (logger.isDebugEnabled()) { logger.debug("Warning: no record for {}, available: {}", record, Arrays.toString(stats.getRecords())); } return 0; } return statsRecord.getValueAsLong(); }
java
protected long getRecord(String record, IStatistic stats) { if (record == null || stats == null) { return 0; } IStatisticRecord statsRecord = stats.getRecordByName(record); if (statsRecord == null) { if (logger.isDebugEnabled()) { logger.debug("Warning: no record for {}, available: {}", record, Arrays.toString(stats.getRecords())); } return 0; } return statsRecord.getValueAsLong(); }
[ "protected", "long", "getRecord", "(", "String", "record", ",", "IStatistic", "stats", ")", "{", "if", "(", "record", "==", "null", "||", "stats", "==", "null", ")", "{", "return", "0", ";", "}", "IStatisticRecord", "statsRecord", "=", "stats", ".", "get...
Return statistics record value from given {@link IStatistic} @param record key to retrieve @param stats statistic object @return
[ "Return", "statistics", "record", "value", "from", "given", "{", "@link", "IStatistic", "}" ]
train
https://github.com/RestComm/jdiameter/blob/672134c378ea9704bf06dbe1985872ad4ebf4640/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/WeightedLeastConnectionsRouter.java#L198-L210
spockframework/spock
spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java
GroovyRuntimeUtil.invokeClosure
@SuppressWarnings("unchecked") public static <T> T invokeClosure(Closure<T> closure, Object... args) { try { return closure.call(args); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
java
@SuppressWarnings("unchecked") public static <T> T invokeClosure(Closure<T> closure, Object... args) { try { return closure.call(args); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "invokeClosure", "(", "Closure", "<", "T", ">", "closure", ",", "Object", "...", "args", ")", "{", "try", "{", "return", "closure", ".", "call", "(", "args", ")...
Note: This method may throw checked exceptions although it doesn't say so.
[ "Note", ":", "This", "method", "may", "throw", "checked", "exceptions", "although", "it", "doesn", "t", "say", "so", "." ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java#L198-L206
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.findByG_A
@Override public List<CommerceCountry> findByG_A(long groupId, boolean active, int start, int end, OrderByComparator<CommerceCountry> orderByComparator) { return findByG_A(groupId, active, start, end, orderByComparator, true); }
java
@Override public List<CommerceCountry> findByG_A(long groupId, boolean active, int start, int end, OrderByComparator<CommerceCountry> orderByComparator) { return findByG_A(groupId, active, start, end, orderByComparator, true); }
[ "@", "Override", "public", "List", "<", "CommerceCountry", ">", "findByG_A", "(", "long", "groupId", ",", "boolean", "active", ",", "int", "start", ",", "int", "end", ",", "OrderByComparator", "<", "CommerceCountry", ">", "orderByComparator", ")", "{", "return...
Returns an ordered range of all the commerce countries where groupId = &#63; and active = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceCountryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param active the active @param start the lower bound of the range of commerce countries @param end the upper bound of the range of commerce countries (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching commerce countries
[ "Returns", "an", "ordered", "range", "of", "all", "the", "commerce", "countries", "where", "groupId", "=", "&#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#L2524-L2528
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/message/MessageImpl.java
MessageImpl.removeReaction
public void removeReaction(Emoji emoji, boolean you) { Optional<Reaction> reaction = reactions.stream().filter(r -> emoji.equalsEmoji(r.getEmoji())).findAny(); reaction.ifPresent(r -> ((ReactionImpl) r).decrementCount(you)); reactions.removeIf(r -> r.getCount() <= 0); }
java
public void removeReaction(Emoji emoji, boolean you) { Optional<Reaction> reaction = reactions.stream().filter(r -> emoji.equalsEmoji(r.getEmoji())).findAny(); reaction.ifPresent(r -> ((ReactionImpl) r).decrementCount(you)); reactions.removeIf(r -> r.getCount() <= 0); }
[ "public", "void", "removeReaction", "(", "Emoji", "emoji", ",", "boolean", "you", ")", "{", "Optional", "<", "Reaction", ">", "reaction", "=", "reactions", ".", "stream", "(", ")", ".", "filter", "(", "r", "->", "emoji", ".", "equalsEmoji", "(", "r", "...
Removes an emoji from the list of reactions. @param emoji The emoji. @param you Whether this reaction is used by you or not.
[ "Removes", "an", "emoji", "from", "the", "list", "of", "reactions", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/message/MessageImpl.java#L274-L278
loadimpact/loadimpact-sdk-java
src/main/java/com/loadimpact/util/StringUtils.java
StringUtils.startsWith
public static boolean startsWith(Object target, String prefix) { if (target==null || prefix==null) return false; String targetTxt = target.toString(); return targetTxt.length() > 0 && targetTxt.startsWith(prefix); }
java
public static boolean startsWith(Object target, String prefix) { if (target==null || prefix==null) return false; String targetTxt = target.toString(); return targetTxt.length() > 0 && targetTxt.startsWith(prefix); }
[ "public", "static", "boolean", "startsWith", "(", "Object", "target", ",", "String", "prefix", ")", "{", "if", "(", "target", "==", "null", "||", "prefix", "==", "null", ")", "return", "false", ";", "String", "targetTxt", "=", "target", ".", "toString", ...
Returns true if the target string has a value and starts with the given prefix (null-safe). @param target string to investigate @param prefix substring to check for @return true if prefix starts in target
[ "Returns", "true", "if", "the", "target", "string", "has", "a", "value", "and", "starts", "with", "the", "given", "prefix", "(", "null", "-", "safe", ")", "." ]
train
https://github.com/loadimpact/loadimpact-sdk-java/blob/49af80b768c5453266414108b0d30a0fc01b8cef/src/main/java/com/loadimpact/util/StringUtils.java#L44-L48
aseovic/coherence-tools
core/src/main/java/com/seovic/core/extractor/PropertyExtractor.java
PropertyExtractor.findReadMethod
protected Method findReadMethod(String propertyName, Class cls) { String name = Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); for (String prefix : PREFIXES) { try { return cls.getMethod(prefix + name); } catch (NoSuchMethodException ignore) { } } return null; }
java
protected Method findReadMethod(String propertyName, Class cls) { String name = Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); for (String prefix : PREFIXES) { try { return cls.getMethod(prefix + name); } catch (NoSuchMethodException ignore) { } } return null; }
[ "protected", "Method", "findReadMethod", "(", "String", "propertyName", ",", "Class", "cls", ")", "{", "String", "name", "=", "Character", ".", "toUpperCase", "(", "propertyName", ".", "charAt", "(", "0", ")", ")", "+", "propertyName", ".", "substring", "(",...
Attempt to find a read method for the specified property name. <p/> This method attempts to find a read method by prepending prefixes 'get' and 'is' to the specified property name, in that order. @param propertyName property name @param cls class containing the property @return read method for the property, or <tt>null</tt> if the method cannot be found
[ "Attempt", "to", "find", "a", "read", "method", "for", "the", "specified", "property", "name", ".", "<p", "/", ">", "This", "method", "attempts", "to", "find", "a", "read", "method", "by", "prepending", "prefixes", "get", "and", "is", "to", "the", "speci...
train
https://github.com/aseovic/coherence-tools/blob/561a1d7e572ad98657fcd26beb1164891b0cd6fe/core/src/main/java/com/seovic/core/extractor/PropertyExtractor.java#L122-L135
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/DetectFiducialSquareGrid.java
DetectFiducialSquareGrid.lookupDetection
private Detection lookupDetection( long found , int gridIndex) { for (int i = 0; i < detections.size(); i++) { Detection d = detections.get(i); if( d.id == found ) { return d; } } Detection d = detections.grow(); d.reset(); d.id = found; d.gridIndex = gridIndex; return d; }
java
private Detection lookupDetection( long found , int gridIndex) { for (int i = 0; i < detections.size(); i++) { Detection d = detections.get(i); if( d.id == found ) { return d; } } Detection d = detections.grow(); d.reset(); d.id = found; d.gridIndex = gridIndex; return d; }
[ "private", "Detection", "lookupDetection", "(", "long", "found", ",", "int", "gridIndex", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "detections", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Detection", "d", "=", "detections", ...
Looks up a detection given the fiducial ID number. If not seen before the gridIndex is saved and a new instance returned.
[ "Looks", "up", "a", "detection", "given", "the", "fiducial", "ID", "number", ".", "If", "not", "seen", "before", "the", "gridIndex", "is", "saved", "and", "a", "new", "instance", "returned", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/DetectFiducialSquareGrid.java#L141-L155
getsentry/sentry-java
sentry/src/main/java/io/sentry/SentryClientFactory.java
SentryClientFactory.sentryClient
public static SentryClient sentryClient(String dsn, SentryClientFactory sentryClientFactory) { Dsn realDsn = resolveDsn(dsn); // If the caller didn't pass a factory, try to look one up if (sentryClientFactory == null) { String sentryClientFactoryName = Lookup.lookup("factory", realDsn); if (Util.isNullOrEmpty(sentryClientFactoryName)) { // no name specified, use the default factory sentryClientFactory = new DefaultSentryClientFactory(); } else { // attempt to construct the user specified factory class Class<? extends SentryClientFactory> factoryClass = null; try { factoryClass = (Class<? extends SentryClientFactory>) Class.forName(sentryClientFactoryName); sentryClientFactory = factoryClass.newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { logger.error("Error creating SentryClient using factory class: '" + sentryClientFactoryName + "'.", e); return null; } } } return sentryClientFactory.createSentryClient(realDsn); }
java
public static SentryClient sentryClient(String dsn, SentryClientFactory sentryClientFactory) { Dsn realDsn = resolveDsn(dsn); // If the caller didn't pass a factory, try to look one up if (sentryClientFactory == null) { String sentryClientFactoryName = Lookup.lookup("factory", realDsn); if (Util.isNullOrEmpty(sentryClientFactoryName)) { // no name specified, use the default factory sentryClientFactory = new DefaultSentryClientFactory(); } else { // attempt to construct the user specified factory class Class<? extends SentryClientFactory> factoryClass = null; try { factoryClass = (Class<? extends SentryClientFactory>) Class.forName(sentryClientFactoryName); sentryClientFactory = factoryClass.newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { logger.error("Error creating SentryClient using factory class: '" + sentryClientFactoryName + "'.", e); return null; } } } return sentryClientFactory.createSentryClient(realDsn); }
[ "public", "static", "SentryClient", "sentryClient", "(", "String", "dsn", ",", "SentryClientFactory", "sentryClientFactory", ")", "{", "Dsn", "realDsn", "=", "resolveDsn", "(", "dsn", ")", ";", "// If the caller didn't pass a factory, try to look one up", "if", "(", "se...
Creates an instance of Sentry using the provided DSN and the specified factory. @param dsn Data Source Name of the Sentry server. @param sentryClientFactory SentryClientFactory instance to use, or null to do a config lookup. @return SentryClient instance, or null if one couldn't be constructed.
[ "Creates", "an", "instance", "of", "Sentry", "using", "the", "provided", "DSN", "and", "the", "specified", "factory", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/SentryClientFactory.java#L41-L65
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CPInstanceLocalServiceBaseImpl.java
CPInstanceLocalServiceBaseImpl.fetchCPInstanceByUuidAndGroupId
@Override public CPInstance fetchCPInstanceByUuidAndGroupId(String uuid, long groupId) { return cpInstancePersistence.fetchByUUID_G(uuid, groupId); }
java
@Override public CPInstance fetchCPInstanceByUuidAndGroupId(String uuid, long groupId) { return cpInstancePersistence.fetchByUUID_G(uuid, groupId); }
[ "@", "Override", "public", "CPInstance", "fetchCPInstanceByUuidAndGroupId", "(", "String", "uuid", ",", "long", "groupId", ")", "{", "return", "cpInstancePersistence", ".", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "}" ]
Returns the cp instance matching the UUID and group. @param uuid the cp instance's UUID @param groupId the primary key of the group @return the matching cp instance, or <code>null</code> if a matching cp instance could not be found
[ "Returns", "the", "cp", "instance", "matching", "the", "UUID", "and", "group", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CPInstanceLocalServiceBaseImpl.java#L267-L270
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/techsupport.java
techsupport.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { techsupport_responses result = (techsupport_responses) service.get_payload_formatter().string_to_resource(techsupport_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.techsupport_response_array); } techsupport[] result_techsupport = new techsupport[result.techsupport_response_array.length]; for(int i = 0; i < result.techsupport_response_array.length; i++) { result_techsupport[i] = result.techsupport_response_array[i].techsupport[0]; } return result_techsupport; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { techsupport_responses result = (techsupport_responses) service.get_payload_formatter().string_to_resource(techsupport_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.techsupport_response_array); } techsupport[] result_techsupport = new techsupport[result.techsupport_response_array.length]; for(int i = 0; i < result.techsupport_response_array.length; i++) { result_techsupport[i] = result.techsupport_response_array[i].techsupport[0]; } return result_techsupport; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "techsupport_responses", "result", "=", "(", "techsupport_responses", ")", "service", ".", "get_payload_format...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/techsupport.java#L329-L346
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java
ObjectUpdater.buildErrorStatus
private void buildErrorStatus(ObjectResult result, String objID, Throwable ex) { result.setStatus(ObjectResult.Status.ERROR); result.setErrorMessage(ex.getLocalizedMessage()); if (!Utils.isEmpty(objID)) { result.setObjectID(objID); } if (ex instanceof IllegalArgumentException) { m_logger.debug("Object update error: {}", ex.toString()); } else { result.setStackTrace(Utils.getStackTrace(ex)); m_logger.debug("Object update error: {} stacktrace: {}", ex.toString(), Utils.getStackTrace(ex)); } }
java
private void buildErrorStatus(ObjectResult result, String objID, Throwable ex) { result.setStatus(ObjectResult.Status.ERROR); result.setErrorMessage(ex.getLocalizedMessage()); if (!Utils.isEmpty(objID)) { result.setObjectID(objID); } if (ex instanceof IllegalArgumentException) { m_logger.debug("Object update error: {}", ex.toString()); } else { result.setStackTrace(Utils.getStackTrace(ex)); m_logger.debug("Object update error: {} stacktrace: {}", ex.toString(), Utils.getStackTrace(ex)); } }
[ "private", "void", "buildErrorStatus", "(", "ObjectResult", "result", ",", "String", "objID", ",", "Throwable", "ex", ")", "{", "result", ".", "setStatus", "(", "ObjectResult", ".", "Status", ".", "ERROR", ")", ";", "result", ".", "setErrorMessage", "(", "ex...
Add error fields to the given ObjectResult due to the given exception.
[ "Add", "error", "fields", "to", "the", "given", "ObjectResult", "due", "to", "the", "given", "exception", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java#L208-L221
playn/playn
java-base/src/playn/java/JavaAssets.java
JavaAssets.requireResource
protected Resource requireResource(String path) throws IOException { URL url = getClass().getClassLoader().getResource(pathPrefix + path); if (url != null) { return url.getProtocol().equals("file") ? new FileResource(new File(URLDecoder.decode(url.getPath(), "UTF-8"))) : new URLResource(url); } for (File dir : directories) { File f = new File(dir, path).getCanonicalFile(); if (f.exists()) { return new FileResource(f); } } throw new FileNotFoundException(path); }
java
protected Resource requireResource(String path) throws IOException { URL url = getClass().getClassLoader().getResource(pathPrefix + path); if (url != null) { return url.getProtocol().equals("file") ? new FileResource(new File(URLDecoder.decode(url.getPath(), "UTF-8"))) : new URLResource(url); } for (File dir : directories) { File f = new File(dir, path).getCanonicalFile(); if (f.exists()) { return new FileResource(f); } } throw new FileNotFoundException(path); }
[ "protected", "Resource", "requireResource", "(", "String", "path", ")", "throws", "IOException", "{", "URL", "url", "=", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "getResource", "(", "pathPrefix", "+", "path", ")", ";", "if", "(", "url", ...
Attempts to locate the resource at the given path, and returns a wrapper which allows its data to be efficiently read. <p>First, the path prefix is prepended (see {@link #setPathPrefix(String)}) and the the class loader checked. If not found, then the extra directories, if any, are checked, in order. If the file is not found in any of the extra directories either, then an exception is thrown.
[ "Attempts", "to", "locate", "the", "resource", "at", "the", "given", "path", "and", "returns", "a", "wrapper", "which", "allows", "its", "data", "to", "be", "efficiently", "read", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaAssets.java#L174-L188
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/Interval.java
Interval.forEach
public void forEach(Procedure<? super Integer> procedure, Executor executor) { CountDownLatch latch = new CountDownLatch(this.size()); if (this.goForward()) { // Iterates in forward direction because step value is negative for (int i = this.from; i <= this.to; i += this.step) { this.executeAndCountdown(procedure, executor, latch, i); } } else { // Iterates in reverse because step value is negative for (int i = this.from; i >= this.to; i += this.step) { this.executeAndCountdown(procedure, executor, latch, i); } } try { latch.await(); } catch (InterruptedException e) { // do nothing here; } }
java
public void forEach(Procedure<? super Integer> procedure, Executor executor) { CountDownLatch latch = new CountDownLatch(this.size()); if (this.goForward()) { // Iterates in forward direction because step value is negative for (int i = this.from; i <= this.to; i += this.step) { this.executeAndCountdown(procedure, executor, latch, i); } } else { // Iterates in reverse because step value is negative for (int i = this.from; i >= this.to; i += this.step) { this.executeAndCountdown(procedure, executor, latch, i); } } try { latch.await(); } catch (InterruptedException e) { // do nothing here; } }
[ "public", "void", "forEach", "(", "Procedure", "<", "?", "super", "Integer", ">", "procedure", ",", "Executor", "executor", ")", "{", "CountDownLatch", "latch", "=", "new", "CountDownLatch", "(", "this", ".", "size", "(", ")", ")", ";", "if", "(", "this"...
This method executes a void procedure against an executor, passing the current index of the interval.
[ "This", "method", "executes", "a", "void", "procedure", "against", "an", "executor", "passing", "the", "current", "index", "of", "the", "interval", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L481-L508
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java
ArabicShaping.handleTashkeelWithTatweel
private static int handleTashkeelWithTatweel(char[] dest, int sourceLength) { int i; for(i = 0; i < sourceLength; i++){ if((isTashkeelOnTatweelChar(dest[i]) == 1)){ dest[i] = TATWEEL_CHAR; }else if((isTashkeelOnTatweelChar(dest[i]) == 2)){ dest[i] = SHADDA_TATWEEL_CHAR; }else if((isIsolatedTashkeelChar(dest[i])==1) && dest[i] != SHADDA_CHAR){ dest[i] = SPACE_CHAR; } } return sourceLength; }
java
private static int handleTashkeelWithTatweel(char[] dest, int sourceLength) { int i; for(i = 0; i < sourceLength; i++){ if((isTashkeelOnTatweelChar(dest[i]) == 1)){ dest[i] = TATWEEL_CHAR; }else if((isTashkeelOnTatweelChar(dest[i]) == 2)){ dest[i] = SHADDA_TATWEEL_CHAR; }else if((isIsolatedTashkeelChar(dest[i])==1) && dest[i] != SHADDA_CHAR){ dest[i] = SPACE_CHAR; } } return sourceLength; }
[ "private", "static", "int", "handleTashkeelWithTatweel", "(", "char", "[", "]", "dest", ",", "int", "sourceLength", ")", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "sourceLength", ";", "i", "++", ")", "{", "if", "(", "(", "isTa...
/* Name : handleTashkeelWithTatweel Function : Replaces Tashkeel as following: Case 1 :if the Tashkeel on tatweel, replace it with Tatweel. Case 2 :if the Tashkeel aggregated with Shadda on Tatweel, replace it with Shadda on Tatweel. Case 3: if the Tashkeel is isolated replace it with Space.
[ "/", "*", "Name", ":", "handleTashkeelWithTatweel", "Function", ":", "Replaces", "Tashkeel", "as", "following", ":", "Case", "1", ":", "if", "the", "Tashkeel", "on", "tatweel", "replace", "it", "with", "Tatweel", ".", "Case", "2", ":", "if", "the", "Tashke...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java#L1207-L1219
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java
TypesafeConfigUtils.getInteger
public static Integer getInteger(Config config, String path) { try { Object obj = config.getAnyRef(path); return obj instanceof Number ? ((Number) obj).intValue() : null; } catch (ConfigException.Missing | ConfigException.WrongType e) { if (e instanceof ConfigException.WrongType) { LOGGER.warn(e.getMessage(), e); } return null; } }
java
public static Integer getInteger(Config config, String path) { try { Object obj = config.getAnyRef(path); return obj instanceof Number ? ((Number) obj).intValue() : null; } catch (ConfigException.Missing | ConfigException.WrongType e) { if (e instanceof ConfigException.WrongType) { LOGGER.warn(e.getMessage(), e); } return null; } }
[ "public", "static", "Integer", "getInteger", "(", "Config", "config", ",", "String", "path", ")", "{", "try", "{", "Object", "obj", "=", "config", ".", "getAnyRef", "(", "path", ")", ";", "return", "obj", "instanceof", "Number", "?", "(", "(", "Number", ...
Get a configuration as Integer. Return {@code null} if missing or wrong type. @param config @param path @return
[ "Get", "a", "configuration", "as", "Integer", ".", "Return", "{", "@code", "null", "}", "if", "missing", "or", "wrong", "type", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L305-L315
Breinify/brein-time-utilities
src/com/brein/time/timeseries/BucketTimeSeries.java
BucketTimeSeries.fill
protected void fill(int fromIndex, int endIndex) { fromIndex = fromIndex == -1 ? 0 : fromIndex; endIndex = endIndex == -1 || endIndex > this.timeSeries.length ? this.timeSeries.length : endIndex; final T val; if (applyZero()) { val = zero(); } else { val = null; } // set the values for (int i = fromIndex; i < endIndex; i++) { set(i, val); } }
java
protected void fill(int fromIndex, int endIndex) { fromIndex = fromIndex == -1 ? 0 : fromIndex; endIndex = endIndex == -1 || endIndex > this.timeSeries.length ? this.timeSeries.length : endIndex; final T val; if (applyZero()) { val = zero(); } else { val = null; } // set the values for (int i = fromIndex; i < endIndex; i++) { set(i, val); } }
[ "protected", "void", "fill", "(", "int", "fromIndex", ",", "int", "endIndex", ")", "{", "fromIndex", "=", "fromIndex", "==", "-", "1", "?", "0", ":", "fromIndex", ";", "endIndex", "=", "endIndex", "==", "-", "1", "||", "endIndex", ">", "this", ".", "...
Resets the values from [fromIndex, endIndex). @param fromIndex the index to start from (included) @param endIndex the index to end (excluded)
[ "Resets", "the", "values", "from", "[", "fromIndex", "endIndex", ")", "." ]
train
https://github.com/Breinify/brein-time-utilities/blob/ec0165a50ec1951ec7730b72c85c801c2018f314/src/com/brein/time/timeseries/BucketTimeSeries.java#L125-L140
mikepenz/FastAdapter
library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java
OnBindViewHolderListenerImpl.onBindViewHolder
@Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, List<Object> payloads) { Object tag = viewHolder.itemView.getTag(R.id.fastadapter_item_adapter); if (tag instanceof FastAdapter) { FastAdapter fastAdapter = ((FastAdapter) tag); IItem item = fastAdapter.getItem(position); if (item != null) { item.bindView(viewHolder, payloads); if (viewHolder instanceof FastAdapter.ViewHolder) { ((FastAdapter.ViewHolder) viewHolder).bindView(item, payloads); } //set the R.id.fastadapter_item tag of this item to the item object (can be used when retrieving the view) viewHolder.itemView.setTag(R.id.fastadapter_item, item); } } }
java
@Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, List<Object> payloads) { Object tag = viewHolder.itemView.getTag(R.id.fastadapter_item_adapter); if (tag instanceof FastAdapter) { FastAdapter fastAdapter = ((FastAdapter) tag); IItem item = fastAdapter.getItem(position); if (item != null) { item.bindView(viewHolder, payloads); if (viewHolder instanceof FastAdapter.ViewHolder) { ((FastAdapter.ViewHolder) viewHolder).bindView(item, payloads); } //set the R.id.fastadapter_item tag of this item to the item object (can be used when retrieving the view) viewHolder.itemView.setTag(R.id.fastadapter_item, item); } } }
[ "@", "Override", "public", "void", "onBindViewHolder", "(", "RecyclerView", ".", "ViewHolder", "viewHolder", ",", "int", "position", ",", "List", "<", "Object", ">", "payloads", ")", "{", "Object", "tag", "=", "viewHolder", ".", "itemView", ".", "getTag", "(...
is called in onBindViewHolder to bind the data on the ViewHolder @param viewHolder the viewHolder for the type at this position @param position the position of this viewHolder @param payloads the payloads provided by the adapter
[ "is", "called", "in", "onBindViewHolder", "to", "bind", "the", "data", "on", "the", "ViewHolder" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java#L21-L36
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java
SecStrucCalc.shouldExtendLadder
private boolean shouldExtendLadder(Ladder ladder, BetaBridge b) { //Only extend if they are of the same type boolean sameType = b.type.equals(ladder.btype); if (!sameType) return false; //Only extend if residue 1 is sequential to ladder strand boolean sequential = (b.partner1 == ladder.to+1); if (!sequential) return false; switch(b.type){ case parallel: //Residue 2 should be sequential to second strand if (b.partner2 == ladder.lto+1) return true; break; case antiparallel: //Residue 2 should be previous to second strand if (b.partner2 == ladder.lfrom-1) return true; break; } return false; }
java
private boolean shouldExtendLadder(Ladder ladder, BetaBridge b) { //Only extend if they are of the same type boolean sameType = b.type.equals(ladder.btype); if (!sameType) return false; //Only extend if residue 1 is sequential to ladder strand boolean sequential = (b.partner1 == ladder.to+1); if (!sequential) return false; switch(b.type){ case parallel: //Residue 2 should be sequential to second strand if (b.partner2 == ladder.lto+1) return true; break; case antiparallel: //Residue 2 should be previous to second strand if (b.partner2 == ladder.lfrom-1) return true; break; } return false; }
[ "private", "boolean", "shouldExtendLadder", "(", "Ladder", "ladder", ",", "BetaBridge", "b", ")", "{", "//Only extend if they are of the same type", "boolean", "sameType", "=", "b", ".", "type", ".", "equals", "(", "ladder", ".", "btype", ")", ";", "if", "(", ...
Conditions to extend a ladder with a given beta Bridge: <li>The bridge and ladder are of the same type. <li>The smallest bridge residue is sequential to the first strand ladder. <li>The second bridge residue is either sequential (parallel) or previous (antiparallel) to the second strand of the ladder </li> @param ladder the ladder candidate to extend @param b the beta bridge that would extend the ladder @return true if the bridge b extends the ladder
[ "Conditions", "to", "extend", "a", "ladder", "with", "a", "given", "beta", "Bridge", ":", "<li", ">", "The", "bridge", "and", "ladder", "are", "of", "the", "same", "type", ".", "<li", ">", "The", "smallest", "bridge", "residue", "is", "sequential", "to",...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java#L382-L403
google/closure-templates
java/src/com/google/template/soy/jbcsrc/ProtoUtils.java
ProtoUtils.accessField
static SoyExpression accessField( SoyProtoType protoType, SoyExpression baseExpr, FieldAccessNode node) { return new AccessorGenerator(protoType, baseExpr, node).generate(); }
java
static SoyExpression accessField( SoyProtoType protoType, SoyExpression baseExpr, FieldAccessNode node) { return new AccessorGenerator(protoType, baseExpr, node).generate(); }
[ "static", "SoyExpression", "accessField", "(", "SoyProtoType", "protoType", ",", "SoyExpression", "baseExpr", ",", "FieldAccessNode", "node", ")", "{", "return", "new", "AccessorGenerator", "(", "protoType", ",", "baseExpr", ",", "node", ")", ".", "generate", "(",...
Returns a {@link SoyExpression} for accessing a field of a proto. @param protoType The type of the proto being accessed @param baseExpr The proto being accessed @param node The field access operation
[ "Returns", "a", "{", "@link", "SoyExpression", "}", "for", "accessing", "a", "field", "of", "a", "proto", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ProtoUtils.java#L200-L203
alkacon/opencms-core
src/org/opencms/search/CmsSearchCategoryCollector.java
CmsSearchCategoryCollector.formatCategoryMap
public static final String formatCategoryMap(Map<String, Integer> categories) { StringBuffer result = new StringBuffer(256); result.append("Total categories: "); result.append(categories.size()); result.append('\n'); Iterator<Map.Entry<String, Integer>> i = categories.entrySet().iterator(); while (i.hasNext()) { Map.Entry<String, Integer> entry = i.next(); result.append(CmsStringUtil.padRight(entry.getKey(), 30)); result.append(entry.getValue().intValue()); result.append('\n'); } return result.toString(); }
java
public static final String formatCategoryMap(Map<String, Integer> categories) { StringBuffer result = new StringBuffer(256); result.append("Total categories: "); result.append(categories.size()); result.append('\n'); Iterator<Map.Entry<String, Integer>> i = categories.entrySet().iterator(); while (i.hasNext()) { Map.Entry<String, Integer> entry = i.next(); result.append(CmsStringUtil.padRight(entry.getKey(), 30)); result.append(entry.getValue().intValue()); result.append('\n'); } return result.toString(); }
[ "public", "static", "final", "String", "formatCategoryMap", "(", "Map", "<", "String", ",", "Integer", ">", "categories", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "256", ")", ";", "result", ".", "append", "(", "\"Total categories: \...
Convenience method to format a map of categories in a nice 2 column list, for example for display of debugging output.<p> @param categories the map to format @return the formatted category map
[ "Convenience", "method", "to", "format", "a", "map", "of", "categories", "in", "a", "nice", "2", "column", "list", "for", "example", "for", "display", "of", "debugging", "output", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchCategoryCollector.java#L130-L144
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/JobConf.java
JobConf.setProfileTaskRange
public void setProfileTaskRange(boolean isMap, String newValue) { // parse the value to make sure it is legal new Configuration.IntegerRanges(newValue); set((isMap ? "mapred.task.profile.maps" : "mapred.task.profile.reduces"), newValue); }
java
public void setProfileTaskRange(boolean isMap, String newValue) { // parse the value to make sure it is legal new Configuration.IntegerRanges(newValue); set((isMap ? "mapred.task.profile.maps" : "mapred.task.profile.reduces"), newValue); }
[ "public", "void", "setProfileTaskRange", "(", "boolean", "isMap", ",", "String", "newValue", ")", "{", "// parse the value to make sure it is legal", "new", "Configuration", ".", "IntegerRanges", "(", "newValue", ")", ";", "set", "(", "(", "isMap", "?", "\"mapred.ta...
Set the ranges of maps or reduces to profile. setProfileEnabled(true) must also be called. @param newValue a set of integer ranges of the map ids
[ "Set", "the", "ranges", "of", "maps", "or", "reduces", "to", "profile", ".", "setProfileEnabled", "(", "true", ")", "must", "also", "be", "called", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobConf.java#L1724-L1729
meertensinstituut/mtas
src/main/java/mtas/solr/handler/component/util/MtasSolrCollectionResult.java
MtasSolrCollectionResult.setImport
public void setImport(long now, SimpleOrderedMap<Object> status) throws IOException { if (action.equals(ComponentCollection.ACTION_IMPORT)) { this.now = now; this.status = status; } else { throw new IOException("not allowed with action '" + action + "'"); } }
java
public void setImport(long now, SimpleOrderedMap<Object> status) throws IOException { if (action.equals(ComponentCollection.ACTION_IMPORT)) { this.now = now; this.status = status; } else { throw new IOException("not allowed with action '" + action + "'"); } }
[ "public", "void", "setImport", "(", "long", "now", ",", "SimpleOrderedMap", "<", "Object", ">", "status", ")", "throws", "IOException", "{", "if", "(", "action", ".", "equals", "(", "ComponentCollection", ".", "ACTION_IMPORT", ")", ")", "{", "this", ".", "...
Sets the import. @param now the now @param status the status @throws IOException Signals that an I/O exception has occurred.
[ "Sets", "the", "import", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/component/util/MtasSolrCollectionResult.java#L164-L172
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java
MessageRetriever.notice
public void notice(SourcePosition pos, String key, Object... args) { printNotice(pos, getText(key, args)); }
java
public void notice(SourcePosition pos, String key, Object... args) { printNotice(pos, getText(key, args)); }
[ "public", "void", "notice", "(", "SourcePosition", "pos", ",", "String", "key", ",", "Object", "...", "args", ")", "{", "printNotice", "(", "pos", ",", "getText", "(", "key", ",", "args", ")", ")", ";", "}" ]
Print a message. @param pos the position of the source @param key selects message from resource @param args arguments to be replaced in the message.
[ "Print", "a", "message", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java#L236-L238
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/logging/RedwoodConfiguration.java
RedwoodConfiguration.splice
public RedwoodConfiguration splice(final LogRecordHandler parent, final LogRecordHandler toAdd, final LogRecordHandler grandchild){ tasks.add(new Runnable() { public void run() { Redwood.spliceHandler(parent, toAdd, grandchild);} }); return this; }
java
public RedwoodConfiguration splice(final LogRecordHandler parent, final LogRecordHandler toAdd, final LogRecordHandler grandchild){ tasks.add(new Runnable() { public void run() { Redwood.spliceHandler(parent, toAdd, grandchild);} }); return this; }
[ "public", "RedwoodConfiguration", "splice", "(", "final", "LogRecordHandler", "parent", ",", "final", "LogRecordHandler", "toAdd", ",", "final", "LogRecordHandler", "grandchild", ")", "{", "tasks", ".", "add", "(", "new", "Runnable", "(", ")", "{", "public", "vo...
Add a handler to as a child of an existing parent @param parent The handler to extend @param toAdd The new handler to add @param grandchild The subtree to attach to the new handler @return this
[ "Add", "a", "handler", "to", "as", "a", "child", "of", "an", "existing", "parent" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/logging/RedwoodConfiguration.java#L139-L142
dita-ot/dita-ot
src/main/java/org/dita/dost/writer/ValidationFilter.java
ValidationFilter.validateScope
private AttributesImpl validateScope(final Attributes atts, final AttributesImpl modified) { AttributesImpl res = modified; final String scope = atts.getValue(ATTRIBUTE_NAME_SCOPE); final URI href = toURI(atts.getValue(ATTRIBUTE_NAME_HREF)); if (scope == null && href != null && href.isAbsolute()) { final boolean sameScheme = Objects.equals(currentFile.getScheme(), href.getScheme()); final boolean sameAuthority = Objects.equals(currentFile.getRawAuthority(), href.getRawAuthority()); if (!(sameScheme && sameAuthority)) { switch (processingMode) { case LAX: if (res == null) { res = new AttributesImpl(atts); } addOrSetAttribute(res, ATTRIBUTE_NAME_SCOPE, ATTR_SCOPE_VALUE_EXTERNAL); logger.warn(MessageUtils.getMessage("DOTJ075W", href.toString()).setLocation(locator).toString()); break; default: logger.warn(MessageUtils.getMessage("DOTJ076W", href.toString()).setLocation(locator) + ", using invalid value."); break; } } } return res; }
java
private AttributesImpl validateScope(final Attributes atts, final AttributesImpl modified) { AttributesImpl res = modified; final String scope = atts.getValue(ATTRIBUTE_NAME_SCOPE); final URI href = toURI(atts.getValue(ATTRIBUTE_NAME_HREF)); if (scope == null && href != null && href.isAbsolute()) { final boolean sameScheme = Objects.equals(currentFile.getScheme(), href.getScheme()); final boolean sameAuthority = Objects.equals(currentFile.getRawAuthority(), href.getRawAuthority()); if (!(sameScheme && sameAuthority)) { switch (processingMode) { case LAX: if (res == null) { res = new AttributesImpl(atts); } addOrSetAttribute(res, ATTRIBUTE_NAME_SCOPE, ATTR_SCOPE_VALUE_EXTERNAL); logger.warn(MessageUtils.getMessage("DOTJ075W", href.toString()).setLocation(locator).toString()); break; default: logger.warn(MessageUtils.getMessage("DOTJ076W", href.toString()).setLocation(locator) + ", using invalid value."); break; } } } return res; }
[ "private", "AttributesImpl", "validateScope", "(", "final", "Attributes", "atts", ",", "final", "AttributesImpl", "modified", ")", "{", "AttributesImpl", "res", "=", "modified", ";", "final", "String", "scope", "=", "atts", ".", "getValue", "(", "ATTRIBUTE_NAME_SC...
Fix implicit {@code scope} attribute. @return modified attributes, {@code null} if there have been no changes
[ "Fix", "implicit", "{", "@code", "scope", "}", "attribute", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/ValidationFilter.java#L219-L242
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/compiler/Scope.java
Scope.getDeclaredVariable
public Variable getDeclaredVariable(String name, boolean publicOnly) { //private Set mPrivateVars; Variable var = mDeclared.get(name); if (var != null) { // If its okay to be private or its public then... if (!publicOnly || mPrivateVars == null || !mPrivateVars.contains(var)) { return var; } } if (mParent != null) { return mParent.getDeclaredVariable(name); } return null; }
java
public Variable getDeclaredVariable(String name, boolean publicOnly) { //private Set mPrivateVars; Variable var = mDeclared.get(name); if (var != null) { // If its okay to be private or its public then... if (!publicOnly || mPrivateVars == null || !mPrivateVars.contains(var)) { return var; } } if (mParent != null) { return mParent.getDeclaredVariable(name); } return null; }
[ "public", "Variable", "getDeclaredVariable", "(", "String", "name", ",", "boolean", "publicOnly", ")", "{", "//private Set mPrivateVars;", "Variable", "var", "=", "mDeclared", ".", "get", "(", "name", ")", ";", "if", "(", "var", "!=", "null", ")", "{", "// I...
Returns a declared variable by name. Search begins in this scope and moves up into parent scopes. If not found, null is returned. A public- only variable can be requested. @return Null if no declared variable found with the given name
[ "Returns", "a", "declared", "variable", "by", "name", ".", "Search", "begins", "in", "this", "scope", "and", "moves", "up", "into", "parent", "scopes", ".", "If", "not", "found", "null", "is", "returned", ".", "A", "public", "-", "only", "variable", "can...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Scope.java#L161-L178
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/dbserver/ConnectionManager.java
ConnectionManager.invokeWithClientSession
public <T> T invokeWithClientSession(int targetPlayer, ClientTask<T> task, String description) throws Exception { if (!isRunning()) { throw new IllegalStateException("ConnectionManager is not running, aborting " + description); } final Client client = allocateClient(targetPlayer, description); try { return task.useClient(client); } finally { freeClient(client); } }
java
public <T> T invokeWithClientSession(int targetPlayer, ClientTask<T> task, String description) throws Exception { if (!isRunning()) { throw new IllegalStateException("ConnectionManager is not running, aborting " + description); } final Client client = allocateClient(targetPlayer, description); try { return task.useClient(client); } finally { freeClient(client); } }
[ "public", "<", "T", ">", "T", "invokeWithClientSession", "(", "int", "targetPlayer", ",", "ClientTask", "<", "T", ">", "task", ",", "String", "description", ")", "throws", "Exception", "{", "if", "(", "!", "isRunning", "(", ")", ")", "{", "throw", "new",...
Obtain a dbserver client session that can be used to perform some task, call that task with the client, then release the client. @param targetPlayer the player number whose dbserver we wish to communicate with @param task the activity that will be performed with exclusive access to a dbserver connection @param description a short description of the task being performed for error reporting if it fails, should be a verb phrase like "requesting track metadata" @param <T> the type that will be returned by the task to be performed @return the value returned by the completed task @throws IOException if there is a problem communicating @throws Exception from the underlying {@code task}, if any
[ "Obtain", "a", "dbserver", "client", "session", "that", "can", "be", "used", "to", "perform", "some", "task", "call", "that", "task", "with", "the", "client", "then", "release", "the", "client", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/dbserver/ConnectionManager.java#L186-L198
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonServiceDocumentWriter.java
JsonServiceDocumentWriter.writeKind
private void writeKind(JsonGenerator jsonGenerator, Object entity) throws IOException { jsonGenerator.writeFieldName(KIND); if (entity instanceof EntitySet) { jsonGenerator.writeObject(ENTITY_SET); } else { jsonGenerator.writeObject(SINGLETON); } }
java
private void writeKind(JsonGenerator jsonGenerator, Object entity) throws IOException { jsonGenerator.writeFieldName(KIND); if (entity instanceof EntitySet) { jsonGenerator.writeObject(ENTITY_SET); } else { jsonGenerator.writeObject(SINGLETON); } }
[ "private", "void", "writeKind", "(", "JsonGenerator", "jsonGenerator", ",", "Object", "entity", ")", "throws", "IOException", "{", "jsonGenerator", ".", "writeFieldName", "(", "KIND", ")", ";", "if", "(", "entity", "instanceof", "EntitySet", ")", "{", "jsonGener...
Writes the kind of the entity. @param jsonGenerator jsonGenerator @param entity entity from the container
[ "Writes", "the", "kind", "of", "the", "entity", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonServiceDocumentWriter.java#L138-L145
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/SplitRegexOperation.java
SplitRegexOperation.performSplitting
private String performSplitting(String source, String splitString, String indexString) throws TransformationOperationException { Integer index = parseIntString(indexString, false, 0); Matcher matcher = generateMatcher(splitString, source); for (int i = 0; i <= index; i++) { matcher.find(); } String value = matcher.group(); if (value == null) { getLogger().warn("No result for given regex and index. The empty string will be taken instead."); value = ""; } return value; }
java
private String performSplitting(String source, String splitString, String indexString) throws TransformationOperationException { Integer index = parseIntString(indexString, false, 0); Matcher matcher = generateMatcher(splitString, source); for (int i = 0; i <= index; i++) { matcher.find(); } String value = matcher.group(); if (value == null) { getLogger().warn("No result for given regex and index. The empty string will be taken instead."); value = ""; } return value; }
[ "private", "String", "performSplitting", "(", "String", "source", ",", "String", "splitString", ",", "String", "indexString", ")", "throws", "TransformationOperationException", "{", "Integer", "index", "=", "parseIntString", "(", "indexString", ",", "false", ",", "0...
Performs the actual splitting operation. Throws a TransformationOperationException if the index string is not a number or causes an IndexOutOfBoundsException.
[ "Performs", "the", "actual", "splitting", "operation", ".", "Throws", "a", "TransformationOperationException", "if", "the", "index", "string", "is", "not", "a", "number", "or", "causes", "an", "IndexOutOfBoundsException", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/SplitRegexOperation.java#L74-L87
alkacon/opencms-core
src/org/opencms/jsp/CmsJspNavBuilder.java
CmsJspNavBuilder.getNavigationBreadCrumb
public List<CmsJspNavElement> getNavigationBreadCrumb(int startlevel, int endlevel) { return getNavigationBreadCrumb(m_requestUriFolder, startlevel, endlevel, true); }
java
public List<CmsJspNavElement> getNavigationBreadCrumb(int startlevel, int endlevel) { return getNavigationBreadCrumb(m_requestUriFolder, startlevel, endlevel, true); }
[ "public", "List", "<", "CmsJspNavElement", ">", "getNavigationBreadCrumb", "(", "int", "startlevel", ",", "int", "endlevel", ")", "{", "return", "getNavigationBreadCrumb", "(", "m_requestUriFolder", ",", "startlevel", ",", "endlevel", ",", "true", ")", ";", "}" ]
Build a "bread crumb" path navigation to the current folder.<p> @param startlevel the start level, if negative, go down |n| steps from selected folder @param endlevel the end level, if -1, build navigation to selected folder @return sorted list of navigation elements @see #getNavigationBreadCrumb(String, int, int, boolean)
[ "Build", "a", "bread", "crumb", "path", "navigation", "to", "the", "current", "folder", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspNavBuilder.java#L398-L401
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java
PropertyHelper.resolveProperty
public static String resolveProperty(Properties props, String original) { Matcher matcher = PROPERTY_TEMPLATE.matcher(original); StringBuilder buffer = new StringBuilder(); boolean found = false; while(matcher.find()) { found = true; String propertyName = matcher.group(2).trim(); buffer.append(matcher.group(1)) .append(props.containsKey(propertyName) ? props.getProperty(propertyName) : "") .append(matcher.group(3)); } return found ? buffer.toString() : original; }
java
public static String resolveProperty(Properties props, String original) { Matcher matcher = PROPERTY_TEMPLATE.matcher(original); StringBuilder buffer = new StringBuilder(); boolean found = false; while(matcher.find()) { found = true; String propertyName = matcher.group(2).trim(); buffer.append(matcher.group(1)) .append(props.containsKey(propertyName) ? props.getProperty(propertyName) : "") .append(matcher.group(3)); } return found ? buffer.toString() : original; }
[ "public", "static", "String", "resolveProperty", "(", "Properties", "props", ",", "String", "original", ")", "{", "Matcher", "matcher", "=", "PROPERTY_TEMPLATE", ".", "matcher", "(", "original", ")", ";", "StringBuilder", "buffer", "=", "new", "StringBuilder", "...
Replaces Ant-style property references if the corresponding keys exist in the provided {@link Properties}. @param props contains possible replacements @param original may contain Ant-style templates @return the original string with replaced properties or the unchanged original string if no placeholder found.
[ "Replaces", "Ant", "-", "style", "property", "references", "if", "the", "corresponding", "keys", "exist", "in", "the", "provided", "{", "@link", "Properties", "}", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java#L122-L134
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseLimitFieldSize
private void parseLimitFieldSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_FIELDSIZE); if (null != value) { try { this.limitFieldSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_LIMIT_FIELDSIZE, HttpConfigConstants.MAX_LIMIT_FIELDSIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: field size limit is " + getLimitOfFieldSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitFieldSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invaild max field size setting of " + value); } } } }
java
private void parseLimitFieldSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_FIELDSIZE); if (null != value) { try { this.limitFieldSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_LIMIT_FIELDSIZE, HttpConfigConstants.MAX_LIMIT_FIELDSIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: field size limit is " + getLimitOfFieldSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitFieldSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invaild max field size setting of " + value); } } } }
[ "private", "void", "parseLimitFieldSize", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_LIMIT_FIELDSIZE", ")", ";", "if", "(", "null", "!=", "value", ...
Check the input configuration for a maximum size allowed for HTTP fields. @param props
[ "Check", "the", "input", "configuration", "for", "a", "maximum", "size", "allowed", "for", "HTTP", "fields", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L812-L827
finmath/finmath-lib
src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java
ForwardCurveInterpolation.createForwardCurveFromMonteCarloLiborModel
public static ForwardCurveInterpolation createForwardCurveFromMonteCarloLiborModel(String name, LIBORModelMonteCarloSimulationModel model, double startTime) throws CalculationException{ int timeIndex = model.getTimeIndex(startTime); // Get all Libors at timeIndex which are not yet fixed (others null) and times for the timeDiscretizationFromArray of the curves ArrayList<RandomVariable> liborsAtTimeIndex = new ArrayList<>(); int firstLiborIndex = model.getLiborPeriodDiscretization().getTimeIndexNearestGreaterOrEqual(startTime); double firstLiborTime = model.getLiborPeriodDiscretization().getTime(firstLiborIndex); if(firstLiborTime>startTime) { liborsAtTimeIndex.add(model.getLIBOR(startTime, startTime, firstLiborTime)); } // Vector of times for the forward curve double[] times = new double[firstLiborTime==startTime ? (model.getNumberOfLibors()-firstLiborIndex) : (model.getNumberOfLibors()-firstLiborIndex+1)]; times[0]=0; int indexOffset = firstLiborTime==startTime ? 0 : 1; for(int i=firstLiborIndex;i<model.getNumberOfLibors();i++) { liborsAtTimeIndex.add(model.getLIBOR(timeIndex,i)); times[i-firstLiborIndex+indexOffset]=model.getLiborPeriodDiscretization().getTime(i)-startTime; } RandomVariable[] libors = liborsAtTimeIndex.toArray(new RandomVariable[liborsAtTimeIndex.size()]); return ForwardCurveInterpolation.createForwardCurveFromForwards(name, times, libors, model.getLiborPeriodDiscretization().getTimeStep(firstLiborIndex)); }
java
public static ForwardCurveInterpolation createForwardCurveFromMonteCarloLiborModel(String name, LIBORModelMonteCarloSimulationModel model, double startTime) throws CalculationException{ int timeIndex = model.getTimeIndex(startTime); // Get all Libors at timeIndex which are not yet fixed (others null) and times for the timeDiscretizationFromArray of the curves ArrayList<RandomVariable> liborsAtTimeIndex = new ArrayList<>(); int firstLiborIndex = model.getLiborPeriodDiscretization().getTimeIndexNearestGreaterOrEqual(startTime); double firstLiborTime = model.getLiborPeriodDiscretization().getTime(firstLiborIndex); if(firstLiborTime>startTime) { liborsAtTimeIndex.add(model.getLIBOR(startTime, startTime, firstLiborTime)); } // Vector of times for the forward curve double[] times = new double[firstLiborTime==startTime ? (model.getNumberOfLibors()-firstLiborIndex) : (model.getNumberOfLibors()-firstLiborIndex+1)]; times[0]=0; int indexOffset = firstLiborTime==startTime ? 0 : 1; for(int i=firstLiborIndex;i<model.getNumberOfLibors();i++) { liborsAtTimeIndex.add(model.getLIBOR(timeIndex,i)); times[i-firstLiborIndex+indexOffset]=model.getLiborPeriodDiscretization().getTime(i)-startTime; } RandomVariable[] libors = liborsAtTimeIndex.toArray(new RandomVariable[liborsAtTimeIndex.size()]); return ForwardCurveInterpolation.createForwardCurveFromForwards(name, times, libors, model.getLiborPeriodDiscretization().getTimeStep(firstLiborIndex)); }
[ "public", "static", "ForwardCurveInterpolation", "createForwardCurveFromMonteCarloLiborModel", "(", "String", "name", ",", "LIBORModelMonteCarloSimulationModel", "model", ",", "double", "startTime", ")", "throws", "CalculationException", "{", "int", "timeIndex", "=", "model",...
Create a forward curve from forwards given by a LIBORMonteCarloModel. @param name name of the forward curve. @param model Monte Carlo model providing the forwards. @param startTime time at which the curve starts, i.e. zero time for the curve @return a forward curve from forwards given by a LIBORMonteCarloModel. @throws CalculationException Thrown if the model failed to provide the forward rates.
[ "Create", "a", "forward", "curve", "from", "forwards", "given", "by", "a", "LIBORMonteCarloModel", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/ForwardCurveInterpolation.java#L334-L356
wcm-io/wcm-io-handler
url/src/main/java/io/wcm/handler/url/impl/Externalizer.java
Externalizer.externalizeUrl
public static @Nullable String externalizeUrl(@NotNull String url, @NotNull ResourceResolver resolver, @Nullable SlingHttpServletRequest request) { // apply externalization only path part String path = url; // split off query string or fragment that may be appended to the URL String urlRemainder = null; int urlRemainderPos = StringUtils.indexOfAny(path, '?', '#'); if (urlRemainderPos >= 0) { urlRemainder = path.substring(urlRemainderPos); path = path.substring(0, urlRemainderPos); } // apply reverse mapping based on current sling mapping configuration for current request // e.g. to support a host-based prefix stripping mapping configuration configured at /etc/map // please note: the sling map method does a lot of things: // 1. applies reverse mapping depending on the sling mapping configuration // (this can even add a hostname if defined in sling mapping configuration) // 2. applies namespace mangling (e.g. replace jcr: with _jcr_) // 3. adds webapp context path if required // 4. url-encodes the whole url if (request != null) { path = resolver.map(request, path); } else { path = resolver.map(path); } // remove scheme and hostname (probably added by sling mapping), but leave path in escaped form try { path = new URI(path).getRawPath(); // replace %2F back to / for better readability path = StringUtils.replace(path, "%2F", "/"); } catch (URISyntaxException ex) { throw new RuntimeException("Sling map method returned invalid URI: " + path, ex); } // build full URL again if (path == null) { return null; } else { return path + (urlRemainder != null ? urlRemainder : ""); } }
java
public static @Nullable String externalizeUrl(@NotNull String url, @NotNull ResourceResolver resolver, @Nullable SlingHttpServletRequest request) { // apply externalization only path part String path = url; // split off query string or fragment that may be appended to the URL String urlRemainder = null; int urlRemainderPos = StringUtils.indexOfAny(path, '?', '#'); if (urlRemainderPos >= 0) { urlRemainder = path.substring(urlRemainderPos); path = path.substring(0, urlRemainderPos); } // apply reverse mapping based on current sling mapping configuration for current request // e.g. to support a host-based prefix stripping mapping configuration configured at /etc/map // please note: the sling map method does a lot of things: // 1. applies reverse mapping depending on the sling mapping configuration // (this can even add a hostname if defined in sling mapping configuration) // 2. applies namespace mangling (e.g. replace jcr: with _jcr_) // 3. adds webapp context path if required // 4. url-encodes the whole url if (request != null) { path = resolver.map(request, path); } else { path = resolver.map(path); } // remove scheme and hostname (probably added by sling mapping), but leave path in escaped form try { path = new URI(path).getRawPath(); // replace %2F back to / for better readability path = StringUtils.replace(path, "%2F", "/"); } catch (URISyntaxException ex) { throw new RuntimeException("Sling map method returned invalid URI: " + path, ex); } // build full URL again if (path == null) { return null; } else { return path + (urlRemainder != null ? urlRemainder : ""); } }
[ "public", "static", "@", "Nullable", "String", "externalizeUrl", "(", "@", "NotNull", "String", "url", ",", "@", "NotNull", "ResourceResolver", "resolver", ",", "@", "Nullable", "SlingHttpServletRequest", "request", ")", "{", "// apply externalization only path part", ...
Externalizes an URL by applying Sling Mapping. Hostname and scheme are not added because they are added by the link handler depending on site URL configuration and secure/non-secure mode. URLs that are already externalized remain untouched. @param url Unexternalized URL (without scheme or hostname) @param resolver Resource resolver @param request Request @return Exernalized URL without scheme or hostname, but with short URLs (if configured in Sling Mapping is configured), and the path is URL-encoded if it contains special chars.
[ "Externalizes", "an", "URL", "by", "applying", "Sling", "Mapping", ".", "Hostname", "and", "scheme", "are", "not", "added", "because", "they", "are", "added", "by", "the", "link", "handler", "depending", "on", "site", "URL", "configuration", "and", "secure", ...
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/impl/Externalizer.java#L54-L100
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/schema/analysis/SnowballAnalyzerBuilder.java
SnowballAnalyzerBuilder.getStopwords
private static CharArraySet getStopwords(String stopwords) { List<String> stopwordsList = new ArrayList<>(); for (String stop : stopwords.split(",")) { stopwordsList.add(stop.trim()); } return new CharArraySet(stopwordsList, true); }
java
private static CharArraySet getStopwords(String stopwords) { List<String> stopwordsList = new ArrayList<>(); for (String stop : stopwords.split(",")) { stopwordsList.add(stop.trim()); } return new CharArraySet(stopwordsList, true); }
[ "private", "static", "CharArraySet", "getStopwords", "(", "String", "stopwords", ")", "{", "List", "<", "String", ">", "stopwordsList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "stop", ":", "stopwords", ".", "split", "(", "\",\""...
Returns the stopwords {@link CharArraySet} for the specified comma separated stopwords {@code String}. @param stopwords a {@code String} comma separated stopwords list @return the stopwords list as a char array set
[ "Returns", "the", "stopwords", "{", "@link", "CharArraySet", "}", "for", "the", "specified", "comma", "separated", "stopwords", "{", "@code", "String", "}", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/schema/analysis/SnowballAnalyzerBuilder.java#L98-L104
citiususc/hipster
hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java
FibonacciHeap.decreaseKeyUnchecked
private void decreaseKeyUnchecked(Entry<T> entry, double priority) { /* First, change the node's priority. */ entry.mPriority = priority; /* If the node no longer has a higher priority than its parent, cut it. * Note that this also means that if we try to run a delete operation * that decreases the key to -infinity, it's guaranteed to cut the node * from its parent. */ if (entry.mParent != null && entry.mPriority <= entry.mParent.mPriority) cutNode(entry); /* If our new value is the new min, mark it as such. Note that if we * ended up decreasing the key in a way that ties the current minimum * priority, this will change the min accordingly. */ if (entry.mPriority <= mMin.mPriority) mMin = entry; }
java
private void decreaseKeyUnchecked(Entry<T> entry, double priority) { /* First, change the node's priority. */ entry.mPriority = priority; /* If the node no longer has a higher priority than its parent, cut it. * Note that this also means that if we try to run a delete operation * that decreases the key to -infinity, it's guaranteed to cut the node * from its parent. */ if (entry.mParent != null && entry.mPriority <= entry.mParent.mPriority) cutNode(entry); /* If our new value is the new min, mark it as such. Note that if we * ended up decreasing the key in a way that ties the current minimum * priority, this will change the min accordingly. */ if (entry.mPriority <= mMin.mPriority) mMin = entry; }
[ "private", "void", "decreaseKeyUnchecked", "(", "Entry", "<", "T", ">", "entry", ",", "double", "priority", ")", "{", "/* First, change the node's priority. */", "entry", ".", "mPriority", "=", "priority", ";", "/* If the node no longer has a higher priority than its parent...
Decreases the key of a node in the tree without doing any checking to ensure that the new priority is valid. @param entry The node whose key should be decreased. @param priority The node's new priority.
[ "Decreases", "the", "key", "of", "a", "node", "in", "the", "tree", "without", "doing", "any", "checking", "to", "ensure", "that", "the", "new", "priority", "is", "valid", "." ]
train
https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/lab/hipster/collections/FibonacciHeap.java#L520-L538
EdwardRaff/JSAT
JSAT/src/jsat/io/LIBSVMLoader.java
LIBSVMLoader.loadR
public static RegressionDataSet loadR(Reader reader, double sparseRatio, int vectorLength, DataStore store) throws IOException { return (RegressionDataSet) loadG(reader, sparseRatio, vectorLength, false, store); }
java
public static RegressionDataSet loadR(Reader reader, double sparseRatio, int vectorLength, DataStore store) throws IOException { return (RegressionDataSet) loadG(reader, sparseRatio, vectorLength, false, store); }
[ "public", "static", "RegressionDataSet", "loadR", "(", "Reader", "reader", ",", "double", "sparseRatio", ",", "int", "vectorLength", ",", "DataStore", "store", ")", "throws", "IOException", "{", "return", "(", "RegressionDataSet", ")", "loadG", "(", "reader", ",...
Loads a new regression data set from a LIBSVM file, assuming the label is a numeric target value to predict. @param reader the reader for the file to load @param sparseRatio the fraction of non zero values to qualify a data point as sparse @param vectorLength the pre-determined length of each vector. If given a negative value, the largest non-zero index observed in the data will be used as the length. @param store the type of store to use for data @return a regression data set @throws IOException
[ "Loads", "a", "new", "regression", "data", "set", "from", "a", "LIBSVM", "file", "assuming", "the", "label", "is", "a", "numeric", "target", "value", "to", "predict", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/LIBSVMLoader.java#L150-L153
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/wishlists/WishlistItemUrl.java
WishlistItemUrl.updateWishlistItemQuantityUrl
public static MozuUrl updateWishlistItemQuantityUrl(Integer quantity, String responseFields, String wishlistId, String wishlistItemId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/{wishlistId}/items/{wishlistItemId}/{quantity}?responseFields={responseFields}"); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("wishlistId", wishlistId); formatter.formatUrl("wishlistItemId", wishlistItemId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateWishlistItemQuantityUrl(Integer quantity, String responseFields, String wishlistId, String wishlistItemId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/{wishlistId}/items/{wishlistItemId}/{quantity}?responseFields={responseFields}"); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("wishlistId", wishlistId); formatter.formatUrl("wishlistItemId", wishlistItemId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateWishlistItemQuantityUrl", "(", "Integer", "quantity", ",", "String", "responseFields", ",", "String", "wishlistId", ",", "String", "wishlistItemId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/c...
Get Resource Url for UpdateWishlistItemQuantity @param quantity The number of cart items in the shopper's active cart. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param wishlistId Unique identifier of the wish list. @param wishlistItemId Unique identifier of the item to remove from the shopper wish list. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateWishlistItemQuantity" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/wishlists/WishlistItemUrl.java#L100-L108
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.ohj/src/main/java/org/carewebframework/help/ohj/HelpView.java
HelpView.initTopicTree
private void initTopicTree(HelpTopicNode htnParent, TopicTreeNode ttnParent) { initTopicTree(htnParent, ttnParent.getChildren()); if (ttnParent instanceof KeywordTopicTreeNode) { initTopicTree(htnParent, ((KeywordTopicTreeNode) ttnParent).getEntries()); } }
java
private void initTopicTree(HelpTopicNode htnParent, TopicTreeNode ttnParent) { initTopicTree(htnParent, ttnParent.getChildren()); if (ttnParent instanceof KeywordTopicTreeNode) { initTopicTree(htnParent, ((KeywordTopicTreeNode) ttnParent).getEntries()); } }
[ "private", "void", "initTopicTree", "(", "HelpTopicNode", "htnParent", ",", "TopicTreeNode", "ttnParent", ")", "{", "initTopicTree", "(", "htnParent", ",", "ttnParent", ".", "getChildren", "(", ")", ")", ";", "if", "(", "ttnParent", "instanceof", "KeywordTopicTree...
Initialize the topic tree. Converts the Oracle help TopicTreeNode-based tree to a HelpTopicNode-based tree. @param htnParent Current help topic node. @param ttnParent Current topic tree node.
[ "Initialize", "the", "topic", "tree", ".", "Converts", "the", "Oracle", "help", "TopicTreeNode", "-", "based", "tree", "to", "a", "HelpTopicNode", "-", "based", "tree", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.ohj/src/main/java/org/carewebframework/help/ohj/HelpView.java#L102-L108
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2016_06_27_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2016_06_27_preview/implementation/RegistriesInner.java
RegistriesInner.getCredentialsAsync
public Observable<RegistryCredentialsInner> getCredentialsAsync(String resourceGroupName, String registryName) { return getCredentialsWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1<ServiceResponse<RegistryCredentialsInner>, RegistryCredentialsInner>() { @Override public RegistryCredentialsInner call(ServiceResponse<RegistryCredentialsInner> response) { return response.body(); } }); }
java
public Observable<RegistryCredentialsInner> getCredentialsAsync(String resourceGroupName, String registryName) { return getCredentialsWithServiceResponseAsync(resourceGroupName, registryName).map(new Func1<ServiceResponse<RegistryCredentialsInner>, RegistryCredentialsInner>() { @Override public RegistryCredentialsInner call(ServiceResponse<RegistryCredentialsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RegistryCredentialsInner", ">", "getCredentialsAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ")", "{", "return", "getCredentialsWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ")", ".", "...
Gets the administrator login credentials for the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RegistryCredentialsInner object
[ "Gets", "the", "administrator", "login", "credentials", "for", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2016_06_27_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2016_06_27_preview/implementation/RegistriesInner.java#L816-L823
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/util/LevenshteinDistance.java
LevenshteinDistance.getDistance
public static int getDistance (@Nullable final char [] aStr1, @Nullable final char [] aStr2) { final int nLen1 = aStr1 == null ? 0 : aStr1.length; final int nLen2 = aStr2 == null ? 0 : aStr2.length; if (nLen1 == 0) return nLen2; if (nLen2 == 0) return nLen1; return _getDistance111 (aStr1, nLen1, aStr2, nLen2); }
java
public static int getDistance (@Nullable final char [] aStr1, @Nullable final char [] aStr2) { final int nLen1 = aStr1 == null ? 0 : aStr1.length; final int nLen2 = aStr2 == null ? 0 : aStr2.length; if (nLen1 == 0) return nLen2; if (nLen2 == 0) return nLen1; return _getDistance111 (aStr1, nLen1, aStr2, nLen2); }
[ "public", "static", "int", "getDistance", "(", "@", "Nullable", "final", "char", "[", "]", "aStr1", ",", "@", "Nullable", "final", "char", "[", "]", "aStr2", ")", "{", "final", "int", "nLen1", "=", "aStr1", "==", "null", "?", "0", ":", "aStr1", ".", ...
Get the distance of the 2 strings, using the costs 1 for insertion, deletion and substitution. @param aStr1 First string. @param aStr2 Second string. @return The Levenshtein distance.
[ "Get", "the", "distance", "of", "the", "2", "strings", "using", "the", "costs", "1", "for", "insertion", "deletion", "and", "substitution", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/util/LevenshteinDistance.java#L163-L174
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java
NamespacesInner.getByResourceGroup
public NamespaceResourceInner getByResourceGroup(String resourceGroupName, String namespaceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); }
java
public NamespaceResourceInner getByResourceGroup(String resourceGroupName, String namespaceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); }
[ "public", "NamespaceResourceInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "namespaceName", ")", ".", "toBlocking", "(", ")", ...
Returns the description for the specified namespace. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the NamespaceResourceInner object if successful.
[ "Returns", "the", "description", "for", "the", "specified", "namespace", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java#L578-L580
Omertron/api-fanarttv
src/main/java/com/omertron/fanarttvapi/model/ArtworkList.java
ArtworkList.addArtwork
public void addArtwork(FTArtworkType artworkType, List<FTArtwork> artworkList) { artwork.put(artworkType, artworkList); }
java
public void addArtwork(FTArtworkType artworkType, List<FTArtwork> artworkList) { artwork.put(artworkType, artworkList); }
[ "public", "void", "addArtwork", "(", "FTArtworkType", "artworkType", ",", "List", "<", "FTArtwork", ">", "artworkList", ")", "{", "artwork", ".", "put", "(", "artworkType", ",", "artworkList", ")", ";", "}" ]
Add artwork to the list @param artworkType @param artworkList
[ "Add", "artwork", "to", "the", "list" ]
train
https://github.com/Omertron/api-fanarttv/blob/2a1854c840d8111935d0f6abe5232e2c3c3f318b/src/main/java/com/omertron/fanarttvapi/model/ArtworkList.java#L47-L49
VoltDB/voltdb
src/frontend/org/voltdb/utils/MiscUtils.java
MiscUtils.copyFile
public static void copyFile(String fromPath, String toPath) throws Exception { File inputFile = new File(fromPath); File outputFile = new File(toPath); com.google_voltpatches.common.io.Files.copy(inputFile, outputFile); }
java
public static void copyFile(String fromPath, String toPath) throws Exception { File inputFile = new File(fromPath); File outputFile = new File(toPath); com.google_voltpatches.common.io.Files.copy(inputFile, outputFile); }
[ "public", "static", "void", "copyFile", "(", "String", "fromPath", ",", "String", "toPath", ")", "throws", "Exception", "{", "File", "inputFile", "=", "new", "File", "(", "fromPath", ")", ";", "File", "outputFile", "=", "new", "File", "(", "toPath", ")", ...
Simple code to copy a file from one place to another... Java should have this built in... stupid java...
[ "Simple", "code", "to", "copy", "a", "file", "from", "one", "place", "to", "another", "...", "Java", "should", "have", "this", "built", "in", "...", "stupid", "java", "..." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/MiscUtils.java#L92-L96
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/attribute/map/MapfishMapContext.java
MapfishMapContext.getTransform
public AffineTransform getTransform() { if (FloatingPointUtil.equals(this.rotation, 0.0)) { return null; } final Dimension rotatedMapSize = getRotatedMapSize(); final AffineTransform transform = AffineTransform.getTranslateInstance(0.0, 0.0); // move to the center of the original map rectangle (this is the actual // size of the graphic) transform.translate(this.mapSize.width / 2, this.mapSize.height / 2); // then rotate around this center transform.rotate(this.rotation); // then move to an artificial origin (0,0) which might be outside of the actual // painting area. this origin still keeps the center of the original map area // at the center of the rotated map area. transform.translate(-rotatedMapSize.width / 2, -rotatedMapSize.height / 2); return transform; }
java
public AffineTransform getTransform() { if (FloatingPointUtil.equals(this.rotation, 0.0)) { return null; } final Dimension rotatedMapSize = getRotatedMapSize(); final AffineTransform transform = AffineTransform.getTranslateInstance(0.0, 0.0); // move to the center of the original map rectangle (this is the actual // size of the graphic) transform.translate(this.mapSize.width / 2, this.mapSize.height / 2); // then rotate around this center transform.rotate(this.rotation); // then move to an artificial origin (0,0) which might be outside of the actual // painting area. this origin still keeps the center of the original map area // at the center of the rotated map area. transform.translate(-rotatedMapSize.width / 2, -rotatedMapSize.height / 2); return transform; }
[ "public", "AffineTransform", "getTransform", "(", ")", "{", "if", "(", "FloatingPointUtil", ".", "equals", "(", "this", ".", "rotation", ",", "0.0", ")", ")", "{", "return", "null", ";", "}", "final", "Dimension", "rotatedMapSize", "=", "getRotatedMapSize", ...
Returns an {@link AffineTransform} taking the rotation into account. @return an affine transformation
[ "Returns", "an", "{", "@link", "AffineTransform", "}", "taking", "the", "rotation", "into", "account", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/attribute/map/MapfishMapContext.java#L284-L305
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
DateTimeField.setCalendar
public int setCalendar(Calendar value, boolean bDisplayOption, int iMoveMode) { // Set this field's value java.util.Date dateTemp = value.getTime(); int errorCode = this.setData(dateTemp, bDisplayOption, iMoveMode); return errorCode; }
java
public int setCalendar(Calendar value, boolean bDisplayOption, int iMoveMode) { // Set this field's value java.util.Date dateTemp = value.getTime(); int errorCode = this.setData(dateTemp, bDisplayOption, iMoveMode); return errorCode; }
[ "public", "int", "setCalendar", "(", "Calendar", "value", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "// Set this field's value", "java", ".", "util", ".", "Date", "dateTemp", "=", "value", ".", "getTime", "(", ")", ";", "int", "err...
SetValue in current calendar. @param value The date (as a calendar value) to set. @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "SetValue", "in", "current", "calendar", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L422-L427
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Reference.java
Reference.newInstance
public static Reference newInstance(Requirement requirement, Specification specification, SystemUnderTest sut) { return newInstance(requirement, specification, sut, null); }
java
public static Reference newInstance(Requirement requirement, Specification specification, SystemUnderTest sut) { return newInstance(requirement, specification, sut, null); }
[ "public", "static", "Reference", "newInstance", "(", "Requirement", "requirement", ",", "Specification", "specification", ",", "SystemUnderTest", "sut", ")", "{", "return", "newInstance", "(", "requirement", ",", "specification", ",", "sut", ",", "null", ")", ";",...
<p>newInstance.</p> @param requirement a {@link com.greenpepper.server.domain.Requirement} object. @param specification a {@link com.greenpepper.server.domain.Specification} object. @param sut a {@link com.greenpepper.server.domain.SystemUnderTest} object. @return a {@link com.greenpepper.server.domain.Reference} object.
[ "<p", ">", "newInstance", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Reference.java#L53-L56
icoloma/simpleds
src/main/java/org/simpleds/metadata/ClassMetadata.java
ClassMetadata.javaToDatastore
public Entity javaToDatastore(Key parentKey, Object javaObject) { Key key = keyProperty.getValue(javaObject); Entity entity = key == null? new Entity(kind, parentKey) : new Entity(key); for (Entry<String, PropertyMetadata<?, ?>> entry : properties.entrySet()) { PropertyMetadata property = entry.getValue(); Object javaValue = property.getValue(javaObject); property.setEntityValue(entity, javaValue); } return entity; }
java
public Entity javaToDatastore(Key parentKey, Object javaObject) { Key key = keyProperty.getValue(javaObject); Entity entity = key == null? new Entity(kind, parentKey) : new Entity(key); for (Entry<String, PropertyMetadata<?, ?>> entry : properties.entrySet()) { PropertyMetadata property = entry.getValue(); Object javaValue = property.getValue(javaObject); property.setEntityValue(entity, javaValue); } return entity; }
[ "public", "Entity", "javaToDatastore", "(", "Key", "parentKey", ",", "Object", "javaObject", ")", "{", "Key", "key", "=", "keyProperty", ".", "getValue", "(", "javaObject", ")", ";", "Entity", "entity", "=", "key", "==", "null", "?", "new", "Entity", "(", ...
Convert a value from Java representation to a Datastore {@link Entity} @param javaObject the Java property value @param parentKey the parent {@link Key} (may be null)
[ "Convert", "a", "value", "from", "Java", "representation", "to", "a", "Datastore", "{" ]
train
https://github.com/icoloma/simpleds/blob/b07763df98b9375b764e625f617a6c78df4b068d/src/main/java/org/simpleds/metadata/ClassMetadata.java#L116-L125
xcesco/kripton
kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/commons/IOUtils.java
IOUtils.readTextLines
public static void readTextLines(InputStream openRawResource, OnReadLineListener listener) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(openRawResource)); String line; try { while ((line = bufferedReader.readLine()) != null) { listener.onTextLine(line); } } catch (IOException e) { Logger.error(e.getMessage()); e.printStackTrace(); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { Logger.error(e.getMessage()); e.printStackTrace(); } } } }
java
public static void readTextLines(InputStream openRawResource, OnReadLineListener listener) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(openRawResource)); String line; try { while ((line = bufferedReader.readLine()) != null) { listener.onTextLine(line); } } catch (IOException e) { Logger.error(e.getMessage()); e.printStackTrace(); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { Logger.error(e.getMessage()); e.printStackTrace(); } } } }
[ "public", "static", "void", "readTextLines", "(", "InputStream", "openRawResource", ",", "OnReadLineListener", "listener", ")", "{", "BufferedReader", "bufferedReader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "openRawResource", ")", ")", ";...
Read text lines. @param openRawResource the open raw resource @param listener the listener
[ "Read", "text", "lines", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/commons/IOUtils.java#L148-L170
auth0/auth0-java
src/main/java/com/auth0/client/auth/AuthAPI.java
AuthAPI.exchangeCode
public AuthRequest exchangeCode(String code, String redirectUri) { Asserts.assertNotNull(code, "code"); Asserts.assertNotNull(redirectUri, "redirect uri"); String url = baseUrl .newBuilder() .addPathSegment(PATH_OAUTH) .addPathSegment(PATH_TOKEN) .build() .toString(); TokenRequest request = new TokenRequest(client, url); request.addParameter(KEY_CLIENT_ID, clientId); request.addParameter(KEY_CLIENT_SECRET, clientSecret); request.addParameter(KEY_GRANT_TYPE, "authorization_code"); request.addParameter("code", code); request.addParameter("redirect_uri", redirectUri); return request; }
java
public AuthRequest exchangeCode(String code, String redirectUri) { Asserts.assertNotNull(code, "code"); Asserts.assertNotNull(redirectUri, "redirect uri"); String url = baseUrl .newBuilder() .addPathSegment(PATH_OAUTH) .addPathSegment(PATH_TOKEN) .build() .toString(); TokenRequest request = new TokenRequest(client, url); request.addParameter(KEY_CLIENT_ID, clientId); request.addParameter(KEY_CLIENT_SECRET, clientSecret); request.addParameter(KEY_GRANT_TYPE, "authorization_code"); request.addParameter("code", code); request.addParameter("redirect_uri", redirectUri); return request; }
[ "public", "AuthRequest", "exchangeCode", "(", "String", "code", ",", "String", "redirectUri", ")", "{", "Asserts", ".", "assertNotNull", "(", "code", ",", "\"code\"", ")", ";", "Asserts", ".", "assertNotNull", "(", "redirectUri", ",", "\"redirect uri\"", ")", ...
Creates a request to exchange the code obtained in the /authorize call using the 'Authorization Code' grant. <pre> {@code AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne"); try { TokenHolder result = auth.exchangeCode("SnWoFLMzApDskr", "https://me.auth0.com/callback") .setScope("openid name nickname") .execute(); } catch (Auth0Exception e) { //Something happened } } </pre> @param code the authorization code received from the /authorize call. @param redirectUri the redirect uri sent on the /authorize call. @return a Request to configure and execute.
[ "Creates", "a", "request", "to", "exchange", "the", "code", "obtained", "in", "the", "/", "authorize", "call", "using", "the", "Authorization", "Code", "grant", ".", "<pre", ">", "{", "@code", "AuthAPI", "auth", "=", "new", "AuthAPI", "(", "me", ".", "au...
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthAPI.java#L508-L525
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getOptionalField
public static Field getOptionalField(Class<?> clazz, String fieldName) { try { Field field = clazz.getDeclaredField(fieldName); field.setAccessible(true); return field; } catch(NoSuchFieldException expectable) {} catch(SecurityException e) { throw new BugError(e); } return null; }
java
public static Field getOptionalField(Class<?> clazz, String fieldName) { try { Field field = clazz.getDeclaredField(fieldName); field.setAccessible(true); return field; } catch(NoSuchFieldException expectable) {} catch(SecurityException e) { throw new BugError(e); } return null; }
[ "public", "static", "Field", "getOptionalField", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fieldName", ")", "{", "try", "{", "Field", "field", "=", "clazz", ".", "getDeclaredField", "(", "fieldName", ")", ";", "field", ".", "setAccessible", "("...
Get class field or null if not found. Try to get named class field and returns null if not found; this method does not throw any exception. @param clazz Java class to return field from, @param fieldName field name. @return class reflective field or null.
[ "Get", "class", "field", "or", "null", "if", "not", "found", ".", "Try", "to", "get", "named", "class", "field", "and", "returns", "null", "if", "not", "found", ";", "this", "method", "does", "not", "throw", "any", "exception", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L630-L642
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/ManagedBackupShortTermRetentionPoliciesInner.java
ManagedBackupShortTermRetentionPoliciesInner.beginCreateOrUpdate
public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().single().body(); }
java
public ManagedBackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().single().body(); }
[ "public", "ManagedBackupShortTermRetentionPolicyInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "String", "databaseName", ",", "Integer", "retentionDays", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsyn...
Updates a managed database's short term retention policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ManagedBackupShortTermRetentionPolicyInner object if successful.
[ "Updates", "a", "managed", "database", "s", "short", "term", "retention", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java#L451-L453
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_task_account_id_GET
public OvhTaskPop domain_task_account_id_GET(String domain, Long id) throws IOException { String qPath = "/email/domain/{domain}/task/account/{id}"; StringBuilder sb = path(qPath, domain, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTaskPop.class); }
java
public OvhTaskPop domain_task_account_id_GET(String domain, Long id) throws IOException { String qPath = "/email/domain/{domain}/task/account/{id}"; StringBuilder sb = path(qPath, domain, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTaskPop.class); }
[ "public", "OvhTaskPop", "domain_task_account_id_GET", "(", "String", "domain", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/task/account/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "...
Get this object properties REST: GET /email/domain/{domain}/task/account/{id} @param domain [required] Name of your domain name @param id [required] Id of task
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1172-L1177
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/hpack/H2Headers.java
H2Headers.decodeHeader
public static H2HeaderField decodeHeader(WsByteBuffer buffer, H2HeaderTable table) throws CompressionException { return decodeHeader(buffer, table, true, false, null); }
java
public static H2HeaderField decodeHeader(WsByteBuffer buffer, H2HeaderTable table) throws CompressionException { return decodeHeader(buffer, table, true, false, null); }
[ "public", "static", "H2HeaderField", "decodeHeader", "(", "WsByteBuffer", "buffer", ",", "H2HeaderTable", "table", ")", "throws", "CompressionException", "{", "return", "decodeHeader", "(", "buffer", ",", "table", ",", "true", ",", "false", ",", "null", ")", ";"...
Decode header bytes without validating against connection settings @param WsByteBuffer @param H2HeaderTable @return H2HeaderField @throws CompressionException
[ "Decode", "header", "bytes", "without", "validating", "against", "connection", "settings" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/hpack/H2Headers.java#L43-L45
msgpack/msgpack-java
msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java
MessageBuffer.putInt
public void putInt(int index, int v) { // Reversing the endian v = Integer.reverseBytes(v); unsafe.putInt(base, address + index, v); }
java
public void putInt(int index, int v) { // Reversing the endian v = Integer.reverseBytes(v); unsafe.putInt(base, address + index, v); }
[ "public", "void", "putInt", "(", "int", "index", ",", "int", "v", ")", "{", "// Reversing the endian", "v", "=", "Integer", ".", "reverseBytes", "(", "v", ")", ";", "unsafe", ".", "putInt", "(", "base", ",", "address", "+", "index", ",", "v", ")", ";...
Write a big-endian integer value to the memory @param index @param v
[ "Write", "a", "big", "-", "endian", "integer", "value", "to", "the", "memory" ]
train
https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L503-L508
Harium/keel
src/main/java/com/harium/keel/catalano/math/ComplexNumber.java
ComplexNumber.Multiply
public static ComplexNumber Multiply(ComplexNumber z1, ComplexNumber z2) { double z1R = z1.real, z1I = z1.imaginary; double z2R = z2.real, z2I = z2.imaginary; return new ComplexNumber(z1R * z2R - z1I * z2I, z1R * z2I + z1I * z2R); }
java
public static ComplexNumber Multiply(ComplexNumber z1, ComplexNumber z2) { double z1R = z1.real, z1I = z1.imaginary; double z2R = z2.real, z2I = z2.imaginary; return new ComplexNumber(z1R * z2R - z1I * z2I, z1R * z2I + z1I * z2R); }
[ "public", "static", "ComplexNumber", "Multiply", "(", "ComplexNumber", "z1", ",", "ComplexNumber", "z2", ")", "{", "double", "z1R", "=", "z1", ".", "real", ",", "z1I", "=", "z1", ".", "imaginary", ";", "double", "z2R", "=", "z2", ".", "real", ",", "z2I...
Multiply two complex numbers. @param z1 Complex Number. @param z2 Complex Number. @return Returns new ComplexNumber instance containing the multiply of specified complex numbers.
[ "Multiply", "two", "complex", "numbers", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/ComplexNumber.java#L313-L318
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.setupQuery
private void setupQuery(Query query, Object[] paramValues, Type[] paramTypes, Integer offset, Integer limit){ if (paramValues != null && paramTypes != null){ query.setParameters(paramValues, paramTypes); } if (offset != null){ query.setFirstResult(offset); } if (limit != null){ query.setMaxResults(limit); } }
java
private void setupQuery(Query query, Object[] paramValues, Type[] paramTypes, Integer offset, Integer limit){ if (paramValues != null && paramTypes != null){ query.setParameters(paramValues, paramTypes); } if (offset != null){ query.setFirstResult(offset); } if (limit != null){ query.setMaxResults(limit); } }
[ "private", "void", "setupQuery", "(", "Query", "query", ",", "Object", "[", "]", "paramValues", ",", "Type", "[", "]", "paramTypes", ",", "Integer", "offset", ",", "Integer", "limit", ")", "{", "if", "(", "paramValues", "!=", "null", "&&", "paramTypes", ...
Setup a query with parameters and other configurations. @param query @param paramValues @param paramTypes @param offset @param limit
[ "Setup", "a", "query", "with", "parameters", "and", "other", "configurations", "." ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L377-L387
cloudfoundry/cf-java-client
cloudfoundry-util/src/main/java/org/cloudfoundry/util/DateUtils.java
DateUtils.parseFromIso8601
public static Date parseFromIso8601(String s) { synchronized (MONITOR) { try { return ISO8601.parse(s); } catch (ParseException e) { throw new IllegalArgumentException("Unable to parse date", e); } } }
java
public static Date parseFromIso8601(String s) { synchronized (MONITOR) { try { return ISO8601.parse(s); } catch (ParseException e) { throw new IllegalArgumentException("Unable to parse date", e); } } }
[ "public", "static", "Date", "parseFromIso8601", "(", "String", "s", ")", "{", "synchronized", "(", "MONITOR", ")", "{", "try", "{", "return", "ISO8601", ".", "parse", "(", "s", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "throw", "new...
Parses a string in {@code ISO8601} format to a {@link Date} object @param s the string to parse @return the parsed {@link Date}
[ "Parses", "a", "string", "in", "{", "@code", "ISO8601", "}", "format", "to", "a", "{", "@link", "Date", "}", "object" ]
train
https://github.com/cloudfoundry/cf-java-client/blob/caa1cb889cfe8717614c071703d833a1540784df/cloudfoundry-util/src/main/java/org/cloudfoundry/util/DateUtils.java#L55-L63
JetBrains/xodus
utils/src/main/java/jetbrains/exodus/core/execution/JobProcessorAdapter.java
JobProcessorAdapter.queueIn
@Override public final Job queueIn(final Job job, final long millis) { return pushAt(job, System.currentTimeMillis() + millis); }
java
@Override public final Job queueIn(final Job job, final long millis) { return pushAt(job, System.currentTimeMillis() + millis); }
[ "@", "Override", "public", "final", "Job", "queueIn", "(", "final", "Job", "job", ",", "final", "long", "millis", ")", "{", "return", "pushAt", "(", "job", ",", "System", ".", "currentTimeMillis", "(", ")", "+", "millis", ")", ";", "}" ]
Queues a job for execution in specified time. @param job the job. @param millis execute the job in this time.
[ "Queues", "a", "job", "for", "execution", "in", "specified", "time", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/utils/src/main/java/jetbrains/exodus/core/execution/JobProcessorAdapter.java#L116-L119
MGunlogson/CuckooFilter4J
src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java
FilterTable.readTagAndSet
long readTagAndSet(long bucketIndex, int posInBucket, long newTag) { long tagStartIdx = getTagOffset(bucketIndex, posInBucket); long tag = 0; long tagEndIdx = tagStartIdx + bitsPerTag; int tagPos = 0; for (long i = tagStartIdx; i < tagEndIdx; i++) { if ((newTag & (1L << tagPos)) != 0) { if (memBlock.getAndSet(i)) { tag |= 1 << tagPos; } } else { if (memBlock.getAndClear(i)) { tag |= 1 << tagPos; } } tagPos++; } return tag; }
java
long readTagAndSet(long bucketIndex, int posInBucket, long newTag) { long tagStartIdx = getTagOffset(bucketIndex, posInBucket); long tag = 0; long tagEndIdx = tagStartIdx + bitsPerTag; int tagPos = 0; for (long i = tagStartIdx; i < tagEndIdx; i++) { if ((newTag & (1L << tagPos)) != 0) { if (memBlock.getAndSet(i)) { tag |= 1 << tagPos; } } else { if (memBlock.getAndClear(i)) { tag |= 1 << tagPos; } } tagPos++; } return tag; }
[ "long", "readTagAndSet", "(", "long", "bucketIndex", ",", "int", "posInBucket", ",", "long", "newTag", ")", "{", "long", "tagStartIdx", "=", "getTagOffset", "(", "bucketIndex", ",", "posInBucket", ")", ";", "long", "tag", "=", "0", ";", "long", "tagEndIdx", ...
Reads a tag and sets the bits to a new tag at same time for max speedification
[ "Reads", "a", "tag", "and", "sets", "the", "bits", "to", "a", "new", "tag", "at", "same", "time", "for", "max", "speedification" ]
train
https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java#L182-L200
iorga-group/iraj
iraj/src/main/java/com/iorga/iraj/servlet/CacheAwareServlet.java
CacheAwareServlet.checkIfMatch
protected boolean checkIfMatch(final HttpServletRequest request, final HttpServletResponse response, final Attributes resourceAttributes) throws IOException { final String eTag = resourceAttributes.getETag(); final String headerValue = request.getHeader("If-Match"); if (headerValue != null) { if (headerValue.indexOf('*') == -1) { final StringTokenizer commaTokenizer = new StringTokenizer(headerValue, ","); boolean conditionSatisfied = false; while (!conditionSatisfied && commaTokenizer.hasMoreTokens()) { final String currentToken = commaTokenizer.nextToken(); if (currentToken.trim().equals(eTag)) conditionSatisfied = true; } // If none of the given ETags match, 412 Precodition failed is // sent back if (!conditionSatisfied) { response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED); return false; } } } return true; }
java
protected boolean checkIfMatch(final HttpServletRequest request, final HttpServletResponse response, final Attributes resourceAttributes) throws IOException { final String eTag = resourceAttributes.getETag(); final String headerValue = request.getHeader("If-Match"); if (headerValue != null) { if (headerValue.indexOf('*') == -1) { final StringTokenizer commaTokenizer = new StringTokenizer(headerValue, ","); boolean conditionSatisfied = false; while (!conditionSatisfied && commaTokenizer.hasMoreTokens()) { final String currentToken = commaTokenizer.nextToken(); if (currentToken.trim().equals(eTag)) conditionSatisfied = true; } // If none of the given ETags match, 412 Precodition failed is // sent back if (!conditionSatisfied) { response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED); return false; } } } return true; }
[ "protected", "boolean", "checkIfMatch", "(", "final", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ",", "final", "Attributes", "resourceAttributes", ")", "throws", "IOException", "{", "final", "String", "eTag", "=", "resourceAttribut...
Check if the if-match condition is satisfied. @param request The servlet request we are processing @param response The servlet response we are creating @param resourceAttributes File object @return boolean true if the resource meets the specified condition, and false if the condition is not satisfied, in which case request processing is stopped
[ "Check", "if", "the", "if", "-", "match", "condition", "is", "satisfied", "." ]
train
https://github.com/iorga-group/iraj/blob/5fdee26464248f29833610de402275eb64505542/iraj/src/main/java/com/iorga/iraj/servlet/CacheAwareServlet.java#L658-L685
logic-ng/LogicNG
src/main/java/org/logicng/formulas/FormulaFactory.java
FormulaFactory.naryOperator
public Formula naryOperator(final FType type, final Formula... operands) { switch (type) { case OR: return this.or(operands); case AND: return this.and(operands); default: throw new IllegalArgumentException("Cannot create an n-ary formula with operator: " + type); } }
java
public Formula naryOperator(final FType type, final Formula... operands) { switch (type) { case OR: return this.or(operands); case AND: return this.and(operands); default: throw new IllegalArgumentException("Cannot create an n-ary formula with operator: " + type); } }
[ "public", "Formula", "naryOperator", "(", "final", "FType", "type", ",", "final", "Formula", "...", "operands", ")", "{", "switch", "(", "type", ")", "{", "case", "OR", ":", "return", "this", ".", "or", "(", "operands", ")", ";", "case", "AND", ":", ...
Creates a new n-ary operator with a given type and a list of operands. @param type the type of the formula @param operands the list of operands @return the newly generated formula @throws IllegalArgumentException if a wrong formula type is passed
[ "Creates", "a", "new", "n", "-", "ary", "operator", "with", "a", "given", "type", "and", "a", "list", "of", "operands", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L378-L387
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/util/MithraConfigurationManager.java
MithraConfigurationManager.loadMithraCache
public void loadMithraCache(List<MithraObjectPortal> portals, int threads) throws MithraBusinessException { ThreadConservingExecutor executor = new ThreadConservingExecutor(threads); for(int i=0;i<portals.size();i++) { final MithraObjectPortal portal = portals.get(i); executor.submit(new PortalLoadCacheRunnable(portal)); } executor.finish(); }
java
public void loadMithraCache(List<MithraObjectPortal> portals, int threads) throws MithraBusinessException { ThreadConservingExecutor executor = new ThreadConservingExecutor(threads); for(int i=0;i<portals.size();i++) { final MithraObjectPortal portal = portals.get(i); executor.submit(new PortalLoadCacheRunnable(portal)); } executor.finish(); }
[ "public", "void", "loadMithraCache", "(", "List", "<", "MithraObjectPortal", ">", "portals", ",", "int", "threads", ")", "throws", "MithraBusinessException", "{", "ThreadConservingExecutor", "executor", "=", "new", "ThreadConservingExecutor", "(", "threads", ")", ";",...
This method will load the cache of the object already initialized. A Collection is used to keep track of the objects to load. @param portals list of portals to load caches for @param threads number of parallel threads to load @throws MithraBusinessException if something goes wrong during the load
[ "This", "method", "will", "load", "the", "cache", "of", "the", "object", "already", "initialized", ".", "A", "Collection", "is", "used", "to", "keep", "track", "of", "the", "objects", "to", "load", "." ]
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/MithraConfigurationManager.java#L267-L276
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/ocr/AipOcr.java
AipOcr.basicGeneralUrl
public JSONObject basicGeneralUrl(String url, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("url", url); if (options != null) { request.addBody(options); } request.setUri(OcrConsts.GENERAL_BASIC); postOperation(request); return requestServer(request); }
java
public JSONObject basicGeneralUrl(String url, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("url", url); if (options != null) { request.addBody(options); } request.setUri(OcrConsts.GENERAL_BASIC); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "basicGeneralUrl", "(", "String", "url", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "request", ...
通用文字识别接口 用户向服务请求识别某张图中的所有文字 @param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效 @param options - 可选参数对象,key: value都为string类型 options - options列表: language_type 识别语言类型,默认为CHN_ENG。可选值包括:<br>- CHN_ENG:中英文混合;<br>- ENG:英文;<br>- POR:葡萄牙语;<br>- FRE:法语;<br>- GER:德语;<br>- ITA:意大利语;<br>- SPA:西班牙语;<br>- RUS:俄语;<br>- JAP:日语;<br>- KOR:韩语; detect_direction 是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:<br>- true:检测朝向;<br>- false:不检测朝向。 detect_language 是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语) probability 是否返回识别结果中每一行的置信度 @return JSONObject
[ "通用文字识别接口", "用户向服务请求识别某张图中的所有文字" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/ocr/AipOcr.java#L96-L107
ios-driver/ios-driver
client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/RemoteIOSObject.java
RemoteIOSObject.createObject
public static WebElement createObject(RemoteWebDriver driver, Map<String, Object> ro) { String ref = ro.get("ELEMENT").toString(); String type = (String) ro.get("type"); if (type != null) { String remoteObjectName = "org.uiautomation.ios.client.uiamodels.impl.Remote" + type; if ("UIAElementNil".equals(type)) { return null; } boolean isArray = false; // uiObject.has("length"); Object[] args = null; Class<?>[] argsClass = null; if (isArray) { // args = new Object[] {driver, ref, uiObject.getInt("length")}; // argsClass = new Class[] {RemoteIOSDriver.class, String.class, // Integer.class}; } else { args = new Object[]{driver, ref}; argsClass = new Class[]{RemoteWebDriver.class, String.class}; } try { Class<?> clazz = Class.forName(remoteObjectName); Constructor<?> c = clazz.getConstructor(argsClass); Object o = c.newInstance(args); RemoteWebElement element = (RemoteWebElement) o; element.setFileDetector(driver.getFileDetector()); element.setParent(driver); element.setId(ref); return (RemoteIOSObject) o; } catch (Exception e) { throw new WebDriverException("error casting", e); } } else { RemoteWebElement element = new RemoteWebElement(); element.setFileDetector(driver.getFileDetector()); element.setId(ref); element.setParent(driver); return element; } }
java
public static WebElement createObject(RemoteWebDriver driver, Map<String, Object> ro) { String ref = ro.get("ELEMENT").toString(); String type = (String) ro.get("type"); if (type != null) { String remoteObjectName = "org.uiautomation.ios.client.uiamodels.impl.Remote" + type; if ("UIAElementNil".equals(type)) { return null; } boolean isArray = false; // uiObject.has("length"); Object[] args = null; Class<?>[] argsClass = null; if (isArray) { // args = new Object[] {driver, ref, uiObject.getInt("length")}; // argsClass = new Class[] {RemoteIOSDriver.class, String.class, // Integer.class}; } else { args = new Object[]{driver, ref}; argsClass = new Class[]{RemoteWebDriver.class, String.class}; } try { Class<?> clazz = Class.forName(remoteObjectName); Constructor<?> c = clazz.getConstructor(argsClass); Object o = c.newInstance(args); RemoteWebElement element = (RemoteWebElement) o; element.setFileDetector(driver.getFileDetector()); element.setParent(driver); element.setId(ref); return (RemoteIOSObject) o; } catch (Exception e) { throw new WebDriverException("error casting", e); } } else { RemoteWebElement element = new RemoteWebElement(); element.setFileDetector(driver.getFileDetector()); element.setId(ref); element.setParent(driver); return element; } }
[ "public", "static", "WebElement", "createObject", "(", "RemoteWebDriver", "driver", ",", "Map", "<", "String", ",", "Object", ">", "ro", ")", "{", "String", "ref", "=", "ro", ".", "get", "(", "\"ELEMENT\"", ")", ".", "toString", "(", ")", ";", "String", ...
Uses reflection to instanciate a remote object implementing the correct interface. @return the object. If the object is UIAElementNil, return null for a simple object, an empty list for a UIAElementArray.
[ "Uses", "reflection", "to", "instanciate", "a", "remote", "object", "implementing", "the", "correct", "interface", "." ]
train
https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/RemoteIOSObject.java#L55-L100
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/GelfMessage.java
GelfMessage.addFields
public GelfMessage addFields(Map<String, String> fields) { if (fields == null) { throw new IllegalArgumentException("fields is null"); } getAdditonalFields().putAll(fields); return this; }
java
public GelfMessage addFields(Map<String, String> fields) { if (fields == null) { throw new IllegalArgumentException("fields is null"); } getAdditonalFields().putAll(fields); return this; }
[ "public", "GelfMessage", "addFields", "(", "Map", "<", "String", ",", "String", ">", "fields", ")", "{", "if", "(", "fields", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"fields is null\"", ")", ";", "}", "getAdditonalFields", ...
Add multiple fields (key/value pairs) @param fields map of fields @return the current GelfMessage.
[ "Add", "multiple", "fields", "(", "key", "/", "value", "pairs", ")" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/GelfMessage.java#L504-L512
grpc/grpc-java
okhttp/src/main/java/io/grpc/okhttp/OutboundFlowController.java
OutboundFlowController.initialOutboundWindowSize
boolean initialOutboundWindowSize(int newWindowSize) { if (newWindowSize < 0) { throw new IllegalArgumentException("Invalid initial window size: " + newWindowSize); } int delta = newWindowSize - initialWindowSize; initialWindowSize = newWindowSize; for (OkHttpClientStream stream : transport.getActiveStreams()) { OutboundFlowState state = (OutboundFlowState) stream.getOutboundFlowState(); if (state == null) { // Create the OutboundFlowState with the new window size. state = new OutboundFlowState(stream, initialWindowSize); stream.setOutboundFlowState(state); } else { state.incrementStreamWindow(delta); } } return delta > 0; }
java
boolean initialOutboundWindowSize(int newWindowSize) { if (newWindowSize < 0) { throw new IllegalArgumentException("Invalid initial window size: " + newWindowSize); } int delta = newWindowSize - initialWindowSize; initialWindowSize = newWindowSize; for (OkHttpClientStream stream : transport.getActiveStreams()) { OutboundFlowState state = (OutboundFlowState) stream.getOutboundFlowState(); if (state == null) { // Create the OutboundFlowState with the new window size. state = new OutboundFlowState(stream, initialWindowSize); stream.setOutboundFlowState(state); } else { state.incrementStreamWindow(delta); } } return delta > 0; }
[ "boolean", "initialOutboundWindowSize", "(", "int", "newWindowSize", ")", "{", "if", "(", "newWindowSize", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid initial window size: \"", "+", "newWindowSize", ")", ";", "}", "int", "delta", ...
Adjusts outbound window size requested by peer. When window size is increased, it does not send any pending frames. If this method returns {@code true}, the caller should call {@link #writeStreams()} after settings ack. <p>Must be called with holding transport lock. @return true, if new window size is increased, false otherwise.
[ "Adjusts", "outbound", "window", "size", "requested", "by", "peer", ".", "When", "window", "size", "is", "increased", "it", "does", "not", "send", "any", "pending", "frames", ".", "If", "this", "method", "returns", "{", "@code", "true", "}", "the", "caller...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OutboundFlowController.java#L57-L76
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java
ClustersInner.beginStart
public void beginStart(String resourceGroupName, String clusterName) { beginStartWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); }
java
public void beginStart(String resourceGroupName, String clusterName) { beginStartWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); }
[ "public", "void", "beginStart", "(", "String", "resourceGroupName", ",", "String", "clusterName", ")", "{", "beginStartWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", ...
Starts a Kusto cluster. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Starts", "a", "Kusto", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L950-L952
Alluxio/alluxio
minicluster/src/main/java/alluxio/multi/process/MultiProcessCluster.java
MultiProcessCluster.updateMasterConf
public synchronized void updateMasterConf(PropertyKey key, @Nullable String value) { mMasters.forEach(master -> master.updateConf(key, value)); }
java
public synchronized void updateMasterConf(PropertyKey key, @Nullable String value) { mMasters.forEach(master -> master.updateConf(key, value)); }
[ "public", "synchronized", "void", "updateMasterConf", "(", "PropertyKey", "key", ",", "@", "Nullable", "String", "value", ")", "{", "mMasters", ".", "forEach", "(", "master", "->", "master", ".", "updateConf", "(", "key", ",", "value", ")", ")", ";", "}" ]
Updates master configuration for all masters. This will take effect on a master the next time the master is started. @param key the key to update @param value the value to set, or null to unset the key
[ "Updates", "master", "configuration", "for", "all", "masters", ".", "This", "will", "take", "effect", "on", "a", "master", "the", "next", "time", "the", "master", "is", "started", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/minicluster/src/main/java/alluxio/multi/process/MultiProcessCluster.java#L478-L480
wisdom-framework/wisdom
core/content-manager/src/main/java/org/wisdom/content/bodyparsers/BodyParserJson.java
BodyParserJson.invoke
public <T> T invoke(Context context, Class<T> classOfT, Type genericType) { T t = null; try { final String content = context.body(); if (content == null || content.length() == 0) { return null; } if (genericType != null) { t = json.mapper().readValue(content, json.mapper().constructType(genericType)); } else { t = json.mapper().readValue(content, classOfT); } } catch (IOException e) { LOGGER.error(ERROR, e); } return t; }
java
public <T> T invoke(Context context, Class<T> classOfT, Type genericType) { T t = null; try { final String content = context.body(); if (content == null || content.length() == 0) { return null; } if (genericType != null) { t = json.mapper().readValue(content, json.mapper().constructType(genericType)); } else { t = json.mapper().readValue(content, classOfT); } } catch (IOException e) { LOGGER.error(ERROR, e); } return t; }
[ "public", "<", "T", ">", "T", "invoke", "(", "Context", "context", ",", "Class", "<", "T", ">", "classOfT", ",", "Type", "genericType", ")", "{", "T", "t", "=", "null", ";", "try", "{", "final", "String", "content", "=", "context", ".", "body", "("...
Builds an instance of {@literal T} from the request payload. @param context The context @param classOfT The class we expect @param <T> the type of the object @return the build object, {@literal null} if the object cannot be built.
[ "Builds", "an", "instance", "of", "{", "@literal", "T", "}", "from", "the", "request", "payload", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/bodyparsers/BodyParserJson.java#L73-L91
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.generateHierarchyAttributeInterfaces
private void generateHierarchyAttributeInterfaces(Map<String, List<XsdAttribute>> createdAttributes, ElementHierarchyItem hierarchyInterface, String apiName) { String interfaceName = hierarchyInterface.getInterfaceName(); List<String> extendedInterfaceList = hierarchyInterface.getInterfaces(); String[] extendedInterfaces = listToArray(extendedInterfaceList, ELEMENT); ClassWriter classWriter = generateClass(interfaceName, JAVA_OBJECT, extendedInterfaces, getInterfaceSignature(extendedInterfaces, apiName), ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, apiName); hierarchyInterface.getAttributes().forEach(attribute -> generateMethodsAndCreateAttribute(createdAttributes, classWriter, attribute, elementTypeDesc, interfaceName, apiName) ); writeClassToFile(interfaceName, classWriter, apiName); }
java
private void generateHierarchyAttributeInterfaces(Map<String, List<XsdAttribute>> createdAttributes, ElementHierarchyItem hierarchyInterface, String apiName) { String interfaceName = hierarchyInterface.getInterfaceName(); List<String> extendedInterfaceList = hierarchyInterface.getInterfaces(); String[] extendedInterfaces = listToArray(extendedInterfaceList, ELEMENT); ClassWriter classWriter = generateClass(interfaceName, JAVA_OBJECT, extendedInterfaces, getInterfaceSignature(extendedInterfaces, apiName), ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, apiName); hierarchyInterface.getAttributes().forEach(attribute -> generateMethodsAndCreateAttribute(createdAttributes, classWriter, attribute, elementTypeDesc, interfaceName, apiName) ); writeClassToFile(interfaceName, classWriter, apiName); }
[ "private", "void", "generateHierarchyAttributeInterfaces", "(", "Map", "<", "String", ",", "List", "<", "XsdAttribute", ">", ">", "createdAttributes", ",", "ElementHierarchyItem", "hierarchyInterface", ",", "String", "apiName", ")", "{", "String", "interfaceName", "="...
Generates all the hierarchy interfaces. @param createdAttributes Information about the attributes that are already created. @param hierarchyInterface Information about the hierarchy interface to create. @param apiName The name of the generated fluent interface.
[ "Generates", "all", "the", "hierarchy", "interfaces", "." ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L106-L118
akarnokd/akarnokd-xml
src/main/java/hu/akarnokd/xml/XSerializables.java
XSerializables.createUpdate
public static XElement createUpdate(String function, XSerializable object) { XElement result = new XElement(function); object.save(result); return result; }
java
public static XElement createUpdate(String function, XSerializable object) { XElement result = new XElement(function); object.save(result); return result; }
[ "public", "static", "XElement", "createUpdate", "(", "String", "function", ",", "XSerializable", "object", ")", "{", "XElement", "result", "=", "new", "XElement", "(", "function", ")", ";", "object", ".", "save", "(", "result", ")", ";", "return", "result", ...
Create an update request and store the contents of the object into it. @param function the remote function name @param object the object to store. @return the request XML
[ "Create", "an", "update", "request", "and", "store", "the", "contents", "of", "the", "object", "into", "it", "." ]
train
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XSerializables.java#L48-L52
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/print/OneSelect.java
OneSelect.addAttributeSetSelectPart
public void addAttributeSetSelectPart(final String _attributeSet, final String _where) throws EFapsException { final Type type; // if a previous select exists it is based on the previous select, // else it is based on the basic table if (this.selectParts.size() > 0) { type = this.selectParts.get(this.selectParts.size() - 1).getType(); } else { type = this.query.getMainType(); } try { final AttributeSet set = AttributeSet.find(type.getName(), _attributeSet); final String linkFrom = set.getName() + "#" + set.getAttributeName(); this.fromSelect = new LinkFromSelect(linkFrom, getQuery().isCacheEnabled() ? getQuery().getKey() : null); this.fromSelect.addWhere(_where); } catch (final CacheReloadException e) { OneSelect.LOG.error("Could not find AttributeSet for Type: {}, attribute: {}", type.getName(), _attributeSet); } }
java
public void addAttributeSetSelectPart(final String _attributeSet, final String _where) throws EFapsException { final Type type; // if a previous select exists it is based on the previous select, // else it is based on the basic table if (this.selectParts.size() > 0) { type = this.selectParts.get(this.selectParts.size() - 1).getType(); } else { type = this.query.getMainType(); } try { final AttributeSet set = AttributeSet.find(type.getName(), _attributeSet); final String linkFrom = set.getName() + "#" + set.getAttributeName(); this.fromSelect = new LinkFromSelect(linkFrom, getQuery().isCacheEnabled() ? getQuery().getKey() : null); this.fromSelect.addWhere(_where); } catch (final CacheReloadException e) { OneSelect.LOG.error("Could not find AttributeSet for Type: {}, attribute: {}", type.getName(), _attributeSet); } }
[ "public", "void", "addAttributeSetSelectPart", "(", "final", "String", "_attributeSet", ",", "final", "String", "_where", ")", "throws", "EFapsException", "{", "final", "Type", "type", ";", "// if a previous select exists it is based on the previous select,", "// else it is b...
Adds the attribute set select part. @param _attributeSet the attribute set @param _where the where @throws EFapsException on error
[ "Adds", "the", "attribute", "set", "select", "part", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/print/OneSelect.java#L359-L381
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHashPartition.java
LongHashPartition.get
public MatchIterator get(long key, int hashCode) { int bucket = hashCode & numBucketsMask; int bucketOffset = bucket << 4; MemorySegment segment = buckets[bucketOffset >>> segmentSizeBits]; int segOffset = bucketOffset & segmentSizeMask; while (true) { long address = segment.getLong(segOffset + 8); if (address != INVALID_ADDRESS) { if (segment.getLong(segOffset) == key) { return valueIter(address); } else { bucket = (bucket + 1) & numBucketsMask; if (segOffset + 16 < segmentSize) { segOffset += 16; } else { bucketOffset = bucket << 4; segOffset = bucketOffset & segmentSizeMask; segment = buckets[bucketOffset >>> segmentSizeBits]; } } } else { return valueIter(INVALID_ADDRESS); } } }
java
public MatchIterator get(long key, int hashCode) { int bucket = hashCode & numBucketsMask; int bucketOffset = bucket << 4; MemorySegment segment = buckets[bucketOffset >>> segmentSizeBits]; int segOffset = bucketOffset & segmentSizeMask; while (true) { long address = segment.getLong(segOffset + 8); if (address != INVALID_ADDRESS) { if (segment.getLong(segOffset) == key) { return valueIter(address); } else { bucket = (bucket + 1) & numBucketsMask; if (segOffset + 16 < segmentSize) { segOffset += 16; } else { bucketOffset = bucket << 4; segOffset = bucketOffset & segmentSizeMask; segment = buckets[bucketOffset >>> segmentSizeBits]; } } } else { return valueIter(INVALID_ADDRESS); } } }
[ "public", "MatchIterator", "get", "(", "long", "key", ",", "int", "hashCode", ")", "{", "int", "bucket", "=", "hashCode", "&", "numBucketsMask", ";", "int", "bucketOffset", "=", "bucket", "<<", "4", ";", "MemorySegment", "segment", "=", "buckets", "[", "bu...
Returns an iterator for all the values for the given key, or null if no value found.
[ "Returns", "an", "iterator", "for", "all", "the", "values", "for", "the", "given", "key", "or", "null", "if", "no", "value", "found", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHashPartition.java#L255-L281
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.createFolder
public JenkinsServer createFolder(String folderName, Boolean crumbFlag) throws IOException { return createFolder(null, folderName, crumbFlag); }
java
public JenkinsServer createFolder(String folderName, Boolean crumbFlag) throws IOException { return createFolder(null, folderName, crumbFlag); }
[ "public", "JenkinsServer", "createFolder", "(", "String", "folderName", ",", "Boolean", "crumbFlag", ")", "throws", "IOException", "{", "return", "createFolder", "(", "null", ",", "folderName", ",", "crumbFlag", ")", ";", "}" ]
Create a folder on the server (in the root) @param folderName name of the folder. @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> <code>false</code> otherwise. @throws IOException in case of an error.
[ "Create", "a", "folder", "on", "the", "server", "(", "in", "the", "root", ")" ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L467-L469
logic-ng/LogicNG
src/main/java/org/logicng/io/readers/DimacsReader.java
DimacsReader.readCNF
public static List<Formula> readCNF(final File file, final FormulaFactory f) throws IOException { return readCNF(file, f, "v"); }
java
public static List<Formula> readCNF(final File file, final FormulaFactory f) throws IOException { return readCNF(file, f, "v"); }
[ "public", "static", "List", "<", "Formula", ">", "readCNF", "(", "final", "File", "file", ",", "final", "FormulaFactory", "f", ")", "throws", "IOException", "{", "return", "readCNF", "(", "file", ",", "f", ",", "\"v\"", ")", ";", "}" ]
Reads a given DIMACS CNF file and returns the contained clauses as a list of formulas. @param file the file @param f the formula factory @return the list of formulas (clauses) @throws IOException if there was a problem reading the file
[ "Reads", "a", "given", "DIMACS", "CNF", "file", "and", "returns", "the", "contained", "clauses", "as", "a", "list", "of", "formulas", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/io/readers/DimacsReader.java#L68-L70
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/internal/Utils.java
Utils.checkIndex
public static void checkIndex(int index, int size) { if (size < 0) { throw new IllegalArgumentException("Negative size: " + size); } if (index < 0 || index >= size) { throw new IndexOutOfBoundsException("Index out of bounds: size=" + size + ", index=" + index); } }
java
public static void checkIndex(int index, int size) { if (size < 0) { throw new IllegalArgumentException("Negative size: " + size); } if (index < 0 || index >= size) { throw new IndexOutOfBoundsException("Index out of bounds: size=" + size + ", index=" + index); } }
[ "public", "static", "void", "checkIndex", "(", "int", "index", ",", "int", "size", ")", "{", "if", "(", "size", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Negative size: \"", "+", "size", ")", ";", "}", "if", "(", "index", ...
Validates an index in an array or other container. This method throws an {@link IllegalArgumentException} if the size is negative and throws an {@link IndexOutOfBoundsException} if the index is negative or greater than or equal to the size. This method is similar to {@code Preconditions.checkElementIndex(int, int)} from Guava. @param index the index to validate. @param size the size of the array or container.
[ "Validates", "an", "index", "in", "an", "array", "or", "other", "container", ".", "This", "method", "throws", "an", "{", "@link", "IllegalArgumentException", "}", "if", "the", "size", "is", "negative", "and", "throws", "an", "{", "@link", "IndexOutOfBoundsExce...
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/internal/Utils.java#L94-L101
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java
AttributeDefinition.validateAndSet
public final void validateAndSet(ModelNode operationObject, final ModelNode model) throws OperationFailedException { if (operationObject.hasDefined(name) && deprecationData != null && deprecationData.isNotificationUseful()) { ControllerLogger.DEPRECATED_LOGGER.attributeDeprecated(getName(), PathAddress.pathAddress(operationObject.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString()); } // AS7-6224 -- convert expression strings to ModelType.EXPRESSION *before* correcting ModelNode newValue = convertParameterExpressions(operationObject.get(name)); final ModelNode correctedValue = correctValue(newValue, model.get(name)); if (!correctedValue.equals(operationObject.get(name))) { operationObject.get(name).set(correctedValue); } ModelNode node = validateOperation(operationObject, true); if (node.getType() == ModelType.EXPRESSION && (referenceRecorder != null || flags.contains(AttributeAccess.Flag.EXPRESSIONS_DEPRECATED))) { ControllerLogger.DEPRECATED_LOGGER.attributeExpressionDeprecated(getName(), PathAddress.pathAddress(operationObject.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString()); } model.get(name).set(node); }
java
public final void validateAndSet(ModelNode operationObject, final ModelNode model) throws OperationFailedException { if (operationObject.hasDefined(name) && deprecationData != null && deprecationData.isNotificationUseful()) { ControllerLogger.DEPRECATED_LOGGER.attributeDeprecated(getName(), PathAddress.pathAddress(operationObject.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString()); } // AS7-6224 -- convert expression strings to ModelType.EXPRESSION *before* correcting ModelNode newValue = convertParameterExpressions(operationObject.get(name)); final ModelNode correctedValue = correctValue(newValue, model.get(name)); if (!correctedValue.equals(operationObject.get(name))) { operationObject.get(name).set(correctedValue); } ModelNode node = validateOperation(operationObject, true); if (node.getType() == ModelType.EXPRESSION && (referenceRecorder != null || flags.contains(AttributeAccess.Flag.EXPRESSIONS_DEPRECATED))) { ControllerLogger.DEPRECATED_LOGGER.attributeExpressionDeprecated(getName(), PathAddress.pathAddress(operationObject.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString()); } model.get(name).set(node); }
[ "public", "final", "void", "validateAndSet", "(", "ModelNode", "operationObject", ",", "final", "ModelNode", "model", ")", "throws", "OperationFailedException", "{", "if", "(", "operationObject", ".", "hasDefined", "(", "name", ")", "&&", "deprecationData", "!=", ...
Finds a value in the given {@code operationObject} whose key matches this attribute's {@link #getName() name}, validates it using this attribute's {@link #getValidator() validator}, and, stores it under this attribute's name in the given {@code model}. @param operationObject model node of type {@link ModelType#OBJECT}, typically representing an operation request @param model model node in which the value should be stored @throws OperationFailedException if the value is not valid
[ "Finds", "a", "value", "in", "the", "given", "{", "@code", "operationObject", "}", "whose", "key", "matches", "this", "attribute", "s", "{", "@link", "#getName", "()", "name", "}", "validates", "it", "using", "this", "attribute", "s", "{", "@link", "#getVa...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L503-L521