method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix) { int matrixWidgth = matrix.getWidth(); int matrixHeight = matrix.getHeight(); BitMatrix output = new BitMatrix(matrixWidgth, matrixHeight); output.clear(); for (int i = 0; i < matrixWidgth; i++) { for (int j = 0; j < matrixHeight; j++) { // Zero is white in the bytematrix if (matrix.get(i, j) == 1) { output.set(i, j); } } } return output; }
static BitMatrix function(ByteMatrix matrix) { int matrixWidgth = matrix.getWidth(); int matrixHeight = matrix.getHeight(); BitMatrix output = new BitMatrix(matrixWidgth, matrixHeight); output.clear(); for (int i = 0; i < matrixWidgth; i++) { for (int j = 0; j < matrixHeight; j++) { if (matrix.get(i, j) == 1) { output.set(i, j); } } } return output; }
/** * Convert the ByteMatrix to BitMatrix. * * @param matrix * The input matrix. * @return The output matrix. */
Convert the ByteMatrix to BitMatrix
convertByteMatrixToBitMatrix
{ "repo_name": "cping/RipplePower", "path": "eclipse/RipplePower/src/com/google/zxing/datamatrix/DataMatrixWriter.java", "license": "apache-2.0", "size": 5654 }
[ "com.google.zxing.common.BitMatrix", "com.google.zxing.qrcode.encoder.ByteMatrix" ]
import com.google.zxing.common.BitMatrix; import com.google.zxing.qrcode.encoder.ByteMatrix;
import com.google.zxing.common.*; import com.google.zxing.qrcode.encoder.*;
[ "com.google.zxing" ]
com.google.zxing;
1,221,334
public MethodTree getContainingMethod(Tree t) { return cfg.getContainingMethod(t); }
MethodTree function(Tree t) { return cfg.getContainingMethod(t); }
/** * Get the {@link MethodTree} of the current CFG if the argument {@link Tree} maps * to a {@link Node} in the CFG or null otherwise. */
Get the <code>MethodTree</code> of the current CFG if the argument <code>Tree</code> maps to a <code>Node</code> in the CFG or null otherwise
getContainingMethod
{ "repo_name": "kchodorow/bazel-1", "path": "third_party/checker_framework_dataflow/java/org/checkerframework/dataflow/analysis/Analysis.java", "license": "apache-2.0", "size": 26060 }
[ "com.sun.source.tree.MethodTree", "com.sun.source.tree.Tree" ]
import com.sun.source.tree.MethodTree; import com.sun.source.tree.Tree;
import com.sun.source.tree.*;
[ "com.sun.source" ]
com.sun.source;
750,288
public static MozuUrl getViewEntitiesUrl(String entityListFullName, String filter, Integer pageSize, String responseFields, Integer startIndex, String viewName) { UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/views/{viewName}/entities?pageSize={pageSize}&startIndex={startIndex}&filter={filter}&responseFields={responseFields}"); formatter.formatUrl("entityListFullName", entityListFullName); formatter.formatUrl("filter", filter); formatter.formatUrl("pageSize", pageSize); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("startIndex", startIndex); formatter.formatUrl("viewName", viewName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
static MozuUrl function(String entityListFullName, String filter, Integer pageSize, String responseFields, Integer startIndex, String viewName) { UrlFormatter formatter = new UrlFormatter(STR); formatter.formatUrl(STR, entityListFullName); formatter.formatUrl(STR, filter); formatter.formatUrl(STR, pageSize); formatter.formatUrl(STR, responseFields); formatter.formatUrl(STR, startIndex); formatter.formatUrl(STR, viewName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
/** * Get Resource Url for GetViewEntities * @param entityListFullName The full name of the EntityList including namespace in name@nameSpace format * @param filter A set of filter expressions representing the search parameters for a query. This parameter is optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for a list of supported filters. * @param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50. * @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. * @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50. * @param viewName The name for a view. Views are used to render data in , such as document and entity lists. Each view includes a schema, format, name, ID, and associated data types to render. * @return String Resource Url */
Get Resource Url for GetViewEntities
getViewEntitiesUrl
{ "repo_name": "Mozu/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/entitylists/ListViewUrl.java", "license": "mit", "size": 12678 }
[ "com.mozu.api.MozuUrl", "com.mozu.api.utils.UrlFormatter" ]
import com.mozu.api.MozuUrl; import com.mozu.api.utils.UrlFormatter;
import com.mozu.api.*; import com.mozu.api.utils.*;
[ "com.mozu.api" ]
com.mozu.api;
2,311,942
public AdaptrisMessage translate(Message msg) throws JMSException { MapMessage jmsMsg = (MapMessage) msg; AdaptrisMessage result = currentMessageFactory().newMessage(jmsMsg.getString(getKeyForPayload())); Enumeration e = jmsMsg.getMapNames(); while (e.hasMoreElements()) { String mapName = (String) e.nextElement(); if (!mapName.equals(getKeyForPayload())) { result.addMetadata(mapName, jmsMsg.getString(mapName)); } } return helper.moveMetadata(msg, result); }
AdaptrisMessage function(Message msg) throws JMSException { MapMessage jmsMsg = (MapMessage) msg; AdaptrisMessage result = currentMessageFactory().newMessage(jmsMsg.getString(getKeyForPayload())); Enumeration e = jmsMsg.getMapNames(); while (e.hasMoreElements()) { String mapName = (String) e.nextElement(); if (!mapName.equals(getKeyForPayload())) { result.addMetadata(mapName, jmsMsg.getString(mapName)); } } return helper.moveMetadata(msg, result); }
/** * <p> * Translates a MapMessage into an {@link com.adaptris.core.AdaptrisMessage}. * </p> * * @param msg the <code>MapMessage</code> to translate * @return an <code>AdaptrisMessage</code> * @throws JMSException */
Translates a MapMessage into an <code>com.adaptris.core.AdaptrisMessage</code>.
translate
{ "repo_name": "mcwarman/interlok", "path": "adapter/src/main/java/com/adaptris/core/jms/MapMessageTranslator.java", "license": "apache-2.0", "size": 5363 }
[ "com.adaptris.core.AdaptrisMessage", "java.util.Enumeration", "javax.jms.JMSException", "javax.jms.MapMessage", "javax.jms.Message" ]
import com.adaptris.core.AdaptrisMessage; import java.util.Enumeration; import javax.jms.JMSException; import javax.jms.MapMessage; import javax.jms.Message;
import com.adaptris.core.*; import java.util.*; import javax.jms.*;
[ "com.adaptris.core", "java.util", "javax.jms" ]
com.adaptris.core; java.util; javax.jms;
2,896,163
public void setScript(File script) { this.script = script; }
void function(File script) { this.script = script; }
/** * Sets the script {@link File} that will be included in the executable archive. When * {@code null}, the default launch script will be used. * @param script the script file */
Sets the script <code>File</code> that will be included in the executable archive. When null, the default launch script will be used
setScript
{ "repo_name": "bclozel/spring-boot", "path": "spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java", "license": "apache-2.0", "size": 3223 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,289,746
return new AvroDeserializationSchema<>(GenericRecord.class, schema); }
return new AvroDeserializationSchema<>(GenericRecord.class, schema); }
/** * Creates {@link AvroDeserializationSchema} that produces {@link GenericRecord} using provided schema. * * @param schema schema of produced records * @return deserialized record in form of {@link GenericRecord} */
Creates <code>AvroDeserializationSchema</code> that produces <code>GenericRecord</code> using provided schema
forGeneric
{ "repo_name": "zhangminglei/flink", "path": "flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroDeserializationSchema.java", "license": "apache-2.0", "size": 5639 }
[ "org.apache.avro.generic.GenericRecord" ]
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.generic.*;
[ "org.apache.avro" ]
org.apache.avro;
690,251
@Override public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { Log.d(Tag, "onCharacteristicRead"); }
void function(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { Log.d(Tag, STR); }
/** *Callback reporting the result of a characteristic read operation. * * @param gatt * @param characteristic * @param status */
Callback reporting the result of a characteristic read operation
onCharacteristicRead
{ "repo_name": "wuhighway/DailyStudy", "path": "app/src/main/java/com/highway/study/bluetooth/BleActivity.java", "license": "apache-2.0", "size": 7402 }
[ "android.bluetooth.BluetoothGatt", "android.bluetooth.BluetoothGattCharacteristic", "android.util.Log" ]
import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.util.Log;
import android.bluetooth.*; import android.util.*;
[ "android.bluetooth", "android.util" ]
android.bluetooth; android.util;
2,188,196
public static void showPointsInImage(Molecule[] mols, ImagePlus imp, Rectangle roi, Color c, int markerType) { Overlay overlay = imp.getOverlay(); if(overlay == null) { overlay = new Overlay(); } if(roi == null) { Roi r = imp.getRoi(); if(r != null) { roi = r.getBounds(); } else { roi = new Rectangle(0, 0, imp.getWidth(), imp.getHeight()); } }
static void function(Molecule[] mols, ImagePlus imp, Rectangle roi, Color c, int markerType) { Overlay overlay = imp.getOverlay(); if(overlay == null) { overlay = new Overlay(); } if(roi == null) { Roi r = imp.getRoi(); if(r != null) { roi = r.getBounds(); } else { roi = new Rectangle(0, 0, imp.getWidth(), imp.getHeight()); } }
/** * Shows molecule locations in image overlay. Compound molecules are not * expanded - only the parent molecule is shown. * * @param mols * @param imp * @param roi * @param c * @param markerType */
Shows molecule locations in image overlay. Compound molecules are not expanded - only the parent molecule is shown
showPointsInImage
{ "repo_name": "sbesson/thunderstorm", "path": "src/main/java/cz/cuni/lf1/lge/ThunderSTORM/UI/RenderingOverlay.java", "license": "gpl-3.0", "size": 9361 }
[ "cz.cuni.lf1.lge.ThunderSTORM", "java.awt.Color", "java.awt.Rectangle" ]
import cz.cuni.lf1.lge.ThunderSTORM; import java.awt.Color; import java.awt.Rectangle;
import cz.cuni.lf1.lge.*; import java.awt.*;
[ "cz.cuni.lf1", "java.awt" ]
cz.cuni.lf1; java.awt;
2,153,331
public synchronized Async<List<String>> startNodesAsync(final int numNodes) { return startNodesAsync(numNodes, Settings.EMPTY, Version.CURRENT); }
synchronized Async<List<String>> function(final int numNodes) { return startNodesAsync(numNodes, Settings.EMPTY, Version.CURRENT); }
/** * Starts multiple nodes in an async manner and returns future with its name. */
Starts multiple nodes in an async manner and returns future with its name
startNodesAsync
{ "repo_name": "clintongormley/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java", "license": "apache-2.0", "size": 81745 }
[ "java.util.List", "org.elasticsearch.Version", "org.elasticsearch.common.settings.Settings" ]
import java.util.List; import org.elasticsearch.Version; import org.elasticsearch.common.settings.Settings;
import java.util.*; import org.elasticsearch.*; import org.elasticsearch.common.settings.*;
[ "java.util", "org.elasticsearch", "org.elasticsearch.common" ]
java.util; org.elasticsearch; org.elasticsearch.common;
309,777
public synchronized Set<String> getAllLeafChildren(String parent) { if (parent == null || parent.length() == 0) { //return new ArrayList<String>(); return null; } HashSet<String> allChildSet = new HashSet<String>(); ArrayList<String> children = getImmediateChildren(parent); if (!children.isEmpty()) { for (String child : children) { //run _getAllLeafChildren(child, allChildSet); } } //at all. // if (!allChildSet.isEmpty()) { // ArrayList<String> result = new ArrayList<String>(allChildSet); // Collections.sort(result); // return result; // } else { // return new ArrayList<String>(); // } return allChildSet; }
synchronized Set<String> function(String parent) { if (parent == null parent.length() == 0) { return null; } HashSet<String> allChildSet = new HashSet<String>(); ArrayList<String> children = getImmediateChildren(parent); if (!children.isEmpty()) { for (String child : children) { _getAllLeafChildren(child, allChildSet); } } return allChildSet; }
/** * get all child nodes from one node * * @param parent * @return */
get all child nodes from one node
getAllLeafChildren
{ "repo_name": "sugang/coolmap", "path": "src/coolmap/data/contology/model/COntology.java", "license": "gpl-2.0", "size": 28672 }
[ "java.util.ArrayList", "java.util.HashSet", "java.util.Set" ]
import java.util.ArrayList; import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
489,421
public static FontInfo buildDefaultJava2DBasedFontInfo( FontInfo fontInfo, FOUserAgent userAgent) { Java2DFontMetrics java2DFontMetrics = new Java2DFontMetrics(); FontManager fontManager = userAgent.getFactory().getFontManager(); FontCollection[] fontCollections = new FontCollection[] { new org.apache.fop.render.java2d.Base14FontCollection(java2DFontMetrics), new InstalledFontCollection(java2DFontMetrics) }; FontInfo fi = (fontInfo != null ? fontInfo : new FontInfo()); fi.setEventListener(new FontEventAdapter(userAgent.getEventBroadcaster())); fontManager.setup(fi, fontCollections); return fi; }
static FontInfo function( FontInfo fontInfo, FOUserAgent userAgent) { Java2DFontMetrics java2DFontMetrics = new Java2DFontMetrics(); FontManager fontManager = userAgent.getFactory().getFontManager(); FontCollection[] fontCollections = new FontCollection[] { new org.apache.fop.render.java2d.Base14FontCollection(java2DFontMetrics), new InstalledFontCollection(java2DFontMetrics) }; FontInfo fi = (fontInfo != null ? fontInfo : new FontInfo()); fi.setEventListener(new FontEventAdapter(userAgent.getEventBroadcaster())); fontManager.setup(fi, fontCollections); return fi; }
/** * Builds a default {@link FontInfo} object for use with output formats using the Java2D * font setup. * @param fontInfo the font info object to populate * @param userAgent the user agent * @return the populated font information object */
Builds a default <code>FontInfo</code> object for use with output formats using the Java2D font setup
buildDefaultJava2DBasedFontInfo
{ "repo_name": "Distrotech/fop", "path": "src/java/org/apache/fop/render/java2d/Java2DUtil.java", "license": "apache-2.0", "size": 2184 }
[ "org.apache.fop.apps.FOUserAgent", "org.apache.fop.fonts.FontCollection", "org.apache.fop.fonts.FontEventAdapter", "org.apache.fop.fonts.FontInfo", "org.apache.fop.fonts.FontManager" ]
import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fonts.FontCollection; import org.apache.fop.fonts.FontEventAdapter; import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontManager;
import org.apache.fop.apps.*; import org.apache.fop.fonts.*;
[ "org.apache.fop" ]
org.apache.fop;
2,236,424
default AdvancedBoxEndpointConsumerBuilder pollStrategy( PollingConsumerPollStrategy pollStrategy) { doSetProperty("pollStrategy", pollStrategy); return this; }
default AdvancedBoxEndpointConsumerBuilder pollStrategy( PollingConsumerPollStrategy pollStrategy) { doSetProperty(STR, pollStrategy); return this; }
/** * A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing * you to provide your custom implementation to control error handling * usually occurred during the poll operation before an Exchange have * been created and being routed in Camel. * * The option is a: * <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type. * * Group: consumer (advanced) */
A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. The option is a: <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type. Group: consumer (advanced)
pollStrategy
{ "repo_name": "CodeSmell/camel", "path": "core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/BoxEndpointBuilderFactory.java", "license": "apache-2.0", "size": 61191 }
[ "org.apache.camel.spi.PollingConsumerPollStrategy" ]
import org.apache.camel.spi.PollingConsumerPollStrategy;
import org.apache.camel.spi.*;
[ "org.apache.camel" ]
org.apache.camel;
862,346
@ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux<PollResult<ServerSecurityAlertPolicyInner>, ServerSecurityAlertPolicyInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicyInner parameters) { Mono<Response<Flux<ByteBuffer>>> mono = createOrUpdateWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters); return this .client .<ServerSecurityAlertPolicyInner, ServerSecurityAlertPolicyInner>getLroResult( mono, this.client.getHttpPipeline(), ServerSecurityAlertPolicyInner.class, ServerSecurityAlertPolicyInner.class, Context.NONE); }
@ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<ServerSecurityAlertPolicyInner>, ServerSecurityAlertPolicyInner> function( String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicyInner parameters) { Mono<Response<Flux<ByteBuffer>>> mono = createOrUpdateWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters); return this .client .<ServerSecurityAlertPolicyInner, ServerSecurityAlertPolicyInner>getLroResult( mono, this.client.getHttpPipeline(), ServerSecurityAlertPolicyInner.class, ServerSecurityAlertPolicyInner.class, Context.NONE); }
/** * Creates or updates a threat detection policy. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param securityAlertPolicyName The name of the threat detection policy. * @param parameters The server security alert policy. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a server security alert policy. */
Creates or updates a threat detection policy
beginCreateOrUpdateAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesClientImpl.java", "license": "mit", "size": 43102 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.management.polling.PollResult", "com.azure.core.util.Context", "com.azure.core.util.polling.PollerFlux", "com.azure.resourcemanager.mariadb.fluent.models.ServerSecurity...
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.PollerFlux; import com.azure.resourcemanager.mariadb.fluent.models.ServerSecurityAlertPolicyInner; import com.azure.resourcemanager.mariadb.models.SecurityAlertPolicyName; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.mariadb.fluent.models.*; import com.azure.resourcemanager.mariadb.models.*; import java.nio.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.nio" ]
com.azure.core; com.azure.resourcemanager; java.nio;
1,896,163
@Override public PerformanceVector getOptimizationPerformance() { double finalFitness = getFitness(svmExamples.get_alphas(), svmExamples.get_ys(), kernel); PerformanceVector result = new PerformanceVector(); result.addCriterion(new EstimatedPerformance("svm_objective_function", finalFitness, 1, false)); result.addCriterion(new EstimatedPerformance("no_support_vectors", svmExamples.getNumberOfSupportVectors(), 1, true)); return result; }
PerformanceVector function() { double finalFitness = getFitness(svmExamples.get_alphas(), svmExamples.get_ys(), kernel); PerformanceVector result = new PerformanceVector(); result.addCriterion(new EstimatedPerformance(STR, finalFitness, 1, false)); result.addCriterion(new EstimatedPerformance(STR, svmExamples.getNumberOfSupportVectors(), 1, true)); return result; }
/** * Returns the optimization performance of the best result. This method must be called after * training, not before. */
Returns the optimization performance of the best result. This method must be called after training, not before
getOptimizationPerformance
{ "repo_name": "transwarpio/rapidminer", "path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/operator/learner/functions/kernel/AbstractMySVMLearner.java", "license": "gpl-3.0", "size": 18780 }
[ "com.rapidminer.operator.performance.EstimatedPerformance", "com.rapidminer.operator.performance.PerformanceVector" ]
import com.rapidminer.operator.performance.EstimatedPerformance; import com.rapidminer.operator.performance.PerformanceVector;
import com.rapidminer.operator.performance.*;
[ "com.rapidminer.operator" ]
com.rapidminer.operator;
2,373,579
@Override int compileIfStatic(CtClass type, String name, Bytecode code, Javac drv) throws CannotCompileException { String desc; int stacksize = 1; if (stringParams == null) desc = "()"; else { desc = "([Ljava/lang/String;)"; stacksize += compileStringParameter(code); } String typeDesc = Descriptor.of(type); code.addInvokestatic(objectType, methodName, desc + typeDesc); code.addPutstatic(Bytecode.THIS, name, typeDesc); return stacksize; } } static class IntInitializer extends Initializer { int value; IntInitializer(int v) { value = v; }
int compileIfStatic(CtClass type, String name, Bytecode code, Javac drv) throws CannotCompileException { String desc; int stacksize = 1; if (stringParams == null) desc = "()"; else { desc = STR; stacksize += compileStringParameter(code); } String typeDesc = Descriptor.of(type); code.addInvokestatic(objectType, methodName, desc + typeDesc); code.addPutstatic(Bytecode.THIS, name, typeDesc); return stacksize; } } static class IntInitializer extends Initializer { int value; IntInitializer(int v) { value = v; }
/** * Produces codes for a static field. */
Produces codes for a static field
compileIfStatic
{ "repo_name": "HotswapProjects/HotswapAgent", "path": "hotswap-agent-core/src/main/java/org/hotswap/agent/javassist/CtField.java", "license": "gpl-2.0", "size": 51869 }
[ "org.hotswap.agent.javassist.bytecode.Bytecode", "org.hotswap.agent.javassist.bytecode.Descriptor", "org.hotswap.agent.javassist.compiler.Javac" ]
import org.hotswap.agent.javassist.bytecode.Bytecode; import org.hotswap.agent.javassist.bytecode.Descriptor; import org.hotswap.agent.javassist.compiler.Javac;
import org.hotswap.agent.javassist.bytecode.*; import org.hotswap.agent.javassist.compiler.*;
[ "org.hotswap.agent" ]
org.hotswap.agent;
263,840
private boolean busyRun(Runnable r, GridBusyLock taskLock) { if (!taskLock.enterBusy()) return false; try { if (!active) return false; r.run(); return true; } catch (Throwable t) { if (stopping.get()) log.debug("Unexpected exception on statistics processing: " + t); else log.warning("Unexpected exception on statistics processing: " + t.getMessage(), t); } finally { taskLock.leaveBusy(); } return false; }
boolean function(Runnable r, GridBusyLock taskLock) { if (!taskLock.enterBusy()) return false; try { if (!active) return false; r.run(); return true; } catch (Throwable t) { if (stopping.get()) log.debug(STR + t); else log.warning(STR + t.getMessage(), t); } finally { taskLock.leaveBusy(); } return false; }
/** * Run task under specified busyLock. * * @param r Task to run. * @param taskLock BusyLock to use. * @return {@code true} if task was succesfully scheduled, {@code false} - otherwise (due to inactive state). */
Run task under specified busyLock
busyRun
{ "repo_name": "NSAmelchev/ignite", "path": "modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/stat/BusyExecutor.java", "license": "apache-2.0", "size": 5912 }
[ "org.apache.ignite.internal.util.GridBusyLock" ]
import org.apache.ignite.internal.util.GridBusyLock;
import org.apache.ignite.internal.util.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,461,188
public void setS3Client(@javax.validation.constraints.NotNull AmazonS3 s3Client) { Preconditions.checkNotNull(s3Client); this.s3Client = s3Client; }
void function(@javax.validation.constraints.NotNull AmazonS3 s3Client) { Preconditions.checkNotNull(s3Client); this.s3Client = s3Client; }
/** * Set the AmazonS3 service * * @param s3Client * given s3Client */
Set the AmazonS3 service
setS3Client
{ "repo_name": "vrozov/apex-malhar", "path": "library/src/main/java/org/apache/apex/malhar/lib/fs/s3/S3RecordReader.java", "license": "apache-2.0", "size": 16612 }
[ "com.amazonaws.services.s3.AmazonS3", "com.esotericsoftware.kryo.NotNull", "com.google.common.base.Preconditions" ]
import com.amazonaws.services.s3.AmazonS3; import com.esotericsoftware.kryo.NotNull; import com.google.common.base.Preconditions;
import com.amazonaws.services.s3.*; import com.esotericsoftware.kryo.*; import com.google.common.base.*;
[ "com.amazonaws.services", "com.esotericsoftware.kryo", "com.google.common" ]
com.amazonaws.services; com.esotericsoftware.kryo; com.google.common;
721,731
public void walkFileTree(Path root, FileVisitor<Path> fileVisitor) throws IOException { Files.walkFileTree(root, fileVisitor); }
void function(Path root, FileVisitor<Path> fileVisitor) throws IOException { Files.walkFileTree(root, fileVisitor); }
/** * Allows {@link Files#walkFileTree} to be faked in tests. */
Allows <code>Files#walkFileTree</code> to be faked in tests
walkFileTree
{ "repo_name": "hgl888/buck", "path": "src/com/facebook/buck/io/ProjectFilesystem.java", "license": "apache-2.0", "size": 31785 }
[ "java.io.IOException", "java.nio.file.FileVisitor", "java.nio.file.Files", "java.nio.file.Path" ]
import java.io.IOException; import java.nio.file.FileVisitor; import java.nio.file.Files; import java.nio.file.Path;
import java.io.*; import java.nio.file.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
1,596,431
@Deprecated @Override public final void sort(Comparator<? super E> c) { throw new UnsupportedOperationException(); }
final void function(Comparator<? super E> c) { throw new UnsupportedOperationException(); }
/** * Guaranteed to throw an exception and leave the list unmodified. * * @throws UnsupportedOperationException always * @deprecated Unsupported operation. */
Guaranteed to throw an exception and leave the list unmodified
sort
{ "repo_name": "DavesMan/guava", "path": "guava/src/com/google/common/collect/ImmutableList.java", "license": "apache-2.0", "size": 24801 }
[ "java.util.Comparator" ]
import java.util.Comparator;
import java.util.*;
[ "java.util" ]
java.util;
864,374
public static int getNumParametersForInvocation(InvokeInstruction inv, ConstantPoolGen cpg) { SignatureParser sigParser = new SignatureParser(inv.getSignature(cpg)); return sigParser.getNumParameters(); }
static int function(InvokeInstruction inv, ConstantPoolGen cpg) { SignatureParser sigParser = new SignatureParser(inv.getSignature(cpg)); return sigParser.getNumParameters(); }
/** * Get the number of parameters passed to method invocation. * * @param inv * @param cpg * @return int number of parameters */
Get the number of parameters passed to method invocation
getNumParametersForInvocation
{ "repo_name": "OpenNTF/FindBug-for-Domino-Designer", "path": "findBugsEclipsePlugin/src/edu/umd/cs/findbugs/ba/SignatureParser.java", "license": "lgpl-3.0", "size": 8462 }
[ "org.apache.bcel.generic.ConstantPoolGen", "org.apache.bcel.generic.InvokeInstruction" ]
import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.InvokeInstruction;
import org.apache.bcel.generic.*;
[ "org.apache.bcel" ]
org.apache.bcel;
879,113
List<ByteArrayEntity> findAll();
List<ByteArrayEntity> findAll();
/** * Returns all {@link ByteArrayEntity}. */
Returns all <code>ByteArrayEntity</code>
findAll
{ "repo_name": "roberthafner/flowable-engine", "path": "modules/flowable-engine/src/main/java/org/activiti/engine/impl/persistence/entity/ByteArrayEntityManager.java", "license": "apache-2.0", "size": 1188 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
550,752
private void setCurrenciesRate(Activity activity, int rateBy) { updateCurrenciesRateTitle(activity, rateBy); currencyListAdapter.setRateBy(rateBy); currencyListAdapter.notifyDataSetChanged(); }
void function(Activity activity, int rateBy) { updateCurrenciesRateTitle(activity, rateBy); currencyListAdapter.setRateBy(rateBy); currencyListAdapter.notifyDataSetChanged(); }
/** * Shows buy/sell currencies rate info */
Shows buy/sell currencies rate info
setCurrenciesRate
{ "repo_name": "vexelon-dot-net/currencybg.app", "path": "src/main/java/net/vexelon/currencybg/app/ui/fragments/CurrenciesFragment.java", "license": "gpl-3.0", "size": 26937 }
[ "android.app.Activity" ]
import android.app.Activity;
import android.app.*;
[ "android.app" ]
android.app;
1,851,101
public void setLinkKind(Link link) { setEntityKind(link, OcciCoreConstants.OCCI_CORE_LINK_TERM); }
void function(Link link) { setEntityKind(link, OcciCoreConstants.OCCI_CORE_LINK_TERM); }
/** * Set the initial kind of a Link. */
Set the initial kind of a Link
setLinkKind
{ "repo_name": "occiware/OCCI-Studio", "path": "plugins/org.eclipse.cmf.occi.core.design/src/org/eclipse/cmf/occi/core/design/services/DesignServices.java", "license": "epl-1.0", "size": 9999 }
[ "org.eclipse.cmf.occi.core.Link", "org.eclipse.cmf.occi.core.OcciCoreConstants" ]
import org.eclipse.cmf.occi.core.Link; import org.eclipse.cmf.occi.core.OcciCoreConstants;
import org.eclipse.cmf.occi.core.*;
[ "org.eclipse.cmf" ]
org.eclipse.cmf;
423,238
public void setBytes(byte[] bytes) { this.bytes = bytes; } /** * Returns the current used digest algorithm for a DigestDocument * * @return {@link DigestAlgorithm}
void function(byte[] bytes) { this.bytes = bytes; } /** * Returns the current used digest algorithm for a DigestDocument * * @return {@link DigestAlgorithm}
/** * Sets binaries of the document or its digest value (for DigestDocument). * * @param bytes binaries of the document or its digest value (for DigestDocument) */
Sets binaries of the document or its digest value (for DigestDocument)
setBytes
{ "repo_name": "esig/dss", "path": "dss-common-remote-dto/src/main/java/eu/europa/esig/dss/ws/dto/RemoteDocument.java", "license": "lgpl-2.1", "size": 4628 }
[ "eu.europa.esig.dss.enumerations.DigestAlgorithm" ]
import eu.europa.esig.dss.enumerations.DigestAlgorithm;
import eu.europa.esig.dss.enumerations.*;
[ "eu.europa.esig" ]
eu.europa.esig;
39,808
public byte[] randomBytesDeterministic(byte[] seed, int size) { if (seed == null || seed.length != RANDOMBYTES_SEEDBYTES) throw new RuntimeException("Invalid size: " + seed.length); byte[] buffer = new byte[size]; sodium().randombytes_buf_deterministic(buffer, size, seed); return buffer; }
byte[] function(byte[] seed, int size) { if (seed == null seed.length != RANDOMBYTES_SEEDBYTES) throw new RuntimeException(STR + seed.length); byte[] buffer = new byte[size]; sodium().randombytes_buf_deterministic(buffer, size, seed); return buffer; }
/** * Deterministically generate pseudorandom bytes of length 'size' from a seed * * @param seed the seed to generate the bytes from * @param size the size of the buffer * @return Byte array with deterministically generated pseudorandom bytes */
Deterministically generate pseudorandom bytes of length 'size' from a seed
randomBytesDeterministic
{ "repo_name": "joshjdevl/kalium-jni", "path": "src/main/java/org/libsodium/jni/crypto/Random.java", "license": "apache-2.0", "size": 1926 }
[ "org.libsodium.jni.NaCl" ]
import org.libsodium.jni.NaCl;
import org.libsodium.jni.*;
[ "org.libsodium.jni" ]
org.libsodium.jni;
2,025,012
protected boolean isForceDelete() { return getParameterConverter().toBoolean(getProperties(), EntityEventProcessor.PROPERTY_FORCE_DELETE, false); }
boolean function() { return getParameterConverter().toBoolean(getProperties(), EntityEventProcessor.PROPERTY_FORCE_DELETE, false); }
/** * True - force (~asynchronous) delete - cascade delete for all related entities. * * @return true - force * @since 11.1.0 */
True - force (~asynchronous) delete - cascade delete for all related entities
isForceDelete
{ "repo_name": "bcvsolutions/CzechIdMng", "path": "Realization/backend/core/core-api/src/main/java/eu/bcvsolutions/idm/core/api/bulk/action/AbstractRemoveBulkAction.java", "license": "mit", "size": 3472 }
[ "eu.bcvsolutions.idm.core.api.event.EntityEventProcessor" ]
import eu.bcvsolutions.idm.core.api.event.EntityEventProcessor;
import eu.bcvsolutions.idm.core.api.event.*;
[ "eu.bcvsolutions.idm" ]
eu.bcvsolutions.idm;
1,132,288
public void doShow_submission_assignment_instruction(RunData data) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); state.setAttribute(GRADE_SUBMISSION_ASSIGNMENT_EXPAND_FLAG, Boolean.valueOf(true)); // save user input readGradeForm(data, state, "read"); } // doShow_submission_assignment_instruction
void function(RunData data) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); state.setAttribute(GRADE_SUBMISSION_ASSIGNMENT_EXPAND_FLAG, Boolean.valueOf(true)); readGradeForm(data, state, "read"); }
/** * Action is to show the preview assignment student view */
Action is to show the preview assignment student view
doShow_submission_assignment_instruction
{ "repo_name": "eemirtekin/Sakai-10.6-TR", "path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java", "license": "apache-2.0", "size": 631432 }
[ "org.sakaiproject.cheftool.JetspeedRunData", "org.sakaiproject.cheftool.RunData", "org.sakaiproject.event.api.SessionState" ]
import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.event.api.SessionState;
import org.sakaiproject.cheftool.*; import org.sakaiproject.event.api.*;
[ "org.sakaiproject.cheftool", "org.sakaiproject.event" ]
org.sakaiproject.cheftool; org.sakaiproject.event;
683,229
public static int binarySearch(byte [][]arr, byte []key, int offset, int length, RawComparator<byte []> comparator) { int low = 0; int high = arr.length - 1; while (low <= high) { int mid = (low+high) >>> 1; // we have to compare in this order, because the comparator order // has special logic when the 'left side' is a special key. int cmp = comparator.compare(key, offset, length, arr[mid], 0, arr[mid].length); // key lives above the midpoint if (cmp > 0) low = mid + 1; // key lives below the midpoint else if (cmp < 0) high = mid - 1; // BAM. how often does this really happen? else return mid; } return - (low+1); }
static int function(byte [][]arr, byte []key, int offset, int length, RawComparator<byte []> comparator) { int low = 0; int high = arr.length - 1; while (low <= high) { int mid = (low+high) >>> 1; int cmp = comparator.compare(key, offset, length, arr[mid], 0, arr[mid].length); if (cmp > 0) low = mid + 1; else if (cmp < 0) high = mid - 1; else return mid; } return - (low+1); }
/** * Binary search for keys in indexes. * @param arr array of byte arrays to search for * @param key the key you want to find * @param offset the offset in the key you want to find * @param length the length of the key * @param comparator a comparator to compare. * @return index of key */
Binary search for keys in indexes
binarySearch
{ "repo_name": "adragomir/hbaseindex", "path": "src/java/org/apache/hadoop/hbase/util/Bytes.java", "license": "apache-2.0", "size": 31033 }
[ "org.apache.hadoop.io.RawComparator" ]
import org.apache.hadoop.io.RawComparator;
import org.apache.hadoop.io.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,554,791
@Override public void testPeriodic() { LiveWindow.run(); periodicStatusUpdate(); }
void function() { LiveWindow.run(); periodicStatusUpdate(); }
/** * This function is called periodically during test mode */
This function is called periodically during test mode
testPeriodic
{ "repo_name": "schmirob000/2016-Stronghold", "path": "src/org/usfirst/frc/team4915/stronghold/Robot.java", "license": "mit", "size": 7923 }
[ "edu.wpi.first.wpilibj.livewindow.LiveWindow" ]
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.livewindow.*;
[ "edu.wpi.first" ]
edu.wpi.first;
1,287,964
public List<Event> getAllCurrentEvents() { ArrayList<Event> currentEvents = new ArrayList<Event>(); Iterator<Event> iterator = events.iterator(); while (iterator.hasNext()) { Event currEvent = iterator.next(); if (!currEvent.isOver()) { currentEvents.add(currEvent); } } return currentEvents; }
List<Event> function() { ArrayList<Event> currentEvents = new ArrayList<Event>(); Iterator<Event> iterator = events.iterator(); while (iterator.hasNext()) { Event currEvent = iterator.next(); if (!currEvent.isOver()) { currentEvents.add(currEvent); } } return currentEvents; }
/** * Get a list of events that are not over based on today date from the DB. * * @return events * @@author Tiong YaoCong A0139922Y */
Get a list of events that are not over based on today date from the DB
getAllCurrentEvents
{ "repo_name": "CS2103AUG2016-F11-C1/main", "path": "src/main/java/seedu/todo/models/TodoListDB.java", "license": "mit", "size": 8945 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,501,355
File caseFile = new File(inputCaseFile); if (caseFile.exists()) { return; } BufferedReader metaReader = null; BufferedWriter caseWriter = null; try { metaReader = new BufferedReader(new FileReader(metaFeatureFile)); caseWriter = new BufferedWriter(new FileWriter(caseFile)); String metaRow = null; boolean firstRow = true; int caseID = 0; while ((metaRow = metaReader.readLine()) != null) { if (firstRow) { firstRow = false; metaRow = metaRow.substring(metaRow.indexOf(",") + 1); caseWriter.append("# This file is generated from ["+ metaFeatureFile + "].\n"); caseWriter.append("# Column headings are given below, the order of columns matter. So please do not modify this file.\n"); caseWriter.append("# " + metaRow + "\n\n"); continue; } caseID++; metaRow = metaRow.substring(metaRow.indexOf(",") + 1); caseWriter.append(caseID + "," + metaRow + "\n"); } metaReader.close(); caseWriter.close(); metaReader = null; caseWriter = null; } catch (IOException e) { if(metaReader != null || caseWriter != null){ try { metaReader.close(); caseWriter.close(); } catch (IOException ex) { ex.printStackTrace(); } } throw e; } }
File caseFile = new File(inputCaseFile); if (caseFile.exists()) { return; } BufferedReader metaReader = null; BufferedWriter caseWriter = null; try { metaReader = new BufferedReader(new FileReader(metaFeatureFile)); caseWriter = new BufferedWriter(new FileWriter(caseFile)); String metaRow = null; boolean firstRow = true; int caseID = 0; while ((metaRow = metaReader.readLine()) != null) { if (firstRow) { firstRow = false; metaRow = metaRow.substring(metaRow.indexOf(",") + 1); caseWriter.append(STR+ metaFeatureFile + "].\n"); caseWriter.append(STR); caseWriter.append(STR + metaRow + "\n\n"); continue; } caseID++; metaRow = metaRow.substring(metaRow.indexOf(",") + 1); caseWriter.append(caseID + "," + metaRow + "\n"); } metaReader.close(); caseWriter.close(); metaReader = null; caseWriter = null; } catch (IOException e) { if(metaReader != null caseWriter != null){ try { metaReader.close(); caseWriter.close(); } catch (IOException ex) { ex.printStackTrace(); } } throw e; } }
/** * builds input case file from extracted Meta Features File, if and only if * the input case file does not exists. * */
builds input case file from extracted Meta Features File, if and only if the input case file does not exists
buildCasesIfNotExists
{ "repo_name": "intelligent-decision-support-systems/automatic-algorithm-selector", "path": "algoselector/src/main/java/org/uclab/mm/kcl/edket/algoselector/mfe/InputCaseBuilder.java", "license": "apache-2.0", "size": 5285 }
[ "java.io.BufferedReader", "java.io.BufferedWriter", "java.io.File", "java.io.FileReader", "java.io.FileWriter", "java.io.IOException" ]
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,808,311
public void setContextualSearchPanel(ContextualSearchPanel panel) { mSearchPanel = panel; } // TODO(donnd): Consider adding a test-only constructor that uses dependency injection of a // preference manager and PrefServiceBridge. Currently this is not possible because the // PrefServiceBridge is final.
void function(ContextualSearchPanel panel) { mSearchPanel = panel; }
/** * Sets the handle to the ContextualSearchPanel. * @param panel The ContextualSearchPanel. */
Sets the handle to the ContextualSearchPanel
setContextualSearchPanel
{ "repo_name": "highweb-project/highweb-webcl-html5spec", "path": "chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java", "license": "bsd-3-clause", "size": 21792 }
[ "org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel" ]
import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel;
import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.*;
[ "org.chromium.chrome" ]
org.chromium.chrome;
171,312
@Override public void doSave(final IProgressMonitor monitor) { }
void function(final IProgressMonitor monitor) { }
/** * {@link #doSave(IProgressMonitor)} method is empty, not used to do save */
<code>#doSave(IProgressMonitor)</code> method is empty, not used to do save
doSave
{ "repo_name": "alovassy/titan.EclipsePlug-ins", "path": "org.eclipse.titanium/src/org/eclipse/titanium/graph/gui/windows/GraphEditor.java", "license": "epl-1.0", "size": 25508 }
[ "org.eclipse.core.runtime.IProgressMonitor" ]
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.*;
[ "org.eclipse.core" ]
org.eclipse.core;
2,438,764
boolean canRemoveItem( Name primaryTypeNameOfParent, List<Name> mixinTypeNamesOfParent, Name itemName, boolean skipProtected ) { // First look in the primary type for a matching property definition... JcrNodeType primaryType = getNodeType(primaryTypeNameOfParent); if (primaryType != null) { for (JcrPropertyDefinition definition : primaryType.allPropertyDefinitions(itemName)) { // Skip protected definitions ... if (skipProtected && definition.isProtected()) continue; // If this definition is not mandatory, then we have found that we CAN remove the property ... return !definition.isMandatory(); } } // Then, look in the primary type for a matching child node definition... if (primaryType != null) { for (JcrNodeDefinition definition : primaryType.allChildNodeDefinitions(itemName)) { // Skip protected definitions ... if (skipProtected && definition.isProtected()) continue; // If this definition is not mandatory, then we have found that we CAN remove all children ... return !definition.isMandatory(); } } // Then, look in the mixin types for a matching property definition... if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) { for (Name mixinTypeName : mixinTypeNamesOfParent) { JcrNodeType mixinType = getNodeType(mixinTypeName); if (mixinType == null) continue; for (JcrPropertyDefinition definition : mixinType.allPropertyDefinitions(itemName)) { // Skip protected definitions ... if (skipProtected && definition.isProtected()) continue; // If this definition is not mandatory, then we have found that we CAN remove the property ... return !definition.isMandatory(); } } } // Then, look in the mixin types for a matching child node definition... if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) { for (Name mixinTypeName : mixinTypeNamesOfParent) { JcrNodeType mixinType = getNodeType(mixinTypeName); if (mixinType == null) continue; for (JcrNodeDefinition definition : mixinType.allChildNodeDefinitions(itemName)) { // Skip protected definitions ... if (skipProtected && definition.isProtected()) continue; // If this definition is not mandatory, then we have found that we CAN remove all children ... return !definition.isMandatory(); } } } // Nothing was found, so look for residual item definitions ... if (!itemName.equals(JcrNodeType.RESIDUAL_NAME)) return canRemoveItem(primaryTypeNameOfParent, mixinTypeNamesOfParent, JcrNodeType.RESIDUAL_NAME, skipProtected); return false; }
boolean canRemoveItem( Name primaryTypeNameOfParent, List<Name> mixinTypeNamesOfParent, Name itemName, boolean skipProtected ) { JcrNodeType primaryType = getNodeType(primaryTypeNameOfParent); if (primaryType != null) { for (JcrPropertyDefinition definition : primaryType.allPropertyDefinitions(itemName)) { if (skipProtected && definition.isProtected()) continue; return !definition.isMandatory(); } } if (primaryType != null) { for (JcrNodeDefinition definition : primaryType.allChildNodeDefinitions(itemName)) { if (skipProtected && definition.isProtected()) continue; return !definition.isMandatory(); } } if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) { for (Name mixinTypeName : mixinTypeNamesOfParent) { JcrNodeType mixinType = getNodeType(mixinTypeName); if (mixinType == null) continue; for (JcrPropertyDefinition definition : mixinType.allPropertyDefinitions(itemName)) { if (skipProtected && definition.isProtected()) continue; return !definition.isMandatory(); } } } if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) { for (Name mixinTypeName : mixinTypeNamesOfParent) { JcrNodeType mixinType = getNodeType(mixinTypeName); if (mixinType == null) continue; for (JcrNodeDefinition definition : mixinType.allChildNodeDefinitions(itemName)) { if (skipProtected && definition.isProtected()) continue; return !definition.isMandatory(); } } } if (!itemName.equals(JcrNodeType.RESIDUAL_NAME)) return canRemoveItem(primaryTypeNameOfParent, mixinTypeNamesOfParent, JcrNodeType.RESIDUAL_NAME, skipProtected); return false; }
/** * Determine if the node and property definitions of the supplied primary type and mixin types allow the item with the * supplied name to be removed. * * @param primaryTypeNameOfParent the name of the primary type for the parent node; may not be null * @param mixinTypeNamesOfParent the names of the mixin types for the parent node; may be null or empty if there are no mixins * to include in the search * @param itemName the name of the item to be removed; may not be null * @param skipProtected true if this operation is being done from within the public JCR node and property API, or false if * this operation is being done from within internal implementations * @return true if at least one child node definition does not require children with the supplied name to exist, or false * otherwise */
Determine if the node and property definitions of the supplied primary type and mixin types allow the item with the supplied name to be removed
canRemoveItem
{ "repo_name": "stemig62/modeshape", "path": "modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java", "license": "apache-2.0", "size": 166534 }
[ "java.util.List", "org.modeshape.jcr.value.Name" ]
import java.util.List; import org.modeshape.jcr.value.Name;
import java.util.*; import org.modeshape.jcr.value.*;
[ "java.util", "org.modeshape.jcr" ]
java.util; org.modeshape.jcr;
1,277,002
public Database parseFile(String xmlFile) throws EngineException { try { // in case I am missing something, make it obvious if (!firstPass) { throw new Error("No more double pass"); } // check to see if we alread have parsed the file if ((alreadyReadFiles != null) && alreadyReadFiles.contains(xmlFile)) { return database; } else if (alreadyReadFiles == null) { alreadyReadFiles = new Vector(3, 1); } // remember the file to avoid looping alreadyReadFiles.add(xmlFile); currentXmlFile = xmlFile; SAXParser parser = saxFactory.newSAXParser(); FileReader fr = null; try { fr = new FileReader(xmlFile); } catch (FileNotFoundException fnfe) { throw new FileNotFoundException (new File(xmlFile).getAbsolutePath()); } BufferedReader br = new BufferedReader(fr); try { log.info("Parsing file: '" + (new File(xmlFile)).getName() + "'"); InputSource is = new InputSource(br); parser.parse(is, this); } finally { br.close(); } } catch (Exception e) { throw new EngineException(e); } if (!isExternalSchema) { firstPass = false; } database.doFinalInitialization(); return database; }
Database function(String xmlFile) throws EngineException { try { if (!firstPass) { throw new Error(STR); } if ((alreadyReadFiles != null) && alreadyReadFiles.contains(xmlFile)) { return database; } else if (alreadyReadFiles == null) { alreadyReadFiles = new Vector(3, 1); } alreadyReadFiles.add(xmlFile); currentXmlFile = xmlFile; SAXParser parser = saxFactory.newSAXParser(); FileReader fr = null; try { fr = new FileReader(xmlFile); } catch (FileNotFoundException fnfe) { throw new FileNotFoundException (new File(xmlFile).getAbsolutePath()); } BufferedReader br = new BufferedReader(fr); try { log.info(STR + (new File(xmlFile)).getName() + "'"); InputSource is = new InputSource(br); parser.parse(is, this); } finally { br.close(); } } catch (Exception e) { throw new EngineException(e); } if (!isExternalSchema) { firstPass = false; } database.doFinalInitialization(); return database; }
/** * Parses a XML input file and returns a newly created and * populated Database structure. * * @param xmlFile The input file to parse. * @return Database populated by <code>xmlFile</code>. */
Parses a XML input file and returns a newly created and populated Database structure
parseFile
{ "repo_name": "bbossgroups/bbossgroups-3.5", "path": "bboss-persistent/src/com/frameworkset/orm/engine/transform/XmlToAppData.java", "license": "apache-2.0", "size": 13417 }
[ "com.frameworkset.orm.engine.EngineException", "com.frameworkset.orm.engine.model.Database", "java.io.BufferedReader", "java.io.File", "java.io.FileNotFoundException", "java.io.FileReader", "java.util.Vector", "javax.xml.parsers.SAXParser", "org.xml.sax.InputSource" ]
import com.frameworkset.orm.engine.EngineException; import com.frameworkset.orm.engine.model.Database; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Vector; import javax.xml.parsers.SAXParser; import org.xml.sax.InputSource;
import com.frameworkset.orm.engine.*; import com.frameworkset.orm.engine.model.*; import java.io.*; import java.util.*; import javax.xml.parsers.*; import org.xml.sax.*;
[ "com.frameworkset.orm", "java.io", "java.util", "javax.xml", "org.xml.sax" ]
com.frameworkset.orm; java.io; java.util; javax.xml; org.xml.sax;
1,984,546
public Map<Integer, Map<Integer, Integer>> createXKerningMapEncoded() { if (!hasKerning()) { return null; } Map<Integer, Map<Integer, Integer>> m = new java.util.HashMap<Integer, Map<Integer, Integer>>(); for (Map.Entry<String, Map<String, Dimension2D>> entryFrom : this.kerningMap.entrySet()) { String name1 = entryFrom.getKey(); AFMCharMetrics chm1 = getChar(name1); if (chm1 == null || !chm1.hasCharCode()) { continue; } Map<Integer, Integer> container = null; Map<String, Dimension2D> entriesTo = entryFrom.getValue(); for (Map.Entry<String, Dimension2D> entryTo : entriesTo.entrySet()) { String name2 = entryTo.getKey(); AFMCharMetrics chm2 = getChar(name2); if (chm2 == null || !chm2.hasCharCode()) { continue; } if (container == null) { Integer k1 = Integer.valueOf(chm1.getCharCode()); container = m.get(k1); if (container == null) { container = new java.util.HashMap<Integer, Integer>(); m.put(k1, container); } } Dimension2D dim = entryTo.getValue(); container.put(Integer.valueOf(chm2.getCharCode()), Integer.valueOf((int)Math.round(dim.getWidth()))); } } return m; }
Map<Integer, Map<Integer, Integer>> function() { if (!hasKerning()) { return null; } Map<Integer, Map<Integer, Integer>> m = new java.util.HashMap<Integer, Map<Integer, Integer>>(); for (Map.Entry<String, Map<String, Dimension2D>> entryFrom : this.kerningMap.entrySet()) { String name1 = entryFrom.getKey(); AFMCharMetrics chm1 = getChar(name1); if (chm1 == null !chm1.hasCharCode()) { continue; } Map<Integer, Integer> container = null; Map<String, Dimension2D> entriesTo = entryFrom.getValue(); for (Map.Entry<String, Dimension2D> entryTo : entriesTo.entrySet()) { String name2 = entryTo.getKey(); AFMCharMetrics chm2 = getChar(name2); if (chm2 == null !chm2.hasCharCode()) { continue; } if (container == null) { Integer k1 = Integer.valueOf(chm1.getCharCode()); container = m.get(k1); if (container == null) { container = new java.util.HashMap<Integer, Integer>(); m.put(k1, container); } } Dimension2D dim = entryTo.getValue(); container.put(Integer.valueOf(chm2.getCharCode()), Integer.valueOf((int)Math.round(dim.getWidth()))); } } return m; }
/** * Creates and returns a kerning map for writing mode 0 (ltr) with character codes. * @return the kerning map or null if there is no kerning information. */
Creates and returns a kerning map for writing mode 0 (ltr) with character codes
createXKerningMapEncoded
{ "repo_name": "pellcorp/fop", "path": "src/java/org/apache/fop/fonts/type1/AFMFile.java", "license": "apache-2.0", "size": 15101 }
[ "java.awt.geom.Dimension2D", "java.util.Map" ]
import java.awt.geom.Dimension2D; import java.util.Map;
import java.awt.geom.*; import java.util.*;
[ "java.awt", "java.util" ]
java.awt; java.util;
1,736,890
private void setExperimentPanel() { experimentTitlePanel = new Cab2bPanel(new RiverLayout(5, 5)); Cab2bLabel experimentLabel = new Cab2bLabel(selectedExperiment.getName()); experimentLabel.setForeground(Color.blue); Font font = experimentLabel.getFont(); Font textFont = new Font(font.getName(), Font.BOLD, font.getSize() + 3); experimentLabel.setFont(textFont); experimentTitlePanel.add("hfill", experimentLabel); Cab2bLabel experimentCreatedOn = new Cab2bLabel("Created On :" + selectedExperiment.getCreatedOn().toString()); experimentTitlePanel.add("tab tab tab tab hfill ", experimentCreatedOn); Cab2bLabel experimentModifiedOn = new Cab2bLabel("Last Updated :" + selectedExperiment.getLastUpdatedOn().toString()); experimentTitlePanel.add("tab tab tab tab hfill", experimentModifiedOn); experimentTitlePanel.add("br", new JLabel("")); experimentTitlePanel.setBorder(null);
void function() { experimentTitlePanel = new Cab2bPanel(new RiverLayout(5, 5)); Cab2bLabel experimentLabel = new Cab2bLabel(selectedExperiment.getName()); experimentLabel.setForeground(Color.blue); Font font = experimentLabel.getFont(); Font textFont = new Font(font.getName(), Font.BOLD, font.getSize() + 3); experimentLabel.setFont(textFont); experimentTitlePanel.add("hfill", experimentLabel); Cab2bLabel experimentCreatedOn = new Cab2bLabel(STR + selectedExperiment.getCreatedOn().toString()); experimentTitlePanel.add(STR, experimentCreatedOn); Cab2bLabel experimentModifiedOn = new Cab2bLabel(STR + selectedExperiment.getLastUpdatedOn().toString()); experimentTitlePanel.add(STR, experimentModifiedOn); experimentTitlePanel.add("br", new JLabel("")); experimentTitlePanel.setBorder(null);
/** * Method to set experiment panel */
Method to set experiment panel
setExperimentPanel
{ "repo_name": "NCIP/cab2b", "path": "software/cab2b/src/java/client/edu/wustl/cab2b/client/ui/experiment/ExperimentOpenPanel.java", "license": "bsd-3-clause", "size": 11301 }
[ "edu.wustl.cab2b.client.ui.controls.Cab2bLabel", "edu.wustl.cab2b.client.ui.controls.Cab2bPanel", "edu.wustl.cab2b.client.ui.controls.RiverLayout", "java.awt.Color", "java.awt.Font", "javax.swing.JLabel" ]
import edu.wustl.cab2b.client.ui.controls.Cab2bLabel; import edu.wustl.cab2b.client.ui.controls.Cab2bPanel; import edu.wustl.cab2b.client.ui.controls.RiverLayout; import java.awt.Color; import java.awt.Font; import javax.swing.JLabel;
import edu.wustl.cab2b.client.ui.controls.*; import java.awt.*; import javax.swing.*;
[ "edu.wustl.cab2b", "java.awt", "javax.swing" ]
edu.wustl.cab2b; java.awt; javax.swing;
1,818,716
return new MissionView(context, true); }
return new MissionView(context, true); }
/** * Create a new View associated to Adapter. * @param context * @param cursor * @param parent * @return View */
Create a new View associated to Adapter
newView
{ "repo_name": "marcusfelipetm/jemf", "path": "src/br/ufrj/ppgi/jemf/mobile/adapter/MissionAdapter.java", "license": "gpl-3.0", "size": 2630 }
[ "br.ufrj.ppgi.jemf.mobile.view.MissionView" ]
import br.ufrj.ppgi.jemf.mobile.view.MissionView;
import br.ufrj.ppgi.jemf.mobile.view.*;
[ "br.ufrj.ppgi" ]
br.ufrj.ppgi;
2,717,349
// if it's been less than 1 hour since the last json pull, just return the stored value if(!forceDownload) { long timeDiff = System.currentTimeMillis() - lastDownloadedJSON; if(timeDiff < 3600000) { return prefJson; } } // try downloading file String scheduleJson = ""; try { DefaultHttpClient client = new DefaultHttpClient(); URI uri = new URI(SCHEDULE_JSON_URL); HttpGet method = new HttpGet(uri); HttpResponse res = client.execute(method); InputStream data = res.getEntity().getContent(); InputStreamReader reader = new InputStreamReader(data); BufferedReader buffer = new BufferedReader(reader); StringBuilder sb = new StringBuilder(); String cur; while ((cur = buffer.readLine()) != null) { sb.append(cur + "\n"); } data.close(); scheduleJson = sb.toString(); } catch (Exception e) { // failed to download, so let's just return what we've got lastDownloadedJSON = System.currentTimeMillis(); if(prefJson == "{ }") Toast.makeText(context, "Could not download schedule, check your internet connection", Toast.LENGTH_SHORT).show(); else Toast.makeText(context, "Using stored schedule", Toast.LENGTH_SHORT).show(); return prefJson; } // downloaded new json successfully, now save it and return it prefJson = scheduleJson; SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString("json", prefJson); editor.commit(); lastDownloadedJSON = System.currentTimeMillis(); Toast.makeText(context, "Downloaded latest schedule", Toast.LENGTH_SHORT).show(); return prefJson; }
if(!forceDownload) { long timeDiff = System.currentTimeMillis() - lastDownloadedJSON; if(timeDiff < 3600000) { return prefJson; } } String scheduleJson = STR\nSTR{ }STRCould not download schedule, check your internet connectionSTRUsing stored scheduleSTRjsonSTRDownloaded latest schedule", Toast.LENGTH_SHORT).show(); return prefJson; }
/** retrieve the schedule from the internet * @param forceDownload true if the schedule must be * re-downloaded even if we've fetched it * recently * @return a JSON string */
retrieve the schedule from the internet
getScheduleJson
{ "repo_name": "micahflee/hope_android", "path": "src/net/hope/mobile/JSInterface.java", "license": "mit", "size": 7642 }
[ "android.widget.Toast" ]
import android.widget.Toast;
import android.widget.*;
[ "android.widget" ]
android.widget;
1,873,317
public void stop(BundleContext context) throws Exception { super.stop(context); }
void function(BundleContext context) throws Exception { super.stop(context); }
/** * This method is called when the plug-in is stopped */
This method is called when the plug-in is stopped
stop
{ "repo_name": "rajul/Pydev", "path": "plugins/org.python.pydev.parser/src/org/python/pydev/parser/ParserPlugin.java", "license": "epl-1.0", "size": 2091 }
[ "org.osgi.framework.BundleContext" ]
import org.osgi.framework.BundleContext;
import org.osgi.framework.*;
[ "org.osgi.framework" ]
org.osgi.framework;
1,589,351
@Override @Generated(value = "com.sun.tools.xjc.Driver", date = "2014-09-19T03:08:06-06:00", comment = "JAXB RI v2.2.6") public String toString() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE); }
@Generated(value = STR, date = STR, comment = STR) String function() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE); }
/** * Generates a String representation of the contents of this type. * This is an extension method, produced by the 'ts' xjc plugin * */
Generates a String representation of the contents of this type. This is an extension method, produced by the 'ts' xjc plugin
toString
{ "repo_name": "angecab10/travelport-uapi-tutorial", "path": "src/com/travelport/schema/universal_v29_0/AirSegmentSpecialUpdate.java", "license": "gpl-3.0", "size": 4832 }
[ "javax.annotation.Generated", "org.apache.commons.lang.builder.ToStringBuilder", "org.apache.cxf.xjc.runtime.JAXBToStringStyle" ]
import javax.annotation.Generated; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.cxf.xjc.runtime.JAXBToStringStyle;
import javax.annotation.*; import org.apache.commons.lang.builder.*; import org.apache.cxf.xjc.runtime.*;
[ "javax.annotation", "org.apache.commons", "org.apache.cxf" ]
javax.annotation; org.apache.commons; org.apache.cxf;
866,171
public void setChildInfos(NodeId id, Iterator<ChildInfo> infos) { childInfos.put(id, toList(infos)); } // -----------------------------------------------------< private >---
void function(NodeId id, Iterator<ChildInfo> infos) { childInfos.put(id, toList(infos)); }
/** * Set the {@link ChildInfo}s of a node * * @param id * @param infos */
Set the <code>ChildInfo</code>s of a node
setChildInfos
{ "repo_name": "tripodsan/jackrabbit", "path": "jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ItemInfoStore.java", "license": "apache-2.0", "size": 5540 }
[ "java.util.Iterator", "org.apache.jackrabbit.spi.ChildInfo", "org.apache.jackrabbit.spi.NodeId" ]
import java.util.Iterator; import org.apache.jackrabbit.spi.ChildInfo; import org.apache.jackrabbit.spi.NodeId;
import java.util.*; import org.apache.jackrabbit.spi.*;
[ "java.util", "org.apache.jackrabbit" ]
java.util; org.apache.jackrabbit;
2,063,421
private void rollback(final String patchID, final IdentityPatchContext context) throws PatchingException { try { // Load the patch history final PatchingTaskContext.Mode mode = context.getMode(); final Patch originalPatch = loadPatchInformation(patchID, installedImage); final RollbackPatch rollbackPatch = loadRollbackInformation(patchID, installedImage); final Patch.PatchType patchType = rollbackPatch.getIdentity().getPatchType(); final InstalledIdentity history = rollbackPatch.getIdentityState(); // Process originals by type first final LinkedHashMap<String, PatchElement> originalLayers = new LinkedHashMap<String, PatchElement>(); final LinkedHashMap<String, PatchElement> originalAddOns = new LinkedHashMap<String, PatchElement>(); for (final PatchElement patchElement : originalPatch.getElements()) { final PatchElementProvider provider = patchElement.getProvider(); final String layerName = provider.getName(); final LayerType layerType = provider.getLayerType(); final Map<String, PatchElement> originals; switch (layerType) { case Layer: originals = originalLayers; break; case AddOn: originals = originalAddOns; break; default: throw new IllegalStateException(); } if (!originals.containsKey(layerName)) { originals.put(layerName, patchElement); } else { throw PatchLogger.ROOT_LOGGER.installationDuplicateLayer(layerType.toString(), layerName); } } // Process the rollback xml for (final PatchElement patchElement : rollbackPatch.getElements()) { final String elementPatchId = patchElement.getId(); final PatchElementProvider provider = patchElement.getProvider(); final String layerName = provider.getName(); final LayerType layerType = provider.getLayerType(); final LinkedHashMap<String, PatchElement> originals; switch (layerType) { case Layer: originals = originalLayers; break; case AddOn: originals = originalAddOns; break; default: throw new IllegalStateException(); } final PatchElement original = originals.remove(layerName); if (original == null) { throw PatchLogger.ROOT_LOGGER.noSuchLayer(layerName); } final IdentityPatchContext.PatchEntry entry = context.resolveForElement(patchElement); // Create the rollback PatchingTasks.rollback(elementPatchId, original.getModifications(), patchElement.getModifications(), entry, ContentItemFilter.ALL_BUT_MISC, mode); entry.rollback(original.getId()); // We need to restore the previous state final Patch.PatchType elementPatchType = provider.getPatchType(); final PatchableTarget.TargetInfo info; if (layerType == LayerType.AddOn) { info = history.getAddOn(layerName).loadTargetInfo(); } else { info = history.getLayer(layerName).loadTargetInfo(); } if (mode == ROLLBACK) { restoreFromHistory(entry, elementPatchId, elementPatchType, info); } } if (!originalLayers.isEmpty() || !originalAddOns.isEmpty()) { throw PatchLogger.ROOT_LOGGER.invalidRollbackInformation(); } // Rollback the patch final IdentityPatchContext.PatchEntry identity = context.getIdentityEntry(); PatchingTasks.rollback(patchID, originalPatch.getModifications(), rollbackPatch.getModifications(), identity, ContentItemFilter.MISC_ONLY, mode); identity.rollback(patchID); // Restore previous state if (mode == ROLLBACK) { final PatchableTarget.TargetInfo identityHistory = history.getIdentity().loadTargetInfo(); restoreFromHistory(identity, rollbackPatch.getPatchId(), patchType, identityHistory); if(patchType == Patch.PatchType.CUMULATIVE) { reenableNotOverridenModules(rollbackPatch, context); } } if (patchType == Patch.PatchType.CUMULATIVE) { final Identity.IdentityUpgrade upgrade = rollbackPatch.getIdentity().forType(Patch.PatchType.CUMULATIVE, Identity.IdentityUpgrade.class); identity.setResultingVersion(upgrade.getResultingVersion()); } } catch (Exception e) { throw rethrowException(e); } }
void function(final String patchID, final IdentityPatchContext context) throws PatchingException { try { final PatchingTaskContext.Mode mode = context.getMode(); final Patch originalPatch = loadPatchInformation(patchID, installedImage); final RollbackPatch rollbackPatch = loadRollbackInformation(patchID, installedImage); final Patch.PatchType patchType = rollbackPatch.getIdentity().getPatchType(); final InstalledIdentity history = rollbackPatch.getIdentityState(); final LinkedHashMap<String, PatchElement> originalLayers = new LinkedHashMap<String, PatchElement>(); final LinkedHashMap<String, PatchElement> originalAddOns = new LinkedHashMap<String, PatchElement>(); for (final PatchElement patchElement : originalPatch.getElements()) { final PatchElementProvider provider = patchElement.getProvider(); final String layerName = provider.getName(); final LayerType layerType = provider.getLayerType(); final Map<String, PatchElement> originals; switch (layerType) { case Layer: originals = originalLayers; break; case AddOn: originals = originalAddOns; break; default: throw new IllegalStateException(); } if (!originals.containsKey(layerName)) { originals.put(layerName, patchElement); } else { throw PatchLogger.ROOT_LOGGER.installationDuplicateLayer(layerType.toString(), layerName); } } for (final PatchElement patchElement : rollbackPatch.getElements()) { final String elementPatchId = patchElement.getId(); final PatchElementProvider provider = patchElement.getProvider(); final String layerName = provider.getName(); final LayerType layerType = provider.getLayerType(); final LinkedHashMap<String, PatchElement> originals; switch (layerType) { case Layer: originals = originalLayers; break; case AddOn: originals = originalAddOns; break; default: throw new IllegalStateException(); } final PatchElement original = originals.remove(layerName); if (original == null) { throw PatchLogger.ROOT_LOGGER.noSuchLayer(layerName); } final IdentityPatchContext.PatchEntry entry = context.resolveForElement(patchElement); PatchingTasks.rollback(elementPatchId, original.getModifications(), patchElement.getModifications(), entry, ContentItemFilter.ALL_BUT_MISC, mode); entry.rollback(original.getId()); final Patch.PatchType elementPatchType = provider.getPatchType(); final PatchableTarget.TargetInfo info; if (layerType == LayerType.AddOn) { info = history.getAddOn(layerName).loadTargetInfo(); } else { info = history.getLayer(layerName).loadTargetInfo(); } if (mode == ROLLBACK) { restoreFromHistory(entry, elementPatchId, elementPatchType, info); } } if (!originalLayers.isEmpty() !originalAddOns.isEmpty()) { throw PatchLogger.ROOT_LOGGER.invalidRollbackInformation(); } final IdentityPatchContext.PatchEntry identity = context.getIdentityEntry(); PatchingTasks.rollback(patchID, originalPatch.getModifications(), rollbackPatch.getModifications(), identity, ContentItemFilter.MISC_ONLY, mode); identity.rollback(patchID); if (mode == ROLLBACK) { final PatchableTarget.TargetInfo identityHistory = history.getIdentity().loadTargetInfo(); restoreFromHistory(identity, rollbackPatch.getPatchId(), patchType, identityHistory); if(patchType == Patch.PatchType.CUMULATIVE) { reenableNotOverridenModules(rollbackPatch, context); } } if (patchType == Patch.PatchType.CUMULATIVE) { final Identity.IdentityUpgrade upgrade = rollbackPatch.getIdentity().forType(Patch.PatchType.CUMULATIVE, Identity.IdentityUpgrade.class); identity.setResultingVersion(upgrade.getResultingVersion()); } } catch (Exception e) { throw rethrowException(e); } }
/** * Rollback a patch. * * @param patchID the patch id * @param context the patch context * @throws PatchingException */
Rollback a patch
rollback
{ "repo_name": "yersan/wildfly-core", "path": "patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java", "license": "lgpl-2.1", "size": 36290 }
[ "java.util.LinkedHashMap", "java.util.Map", "org.jboss.as.patching.PatchingException", "org.jboss.as.patching.installation.InstalledIdentity", "org.jboss.as.patching.installation.PatchableTarget", "org.jboss.as.patching.logging.PatchLogger", "org.jboss.as.patching.metadata.Identity", "org.jboss.as.pat...
import java.util.LinkedHashMap; import java.util.Map; import org.jboss.as.patching.PatchingException; import org.jboss.as.patching.installation.InstalledIdentity; import org.jboss.as.patching.installation.PatchableTarget; import org.jboss.as.patching.logging.PatchLogger; import org.jboss.as.patching.metadata.Identity; import org.jboss.as.patching.metadata.LayerType; import org.jboss.as.patching.metadata.Patch; import org.jboss.as.patching.metadata.PatchElement; import org.jboss.as.patching.metadata.PatchElementProvider; import org.jboss.as.patching.metadata.RollbackPatch; import org.jboss.as.patching.runner.IdentityPatchContext;
import java.util.*; import org.jboss.as.patching.*; import org.jboss.as.patching.installation.*; import org.jboss.as.patching.logging.*; import org.jboss.as.patching.metadata.*; import org.jboss.as.patching.runner.*;
[ "java.util", "org.jboss.as" ]
java.util; org.jboss.as;
1,401,744
protected String getJsonString(JSONObject obj, String property) { String value = null; try { if (obj != null) { value = obj.getString(property); if (value.equals("null")) { Log.d(LOG_TAG, property + " is string called 'null'"); value = null; } } } catch (JSONException e) { Log.d(LOG_TAG, "Could not get = " + e.getMessage()); } return value; }
String function(JSONObject obj, String property) { String value = null; try { if (obj != null) { value = obj.getString(property); if (value.equals("null")) { Log.d(LOG_TAG, property + STR); value = null; } } } catch (JSONException e) { Log.d(LOG_TAG, STR + e.getMessage()); } return value; }
/** * Convenience method to get a string from a JSON object. Saves a * lot of try/catch writing. * If the property is not found in the object null will be returned. * * @param obj contact object to search * @param property to be looked up * @return The value of the property */
Convenience method to get a string from a JSON object. Saves a lot of try/catch writing. If the property is not found in the object null will be returned
getJsonString
{ "repo_name": "roadlabs/android", "path": "appMobiLib/src/com/phonegap/ContactAccessor.java", "license": "mit", "size": 6323 }
[ "android.util.Log", "org.json.JSONException", "org.json.JSONObject" ]
import android.util.Log; import org.json.JSONException; import org.json.JSONObject;
import android.util.*; import org.json.*;
[ "android.util", "org.json" ]
android.util; org.json;
2,794
@Bench(runs = RUNS) public void vectorAdd() { vector = new Vector<Integer>(); for (final int i : intData) { vector.add(i); } }
@Bench(runs = RUNS) void function() { vector = new Vector<Integer>(); for (final int i : intData) { vector.add(i); } }
/** * benchmark for adding data to [@link java.util.Vector] */
benchmark for adding data to [@link java.util.Vector]
vectorAdd
{ "repo_name": "sebastiangraf/perfidix", "path": "src/main/java/org/perfidix/example/list/ListBenchmark.java", "license": "bsd-3-clause", "size": 5155 }
[ "java.util.Vector", "org.perfidix.annotation.Bench" ]
import java.util.Vector; import org.perfidix.annotation.Bench;
import java.util.*; import org.perfidix.annotation.*;
[ "java.util", "org.perfidix.annotation" ]
java.util; org.perfidix.annotation;
327,645
public void setRows(List<DataRowBase> rs) { data_rows.initialize(vertical_axis.size(), horizontal_axis.size()); Iterator<DataRowBase> iter = rs.iterator(); while (iter.hasNext()) { DataRowBase row = iter.next(); int h_idx = horizontal_axis.getHash(horizontal_axis.getMap(row)); int v_idx = vertical_axis.getHash(vertical_axis.getMap(row)); data_rows.addData(row, v_idx, h_idx); } }
void function(List<DataRowBase> rs) { data_rows.initialize(vertical_axis.size(), horizontal_axis.size()); Iterator<DataRowBase> iter = rs.iterator(); while (iter.hasNext()) { DataRowBase row = iter.next(); int h_idx = horizontal_axis.getHash(horizontal_axis.getMap(row)); int v_idx = vertical_axis.getHash(vertical_axis.getMap(row)); data_rows.addData(row, v_idx, h_idx); } }
/** * This method traverses the input ResultSet and correctly sets values into * the data rows. The horizontal and vertical axes must be correctly set and * fully configured prior to calling this method. */
This method traverses the input ResultSet and correctly sets values into the data rows. The horizontal and vertical axes must be correctly set and fully configured prior to calling this method
setRows
{ "repo_name": "swordlordcodingcrew/gozer", "path": "src/main/java/com/swordlord/gozer/crosstab/CrosstabResultSet.java", "license": "agpl-3.0", "size": 7278 }
[ "com.swordlord.jalapeno.datarow.DataRowBase", "java.util.Iterator", "java.util.List" ]
import com.swordlord.jalapeno.datarow.DataRowBase; import java.util.Iterator; import java.util.List;
import com.swordlord.jalapeno.datarow.*; import java.util.*;
[ "com.swordlord.jalapeno", "java.util" ]
com.swordlord.jalapeno; java.util;
1,520,732
@Nonnull public java.util.concurrent.CompletableFuture<EventMessage> putAsync(@Nonnull final EventMessage newEventMessage) { return sendAsync(HttpMethod.PUT, newEventMessage); }
java.util.concurrent.CompletableFuture<EventMessage> function(@Nonnull final EventMessage newEventMessage) { return sendAsync(HttpMethod.PUT, newEventMessage); }
/** * Creates a EventMessage with a new object * * @param newEventMessage the object to create/update * @return a future with the result */
Creates a EventMessage with a new object
putAsync
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/EventMessageRequest.java", "license": "mit", "size": 6553 }
[ "com.microsoft.graph.http.HttpMethod", "com.microsoft.graph.models.EventMessage", "javax.annotation.Nonnull" ]
import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.EventMessage; import javax.annotation.Nonnull;
import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*;
[ "com.microsoft.graph", "javax.annotation" ]
com.microsoft.graph; javax.annotation;
2,470,162
void injectAll(final Errors errors) { Preconditions.checkState(validationStarted, "Validation should be done before injection"); for (InjectableReference<?> reference : pendingInjections) { try { reference.get(); } catch (InternalProvisionException ipe) { errors.merge(ipe); } } pendingInjections.clear(); } private enum InjectableReferenceState { NEW, VALIDATED, INJECTING, READY } private static class InjectableReference<T> implements Initializable<T> { private volatile InjectableReferenceState state = InjectableReferenceState.NEW; private volatile MembersInjectorImpl<T> membersInjector = null; private final InjectorImpl injector; private final T instance; private final Object source; private final Key<T> key; private final ProvisionListenerStackCallback<T> provisionCallback; private final CycleDetectingLock<?> lock; public InjectableReference( InjectorImpl injector, T instance, Key<T> key, ProvisionListenerStackCallback<T> provisionCallback, Object source, CycleDetectingLock<?> lock) { this.injector = injector; this.key = key; // possibly null! this.provisionCallback = provisionCallback; // possibly null! this.instance = checkNotNull(instance, "instance"); this.source = checkNotNull(source, "source"); this.lock = checkNotNull(lock, "lock"); }
void injectAll(final Errors errors) { Preconditions.checkState(validationStarted, STR); for (InjectableReference<?> reference : pendingInjections) { try { reference.get(); } catch (InternalProvisionException ipe) { errors.merge(ipe); } } pendingInjections.clear(); } private enum InjectableReferenceState { NEW, VALIDATED, INJECTING, READY } private static class InjectableReference<T> implements Initializable<T> { private volatile InjectableReferenceState state = InjectableReferenceState.NEW; private volatile MembersInjectorImpl<T> membersInjector = null; private final InjectorImpl injector; private final T instance; private final Object source; private final Key<T> key; private final ProvisionListenerStackCallback<T> provisionCallback; private final CycleDetectingLock<?> lock; public InjectableReference( InjectorImpl injector, T instance, Key<T> key, ProvisionListenerStackCallback<T> provisionCallback, Object source, CycleDetectingLock<?> lock) { this.injector = injector; this.key = key; this.provisionCallback = provisionCallback; this.instance = checkNotNull(instance, STR); this.source = checkNotNull(source, STR); this.lock = checkNotNull(lock, "lock"); }
/** * Performs creation-time injections on all objects that require it. Whenever fulfilling an * injection depends on another object that requires injection, we inject it first. If the two * instances are codependent (directly or transitively), ordering of injection is arbitrary. */
Performs creation-time injections on all objects that require it. Whenever fulfilling an injection depends on another object that requires injection, we inject it first. If the two instances are codependent (directly or transitively), ordering of injection is arbitrary
injectAll
{ "repo_name": "sonatype/sisu-guice", "path": "core/src/com/google/inject/internal/Initializer.java", "license": "apache-2.0", "size": 10274 }
[ "com.google.common.base.Preconditions", "com.google.inject.Key" ]
import com.google.common.base.Preconditions; import com.google.inject.Key;
import com.google.common.base.*; import com.google.inject.*;
[ "com.google.common", "com.google.inject" ]
com.google.common; com.google.inject;
265,475
public Observable<ServiceResponse<StorageAccountListKeysResultInner>> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, String keyName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } if (keyName == null) { throw new IllegalArgumentException("Parameter keyName is required and cannot be null."); }
Observable<ServiceResponse<StorageAccountListKeysResultInner>> function(String resourceGroupName, String accountName, String keyName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (accountName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } if (keyName == null) { throw new IllegalArgumentException(STR); }
/** * Regenerates one of the access keys for the specified storage account. * * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @param keyName The name of storage keys that want to be regenerated, possible vaules are key1, key2. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the StorageAccountListKeysResultInner object */
Regenerates one of the access keys for the specified storage account
regenerateKeyWithServiceResponseAsync
{ "repo_name": "hovsepm/azure-sdk-for-java", "path": "storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java", "license": "mit", "size": 112387 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,418,592
try { ExpressionEngine expressionEngine = new XPathExpressionEngine(); String configPath = getConfigName(); FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy(); File dataDirConfigFile = new File(configPath); if (!dataDirConfigFile.exists()) { // Load a default from the classpath: // Note: we don't let new XMLConfiguration() lookup the resource // url directly because it may not be able to find the desired // classloader to load the URL from. URL configResourceUrl = this.getClass().getClassLoader().getResource(configPath); if (configResourceUrl == null) { throw new RuntimeException("unable to load resource: " + configPath); } XMLConfiguration tmpConfig = new XMLConfiguration(configResourceUrl); // Copy over a default configuration since none exists: // Ensure data dir location exists: if (dataDirConfigFile.getParentFile() != null && !dataDirConfigFile.getParentFile().exists() && !dataDirConfigFile.getParentFile().mkdirs()) { throw new RuntimeException("could not create directories."); } tmpConfig.save(dataDirConfigFile); } if (dataDirConfigFile.exists()) { config = new XMLConfiguration(dataDirConfigFile); } else { // extract from jar and write to throw new IllegalStateException("Config file does not exist or cannot be created"); } if (expressionEngine != null) { config.setExpressionEngine(expressionEngine); } configFile = dataDirConfigFile; // reload at most once per thirty seconds on configuration queries. config.setReloadingStrategy(reloadingStrategy); initConfig(config); } catch (ConfigurationException e) { throw new RuntimeException(e); } }
try { ExpressionEngine expressionEngine = new XPathExpressionEngine(); String configPath = getConfigName(); FileChangedReloadingStrategy reloadingStrategy = new FileChangedReloadingStrategy(); File dataDirConfigFile = new File(configPath); if (!dataDirConfigFile.exists()) { URL configResourceUrl = this.getClass().getClassLoader().getResource(configPath); if (configResourceUrl == null) { throw new RuntimeException(STR + configPath); } XMLConfiguration tmpConfig = new XMLConfiguration(configResourceUrl); if (dataDirConfigFile.getParentFile() != null && !dataDirConfigFile.getParentFile().exists() && !dataDirConfigFile.getParentFile().mkdirs()) { throw new RuntimeException(STR); } tmpConfig.save(dataDirConfigFile); } if (dataDirConfigFile.exists()) { config = new XMLConfiguration(dataDirConfigFile); } else { throw new IllegalStateException(STR); } if (expressionEngine != null) { config.setExpressionEngine(expressionEngine); } configFile = dataDirConfigFile; config.setReloadingStrategy(reloadingStrategy); initConfig(config); } catch (ConfigurationException e) { throw new RuntimeException(e); } }
/** * Constructor pulls file out of the jar or reads from disk and sets up refresh policy. * * @param expressionEngine * the expression engine to use. Null results in default expression engine */
Constructor pulls file out of the jar or reads from disk and sets up refresh policy
readConfig
{ "repo_name": "rkadle/Tank", "path": "api/src/main/java/com/intuit/tank/vm/settings/BaseCommonsXmlConfig.java", "license": "epl-1.0", "size": 5639 }
[ "java.io.File", "org.apache.commons.configuration.ConfigurationException", "org.apache.commons.configuration.XMLConfiguration", "org.apache.commons.configuration.reloading.FileChangedReloadingStrategy", "org.apache.commons.configuration.tree.ExpressionEngine", "org.apache.commons.configuration.tree.xpath....
import java.io.File; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.XMLConfiguration; import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy; import org.apache.commons.configuration.tree.ExpressionEngine; import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine;
import java.io.*; import org.apache.commons.configuration.*; import org.apache.commons.configuration.reloading.*; import org.apache.commons.configuration.tree.*; import org.apache.commons.configuration.tree.xpath.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
513,963
static void determinize(Automaton a) { if (a.deterministic || a.isSingleton()) { return; } final State[] allStates = a.getNumberedStates(); // subset construction final boolean initAccept = a.initial.accept; final int initNumber = a.initial.number; a.initial = new State(); SortedIntSet.FrozenIntSet initialset = new SortedIntSet.FrozenIntSet(initNumber, a.initial); LinkedList<SortedIntSet.FrozenIntSet> worklist = new LinkedList<SortedIntSet.FrozenIntSet>(); Map<SortedIntSet.FrozenIntSet,State> newstate = new HashMap<SortedIntSet.FrozenIntSet,State>(); worklist.add(initialset); a.initial.accept = initAccept; newstate.put(initialset, a.initial); int newStateUpto = 0; State[] newStatesArray = new State[5]; newStatesArray[newStateUpto] = a.initial; a.initial.number = newStateUpto; newStateUpto++; // like Set<Integer,PointTransitions> final PointTransitionSet points = new PointTransitionSet(); // like SortedMap<Integer,Integer> final SortedIntSet statesSet = new SortedIntSet(5); while (worklist.size() > 0) { SortedIntSet.FrozenIntSet s = worklist.removeFirst(); // Collate all outgoing transitions by min/1+max: for(int i=0;i<s.values.length;i++) { final State s0 = allStates[s.values[i]]; for(int j=0;j<s0.numTransitions;j++) { points.add(s0.transitionsArray[j]); } } if (points.count == 0) { // No outgoing transitions -- skip it continue; } points.sort(); int lastPoint = -1; int accCount = 0; final State r = s.state; for(int i=0;i<points.count;i++) { final int point = points.points[i].point; if (statesSet.upto > 0) { assert lastPoint != -1; statesSet.computeHash(); State q = newstate.get(statesSet); if (q == null) { q = new State(); final SortedIntSet.FrozenIntSet p = statesSet.freeze(q); worklist.add(p); if (newStateUpto == newStatesArray.length) { final State[] newArray = new State[ArrayUtil2.oversize(1+newStateUpto, RamUsageEstimator.NUM_BYTES_OBJECT_REF)]; System.arraycopy(newStatesArray, 0, newArray, 0, newStateUpto); newStatesArray = newArray; } newStatesArray[newStateUpto] = q; q.number = newStateUpto; newStateUpto++; q.accept = accCount > 0; newstate.put(p, q); } else { assert (accCount > 0 ? true:false) == q.accept: "accCount=" + accCount + " vs existing accept=" + q.accept + " states=" + statesSet; } r.addTransition(new Transition(lastPoint, point-1, q)); } // process transitions that end on this point // (closes an overlapping interval) Transition[] transitions = points.points[i].ends.transitions; int limit = points.points[i].ends.count; for(int j=0;j<limit;j++) { final Transition t = transitions[j]; final Integer num = t.to.number; statesSet.decr(num); accCount -= t.to.accept ? 1:0; } points.points[i].ends.count = 0; // process transitions that start on this point // (opens a new interval) transitions = points.points[i].starts.transitions; limit = points.points[i].starts.count; for(int j=0;j<limit;j++) { final Transition t = transitions[j]; final Integer num = t.to.number; statesSet.incr(num); accCount += t.to.accept ? 1:0; } lastPoint = point; points.points[i].starts.count = 0; } points.reset(); assert statesSet.upto == 0: "upto=" + statesSet.upto; } a.deterministic = true; a.setNumberedStates(newStatesArray, newStateUpto); }
static void determinize(Automaton a) { if (a.deterministic a.isSingleton()) { return; } final State[] allStates = a.getNumberedStates(); final boolean initAccept = a.initial.accept; final int initNumber = a.initial.number; a.initial = new State(); SortedIntSet.FrozenIntSet initialset = new SortedIntSet.FrozenIntSet(initNumber, a.initial); LinkedList<SortedIntSet.FrozenIntSet> worklist = new LinkedList<SortedIntSet.FrozenIntSet>(); Map<SortedIntSet.FrozenIntSet,State> newstate = new HashMap<SortedIntSet.FrozenIntSet,State>(); worklist.add(initialset); a.initial.accept = initAccept; newstate.put(initialset, a.initial); int newStateUpto = 0; State[] newStatesArray = new State[5]; newStatesArray[newStateUpto] = a.initial; a.initial.number = newStateUpto; newStateUpto++; final PointTransitionSet points = new PointTransitionSet(); final SortedIntSet statesSet = new SortedIntSet(5); while (worklist.size() > 0) { SortedIntSet.FrozenIntSet s = worklist.removeFirst(); for(int i=0;i<s.values.length;i++) { final State s0 = allStates[s.values[i]]; for(int j=0;j<s0.numTransitions;j++) { points.add(s0.transitionsArray[j]); } } if (points.count == 0) { continue; } points.sort(); int lastPoint = -1; int accCount = 0; final State r = s.state; for(int i=0;i<points.count;i++) { final int point = points.points[i].point; if (statesSet.upto > 0) { assert lastPoint != -1; statesSet.computeHash(); State q = newstate.get(statesSet); if (q == null) { q = new State(); final SortedIntSet.FrozenIntSet p = statesSet.freeze(q); worklist.add(p); if (newStateUpto == newStatesArray.length) { final State[] newArray = new State[ArrayUtil2.oversize(1+newStateUpto, RamUsageEstimator.NUM_BYTES_OBJECT_REF)]; System.arraycopy(newStatesArray, 0, newArray, 0, newStateUpto); newStatesArray = newArray; } newStatesArray[newStateUpto] = q; q.number = newStateUpto; newStateUpto++; q.accept = accCount > 0; newstate.put(p, q); } else { assert (accCount > 0 ? true:false) == q.accept: STR + accCount + STR + q.accept + STR + statesSet; } r.addTransition(new Transition(lastPoint, point-1, q)); } Transition[] transitions = points.points[i].ends.transitions; int limit = points.points[i].ends.count; for(int j=0;j<limit;j++) { final Transition t = transitions[j]; final Integer num = t.to.number; statesSet.decr(num); accCount -= t.to.accept ? 1:0; } points.points[i].ends.count = 0; transitions = points.points[i].starts.transitions; limit = points.points[i].starts.count; for(int j=0;j<limit;j++) { final Transition t = transitions[j]; final Integer num = t.to.number; statesSet.incr(num); accCount += t.to.accept ? 1:0; } lastPoint = point; points.points[i].starts.count = 0; } points.reset(); assert statesSet.upto == 0: "upto=" + statesSet.upto; } a.deterministic = true; a.setNumberedStates(newStatesArray, newStateUpto); }
/** * Determinizes the given automaton. * <p> * Worst case complexity: exponential in number of states. */
Determinizes the given automaton. Worst case complexity: exponential in number of states
determinize
{ "repo_name": "linkedin/indextank-engine", "path": "lucene-experimental/com/flaptor/org/apache/lucene/util/automaton/BasicOperations.java", "license": "apache-2.0", "size": 27626 }
[ "com.flaptor.org.apache.lucene.util.ArrayUtil2", "com.flaptor.org.apache.lucene.util.RamUsageEstimator", "java.util.HashMap", "java.util.LinkedList", "java.util.Map" ]
import com.flaptor.org.apache.lucene.util.ArrayUtil2; import com.flaptor.org.apache.lucene.util.RamUsageEstimator; import java.util.HashMap; import java.util.LinkedList; import java.util.Map;
import com.flaptor.org.apache.lucene.util.*; import java.util.*;
[ "com.flaptor.org", "java.util" ]
com.flaptor.org; java.util;
68,401
public static HttpSession getSession(HttpServletRequest it) { return (HttpSession)invoke(getSession, it, noargs); }
static HttpSession function(HttpServletRequest it) { return (HttpSession)invoke(getSession, it, noargs); }
/** * Throws <TT>MissingMethodError</TT> when run against 2.0 API, * introduced in 2.1. * * @param it * the HttpServletRequest * @return the <code>HttpSession</code> associated * with this request * @see javax.servlet.http.HttpServletRequest#getSession() * @since 2.1 */
Throws MissingMethodError when run against 2.0 API, introduced in 2.1
getSession
{ "repo_name": "timp21337/melati-old", "path": "melati/src/main/java/org/melati/util/HttpServletRequestCompat.java", "license": "gpl-2.0", "size": 29558 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpSession" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
2,137,114
public BulkRequestBuilder add(UpdateRequestBuilder request) { super.request.add(request.request()); return this; }
BulkRequestBuilder function(UpdateRequestBuilder request) { super.request.add(request.request()); return this; }
/** * Adds an {@link DeleteRequest} to the list of actions to execute. */
Adds an <code>DeleteRequest</code> to the list of actions to execute
add
{ "repo_name": "fabiofumarola/elasticsearch", "path": "src/main/java/org/elasticsearch/action/bulk/BulkRequestBuilder.java", "license": "apache-2.0", "size": 5827 }
[ "org.elasticsearch.action.update.UpdateRequestBuilder" ]
import org.elasticsearch.action.update.UpdateRequestBuilder;
import org.elasticsearch.action.update.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
1,426,818
@Nonnull public ComplianceManagementPartnerRequestBuilder complianceManagementPartners(@Nonnull final String id) { return new ComplianceManagementPartnerRequestBuilder(getRequestUrlWithAdditionalSegment("complianceManagementPartners") + "/" + id, getClient(), null); }
ComplianceManagementPartnerRequestBuilder function(@Nonnull final String id) { return new ComplianceManagementPartnerRequestBuilder(getRequestUrlWithAdditionalSegment(STR) + "/" + id, getClient(), null); }
/** * Gets a request builder for the ComplianceManagementPartner item * * @return the request builder * @param id the item identifier */
Gets a request builder for the ComplianceManagementPartner item
complianceManagementPartners
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/DeviceManagementRequestBuilder.java", "license": "mit", "size": 32327 }
[ "com.microsoft.graph.requests.ComplianceManagementPartnerRequestBuilder", "javax.annotation.Nonnull" ]
import com.microsoft.graph.requests.ComplianceManagementPartnerRequestBuilder; import javax.annotation.Nonnull;
import com.microsoft.graph.requests.*; import javax.annotation.*;
[ "com.microsoft.graph", "javax.annotation" ]
com.microsoft.graph; javax.annotation;
473,209
private void executeExternalHiveScript(String filename, List<String> env) throws IOException { // run Hive on the script and note the return code. String hiveExec = getHiveBinPath(); String[] argv = getHiveArgs(hiveExec, "-f", filename); LoggingAsyncSink logSink = new LoggingAsyncSink(LOG); int ret = Executor.exec(argv, env.toArray(new String[0]), logSink, logSink); if (0 != ret) { throw new IOException("Hive exited with status " + ret); } }
void function(String filename, List<String> env) throws IOException { String hiveExec = getHiveBinPath(); String[] argv = getHiveArgs(hiveExec, "-f", filename); LoggingAsyncSink logSink = new LoggingAsyncSink(LOG); int ret = Executor.exec(argv, env.toArray(new String[0]), logSink, logSink); if (0 != ret) { throw new IOException(STR + ret); } }
/** * Execute Hive via an external 'bin/hive' process. * @param filename the Script file to run. * @param env the environment strings to pass to any subprocess. * @throws IOException if Hive did not exit successfully. */
Execute Hive via an external 'bin/hive' process
executeExternalHiveScript
{ "repo_name": "bonnetb/sqoop", "path": "src/java/org/apache/sqoop/hive/HiveImport.java", "license": "apache-2.0", "size": 14524 }
[ "java.io.IOException", "java.util.List", "org.apache.sqoop.util.Executor", "org.apache.sqoop.util.LoggingAsyncSink" ]
import java.io.IOException; import java.util.List; import org.apache.sqoop.util.Executor; import org.apache.sqoop.util.LoggingAsyncSink;
import java.io.*; import java.util.*; import org.apache.sqoop.util.*;
[ "java.io", "java.util", "org.apache.sqoop" ]
java.io; java.util; org.apache.sqoop;
2,010,874
public int getFontStyle() { return Font.BOLD; }
int function() { return Font.BOLD; }
/** * Get the {@link Font#getStyle()) to use for drawing * the name of the road. * @return the style, e.g. Font.BOLD */
Get the {@link Font#getStyle()) to use for drawing the name of the road
getFontStyle
{ "repo_name": "xafero/travelingsales", "path": "osmnavigation/src/main/java/org/openstreetmap/travelingsalesman/painting/odr/ODR_WAY_TYPE.java", "license": "gpl-3.0", "size": 21979 }
[ "java.awt.Font" ]
import java.awt.Font;
import java.awt.*;
[ "java.awt" ]
java.awt;
535,104
Future<Void> delete(CacheKey key);
Future<Void> delete(CacheKey key);
/** * Delete a key from the cache. * * @param key the key to delete * @return a future so the API can be composed fluently */
Delete a key from the cache
delete
{ "repo_name": "vert-x3/vertx-web", "path": "vertx-web-client/src/main/java/io/vertx/ext/web/client/spi/CacheStore.java", "license": "apache-2.0", "size": 3872 }
[ "io.vertx.core.Future", "io.vertx.ext.web.client.impl.cache.CacheKey" ]
import io.vertx.core.Future; import io.vertx.ext.web.client.impl.cache.CacheKey;
import io.vertx.core.*; import io.vertx.ext.web.client.impl.cache.*;
[ "io.vertx.core", "io.vertx.ext" ]
io.vertx.core; io.vertx.ext;
2,377,242
private void buildTitleFeature(StringBuilder sb, TitleFeature titleFeature) throws VCardBuildException { try { if(titleFeature != null) { if(titleFeature.hasTitle()) { String title = titleFeature.getTitle(); StringBuilder tmpSb = new StringBuilder(); if(titleFeature.hasGroup()) { tmpSb.append(titleFeature.getGroup()); tmpSb.append("."); } tmpSb.append(titleFeature.getTypeString()); tmpSb.append(":"); tmpSb.append(VCardUtils.escapeString(title)); String tmpTitleLine = tmpSb.toString(); String foldedTitleLine = VCardUtils.foldLine(tmpTitleLine, foldingScheme); sb.append(foldedTitleLine); sb.append(VCardUtils.CRLF); } else { throw new VCardBuildException("TitleFeature ("+VCardType.TITLE.getType()+") exists but is emtpy."); } } } catch(Exception ex) { throw new VCardBuildException("TitleFeature ("+VCardType.TITLE.getType()+") ["+ex.getClass().getName()+"] "+ex.getMessage(), ex); } }
void function(StringBuilder sb, TitleFeature titleFeature) throws VCardBuildException { try { if(titleFeature != null) { if(titleFeature.hasTitle()) { String title = titleFeature.getTitle(); StringBuilder tmpSb = new StringBuilder(); if(titleFeature.hasGroup()) { tmpSb.append(titleFeature.getGroup()); tmpSb.append("."); } tmpSb.append(titleFeature.getTypeString()); tmpSb.append(":"); tmpSb.append(VCardUtils.escapeString(title)); String tmpTitleLine = tmpSb.toString(); String foldedTitleLine = VCardUtils.foldLine(tmpTitleLine, foldingScheme); sb.append(foldedTitleLine); sb.append(VCardUtils.CRLF); } else { throw new VCardBuildException(STR+VCardType.TITLE.getType()+STR); } } } catch(Exception ex) { throw new VCardBuildException(STR+VCardType.TITLE.getType()+STR+ex.getClass().getName()+STR+ex.getMessage(), ex); } }
/** * <p>Builds the title feature as a String.</p> * * @param sb * - The StringBuilder to append to * @param titleFeature * - The feature to output as a String * @throws VCardBuildException * Thrown when the title feature is null */
Builds the title feature as a String
buildTitleFeature
{ "repo_name": "FullMetal210/milton2", "path": "external/cardme/src/main/java/info/ineighborhood/cardme/io/VCardWriter.java", "license": "agpl-3.0", "size": 94646 }
[ "info.ineighborhood.cardme.util.VCardUtils", "info.ineighborhood.cardme.vcard.VCardType", "info.ineighborhood.cardme.vcard.errors.VCardBuildException", "info.ineighborhood.cardme.vcard.features.TitleFeature" ]
import info.ineighborhood.cardme.util.VCardUtils; import info.ineighborhood.cardme.vcard.VCardType; import info.ineighborhood.cardme.vcard.errors.VCardBuildException; import info.ineighborhood.cardme.vcard.features.TitleFeature;
import info.ineighborhood.cardme.util.*; import info.ineighborhood.cardme.vcard.*; import info.ineighborhood.cardme.vcard.errors.*; import info.ineighborhood.cardme.vcard.features.*;
[ "info.ineighborhood.cardme" ]
info.ineighborhood.cardme;
714,225
public static ims.ocrr.vo.ChartResultAnalyteVo insert(DomainObjectMap map, ims.ocrr.vo.ChartResultAnalyteVo valueObject, ims.ocrr.configuration.domain.objects.Analyte domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_Analyte(domainObject.getId()); valueObject.setIsRIE(domainObject.getIsRIE()); // If this is a recordedInError record, and the domainObject // value isIncludeRecord has not been set, then we return null and // not the value object if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord()) return null; // If this is not a recordedInError record, and the domainObject // value isIncludeRecord has been set, then we return null and // not the value object if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord()) return null; // DatasetType if (domainObject.getDatasetType() != null) { if(domainObject.getDatasetType() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the id already. { HibernateProxy p = (HibernateProxy) domainObject.getDatasetType(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setDatasetType(new ims.core.charting.vo.DatasetTypeRefVo(id, -1)); } else { valueObject.setDatasetType(new ims.core.charting.vo.DatasetTypeRefVo(domainObject.getDatasetType().getId(), domainObject.getDatasetType().getVersion())); } } return valueObject; }
static ims.ocrr.vo.ChartResultAnalyteVo function(DomainObjectMap map, ims.ocrr.vo.ChartResultAnalyteVo valueObject, ims.ocrr.configuration.domain.objects.Analyte domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_Analyte(domainObject.getId()); valueObject.setIsRIE(domainObject.getIsRIE()); if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord()) return null; if ((valueObject.getIsRIE() == null valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord()) return null; if (domainObject.getDatasetType() != null) { if(domainObject.getDatasetType() instanceof HibernateProxy) { HibernateProxy p = (HibernateProxy) domainObject.getDatasetType(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setDatasetType(new ims.core.charting.vo.DatasetTypeRefVo(id, -1)); } else { valueObject.setDatasetType(new ims.core.charting.vo.DatasetTypeRefVo(domainObject.getDatasetType().getId(), domainObject.getDatasetType().getVersion())); } } return valueObject; }
/** * Update the ValueObject with the Domain Object. * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.ocrr.configuration.domain.objects.Analyte */
Update the ValueObject with the Domain Object
insert
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/ocrr/vo/domain/ChartResultAnalyteVoAssembler.java", "license": "agpl-3.0", "size": 16556 }
[ "org.hibernate.proxy.HibernateProxy" ]
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.*;
[ "org.hibernate.proxy" ]
org.hibernate.proxy;
2,452,257
public static String authenticate(String username, String password, Handler handler, final Context context) { try { String token = AdmobRequest.login(username, password); sendResult("true", handler, context); return token; } catch (NetworkException e) { Log.e(TAG, "Unsuccessful Admob authentication, network error"); sendResult(AdmobRequest.ERROR_NETWORK_ERROR, handler, context); return AdmobRequest.ERROR_NETWORK_ERROR; } catch (AdmobInvalidRequestException e) { Log.e(TAG, "Unsuccessful Admob authentication, google accounts are not supported"); sendResult(AdmobRequest.ERROR_REQUEST_INVALID, handler, context); return null; } catch (AdmobRateLimitExceededException e) { Log.e(TAG, "Unsuccessful Admob authentication, rate limit excceded"); sendResult(AdmobRequest.ERROR_RATE_LIMIT_EXCEEDED, handler, context); return null; } catch (Exception e) { Log.e(TAG, "Unsuccessful Admob authentication"); sendResult("false", handler, context); return null; } }
static String function(String username, String password, Handler handler, final Context context) { try { String token = AdmobRequest.login(username, password); sendResult("true", handler, context); return token; } catch (NetworkException e) { Log.e(TAG, STR); sendResult(AdmobRequest.ERROR_NETWORK_ERROR, handler, context); return AdmobRequest.ERROR_NETWORK_ERROR; } catch (AdmobInvalidRequestException e) { Log.e(TAG, STR); sendResult(AdmobRequest.ERROR_REQUEST_INVALID, handler, context); return null; } catch (AdmobRateLimitExceededException e) { Log.e(TAG, STR); sendResult(AdmobRequest.ERROR_RATE_LIMIT_EXCEEDED, handler, context); return null; } catch (Exception e) { Log.e(TAG, STR); sendResult("false", handler, context); return null; } }
/** * Connects to the Voiper server, authenticates the provided username and * password. * * @param username * The user's username * @param password * The user's password * @param handler * The hander instance from the calling UI thread. * @param context * The context of the calling Activity. * @return boolean The boolean result indicating whether the user was * successfully authenticated. */
Connects to the Voiper server, authenticates the provided username and password
authenticate
{ "repo_name": "d4rken/andlytics", "path": "src/com/github/andlyticsproject/admob/AdmobAuthenticationUtilities.java", "license": "apache-2.0", "size": 7080 }
[ "android.content.Context", "android.os.Handler", "android.util.Log", "com.github.andlyticsproject.console.NetworkException" ]
import android.content.Context; import android.os.Handler; import android.util.Log; import com.github.andlyticsproject.console.NetworkException;
import android.content.*; import android.os.*; import android.util.*; import com.github.andlyticsproject.console.*;
[ "android.content", "android.os", "android.util", "com.github.andlyticsproject" ]
android.content; android.os; android.util; com.github.andlyticsproject;
180,794
public void unVisit(Room R); public String[] getAliasNames();
void unVisit(Room R); public String[] function();
/** * Returns the string array set of defined alias commands * for this player. * * @see com.suscipio_solutions.consecro_mud.Common.interfaces.PlayerStats#getAlias(String) * @see com.suscipio_solutions.consecro_mud.Common.interfaces.PlayerStats#addAliasName(String) * @see com.suscipio_solutions.consecro_mud.Common.interfaces.PlayerStats#delAliasName(String) * @see com.suscipio_solutions.consecro_mud.Common.interfaces.PlayerStats#setAlias(String, String) * * @return the string array set of defined alias commands. */
Returns the string array set of defined alias commands for this player
getAliasNames
{ "repo_name": "ConsecroMUD/ConsecroMUD", "path": "com/suscipio_solutions/consecro_mud/Common/interfaces/PlayerStats.java", "license": "apache-2.0", "size": 28723 }
[ "com.suscipio_solutions.consecro_mud.Locales" ]
import com.suscipio_solutions.consecro_mud.Locales;
import com.suscipio_solutions.consecro_mud.*;
[ "com.suscipio_solutions.consecro_mud" ]
com.suscipio_solutions.consecro_mud;
759,435
XmlWriter xml = new XmlWriter(); xml.start("Delete"); if ( rq.getQuiet() ) { xml.start("Quiet").value("true").end(); } for (KeyVersion keyVersion : rq.getKeys()) { writeKeyVersion(xml, keyVersion); } xml.end(); return xml.getBytes(); }
XmlWriter xml = new XmlWriter(); xml.start(STR); if ( rq.getQuiet() ) { xml.start("Quiet").value("true").end(); } for (KeyVersion keyVersion : rq.getKeys()) { writeKeyVersion(xml, keyVersion); } xml.end(); return xml.getBytes(); }
/** * Converts the specified {@link DeleteObjectsRequest} object to an XML fragment that * can be sent to Amazon S3. * * @param rq * The {@link DeleteObjectsRequest} */
Converts the specified <code>DeleteObjectsRequest</code> object to an XML fragment that can be sent to Amazon S3
convertToXmlByteArray
{ "repo_name": "flofreud/aws-sdk-java", "path": "aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/MultiObjectDeleteXmlFactory.java", "license": "apache-2.0", "size": 2005 }
[ "com.amazonaws.services.s3.internal.XmlWriter", "com.amazonaws.services.s3.model.DeleteObjectsRequest" ]
import com.amazonaws.services.s3.internal.XmlWriter; import com.amazonaws.services.s3.model.DeleteObjectsRequest;
import com.amazonaws.services.s3.internal.*; import com.amazonaws.services.s3.model.*;
[ "com.amazonaws.services" ]
com.amazonaws.services;
2,442,994
private void addParameter(Parameter para) { if (para.getId() == null) { para.setId(dataProvider.getList().size() + 1); dataProvider.getList().add(para); } else { csvDataGrid.getSelectionModel().setSelected(para, false); dataProvider.refresh(); } dataProvider.flush(); rebuildPager(dataGridPagination, dataGridPager); }
void function(Parameter para) { if (para.getId() == null) { para.setId(dataProvider.getList().size() + 1); dataProvider.getList().add(para); } else { csvDataGrid.getSelectionModel().setSelected(para, false); dataProvider.refresh(); } dataProvider.flush(); rebuildPager(dataGridPagination, dataGridPager); }
/** * Add a parameter into the table. * * @param para the parameter to be added */
Add a parameter into the table
addParameter
{ "repo_name": "jiangong01/LONIA", "path": "src/edu/ucla/cs/lonia/client/widget/CSVEditor.java", "license": "lgpl-3.0", "size": 40221 }
[ "edu.ucla.cs.lonia.client.model.Parameter" ]
import edu.ucla.cs.lonia.client.model.Parameter;
import edu.ucla.cs.lonia.client.model.*;
[ "edu.ucla.cs" ]
edu.ucla.cs;
1,866,633
public ContentContext getContextNotEmpty(MenuElement page) throws Exception { if (!page.isEmpty(this, ComponentBean.DEFAULT_AREA, false)) { return getContextOnPage(page); } else { ContentContext lgCtx = new ContentContext(this); lgCtx.setContentLanguage(getLanguage()); lgCtx.setRequestContentLanguage(null); if (!page.isEmpty(lgCtx, ComponentBean.DEFAULT_AREA, false)) { return lgCtx; } else { GlobalContext globalContext = GlobalContext.getInstance(getRequest()); Collection<String> lgs = globalContext.getDefaultLanguages(); for (String lg : lgs) { lgCtx.setAllLanguage(lg); if (!page.isEmpty(lgCtx, ComponentBean.DEFAULT_AREA, false)) { return lgCtx.getContextOnPage(page); } } } } return null; }
ContentContext function(MenuElement page) throws Exception { if (!page.isEmpty(this, ComponentBean.DEFAULT_AREA, false)) { return getContextOnPage(page); } else { ContentContext lgCtx = new ContentContext(this); lgCtx.setContentLanguage(getLanguage()); lgCtx.setRequestContentLanguage(null); if (!page.isEmpty(lgCtx, ComponentBean.DEFAULT_AREA, false)) { return lgCtx; } else { GlobalContext globalContext = GlobalContext.getInstance(getRequest()); Collection<String> lgs = globalContext.getDefaultLanguages(); for (String lg : lgs) { lgCtx.setAllLanguage(lg); if (!page.isEmpty(lgCtx, ComponentBean.DEFAULT_AREA, false)) { return lgCtx.getContextOnPage(page); } } } } return null; }
/** * return a context with at least one element (if exist), it can be change the * language (and only this) of the current context. this method use only the * default language list. * * @return null if no content found. * @throws Exception */
return a context with at least one element (if exist), it can be change the language (and only this) of the current context. this method use only the default language list
getContextNotEmpty
{ "repo_name": "Javlo/javlo", "path": "src/main/java/org/javlo/context/ContentContext.java", "license": "lgpl-3.0", "size": 62898 }
[ "java.util.Collection", "org.javlo.component.core.ComponentBean", "org.javlo.navigation.MenuElement" ]
import java.util.Collection; import org.javlo.component.core.ComponentBean; import org.javlo.navigation.MenuElement;
import java.util.*; import org.javlo.component.core.*; import org.javlo.navigation.*;
[ "java.util", "org.javlo.component", "org.javlo.navigation" ]
java.util; org.javlo.component; org.javlo.navigation;
2,807,900
public MailService getMailService() { return mailService; }
MailService function() { return mailService; }
/** * Gets the mailService attribute. * @return Returns the mailService. */
Gets the mailService attribute
getMailService
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/sys/service/impl/KfsNotificationServiceImpl.java", "license": "agpl-3.0", "size": 6513 }
[ "org.kuali.rice.krad.service.MailService" ]
import org.kuali.rice.krad.service.MailService;
import org.kuali.rice.krad.service.*;
[ "org.kuali.rice" ]
org.kuali.rice;
840,086
void executeBuild(UUID buildId, AnalysisResult analysisResult, BuildResult buildResult, BuildConfigurationCollection configurations, ImmutableMap<PackageIdentifier, Path> packageRoots, TopLevelArtifactContext topLevelArtifactContext) throws BuildFailedException, InterruptedException, TestExecException, AbruptExitException { Stopwatch timer = Stopwatch.createStarted(); prepare(packageRoots, analysisResult.getWorkspaceName()); ActionGraph actionGraph = analysisResult.getActionGraph(); // Get top-level artifacts. ImmutableSet<Artifact> additionalArtifacts = analysisResult.getAdditionalArtifactsToBuild(); OutputService outputService = env.getOutputService(); ModifiedFileSet modifiedOutputFiles = ModifiedFileSet.EVERYTHING_MODIFIED; if (outputService != null) { modifiedOutputFiles = outputService.startBuild(buildId, request.getBuildOptions().finalizeActions); } else { // TODO(bazel-team): this could be just another OutputService startLocalOutputBuild(analysisResult.getWorkspaceName()); } List<BuildConfiguration> targetConfigurations = configurations.getTargetConfigurations(); BuildConfiguration targetConfiguration = targetConfigurations.size() == 1 ? targetConfigurations.get(0) : null; if (targetConfigurations.size() == 1) { String productName = runtime.getProductName(); String dirName = env.getWorkspaceName(); String workspaceName = analysisResult.getWorkspaceName(); OutputDirectoryLinksUtils.createOutputDirectoryLinks( dirName, env.getWorkspace(), env.getDirectories().getExecRoot(workspaceName), env.getDirectories().getOutputPath(workspaceName), getReporter(), targetConfiguration, request.getBuildOptions().getSymlinkPrefix(productName), productName); } ActionCache actionCache = getActionCache(); SkyframeExecutor skyframeExecutor = env.getSkyframeExecutor(); Builder builder = createBuilder( request, actionCache, skyframeExecutor, modifiedOutputFiles); // // Execution proper. All statements below are logically nested in // begin/end pairs. No early returns or exceptions please! // Collection<ConfiguredTarget> configuredTargets = buildResult.getActualTargets(); env.getEventBus().post(new ExecutionStartingEvent(configuredTargets)); getReporter().handle(Event.progress("Building...")); // Conditionally record dependency-checker log: ExplanationHandler explanationHandler = installExplanationHandler(request.getBuildOptions().explanationPath, request.getOptionsDescription()); Set<ConfiguredTarget> builtTargets = new HashSet<>(); Collection<AspectValue> aspects = analysisResult.getAspects(); Iterable<Artifact> allArtifactsForProviders = Iterables.concat( additionalArtifacts, TopLevelArtifactHelper.getAllArtifactsToBuild( analysisResult.getTargetsToBuild(), analysisResult.getTopLevelContext()) .getAllArtifacts(), TopLevelArtifactHelper.getAllArtifactsToBuildFromAspects( aspects, analysisResult.getTopLevelContext()) .getAllArtifacts(), //TODO(dslomov): Artifacts to test from aspects? TopLevelArtifactHelper.getAllArtifactsToTest(analysisResult.getTargetsToTest())); if (request.isRunningInEmacs()) { // The syntax of this message is tightly constrained by lisp/progmodes/compile.el in emacs request.getOutErr().printErrLn("blaze: Entering directory `" + getExecRoot() + "/'"); } boolean buildCompleted = false; try { for (ActionContextProvider actionContextProvider : actionContextProviders) { actionContextProvider.executionPhaseStarting(actionGraph, allArtifactsForProviders); } executor.executionPhaseStarting(); skyframeExecutor.drainChangedFiles(); if (request.getViewOptions().discardAnalysisCache) { // Free memory by removing cache entries that aren't going to be needed. Note that in // skyframe full, this destroys the action graph as well, so we can only do it after the // action graph is no longer needed. env.getSkyframeBuildView().clearAnalysisCache(analysisResult.getTargetsToBuild()); } configureResourceManager(request); Profiler.instance().markPhase(ProfilePhase.EXECUTE); builder.buildArtifacts( env.getReporter(), additionalArtifacts, analysisResult.getParallelTests(), analysisResult.getExclusiveTests(), analysisResult.getTargetsToBuild(), analysisResult.getAspects(), executor, builtTargets, request.getBuildOptions().explanationPath != null, env.getBlazeWorkspace().getLastExecutionTimeRange(), topLevelArtifactContext); buildCompleted = true; } catch (BuildFailedException | TestExecException e) { buildCompleted = true; throw e; } finally { env.recordLastExecutionTime(); if (request.isRunningInEmacs()) { request.getOutErr().printErrLn("blaze: Leaving directory `" + getExecRoot() + "/'"); } if (buildCompleted) { getReporter().handle(Event.progress("Building complete.")); } env.getEventBus().post(new ExecutionFinishedEvent(ImmutableMap.<String, Long> of(), 0L, skyframeExecutor.getOutputDirtyFilesAndClear(), skyframeExecutor.getModifiedFilesDuringPreviousBuildAndClear())); executor.executionPhaseEnding(); for (ActionContextProvider actionContextProvider : actionContextProviders) { actionContextProvider.executionPhaseEnding(); } Profiler.instance().markPhase(ProfilePhase.FINISH); if (buildCompleted) { saveCaches(actionCache); } try (AutoProfiler p = AutoProfiler.profiled("Show results", ProfilerTask.INFO)) { buildResult.setSuccessfulTargets( determineSuccessfulTargets(configuredTargets, builtTargets, timer)); BuildResultPrinter buildResultPrinter = new BuildResultPrinter(env); buildResultPrinter.showBuildResult( request, buildResult, configuredTargets, analysisResult.getAspects()); } try (AutoProfiler p = AutoProfiler.profiled("Show artifacts", ProfilerTask.INFO)) { if (request.getBuildOptions().showArtifacts) { BuildResultPrinter buildResultPrinter = new BuildResultPrinter(env); buildResultPrinter.showArtifacts( request, configuredTargets, analysisResult.getAspects()); } } if (explanationHandler != null) { uninstallExplanationHandler(explanationHandler); } // Finalize output service last, so that if we do throw an exception, we know all the other // code has already run. if (env.getOutputService() != null) { boolean isBuildSuccessful = buildResult.getSuccessfulTargets().size() == configuredTargets.size(); env.getOutputService().finalizeBuild(isBuildSuccessful); } } }
void executeBuild(UUID buildId, AnalysisResult analysisResult, BuildResult buildResult, BuildConfigurationCollection configurations, ImmutableMap<PackageIdentifier, Path> packageRoots, TopLevelArtifactContext topLevelArtifactContext) throws BuildFailedException, InterruptedException, TestExecException, AbruptExitException { Stopwatch timer = Stopwatch.createStarted(); prepare(packageRoots, analysisResult.getWorkspaceName()); ActionGraph actionGraph = analysisResult.getActionGraph(); ImmutableSet<Artifact> additionalArtifacts = analysisResult.getAdditionalArtifactsToBuild(); OutputService outputService = env.getOutputService(); ModifiedFileSet modifiedOutputFiles = ModifiedFileSet.EVERYTHING_MODIFIED; if (outputService != null) { modifiedOutputFiles = outputService.startBuild(buildId, request.getBuildOptions().finalizeActions); } else { startLocalOutputBuild(analysisResult.getWorkspaceName()); } List<BuildConfiguration> targetConfigurations = configurations.getTargetConfigurations(); BuildConfiguration targetConfiguration = targetConfigurations.size() == 1 ? targetConfigurations.get(0) : null; if (targetConfigurations.size() == 1) { String productName = runtime.getProductName(); String dirName = env.getWorkspaceName(); String workspaceName = analysisResult.getWorkspaceName(); OutputDirectoryLinksUtils.createOutputDirectoryLinks( dirName, env.getWorkspace(), env.getDirectories().getExecRoot(workspaceName), env.getDirectories().getOutputPath(workspaceName), getReporter(), targetConfiguration, request.getBuildOptions().getSymlinkPrefix(productName), productName); } ActionCache actionCache = getActionCache(); SkyframeExecutor skyframeExecutor = env.getSkyframeExecutor(); Builder builder = createBuilder( request, actionCache, skyframeExecutor, modifiedOutputFiles); Collection<ConfiguredTarget> configuredTargets = buildResult.getActualTargets(); env.getEventBus().post(new ExecutionStartingEvent(configuredTargets)); getReporter().handle(Event.progress(STR)); ExplanationHandler explanationHandler = installExplanationHandler(request.getBuildOptions().explanationPath, request.getOptionsDescription()); Set<ConfiguredTarget> builtTargets = new HashSet<>(); Collection<AspectValue> aspects = analysisResult.getAspects(); Iterable<Artifact> allArtifactsForProviders = Iterables.concat( additionalArtifacts, TopLevelArtifactHelper.getAllArtifactsToBuild( analysisResult.getTargetsToBuild(), analysisResult.getTopLevelContext()) .getAllArtifacts(), TopLevelArtifactHelper.getAllArtifactsToBuildFromAspects( aspects, analysisResult.getTopLevelContext()) .getAllArtifacts(), TopLevelArtifactHelper.getAllArtifactsToTest(analysisResult.getTargetsToTest())); if (request.isRunningInEmacs()) { request.getOutErr().printErrLn(STR + getExecRoot() + "/'"); } boolean buildCompleted = false; try { for (ActionContextProvider actionContextProvider : actionContextProviders) { actionContextProvider.executionPhaseStarting(actionGraph, allArtifactsForProviders); } executor.executionPhaseStarting(); skyframeExecutor.drainChangedFiles(); if (request.getViewOptions().discardAnalysisCache) { env.getSkyframeBuildView().clearAnalysisCache(analysisResult.getTargetsToBuild()); } configureResourceManager(request); Profiler.instance().markPhase(ProfilePhase.EXECUTE); builder.buildArtifacts( env.getReporter(), additionalArtifacts, analysisResult.getParallelTests(), analysisResult.getExclusiveTests(), analysisResult.getTargetsToBuild(), analysisResult.getAspects(), executor, builtTargets, request.getBuildOptions().explanationPath != null, env.getBlazeWorkspace().getLastExecutionTimeRange(), topLevelArtifactContext); buildCompleted = true; } catch (BuildFailedException TestExecException e) { buildCompleted = true; throw e; } finally { env.recordLastExecutionTime(); if (request.isRunningInEmacs()) { request.getOutErr().printErrLn(STR + getExecRoot() + "/'"); } if (buildCompleted) { getReporter().handle(Event.progress(STR)); } env.getEventBus().post(new ExecutionFinishedEvent(ImmutableMap.<String, Long> of(), 0L, skyframeExecutor.getOutputDirtyFilesAndClear(), skyframeExecutor.getModifiedFilesDuringPreviousBuildAndClear())); executor.executionPhaseEnding(); for (ActionContextProvider actionContextProvider : actionContextProviders) { actionContextProvider.executionPhaseEnding(); } Profiler.instance().markPhase(ProfilePhase.FINISH); if (buildCompleted) { saveCaches(actionCache); } try (AutoProfiler p = AutoProfiler.profiled(STR, ProfilerTask.INFO)) { buildResult.setSuccessfulTargets( determineSuccessfulTargets(configuredTargets, builtTargets, timer)); BuildResultPrinter buildResultPrinter = new BuildResultPrinter(env); buildResultPrinter.showBuildResult( request, buildResult, configuredTargets, analysisResult.getAspects()); } try (AutoProfiler p = AutoProfiler.profiled(STR, ProfilerTask.INFO)) { if (request.getBuildOptions().showArtifacts) { BuildResultPrinter buildResultPrinter = new BuildResultPrinter(env); buildResultPrinter.showArtifacts( request, configuredTargets, analysisResult.getAspects()); } } if (explanationHandler != null) { uninstallExplanationHandler(explanationHandler); } if (env.getOutputService() != null) { boolean isBuildSuccessful = buildResult.getSuccessfulTargets().size() == configuredTargets.size(); env.getOutputService().finalizeBuild(isBuildSuccessful); } } }
/** * Performs the execution phase (phase 3) of the build, in which the Builder * is applied to the action graph to bring the targets up to date. (This * function will return prior to execution-proper if --nobuild was specified.) * @param buildId UUID of the build id * @param analysisResult the analysis phase output * @param buildResult the mutable build result * @param packageRoots package roots collected from loading phase and BuildConfigurationCollection * creation */
Performs the execution phase (phase 3) of the build, in which the Builder is applied to the action graph to bring the targets up to date. (This function will return prior to execution-proper if --nobuild was specified.)
executeBuild
{ "repo_name": "kchodorow/bazel", "path": "src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java", "license": "apache-2.0", "size": 30293 }
[ "com.google.common.base.Stopwatch", "com.google.common.collect.ImmutableMap", "com.google.common.collect.ImmutableSet", "com.google.common.collect.Iterables", "com.google.devtools.build.lib.actions.ActionGraph", "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.actions.Bui...
import com.google.common.base.Stopwatch; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.ActionGraph; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.BuildFailedException; import com.google.devtools.build.lib.actions.TestExecException; import com.google.devtools.build.lib.actions.cache.ActionCache; import com.google.devtools.build.lib.analysis.BuildView; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.TopLevelArtifactContext; import com.google.devtools.build.lib.analysis.TopLevelArtifactHelper; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.analysis.config.BuildConfigurationCollection; import com.google.devtools.build.lib.buildtool.buildevent.ExecutionStartingEvent; import com.google.devtools.build.lib.cmdline.PackageIdentifier; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.exec.ActionContextProvider; import com.google.devtools.build.lib.exec.OutputService; import com.google.devtools.build.lib.profiler.AutoProfiler; import com.google.devtools.build.lib.profiler.ProfilePhase; import com.google.devtools.build.lib.profiler.Profiler; import com.google.devtools.build.lib.profiler.ProfilerTask; import com.google.devtools.build.lib.skyframe.AspectValue; import com.google.devtools.build.lib.skyframe.Builder; import com.google.devtools.build.lib.skyframe.SkyframeExecutor; import com.google.devtools.build.lib.util.AbruptExitException; import com.google.devtools.build.lib.vfs.ModifiedFileSet; import com.google.devtools.build.lib.vfs.Path; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set;
import com.google.common.base.*; import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.actions.cache.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.analysis.config.*; import com.google.devtools.build.lib.buildtool.buildevent.*; import com.google.devtools.build.lib.cmdline.*; import com.google.devtools.build.lib.events.*; import com.google.devtools.build.lib.exec.*; import com.google.devtools.build.lib.profiler.*; import com.google.devtools.build.lib.skyframe.*; import com.google.devtools.build.lib.util.*; import com.google.devtools.build.lib.vfs.*; import java.util.*;
[ "com.google.common", "com.google.devtools", "java.util" ]
com.google.common; com.google.devtools; java.util;
588,867
public IBlockState getStateFromMeta(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockPlanks.EnumType.byMetadata(meta & 7)); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); } return iblockstate; }
IBlockState function(int meta) { IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, BlockPlanks.EnumType.byMetadata(meta & 7)); if (!this.isDouble()) { iblockstate = iblockstate.withProperty(HALF, (meta & 8) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP); } return iblockstate; }
/** * Convert the given metadata into a BlockState for this Block */
Convert the given metadata into a BlockState for this Block
getStateFromMeta
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraft/block/BlockWoodSlab.java", "license": "lgpl-2.1", "size": 4473 }
[ "net.minecraft.block.state.IBlockState" ]
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.state.*;
[ "net.minecraft.block" ]
net.minecraft.block;
1,667,068
public Set<InstallLicense> getServerPackageFeatureLicense(File archive, boolean offlineOnly, Locale locale) throws InstallException { String aName = archive.getAbsolutePath().toLowerCase(); ServerPackageAsset spa = null; if (ServerPackageZipAsset.validType(aName)) { spa = new ServerPackageZipAsset(archive, false); } else if (ServerPackageJarAsset.validType(aName)) { spa = new ServerPackageJarAsset(archive, false); } else { return new HashSet<InstallLicense>(); } return getFeatureLicense(spa.getRequiredFeatures(), locale, null, null); }
Set<InstallLicense> function(File archive, boolean offlineOnly, Locale locale) throws InstallException { String aName = archive.getAbsolutePath().toLowerCase(); ServerPackageAsset spa = null; if (ServerPackageZipAsset.validType(aName)) { spa = new ServerPackageZipAsset(archive, false); } else if (ServerPackageJarAsset.validType(aName)) { spa = new ServerPackageJarAsset(archive, false); } else { return new HashSet<InstallLicense>(); } return getFeatureLicense(spa.getRequiredFeatures(), locale, null, null); }
/** * Gets the licenses for the specified archive file * * @param archive the archive file * @param offlineOnly if features should be only retrieved locally * @param locale Locale for the licenses * @return A set of InstallLicesese for the features in the archive file * @throws InstallException */
Gets the licenses for the specified archive file
getServerPackageFeatureLicense
{ "repo_name": "kgibm/open-liberty", "path": "dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java", "license": "epl-1.0", "size": 93799 }
[ "com.ibm.ws.install.InstallException", "com.ibm.ws.install.InstallLicense", "com.ibm.ws.install.internal.asset.ServerPackageAsset", "com.ibm.ws.install.internal.asset.ServerPackageJarAsset", "com.ibm.ws.install.internal.asset.ServerPackageZipAsset", "java.io.File", "java.util.HashSet", "java.util.Loca...
import com.ibm.ws.install.InstallException; import com.ibm.ws.install.InstallLicense; import com.ibm.ws.install.internal.asset.ServerPackageAsset; import com.ibm.ws.install.internal.asset.ServerPackageJarAsset; import com.ibm.ws.install.internal.asset.ServerPackageZipAsset; import java.io.File; import java.util.HashSet; import java.util.Locale; import java.util.Set;
import com.ibm.ws.install.*; import com.ibm.ws.install.internal.asset.*; import java.io.*; import java.util.*;
[ "com.ibm.ws", "java.io", "java.util" ]
com.ibm.ws; java.io; java.util;
2,721,837
public static CustomRuleDTO fromCustomPolicyToDTO(CustomPolicy globalPolicy) throws UnsupportedThrottleLimitTypeException { CustomRuleDTO policyDTO = new CustomRuleDTO(); policyDTO = CommonThrottleMappingUtil.updateFieldsFromToPolicyToDTO(globalPolicy, policyDTO); policyDTO.setKeyTemplate(globalPolicy.getKeyTemplate()); policyDTO.setSiddhiQuery(globalPolicy.getSiddhiQuery()); return policyDTO; }
static CustomRuleDTO function(CustomPolicy globalPolicy) throws UnsupportedThrottleLimitTypeException { CustomRuleDTO policyDTO = new CustomRuleDTO(); policyDTO = CommonThrottleMappingUtil.updateFieldsFromToPolicyToDTO(globalPolicy, policyDTO); policyDTO.setKeyTemplate(globalPolicy.getKeyTemplate()); policyDTO.setSiddhiQuery(globalPolicy.getSiddhiQuery()); return policyDTO; }
/** * Converts a single Custom Policy model object into DTO object. * * @param globalPolicy Custom Policy model object * @return DTO object derived from the Policy model object * @throws UnsupportedThrottleLimitTypeException */
Converts a single Custom Policy model object into DTO object
fromCustomPolicyToDTO
{ "repo_name": "rswijesena/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.admin/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/mappings/CustomPolicyMappingUtil.java", "license": "apache-2.0", "size": 3569 }
[ "org.wso2.carbon.apimgt.core.models.policy.CustomPolicy", "org.wso2.carbon.apimgt.rest.api.admin.dto.CustomRuleDTO", "org.wso2.carbon.apimgt.rest.api.admin.exceptions.UnsupportedThrottleLimitTypeException" ]
import org.wso2.carbon.apimgt.core.models.policy.CustomPolicy; import org.wso2.carbon.apimgt.rest.api.admin.dto.CustomRuleDTO; import org.wso2.carbon.apimgt.rest.api.admin.exceptions.UnsupportedThrottleLimitTypeException;
import org.wso2.carbon.apimgt.core.models.policy.*; import org.wso2.carbon.apimgt.rest.api.admin.dto.*; import org.wso2.carbon.apimgt.rest.api.admin.exceptions.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
1,840,967
private void fullyPopulateAccessibilityNodeInfo(AccessibilityNodeInfo info) { info.setParent(new View(getContext())); info.setSource(new View(getContext())); info.addChild(new View(getContext())); info.addChild(new View(getContext()), 1); info.setBoundsInParent(new Rect(1,1,1,1)); info.setBoundsInScreen(new Rect(2,2,2,2)); info.setClassName("foo.bar.baz.Class"); info.setContentDescription("content description"); info.setPackageName("foo.bar.baz"); info.setText("text"); info.setCheckable(true); info.setChecked(true); info.setClickable(true); info.setEnabled(true); info.setFocusable(true); info.setFocused(true); info.setLongClickable(true); info.setPassword(true); info.setScrollable(true); info.setSelected(true); info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_FOCUS); info.setAccessibilityFocused(true); info.setMovementGranularities(AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE); info.setLabeledBy(new View(getContext())); info.setLabelFor(new View(getContext())); info.setViewIdResourceName("foo.bar:id/baz"); }
void function(AccessibilityNodeInfo info) { info.setParent(new View(getContext())); info.setSource(new View(getContext())); info.addChild(new View(getContext())); info.addChild(new View(getContext()), 1); info.setBoundsInParent(new Rect(1,1,1,1)); info.setBoundsInScreen(new Rect(2,2,2,2)); info.setClassName(STR); info.setContentDescription(STR); info.setPackageName(STR); info.setText("text"); info.setCheckable(true); info.setChecked(true); info.setClickable(true); info.setEnabled(true); info.setFocusable(true); info.setFocused(true); info.setLongClickable(true); info.setPassword(true); info.setScrollable(true); info.setSelected(true); info.addAction(AccessibilityNodeInfo.ACTION_CLEAR_FOCUS); info.setAccessibilityFocused(true); info.setMovementGranularities(AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE); info.setLabeledBy(new View(getContext())); info.setLabelFor(new View(getContext())); info.setViewIdResourceName(STR); }
/** * Fully populates the {@link AccessibilityNodeInfo} to marshal. * * @param info The node info to populate. */
Fully populates the <code>AccessibilityNodeInfo</code> to marshal
fullyPopulateAccessibilityNodeInfo
{ "repo_name": "indashnet/InDashNet.Open.UN2000", "path": "android/cts/tests/tests/accessibility/src/android/view/accessibility/cts/AccessibilityNodeInfoTest.java", "license": "apache-2.0", "size": 10355 }
[ "android.graphics.Rect", "android.view.View", "android.view.accessibility.AccessibilityNodeInfo" ]
import android.graphics.Rect; import android.view.View; import android.view.accessibility.AccessibilityNodeInfo;
import android.graphics.*; import android.view.*; import android.view.accessibility.*;
[ "android.graphics", "android.view" ]
android.graphics; android.view;
386,515
EReference getNodeStyleDefinition_Border();
EReference getNodeStyleDefinition_Border();
/** * Returns the meta object for the containment reference '{@link fr.obeo.dsl.sPrototyper.NodeStyleDefinition#getBorder <em>Border</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Border</em>'. * @see fr.obeo.dsl.sPrototyper.NodeStyleDefinition#getBorder() * @see #getNodeStyleDefinition() * @generated */
Returns the meta object for the containment reference '<code>fr.obeo.dsl.sPrototyper.NodeStyleDefinition#getBorder Border</code>'.
getNodeStyleDefinition_Border
{ "repo_name": "glefur/s-prototyper", "path": "plugins/fr.obeo.dsl.sprototyper/src-gen/fr/obeo/dsl/sPrototyper/SPrototyperPackage.java", "license": "apache-2.0", "size": 98928 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,402,568
@Type(type="com.servinglynk.hmis.warehouse.enums.ClientDobDataQualityEnumType") @Basic( optional = true ) @Column( name = "dob_data_quality" ) public ClientDobDataQualityEnum getDobDataQuality() { return this.dobDataQuality; }
@Type(type=STR) @Basic( optional = true ) @Column( name = STR ) ClientDobDataQualityEnum function() { return this.dobDataQuality; }
/** * Return the value associated with the column: dobDataQuality. * @return A ClientDobDataQualityEnum object (this.dobDataQuality) */
Return the value associated with the column: dobDataQuality
getDobDataQuality
{ "repo_name": "servinglynk/hmis-lynk-open-source", "path": "hmis-model-v2015/src/main/java/com/servinglynk/hmis/warehouse/model/v2015/Client.java", "license": "mpl-2.0", "size": 23038 }
[ "com.servinglynk.hmis.warehouse.enums.ClientDobDataQualityEnum", "javax.persistence.Basic", "javax.persistence.Column", "org.hibernate.annotations.Type" ]
import com.servinglynk.hmis.warehouse.enums.ClientDobDataQualityEnum; import javax.persistence.Basic; import javax.persistence.Column; import org.hibernate.annotations.Type;
import com.servinglynk.hmis.warehouse.enums.*; import javax.persistence.*; import org.hibernate.annotations.*;
[ "com.servinglynk.hmis", "javax.persistence", "org.hibernate.annotations" ]
com.servinglynk.hmis; javax.persistence; org.hibernate.annotations;
1,844,469
public static List<ConstructedWord> analyze (String word, String...options) { List<ConstructedWord> analyses = new ArrayList<ConstructedWord>(); List<String> wc = null; if (options != null && options.length > 0 && !options[0].isEmpty()) { wc = Collections.singletonList(options[0]); } else { wc = WordClassGuesser.guess(word); } ParadigmAccessor pa = new ParadigmAccessor(); IrregularNouns irrnoun = pa.getIrregularNouns(); IrregularNumerals irrnum = pa.getIrregularNumerals(); Lemmatizer l = new Lemmatizer(); Paradigm pronoun = pa.getPronounParadigm(); for (Morpheme mo : pronoun.getMorphemes()) { if (mo.exactly(word)) { FeatureSet feat = new FeatureSet(); for (Feature f : mo.getFeatureSet()) { if (f.getKey().equals("case")) { feat.add(new Feature("case", "nominative")); } else if (f.getKey().equals("number")) { feat.add(new Feature("number", "singular")); } else { feat.add(f); } } Paradigm p = pronoun.getParadigmByFeatures(feat); for (Morph m : p.getEndings()) { String lemma = m.getMorph(); analyses.add(constructWord(word, lemma, mo.getFeatureSet())); } } // TODO premature return? } if (irrnoun.isIrregular(word)) { Paradigm p = irrnoun.getLemma(word); for (Morpheme m : p.getMorphemes()) { for (Morph n : m.getAllomorphs()) { String lemma = n.getMorph(); analyses.add(constructWord(word, lemma, irrnoun.getForms(word).getFeatureSet(word))); } } // premature? } if (irrnum.isIrregular(word)) { Paradigm p = irrnum.getLemma(word); for (Morpheme m : p.getMorphemes()) { for (Morph n : m.getAllomorphs()) { String lemma = n.getMorph(); analyses.add(constructWord(word, lemma, irrnum.getForms(word).getFeatureSet(word))); } } // TODO premature return? } // TODO affixes currently not used Map<String, String> map = new HashMap<String, String>(); // for each word class guess for (String wci : wc) { if (wci.equals("adverb")) { AdverbStrategy as = new AdverbStrategy(); analyses.addAll(as.apply(word)); continue; } // retrieve relevant paradigm Paradigm p = pa.getParadigmsByFeatures(new FeatureSet("paradigm", wci)); // merge suffix paradigm in // TODO affix not used //p.getMorphemes().addAll(suffix.getMorphemes()); // if no prefix was found, add word to map to avoid null verb if (map.isEmpty()) { map.put("", word); } for (Entry<String, String> e : map.entrySet()) { String pre = e.getKey(); String pre_word = e.getValue(); for (Morpheme morpheme : p.getMorphemes()) { if (morpheme.isApplicable(word)) { // identify boundaries word<->ending String ending = morpheme.match(word); String stem = ""; // set word to pre_word if prefix and suffix are not longer than word if (!pre.isEmpty() && pre.length() + ending.length() < word.length()) { stem = pre_word; } else { stem = word; } String start = stem.substring(0,stem.length()-ending.length()); // derive lemma from start under "wci" assumption // with declension info if present String dec = morpheme.getFeatureByName("declension"); List<String> lemmata = l.lemmaFromStem(start, wci, dec); for (String lemma : lemmata) { ConstructedWord cw = new ConstructedWord(); cw.setLemma(lemma); String pword = pre.isEmpty() ? "":pre+SEPARATOR; cw.setWord(pword + start + SEPARATOR + ending); cw.setInfo(morpheme.getFeatureSet()); analyses.add(cw); cw = null; } } } } } return analyses; }
static List<ConstructedWord> function (String word, String...options) { List<ConstructedWord> analyses = new ArrayList<ConstructedWord>(); List<String> wc = null; if (options != null && options.length > 0 && !options[0].isEmpty()) { wc = Collections.singletonList(options[0]); } else { wc = WordClassGuesser.guess(word); } ParadigmAccessor pa = new ParadigmAccessor(); IrregularNouns irrnoun = pa.getIrregularNouns(); IrregularNumerals irrnum = pa.getIrregularNumerals(); Lemmatizer l = new Lemmatizer(); Paradigm pronoun = pa.getPronounParadigm(); for (Morpheme mo : pronoun.getMorphemes()) { if (mo.exactly(word)) { FeatureSet feat = new FeatureSet(); for (Feature f : mo.getFeatureSet()) { if (f.getKey().equals("case")) { feat.add(new Feature("case", STR)); } else if (f.getKey().equals(STR)) { feat.add(new Feature(STR, STR)); } else { feat.add(f); } } Paradigm p = pronoun.getParadigmByFeatures(feat); for (Morph m : p.getEndings()) { String lemma = m.getMorph(); analyses.add(constructWord(word, lemma, mo.getFeatureSet())); } } } if (irrnoun.isIrregular(word)) { Paradigm p = irrnoun.getLemma(word); for (Morpheme m : p.getMorphemes()) { for (Morph n : m.getAllomorphs()) { String lemma = n.getMorph(); analyses.add(constructWord(word, lemma, irrnoun.getForms(word).getFeatureSet(word))); } } } if (irrnum.isIrregular(word)) { Paradigm p = irrnum.getLemma(word); for (Morpheme m : p.getMorphemes()) { for (Morph n : m.getAllomorphs()) { String lemma = n.getMorph(); analyses.add(constructWord(word, lemma, irrnum.getForms(word).getFeatureSet(word))); } } } Map<String, String> map = new HashMap<String, String>(); for (String wci : wc) { if (wci.equals(STR)) { AdverbStrategy as = new AdverbStrategy(); analyses.addAll(as.apply(word)); continue; } Paradigm p = pa.getParadigmsByFeatures(new FeatureSet(STR, wci)); if (map.isEmpty()) { map.put(STRSTRdeclensionSTR":pre+SEPARATOR; cw.setWord(pword + start + SEPARATOR + ending); cw.setInfo(morpheme.getFeatureSet()); analyses.add(cw); cw = null; } } } } } return analyses; }
/** * Analyze in offline mode * <p> * Returns possible analyses of a given word using paradigm information * @param word word to analyze * @return possible analyses */
Analyze in offline mode Returns possible analyses of a given word using paradigm information
analyze
{ "repo_name": "veer66/PaliNLP", "path": "src/de/unitrier/daalft/pali/morphology/MorphologyAnalyzer.java", "license": "gpl-2.0", "size": 7687 }
[ "de.unitrier.daalft.pali.morphology.element.ConstructedWord", "de.unitrier.daalft.pali.morphology.element.Feature", "de.unitrier.daalft.pali.morphology.element.FeatureSet", "de.unitrier.daalft.pali.morphology.element.Morph", "de.unitrier.daalft.pali.morphology.element.Morpheme", "de.unitrier.daalft.pali.m...
import de.unitrier.daalft.pali.morphology.element.ConstructedWord; import de.unitrier.daalft.pali.morphology.element.Feature; import de.unitrier.daalft.pali.morphology.element.FeatureSet; import de.unitrier.daalft.pali.morphology.element.Morph; import de.unitrier.daalft.pali.morphology.element.Morpheme; import de.unitrier.daalft.pali.morphology.paradigm.Paradigm; import de.unitrier.daalft.pali.morphology.paradigm.ParadigmAccessor; import de.unitrier.daalft.pali.morphology.paradigm.irregular.IrregularNouns; import de.unitrier.daalft.pali.morphology.paradigm.irregular.IrregularNumerals; import de.unitrier.daalft.pali.morphology.strategy.AdverbStrategy; import de.unitrier.daalft.pali.morphology.tools.WordClassGuesser; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map;
import de.unitrier.daalft.pali.morphology.element.*; import de.unitrier.daalft.pali.morphology.paradigm.*; import de.unitrier.daalft.pali.morphology.paradigm.irregular.*; import de.unitrier.daalft.pali.morphology.strategy.*; import de.unitrier.daalft.pali.morphology.tools.*; import java.util.*;
[ "de.unitrier.daalft", "java.util" ]
de.unitrier.daalft; java.util;
77,664
protected void addJsonNoBrackets(StringBuilder sb) { for (int i = 0; i < getIndexedReadOnlyStringMap().size(); i++) { if (i > 0) { sb.append(", "); } sb.append(Chars.DQUOTE); int start = sb.length(); sb.append(getIndexedReadOnlyStringMap().getKeyAt(i)); StringBuilders.escapeJson(sb, start); sb.append(Chars.DQUOTE).append(':').append(Chars.DQUOTE); start = sb.length(); Object value = getIndexedReadOnlyStringMap().getValueAt(i); sb.append(value); StringBuilders.escapeJson(sb, start); sb.append(Chars.DQUOTE); } }
void function(StringBuilder sb) { for (int i = 0; i < getIndexedReadOnlyStringMap().size(); i++) { if (i > 0) { sb.append(STR); } sb.append(Chars.DQUOTE); int start = sb.length(); sb.append(getIndexedReadOnlyStringMap().getKeyAt(i)); StringBuilders.escapeJson(sb, start); sb.append(Chars.DQUOTE).append(':').append(Chars.DQUOTE); start = sb.length(); Object value = getIndexedReadOnlyStringMap().getValueAt(i); sb.append(value); StringBuilders.escapeJson(sb, start); sb.append(Chars.DQUOTE); } }
/** * This method is used in order to support ESJsonLayout which replaces %CustomMapFields from a pattern with JSON fields * It is a modified version of {@link MapMessage#asJson(StringBuilder)} where the curly brackets are not added * @param sb a string builder where JSON fields will be attached */
This method is used in order to support ESJsonLayout which replaces %CustomMapFields from a pattern with JSON fields It is a modified version of <code>MapMessage#asJson(StringBuilder)</code> where the curly brackets are not added
addJsonNoBrackets
{ "repo_name": "GlenRSmith/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/logging/ESLogMessage.java", "license": "apache-2.0", "size": 3664 }
[ "org.apache.logging.log4j.util.Chars", "org.apache.logging.log4j.util.StringBuilders" ]
import org.apache.logging.log4j.util.Chars; import org.apache.logging.log4j.util.StringBuilders;
import org.apache.logging.log4j.util.*;
[ "org.apache.logging" ]
org.apache.logging;
2,733,254
public final void setYear(final Integer year) { this.year = year; } public static class CardExpiryBuilder<BLDRT extends GenericBuilder> extends NestedBuilder<CardExpiry, BLDRT> { private final CardExpiry cardExpiry = new CardExpiry(); public CardExpiryBuilder(final BLDRT parent) { super(parent); }
final void function(final Integer year) { this.year = year; } public static class CardExpiryBuilder<BLDRT extends GenericBuilder> extends NestedBuilder<CardExpiry, BLDRT> { private final CardExpiry cardExpiry = new CardExpiry(); public CardExpiryBuilder(final BLDRT parent) { super(parent); }
/** * Sets the year. * * @param year the new year */
Sets the year
setYear
{ "repo_name": "OptimalPayments/Java_SDK", "path": "NetBanxSDK/src/main/java/com/optimalpayments/common/CardExpiry.java", "license": "mit", "size": 3293 }
[ "com.optimalpayments.common.impl.GenericBuilder", "com.optimalpayments.common.impl.NestedBuilder" ]
import com.optimalpayments.common.impl.GenericBuilder; import com.optimalpayments.common.impl.NestedBuilder;
import com.optimalpayments.common.impl.*;
[ "com.optimalpayments.common" ]
com.optimalpayments.common;
768,088
@Test public void testGetAll() { int tableSize = alarmMapper.getNumberItems(); int alarmsRetrieved = alarmMapper.getAll().size(); assertEquals(tableSize, alarmsRetrieved); }
void function() { int tableSize = alarmMapper.getNumberItems(); int alarmsRetrieved = alarmMapper.getAll().size(); assertEquals(tableSize, alarmsRetrieved); }
/** * Compares size of table with number of records. */
Compares size of table with number of records
testGetAll
{ "repo_name": "c2mon/c2mon", "path": "c2mon-server/c2mon-server-cachedbaccess/src/test/java/cern/c2mon/server/cache/dbaccess/AlarmMapperTest.java", "license": "lgpl-3.0", "size": 3683 }
[ "junit.framework.TestCase" ]
import junit.framework.TestCase;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
1,748,634
public static byte[] toByteArray(InputStream input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
static byte[] function(InputStream input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); copy(input, output); return output.toByteArray(); }
/** * Get the contents of an <code>InputStream</code> as a <code>byte[]</code>. * <p/> * This method buffers the input internally, so there is no need to use a * <code>BufferedInputStream</code>. * * @param input the <code>InputStream</code> to read from * @return the requested byte array * @throws NullPointerException if the input is null * @throws IOException if an I/O error occurs */
Get the contents of an <code>InputStream</code> as a <code>byte[]</code>. This method buffers the input internally, so there is no need to use a <code>BufferedInputStream</code>
toByteArray
{ "repo_name": "nvllsvm/Audinaut", "path": "app/src/main/java/net/nullsum/audinaut/util/Util.java", "license": "gpl-3.0", "size": 48334 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "java.io.InputStream" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,829,125
private void setExpandedEnergyValue(int expendedEnergy) throws GattException { setFlag(EXPENDED_ENERGY_FLAG); int expendedEnergyOffset = isUInt16HeartRateFormat() ? EXPENDED_ENERGY_SHIFTED_OFFSET : EXPENDED_ENERGY_BASE_OFFSET; setIntValue(expendedEnergy, BluetoothGattCharacteristic.FORMAT_UINT16, expendedEnergyOffset); }
void function(int expendedEnergy) throws GattException { setFlag(EXPENDED_ENERGY_FLAG); int expendedEnergyOffset = isUInt16HeartRateFormat() ? EXPENDED_ENERGY_SHIFTED_OFFSET : EXPENDED_ENERGY_BASE_OFFSET; setIntValue(expendedEnergy, BluetoothGattCharacteristic.FORMAT_UINT16, expendedEnergyOffset); }
/** * Set given expended energy value info characteristic value byte array. * * @param expendedEnergy expended energy value to set * @throws GattException if cannot set given expended energy value */
Set given expended energy value info characteristic value byte array
setExpandedEnergyValue
{ "repo_name": "googleinterns/heartrate-bt-wear", "path": "server/app/src/main/java/com/google/heartrate/wearos/app/gatt/heartrate/characteristics/HeartRateMeasurementCharacteristic.java", "license": "apache-2.0", "size": 12808 }
[ "android.bluetooth.BluetoothGattCharacteristic", "com.google.heartrate.wearos.app.gatt.GattException" ]
import android.bluetooth.BluetoothGattCharacteristic; import com.google.heartrate.wearos.app.gatt.GattException;
import android.bluetooth.*; import com.google.heartrate.wearos.app.gatt.*;
[ "android.bluetooth", "com.google.heartrate" ]
android.bluetooth; com.google.heartrate;
2,148,336
public ExportReport exportAlbum(String albumId, MediaResolution mediaResolution) throws ExportException { ExportReport exportReport = new ExportReport(); if (isExportEnable() && StringUtil.isDefined(albumId)) { // Create export folder then apply each picture from this folder ImportExportDescriptor exportDesc = new ExportDescriptor() .withParameter(GalleryExporter.EXPORT_FOR_USER, getUserDetail()). withParameter(GalleryExporter.EXPORT_ALBUM, getAlbum(albumId)) .withParameter(GalleryExporter.EXPORT_RESOLUTION, mediaResolution); aGalleryExporter().exportAlbum(exportDesc, exportReport); } return exportReport; }
ExportReport function(String albumId, MediaResolution mediaResolution) throws ExportException { ExportReport exportReport = new ExportReport(); if (isExportEnable() && StringUtil.isDefined(albumId)) { ImportExportDescriptor exportDesc = new ExportDescriptor() .withParameter(GalleryExporter.EXPORT_FOR_USER, getUserDetail()). withParameter(GalleryExporter.EXPORT_ALBUM, getAlbum(albumId)) .withParameter(GalleryExporter.EXPORT_RESOLUTION, mediaResolution); aGalleryExporter().exportAlbum(exportDesc, exportReport); } return exportReport; }
/** * Export all picture from an album with the given resolution * @param albumId * @param mediaResolution */
Export all picture from an album with the given resolution
exportAlbum
{ "repo_name": "CecileBONIN/Silverpeas-Components", "path": "gallery/gallery-war/src/main/java/com/silverpeas/gallery/control/GallerySessionController.java", "license": "agpl-3.0", "size": 50985 }
[ "com.silverpeas.export.ExportDescriptor", "com.silverpeas.export.ExportException", "com.silverpeas.export.ImportExportDescriptor", "com.silverpeas.gallery.constant.MediaResolution", "com.silverpeas.importExport.report.ExportReport", "com.silverpeas.util.StringUtil" ]
import com.silverpeas.export.ExportDescriptor; import com.silverpeas.export.ExportException; import com.silverpeas.export.ImportExportDescriptor; import com.silverpeas.gallery.constant.MediaResolution; import com.silverpeas.importExport.report.ExportReport; import com.silverpeas.util.StringUtil;
import com.silverpeas.*; import com.silverpeas.export.*; import com.silverpeas.gallery.constant.*; import com.silverpeas.util.*;
[ "com.silverpeas", "com.silverpeas.export", "com.silverpeas.gallery", "com.silverpeas.util" ]
com.silverpeas; com.silverpeas.export; com.silverpeas.gallery; com.silverpeas.util;
972,178
public void setMenu(View v) { mViewBehind.setContent(v); }
void function(View v) { mViewBehind.setContent(v); }
/** * Set the behind view (menu) content to the given View. * * @param view The desired content to display. */
Set the behind view (menu) content to the given View
setMenu
{ "repo_name": "Douvi/FragmentTransactionManager", "path": "SlidingMenu/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java", "license": "apache-2.0", "size": 28865 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,478,437
public static void insertContentElement(Element jdomParent, String tag, String text) { if (text != null) { Element jdomVersion = insertNewElement(tag, jdomParent); jdomVersion.setContent(new Text(text)); } }
static void function(Element jdomParent, String tag, String text) { if (text != null) { Element jdomVersion = insertNewElement(tag, jdomParent); jdomVersion.setContent(new Text(text)); } }
/** * Inserts an element with text, like &lt;version&gt;1.2.3&lt;/version&gt; */
Inserts an element with text, like &lt;version&gt;1.2.3&lt;/version&gt
insertContentElement
{ "repo_name": "codenameone/CodenameOne", "path": "maven/codenameone-maven-plugin/src/main/java/org/apache/maven/model/jdom/util/JDomUtils.java", "license": "gpl-2.0", "size": 19375 }
[ "org.jdom2.Element", "org.jdom2.Text" ]
import org.jdom2.Element; import org.jdom2.Text;
import org.jdom2.*;
[ "org.jdom2" ]
org.jdom2;
2,729,029
public static KeyValue createLastOnRow(final byte[] row, final int roffset, final int rlength, final byte[] family, final int foffset, final int flength, final byte[] qualifier, final int qoffset, final int qlength) { return new KeyValue(row, roffset, rlength, family, foffset, flength, qualifier, qoffset, qlength, HConstants.OLDEST_TIMESTAMP, Type.Minimum, null, 0, 0); }
static KeyValue function(final byte[] row, final int roffset, final int rlength, final byte[] family, final int foffset, final int flength, final byte[] qualifier, final int qoffset, final int qlength) { return new KeyValue(row, roffset, rlength, family, foffset, flength, qualifier, qoffset, qlength, HConstants.OLDEST_TIMESTAMP, Type.Minimum, null, 0, 0); }
/** * Create a KeyValue for the specified row, family and qualifier that would be * larger than or equal to all other possible KeyValues that have the same * row, family, qualifier. Used for reseeking. Should NEVER be returned to a client. * * @param row * row key * @param roffset * row offset * @param rlength * row length * @param family * family name * @param foffset * family offset * @param flength * family length * @param qualifier * column qualifier * @param qoffset * qualifier offset * @param qlength * qualifier length * @return Last possible key on passed row, family, qualifier. */
Create a KeyValue for the specified row, family and qualifier that would be larger than or equal to all other possible KeyValues that have the same row, family, qualifier. Used for reseeking. Should NEVER be returned to a client
createLastOnRow
{ "repo_name": "JingchengDu/hbase", "path": "hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueUtil.java", "license": "apache-2.0", "size": 25785 }
[ "org.apache.hadoop.hbase.KeyValue" ]
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,825,183
private void deploy(DeployableFileEntry entry) { //This deploys "everything else" that isn't XML data. String fullPath = mudPath + File.separator + stripMudPrefix(entry.getEntryName()); File file = new File(fullPath); RegularDeployer deployer = new RegularDeployer(file, entry); deployer.deploy(); if (!codeUpdates) { codeUpdates = deployer.codeUpdates(); } }
void function(DeployableFileEntry entry) { String fullPath = mudPath + File.separator + stripMudPrefix(entry.getEntryName()); File file = new File(fullPath); RegularDeployer deployer = new RegularDeployer(file, entry); deployer.deploy(); if (!codeUpdates) { codeUpdates = deployer.codeUpdates(); } }
/** * Deploys something that isn't an XML document. Delegates to RegularDeployer. * @param entry */
Deploys something that isn't an XML document. Delegates to RegularDeployer
deploy
{ "repo_name": "ProjectMoon/ringmud", "path": "src/ring/deployer/DeployModule.java", "license": "lgpl-3.0", "size": 6767 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,876,492
private void testCacheCreatedAfterSnapshotting(boolean encryptedFirst) throws Exception { CacheConfiguration<Integer, Object> ccfg = new CacheConfiguration<>(dfltCacheCfg).setName(CACHE2); if (encryptedFirst) ccfg.setEncryptionEnabled(true); startGridsWithCache(3, ccfg, CACHE_KEYS_RANGE); grid(1).snapshot().createSnapshot(SNAPSHOT_NAME).get(TIMEOUT); grid(2).destroyCache(CACHE2); awaitPartitionMapExchange(); addCache(!encryptedFirst); }
void function(boolean encryptedFirst) throws Exception { CacheConfiguration<Integer, Object> ccfg = new CacheConfiguration<>(dfltCacheCfg).setName(CACHE2); if (encryptedFirst) ccfg.setEncryptionEnabled(true); startGridsWithCache(3, ccfg, CACHE_KEYS_RANGE); grid(1).snapshot().createSnapshot(SNAPSHOT_NAME).get(TIMEOUT); grid(2).destroyCache(CACHE2); awaitPartitionMapExchange(); addCache(!encryptedFirst); }
/** * Ensures that same-name-cache is created after putting cache into snapshot and deleting. * * @param encryptedFirst If {@code true}, creates encrypted cache before snapshoting and deleting. In reverse * order if {@code false}. */
Ensures that same-name-cache is created after putting cache into snapshot and deleting
testCacheCreatedAfterSnapshotting
{ "repo_name": "NSAmelchev/ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/EncryptedSnapshotTest.java", "license": "apache-2.0", "size": 11499 }
[ "org.apache.ignite.configuration.CacheConfiguration" ]
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,512,917
EAttribute getClock_Daylight_savings_enabled();
EAttribute getClock_Daylight_savings_enabled();
/** * Returns the meta object for the attribute '{@link gluemodel.COSEM.InterfaceClasses.Clock#isDaylight_savings_enabled <em>Daylight savings enabled</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Daylight savings enabled</em>'. * @see gluemodel.COSEM.InterfaceClasses.Clock#isDaylight_savings_enabled() * @see #getClock() * @generated */
Returns the meta object for the attribute '<code>gluemodel.COSEM.InterfaceClasses.Clock#isDaylight_savings_enabled Daylight savings enabled</code>'.
getClock_Daylight_savings_enabled
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/COSEM/InterfaceClasses/InterfaceClassesPackage.java", "license": "mit", "size": 201104 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,804,439
@Deprecated public static GemFireCacheImpl getExisting() { final GemFireCacheImpl result = getInstance(); if (result != null && !result.isClosing) { return result; } if (result != null) { throw result.getCacheClosedException( LocalizedStrings.CacheFactory_THE_CACHE_HAS_BEEN_CLOSED.toLocalizedString()); } throw new CacheClosedException( LocalizedStrings.CacheFactory_A_CACHE_HAS_NOT_YET_BEEN_CREATED.toLocalizedString()); }
static GemFireCacheImpl function() { final GemFireCacheImpl result = getInstance(); if (result != null && !result.isClosing) { return result; } if (result != null) { throw result.getCacheClosedException( LocalizedStrings.CacheFactory_THE_CACHE_HAS_BEEN_CLOSED.toLocalizedString()); } throw new CacheClosedException( LocalizedStrings.CacheFactory_A_CACHE_HAS_NOT_YET_BEEN_CREATED.toLocalizedString()); }
/** * Returns an existing instance. If a cache does not exist throws a cache closed exception. * * @return the existing cache * @throws CacheClosedException if an existing cache can not be found. * @deprecated use DM.getExistingCache instead. */
Returns an existing instance. If a cache does not exist throws a cache closed exception
getExisting
{ "repo_name": "smanvi-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java", "license": "apache-2.0", "size": 187237 }
[ "org.apache.geode.cache.CacheClosedException", "org.apache.geode.internal.i18n.LocalizedStrings" ]
import org.apache.geode.cache.CacheClosedException; import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.cache.*; import org.apache.geode.internal.i18n.*;
[ "org.apache.geode" ]
org.apache.geode;
1,349,479
public void testInit() throws Exception { System.out.println("init"); RiskUIUtil.mapsdir = new File("./game/Domination/maps").toURI().toURL(); List mapsUIDs = new Vector(); // ALL THESE MAPS NEED TO ACTUALLY BE IN THE MAPS DIR mapsUIDs.add("RiskEurope.map"); mapsUIDs.add("ameroki.map"); mapsUIDs.add("eurasien.map"); mapsUIDs.add("geoscape.map"); mapsUIDs.add("lotr.map"); mapsUIDs.add("luca.map"); mapsUIDs.add("risk.map"); mapsUIDs.add("roman_empire.map"); mapsUIDs.add("sersom.map"); mapsUIDs.add("teg.map"); mapsUIDs.add("tube.map"); mapsUIDs.add("uk.map"); mapsUIDs.add("world.map"); MapUpdateService instance = MapUpdateService.getInstance(); instance.init(mapsUIDs,"http://mapsqa.yura.net/maps?format=xml"); List result = instance.mapsToUpdate; Vector check = new Vector(); check.add("ameroki.map"); testResultContains(result,check); }
void function() throws Exception { System.out.println("init"); RiskUIUtil.mapsdir = new File(STR).toURI().toURL(); List mapsUIDs = new Vector(); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); mapsUIDs.add(STR); MapUpdateService instance = MapUpdateService.getInstance(); instance.init(mapsUIDs,"http: List result = instance.mapsToUpdate; Vector check = new Vector(); check.add(STR); testResultContains(result,check); }
/** * Test of init method, of class MapUpdateService. */
Test of init method, of class MapUpdateService
testInit
{ "repo_name": "hernol/ConuWar", "path": "Game/test/junit/net/yura/domination/mapstore/MapUpdateServiceTest.java", "license": "gpl-3.0", "size": 2722 }
[ "java.io.File", "java.util.List", "java.util.Vector", "net.yura.domination.engine.RiskUIUtil" ]
import java.io.File; import java.util.List; import java.util.Vector; import net.yura.domination.engine.RiskUIUtil;
import java.io.*; import java.util.*; import net.yura.domination.engine.*;
[ "java.io", "java.util", "net.yura.domination" ]
java.io; java.util; net.yura.domination;
2,582,369
private void visitImages(CmsObject cms, File directory) { if (!directory.canRead() || !directory.isDirectory()) { return; } File[] files = directory.listFiles(m_filter); for (int i = 0; i < files.length; i++) { File f = files[i]; if (f.isDirectory()) { visitImages(cms, f); continue; } visitImage(cms, f); } }
void function(CmsObject cms, File directory) { if (!directory.canRead() !directory.isDirectory()) { return; } File[] files = directory.listFiles(m_filter); for (int i = 0; i < files.length; i++) { File f = files[i]; if (f.isDirectory()) { visitImages(cms, f); continue; } visitImage(cms, f); } }
/** * Visits all cached images in the given directory.<p> * * @param cms the cms context * @param directory the directory to visit */
Visits all cached images in the given directory
visitImages
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/ui/apps/cacheadmin/CmsImageCacheHolder.java", "license": "lgpl-2.1", "size": 8980 }
[ "java.io.File", "org.opencms.file.CmsObject" ]
import java.io.File; import org.opencms.file.CmsObject;
import java.io.*; import org.opencms.file.*;
[ "java.io", "org.opencms.file" ]
java.io; org.opencms.file;
1,597,489
public Date getLastHeartBeatTime() { return this.lastHeartBeatTime; }
Date function() { return this.lastHeartBeatTime; }
/** * get last heart beat timestamp * * @return last heart beat timestamp */
get last heart beat timestamp
getLastHeartBeatTime
{ "repo_name": "fanyunfeng/jfdfslib", "path": "src/main/java/jfdfs/core/StructStorageStat.java", "license": "gpl-2.0", "size": 36725 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,699,233
public static Transition arcMotion(Context context) { if (sArc == null) { sArc = TransitionInflater.from(context).inflateTransition( R.transition.sprockets_arc_motion); } return sArc; }
static Transition function(Context context) { if (sArc == null) { sArc = TransitionInflater.from(context).inflateTransition( R.transition.sprockets_arc_motion); } return sArc; }
/** * Get a cached arc motion transition. */
Get a cached arc motion transition
arcMotion
{ "repo_name": "pushbit/sprockets-android", "path": "sprockets/src/main/java/net/sf/sprockets/transition/Transitions.java", "license": "gpl-3.0", "size": 2576 }
[ "android.content.Context", "android.transition.Transition", "android.transition.TransitionInflater" ]
import android.content.Context; import android.transition.Transition; import android.transition.TransitionInflater;
import android.content.*; import android.transition.*;
[ "android.content", "android.transition" ]
android.content; android.transition;
313,302
private void onButtonPressDeclineTerms() { Editor e = getPreferences(MODE_PRIVATE).edit(); e.putBoolean(PREFERENCE_SEEN_TERMS, false); e.commit(); finish(); }
void function() { Editor e = getPreferences(MODE_PRIVATE).edit(); e.putBoolean(PREFERENCE_SEEN_TERMS, false); e.commit(); finish(); }
/** * called when terms&conditions are declined */
called when terms&conditions are declined
onButtonPressDeclineTerms
{ "repo_name": "jacekkopecky/parkjam", "path": "src/uk/ac/open/kmi/parking/MainActivity.java", "license": "apache-2.0", "size": 43940 }
[ "android.content.SharedPreferences" ]
import android.content.SharedPreferences;
import android.content.*;
[ "android.content" ]
android.content;
2,625,340
boolean sqlMapDeleteByPrimaryKeyElementGenerated(XmlElement element, IntrospectedTable introspectedTable);
boolean sqlMapDeleteByPrimaryKeyElementGenerated(XmlElement element, IntrospectedTable introspectedTable);
/** * This method is called when the deleteByPrimaryKey element is generated. * * @param element * the generated &lt;delete&gt; element * @param introspectedTable * The class containing information about the table as * introspected from the database * @return true if the element should be generated, false if the generated * element should be ignored. In the case of multiple plugins, the * first plugin returning false will disable the calling of further * plugins. */
This method is called when the deleteByPrimaryKey element is generated
sqlMapDeleteByPrimaryKeyElementGenerated
{ "repo_name": "solmix/datax", "path": "generator/core/src/main/java/org/solmix/generator/api/Plugin.java", "license": "lgpl-2.1", "size": 72918 }
[ "org.solmix.commons.xml.dom.XmlElement" ]
import org.solmix.commons.xml.dom.XmlElement;
import org.solmix.commons.xml.dom.*;
[ "org.solmix.commons" ]
org.solmix.commons;
123,853
public static Map<String, InetSocketAddress> getWebAddressesForNameserviceId( Configuration conf, String nsId, String defaultValue) { return DFSUtilClient.getAddressesForNameserviceId(conf, nsId, defaultValue, DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY); }
static Map<String, InetSocketAddress> function( Configuration conf, String nsId, String defaultValue) { return DFSUtilClient.getAddressesForNameserviceId(conf, nsId, defaultValue, DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY); }
/** * Get all of the Web addresses of the individual NNs in a given nameservice. * * @param conf Configuration * @param nsId the nameservice whose NNs addresses we want. * @param defaultValue default address to return in case key is not found. * @return A map from nnId -> Web address of each NN in the nameservice. */
Get all of the Web addresses of the individual NNs in a given nameservice
getWebAddressesForNameserviceId
{ "repo_name": "dennishuo/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java", "license": "apache-2.0", "size": 63202 }
[ "java.net.InetSocketAddress", "java.util.Map", "org.apache.hadoop.conf.Configuration" ]
import java.net.InetSocketAddress; import java.util.Map; import org.apache.hadoop.conf.Configuration;
import java.net.*; import java.util.*; import org.apache.hadoop.conf.*;
[ "java.net", "java.util", "org.apache.hadoop" ]
java.net; java.util; org.apache.hadoop;
2,642,340
public List<String> getChoices() { return Choices; }
List<String> function() { return Choices; }
/** * Getter - List of choices * @return List of choices */
Getter - List of choices
getChoices
{ "repo_name": "JamesMarino/CSCI213", "path": "Assignments/Assignment 4/Solutions/Server/src/au/edu/uow/QuestionLibrary/TrueAndFalseQuestion.java", "license": "mit", "size": 1788 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,860,995
public Duration getAutoDeleteOnIdle() { return this.autoDeleteOnIdle; }
Duration function() { return this.autoDeleteOnIdle; }
/** * Get the autoDeleteOnIdle property: ISO 8601 timeSpan idle interval after which the queue is automatically * deleted. The minimum duration is 5 minutes. * * @return the autoDeleteOnIdle value. */
Get the autoDeleteOnIdle property: ISO 8601 timeSpan idle interval after which the queue is automatically deleted. The minimum duration is 5 minutes
getAutoDeleteOnIdle
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/models/QueueDescription.java", "license": "mit", "size": 29239 }
[ "java.time.Duration" ]
import java.time.Duration;
import java.time.*;
[ "java.time" ]
java.time;
1,249,296
private Key withoutLabel(LabelIndicator labelIndicator) { if (!labelIndicators.contains(labelIndicator)) { return this; } else { Set<LabelIndicator> lis = EnumSet.copyOf(labelIndicators); lis.remove(labelIndicator); return new Key(type, value, arg, lis, aggregationIndicator); } }
Key function(LabelIndicator labelIndicator) { if (!labelIndicators.contains(labelIndicator)) { return this; } else { Set<LabelIndicator> lis = EnumSet.copyOf(labelIndicators); lis.remove(labelIndicator); return new Key(type, value, arg, lis, aggregationIndicator); } }
/** * Removes a label from a key. * * @param labelIndicator * @return */
Removes a label from a key
withoutLabel
{ "repo_name": "aborg0/rapidminer-studio", "path": "src/main/java/com/rapidminer/tools/usagestats/ActionStatisticsCollector.java", "license": "agpl-3.0", "size": 57971 }
[ "java.util.EnumSet", "java.util.Set" ]
import java.util.EnumSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,597,378
public void dump(String context) throws KeyStoreException, NoSuchAlgorithmException { dump(context, keyStore, keyPassword); }
void function(String context) throws KeyStoreException, NoSuchAlgorithmException { dump(context, keyStore, keyPassword); }
/** * Dump a key store for debugging. */
Dump a key store for debugging
dump
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "libcore/support/src/test/java/libcore/java/security/TestKeyStore.java", "license": "gpl-3.0", "size": 40333 }
[ "java.security.KeyStoreException", "java.security.NoSuchAlgorithmException" ]
import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException;
import java.security.*;
[ "java.security" ]
java.security;
530,209
@Test public void getClientTest() { ClientEntity entity = data.get(0); ClientEntity resultEntity = clientLogic.getClient(entity.getId()); Assert.assertNotNull(resultEntity); Assert.assertEquals(entity.getId(), resultEntity.getId()); Assert.assertEquals(entity.getName(), resultEntity.getName()); }
void function() { ClientEntity entity = data.get(0); ClientEntity resultEntity = clientLogic.getClient(entity.getId()); Assert.assertNotNull(resultEntity); Assert.assertEquals(entity.getId(), resultEntity.getId()); Assert.assertEquals(entity.getName(), resultEntity.getName()); }
/** * Prueba para consultar un Client * * @generated */
Prueba para consultar un Client
getClientTest
{ "repo_name": "Uniandes-MISO4203/artwork-201620-1", "path": "artwork-logic/src/test/java/co/edu/uniandes/csw/artwork/test/logic/ClientLogicTest.java", "license": "mit", "size": 8747 }
[ "co.edu.uniandes.csw.artwork.entities.ClientEntity", "org.junit.Assert" ]
import co.edu.uniandes.csw.artwork.entities.ClientEntity; import org.junit.Assert;
import co.edu.uniandes.csw.artwork.entities.*; import org.junit.*;
[ "co.edu.uniandes", "org.junit" ]
co.edu.uniandes; org.junit;
793,552
public void releaseAll() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child: children) { try { release(child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception("Could not properly release all state nodes.", exception); } }
void function() throws Exception { Collection<String> children = getAllPaths(); Exception exception = null; for (String child: children) { try { release(child); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } } if (exception != null) { throw new Exception(STR, exception); } }
/** * Releases all lock nodes of this ZooKeeperStateHandleStore. * * @throws Exception if the delete operation of a lock file fails */
Releases all lock nodes of this ZooKeeperStateHandleStore
releaseAll
{ "repo_name": "hequn8128/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java", "license": "apache-2.0", "size": 17553 }
[ "java.util.Collection", "org.apache.flink.util.ExceptionUtils" ]
import java.util.Collection; import org.apache.flink.util.ExceptionUtils;
import java.util.*; import org.apache.flink.util.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
383,308
public static UnicodeScript of(int codePoint) { if (!isValidCodePoint(codePoint)) throw new IllegalArgumentException(); int type = getType(codePoint); // leave SURROGATE and PRIVATE_USE for table lookup if (type == UNASSIGNED) return UNKNOWN; int index = Arrays.binarySearch(scriptStarts, codePoint); if (index < 0) index = -index - 2; return scripts[index]; } /** * Returns the UnicodeScript constant with the given Unicode script * name or the script name alias. Script names and their aliases are * determined by The Unicode Standard. The files {@code Scripts<version>.txt} * and {@code PropertyValueAliases<version>.txt} define script names * and the script name aliases for a particular version of the * standard. The {@link Character} class specifies the version of * the standard that it supports. * <p> * Character case is ignored for all of the valid script names. * The en_US locale's case mapping rules are used to provide * case-insensitive string comparisons for script name validation. * * @param scriptName A {@code UnicodeScript} name. * @return The {@code UnicodeScript} constant identified * by {@code scriptName}
static UnicodeScript function(int codePoint) { if (!isValidCodePoint(codePoint)) throw new IllegalArgumentException(); int type = getType(codePoint); if (type == UNASSIGNED) return UNKNOWN; int index = Arrays.binarySearch(scriptStarts, codePoint); if (index < 0) index = -index - 2; return scripts[index]; } /** * Returns the UnicodeScript constant with the given Unicode script * name or the script name alias. Script names and their aliases are * determined by The Unicode Standard. The files {@code Scripts<version>.txt} * and {@code PropertyValueAliases<version>.txt} define script names * and the script name aliases for a particular version of the * standard. The {@link Character} class specifies the version of * the standard that it supports. * <p> * Character case is ignored for all of the valid script names. * The en_US locale's case mapping rules are used to provide * case-insensitive string comparisons for script name validation. * * @param scriptName A {@code UnicodeScript} name. * @return The {@code UnicodeScript} constant identified * by {@code scriptName}
/** * Returns the enum constant representing the Unicode script of which * the given character (Unicode code point) is assigned to. * * @param codePoint the character (Unicode code point) in question. * @return The {@code UnicodeScript} constant representing the * Unicode script of which this character is assigned to. * * @exception IllegalArgumentException if the specified * {@code codePoint} is an invalid Unicode code point. * @see Character#isValidCodePoint(int) * */
Returns the enum constant representing the Unicode script of which the given character (Unicode code point) is assigned to
of
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "src/java.base/share/classes/java/lang/Character.java", "license": "gpl-2.0", "size": 408708 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,496,373