repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/DrawerBuilder.java
DrawerBuilder.buildView
public Drawer buildView() { // get the slider view mSliderLayout = (ScrimInsetsRelativeLayout) mActivity.getLayoutInflater().inflate(R.layout.material_drawer_slider, mDrawerLayout, false); mSliderLayout.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(mActivity, R.attr.material_drawer_background, R.color.material_drawer_background)); // get the layout params DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) mSliderLayout.getLayoutParams(); if (params != null) { // if we've set a custom gravity set it params.gravity = mDrawerGravity; // if this is a drawer from the right, change the margins :D params = DrawerUtils.processDrawerLayoutParams(this, params); // set the new layout params mSliderLayout.setLayoutParams(params); } //create the content createContent(); //create the result object Drawer result = new Drawer(this); //set the drawer for the accountHeader if set if (mAccountHeader != null) { mAccountHeader.setDrawer(result); } //toggle selection list if we were previously on the account list if (mSavedInstance != null && mSavedInstance.getBoolean(Drawer.BUNDLE_DRAWER_CONTENT_SWITCHED, false)) { mAccountHeader.toggleSelectionList(mActivity); } //handle if the drawer should be shown on launch handleShowOnLaunch(); //we only want to hook a Drawer to the MiniDrawer if it is the main drawer, not the appended one if (!mAppended && mGenerateMiniDrawer) { // if we should create a MiniDrawer we have to do this now mMiniDrawer = new MiniDrawer().withDrawer(result).withAccountHeader(mAccountHeader); } //forget the reference to the activity mActivity = null; return result; }
java
public Drawer buildView() { // get the slider view mSliderLayout = (ScrimInsetsRelativeLayout) mActivity.getLayoutInflater().inflate(R.layout.material_drawer_slider, mDrawerLayout, false); mSliderLayout.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(mActivity, R.attr.material_drawer_background, R.color.material_drawer_background)); // get the layout params DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) mSliderLayout.getLayoutParams(); if (params != null) { // if we've set a custom gravity set it params.gravity = mDrawerGravity; // if this is a drawer from the right, change the margins :D params = DrawerUtils.processDrawerLayoutParams(this, params); // set the new layout params mSliderLayout.setLayoutParams(params); } //create the content createContent(); //create the result object Drawer result = new Drawer(this); //set the drawer for the accountHeader if set if (mAccountHeader != null) { mAccountHeader.setDrawer(result); } //toggle selection list if we were previously on the account list if (mSavedInstance != null && mSavedInstance.getBoolean(Drawer.BUNDLE_DRAWER_CONTENT_SWITCHED, false)) { mAccountHeader.toggleSelectionList(mActivity); } //handle if the drawer should be shown on launch handleShowOnLaunch(); //we only want to hook a Drawer to the MiniDrawer if it is the main drawer, not the appended one if (!mAppended && mGenerateMiniDrawer) { // if we should create a MiniDrawer we have to do this now mMiniDrawer = new MiniDrawer().withDrawer(result).withAccountHeader(mAccountHeader); } //forget the reference to the activity mActivity = null; return result; }
[ "public", "Drawer", "buildView", "(", ")", "{", "// get the slider view", "mSliderLayout", "=", "(", "ScrimInsetsRelativeLayout", ")", "mActivity", ".", "getLayoutInflater", "(", ")", ".", "inflate", "(", "R", ".", "layout", ".", "material_drawer_slider", ",", "mD...
build the drawers content only. This will still return a Result object, but only with the content set. No inflating of a DrawerLayout. @return Result object with only the content set
[ "build", "the", "drawers", "content", "only", ".", "This", "will", "still", "return", "a", "Result", "object", "but", "only", "with", "the", "content", "set", ".", "No", "inflating", "of", "a", "DrawerLayout", "." ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/DrawerBuilder.java#L1537-L1580
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsXmlContainerPage.java
CmsXmlContainerPage.saveContainerPage
protected void saveContainerPage(CmsObject cms, Element parent, CmsContainerPageBean cntPage) throws CmsException { parent.clearContent(); // save containers in a defined order List<String> containerNames = new ArrayList<String>(cntPage.getNames()); Collections.sort(containerNames); for (String containerName : containerNames) { CmsContainerBean container = cntPage.getContainers().get(containerName); // the container Element cntElement = parent.addElement(XmlNode.Containers.name()); cntElement.addElement(XmlNode.Name.name()).addCDATA(container.getName()); cntElement.addElement(XmlNode.Type.name()).addCDATA(container.getType()); if (container.isNestedContainer()) { cntElement.addElement(XmlNode.ParentInstanceId.name()).addCDATA(container.getParentInstanceId()); } if (container.isRootContainer()) { cntElement.addElement(XmlNode.IsRootContainer.name()).addText(Boolean.TRUE.toString()); } // the elements for (CmsContainerElementBean element : container.getElements()) { Element elemElement = cntElement.addElement(XmlNode.Elements.name()); // the element Element uriElem = elemElement.addElement(XmlNode.Uri.name()); CmsResource uriRes = fillResource(cms, uriElem, element.getId()); Element formatterElem = elemElement.addElement(XmlNode.Formatter.name()); fillResource(cms, formatterElem, element.getFormatterId()); if (element.isCreateNew()) { Element createNewElem = elemElement.addElement(XmlNode.CreateNew.name()); createNewElem.addText(Boolean.TRUE.toString()); } // the properties Map<String, String> properties = element.getIndividualSettings(); Map<String, CmsXmlContentProperty> propertiesConf = OpenCms.getADEManager().getElementSettings( cms, uriRes); CmsXmlContentPropertyHelper.saveProperties(cms, elemElement, properties, propertiesConf); } } }
java
protected void saveContainerPage(CmsObject cms, Element parent, CmsContainerPageBean cntPage) throws CmsException { parent.clearContent(); // save containers in a defined order List<String> containerNames = new ArrayList<String>(cntPage.getNames()); Collections.sort(containerNames); for (String containerName : containerNames) { CmsContainerBean container = cntPage.getContainers().get(containerName); // the container Element cntElement = parent.addElement(XmlNode.Containers.name()); cntElement.addElement(XmlNode.Name.name()).addCDATA(container.getName()); cntElement.addElement(XmlNode.Type.name()).addCDATA(container.getType()); if (container.isNestedContainer()) { cntElement.addElement(XmlNode.ParentInstanceId.name()).addCDATA(container.getParentInstanceId()); } if (container.isRootContainer()) { cntElement.addElement(XmlNode.IsRootContainer.name()).addText(Boolean.TRUE.toString()); } // the elements for (CmsContainerElementBean element : container.getElements()) { Element elemElement = cntElement.addElement(XmlNode.Elements.name()); // the element Element uriElem = elemElement.addElement(XmlNode.Uri.name()); CmsResource uriRes = fillResource(cms, uriElem, element.getId()); Element formatterElem = elemElement.addElement(XmlNode.Formatter.name()); fillResource(cms, formatterElem, element.getFormatterId()); if (element.isCreateNew()) { Element createNewElem = elemElement.addElement(XmlNode.CreateNew.name()); createNewElem.addText(Boolean.TRUE.toString()); } // the properties Map<String, String> properties = element.getIndividualSettings(); Map<String, CmsXmlContentProperty> propertiesConf = OpenCms.getADEManager().getElementSettings( cms, uriRes); CmsXmlContentPropertyHelper.saveProperties(cms, elemElement, properties, propertiesConf); } } }
[ "protected", "void", "saveContainerPage", "(", "CmsObject", "cms", ",", "Element", "parent", ",", "CmsContainerPageBean", "cntPage", ")", "throws", "CmsException", "{", "parent", ".", "clearContent", "(", ")", ";", "// save containers in a defined order", "List", "<",...
Adds the given container page to the given element.<p> @param cms the current CMS object @param parent the element to add it @param cntPage the container page to add @throws CmsException if something goes wrong
[ "Adds", "the", "given", "container", "page", "to", "the", "given", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlContainerPage.java#L641-L685
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.createTopic
private PubsubFuture<Topic> createTopic(final String canonicalTopic) { validateCanonicalTopic(canonicalTopic); return put("create topic", canonicalTopic, NO_PAYLOAD, readJson(Topic.class)); }
java
private PubsubFuture<Topic> createTopic(final String canonicalTopic) { validateCanonicalTopic(canonicalTopic); return put("create topic", canonicalTopic, NO_PAYLOAD, readJson(Topic.class)); }
[ "private", "PubsubFuture", "<", "Topic", ">", "createTopic", "(", "final", "String", "canonicalTopic", ")", "{", "validateCanonicalTopic", "(", "canonicalTopic", ")", ";", "return", "put", "(", "\"create topic\"", ",", "canonicalTopic", ",", "NO_PAYLOAD", ",", "re...
Create a Pub/Sub topic. @param canonicalTopic The canonical (including project) name of the topic to create. @return A future that is completed when this request is completed.
[ "Create", "a", "Pub", "/", "Sub", "topic", "." ]
train
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L293-L296
jboss/jboss-jacc-api_spec
src/main/java/javax/security/jacc/PolicyContext.java
PolicyContext.registerHandler
public static void registerHandler(String key, PolicyContextHandler handler, boolean replace) throws PolicyContextException { if (key == null) throw new IllegalArgumentException("The key may not be null"); if (handler == null) throw new IllegalArgumentException("The handler may not be null"); SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(setPolicy); if (replace == false && handlerMap.containsKey(key) == true) { String msg = "Handler for key=" + key + ", exists, handler: " + handlerMap.get(key); throw new IllegalArgumentException(msg); } handlerMap.put(key, handler); }
java
public static void registerHandler(String key, PolicyContextHandler handler, boolean replace) throws PolicyContextException { if (key == null) throw new IllegalArgumentException("The key may not be null"); if (handler == null) throw new IllegalArgumentException("The handler may not be null"); SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(setPolicy); if (replace == false && handlerMap.containsKey(key) == true) { String msg = "Handler for key=" + key + ", exists, handler: " + handlerMap.get(key); throw new IllegalArgumentException(msg); } handlerMap.put(key, handler); }
[ "public", "static", "void", "registerHandler", "(", "String", "key", ",", "PolicyContextHandler", "handler", ",", "boolean", "replace", ")", "throws", "PolicyContextException", "{", "if", "(", "key", "==", "null", ")", "throw", "new", "IllegalArgumentException", "...
<p> Authorization protected method used to register a container specific {@code PolicyContext} handler. A handler may be registered to handle multiple keys, but at any time, at most one handler may be registered for a key. </p> @param key - a (case-sensitive) {@code String} that identifies the context object handled by the handler. The value of this parameter must not be null. @param handler - an object that implements the {@code PolicyContextHandler} interface. The value of this parameter must not be null. @param replace - this boolean value defines the behavior of this method if, when it is called, a {@code PolicyContextHandler} has already been registered to handle the same key. In that case, and if the value of this argument is {@code true}, the existing handler is replaced with the argument handler. If the value of this parameter is false the existing registration is preserved and an exception is thrown. @throws IllegalArgumentException - if the value of either of the handler or key arguments is null, or the value of the replace argument is false and a handler with the same key as the argument handler is already registered. @throws SecurityException - if the calling {@code AccessControlContext} is not authorized by the container to call this method. @throws PolicyContextException - if an operation by this method on the argument {@code PolicyContextHandler} causes it to throw a checked exception that is not accounted for in the signature of this method.
[ "<p", ">", "Authorization", "protected", "method", "used", "to", "register", "a", "container", "specific", "{", "@code", "PolicyContext", "}", "handler", ".", "A", "handler", "may", "be", "registered", "to", "handle", "multiple", "keys", "but", "at", "any", ...
train
https://github.com/jboss/jboss-jacc-api_spec/blob/cc97802b6d368cd98a1d30f075689a7fef225582/src/main/java/javax/security/jacc/PolicyContext.java#L172-L188
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/StatusTransition.java
StatusTransition.transitionLock
public <T> void transitionLock(String topologyId, boolean errorOnNoTransition, StatusType changeStatus, T... args) throws Exception { // get ZK's topology node's data, which is StormBase StormBase stormbase = data.getStormClusterState().storm_base(topologyId, null); if (stormbase == null) { LOG.error("Cannot apply event: changing status " + topologyId + " -> " + changeStatus.getStatus() + ", cause: failed to get StormBase from ZK"); return; } StormStatus currentStatus = stormbase.getStatus(); if (currentStatus == null) { LOG.error("Cannot apply event: changing status " + topologyId + " -> " + changeStatus.getStatus() + ", cause: topologyStatus is null in ZK"); return; } // <currentStatus, Map<changingStatus, callback>> Map<StatusType, Map<StatusType, Callback>> callbackMap = stateTransitions(topologyId, currentStatus); // get current changingCallbacks Map<StatusType, Callback> changingCallbacks = callbackMap.get(currentStatus.getStatusType()); if (changingCallbacks == null || !changingCallbacks.containsKey(changeStatus) || changingCallbacks.get(changeStatus) == null) { String msg = "No transition for event: changing status:" + changeStatus.getStatus() + ", current status: " + currentStatus.getStatusType() + ", topology-id: " + topologyId; LOG.info(msg); if (errorOnNoTransition) { throw new RuntimeException(msg); } return; } Callback callback = changingCallbacks.get(changeStatus); Object obj = callback.execute(args); if (obj != null && obj instanceof StormStatus) { StormStatus newStatus = (StormStatus) obj; // update status to ZK data.getStormClusterState().update_storm(topologyId, newStatus); LOG.info("Successfully updated " + topologyId + " to status " + newStatus); } LOG.info("Successfully apply event: changing status " + topologyId + " -> " + changeStatus.getStatus()); }
java
public <T> void transitionLock(String topologyId, boolean errorOnNoTransition, StatusType changeStatus, T... args) throws Exception { // get ZK's topology node's data, which is StormBase StormBase stormbase = data.getStormClusterState().storm_base(topologyId, null); if (stormbase == null) { LOG.error("Cannot apply event: changing status " + topologyId + " -> " + changeStatus.getStatus() + ", cause: failed to get StormBase from ZK"); return; } StormStatus currentStatus = stormbase.getStatus(); if (currentStatus == null) { LOG.error("Cannot apply event: changing status " + topologyId + " -> " + changeStatus.getStatus() + ", cause: topologyStatus is null in ZK"); return; } // <currentStatus, Map<changingStatus, callback>> Map<StatusType, Map<StatusType, Callback>> callbackMap = stateTransitions(topologyId, currentStatus); // get current changingCallbacks Map<StatusType, Callback> changingCallbacks = callbackMap.get(currentStatus.getStatusType()); if (changingCallbacks == null || !changingCallbacks.containsKey(changeStatus) || changingCallbacks.get(changeStatus) == null) { String msg = "No transition for event: changing status:" + changeStatus.getStatus() + ", current status: " + currentStatus.getStatusType() + ", topology-id: " + topologyId; LOG.info(msg); if (errorOnNoTransition) { throw new RuntimeException(msg); } return; } Callback callback = changingCallbacks.get(changeStatus); Object obj = callback.execute(args); if (obj != null && obj instanceof StormStatus) { StormStatus newStatus = (StormStatus) obj; // update status to ZK data.getStormClusterState().update_storm(topologyId, newStatus); LOG.info("Successfully updated " + topologyId + " to status " + newStatus); } LOG.info("Successfully apply event: changing status " + topologyId + " -> " + changeStatus.getStatus()); }
[ "public", "<", "T", ">", "void", "transitionLock", "(", "String", "topologyId", ",", "boolean", "errorOnNoTransition", ",", "StatusType", "changeStatus", ",", "T", "...", "args", ")", "throws", "Exception", "{", "// get ZK's topology node's data, which is StormBase", ...
Changing status @param args -- will be used in the status changing callback
[ "Changing", "status" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/StatusTransition.java#L72-L117
transloadit/java-sdk
src/main/java/com/transloadit/sdk/Assembly.java
Assembly.processTusFile
protected void processTusFile(File file, String fieldName, String assemblyUrl) throws IOException { TusUpload upload = getTusUploadInstance(file); Map<String, String> metadata = new HashMap<String, String>(); metadata.put("filename", file.getName()); metadata.put("assembly_url", assemblyUrl); metadata.put("fieldname", fieldName); upload.setMetadata(metadata); uploads.add(upload); }
java
protected void processTusFile(File file, String fieldName, String assemblyUrl) throws IOException { TusUpload upload = getTusUploadInstance(file); Map<String, String> metadata = new HashMap<String, String>(); metadata.put("filename", file.getName()); metadata.put("assembly_url", assemblyUrl); metadata.put("fieldname", fieldName); upload.setMetadata(metadata); uploads.add(upload); }
[ "protected", "void", "processTusFile", "(", "File", "file", ",", "String", "fieldName", ",", "String", "assemblyUrl", ")", "throws", "IOException", "{", "TusUpload", "upload", "=", "getTusUploadInstance", "(", "file", ")", ";", "Map", "<", "String", ",", "Stri...
Prepares a file for tus upload. @param file {@link File} @param fieldName the form field name assigned to the file. @param assemblyUrl the assembly url affiliated with the tus upload. @throws IOException when there's a failure with file retrieval.
[ "Prepares", "a", "file", "for", "tus", "upload", "." ]
train
https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Assembly.java#L251-L262
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java
TitlePaneMenuButtonPainter.paintEnabled
private void paintEnabled(Graphics2D g, JComponent c, int width, int height) { paintMenu(g, c, width, height, enabled); }
java
private void paintEnabled(Graphics2D g, JComponent c, int width, int height) { paintMenu(g, c, width, height, enabled); }
[ "private", "void", "paintEnabled", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "paintMenu", "(", "g", ",", "c", ",", "width", ",", "height", ",", "enabled", ")", ";", "}" ]
Paint the background enabled state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "background", "enabled", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java#L110-L112
killme2008/Metamorphosis
metamorphosis-commons/src/main/java/com/taobao/metamorphosis/utils/ResourceUtils.java
ResourceUtils.getResourceAsFile
public static File getResourceAsFile(ClassLoader loader, String resource) throws IOException { return new File(getResourceURL(loader, resource).getFile()); }
java
public static File getResourceAsFile(ClassLoader loader, String resource) throws IOException { return new File(getResourceURL(loader, resource).getFile()); }
[ "public", "static", "File", "getResourceAsFile", "(", "ClassLoader", "loader", ",", "String", "resource", ")", "throws", "IOException", "{", "return", "new", "File", "(", "getResourceURL", "(", "loader", ",", "resource", ")", ".", "getFile", "(", ")", ")", "...
Returns a resource on the classpath as a File object @param loader The classloader used to load the resource @param resource The resource to find @throws IOException If the resource cannot be found or read @return The resource
[ "Returns", "a", "resource", "on", "the", "classpath", "as", "a", "File", "object" ]
train
https://github.com/killme2008/Metamorphosis/blob/1884b10620dbd640aaf85102243ca295703fbb4a/metamorphosis-commons/src/main/java/com/taobao/metamorphosis/utils/ResourceUtils.java#L245-L247
UrielCh/ovh-java-sdk
ovh-java-sdk-emailmxplan/src/main/java/net/minidev/ovh/api/ApiOvhEmailmxplan.java
ApiOvhEmailmxplan.service_externalContact_externalEmailAddress_DELETE
public OvhTask service_externalContact_externalEmailAddress_DELETE(String service, String externalEmailAddress) throws IOException { String qPath = "/email/mxplan/{service}/externalContact/{externalEmailAddress}"; StringBuilder sb = path(qPath, service, externalEmailAddress); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTask.class); }
java
public OvhTask service_externalContact_externalEmailAddress_DELETE(String service, String externalEmailAddress) throws IOException { String qPath = "/email/mxplan/{service}/externalContact/{externalEmailAddress}"; StringBuilder sb = path(qPath, service, externalEmailAddress); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "service_externalContact_externalEmailAddress_DELETE", "(", "String", "service", ",", "String", "externalEmailAddress", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/mxplan/{service}/externalContact/{externalEmailAddress}\"", ";", "Stri...
delete external contact REST: DELETE /email/mxplan/{service}/externalContact/{externalEmailAddress} @param service [required] The internal name of your mxplan organization @param externalEmailAddress [required] Contact email API beta
[ "delete", "external", "contact" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailmxplan/src/main/java/net/minidev/ovh/api/ApiOvhEmailmxplan.java#L550-L555
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getGeneralGuildInfo
public void getGeneralGuildInfo(String id, Callback<Guild> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, id)); gw2API.getGeneralGuildInfo(id).enqueue(callback); }
java
public void getGeneralGuildInfo(String id, Callback<Guild> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, id)); gw2API.getGeneralGuildInfo(id).enqueue(callback); }
[ "public", "void", "getGeneralGuildInfo", "(", "String", "id", ",", "Callback", "<", "Guild", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType", ".", "GUILD", ",", ...
For more info on guild upgrades API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/upgrades">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param id guild id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @see Guild guild info
[ "For", "more", "info", "on", "guild", "upgrades", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "guild", "/", "upgrades", ">", "here<", "/", "a", ">", "<br", "/"...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1435-L1438
apache/incubator-heron
heron/api/src/java/org/apache/heron/api/HeronSubmitter.java
HeronSubmitter.submitTopology
public static void submitTopology(String name, Config heronConfig, HeronTopology topology) throws AlreadyAliveException, InvalidTopologyException { Map<String, String> heronCmdOptions = getHeronCmdOptions(); // We would read the topology initial state from arguments from heron-cli TopologyAPI.TopologyState initialState; if (heronCmdOptions.get(CMD_TOPOLOGY_INITIAL_STATE) != null) { initialState = TopologyAPI.TopologyState.valueOf( heronCmdOptions.get(CMD_TOPOLOGY_INITIAL_STATE)); } else { initialState = TopologyAPI.TopologyState.RUNNING; } LOG.log(Level.FINE, "To deploy a topology in initial state {0}", initialState); // add role and environment if present final String role = heronCmdOptions.get(CMD_TOPOLOGY_ROLE); if (role != null) { heronConfig.putIfAbsent(Config.TOPOLOGY_TEAM_NAME, role); } final String environment = heronCmdOptions.get(CMD_TOPOLOGY_ENVIRONMENT); if (environment != null) { heronConfig.putIfAbsent(Config.TOPOLOGY_TEAM_ENVIRONMENT, environment); } TopologyAPI.Topology fTopology = topology.setConfig(heronConfig). setName(name). setState(initialState). getTopology(); TopologyUtils.validateTopology(fTopology); assert fTopology.isInitialized(); submitTopologyToFile(fTopology, heronCmdOptions); }
java
public static void submitTopology(String name, Config heronConfig, HeronTopology topology) throws AlreadyAliveException, InvalidTopologyException { Map<String, String> heronCmdOptions = getHeronCmdOptions(); // We would read the topology initial state from arguments from heron-cli TopologyAPI.TopologyState initialState; if (heronCmdOptions.get(CMD_TOPOLOGY_INITIAL_STATE) != null) { initialState = TopologyAPI.TopologyState.valueOf( heronCmdOptions.get(CMD_TOPOLOGY_INITIAL_STATE)); } else { initialState = TopologyAPI.TopologyState.RUNNING; } LOG.log(Level.FINE, "To deploy a topology in initial state {0}", initialState); // add role and environment if present final String role = heronCmdOptions.get(CMD_TOPOLOGY_ROLE); if (role != null) { heronConfig.putIfAbsent(Config.TOPOLOGY_TEAM_NAME, role); } final String environment = heronCmdOptions.get(CMD_TOPOLOGY_ENVIRONMENT); if (environment != null) { heronConfig.putIfAbsent(Config.TOPOLOGY_TEAM_ENVIRONMENT, environment); } TopologyAPI.Topology fTopology = topology.setConfig(heronConfig). setName(name). setState(initialState). getTopology(); TopologyUtils.validateTopology(fTopology); assert fTopology.isInitialized(); submitTopologyToFile(fTopology, heronCmdOptions); }
[ "public", "static", "void", "submitTopology", "(", "String", "name", ",", "Config", "heronConfig", ",", "HeronTopology", "topology", ")", "throws", "AlreadyAliveException", ",", "InvalidTopologyException", "{", "Map", "<", "String", ",", "String", ">", "heronCmdOpti...
Submits a topology to run on the cluster. A topology runs forever or until explicitly killed. @param name the name of the topology. @param heronConfig the topology-specific configuration. See {@link Config}. @param topology the processing to execute. @throws AlreadyAliveException if a topology with this name is already running @throws InvalidTopologyException if an invalid topology was submitted
[ "Submits", "a", "topology", "to", "run", "on", "the", "cluster", ".", "A", "topology", "runs", "forever", "or", "until", "explicitly", "killed", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/HeronSubmitter.java#L66-L102
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java
ByteBufferOutputStream.writeTo
public void writeTo (@Nonnull final ByteBuffer aDestBuffer, final boolean bCompactBuffer) { ValueEnforcer.notNull (aDestBuffer, "DestBuffer"); m_aBuffer.flip (); aDestBuffer.put (m_aBuffer); if (bCompactBuffer) m_aBuffer.compact (); }
java
public void writeTo (@Nonnull final ByteBuffer aDestBuffer, final boolean bCompactBuffer) { ValueEnforcer.notNull (aDestBuffer, "DestBuffer"); m_aBuffer.flip (); aDestBuffer.put (m_aBuffer); if (bCompactBuffer) m_aBuffer.compact (); }
[ "public", "void", "writeTo", "(", "@", "Nonnull", "final", "ByteBuffer", "aDestBuffer", ",", "final", "boolean", "bCompactBuffer", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aDestBuffer", ",", "\"DestBuffer\"", ")", ";", "m_aBuffer", ".", "flip", "(", ")...
Write everything currently contained to the specified buffer. If the passed buffer is too small, a {@link java.nio.BufferOverflowException} is thrown. The copied elements are removed from this streams buffer. @param aDestBuffer The destination buffer to write to. May not be <code>null</code>. @param bCompactBuffer <code>true</code> to compact the buffer afterwards, <code>false</code> otherwise.
[ "Write", "everything", "currently", "contained", "to", "the", "specified", "buffer", ".", "If", "the", "passed", "buffer", "is", "too", "small", "a", "{", "@link", "java", ".", "nio", ".", "BufferOverflowException", "}", "is", "thrown", ".", "The", "copied",...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/ByteBufferOutputStream.java#L229-L237
icoloma/simpleds
src/main/java/org/simpleds/CursorList.java
CursorList.loadRelatedEntities
public Map<Key, Object> loadRelatedEntities(String... propertyName) { EntityManager entityManager = EntityManagerFactory.getEntityManager(); Class<J> persistentClass = (Class<J>) query.getClassMetadata().getPersistentClass(); Set<Key> keys = Sets.newHashSet(); for (String p : propertyName) { keys.addAll(Collections2.transform(data, new EntityToPropertyFunction(persistentClass, p))); } return entityManager.get(keys); }
java
public Map<Key, Object> loadRelatedEntities(String... propertyName) { EntityManager entityManager = EntityManagerFactory.getEntityManager(); Class<J> persistentClass = (Class<J>) query.getClassMetadata().getPersistentClass(); Set<Key> keys = Sets.newHashSet(); for (String p : propertyName) { keys.addAll(Collections2.transform(data, new EntityToPropertyFunction(persistentClass, p))); } return entityManager.get(keys); }
[ "public", "Map", "<", "Key", ",", "Object", ">", "loadRelatedEntities", "(", "String", "...", "propertyName", ")", "{", "EntityManager", "entityManager", "=", "EntityManagerFactory", ".", "getEntityManager", "(", ")", ";", "Class", "<", "J", ">", "persistentClas...
Load the list of related entities. @param propertyName the name of the properties to be used as Key @return the list of retrieved entities
[ "Load", "the", "list", "of", "related", "entities", "." ]
train
https://github.com/icoloma/simpleds/blob/b07763df98b9375b764e625f617a6c78df4b068d/src/main/java/org/simpleds/CursorList.java#L51-L59
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/http2/Http2SourceHandler.java
Http2SourceHandler.userEventTriggered
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { if (evt instanceof HttpServerUpgradeHandler.UpgradeEvent) { FullHttpRequest upgradedRequest = ((HttpServerUpgradeHandler.UpgradeEvent) evt).upgradeRequest(); // Construct new HTTP Request HttpRequest httpRequest = new DefaultHttpRequest( new HttpVersion(Constants.HTTP_VERSION_2_0, true), upgradedRequest.method(), upgradedRequest.uri(), upgradedRequest.headers()); HttpCarbonRequest requestCarbonMessage = setupCarbonRequest(httpRequest, this); requestCarbonMessage.addHttpContent(new DefaultLastHttpContent(upgradedRequest.content())); notifyRequestListener(this, requestCarbonMessage, 1); } }
java
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { if (evt instanceof HttpServerUpgradeHandler.UpgradeEvent) { FullHttpRequest upgradedRequest = ((HttpServerUpgradeHandler.UpgradeEvent) evt).upgradeRequest(); // Construct new HTTP Request HttpRequest httpRequest = new DefaultHttpRequest( new HttpVersion(Constants.HTTP_VERSION_2_0, true), upgradedRequest.method(), upgradedRequest.uri(), upgradedRequest.headers()); HttpCarbonRequest requestCarbonMessage = setupCarbonRequest(httpRequest, this); requestCarbonMessage.addHttpContent(new DefaultLastHttpContent(upgradedRequest.content())); notifyRequestListener(this, requestCarbonMessage, 1); } }
[ "@", "Override", "public", "void", "userEventTriggered", "(", "ChannelHandlerContext", "ctx", ",", "Object", "evt", ")", "{", "if", "(", "evt", "instanceof", "HttpServerUpgradeHandler", ".", "UpgradeEvent", ")", "{", "FullHttpRequest", "upgradedRequest", "=", "(", ...
Handles the cleartext HTTP upgrade event. <p> If an upgrade occurred, message needs to be dispatched to the correct service/resource and response should be delivered over stream 1 (the stream specifically reserved for cleartext HTTP upgrade).
[ "Handles", "the", "cleartext", "HTTP", "upgrade", "event", ".", "<p", ">", "If", "an", "upgrade", "occurred", "message", "needs", "to", "be", "dispatched", "to", "the", "correct", "service", "/", "resource", "and", "response", "should", "be", "delivered", "o...
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/http2/Http2SourceHandler.java#L107-L121
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ns_savedconfig.java
ns_ns_savedconfig.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_ns_savedconfig_responses result = (ns_ns_savedconfig_responses) service.get_payload_formatter().string_to_resource(ns_ns_savedconfig_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.ns_ns_savedconfig_response_array); } ns_ns_savedconfig[] result_ns_ns_savedconfig = new ns_ns_savedconfig[result.ns_ns_savedconfig_response_array.length]; for(int i = 0; i < result.ns_ns_savedconfig_response_array.length; i++) { result_ns_ns_savedconfig[i] = result.ns_ns_savedconfig_response_array[i].ns_ns_savedconfig[0]; } return result_ns_ns_savedconfig; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_ns_savedconfig_responses result = (ns_ns_savedconfig_responses) service.get_payload_formatter().string_to_resource(ns_ns_savedconfig_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.ns_ns_savedconfig_response_array); } ns_ns_savedconfig[] result_ns_ns_savedconfig = new ns_ns_savedconfig[result.ns_ns_savedconfig_response_array.length]; for(int i = 0; i < result.ns_ns_savedconfig_response_array.length; i++) { result_ns_ns_savedconfig[i] = result.ns_ns_savedconfig_response_array[i].ns_ns_savedconfig[0]; } return result_ns_ns_savedconfig; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_ns_savedconfig_responses", "result", "=", "(", "ns_ns_savedconfig_responses", ")", "service", ".", "get_pa...
<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/ns/ns_ns_savedconfig.java#L203-L220
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.createOrUpdateCertificate
public AppServiceCertificateResourceInner createOrUpdateCertificate(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) { return createOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).toBlocking().last().body(); }
java
public AppServiceCertificateResourceInner createOrUpdateCertificate(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) { return createOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).toBlocking().last().body(); }
[ "public", "AppServiceCertificateResourceInner", "createOrUpdateCertificate", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ",", "String", "name", ",", "AppServiceCertificateResourceInner", "keyVaultCertificate", ")", "{", "return", "createOrUpdateCert...
Creates or updates a certificate and associates with key vault secret. Creates or updates a certificate and associates with key vault secret. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param name Name of the certificate. @param keyVaultCertificate Key vault certificate resource Id. @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AppServiceCertificateResourceInner object if successful.
[ "Creates", "or", "updates", "a", "certificate", "and", "associates", "with", "key", "vault", "secret", ".", "Creates", "or", "updates", "a", "certificate", "and", "associates", "with", "key", "vault", "secret", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1189-L1191
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/resource/Import.java
Import.addDataPointSet
public void addDataPointSet(String series, Set<DataPoint> dataPoints) { DataSet set = store.get(series); if (set == null) { set = new DataSet(dataPoints); store.put(series, set); } else { set.addAll(dataPoints); } }
java
public void addDataPointSet(String series, Set<DataPoint> dataPoints) { DataSet set = store.get(series); if (set == null) { set = new DataSet(dataPoints); store.put(series, set); } else { set.addAll(dataPoints); } }
[ "public", "void", "addDataPointSet", "(", "String", "series", ",", "Set", "<", "DataPoint", ">", "dataPoints", ")", "{", "DataSet", "set", "=", "store", ".", "get", "(", "series", ")", ";", "if", "(", "set", "==", "null", ")", "{", "set", "=", "new",...
Adds a set of `DataPoint`s to a series. @param series The series the DataPoints should be added to. If the series doesn't exist, it will be created. @param dataPoints Data to be added.
[ "Adds", "a", "set", "of", "DataPoint", "s", "to", "a", "series", "." ]
train
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/resource/Import.java#L135-L143
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCheckBoxSelectRenderer.java
WCheckBoxSelectRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WCheckBoxSelect select = (WCheckBoxSelect) component; XmlStringBuilder xml = renderContext.getWriter(); int cols = select.getButtonColumns(); boolean readOnly = select.isReadOnly(); xml.appendTagOpen("ui:checkboxselect"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", select.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { int min = select.getMinSelect(); int max = select.getMaxSelect(); xml.appendOptionalAttribute("disabled", select.isDisabled(), "true"); xml.appendOptionalAttribute("required", select.isMandatory(), "true"); xml.appendOptionalAttribute("submitOnChange", select.isSubmitOnChange(), "true"); xml.appendOptionalAttribute("toolTip", component.getToolTip()); xml.appendOptionalAttribute("accessibleText", component.getAccessibleText()); xml.appendOptionalAttribute("min", min > 0, min); xml.appendOptionalAttribute("max", max > 0, max); } xml.appendOptionalAttribute("frameless", select.isFrameless(), "true"); switch (select.getButtonLayout()) { case COLUMNS: xml.appendAttribute("layout", "column"); xml.appendOptionalAttribute("layoutColumnCount", cols > 0, cols); break; case FLAT: xml.appendAttribute("layout", "flat"); break; case STACKED: xml.appendAttribute("layout", "stacked"); break; default: throw new SystemException("Unknown layout type: " + select.getButtonLayout()); } xml.appendClose(); // Options List<?> options = select.getOptions(); boolean renderSelectionsOnly = readOnly; if (options != null) { int optionIndex = 0; List<?> selections = select.getSelected(); for (Object option : options) { if (option instanceof OptionGroup) { throw new SystemException("Option groups not supported in WCheckBoxSelect."); } else { renderOption(select, option, optionIndex++, xml, selections, renderSelectionsOnly); } } } if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(select, renderContext); } xml.appendEndTag("ui:checkboxselect"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WCheckBoxSelect select = (WCheckBoxSelect) component; XmlStringBuilder xml = renderContext.getWriter(); int cols = select.getButtonColumns(); boolean readOnly = select.isReadOnly(); xml.appendTagOpen("ui:checkboxselect"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", select.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { int min = select.getMinSelect(); int max = select.getMaxSelect(); xml.appendOptionalAttribute("disabled", select.isDisabled(), "true"); xml.appendOptionalAttribute("required", select.isMandatory(), "true"); xml.appendOptionalAttribute("submitOnChange", select.isSubmitOnChange(), "true"); xml.appendOptionalAttribute("toolTip", component.getToolTip()); xml.appendOptionalAttribute("accessibleText", component.getAccessibleText()); xml.appendOptionalAttribute("min", min > 0, min); xml.appendOptionalAttribute("max", max > 0, max); } xml.appendOptionalAttribute("frameless", select.isFrameless(), "true"); switch (select.getButtonLayout()) { case COLUMNS: xml.appendAttribute("layout", "column"); xml.appendOptionalAttribute("layoutColumnCount", cols > 0, cols); break; case FLAT: xml.appendAttribute("layout", "flat"); break; case STACKED: xml.appendAttribute("layout", "stacked"); break; default: throw new SystemException("Unknown layout type: " + select.getButtonLayout()); } xml.appendClose(); // Options List<?> options = select.getOptions(); boolean renderSelectionsOnly = readOnly; if (options != null) { int optionIndex = 0; List<?> selections = select.getSelected(); for (Object option : options) { if (option instanceof OptionGroup) { throw new SystemException("Option groups not supported in WCheckBoxSelect."); } else { renderOption(select, option, optionIndex++, xml, selections, renderSelectionsOnly); } } } if (!readOnly) { DiagnosticRenderUtil.renderDiagnostics(select, renderContext); } xml.appendEndTag("ui:checkboxselect"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WCheckBoxSelect", "select", "=", "(", "WCheckBoxSelect", ")", "component", ";", "XmlStringBuilder", "xml", "=", ...
Paints the given WCheckBoxSelect. @param component the WCheckBoxSelect to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WCheckBoxSelect", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCheckBoxSelectRenderer.java#L26-L92
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfReaderInstance.java
PdfReaderInstance.getFormXObject
PdfStream getFormXObject(int pageNumber, int compressionLevel) throws IOException { PdfDictionary page = reader.getPageNRelease(pageNumber); PdfObject contents = PdfReader.getPdfObjectRelease(page.get(PdfName.CONTENTS)); PdfDictionary dic = new PdfDictionary(); byte bout[] = null; if (contents != null) { if (contents.isStream()) dic.putAll((PRStream)contents); else bout = reader.getPageContent(pageNumber, file); } else bout = new byte[0]; dic.put(PdfName.RESOURCES, PdfReader.getPdfObjectRelease(page.get(PdfName.RESOURCES))); dic.put(PdfName.TYPE, PdfName.XOBJECT); dic.put(PdfName.SUBTYPE, PdfName.FORM); PdfImportedPage impPage = (PdfImportedPage)importedPages.get(Integer.valueOf(pageNumber)); dic.put(PdfName.BBOX, new PdfRectangle(impPage.getBoundingBox())); PdfArray matrix = impPage.getMatrix(); if (matrix == null) dic.put(PdfName.MATRIX, IDENTITYMATRIX); else dic.put(PdfName.MATRIX, matrix); dic.put(PdfName.FORMTYPE, ONE); PRStream stream; if (bout == null) { stream = new PRStream((PRStream)contents, dic); } else { stream = new PRStream(reader, bout, compressionLevel); stream.putAll(dic); } return stream; }
java
PdfStream getFormXObject(int pageNumber, int compressionLevel) throws IOException { PdfDictionary page = reader.getPageNRelease(pageNumber); PdfObject contents = PdfReader.getPdfObjectRelease(page.get(PdfName.CONTENTS)); PdfDictionary dic = new PdfDictionary(); byte bout[] = null; if (contents != null) { if (contents.isStream()) dic.putAll((PRStream)contents); else bout = reader.getPageContent(pageNumber, file); } else bout = new byte[0]; dic.put(PdfName.RESOURCES, PdfReader.getPdfObjectRelease(page.get(PdfName.RESOURCES))); dic.put(PdfName.TYPE, PdfName.XOBJECT); dic.put(PdfName.SUBTYPE, PdfName.FORM); PdfImportedPage impPage = (PdfImportedPage)importedPages.get(Integer.valueOf(pageNumber)); dic.put(PdfName.BBOX, new PdfRectangle(impPage.getBoundingBox())); PdfArray matrix = impPage.getMatrix(); if (matrix == null) dic.put(PdfName.MATRIX, IDENTITYMATRIX); else dic.put(PdfName.MATRIX, matrix); dic.put(PdfName.FORMTYPE, ONE); PRStream stream; if (bout == null) { stream = new PRStream((PRStream)contents, dic); } else { stream = new PRStream(reader, bout, compressionLevel); stream.putAll(dic); } return stream; }
[ "PdfStream", "getFormXObject", "(", "int", "pageNumber", ",", "int", "compressionLevel", ")", "throws", "IOException", "{", "PdfDictionary", "page", "=", "reader", ".", "getPageNRelease", "(", "pageNumber", ")", ";", "PdfObject", "contents", "=", "PdfReader", ".",...
Gets the content stream of a page as a PdfStream object. @param pageNumber the page of which you want the stream @param compressionLevel the compression level you want to apply to the stream @return a PdfStream object @since 2.1.3 (the method already existed without param compressionLevel)
[ "Gets", "the", "content", "stream", "of", "a", "page", "as", "a", "PdfStream", "object", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfReaderInstance.java#L120-L153
alkacon/opencms-core
src/org/opencms/util/CmsXsltUtil.java
CmsXsltUtil.transformXmlContent
public static String transformXmlContent(CmsObject cms, String xsltFile, String xmlContent) throws CmsException, CmsXmlException { // JAXP reads data Source xmlSource = new StreamSource(new StringReader(xmlContent)); String xsltString = new String(cms.readFile(xsltFile).getContents()); Source xsltSource = new StreamSource(new StringReader(xsltString)); String result = null; try { TransformerFactory transFact = TransformerFactory.newInstance(); Transformer trans = transFact.newTransformer(xsltSource); StringWriter writer = new StringWriter(); trans.transform(xmlSource, new StreamResult(writer)); result = writer.toString(); } catch (Exception exc) { throw new CmsXmlException(Messages.get().container(Messages.ERR_CSV_XML_TRANSFORMATION_FAILED_0)); } // cut of the prefacing declaration '<?xml version="1.0" encoding="UTF-8"?>' if (result.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")) { return result.substring(38); } else { return result; } }
java
public static String transformXmlContent(CmsObject cms, String xsltFile, String xmlContent) throws CmsException, CmsXmlException { // JAXP reads data Source xmlSource = new StreamSource(new StringReader(xmlContent)); String xsltString = new String(cms.readFile(xsltFile).getContents()); Source xsltSource = new StreamSource(new StringReader(xsltString)); String result = null; try { TransformerFactory transFact = TransformerFactory.newInstance(); Transformer trans = transFact.newTransformer(xsltSource); StringWriter writer = new StringWriter(); trans.transform(xmlSource, new StreamResult(writer)); result = writer.toString(); } catch (Exception exc) { throw new CmsXmlException(Messages.get().container(Messages.ERR_CSV_XML_TRANSFORMATION_FAILED_0)); } // cut of the prefacing declaration '<?xml version="1.0" encoding="UTF-8"?>' if (result.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")) { return result.substring(38); } else { return result; } }
[ "public", "static", "String", "transformXmlContent", "(", "CmsObject", "cms", ",", "String", "xsltFile", ",", "String", "xmlContent", ")", "throws", "CmsException", ",", "CmsXmlException", "{", "// JAXP reads data", "Source", "xmlSource", "=", "new", "StreamSource", ...
Applies a XSLT Transformation to the content.<p> The method does not use DOM4J, because iso-8859-1 code ist not transformed correctly. @param cms the cms object @param xsltFile the XSLT transformation file @param xmlContent the XML content to transform @return the transformed xml @throws CmsXmlException if something goes wrong @throws CmsException if something goes wrong
[ "Applies", "a", "XSLT", "Transformation", "to", "the", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsXsltUtil.java#L145-L171
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java
CommitLogSegment.markClean
public synchronized void markClean(UUID cfId, ReplayPosition context) { if (!cfDirty.containsKey(cfId)) return; if (context.segment == id) markClean(cfId, context.position); else if (context.segment > id) markClean(cfId, Integer.MAX_VALUE); }
java
public synchronized void markClean(UUID cfId, ReplayPosition context) { if (!cfDirty.containsKey(cfId)) return; if (context.segment == id) markClean(cfId, context.position); else if (context.segment > id) markClean(cfId, Integer.MAX_VALUE); }
[ "public", "synchronized", "void", "markClean", "(", "UUID", "cfId", ",", "ReplayPosition", "context", ")", "{", "if", "(", "!", "cfDirty", ".", "containsKey", "(", "cfId", ")", ")", "return", ";", "if", "(", "context", ".", "segment", "==", "id", ")", ...
Marks the ColumnFamily specified by cfId as clean for this log segment. If the given context argument is contained in this file, it will only mark the CF as clean if no newer writes have taken place. @param cfId the column family ID that is now clean @param context the optional clean offset
[ "Marks", "the", "ColumnFamily", "specified", "by", "cfId", "as", "clean", "for", "this", "log", "segment", ".", "If", "the", "given", "context", "argument", "is", "contained", "in", "this", "file", "it", "will", "only", "mark", "the", "CF", "as", "clean", ...
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegment.java#L455-L463
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java
TermOfUsePanel.newCopyrightPanel
protected Component newCopyrightPanel(final String id, final IModel<HeaderContentListModelBean> model) { return new CopyrightPanel(id, Model.of(model.getObject())); }
java
protected Component newCopyrightPanel(final String id, final IModel<HeaderContentListModelBean> model) { return new CopyrightPanel(id, Model.of(model.getObject())); }
[ "protected", "Component", "newCopyrightPanel", "(", "final", "String", "id", ",", "final", "IModel", "<", "HeaderContentListModelBean", ">", "model", ")", "{", "return", "new", "CopyrightPanel", "(", "id", ",", "Model", ".", "of", "(", "model", ".", "getObject...
Factory method for creating the new {@link Component} for the copyright. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the copyright. @param id the id @param model the model @return the new {@link Component} for the copyright
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "Component", "}", "for", "the", "copyright", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", ...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L208-L212
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.changeLock
public void changeLock(CmsRequestContext context, CmsResource resource) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); checkOfflineProject(dbc); try { m_driverManager.changeLock(dbc, resource, CmsLockType.EXCLUSIVE); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_CHANGE_LOCK_OF_RESOURCE_2, context.getSitePath(resource), " - " + e.getMessage()), e); } finally { dbc.clear(); } }
java
public void changeLock(CmsRequestContext context, CmsResource resource) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); checkOfflineProject(dbc); try { m_driverManager.changeLock(dbc, resource, CmsLockType.EXCLUSIVE); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_CHANGE_LOCK_OF_RESOURCE_2, context.getSitePath(resource), " - " + e.getMessage()), e); } finally { dbc.clear(); } }
[ "public", "void", "changeLock", "(", "CmsRequestContext", "context", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "checkOfflineProject", "(", "dbc...
Changes the lock of a resource to the current user, that is "steals" the lock from another user.<p> @param context the current request context @param resource the resource to change the lock for @throws CmsException if something goes wrong @see org.opencms.file.types.I_CmsResourceType#changeLock(CmsObject, CmsSecurityManager, CmsResource)
[ "Changes", "the", "lock", "of", "a", "resource", "to", "the", "current", "user", "that", "is", "steals", "the", "lock", "from", "another", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L307-L324
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/extensions/TaskMonitor.java
TaskMonitor.build
public static TaskMonitor build(IntVar start, IntVar duration, IntVar end) { return new TaskMonitor(start, duration, end); }
java
public static TaskMonitor build(IntVar start, IntVar duration, IntVar end) { return new TaskMonitor(start, duration, end); }
[ "public", "static", "TaskMonitor", "build", "(", "IntVar", "start", ",", "IntVar", "duration", ",", "IntVar", "end", ")", "{", "return", "new", "TaskMonitor", "(", "start", ",", "duration", ",", "end", ")", ";", "}" ]
Make a new Monitor @param start the task start moment @param duration the task duration @param end the task end @return the resulting task.
[ "Make", "a", "new", "Monitor" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/TaskMonitor.java#L65-L67
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java
PublicIPPrefixesInner.beginUpdateTagsAsync
public Observable<PublicIPPrefixInner> beginUpdateTagsAsync(String resourceGroupName, String publicIpPrefixName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() { @Override public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) { return response.body(); } }); }
java
public Observable<PublicIPPrefixInner> beginUpdateTagsAsync(String resourceGroupName, String publicIpPrefixName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() { @Override public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PublicIPPrefixInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "publicIpPrefixName", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "publicIpPrefixName", ")", ...
Updates public IP prefix tags. @param resourceGroupName The name of the resource group. @param publicIpPrefixName The name of the public IP prefix. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PublicIPPrefixInner object
[ "Updates", "public", "IP", "prefix", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java#L779-L786
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_Drape.java
ST_Drape.drapeLineString
public static Geometry drapeLineString(LineString line, Geometry triangles, STRtree sTRtree) { GeometryFactory factory = line.getFactory(); //Split the triangles in lines to perform all intersections Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true); Geometry diffExt = lineMerge(line.difference(triangleLines), factory); CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree); diffExt.apply(drapeFilter); return diffExt; }
java
public static Geometry drapeLineString(LineString line, Geometry triangles, STRtree sTRtree) { GeometryFactory factory = line.getFactory(); //Split the triangles in lines to perform all intersections Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true); Geometry diffExt = lineMerge(line.difference(triangleLines), factory); CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree); diffExt.apply(drapeFilter); return diffExt; }
[ "public", "static", "Geometry", "drapeLineString", "(", "LineString", "line", ",", "Geometry", "triangles", ",", "STRtree", "sTRtree", ")", "{", "GeometryFactory", "factory", "=", "line", ".", "getFactory", "(", ")", ";", "//Split the triangles in lines to perform all...
Drape a linestring to a set of triangles @param line @param triangles @param sTRtree @return
[ "Drape", "a", "linestring", "to", "a", "set", "of", "triangles" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_Drape.java#L150-L158
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/util/UrlEncoded.java
UrlEncoded.decodeString
public static String decodeString(String encoded) { return decodeString(encoded,0,encoded.length(),StringUtil.__ISO_8859_1); }
java
public static String decodeString(String encoded) { return decodeString(encoded,0,encoded.length(),StringUtil.__ISO_8859_1); }
[ "public", "static", "String", "decodeString", "(", "String", "encoded", ")", "{", "return", "decodeString", "(", "encoded", ",", "0", ",", "encoded", ".", "length", "(", ")", ",", "StringUtil", ".", "__ISO_8859_1", ")", ";", "}" ]
Decode String with % encoding. This method makes the assumption that the majority of calls will need no decoding and uses the 8859 encoding.
[ "Decode", "String", "with", "%", "encoding", ".", "This", "method", "makes", "the", "assumption", "that", "the", "majority", "of", "calls", "will", "need", "no", "decoding", "and", "uses", "the", "8859", "encoding", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/UrlEncoded.java#L311-L314
apache/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java
StatementExecutor.executeQuery
public List<QueryResult> executeQuery() throws SQLException { final boolean isExceptionThrown = ExecutorExceptionHandler.isExceptionThrown(); SQLExecuteCallback<QueryResult> executeCallback = new SQLExecuteCallback<QueryResult>(getDatabaseType(), isExceptionThrown) { @Override protected QueryResult executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException { return getQueryResult(routeUnit, statement, connectionMode); } }; return executeCallback(executeCallback); }
java
public List<QueryResult> executeQuery() throws SQLException { final boolean isExceptionThrown = ExecutorExceptionHandler.isExceptionThrown(); SQLExecuteCallback<QueryResult> executeCallback = new SQLExecuteCallback<QueryResult>(getDatabaseType(), isExceptionThrown) { @Override protected QueryResult executeSQL(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException { return getQueryResult(routeUnit, statement, connectionMode); } }; return executeCallback(executeCallback); }
[ "public", "List", "<", "QueryResult", ">", "executeQuery", "(", ")", "throws", "SQLException", "{", "final", "boolean", "isExceptionThrown", "=", "ExecutorExceptionHandler", ".", "isExceptionThrown", "(", ")", ";", "SQLExecuteCallback", "<", "QueryResult", ">", "exe...
Execute query. @return result set list @throws SQLException SQL exception
[ "Execute", "query", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java#L90-L100
james-hu/jabb-core
src/main/java/net/sf/jabb/util/text/word/Dictionary.java
Dictionary.addWord
public void addWord(Word newWord, boolean makeCopy){ synchronized(words){ Word existingWord = words.get(newWord.getWord()); if (existingWord != null){ existingWord.setType(newWord.getTypes()); existingWord.setKeywordAttachment(newWord.getKeywordAttachment()); }else{ if (makeCopy){ newWord = new Word(newWord); } words.put(newWord.getWord(), newWord); } } }
java
public void addWord(Word newWord, boolean makeCopy){ synchronized(words){ Word existingWord = words.get(newWord.getWord()); if (existingWord != null){ existingWord.setType(newWord.getTypes()); existingWord.setKeywordAttachment(newWord.getKeywordAttachment()); }else{ if (makeCopy){ newWord = new Word(newWord); } words.put(newWord.getWord(), newWord); } } }
[ "public", "void", "addWord", "(", "Word", "newWord", ",", "boolean", "makeCopy", ")", "{", "synchronized", "(", "words", ")", "{", "Word", "existingWord", "=", "words", ".", "get", "(", "newWord", ".", "getWord", "(", ")", ")", ";", "if", "(", "existin...
加入一个新词条,如果这个词条在词典中已经存在,则合并。 <p> Add a new word, if this word already exists in the dictionary then the new definition will be merged into existing one. @param newWord @param makeCopy 是否复制词条对象,而非引用 <br>Whether or not to copy the Word object, rather than to refer it.
[ "加入一个新词条,如果这个词条在词典中已经存在,则合并。", "<p", ">", "Add", "a", "new", "word", "if", "this", "word", "already", "exists", "in", "the", "dictionary", "then", "the", "new", "definition", "will", "be", "merged", "into", "existing", "one", "." ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/text/word/Dictionary.java#L79-L92
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper.hasSideEffects
protected Boolean hasSideEffects(XExpression expr, ISideEffectContext context) { if (expr != null && !expr.eIsProxy()) { return this.hasSideEffectsDispatcher.invoke(expr, context); } return false; }
java
protected Boolean hasSideEffects(XExpression expr, ISideEffectContext context) { if (expr != null && !expr.eIsProxy()) { return this.hasSideEffectsDispatcher.invoke(expr, context); } return false; }
[ "protected", "Boolean", "hasSideEffects", "(", "XExpression", "expr", ",", "ISideEffectContext", "context", ")", "{", "if", "(", "expr", "!=", "null", "&&", "!", "expr", ".", "eIsProxy", "(", ")", ")", "{", "return", "this", ".", "hasSideEffectsDispatcher", ...
Determine if the given expression has a side effect. @param expr the expression. @param context the context. @return {@code true} if the expression has a side effect.
[ "Determine", "if", "the", "given", "expression", "has", "a", "side", "effect", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L251-L256
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.insertionSort
public static <T extends Comparable<? super T>> void insertionSort( T[] arr, int start, int end ) { int i; for ( int j = start + 1; j <= end; j++ ) { T tmp = arr[j]; for ( i = j; i > start && tmp.compareTo( arr[i - 1] ) < 0; i-- ) { arr[ i ] = arr[ i - 1 ]; } if ( i < j ) arr[ i ] = tmp; } }
java
public static <T extends Comparable<? super T>> void insertionSort( T[] arr, int start, int end ) { int i; for ( int j = start + 1; j <= end; j++ ) { T tmp = arr[j]; for ( i = j; i > start && tmp.compareTo( arr[i - 1] ) < 0; i-- ) { arr[ i ] = arr[ i - 1 ]; } if ( i < j ) arr[ i ] = tmp; } }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "insertionSort", "(", "T", "[", "]", "arr", ",", "int", "start", ",", "int", "end", ")", "{", "int", "i", ";", "for", "(", "int", "j", "=", "start", ...
method to sort an subarray from start to end with insertion sort algorithm @param arr an array of Comparable items @param start the begining position @param end the end position
[ "method", "to", "sort", "an", "subarray", "from", "start", "to", "end", "with", "insertion", "sort", "algorithm" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L246-L257
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.pointAtLight
public boolean pointAtLight(float x, float y) { for (Light light : lightList) { if (light.contains(x, y)) return true; } return false; }
java
public boolean pointAtLight(float x, float y) { for (Light light : lightList) { if (light.contains(x, y)) return true; } return false; }
[ "public", "boolean", "pointAtLight", "(", "float", "x", ",", "float", "y", ")", "{", "for", "(", "Light", "light", ":", "lightList", ")", "{", "if", "(", "light", ".", "contains", "(", "x", ",", "y", ")", ")", "return", "true", ";", "}", "return", ...
Checks whether the given point is inside of any light volume @return true if point is inside of any light volume
[ "Checks", "whether", "the", "given", "point", "is", "inside", "of", "any", "light", "volume" ]
train
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L400-L405
morimekta/utils
io-util/src/main/java/net/morimekta/util/FileWatcher.java
FileWatcher.addWatcher
@Deprecated public void addWatcher(File file, Watcher watcher) { addWatcher(file.toPath(), watcher); }
java
@Deprecated public void addWatcher(File file, Watcher watcher) { addWatcher(file.toPath(), watcher); }
[ "@", "Deprecated", "public", "void", "addWatcher", "(", "File", "file", ",", "Watcher", "watcher", ")", "{", "addWatcher", "(", "file", ".", "toPath", "(", ")", ",", "watcher", ")", ";", "}" ]
Start watching file path and notify watcher for updates on that file. @param file The file path to watch. @param watcher The watcher to be notified. @deprecated Use {@link #addWatcher(Path, Listener)}
[ "Start", "watching", "file", "path", "and", "notify", "watcher", "for", "updates", "on", "that", "file", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/FileWatcher.java#L164-L167
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_role_roleId_member_POST
public OvhOperation serviceName_role_roleId_member_POST(String serviceName, String roleId, String note, String username) throws IOException { String qPath = "/dbaas/logs/{serviceName}/role/{roleId}/member"; StringBuilder sb = path(qPath, serviceName, roleId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "note", note); addBody(o, "username", username); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation serviceName_role_roleId_member_POST(String serviceName, String roleId, String note, String username) throws IOException { String qPath = "/dbaas/logs/{serviceName}/role/{roleId}/member"; StringBuilder sb = path(qPath, serviceName, roleId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "note", note); addBody(o, "username", username); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "serviceName_role_roleId_member_POST", "(", "String", "serviceName", ",", "String", "roleId", ",", "String", "note", ",", "String", "username", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/role/{roleId}/...
Append user into the member list of specified role REST: POST /dbaas/logs/{serviceName}/role/{roleId}/member @param serviceName [required] Service name @param roleId [required] Role ID @param username [required] Username @param note [required] Custom note
[ "Append", "user", "into", "the", "member", "list", "of", "specified", "role" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L897-L905
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java
DataMaskingPoliciesInner.createOrUpdateAsync
public Observable<DataMaskingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DataMaskingPolicyInner>, DataMaskingPolicyInner>() { @Override public DataMaskingPolicyInner call(ServiceResponse<DataMaskingPolicyInner> response) { return response.body(); } }); }
java
public Observable<DataMaskingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DataMaskingPolicyInner>, DataMaskingPolicyInner>() { @Override public DataMaskingPolicyInner call(ServiceResponse<DataMaskingPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataMaskingPolicyInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "DataMaskingPolicyInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResp...
Creates or updates a database data masking policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @param parameters Parameters for creating or updating a data masking policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataMaskingPolicyInner object
[ "Creates", "or", "updates", "a", "database", "data", "masking", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java#L108-L115
alkacon/opencms-core
src/org/opencms/gwt/CmsCoreService.java
CmsCoreService.internalGetLinkForReturnCode
public static CmsReturnLinkInfo internalGetLinkForReturnCode(CmsObject cms, String returnCode) throws CmsException { if (CmsUUID.isValidUUID(returnCode)) { try { CmsResource pageRes = cms.readResource(new CmsUUID(returnCode), CmsResourceFilter.IGNORE_EXPIRATION); return new CmsReturnLinkInfo( OpenCms.getLinkManager().substituteLink(cms, pageRes), CmsReturnLinkInfo.Status.ok); } catch (CmsVfsResourceNotFoundException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound); } } else { int colonIndex = returnCode.indexOf(':'); if (colonIndex >= 0) { String before = returnCode.substring(0, colonIndex); String after = returnCode.substring(colonIndex + 1); if (CmsUUID.isValidUUID(before) && CmsUUID.isValidUUID(after)) { try { CmsUUID pageId = new CmsUUID(before); CmsUUID detailId = new CmsUUID(after); CmsResource pageRes = cms.readResource(pageId); CmsResource folder = pageRes.isFolder() ? pageRes : cms.readParentFolder(pageRes.getStructureId()); String pageLink = OpenCms.getLinkManager().substituteLink(cms, folder); CmsResource detailRes = cms.readResource(detailId); String detailName = cms.getDetailName( detailRes, cms.getRequestContext().getLocale(), OpenCms.getLocaleManager().getDefaultLocales()); String link = CmsFileUtil.removeTrailingSeparator(pageLink) + "/" + detailName; return new CmsReturnLinkInfo(link, CmsReturnLinkInfo.Status.ok); } catch (CmsVfsResourceNotFoundException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound); } } } throw new IllegalArgumentException("return code has wrong format"); } }
java
public static CmsReturnLinkInfo internalGetLinkForReturnCode(CmsObject cms, String returnCode) throws CmsException { if (CmsUUID.isValidUUID(returnCode)) { try { CmsResource pageRes = cms.readResource(new CmsUUID(returnCode), CmsResourceFilter.IGNORE_EXPIRATION); return new CmsReturnLinkInfo( OpenCms.getLinkManager().substituteLink(cms, pageRes), CmsReturnLinkInfo.Status.ok); } catch (CmsVfsResourceNotFoundException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound); } } else { int colonIndex = returnCode.indexOf(':'); if (colonIndex >= 0) { String before = returnCode.substring(0, colonIndex); String after = returnCode.substring(colonIndex + 1); if (CmsUUID.isValidUUID(before) && CmsUUID.isValidUUID(after)) { try { CmsUUID pageId = new CmsUUID(before); CmsUUID detailId = new CmsUUID(after); CmsResource pageRes = cms.readResource(pageId); CmsResource folder = pageRes.isFolder() ? pageRes : cms.readParentFolder(pageRes.getStructureId()); String pageLink = OpenCms.getLinkManager().substituteLink(cms, folder); CmsResource detailRes = cms.readResource(detailId); String detailName = cms.getDetailName( detailRes, cms.getRequestContext().getLocale(), OpenCms.getLocaleManager().getDefaultLocales()); String link = CmsFileUtil.removeTrailingSeparator(pageLink) + "/" + detailName; return new CmsReturnLinkInfo(link, CmsReturnLinkInfo.Status.ok); } catch (CmsVfsResourceNotFoundException e) { LOG.debug(e.getLocalizedMessage(), e); return new CmsReturnLinkInfo(null, CmsReturnLinkInfo.Status.notfound); } } } throw new IllegalArgumentException("return code has wrong format"); } }
[ "public", "static", "CmsReturnLinkInfo", "internalGetLinkForReturnCode", "(", "CmsObject", "cms", ",", "String", "returnCode", ")", "throws", "CmsException", "{", "if", "(", "CmsUUID", ".", "isValidUUID", "(", "returnCode", ")", ")", "{", "try", "{", "CmsResource"...
Implementation method for getting the link for a given return code.<p> @param cms the CMS context @param returnCode the return code @return the link for the return code @throws CmsException if something goes wrong
[ "Implementation", "method", "for", "getting", "the", "link", "for", "a", "given", "return", "code", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsCoreService.java#L568-L611
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java
SSLChannelProvider.updatedSslSupport
protected void updatedSslSupport(SSLSupport service, Map<String, Object> props) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "updatedSslSupport", props); } sslSupport = service; // If the default pid has changed.. we need to go hunting for who was using the default. String id = (String) props.get(SSL_CFG_REF); if (!defaultId.equals(id)) { for (SSLChannelOptions options : sslOptions.values()) { options.updateRefId(id); options.updateRegistration(bContext, sslConfigs); } defaultId = id; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "updatedSslSupport", "defaultConfigId=" + defaultId); } }
java
protected void updatedSslSupport(SSLSupport service, Map<String, Object> props) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "updatedSslSupport", props); } sslSupport = service; // If the default pid has changed.. we need to go hunting for who was using the default. String id = (String) props.get(SSL_CFG_REF); if (!defaultId.equals(id)) { for (SSLChannelOptions options : sslOptions.values()) { options.updateRefId(id); options.updateRegistration(bContext, sslConfigs); } defaultId = id; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "updatedSslSupport", "defaultConfigId=" + defaultId); } }
[ "protected", "void", "updatedSslSupport", "(", "SSLSupport", "service", ",", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "...
This is called if the service is updated. @param ref reference to the service
[ "This", "is", "called", "if", "the", "service", "is", "updated", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelProvider.java#L216-L235
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java
Signature.getInstance
public static Signature getInstance(String algorithm) throws NoSuchAlgorithmException { List<Service> list; if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) { list = GetInstance.getServices(rsaIds); } else { list = GetInstance.getServices("Signature", algorithm); } Iterator<Service> t = list.iterator(); if (t.hasNext() == false) { throw new NoSuchAlgorithmException (algorithm + " Signature not available"); } // try services until we find an Spi or a working Signature subclass NoSuchAlgorithmException failure; do { Service s = t.next(); if (isSpi(s)) { return new Delegate(algorithm); } else { // must be a subclass of Signature, disable dynamic selection try { Instance instance = GetInstance.getInstance(s, SignatureSpi.class); return getInstance(instance, algorithm); } catch (NoSuchAlgorithmException e) { failure = e; } } } while (t.hasNext()); throw failure; }
java
public static Signature getInstance(String algorithm) throws NoSuchAlgorithmException { List<Service> list; if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) { list = GetInstance.getServices(rsaIds); } else { list = GetInstance.getServices("Signature", algorithm); } Iterator<Service> t = list.iterator(); if (t.hasNext() == false) { throw new NoSuchAlgorithmException (algorithm + " Signature not available"); } // try services until we find an Spi or a working Signature subclass NoSuchAlgorithmException failure; do { Service s = t.next(); if (isSpi(s)) { return new Delegate(algorithm); } else { // must be a subclass of Signature, disable dynamic selection try { Instance instance = GetInstance.getInstance(s, SignatureSpi.class); return getInstance(instance, algorithm); } catch (NoSuchAlgorithmException e) { failure = e; } } } while (t.hasNext()); throw failure; }
[ "public", "static", "Signature", "getInstance", "(", "String", "algorithm", ")", "throws", "NoSuchAlgorithmException", "{", "List", "<", "Service", ">", "list", ";", "if", "(", "algorithm", ".", "equalsIgnoreCase", "(", "RSA_SIGNATURE", ")", ")", "{", "list", ...
Returns a Signature object that implements the specified signature algorithm. <p> This method traverses the list of registered security Providers, starting with the most preferred Provider. A new Signature object encapsulating the SignatureSpi implementation from the first Provider that supports the specified algorithm is returned. <p> Note that the list of registered providers may be retrieved via the {@link Security#getProviders() Security.getProviders()} method. @param algorithm the standard name of the algorithm requested. See the Signature section in the <a href= "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Signature"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard algorithm names. @return the new Signature object. @exception NoSuchAlgorithmException if no Provider supports a Signature implementation for the specified algorithm. @see Provider
[ "Returns", "a", "Signature", "object", "that", "implements", "the", "specified", "signature", "algorithm", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L353-L384
att/AAF
cadi/core/src/main/java/com/att/cadi/Symm.java
Symm.depass
public long depass(final String password, final OutputStream os) throws IOException { int offset = password.startsWith(ENC)?4:0; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ByteArrayInputStream bais = new ByteArrayInputStream(password.getBytes(),offset,password.length()-offset); exec(new AESExec() { @Override public void exec(AES aes) throws IOException { CipherOutputStream cos = aes.outputStream(baos, false); decode(bais,cos); cos.close(); // flush } }); byte[] bytes = baos.toByteArray(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bytes)); long time; if(this.getClass().getSimpleName().startsWith("base64")) { // don't expose randomization os.write(bytes); time = 0L; } else { int start=0; for(int i=0;i<3;++i) { start+=Math.abs(dis.readByte()); } start%=0x7; for(int i=0;i<start;++i) { dis.readByte(); } time = (dis.readInt() & 0xFFFF)|(System.currentTimeMillis()&0xFFFF0000); int minlength = dis.readByte(); if(minlength<0x9){ DataOutputStream dos = new DataOutputStream(os); for(int i=0;i<minlength;++i) { dis.readByte(); dos.writeByte(dis.readByte()); } } else { int pre =((Byte.SIZE*3+Integer.SIZE+Byte.SIZE)/Byte.SIZE)+start; os.write(bytes, pre, bytes.length-pre); } } return time; }
java
public long depass(final String password, final OutputStream os) throws IOException { int offset = password.startsWith(ENC)?4:0; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ByteArrayInputStream bais = new ByteArrayInputStream(password.getBytes(),offset,password.length()-offset); exec(new AESExec() { @Override public void exec(AES aes) throws IOException { CipherOutputStream cos = aes.outputStream(baos, false); decode(bais,cos); cos.close(); // flush } }); byte[] bytes = baos.toByteArray(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bytes)); long time; if(this.getClass().getSimpleName().startsWith("base64")) { // don't expose randomization os.write(bytes); time = 0L; } else { int start=0; for(int i=0;i<3;++i) { start+=Math.abs(dis.readByte()); } start%=0x7; for(int i=0;i<start;++i) { dis.readByte(); } time = (dis.readInt() & 0xFFFF)|(System.currentTimeMillis()&0xFFFF0000); int minlength = dis.readByte(); if(minlength<0x9){ DataOutputStream dos = new DataOutputStream(os); for(int i=0;i<minlength;++i) { dis.readByte(); dos.writeByte(dis.readByte()); } } else { int pre =((Byte.SIZE*3+Integer.SIZE+Byte.SIZE)/Byte.SIZE)+start; os.write(bytes, pre, bytes.length-pre); } } return time; }
[ "public", "long", "depass", "(", "final", "String", "password", ",", "final", "OutputStream", "os", ")", "throws", "IOException", "{", "int", "offset", "=", "password", ".", "startsWith", "(", "ENC", ")", "?", "4", ":", "0", ";", "final", "ByteArrayOutputS...
Decrypt a password Skip Symm.ENC @param password @param os @return @throws IOException
[ "Decrypt", "a", "password" ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Symm.java#L682-L723
opengeospatial/teamengine
teamengine-core/src/main/java/com/occamlab/te/Engine.java
Engine.preload
public void preload(Index index, String sourcesName) throws Exception { for (String key : index.getTestKeys()) { TestEntry te = index.getTest(key); loadExecutable(te, sourcesName); } for (String key : index.getFunctionKeys()) { List<FunctionEntry> functions = index.getFunctions(key); for (FunctionEntry fe : functions) { if (!fe.isJava()) { loadExecutable(fe, sourcesName); } } } }
java
public void preload(Index index, String sourcesName) throws Exception { for (String key : index.getTestKeys()) { TestEntry te = index.getTest(key); loadExecutable(te, sourcesName); } for (String key : index.getFunctionKeys()) { List<FunctionEntry> functions = index.getFunctions(key); for (FunctionEntry fe : functions) { if (!fe.isJava()) { loadExecutable(fe, sourcesName); } } } }
[ "public", "void", "preload", "(", "Index", "index", ",", "String", "sourcesName", ")", "throws", "Exception", "{", "for", "(", "String", "key", ":", "index", ".", "getTestKeys", "(", ")", ")", "{", "TestEntry", "te", "=", "index", ".", "getTest", "(", ...
Loads all of the XSL executables. This is a time consuming operation. @param index @param sourcesName A stylesheet reference. @throws Exception If the stylesheet fail to compile.
[ "Loads", "all", "of", "the", "XSL", "executables", ".", "This", "is", "a", "time", "consuming", "operation", "." ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/Engine.java#L136-L149
ganglia/jmxetric
src/main/java/info/ganglia/jmxetric/GangliaXmlConfigurationService.java
GangliaXmlConfigurationService.getGangliaConfig
private String getGangliaConfig(String cmdLine, Node ganglia, String attributeName, String defaultValue) { if (cmdLine == null) { return selectParameterFromNode(ganglia, attributeName, defaultValue); } else { return cmdLine; } }
java
private String getGangliaConfig(String cmdLine, Node ganglia, String attributeName, String defaultValue) { if (cmdLine == null) { return selectParameterFromNode(ganglia, attributeName, defaultValue); } else { return cmdLine; } }
[ "private", "String", "getGangliaConfig", "(", "String", "cmdLine", ",", "Node", "ganglia", ",", "String", "attributeName", ",", "String", "defaultValue", ")", "{", "if", "(", "cmdLine", "==", "null", ")", "{", "return", "selectParameterFromNode", "(", "ganglia",...
Gets a configuration parameter for Ganglia. First checks if it was given on the command line arguments. If it is not available, it looks for the value in the XML node. @param cmdLine command line value for this attribute @param ganglia the XML node @param attributeName name of the attribute @param defaultValue default value if this attribute cannot be found @return the string value of the specified attribute
[ "Gets", "a", "configuration", "parameter", "for", "Ganglia", ".", "First", "checks", "if", "it", "was", "given", "on", "the", "command", "line", "arguments", ".", "If", "it", "is", "not", "available", "it", "looks", "for", "the", "value", "in", "the", "X...
train
https://github.com/ganglia/jmxetric/blob/0b21edb9bd75e0b2df8370ad1c77a1ea47f502ca/src/main/java/info/ganglia/jmxetric/GangliaXmlConfigurationService.java#L178-L185
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getExploded
@Nonnull @ReturnsMutableCopy public static ICommonsList <String> getExploded (final char cSep, @Nullable final String sElements) { return getExploded (cSep, sElements, -1); }
java
@Nonnull @ReturnsMutableCopy public static ICommonsList <String> getExploded (final char cSep, @Nullable final String sElements) { return getExploded (cSep, sElements, -1); }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "static", "ICommonsList", "<", "String", ">", "getExploded", "(", "final", "char", "cSep", ",", "@", "Nullable", "final", "String", "sElements", ")", "{", "return", "getExploded", "(", "cSep", ",", "sElement...
Take a concatenated String and return a {@link ICommonsList} of all elements in the passed string, using specified separator string. @param cSep The separator character to use. @param sElements The concatenated String to convert. May be <code>null</code> or empty. @return The {@link ICommonsList} represented by the passed string. Never <code>null</code>. If the passed input string is <code>null</code> or "" an empty list is returned.
[ "Take", "a", "concatenated", "String", "and", "return", "a", "{", "@link", "ICommonsList", "}", "of", "all", "elements", "in", "the", "passed", "string", "using", "specified", "separator", "string", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2083-L2088
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/report/db/EmoTableAllTablesReportDAO.java
EmoTableAllTablesReportDAO.convertToTableReportEntry
@Nullable private TableReportEntry convertToTableReportEntry(Map<String, Object> map, Predicate<String> placementFilter, Predicate<Boolean> droppedFilter, Predicate<Boolean> facadeFilter) { if (Intrinsic.isDeleted(map)) { return null; } final String tableName = Intrinsic.getId(map); List<TableReportEntryTable> tables = Lists.newArrayListWithExpectedSize(map.size()); for (Map.Entry<String, Object> entry : toMap(map.get("tables")).entrySet()) { TableReportEntryTable entryTable = convertToTableReportEntryTable(entry.getKey(), toMap(entry.getValue()), placementFilter, droppedFilter, facadeFilter); if (entryTable != null) { tables.add(entryTable); } } // If all tables were filtered then return null if (tables.isEmpty()) { return null; } return new TableReportEntry(tableName, tables); }
java
@Nullable private TableReportEntry convertToTableReportEntry(Map<String, Object> map, Predicate<String> placementFilter, Predicate<Boolean> droppedFilter, Predicate<Boolean> facadeFilter) { if (Intrinsic.isDeleted(map)) { return null; } final String tableName = Intrinsic.getId(map); List<TableReportEntryTable> tables = Lists.newArrayListWithExpectedSize(map.size()); for (Map.Entry<String, Object> entry : toMap(map.get("tables")).entrySet()) { TableReportEntryTable entryTable = convertToTableReportEntryTable(entry.getKey(), toMap(entry.getValue()), placementFilter, droppedFilter, facadeFilter); if (entryTable != null) { tables.add(entryTable); } } // If all tables were filtered then return null if (tables.isEmpty()) { return null; } return new TableReportEntry(tableName, tables); }
[ "@", "Nullable", "private", "TableReportEntry", "convertToTableReportEntry", "(", "Map", "<", "String", ",", "Object", ">", "map", ",", "Predicate", "<", "String", ">", "placementFilter", ",", "Predicate", "<", "Boolean", ">", "droppedFilter", ",", "Predicate", ...
Accepts a row from the table report and returns it converted into a TableReportEntry. If the row is deleted or if it doesn't match all of the configured filters then null is returned.
[ "Accepts", "a", "row", "from", "the", "table", "report", "and", "returns", "it", "converted", "into", "a", "TableReportEntry", ".", "If", "the", "row", "is", "deleted", "or", "if", "it", "doesn", "t", "match", "all", "of", "the", "configured", "filters", ...
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/report/db/EmoTableAllTablesReportDAO.java#L306-L332
structurizr/java
structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java
DocumentationTemplate.addSection
public Section addSection(Container container, String title, Format format, String content) { return add(container, title, format, content); }
java
public Section addSection(Container container, String title, Format format, String content) { return add(container, title, format, content); }
[ "public", "Section", "addSection", "(", "Container", "container", ",", "String", "title", ",", "Format", "format", ",", "String", "content", ")", "{", "return", "add", "(", "container", ",", "title", ",", "format", ",", "content", ")", ";", "}" ]
Adds a section relating to a {@link Container}. @param container the {@link Container} the documentation content relates to @param title the section title @param format the {@link Format} of the documentation content @param content a String containing the documentation content @return a documentation {@link Section}
[ "Adds", "a", "section", "relating", "to", "a", "{", "@link", "Container", "}", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java#L113-L115
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyFinder.java
DependencyFinder.getArtifactFileFromPluginDependencies
public static File getArtifactFileFromPluginDependencies(AbstractWisdomMojo mojo, String artifactId, String type) { Preconditions.checkNotNull(mojo); Preconditions.checkNotNull(artifactId); Preconditions.checkNotNull(type); for (Artifact artifact : mojo.pluginDependencies) { if (artifact.getArtifactId().equals(artifactId) && artifact.getType().equals(type)) { return artifact.getFile(); } } return null; }
java
public static File getArtifactFileFromPluginDependencies(AbstractWisdomMojo mojo, String artifactId, String type) { Preconditions.checkNotNull(mojo); Preconditions.checkNotNull(artifactId); Preconditions.checkNotNull(type); for (Artifact artifact : mojo.pluginDependencies) { if (artifact.getArtifactId().equals(artifactId) && artifact.getType().equals(type)) { return artifact.getFile(); } } return null; }
[ "public", "static", "File", "getArtifactFileFromPluginDependencies", "(", "AbstractWisdomMojo", "mojo", ",", "String", "artifactId", ",", "String", "type", ")", "{", "Preconditions", ".", "checkNotNull", "(", "mojo", ")", ";", "Preconditions", ".", "checkNotNull", "...
Gets the file of the dependency with the given artifact id from the plugin dependencies (i.e. from the dependencies of the wisdom-maven-plugin itself, and not from the current 'under-build' project). @param mojo the mojo, cannot be {@code null} @param artifactId the name of the artifact to find, cannot be {@code null} @param type the extension of the artifact to find, should not be {@code null} @return the artifact file, {@code null} if not found
[ "Gets", "the", "file", "of", "the", "dependency", "with", "the", "given", "artifact", "id", "from", "the", "plugin", "dependencies", "(", "i", ".", "e", ".", "from", "the", "dependencies", "of", "the", "wisdom", "-", "maven", "-", "plugin", "itself", "an...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyFinder.java#L51-L63
rhuss/jolokia
agent/core/src/main/java/org/jolokia/converter/json/TabularDataExtractor.java
TabularDataExtractor.setObjectValue
public Object setObjectValue(StringToObjectConverter pConverter, Object pInner, String pAttribute, Object pValue) throws IllegalAccessException, InvocationTargetException { throw new IllegalArgumentException("TabularData cannot be written to"); }
java
public Object setObjectValue(StringToObjectConverter pConverter, Object pInner, String pAttribute, Object pValue) throws IllegalAccessException, InvocationTargetException { throw new IllegalArgumentException("TabularData cannot be written to"); }
[ "public", "Object", "setObjectValue", "(", "StringToObjectConverter", "pConverter", ",", "Object", "pInner", ",", "String", "pAttribute", ",", "Object", "pValue", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", "{", "throw", "new", "IllegalArg...
Throws always {@link IllegalArgumentException} since tabular data is immutable
[ "Throws", "always", "{" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/TabularDataExtractor.java#L334-L337
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java
MappedParametrizedObjectEntry.getParameterValue
public String getParameterValue(String name, String defaultValue) { String value = defaultValue; SimpleParameterEntry p = parameters.get(name); if (p != null) { value = p.getValue(); } return value; }
java
public String getParameterValue(String name, String defaultValue) { String value = defaultValue; SimpleParameterEntry p = parameters.get(name); if (p != null) { value = p.getValue(); } return value; }
[ "public", "String", "getParameterValue", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "String", "value", "=", "defaultValue", ";", "SimpleParameterEntry", "p", "=", "parameters", ".", "get", "(", "name", ")", ";", "if", "(", "p", "!=", "...
Parse named parameter. @param name parameter name @param defaultValue default value @return String
[ "Parse", "named", "parameter", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java#L103-L112
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.copyResource
public void copyResource(String source, String destination) throws CmsException, CmsIllegalArgumentException { copyResource(source, destination, CmsResource.COPY_PRESERVE_SIBLING); }
java
public void copyResource(String source, String destination) throws CmsException, CmsIllegalArgumentException { copyResource(source, destination, CmsResource.COPY_PRESERVE_SIBLING); }
[ "public", "void", "copyResource", "(", "String", "source", ",", "String", "destination", ")", "throws", "CmsException", ",", "CmsIllegalArgumentException", "{", "copyResource", "(", "source", ",", "destination", ",", "CmsResource", ".", "COPY_PRESERVE_SIBLING", ")", ...
Copies a resource.<p> The copied resource will always be locked to the current user after the copy operation.<p> Siblings will be treated according to the <code>{@link org.opencms.file.CmsResource#COPY_PRESERVE_SIBLING}</code> mode.<p> @param source the name of the resource to copy (full current site relative path) @param destination the name of the copy destination (full current site relative path) @throws CmsException if something goes wrong @throws CmsIllegalArgumentException if the <code>destination</code> argument is null or of length 0 @see #copyResource(String, String, CmsResource.CmsResourceCopyMode)
[ "Copies", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L546-L549
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java
AccountsImpl.listNodeAgentSkusNext
public PagedList<NodeAgentSku> listNodeAgentSkusNext(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions) { ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders> response = listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions).toBlocking().single(); return new PagedList<NodeAgentSku>(response.body()) { @Override public Page<NodeAgentSku> nextPage(String nextPageLink) { return listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<NodeAgentSku> listNodeAgentSkusNext(final String nextPageLink, final AccountListNodeAgentSkusNextOptions accountListNodeAgentSkusNextOptions) { ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders> response = listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions).toBlocking().single(); return new PagedList<NodeAgentSku>(response.body()) { @Override public Page<NodeAgentSku> nextPage(String nextPageLink) { return listNodeAgentSkusNextSinglePageAsync(nextPageLink, accountListNodeAgentSkusNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "NodeAgentSku", ">", "listNodeAgentSkusNext", "(", "final", "String", "nextPageLink", ",", "final", "AccountListNodeAgentSkusNextOptions", "accountListNodeAgentSkusNextOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeAgentSk...
Lists all node agent SKUs supported by the Azure Batch service. @param nextPageLink The NextLink from the previous successful call to List operation. @param accountListNodeAgentSkusNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;NodeAgentSku&gt; object if successful.
[ "Lists", "all", "node", "agent", "SKUs", "supported", "by", "the", "Azure", "Batch", "service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L759-L767
JOML-CI/JOML
src/org/joml/Quaterniond.java
Quaterniond.setAngleAxis
public Quaterniond setAngleAxis(double angle, Vector3dc axis) { return setAngleAxis(angle, axis.x(), axis.y(), axis.z()); }
java
public Quaterniond setAngleAxis(double angle, Vector3dc axis) { return setAngleAxis(angle, axis.x(), axis.y(), axis.z()); }
[ "public", "Quaterniond", "setAngleAxis", "(", "double", "angle", ",", "Vector3dc", "axis", ")", "{", "return", "setAngleAxis", "(", "angle", ",", "axis", ".", "x", "(", ")", ",", "axis", ".", "y", "(", ")", ",", "axis", ".", "z", "(", ")", ")", ";"...
Set this quaternion to be a representation of the supplied axis and angle (in radians). @param angle the angle in radians @param axis the rotation axis @return this
[ "Set", "this", "quaternion", "to", "be", "a", "representation", "of", "the", "supplied", "axis", "and", "angle", "(", "in", "radians", ")", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L418-L420
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java
RDBMEntityGroupStore.primUpdate
private void primUpdate(IEntityGroup group, Connection conn) throws SQLException, GroupsException { try { PreparedStatement ps = conn.prepareStatement(getUpdateGroupSql()); try { Integer typeID = EntityTypesLocator.getEntityTypes() .getEntityIDFromType(group.getLeafType()); ps.setString(1, group.getCreatorID()); ps.setInt(2, typeID.intValue()); ps.setString(3, group.getName()); ps.setString(4, group.getDescription()); ps.setString(5, group.getLocalKey()); if (LOG.isDebugEnabled()) LOG.debug( "RDBMEntityGroupStore.primUpdate(): " + ps + "(" + group.getCreatorID() + ", " + typeID + ", " + group.getName() + ", " + group.getDescription() + ", " + group.getLocalKey() + ")"); int rc = ps.executeUpdate(); if (rc != 1) { String errString = "Problem updating " + group; LOG.error(errString); throw new GroupsException(errString); } } finally { ps.close(); } } catch (SQLException sqle) { LOG.error("Error updating entity in database. Group: " + group, sqle); throw sqle; } }
java
private void primUpdate(IEntityGroup group, Connection conn) throws SQLException, GroupsException { try { PreparedStatement ps = conn.prepareStatement(getUpdateGroupSql()); try { Integer typeID = EntityTypesLocator.getEntityTypes() .getEntityIDFromType(group.getLeafType()); ps.setString(1, group.getCreatorID()); ps.setInt(2, typeID.intValue()); ps.setString(3, group.getName()); ps.setString(4, group.getDescription()); ps.setString(5, group.getLocalKey()); if (LOG.isDebugEnabled()) LOG.debug( "RDBMEntityGroupStore.primUpdate(): " + ps + "(" + group.getCreatorID() + ", " + typeID + ", " + group.getName() + ", " + group.getDescription() + ", " + group.getLocalKey() + ")"); int rc = ps.executeUpdate(); if (rc != 1) { String errString = "Problem updating " + group; LOG.error(errString); throw new GroupsException(errString); } } finally { ps.close(); } } catch (SQLException sqle) { LOG.error("Error updating entity in database. Group: " + group, sqle); throw sqle; } }
[ "private", "void", "primUpdate", "(", "IEntityGroup", "group", ",", "Connection", "conn", ")", "throws", "SQLException", ",", "GroupsException", "{", "try", "{", "PreparedStatement", "ps", "=", "conn", ".", "prepareStatement", "(", "getUpdateGroupSql", "(", ")", ...
Update the entity in the database. @param group IEntityGroup @param conn the database connection
[ "Update", "the", "entity", "in", "the", "database", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java#L1155-L1201
OpenLiberty/open-liberty
dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java
CommonMBeanConnection.getJMXConnector
public JMXConnector getJMXConnector(String controllerHost, int controllerPort, String user, String password) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, IOException { HashMap<String, Object> environment = createJMXEnvironment(user, password, setUpSSLContext()); JMXConnector connector = getMBeanServerConnection(controllerHost, controllerPort, environment); connector.connect(); return connector; }
java
public JMXConnector getJMXConnector(String controllerHost, int controllerPort, String user, String password) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, IOException { HashMap<String, Object> environment = createJMXEnvironment(user, password, setUpSSLContext()); JMXConnector connector = getMBeanServerConnection(controllerHost, controllerPort, environment); connector.connect(); return connector; }
[ "public", "JMXConnector", "getJMXConnector", "(", "String", "controllerHost", ",", "int", "controllerPort", ",", "String", "user", ",", "String", "password", ")", "throws", "NoSuchAlgorithmException", ",", "KeyManagementException", ",", "MalformedURLException", ",", "IO...
Returns a connected JMXConnector. @param controllerHost @param controllerPort @param user @param password @return @throws NoSuchAlgorithmException @throws KeyManagementException @throws MalformedURLException @throws IOException
[ "Returns", "a", "connected", "JMXConnector", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java#L132-L137
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java
MetadataStore.deleteSegment
CompletableFuture<Boolean> deleteSegment(String segmentName, Duration timeout) { long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "deleteSegment", segmentName); TimeoutTimer timer = new TimeoutTimer(timeout); // Find the Segment's Id. long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true); CompletableFuture<Void> deleteSegment; if (isValidSegmentId(segmentId)) { // This segment is currently mapped in the ContainerMetadata. if (this.connector.containerMetadata.getStreamSegmentMetadata(segmentId).isDeleted()) { // ... but it is marked as Deleted, so nothing more we can do here. deleteSegment = CompletableFuture.completedFuture(null); } else { // Queue it up for deletion. This ensures that any component that is actively using it will be notified. deleteSegment = this.connector.getLazyDeleteSegment().apply(segmentId, timer.getRemaining()); } } else { // This segment is not currently mapped in the ContainerMetadata. As such, it is safe to delete it directly. deleteSegment = this.connector.getDirectDeleteSegment().apply(segmentName, timer.getRemaining()); } // It is OK if the previous action indicated the Segment was deleted. We still need to make sure that any traces // of this Segment are cleared from the Metadata Store as this invocation may be a retry of a previous partially // executed operation (where we only managed to delete the Segment, but not clear the Metadata). val result = Futures .exceptionallyExpecting(deleteSegment, ex -> ex instanceof StreamSegmentNotExistsException, null) .thenComposeAsync(ignored -> clearSegmentInfo(segmentName, timer.getRemaining()), this.executor); if (log.isTraceEnabled()) { deleteSegment.thenAccept(v -> LoggerHelpers.traceLeave(log, traceObjectId, "deleteSegment", traceId, segmentName)); } return result; }
java
CompletableFuture<Boolean> deleteSegment(String segmentName, Duration timeout) { long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "deleteSegment", segmentName); TimeoutTimer timer = new TimeoutTimer(timeout); // Find the Segment's Id. long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true); CompletableFuture<Void> deleteSegment; if (isValidSegmentId(segmentId)) { // This segment is currently mapped in the ContainerMetadata. if (this.connector.containerMetadata.getStreamSegmentMetadata(segmentId).isDeleted()) { // ... but it is marked as Deleted, so nothing more we can do here. deleteSegment = CompletableFuture.completedFuture(null); } else { // Queue it up for deletion. This ensures that any component that is actively using it will be notified. deleteSegment = this.connector.getLazyDeleteSegment().apply(segmentId, timer.getRemaining()); } } else { // This segment is not currently mapped in the ContainerMetadata. As such, it is safe to delete it directly. deleteSegment = this.connector.getDirectDeleteSegment().apply(segmentName, timer.getRemaining()); } // It is OK if the previous action indicated the Segment was deleted. We still need to make sure that any traces // of this Segment are cleared from the Metadata Store as this invocation may be a retry of a previous partially // executed operation (where we only managed to delete the Segment, but not clear the Metadata). val result = Futures .exceptionallyExpecting(deleteSegment, ex -> ex instanceof StreamSegmentNotExistsException, null) .thenComposeAsync(ignored -> clearSegmentInfo(segmentName, timer.getRemaining()), this.executor); if (log.isTraceEnabled()) { deleteSegment.thenAccept(v -> LoggerHelpers.traceLeave(log, traceObjectId, "deleteSegment", traceId, segmentName)); } return result; }
[ "CompletableFuture", "<", "Boolean", ">", "deleteSegment", "(", "String", "segmentName", ",", "Duration", "timeout", ")", "{", "long", "traceId", "=", "LoggerHelpers", ".", "traceEnterWithContext", "(", "log", ",", "traceObjectId", ",", "\"deleteSegment\"", ",", "...
Deletes a Segment and any associated information from the Metadata Store. Notes: - This method removes both the Segment and its Metadata Store entries. - {@link #clearSegmentInfo} only removes Metadata Store entries. This operation is made of multiple steps and is restart-able. If it was only able to execute partially before being interrupted (by an unexpected exception or system crash), a reinvocation should be able to pick up from where it left off previously. A partial invocation may leave the Segment in an undefined state, so it is highly recommended that such an interrupted call be reinvoked until successful. @param segmentName The case-sensitive Segment Name. @param timeout Timeout for the operation. @return A CompletableFuture that, when completed normally, will contain a Boolean indicating whether the Segment has been deleted (true means there was a Segment to delete, false means there was no segment to delete). If the operation failed, this will contain the exception that caused the failure.
[ "Deletes", "a", "Segment", "and", "any", "associated", "information", "from", "the", "Metadata", "Store", ".", "Notes", ":", "-", "This", "method", "removes", "both", "the", "Segment", "and", "its", "Metadata", "Store", "entries", ".", "-", "{", "@link", "...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L163-L195
zaproxy/zaproxy
src/org/parosproxy/paros/db/DbUtils.java
DbUtils.hasTable
public static boolean hasTable(final Connection connection, final String tableName) throws SQLException { boolean hasTable = false; ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, null, tableName, null); if (rs.next()) { hasTable = true; } } finally { try { if (rs != null) { rs.close(); } } catch (SQLException e) { if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); } } } return hasTable; }
java
public static boolean hasTable(final Connection connection, final String tableName) throws SQLException { boolean hasTable = false; ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, null, tableName, null); if (rs.next()) { hasTable = true; } } finally { try { if (rs != null) { rs.close(); } } catch (SQLException e) { if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); } } } return hasTable; }
[ "public", "static", "boolean", "hasTable", "(", "final", "Connection", "connection", ",", "final", "String", "tableName", ")", "throws", "SQLException", "{", "boolean", "hasTable", "=", "false", ";", "ResultSet", "rs", "=", "null", ";", "try", "{", "rs", "="...
Tells whether the table {@code tableName} exists in the database, or not. @param connection the connection to the database @param tableName the name of the table that will be checked @return {@code true} if the table {@code tableName} exists in the database, {@code false} otherwise. @throws SQLException if an error occurred while checking if the table exists
[ "Tells", "whether", "the", "table", "{", "@code", "tableName", "}", "exists", "in", "the", "database", "or", "not", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/db/DbUtils.java#L48-L70
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/concurrent/AbstractReadWriteAcces.java
AbstractReadWriteAcces.process
public <Result> Result process(IUnitOfWork<Result, State> work) { releaseReadLock(); acquireWriteLock(); try { if (log.isTraceEnabled()) log.trace("process - " + Thread.currentThread().getName()); return modify(work); } finally { if (log.isTraceEnabled()) log.trace("Downgrading from write lock to read lock..."); acquireReadLock(); releaseWriteLock(); } }
java
public <Result> Result process(IUnitOfWork<Result, State> work) { releaseReadLock(); acquireWriteLock(); try { if (log.isTraceEnabled()) log.trace("process - " + Thread.currentThread().getName()); return modify(work); } finally { if (log.isTraceEnabled()) log.trace("Downgrading from write lock to read lock..."); acquireReadLock(); releaseWriteLock(); } }
[ "public", "<", "Result", ">", "Result", "process", "(", "IUnitOfWork", "<", "Result", ",", "State", ">", "work", ")", "{", "releaseReadLock", "(", ")", ";", "acquireWriteLock", "(", ")", ";", "try", "{", "if", "(", "log", ".", "isTraceEnabled", "(", ")...
Upgrades a read transaction to a write transaction, executes the work then downgrades to a read transaction again. @since 2.4 @noreference
[ "Upgrades", "a", "read", "transaction", "to", "a", "write", "transaction", "executes", "the", "work", "then", "downgrades", "to", "a", "read", "transaction", "again", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/concurrent/AbstractReadWriteAcces.java#L107-L120
softindex/datakernel
core-http/src/main/java/io/datakernel/http/HttpUtils.java
HttpUtils.renderQueryString
public static String renderQueryString(Map<String, String> q, String enc) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> e : q.entrySet()) { String name = urlEncode(e.getKey(), enc); sb.append(name); if (e.getValue() != null) { sb.append('='); sb.append(urlEncode(e.getValue(), enc)); } sb.append('&'); } if (sb.length() > 0) sb.setLength(sb.length() - 1); return sb.toString(); }
java
public static String renderQueryString(Map<String, String> q, String enc) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> e : q.entrySet()) { String name = urlEncode(e.getKey(), enc); sb.append(name); if (e.getValue() != null) { sb.append('='); sb.append(urlEncode(e.getValue(), enc)); } sb.append('&'); } if (sb.length() > 0) sb.setLength(sb.length() - 1); return sb.toString(); }
[ "public", "static", "String", "renderQueryString", "(", "Map", "<", "String", ",", "String", ">", "q", ",", "String", "enc", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",...
Method which creates string with parameters and its value in format URL @param q map in which keys if name of parameters, value - value of parameters. @param enc encoding of this string @return string with parameters and its value in format URL
[ "Method", "which", "creates", "string", "with", "parameters", "and", "its", "value", "in", "format", "URL" ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-http/src/main/java/io/datakernel/http/HttpUtils.java#L190-L204
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.summarizeForSubscriptionLevelPolicyAssignmentAsync
public Observable<SummarizeResultsInner> summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
java
public Observable<SummarizeResultsInner> summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SummarizeResultsInner", ">", "summarizeForSubscriptionLevelPolicyAssignmentAsync", "(", "String", "subscriptionId", ",", "String", "policyAssignmentName", ")", "{", "return", "summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync", "(", ...
Summarizes policy states for the subscription level policy assignment. @param subscriptionId Microsoft Azure subscription ID. @param policyAssignmentName Policy assignment name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SummarizeResultsInner object
[ "Summarizes", "policy", "states", "for", "the", "subscription", "level", "policy", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2714-L2721
greatman/GreatmancodeTools
src/main/java/com/greatmancode/tools/utils/Vector.java
Vector.isInAABB
public boolean isInAABB(Vector min, Vector max) { return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; }
java
public boolean isInAABB(Vector min, Vector max) { return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; }
[ "public", "boolean", "isInAABB", "(", "Vector", "min", ",", "Vector", "max", ")", "{", "return", "x", ">=", "min", ".", "x", "&&", "x", "<=", "max", ".", "x", "&&", "y", ">=", "min", ".", "y", "&&", "y", "<=", "max", ".", "y", "&&", "z", ">="...
Returns whether this vector is in an axis-aligned bounding box. <p> The minimum and maximum vectors given must be truly the minimum and maximum X, Y and Z components. @param min Minimum vector @param max Maximum vector @return whether this vector is in the AABB
[ "Returns", "whether", "this", "vector", "is", "in", "an", "axis", "-", "aligned", "bounding", "box", ".", "<p", ">", "The", "minimum", "and", "maximum", "vectors", "given", "must", "be", "truly", "the", "minimum", "and", "maximum", "X", "Y", "and", "Z", ...
train
https://github.com/greatman/GreatmancodeTools/blob/4c9d2656c5c8298ff9e1f235c9be8b148e43c9f1/src/main/java/com/greatmancode/tools/utils/Vector.java#L357-L359
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.convertPixelToNorm
public static Point2D_F64 convertPixelToNorm( DMatrixRMaj K , Point2D_F64 pixel , Point2D_F64 norm ) { return ImplPerspectiveOps_F64.convertPixelToNorm(K, pixel, norm); }
java
public static Point2D_F64 convertPixelToNorm( DMatrixRMaj K , Point2D_F64 pixel , Point2D_F64 norm ) { return ImplPerspectiveOps_F64.convertPixelToNorm(K, pixel, norm); }
[ "public", "static", "Point2D_F64", "convertPixelToNorm", "(", "DMatrixRMaj", "K", ",", "Point2D_F64", "pixel", ",", "Point2D_F64", "norm", ")", "{", "return", "ImplPerspectiveOps_F64", ".", "convertPixelToNorm", "(", "K", ",", "pixel", ",", "norm", ")", ";", "}"...
<p> Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then {@link PinholePtoN_F64} should be used instead. </p> NOTE: norm and pixel can be the same instance. @param K Intrinsic camera calibration matrix @param pixel Pixel coordinate. @param norm Optional storage for output. If null a new instance will be declared. @return normalized image coordinate
[ "<p", ">", "Convenient", "function", "for", "converting", "from", "original", "image", "pixel", "coordinate", "to", "normalized<", "image", "coordinates", ".", "If", "speed", "is", "a", "concern", "then", "{", "@link", "PinholePtoN_F64", "}", "should", "be", "...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L479-L481
RestComm/jdiameter
core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/IPConverter.java
IPConverter.InetAddressByIPv4
public static InetAddress InetAddressByIPv4(String address) { StringTokenizer addressTokens = new StringTokenizer(address, "."); byte[] bytes; if (addressTokens.countTokens() == 4) { bytes = new byte[]{ getByBytes(addressTokens), getByBytes(addressTokens), getByBytes(addressTokens), getByBytes(addressTokens) }; } else { return null; } try { return InetAddress.getByAddress(bytes); } catch (UnknownHostException e) { return null; } }
java
public static InetAddress InetAddressByIPv4(String address) { StringTokenizer addressTokens = new StringTokenizer(address, "."); byte[] bytes; if (addressTokens.countTokens() == 4) { bytes = new byte[]{ getByBytes(addressTokens), getByBytes(addressTokens), getByBytes(addressTokens), getByBytes(addressTokens) }; } else { return null; } try { return InetAddress.getByAddress(bytes); } catch (UnknownHostException e) { return null; } }
[ "public", "static", "InetAddress", "InetAddressByIPv4", "(", "String", "address", ")", "{", "StringTokenizer", "addressTokens", "=", "new", "StringTokenizer", "(", "address", ",", "\".\"", ")", ";", "byte", "[", "]", "bytes", ";", "if", "(", "addressTokens", "...
Convert defined string to IPv4 object instance @param address string representation of ip address @return IPv4 object instance
[ "Convert", "defined", "string", "to", "IPv4", "object", "instance" ]
train
https://github.com/RestComm/jdiameter/blob/672134c378ea9704bf06dbe1985872ad4ebf4640/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/IPConverter.java#L63-L83
apereo/cas
support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/ChainingAWSCredentialsProvider.java
ChainingAWSCredentialsProvider.getInstance
public static AWSCredentialsProvider getInstance(final String credentialAccessKey, final String credentialSecretKey) { return getInstance(credentialAccessKey, credentialSecretKey, null, null, null); }
java
public static AWSCredentialsProvider getInstance(final String credentialAccessKey, final String credentialSecretKey) { return getInstance(credentialAccessKey, credentialSecretKey, null, null, null); }
[ "public", "static", "AWSCredentialsProvider", "getInstance", "(", "final", "String", "credentialAccessKey", ",", "final", "String", "credentialSecretKey", ")", "{", "return", "getInstance", "(", "credentialAccessKey", ",", "credentialSecretKey", ",", "null", ",", "null"...
Gets instance. @param credentialAccessKey the credential access key @param credentialSecretKey the credential secret key @return the instance
[ "Gets", "instance", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/ChainingAWSCredentialsProvider.java#L53-L55
dustin/java-memcached-client
src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java
OperationImpl.setArguments
protected final void setArguments(ByteBuffer bb, Object... args) { boolean wasFirst = true; for (Object o : args) { if (wasFirst) { wasFirst = false; } else { bb.put((byte) ' '); } bb.put(KeyUtil.getKeyBytes(String.valueOf(o))); } bb.put(CRLF); }
java
protected final void setArguments(ByteBuffer bb, Object... args) { boolean wasFirst = true; for (Object o : args) { if (wasFirst) { wasFirst = false; } else { bb.put((byte) ' '); } bb.put(KeyUtil.getKeyBytes(String.valueOf(o))); } bb.put(CRLF); }
[ "protected", "final", "void", "setArguments", "(", "ByteBuffer", "bb", ",", "Object", "...", "args", ")", "{", "boolean", "wasFirst", "=", "true", ";", "for", "(", "Object", "o", ":", "args", ")", "{", "if", "(", "wasFirst", ")", "{", "wasFirst", "=", ...
Set some arguments for an operation into the given byte buffer.
[ "Set", "some", "arguments", "for", "an", "operation", "into", "the", "given", "byte", "buffer", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java#L99-L110
onepf/OpenIAB
library/src/main/java/org/onepf/oms/OpenIabHelper.java
OpenIabHelper.getSku
@NotNull public static String getSku(@NotNull final String appStoreName, @NotNull String storeSku) { return SkuManager.getInstance().getSku(appStoreName, storeSku); }
java
@NotNull public static String getSku(@NotNull final String appStoreName, @NotNull String storeSku) { return SkuManager.getInstance().getSku(appStoreName, storeSku); }
[ "@", "NotNull", "public", "static", "String", "getSku", "(", "@", "NotNull", "final", "String", "appStoreName", ",", "@", "NotNull", "String", "storeSku", ")", "{", "return", "SkuManager", ".", "getInstance", "(", ")", ".", "getSku", "(", "appStoreName", ","...
Returns a mapped application internal SKU using the store name and a store SKU. @see org.onepf.oms.SkuManager#mapSku(String, String, String) @deprecated Use {@link org.onepf.oms.SkuManager#getSku(String, String)}
[ "Returns", "a", "mapped", "application", "internal", "SKU", "using", "the", "store", "name", "and", "a", "store", "SKU", "." ]
train
https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/OpenIabHelper.java#L378-L381
leancloud/java-sdk-all
realtime/src/main/java/cn/leancloud/session/AVDefaultConnectionListener.java
AVDefaultConnectionListener.processConversationDeliveredAt
private void processConversationDeliveredAt(String conversationId, int convType, long timestamp) { AVConversationHolder conversation = session.getConversationHolder(conversationId, convType); conversation.onConversationDeliveredAtEvent(timestamp); }
java
private void processConversationDeliveredAt(String conversationId, int convType, long timestamp) { AVConversationHolder conversation = session.getConversationHolder(conversationId, convType); conversation.onConversationDeliveredAtEvent(timestamp); }
[ "private", "void", "processConversationDeliveredAt", "(", "String", "conversationId", ",", "int", "convType", ",", "long", "timestamp", ")", "{", "AVConversationHolder", "conversation", "=", "session", ".", "getConversationHolder", "(", "conversationId", ",", "convType"...
处理 v2 版本中 conversation 的 deliveredAt 事件 @param conversationId @param timestamp
[ "处理", "v2", "版本中", "conversation", "的", "deliveredAt", "事件" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/session/AVDefaultConnectionListener.java#L539-L542
KyoriPowered/text
api/src/main/java/net/kyori/text/event/ClickEvent.java
ClickEvent.suggestCommand
public static @NonNull ClickEvent suggestCommand(final @NonNull String command) { return new ClickEvent(Action.SUGGEST_COMMAND, command); }
java
public static @NonNull ClickEvent suggestCommand(final @NonNull String command) { return new ClickEvent(Action.SUGGEST_COMMAND, command); }
[ "public", "static", "@", "NonNull", "ClickEvent", "suggestCommand", "(", "final", "@", "NonNull", "String", "command", ")", "{", "return", "new", "ClickEvent", "(", "Action", ".", "SUGGEST_COMMAND", ",", "command", ")", ";", "}" ]
Creates a click event that suggests a command. @param command the command to suggest @return a click event
[ "Creates", "a", "click", "event", "that", "suggests", "a", "command", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/event/ClickEvent.java#L86-L88
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.xmlConversionTypeIncorrect
public static void xmlConversionTypeIncorrect(String conversionName,String xmlPath,String className,String type){ throw new XmlConversionTypeException(MSG.INSTANCE.message(xmlConversionTypeException,conversionName,xmlPath,className,type)); }
java
public static void xmlConversionTypeIncorrect(String conversionName,String xmlPath,String className,String type){ throw new XmlConversionTypeException(MSG.INSTANCE.message(xmlConversionTypeException,conversionName,xmlPath,className,type)); }
[ "public", "static", "void", "xmlConversionTypeIncorrect", "(", "String", "conversionName", ",", "String", "xmlPath", ",", "String", "className", ",", "String", "type", ")", "{", "throw", "new", "XmlConversionTypeException", "(", "MSG", ".", "INSTANCE", ".", "messa...
Thrown if conversion type is wrong. @param conversionName conversion name @param xmlPath xml path @param className class name @param type type
[ "Thrown", "if", "conversion", "type", "is", "wrong", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L338-L340
undertow-io/undertow
core/src/main/java/io/undertow/util/FlexBase64.java
FlexBase64.encodeStringURL
public static String encodeStringURL(byte[] source, int pos, int limit, boolean wrap) { return Encoder.encodeString(source, pos, limit, wrap, true); }
java
public static String encodeStringURL(byte[] source, int pos, int limit, boolean wrap) { return Encoder.encodeString(source, pos, limit, wrap, true); }
[ "public", "static", "String", "encodeStringURL", "(", "byte", "[", "]", "source", ",", "int", "pos", ",", "int", "limit", ",", "boolean", "wrap", ")", "{", "return", "Encoder", ".", "encodeString", "(", "source", ",", "pos", ",", "limit", ",", "wrap", ...
Encodes a fixed and complete byte array into a Base64url String. <p>This method is only useful for applications which require a String and have all data to be encoded up-front. Note that byte arrays or buffers are almost always a better storage choice. They consume half the memory and can be reused (modified). In other words, it is almost always better to use {@link #encodeBytes}, {@link #createEncoder}, or {@link #createEncoderOutputStream} instead.</p> <pre><code> // Encodes "ell" FlexBase64.encodeStringURL("hello".getBytes("US-ASCII"), 1, 4); </code></pre> @param source the byte array to encode from @param pos the position to start encoding from @param limit the position to halt encoding at (exclusive) @param wrap whether or not to wrap the output at 76 chars with CRLFs @return a new String representing the Base64url output
[ "Encodes", "a", "fixed", "and", "complete", "byte", "array", "into", "a", "Base64url", "String", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FlexBase64.java#L212-L214
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfigXmlGenerator.java
ClientConfigXmlGenerator.generate
public static String generate(ClientConfig clientConfig, int indent) { Preconditions.isNotNull(clientConfig, "ClientConfig"); StringBuilder xml = new StringBuilder(); xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); XmlGenerator gen = new XmlGenerator(xml); gen.open("hazelcast-client", "xmlns", "http://www.hazelcast.com/schema/client-config", "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation", "http://www.hazelcast.com/schema/client-config " + "http://www.hazelcast.com/schema/client-config/hazelcast-client-config-4.0.xsd"); //GroupConfig group(gen, clientConfig.getGroupConfig()); //InstanceName gen.node("instance-name", clientConfig.getInstanceName()); //attributes gen.appendLabels(clientConfig.getLabels()); //Properties gen.appendProperties(clientConfig.getProperties()); //Network network(gen, clientConfig.getNetworkConfig()); //ExecutorPoolSize if (clientConfig.getExecutorPoolSize() > 0) { gen.node("executor-pool-size", clientConfig.getExecutorPoolSize()); } //Security security(gen, clientConfig.getSecurityConfig()); //Listeners listener(gen, clientConfig.getListenerConfigs()); //Serialization serialization(gen, clientConfig.getSerializationConfig()); //Native nativeMemory(gen, clientConfig.getNativeMemoryConfig()); //ProxyFactories proxyFactory(gen, clientConfig.getProxyFactoryConfigs()); //LoadBalancer loadBalancer(gen, clientConfig.getLoadBalancer()); //NearCache nearCaches(gen, clientConfig.getNearCacheConfigMap()); //QueryCaches queryCaches(gen, clientConfig.getQueryCacheConfigs()); //ConnectionStrategy ClientConnectionStrategyConfig connectionStrategy = clientConfig.getConnectionStrategyConfig(); gen.node("connection-strategy", null, "async-start", connectionStrategy.isAsyncStart(), "reconnect-mode", connectionStrategy.getReconnectMode()); //UserCodeDeployment userCodeDeployment(gen, clientConfig.getUserCodeDeploymentConfig()); //FlakeIdGenerator flakeIdGenerator(gen, clientConfig.getFlakeIdGeneratorConfigMap()); //close HazelcastClient gen.close(); return format(xml.toString(), indent); }
java
public static String generate(ClientConfig clientConfig, int indent) { Preconditions.isNotNull(clientConfig, "ClientConfig"); StringBuilder xml = new StringBuilder(); xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); XmlGenerator gen = new XmlGenerator(xml); gen.open("hazelcast-client", "xmlns", "http://www.hazelcast.com/schema/client-config", "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance", "xsi:schemaLocation", "http://www.hazelcast.com/schema/client-config " + "http://www.hazelcast.com/schema/client-config/hazelcast-client-config-4.0.xsd"); //GroupConfig group(gen, clientConfig.getGroupConfig()); //InstanceName gen.node("instance-name", clientConfig.getInstanceName()); //attributes gen.appendLabels(clientConfig.getLabels()); //Properties gen.appendProperties(clientConfig.getProperties()); //Network network(gen, clientConfig.getNetworkConfig()); //ExecutorPoolSize if (clientConfig.getExecutorPoolSize() > 0) { gen.node("executor-pool-size", clientConfig.getExecutorPoolSize()); } //Security security(gen, clientConfig.getSecurityConfig()); //Listeners listener(gen, clientConfig.getListenerConfigs()); //Serialization serialization(gen, clientConfig.getSerializationConfig()); //Native nativeMemory(gen, clientConfig.getNativeMemoryConfig()); //ProxyFactories proxyFactory(gen, clientConfig.getProxyFactoryConfigs()); //LoadBalancer loadBalancer(gen, clientConfig.getLoadBalancer()); //NearCache nearCaches(gen, clientConfig.getNearCacheConfigMap()); //QueryCaches queryCaches(gen, clientConfig.getQueryCacheConfigs()); //ConnectionStrategy ClientConnectionStrategyConfig connectionStrategy = clientConfig.getConnectionStrategyConfig(); gen.node("connection-strategy", null, "async-start", connectionStrategy.isAsyncStart(), "reconnect-mode", connectionStrategy.getReconnectMode()); //UserCodeDeployment userCodeDeployment(gen, clientConfig.getUserCodeDeploymentConfig()); //FlakeIdGenerator flakeIdGenerator(gen, clientConfig.getFlakeIdGeneratorConfigMap()); //close HazelcastClient gen.close(); return format(xml.toString(), indent); }
[ "public", "static", "String", "generate", "(", "ClientConfig", "clientConfig", ",", "int", "indent", ")", "{", "Preconditions", ".", "isNotNull", "(", "clientConfig", ",", "\"ClientConfig\"", ")", ";", "StringBuilder", "xml", "=", "new", "StringBuilder", "(", ")...
Transforms the given {@link ClientConfig} to xml string formatting the output with given {@code indent}, -1 means no formatting.
[ "Transforms", "the", "given", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfigXmlGenerator.java#L86-L141
casmi/casmi
src/main/java/casmi/graphics/element/Quad.java
Quad.getConer
public Vector3D getConer(int index) { Vector3D v = new Vector3D(0, 0, 0); if (index <= 0) { v.set(this.x1, this.y1); } else if (index == 1) { v.set(this.x2, this.y2); } else if (index == 2) { v.set(this.x3, this.y3); } else if (3 <= index) { v.set(this.x4, this.y4); } return v; }
java
public Vector3D getConer(int index) { Vector3D v = new Vector3D(0, 0, 0); if (index <= 0) { v.set(this.x1, this.y1); } else if (index == 1) { v.set(this.x2, this.y2); } else if (index == 2) { v.set(this.x3, this.y3); } else if (3 <= index) { v.set(this.x4, this.y4); } return v; }
[ "public", "Vector3D", "getConer", "(", "int", "index", ")", "{", "Vector3D", "v", "=", "new", "Vector3D", "(", "0", ",", "0", ",", "0", ")", ";", "if", "(", "index", "<=", "0", ")", "{", "v", ".", "set", "(", "this", ".", "x1", ",", "this", "...
Gets coordinates of a corner. @param index The index of a corner.
[ "Gets", "coordinates", "of", "a", "corner", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Quad.java#L221-L234
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/SMARTParser.java
SMARTParser.readColumns
private EventRecord readColumns(EventRecord er, StringBuffer sb) { Pattern pattern = Pattern.compile("^\\s{0,2}(\\d{1,3}\\s+.*)$", Pattern.MULTILINE); Matcher matcher = pattern.matcher(sb); while (matcher.find()) { String[] tokens = matcher.group(1).split("\\s+"); boolean failed = false; // check if this attribute is a failed one if (!tokens[8].equals("-")) failed = true; er.set(tokens[1].toLowerCase(), (failed ? "FAILED:" : "") + tokens[9]); } return er; }
java
private EventRecord readColumns(EventRecord er, StringBuffer sb) { Pattern pattern = Pattern.compile("^\\s{0,2}(\\d{1,3}\\s+.*)$", Pattern.MULTILINE); Matcher matcher = pattern.matcher(sb); while (matcher.find()) { String[] tokens = matcher.group(1).split("\\s+"); boolean failed = false; // check if this attribute is a failed one if (!tokens[8].equals("-")) failed = true; er.set(tokens[1].toLowerCase(), (failed ? "FAILED:" : "") + tokens[9]); } return er; }
[ "private", "EventRecord", "readColumns", "(", "EventRecord", "er", ",", "StringBuffer", "sb", ")", "{", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "\"^\\\\s{0,2}(\\\\d{1,3}\\\\s+.*)$\"", ",", "Pattern", ".", "MULTILINE", ")", ";", "Matcher", "match...
Reads attributes in the following format: ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE 3 Spin_Up_Time 0x0027 180 177 063 Pre-fail Always - 10265 4 Start_Stop_Count 0x0032 253 253 000 Old_age Always - 34 5 Reallocated_Sector_Ct 0x0033 253 253 063 Pre-fail Always - 0 6 Read_Channel_Margin 0x0001 253 253 100 Pre-fail Offline - 0 7 Seek_Error_Rate 0x000a 253 252 000 Old_age Always - 0 8 Seek_Time_Performance 0x0027 250 224 187 Pre-fail Always - 53894 9 Power_On_Minutes 0x0032 210 210 000 Old_age Always - 878h+00m 10 Spin_Retry_Count 0x002b 253 252 157 Pre-fail Always - 0 11 Calibration_Retry_Count 0x002b 253 252 223 Pre-fail Always - 0 12 Power_Cycle_Count 0x0032 253 253 000 Old_age Always - 49 192 PowerOff_Retract_Count 0x0032 253 253 000 Old_age Always - 0 193 Load_Cycle_Count 0x0032 253 253 000 Old_age Always - 0 194 Temperature_Celsius 0x0032 037 253 000 Old_age Always - 37 195 Hardware_ECC_Recovered 0x000a 253 252 000 Old_age Always - 2645 This format is mostly found in IDE and SATA disks. @param er the EventRecord in which to store attributes found @param sb the StringBuffer with the text to parse @return the EventRecord in which new attributes are stored.
[ "Reads", "attributes", "in", "the", "following", "format", ":" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/SMARTParser.java#L153-L169
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/Criteria.java
Criteria.between
public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound, boolean includeLowerBound, boolean includeUppderBound) { predicates.add(new Predicate(OperationKey.BETWEEN, new Object[] { lowerBound, upperBound, includeLowerBound, includeUppderBound })); return this; }
java
public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound, boolean includeLowerBound, boolean includeUppderBound) { predicates.add(new Predicate(OperationKey.BETWEEN, new Object[] { lowerBound, upperBound, includeLowerBound, includeUppderBound })); return this; }
[ "public", "Criteria", "between", "(", "@", "Nullable", "Object", "lowerBound", ",", "@", "Nullable", "Object", "upperBound", ",", "boolean", "includeLowerBound", ",", "boolean", "includeUppderBound", ")", "{", "predicates", ".", "add", "(", "new", "Predicate", "...
Crates new {@link Predicate} for {@code RANGE [lowerBound TO upperBound]} @param lowerBound @param upperBound @param includeLowerBound @param includeUppderBound @return
[ "Crates", "new", "{", "@link", "Predicate", "}", "for", "{", "@code", "RANGE", "[", "lowerBound", "TO", "upperBound", "]", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L414-L418
FasterXML/woodstox
src/main/java/com/ctc/wstx/stax/WstxInputFactory.java
WstxInputFactory.createSR
public XMLStreamReader2 createSR(ReaderConfig cfg, String systemId, InputBootstrapper bs, boolean forER, boolean autoCloseInput) throws XMLStreamException { // 16-Aug-2004, TSa: Maybe we have a context? URL src = cfg.getBaseURL(); // If not, maybe we can derive it from system id? if ((src == null) && (systemId != null && systemId.length() > 0)) { try { src = URLUtil.urlFromSystemId(systemId); } catch (IOException ie) { throw new WstxIOException(ie); } } return doCreateSR(cfg, SystemId.construct(systemId, src), bs, forER, autoCloseInput); }
java
public XMLStreamReader2 createSR(ReaderConfig cfg, String systemId, InputBootstrapper bs, boolean forER, boolean autoCloseInput) throws XMLStreamException { // 16-Aug-2004, TSa: Maybe we have a context? URL src = cfg.getBaseURL(); // If not, maybe we can derive it from system id? if ((src == null) && (systemId != null && systemId.length() > 0)) { try { src = URLUtil.urlFromSystemId(systemId); } catch (IOException ie) { throw new WstxIOException(ie); } } return doCreateSR(cfg, SystemId.construct(systemId, src), bs, forER, autoCloseInput); }
[ "public", "XMLStreamReader2", "createSR", "(", "ReaderConfig", "cfg", ",", "String", "systemId", ",", "InputBootstrapper", "bs", ",", "boolean", "forER", ",", "boolean", "autoCloseInput", ")", "throws", "XMLStreamException", "{", "// 16-Aug-2004, TSa: Maybe we have a cont...
Method that is eventually called to create a (full) stream read instance. <p> Note: defined as public method because it needs to be called by SAX implementation. @param systemId System id used for this reader (if any) @param bs Bootstrapper to use for creating actual underlying physical reader @param forER Flag to indicate whether it will be used via Event API (will affect some configuration settings), true if it will be, false if not (or not known) @param autoCloseInput Whether the underlying input source should be actually closed when encountering EOF, or when <code>close()</code> is called. Will be true for input sources that are automatically managed by stream reader (input streams created for {@link java.net.URL} and {@link java.io.File} arguments, or when configuration settings indicate auto-closing is to be enabled (the default value is false as per Stax 1.0 specs).
[ "Method", "that", "is", "eventually", "called", "to", "create", "a", "(", "full", ")", "stream", "read", "instance", ".", "<p", ">", "Note", ":", "defined", "as", "public", "method", "because", "it", "needs", "to", "be", "called", "by", "SAX", "implement...
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/stax/WstxInputFactory.java#L611-L627
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.pixelYToLatitudeWithScaleFactor
public static double pixelYToLatitudeWithScaleFactor(double pixelY, double scaleFactor, int tileSize) { long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); if (pixelY < 0 || pixelY > mapSize) { throw new IllegalArgumentException("invalid pixelY coordinate at scale " + scaleFactor + ": " + pixelY); } double y = 0.5 - (pixelY / mapSize); return 90 - 360 * Math.atan(Math.exp(-y * (2 * Math.PI))) / Math.PI; }
java
public static double pixelYToLatitudeWithScaleFactor(double pixelY, double scaleFactor, int tileSize) { long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); if (pixelY < 0 || pixelY > mapSize) { throw new IllegalArgumentException("invalid pixelY coordinate at scale " + scaleFactor + ": " + pixelY); } double y = 0.5 - (pixelY / mapSize); return 90 - 360 * Math.atan(Math.exp(-y * (2 * Math.PI))) / Math.PI; }
[ "public", "static", "double", "pixelYToLatitudeWithScaleFactor", "(", "double", "pixelY", ",", "double", "scaleFactor", ",", "int", "tileSize", ")", "{", "long", "mapSize", "=", "getMapSizeWithScaleFactor", "(", "scaleFactor", ",", "tileSize", ")", ";", "if", "(",...
Converts a pixel Y coordinate at a certain scale to a latitude coordinate. @param pixelY the pixel Y coordinate that should be converted. @param scaleFactor the scale factor at which the coordinate should be converted. @return the latitude value of the pixel Y coordinate. @throws IllegalArgumentException if the given pixelY coordinate is invalid.
[ "Converts", "a", "pixel", "Y", "coordinate", "at", "a", "certain", "scale", "to", "a", "latitude", "coordinate", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L390-L397
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java
PAbstractObject.getBool
@Override public final boolean getBool(final String key) { Boolean result = optBool(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
@Override public final boolean getBool(final String key) { Boolean result = optBool(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
[ "@", "Override", "public", "final", "boolean", "getBool", "(", "final", "String", "key", ")", "{", "Boolean", "result", "=", "optBool", "(", "key", ")", ";", "if", "(", "result", "==", "null", ")", "{", "throw", "new", "ObjectMissingException", "(", "thi...
Get a property as a boolean or throw exception. @param key the property name
[ "Get", "a", "property", "as", "a", "boolean", "or", "throw", "exception", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L154-L161
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.identity_user_user_GET
public OvhUser identity_user_user_GET(String user) throws IOException { String qPath = "/me/identity/user/{user}"; StringBuilder sb = path(qPath, user); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhUser.class); }
java
public OvhUser identity_user_user_GET(String user) throws IOException { String qPath = "/me/identity/user/{user}"; StringBuilder sb = path(qPath, user); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhUser.class); }
[ "public", "OvhUser", "identity_user_user_GET", "(", "String", "user", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/identity/user/{user}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "user", ")", ";", "String", "resp", "=", ...
Get this object properties REST: GET /me/identity/user/{user} @param user [required] User's login
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L204-L209
UrielCh/ovh-java-sdk
ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java
ApiOvhCaasregistry.serviceName_users_POST
public OvhUser serviceName_users_POST(String serviceName, OvhInputUser body) throws IOException { String qPath = "/caas/registry/{serviceName}/users"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "POST", sb.toString(), body); return convertTo(resp, OvhUser.class); }
java
public OvhUser serviceName_users_POST(String serviceName, OvhInputUser body) throws IOException { String qPath = "/caas/registry/{serviceName}/users"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "POST", sb.toString(), body); return convertTo(resp, OvhUser.class); }
[ "public", "OvhUser", "serviceName_users_POST", "(", "String", "serviceName", ",", "OvhInputUser", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/caas/registry/{serviceName}/users\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", ...
Create user REST: POST /caas/registry/{serviceName}/users @param body [required] A registry user account @param serviceName [required] Service name API beta
[ "Create", "user" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java#L92-L97
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicylabel.java
transformpolicylabel.get
public static transformpolicylabel get(nitro_service service, String labelname) throws Exception{ transformpolicylabel obj = new transformpolicylabel(); obj.set_labelname(labelname); transformpolicylabel response = (transformpolicylabel) obj.get_resource(service); return response; }
java
public static transformpolicylabel get(nitro_service service, String labelname) throws Exception{ transformpolicylabel obj = new transformpolicylabel(); obj.set_labelname(labelname); transformpolicylabel response = (transformpolicylabel) obj.get_resource(service); return response; }
[ "public", "static", "transformpolicylabel", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "transformpolicylabel", "obj", "=", "new", "transformpolicylabel", "(", ")", ";", "obj", ".", "set_labelname", "(", "la...
Use this API to fetch transformpolicylabel resource of given name .
[ "Use", "this", "API", "to", "fetch", "transformpolicylabel", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicylabel.java#L331-L336
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/mult/VectorVectorMult_DDRM.java
VectorVectorMult_DDRM.addOuterProd
public static void addOuterProd(double gamma , DMatrixD1 x, DMatrixD1 y, DMatrix1Row A ) { int m = A.numRows; int n = A.numCols; int index = 0; if( gamma == 1.0 ) { for( int i = 0; i < m; i++ ) { double xdat = x.get(i); for( int j = 0; j < n; j++ ) { A.plus( index++ , xdat*y.get(j) ); } } } else { for( int i = 0; i < m; i++ ) { double xdat = x.get(i); for( int j = 0; j < n; j++ ) { A.plus( index++ , gamma*xdat*y.get(j)); } } } }
java
public static void addOuterProd(double gamma , DMatrixD1 x, DMatrixD1 y, DMatrix1Row A ) { int m = A.numRows; int n = A.numCols; int index = 0; if( gamma == 1.0 ) { for( int i = 0; i < m; i++ ) { double xdat = x.get(i); for( int j = 0; j < n; j++ ) { A.plus( index++ , xdat*y.get(j) ); } } } else { for( int i = 0; i < m; i++ ) { double xdat = x.get(i); for( int j = 0; j < n; j++ ) { A.plus( index++ , gamma*xdat*y.get(j)); } } } }
[ "public", "static", "void", "addOuterProd", "(", "double", "gamma", ",", "DMatrixD1", "x", ",", "DMatrixD1", "y", ",", "DMatrix1Row", "A", ")", "{", "int", "m", "=", "A", ".", "numRows", ";", "int", "n", "=", "A", ".", "numCols", ";", "int", "index",...
<p> Adds to A &isin; &real; <sup>m &times; n</sup> the results of an outer product multiplication of the two vectors. This is also known as a rank 1 update.<br> <br> A = A + &gamma; x * y<sup>T</sup> where x &isin; &real; <sup>m</sup> and y &isin; &real; <sup>n</sup> are vectors. </p> <p> Which is equivalent to: A<sub>ij</sub> = A<sub>ij</sub> + &gamma; x<sub>i</sub>*y<sub>j</sub> </p> <p> These functions are often used inside of highly optimized code and therefor sanity checks are kept to a minimum. It is not recommended that any of these functions be used directly. </p> @param gamma A multiplication factor for the outer product. @param x A vector with m elements. Not modified. @param y A vector with n elements. Not modified. @param A A Matrix with m by n elements. Modified.
[ "<p", ">", "Adds", "to", "A", "&isin", ";", "&real", ";", "<sup", ">", "m", "&times", ";", "n<", "/", "sup", ">", "the", "results", "of", "an", "outer", "product", "multiplication", "of", "the", "two", "vectors", ".", "This", "is", "also", "known", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/mult/VectorVectorMult_DDRM.java#L192-L212
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/LinearClassifier.java
LinearClassifier.scoreOf
@Deprecated public double scoreOf(RVFDatum<L, F> example, L label) { int iLabel = labelIndex.indexOf(label); double score = 0.0; Counter<F> features = example.asFeaturesCounter(); for (F f : features.keySet()) { score += weight(f, iLabel) * features.getCount(f); } return score + thresholds[iLabel]; }
java
@Deprecated public double scoreOf(RVFDatum<L, F> example, L label) { int iLabel = labelIndex.indexOf(label); double score = 0.0; Counter<F> features = example.asFeaturesCounter(); for (F f : features.keySet()) { score += weight(f, iLabel) * features.getCount(f); } return score + thresholds[iLabel]; }
[ "@", "Deprecated", "public", "double", "scoreOf", "(", "RVFDatum", "<", "L", ",", "F", ">", "example", ",", "L", "label", ")", "{", "int", "iLabel", "=", "labelIndex", ".", "indexOf", "(", "label", ")", ";", "double", "score", "=", "0.0", ";", "Count...
Returns the score of the RVFDatum for the specified label. Ignores the true label of the RVFDatum.
[ "Returns", "the", "score", "of", "the", "RVFDatum", "for", "the", "specified", "label", ".", "Ignores", "the", "true", "label", "of", "the", "RVFDatum", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L205-L214
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java
SeqRes2AtomAligner.alignProteinChains
private boolean alignProteinChains(List<Group> seqRes, List<Group> atomRes) { Map<Integer,Integer> seqresIndexPosition = new HashMap<Integer, Integer>(); Map<Integer,Integer> atomIndexPosition = new HashMap<Integer, Integer>(); String seq1 = getFullAtomSequence(seqRes, seqresIndexPosition, false); // String seq2 = getFullAtomSequence(atomRes, atomIndexPosition, false); logger.debug("Protein seq1 to align (length "+ seq1.length()+"): " + seq1); logger.debug("Protein seq2 to align (length "+ seq2.length()+"): " + seq2); ProteinSequence s1; ProteinSequence s2; try { s1 = new ProteinSequence(seq1); s2 = new ProteinSequence(seq2); } catch (CompoundNotFoundException e) { logger.warn("Could not create protein sequences ({}) to align ATOM and SEQRES groups, they will remain unaligned.", e.getMessage()); return true; } SubstitutionMatrix<AminoAcidCompound> matrix = SubstitutionMatrixHelper.getBlosum65(); GapPenalty penalty = new SimpleGapPenalty(8, 1); PairwiseSequenceAligner<ProteinSequence, AminoAcidCompound> smithWaterman = Alignments.getPairwiseAligner(s1, s2, PairwiseSequenceAlignerType.LOCAL, penalty, matrix); SequencePair<ProteinSequence, AminoAcidCompound> pair = smithWaterman.getPair(); // sequences that are only X (e.g. 1jnv chain A) produced empty alignments, because nothing aligns to nothing and thus the local alignment is empty // to avoid those empty alignments we catch them here with pair.getLength()==0 if ( pair == null || pair.getLength()==0) { logger.warn("Could not align protein sequences. ATOM and SEQRES groups will not be aligned."); logger.warn("Sequences: "); logger.warn(seq1); logger.warn(seq2); return true; } logger.debug("Alignment:\n"+pair.toString(100)); boolean noMatchFound = mapChains(seqRes,atomRes,pair,seqresIndexPosition, atomIndexPosition ); return noMatchFound; }
java
private boolean alignProteinChains(List<Group> seqRes, List<Group> atomRes) { Map<Integer,Integer> seqresIndexPosition = new HashMap<Integer, Integer>(); Map<Integer,Integer> atomIndexPosition = new HashMap<Integer, Integer>(); String seq1 = getFullAtomSequence(seqRes, seqresIndexPosition, false); // String seq2 = getFullAtomSequence(atomRes, atomIndexPosition, false); logger.debug("Protein seq1 to align (length "+ seq1.length()+"): " + seq1); logger.debug("Protein seq2 to align (length "+ seq2.length()+"): " + seq2); ProteinSequence s1; ProteinSequence s2; try { s1 = new ProteinSequence(seq1); s2 = new ProteinSequence(seq2); } catch (CompoundNotFoundException e) { logger.warn("Could not create protein sequences ({}) to align ATOM and SEQRES groups, they will remain unaligned.", e.getMessage()); return true; } SubstitutionMatrix<AminoAcidCompound> matrix = SubstitutionMatrixHelper.getBlosum65(); GapPenalty penalty = new SimpleGapPenalty(8, 1); PairwiseSequenceAligner<ProteinSequence, AminoAcidCompound> smithWaterman = Alignments.getPairwiseAligner(s1, s2, PairwiseSequenceAlignerType.LOCAL, penalty, matrix); SequencePair<ProteinSequence, AminoAcidCompound> pair = smithWaterman.getPair(); // sequences that are only X (e.g. 1jnv chain A) produced empty alignments, because nothing aligns to nothing and thus the local alignment is empty // to avoid those empty alignments we catch them here with pair.getLength()==0 if ( pair == null || pair.getLength()==0) { logger.warn("Could not align protein sequences. ATOM and SEQRES groups will not be aligned."); logger.warn("Sequences: "); logger.warn(seq1); logger.warn(seq2); return true; } logger.debug("Alignment:\n"+pair.toString(100)); boolean noMatchFound = mapChains(seqRes,atomRes,pair,seqresIndexPosition, atomIndexPosition ); return noMatchFound; }
[ "private", "boolean", "alignProteinChains", "(", "List", "<", "Group", ">", "seqRes", ",", "List", "<", "Group", ">", "atomRes", ")", "{", "Map", "<", "Integer", ",", "Integer", ">", "seqresIndexPosition", "=", "new", "HashMap", "<", "Integer", ",", "Integ...
Aligns two chains of groups, where the first parent is representing the list of amino acids as obtained from the SEQRES records, and the second parent represents the groups obtained from the ATOM records (and containing the actual ATOM information). This does the actual alignment and if a group can be mapped to a position in the SEQRES then the corresponding position is replaced with the group that contains the atoms. @param seqRes @param atomRes @return true if no match has been found
[ "Aligns", "two", "chains", "of", "groups", "where", "the", "first", "parent", "is", "representing", "the", "list", "of", "amino", "acids", "as", "obtained", "from", "the", "SEQRES", "records", "and", "the", "second", "parent", "represents", "the", "groups", ...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java#L574-L628
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/read/Buffer.java
Buffer.writeBytes
public void writeBytes(byte header, byte[] bytes) { int length = bytes.length; while (remaining() < length + 10) { grow(); } writeLength(length + 1); buf[position++] = header; System.arraycopy(bytes, 0, buf, position, length); position += length; }
java
public void writeBytes(byte header, byte[] bytes) { int length = bytes.length; while (remaining() < length + 10) { grow(); } writeLength(length + 1); buf[position++] = header; System.arraycopy(bytes, 0, buf, position, length); position += length; }
[ "public", "void", "writeBytes", "(", "byte", "header", ",", "byte", "[", "]", "bytes", ")", "{", "int", "length", "=", "bytes", ".", "length", ";", "while", "(", "remaining", "(", ")", "<", "length", "+", "10", ")", "{", "grow", "(", ")", ";", "}...
Write bytes. @param header header byte @param bytes command bytes
[ "Write", "bytes", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/Buffer.java#L379-L388
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java
RecommendationsInner.disableAllForWebAppAsync
public Observable<Void> disableAllForWebAppAsync(String resourceGroupName, String siteName) { return disableAllForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> disableAllForWebAppAsync(String resourceGroupName, String siteName) { return disableAllForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "disableAllForWebAppAsync", "(", "String", "resourceGroupName", ",", "String", "siteName", ")", "{", "return", "disableAllForWebAppWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ")", ".", "map", "(", "ne...
Disable all recommendations for an app. Disable all recommendations for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Disable", "all", "recommendations", "for", "an", "app", ".", "Disable", "all", "recommendations", "for", "an", "app", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1057-L1064
wisdom-framework/wisdom
framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/impl/WisdomTemplateEngine.java
WisdomTemplateEngine.process
public RenderableString process(Template template, Controller controller, Router router, Assets assets, Map<String, Object> variables) { Context ctx = new Context(); // Add session final org.wisdom.api.http.Context http = org.wisdom.api.http.Context.CONTEXT.get(); ctx.setVariables(http.session().getData()); // Add flash ctx.setVariables(http.flash().getCurrentFlashCookieData()); ctx.setVariables(http.flash().getOutgoingFlashCookieData()); // Add parameter from request, flattened for (Map.Entry<String, List<String>> entry : http.parameters().entrySet()) { if (entry.getValue().size() == 1) { ctx.setVariable(entry.getKey(), entry.getValue().get(0)); } else { ctx.setVariable(entry.getKey(), entry.getValue()); } } // Add request scope for (Map.Entry<String, Object> entry : http.request().data().entrySet()) { ctx.setVariable(entry.getKey(), entry.getValue()); } // Add variable. ctx.setVariables(variables); ctx.setVariable(Routes.ROUTES_VAR, new Routes(router, assets, controller)); // This variable let us resolve template using relative path (in the same directory as the current template). // It's mainly used for 'layout', so we can compute the full url. ctx.setVariable("__TEMPLATE__", template); StringWriter writer = new StringWriter(); try { this.process(template.fullName(), ctx, writer); } catch (TemplateProcessingException e) { // If we have a nested cause having a nested cause, heuristics say that it's the useful message. // Rebuild an exception using this data. if (e.getCause() != null && e.getCause().getCause() != null) { throw new TemplateProcessingException(e.getCause().getCause().getMessage(), e.getTemplateName(), e.getLineNumber(), e.getCause().getCause()); } else { throw e; } } return new RenderableString(writer, MimeTypes.HTML); }
java
public RenderableString process(Template template, Controller controller, Router router, Assets assets, Map<String, Object> variables) { Context ctx = new Context(); // Add session final org.wisdom.api.http.Context http = org.wisdom.api.http.Context.CONTEXT.get(); ctx.setVariables(http.session().getData()); // Add flash ctx.setVariables(http.flash().getCurrentFlashCookieData()); ctx.setVariables(http.flash().getOutgoingFlashCookieData()); // Add parameter from request, flattened for (Map.Entry<String, List<String>> entry : http.parameters().entrySet()) { if (entry.getValue().size() == 1) { ctx.setVariable(entry.getKey(), entry.getValue().get(0)); } else { ctx.setVariable(entry.getKey(), entry.getValue()); } } // Add request scope for (Map.Entry<String, Object> entry : http.request().data().entrySet()) { ctx.setVariable(entry.getKey(), entry.getValue()); } // Add variable. ctx.setVariables(variables); ctx.setVariable(Routes.ROUTES_VAR, new Routes(router, assets, controller)); // This variable let us resolve template using relative path (in the same directory as the current template). // It's mainly used for 'layout', so we can compute the full url. ctx.setVariable("__TEMPLATE__", template); StringWriter writer = new StringWriter(); try { this.process(template.fullName(), ctx, writer); } catch (TemplateProcessingException e) { // If we have a nested cause having a nested cause, heuristics say that it's the useful message. // Rebuild an exception using this data. if (e.getCause() != null && e.getCause().getCause() != null) { throw new TemplateProcessingException(e.getCause().getCause().getMessage(), e.getTemplateName(), e.getLineNumber(), e.getCause().getCause()); } else { throw e; } } return new RenderableString(writer, MimeTypes.HTML); }
[ "public", "RenderableString", "process", "(", "Template", "template", ",", "Controller", "controller", ",", "Router", "router", ",", "Assets", "assets", ",", "Map", "<", "String", ",", "Object", ">", "variables", ")", "{", "Context", "ctx", "=", "new", "Cont...
Renders the given template. <p> Variables from the session, flash and request parameters are added to the given parameters. @param template the template @param controller the template asking for the rendering @param router the router service @param variables the template parameters @return the rendered HTML page
[ "Renders", "the", "given", "template", ".", "<p", ">", "Variables", "from", "the", "session", "flash", "and", "request", "parameters", "are", "added", "to", "the", "given", "parameters", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/impl/WisdomTemplateEngine.java#L69-L115
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/updater/UpdaterBlock.java
UpdaterBlock.applyRegularization
protected void applyRegularization(Regularization.ApplyStep step, Trainable layer, String paramName, INDArray gradientView, INDArray paramsView, int iter, int epoch, double lr) { //TODO: do this for multiple contiguous params/layers (fewer, larger ops) List<Regularization> l = layer.getConfig().getRegularizationByParam(paramName); if(l != null && !l.isEmpty()){ for(Regularization r : l){ if(r.applyStep() == step){ r.apply(paramsView, gradientView, lr, iter, epoch); } } } }
java
protected void applyRegularization(Regularization.ApplyStep step, Trainable layer, String paramName, INDArray gradientView, INDArray paramsView, int iter, int epoch, double lr) { //TODO: do this for multiple contiguous params/layers (fewer, larger ops) List<Regularization> l = layer.getConfig().getRegularizationByParam(paramName); if(l != null && !l.isEmpty()){ for(Regularization r : l){ if(r.applyStep() == step){ r.apply(paramsView, gradientView, lr, iter, epoch); } } } }
[ "protected", "void", "applyRegularization", "(", "Regularization", ".", "ApplyStep", "step", ",", "Trainable", "layer", ",", "String", "paramName", ",", "INDArray", "gradientView", ",", "INDArray", "paramsView", ",", "int", "iter", ",", "int", "epoch", ",", "dou...
Apply L1 and L2 regularization, if necessary. Note that L1/L2 may differ for different layers in the same block @param layer The layer to apply L1/L2 to @param paramName Parameter name in the given layer @param gradientView Gradient view array for the layer + param @param paramsView Parameter view array for the layer + param
[ "Apply", "L1", "and", "L2", "regularization", "if", "necessary", ".", "Note", "that", "L1", "/", "L2", "may", "differ", "for", "different", "layers", "in", "the", "same", "block" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/updater/UpdaterBlock.java#L199-L210
sirthias/parboiled
parboiled-java/src/main/java/org/parboiled/transform/AsmUtils.java
AsmUtils.isAssignableTo
public static boolean isAssignableTo(String classInternalName, Class<?> type) { checkArgNotNull(classInternalName, "classInternalName"); checkArgNotNull(type, "type"); return type.isAssignableFrom(getClassForInternalName(classInternalName)); }
java
public static boolean isAssignableTo(String classInternalName, Class<?> type) { checkArgNotNull(classInternalName, "classInternalName"); checkArgNotNull(type, "type"); return type.isAssignableFrom(getClassForInternalName(classInternalName)); }
[ "public", "static", "boolean", "isAssignableTo", "(", "String", "classInternalName", ",", "Class", "<", "?", ">", "type", ")", "{", "checkArgNotNull", "(", "classInternalName", ",", "\"classInternalName\"", ")", ";", "checkArgNotNull", "(", "type", ",", "\"type\""...
Determines whether the class with the given descriptor is assignable to the given type. @param classInternalName the class descriptor @param type the type @return true if the class with the given descriptor is assignable to the given type
[ "Determines", "whether", "the", "class", "with", "the", "given", "descriptor", "is", "assignable", "to", "the", "given", "type", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-java/src/main/java/org/parboiled/transform/AsmUtils.java#L295-L299
pushbit/sprockets
src/main/java/net/sf/sprockets/util/Elements.java
Elements.addAll
public static boolean addAll(LongCollection collection, long[] array) { boolean changed = false; for (long element : array) { changed |= collection.add(element); } return changed; }
java
public static boolean addAll(LongCollection collection, long[] array) { boolean changed = false; for (long element : array) { changed |= collection.add(element); } return changed; }
[ "public", "static", "boolean", "addAll", "(", "LongCollection", "collection", ",", "long", "[", "]", "array", ")", "{", "boolean", "changed", "=", "false", ";", "for", "(", "long", "element", ":", "array", ")", "{", "changed", "|=", "collection", ".", "a...
Add all elements in the array to the collection. @return true if the collection was changed @since 2.6.0
[ "Add", "all", "elements", "in", "the", "array", "to", "the", "collection", "." ]
train
https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/util/Elements.java#L44-L50
casmi/casmi
src/main/java/casmi/graphics/element/Lines.java
Lines.setVertex
public void setVertex(int i, double x, double y) { this.x.set(i, x); this.y.set(i, y); this.z.set(i, 0d); calcG(); }
java
public void setVertex(int i, double x, double y) { this.x.set(i, x); this.y.set(i, y); this.z.set(i, 0d); calcG(); }
[ "public", "void", "setVertex", "(", "int", "i", ",", "double", "x", ",", "double", "y", ")", "{", "this", ".", "x", ".", "set", "(", "i", ",", "x", ")", ";", "this", ".", "y", ".", "set", "(", "i", ",", "y", ")", ";", "this", ".", "z", "....
Sets the coordinates of the point. @param i The index number of the point. @param x The x-coordinate of the point. @param y The y-coordinate of the point.
[ "Sets", "the", "coordinates", "of", "the", "point", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L151-L156
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/InverseGaussianDistribution.java
InverseGaussianDistribution.logpdf
public static double logpdf(double x, double mu, double shape) { if(!(x > 0) || x == Double.POSITIVE_INFINITY) { return x == x ? Double.NEGATIVE_INFINITY : Double.NaN; } final double v = (x - mu) / mu; return v < Double.MAX_VALUE ? 0.5 * FastMath.log(shape / (MathUtil.TWOPI * x * x * x)) - shape * v * v / (2. * x) : Double.NEGATIVE_INFINITY; }
java
public static double logpdf(double x, double mu, double shape) { if(!(x > 0) || x == Double.POSITIVE_INFINITY) { return x == x ? Double.NEGATIVE_INFINITY : Double.NaN; } final double v = (x - mu) / mu; return v < Double.MAX_VALUE ? 0.5 * FastMath.log(shape / (MathUtil.TWOPI * x * x * x)) - shape * v * v / (2. * x) : Double.NEGATIVE_INFINITY; }
[ "public", "static", "double", "logpdf", "(", "double", "x", ",", "double", "mu", ",", "double", "shape", ")", "{", "if", "(", "!", "(", "x", ">", "0", ")", "||", "x", "==", "Double", ".", "POSITIVE_INFINITY", ")", "{", "return", "x", "==", "x", "...
Probability density function of the Wald distribution. @param x The value. @param mu The mean. @param shape Shape parameter @return log PDF of the given Wald distribution at x.
[ "Probability", "density", "function", "of", "the", "Wald", "distribution", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/InverseGaussianDistribution.java#L181-L187
mbenson/therian
core/src/main/java/therian/operator/copy/BeanToMapCopier.java
BeanToMapCopier.supports
@Override public boolean supports(TherianContext context, Copy<? extends Object, ? extends Map> copy) { if (!super.supports(context, copy)) { return false; } final Type targetKeyType = getKeyType(copy.getTargetPosition()); final Position.ReadWrite<?> targetKey = Positions.readWrite(targetKeyType); return getProperties(context, copy.getSourcePosition()) .anyMatch(propertyName -> context.supports(Convert.to(targetKey, Positions.readOnly(propertyName)))); }
java
@Override public boolean supports(TherianContext context, Copy<? extends Object, ? extends Map> copy) { if (!super.supports(context, copy)) { return false; } final Type targetKeyType = getKeyType(copy.getTargetPosition()); final Position.ReadWrite<?> targetKey = Positions.readWrite(targetKeyType); return getProperties(context, copy.getSourcePosition()) .anyMatch(propertyName -> context.supports(Convert.to(targetKey, Positions.readOnly(propertyName)))); }
[ "@", "Override", "public", "boolean", "supports", "(", "TherianContext", "context", ",", "Copy", "<", "?", "extends", "Object", ",", "?", "extends", "Map", ">", "copy", ")", "{", "if", "(", "!", "super", ".", "supports", "(", "context", ",", "copy", ")...
If at least one property name can be converted to an assignable key, say the operation is supported and we'll give it a shot.
[ "If", "at", "least", "one", "property", "name", "can", "be", "converted", "to", "an", "assignable", "key", "say", "the", "operation", "is", "supported", "and", "we", "ll", "give", "it", "a", "shot", "." ]
train
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/operator/copy/BeanToMapCopier.java#L84-L94
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/cmp/cmppolicylabel_stats.java
cmppolicylabel_stats.get
public static cmppolicylabel_stats get(nitro_service service, String labelname) throws Exception{ cmppolicylabel_stats obj = new cmppolicylabel_stats(); obj.set_labelname(labelname); cmppolicylabel_stats response = (cmppolicylabel_stats) obj.stat_resource(service); return response; }
java
public static cmppolicylabel_stats get(nitro_service service, String labelname) throws Exception{ cmppolicylabel_stats obj = new cmppolicylabel_stats(); obj.set_labelname(labelname); cmppolicylabel_stats response = (cmppolicylabel_stats) obj.stat_resource(service); return response; }
[ "public", "static", "cmppolicylabel_stats", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "cmppolicylabel_stats", "obj", "=", "new", "cmppolicylabel_stats", "(", ")", ";", "obj", ".", "set_labelname", "(", "la...
Use this API to fetch statistics of cmppolicylabel_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "cmppolicylabel_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cmp/cmppolicylabel_stats.java#L149-L154
bullhorn/sdk-rest
src/main/java/com/bullhornsdk/data/api/helper/RestUriVariablesFactory.java
RestUriVariablesFactory.addModifyingUriVariables
private void addModifyingUriVariables(Map<String, String> uriVariables, BullhornEntityInfo entityInfo) { String bhRestToken = bullhornApiRest.getBhRestToken(); uriVariables.put(BH_REST_TOKEN, bhRestToken); uriVariables.put(ENTITY_TYPE, entityInfo.getName()); uriVariables.put(EXECUTE_FORM_TRIGGERS, bullhornApiRest.getExecuteFormTriggers() ? "true" : "false"); }
java
private void addModifyingUriVariables(Map<String, String> uriVariables, BullhornEntityInfo entityInfo) { String bhRestToken = bullhornApiRest.getBhRestToken(); uriVariables.put(BH_REST_TOKEN, bhRestToken); uriVariables.put(ENTITY_TYPE, entityInfo.getName()); uriVariables.put(EXECUTE_FORM_TRIGGERS, bullhornApiRest.getExecuteFormTriggers() ? "true" : "false"); }
[ "private", "void", "addModifyingUriVariables", "(", "Map", "<", "String", ",", "String", ">", "uriVariables", ",", "BullhornEntityInfo", "entityInfo", ")", "{", "String", "bhRestToken", "=", "bullhornApiRest", ".", "getBhRestToken", "(", ")", ";", "uriVariables", ...
Adds common URI Variables for calls that are creating, updating, or deleting data. Adds the execute form triggers url parameter if it has been configured. @param uriVariables The variables map to add the flag to @param entityInfo The bullhorn entity that is being modified by this call
[ "Adds", "common", "URI", "Variables", "for", "calls", "that", "are", "creating", "updating", "or", "deleting", "data", "." ]
train
https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/helper/RestUriVariablesFactory.java#L490-L495
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/parsing/ParserUtil.java
ParserUtil.parseCommandArgs
public static String parseCommandArgs(String commandLine, final CommandLineParser.CallbackHandler handler) throws CommandFormatException { if(commandLine == null) { return null; } final ParsingStateCallbackHandler callbackHandler = getCallbackHandler(handler); return StateParser.parse(commandLine, callbackHandler, ArgumentListState.INSTANCE); }
java
public static String parseCommandArgs(String commandLine, final CommandLineParser.CallbackHandler handler) throws CommandFormatException { if(commandLine == null) { return null; } final ParsingStateCallbackHandler callbackHandler = getCallbackHandler(handler); return StateParser.parse(commandLine, callbackHandler, ArgumentListState.INSTANCE); }
[ "public", "static", "String", "parseCommandArgs", "(", "String", "commandLine", ",", "final", "CommandLineParser", ".", "CallbackHandler", "handler", ")", "throws", "CommandFormatException", "{", "if", "(", "commandLine", "==", "null", ")", "{", "return", "null", ...
Returns the string which was actually parsed with all the substitutions performed
[ "Returns", "the", "string", "which", "was", "actually", "parsed", "with", "all", "the", "substitutions", "performed" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/parsing/ParserUtil.java#L170-L176
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PushbackReader.java
PushbackReader.unread
public void unread(char cbuf[], int off, int len) throws IOException { synchronized (lock) { ensureOpen(); if (len > pos) throw new IOException("Pushback buffer overflow"); pos -= len; System.arraycopy(cbuf, off, buf, pos, len); } }
java
public void unread(char cbuf[], int off, int len) throws IOException { synchronized (lock) { ensureOpen(); if (len > pos) throw new IOException("Pushback buffer overflow"); pos -= len; System.arraycopy(cbuf, off, buf, pos, len); } }
[ "public", "void", "unread", "(", "char", "cbuf", "[", "]", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "synchronized", "(", "lock", ")", "{", "ensureOpen", "(", ")", ";", "if", "(", "len", ">", "pos", ")", "throw", "new...
Pushes back a portion of an array of characters by copying it to the front of the pushback buffer. After this method returns, the next character to be read will have the value <code>cbuf[off]</code>, the character after that will have the value <code>cbuf[off+1]</code>, and so forth. @param cbuf Character array @param off Offset of first character to push back @param len Number of characters to push back @exception IOException If there is insufficient room in the pushback buffer, or if some other I/O error occurs
[ "Pushes", "back", "a", "portion", "of", "an", "array", "of", "characters", "by", "copying", "it", "to", "the", "front", "of", "the", "pushback", "buffer", ".", "After", "this", "method", "returns", "the", "next", "character", "to", "be", "read", "will", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PushbackReader.java#L174-L182
Erudika/para
para-core/src/main/java/com/erudika/para/utils/RegistryUtils.java
RegistryUtils.putValue
public static void putValue(String registryName, String key, Object value) { if (StringUtils.isBlank(registryName) || StringUtils.isBlank(key) || value == null) { return; } Sysprop registryObject = readRegistryObject(registryName); if (registryObject == null) { registryObject = new Sysprop(getRegistryID(registryName)); registryObject.addProperty(key, value); CoreUtils.getInstance().getDao().create(REGISTRY_APP_ID, registryObject); } else { registryObject.addProperty(key, value); CoreUtils.getInstance().getDao().update(REGISTRY_APP_ID, registryObject); } }
java
public static void putValue(String registryName, String key, Object value) { if (StringUtils.isBlank(registryName) || StringUtils.isBlank(key) || value == null) { return; } Sysprop registryObject = readRegistryObject(registryName); if (registryObject == null) { registryObject = new Sysprop(getRegistryID(registryName)); registryObject.addProperty(key, value); CoreUtils.getInstance().getDao().create(REGISTRY_APP_ID, registryObject); } else { registryObject.addProperty(key, value); CoreUtils.getInstance().getDao().update(REGISTRY_APP_ID, registryObject); } }
[ "public", "static", "void", "putValue", "(", "String", "registryName", ",", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "registryName", ")", "||", "StringUtils", ".", "isBlank", "(", "key", ")", "||", ...
Add a specific value to a registry. If the registry doesn't exist yet, create it. @param registryName the name of the registry. @param key the unique key corresponding to the value to insert (typically an appid). @param value the value to add to the registry.
[ "Add", "a", "specific", "value", "to", "a", "registry", ".", "If", "the", "registry", "doesn", "t", "exist", "yet", "create", "it", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/RegistryUtils.java#L44-L57
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java
SARLEclipsePlugin.openError
public void openError(Shell shell, String title, String message, Throwable exception) { final Throwable ex = (exception != null) ? Throwables.getRootCause(exception) : null; if (ex != null) { log(ex); final IStatus status = createStatus(IStatus.ERROR, message, ex); ErrorDialog.openError(shell, title, message, status); } else { MessageDialog.openError(shell, title, message); } }
java
public void openError(Shell shell, String title, String message, Throwable exception) { final Throwable ex = (exception != null) ? Throwables.getRootCause(exception) : null; if (ex != null) { log(ex); final IStatus status = createStatus(IStatus.ERROR, message, ex); ErrorDialog.openError(shell, title, message, status); } else { MessageDialog.openError(shell, title, message); } }
[ "public", "void", "openError", "(", "Shell", "shell", ",", "String", "title", ",", "String", "message", ",", "Throwable", "exception", ")", "{", "final", "Throwable", "ex", "=", "(", "exception", "!=", "null", ")", "?", "Throwables", ".", "getRootCause", "...
Display an error dialog and log the error. @param shell the parent container. @param title the title of the dialog box. @param message the message to display into the dialog box. @param exception the exception to be logged. @since 0.6 @see #log(Throwable)
[ "Display", "an", "error", "dialog", "and", "log", "the", "error", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java#L375-L384
phax/ph-javacc-maven-plugin
src/main/java/org/codehaus/mojo/javacc/UrlUtils.java
UrlUtils.getResourceRoot
public static File getResourceRoot (final URL url, final String resource) { String path = null; if (url != null) { final String spec = url.toExternalForm (); if ((JAR_FILE).regionMatches (true, 0, spec, 0, JAR_FILE.length ())) { URL jar; try { jar = new URL (spec.substring (JAR.length (), spec.lastIndexOf ("!/"))); } catch (final MalformedURLException e) { throw new IllegalArgumentException ("Invalid JAR URL: " + url + ", " + e.getMessage ()); } path = decodeUrl (jar.getPath ()); } else if (FILE.regionMatches (true, 0, spec, 0, FILE.length ())) { path = decodeUrl (url.getPath ()); path = path.substring (0, path.length () - resource.length ()); } else { throw new IllegalArgumentException ("Invalid class path URL: " + url); } } return path != null ? new File (path) : null; }
java
public static File getResourceRoot (final URL url, final String resource) { String path = null; if (url != null) { final String spec = url.toExternalForm (); if ((JAR_FILE).regionMatches (true, 0, spec, 0, JAR_FILE.length ())) { URL jar; try { jar = new URL (spec.substring (JAR.length (), spec.lastIndexOf ("!/"))); } catch (final MalformedURLException e) { throw new IllegalArgumentException ("Invalid JAR URL: " + url + ", " + e.getMessage ()); } path = decodeUrl (jar.getPath ()); } else if (FILE.regionMatches (true, 0, spec, 0, FILE.length ())) { path = decodeUrl (url.getPath ()); path = path.substring (0, path.length () - resource.length ()); } else { throw new IllegalArgumentException ("Invalid class path URL: " + url); } } return path != null ? new File (path) : null; }
[ "public", "static", "File", "getResourceRoot", "(", "final", "URL", "url", ",", "final", "String", "resource", ")", "{", "String", "path", "=", "null", ";", "if", "(", "url", "!=", "null", ")", "{", "final", "String", "spec", "=", "url", ".", "toExtern...
Gets the absolute filesystem path to the class path root for the specified resource. The root is either a JAR file or a directory with loose class files. If the URL does not use a supported protocol, an exception will be thrown. @param url The URL to the resource, may be <code>null</code>. @param resource The name of the resource, must not be <code>null</code>. @return The absolute filesystem path to the class path root of the resource or <code>null</code> if the input URL was <code>null</code>.
[ "Gets", "the", "absolute", "filesystem", "path", "to", "the", "class", "path", "root", "for", "the", "specified", "resource", ".", "The", "root", "is", "either", "a", "JAR", "file", "or", "a", "directory", "with", "loose", "class", "files", ".", "If", "t...
train
https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/UrlUtils.java#L70-L101
apache/flink
flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java
QueryableStateClient.getKvState
private CompletableFuture<KvStateResponse> getKvState( final JobID jobId, final String queryableStateName, final int keyHashCode, final byte[] serializedKeyAndNamespace) { LOG.debug("Sending State Request to {}.", remoteAddress); try { KvStateRequest request = new KvStateRequest(jobId, queryableStateName, keyHashCode, serializedKeyAndNamespace); return client.sendRequest(remoteAddress, request); } catch (Exception e) { LOG.error("Unable to send KVStateRequest: ", e); return FutureUtils.getFailedFuture(e); } }
java
private CompletableFuture<KvStateResponse> getKvState( final JobID jobId, final String queryableStateName, final int keyHashCode, final byte[] serializedKeyAndNamespace) { LOG.debug("Sending State Request to {}.", remoteAddress); try { KvStateRequest request = new KvStateRequest(jobId, queryableStateName, keyHashCode, serializedKeyAndNamespace); return client.sendRequest(remoteAddress, request); } catch (Exception e) { LOG.error("Unable to send KVStateRequest: ", e); return FutureUtils.getFailedFuture(e); } }
[ "private", "CompletableFuture", "<", "KvStateResponse", ">", "getKvState", "(", "final", "JobID", "jobId", ",", "final", "String", "queryableStateName", ",", "final", "int", "keyHashCode", ",", "final", "byte", "[", "]", "serializedKeyAndNamespace", ")", "{", "LOG...
Returns a future holding the serialized request result. @param jobId JobID of the job the queryable state belongs to @param queryableStateName Name under which the state is queryable @param keyHashCode Integer hash code of the key (result of a call to {@link Object#hashCode()} @param serializedKeyAndNamespace Serialized key and namespace to query KvState instance with @return Future holding the serialized result
[ "Returns", "a", "future", "holding", "the", "serialized", "request", "result", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/QueryableStateClient.java#L305-L318
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java
NodeImpl.validatePrefix
static String validatePrefix(String prefix, boolean namespaceAware, String namespaceURI) { if (!namespaceAware) { throw new DOMException(DOMException.NAMESPACE_ERR, prefix); } if (prefix != null) { if (namespaceURI == null || !DocumentImpl.isXMLIdentifier(prefix) || "xml".equals(prefix) && !"http://www.w3.org/XML/1998/namespace".equals(namespaceURI) || "xmlns".equals(prefix) && !"http://www.w3.org/2000/xmlns/".equals(namespaceURI)) { throw new DOMException(DOMException.NAMESPACE_ERR, prefix); } } return prefix; }
java
static String validatePrefix(String prefix, boolean namespaceAware, String namespaceURI) { if (!namespaceAware) { throw new DOMException(DOMException.NAMESPACE_ERR, prefix); } if (prefix != null) { if (namespaceURI == null || !DocumentImpl.isXMLIdentifier(prefix) || "xml".equals(prefix) && !"http://www.w3.org/XML/1998/namespace".equals(namespaceURI) || "xmlns".equals(prefix) && !"http://www.w3.org/2000/xmlns/".equals(namespaceURI)) { throw new DOMException(DOMException.NAMESPACE_ERR, prefix); } } return prefix; }
[ "static", "String", "validatePrefix", "(", "String", "prefix", ",", "boolean", "namespaceAware", ",", "String", "namespaceURI", ")", "{", "if", "(", "!", "namespaceAware", ")", "{", "throw", "new", "DOMException", "(", "DOMException", ".", "NAMESPACE_ERR", ",", ...
Validates the element or attribute namespace prefix on this node. @param namespaceAware whether this node is namespace aware @param namespaceURI this node's namespace URI
[ "Validates", "the", "element", "or", "attribute", "namespace", "prefix", "on", "this", "node", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java#L205-L220
orhanobut/dialogplus
dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java
DialogPlusBuilder.setFooter
public DialogPlusBuilder setFooter(@NonNull View view, boolean fixed) { this.footerView = view; this.fixedFooter = fixed; return this; }
java
public DialogPlusBuilder setFooter(@NonNull View view, boolean fixed) { this.footerView = view; this.fixedFooter = fixed; return this; }
[ "public", "DialogPlusBuilder", "setFooter", "(", "@", "NonNull", "View", "view", ",", "boolean", "fixed", ")", "{", "this", ".", "footerView", "=", "view", ";", "this", ".", "fixedFooter", "=", "fixed", ";", "return", "this", ";", "}" ]
Sets the given view as footer. @param fixed is used to determine whether footer should be fixed or not. Fixed if true, scrollable otherwise
[ "Sets", "the", "given", "view", "as", "footer", "." ]
train
https://github.com/orhanobut/dialogplus/blob/291bf4daaa3c81bf5537125f547913beb8ee2c17/dialogplus/src/main/java/com/orhanobut/dialogplus/DialogPlusBuilder.java#L101-L105
crowmagnumb/s6-util
src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java
AbstractMultipartUtility.addFilePart
public void addFilePart(final String fieldName, final InputStream stream, final String fileName, final String contentType) throws IOException { writer.append("--").append(boundary).append(LINE_FEED); writer.append("Content-Disposition: form-data; name=\"").append(fieldName).append("\""); if (fileName != null) { writer.append("; filename=\"").append(fileName).append("\""); } writer.append(LINE_FEED); writer.append("Content-Type: ").append(contentType).append(LINE_FEED); writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED); writer.append(LINE_FEED); writer.flush(); OsUtils.copyStreams(stream, outputStream); outputStream.flush(); writer.append(LINE_FEED); writer.flush(); }
java
public void addFilePart(final String fieldName, final InputStream stream, final String fileName, final String contentType) throws IOException { writer.append("--").append(boundary).append(LINE_FEED); writer.append("Content-Disposition: form-data; name=\"").append(fieldName).append("\""); if (fileName != null) { writer.append("; filename=\"").append(fileName).append("\""); } writer.append(LINE_FEED); writer.append("Content-Type: ").append(contentType).append(LINE_FEED); writer.append("Content-Transfer-Encoding: binary").append(LINE_FEED); writer.append(LINE_FEED); writer.flush(); OsUtils.copyStreams(stream, outputStream); outputStream.flush(); writer.append(LINE_FEED); writer.flush(); }
[ "public", "void", "addFilePart", "(", "final", "String", "fieldName", ",", "final", "InputStream", "stream", ",", "final", "String", "fileName", ",", "final", "String", "contentType", ")", "throws", "IOException", "{", "writer", ".", "append", "(", "\"--\"", "...
Adds a upload file section to the request @param fieldName name attribute in &lt;input type="file" name="..." /&gt; @param stream input stream of data to upload @param fileName name of file represented by this input stream @param contentType content type of data @throws IOException if problems
[ "Adds", "a", "upload", "file", "section", "to", "the", "request" ]
train
https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java#L105-L127