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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
@Override
@TearDown(Level.Trial)
public void teardown() throws Exception {
completed.set(true);
Thread.sleep(5000);
super.teardown();
} | @TearDown(Level.Trial) void function() throws Exception { completed.set(true); Thread.sleep(5000); super.teardown(); } | /**
* Stop the running calls then stop the server and client channels.
*/ | Stop the running calls then stop the server and client channels | teardown | {
"repo_name": "xzy256/grpc-java-mips64",
"path": "benchmarks/src/jmh/java/io/grpc/benchmarks/netty/UnaryCallResponseBandwidthBenchmark.java",
"license": "bsd-3-clause",
"size": 4602
} | [
"org.openjdk.jmh.annotations.Level",
"org.openjdk.jmh.annotations.TearDown"
] | import org.openjdk.jmh.annotations.Level; import org.openjdk.jmh.annotations.TearDown; | import org.openjdk.jmh.annotations.*; | [
"org.openjdk.jmh"
] | org.openjdk.jmh; | 754,834 |
@Override
public boolean isApplicableFor(final Object model)
{
return InterfaceWrapperHelper.hasModelColumnName(model, I_AD_Column.COLUMNNAME_Updated)
|| InterfaceWrapperHelper.hasModelColumnName(model, I_AD_Column.COLUMNNAME_Created);
} | boolean function(final Object model) { return InterfaceWrapperHelper.hasModelColumnName(model, I_AD_Column.COLUMNNAME_Updated) InterfaceWrapperHelper.hasModelColumnName(model, I_AD_Column.COLUMNNAME_Created); } | /**
* Returns <code>true</code> if the given model has an <code>Updated</code> column.
*/ | Returns <code>true</code> if the given model has an <code>Updated</code> column | isApplicableFor | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.dlm/base/src/main/java/de/metas/dlm/coordinator/impl/LastUpdatedInspector.java",
"license": "gpl-2.0",
"size": 2742
} | [
"org.adempiere.model.InterfaceWrapperHelper"
] | import org.adempiere.model.InterfaceWrapperHelper; | import org.adempiere.model.*; | [
"org.adempiere.model"
] | org.adempiere.model; | 1,416,849 |
@LogToResult
public Path takeScreenshot(String filename) {
return getLoader().getScreenshotActions().takeScreenshot(filename, regionImpl.getRect());
} | Path function(String filename) { return getLoader().getScreenshotActions().takeScreenshot(filename, regionImpl.getRect()); } | /**
* Takes a screenshot of this {@link Region} and saves it to the assigned path. If there ist just a file name, the
* screenshot will be saved in your current testcase folder.
* Supported formats: `jpg` and `png`
* Example:
* ```
* region.takeScreenshot("test.png");
* ```
*
* @param filename {@code pathname/filename.format} or just {@code filename.format}.
* @return {@link Path} to the created screenshot OR null on errors
*/ | Takes a screenshot of this <code>Region</code> and saves it to the assigned path. If there ist just a file name, the screenshot will be saved in your current testcase folder. Supported formats: `jpg` and `png` Example: ``` region.takeScreenshot("test.png"); ``` | takeScreenshot | {
"repo_name": "ConSol/sakuli",
"path": "src/core/src/main/java/org/sakuli/actions/screenbased/Region.java",
"license": "apache-2.0",
"size": 20703
} | [
"java.nio.file.Path"
] | import java.nio.file.Path; | import java.nio.file.*; | [
"java.nio"
] | java.nio; | 2,414,908 |
public void putCurrFrag(MainFrag currFrag) {
prefs.edit().putInt(CURR_FRAG, currFrag.getIndex()).apply();
} | void function(MainFrag currFrag) { prefs.edit().putInt(CURR_FRAG, currFrag.getIndex()).apply(); } | /**
* Put the {@link MainFrag} which specifies the fragment that is currently being shown in {@link MainActivity}.
* @param currFrag Enum.
*/ | Put the <code>MainFrag</code> which specifies the fragment that is currently being shown in <code>MainActivity</code> | putCurrFrag | {
"repo_name": "bkromhout/Minerva",
"path": "app/src/main/java/com/bkromhout/minerva/Prefs.java",
"license": "apache-2.0",
"size": 14745
} | [
"com.bkromhout.minerva.enums.MainFrag"
] | import com.bkromhout.minerva.enums.MainFrag; | import com.bkromhout.minerva.enums.*; | [
"com.bkromhout.minerva"
] | com.bkromhout.minerva; | 1,595,404 |
private Pair<Long, Integer> updateRaw(byte configBytes[]) {
ByteBuffer buf = ByteBuffer.wrap(configBytes);
int numEntries = buf.getInt();
if (numEntries < 0) {
throw new RuntimeException("Bad elastic hashinator config");
}
final int bytes = 8 * numEntries;
long tokens = Bits.unsafe.allocateMemory(bytes);
trackAllocatedHashinatorBytes(bytes);
int lastToken = Integer.MIN_VALUE;
for (int ii = 0; ii < numEntries; ii++) {
long ptr = tokens + (ii * 8);
final int token = buf.getInt();
Preconditions.checkArgument(token >= lastToken);
lastToken = token;
Bits.unsafe.putInt(ptr, token);
final int partitionId = buf.getInt();
Bits.unsafe.putInt(ptr + 4, partitionId);
}
return Pair.of(tokens, numEntries);
} | Pair<Long, Integer> function(byte configBytes[]) { ByteBuffer buf = ByteBuffer.wrap(configBytes); int numEntries = buf.getInt(); if (numEntries < 0) { throw new RuntimeException(STR); } final int bytes = 8 * numEntries; long tokens = Bits.unsafe.allocateMemory(bytes); trackAllocatedHashinatorBytes(bytes); int lastToken = Integer.MIN_VALUE; for (int ii = 0; ii < numEntries; ii++) { long ptr = tokens + (ii * 8); final int token = buf.getInt(); Preconditions.checkArgument(token >= lastToken); lastToken = token; Bits.unsafe.putInt(ptr, token); final int partitionId = buf.getInt(); Bits.unsafe.putInt(ptr + 4, partitionId); } return Pair.of(tokens, numEntries); } | /**
* Update from raw config bytes.
* token-1/partition-1
* token-2/partition-2
* ...
* tokens are 8 bytes
* @param configBytes raw config data
* @return token/partition map
*/ | Update from raw config bytes. token-1/partition-1 token-2/partition-2 ... tokens are 8 bytes | updateRaw | {
"repo_name": "deerwalk/voltdb",
"path": "src/frontend/org/voltdb/ElasticHashinator.java",
"license": "agpl-3.0",
"size": 29859
} | [
"com.google_voltpatches.common.base.Preconditions",
"java.nio.ByteBuffer",
"org.voltcore.utils.Bits",
"org.voltcore.utils.Pair"
] | import com.google_voltpatches.common.base.Preconditions; import java.nio.ByteBuffer; import org.voltcore.utils.Bits; import org.voltcore.utils.Pair; | import com.google_voltpatches.common.base.*; import java.nio.*; import org.voltcore.utils.*; | [
"com.google_voltpatches.common",
"java.nio",
"org.voltcore.utils"
] | com.google_voltpatches.common; java.nio; org.voltcore.utils; | 1,601,928 |
@SuppressWarnings({"unchecked"})
public void initGui()
{
Keyboard.enableRepeatEvents(true);
this.buttonList.clear();
this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.getString("selectWorld.create")));
this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.getString("gui.cancel")));
this.buttonList.add(this.buttonGameMode = new GuiButton(2, this.width / 2 - 75, 115, 150, 20,
I18n.getString("selectWorld.gameMode")));
this.buttonList.add(this.moreWorldOptions = new GuiButton(3, this.width / 2 - 75, 187, 150, 20,
I18n.getString("selectWorld.moreWorldOptions")));
this.buttonList.add(this.buttonGenerateStructures = new GuiButton(4, this.width / 2 - 155, 100, 150, 20,
I18n.getString("selectWorld.mapFeatures")));
this.buttonGenerateStructures.drawButton = false;
this.buttonList.add(this.buttonBonusItems = new GuiButton(7, this.width / 2 + 5, 151, 150, 20, I18n.getString("selectWorld.bonusItems")));
this.buttonBonusItems.drawButton = false;
this.buttonList.add(this.buttonWorldType = new GuiButton(5, this.width / 2 + 5, 100, 150, 20, I18n.getString("selectWorld.mapType")));
this.buttonWorldType.drawButton = false;
this.buttonList.add(this.buttonAllowCommands = new GuiButton(6, this.width / 2 - 155, 151, 150, 20,
I18n.getString("selectWorld.allowCommands")));
this.buttonAllowCommands.drawButton = false;
this.buttonList.add(this.buttonCustomize = new GuiButton(8, this.width / 2 + 5, 120, 150, 20, I18n.getString("selectWorld.customizeType")));
this.buttonCustomize.drawButton = false;
this.textboxWorldName = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20);
this.textboxWorldName.setFocused(true);
this.textboxWorldName.setText(this.localizedNewWorldText);
this.textboxSeed = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20);
this.textboxSeed.setText(this.seed);
this.func_82288_a(this.moreOptions);
this.makeUseableName();
this.updateButtonText();
} | @SuppressWarnings({STR}) void function() { Keyboard.enableRepeatEvents(true); this.buttonList.clear(); this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.getString(STR))); this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.getString(STR))); this.buttonList.add(this.buttonGameMode = new GuiButton(2, this.width / 2 - 75, 115, 150, 20, I18n.getString(STR))); this.buttonList.add(this.moreWorldOptions = new GuiButton(3, this.width / 2 - 75, 187, 150, 20, I18n.getString(STR))); this.buttonList.add(this.buttonGenerateStructures = new GuiButton(4, this.width / 2 - 155, 100, 150, 20, I18n.getString(STR))); this.buttonGenerateStructures.drawButton = false; this.buttonList.add(this.buttonBonusItems = new GuiButton(7, this.width / 2 + 5, 151, 150, 20, I18n.getString(STR))); this.buttonBonusItems.drawButton = false; this.buttonList.add(this.buttonWorldType = new GuiButton(5, this.width / 2 + 5, 100, 150, 20, I18n.getString(STR))); this.buttonWorldType.drawButton = false; this.buttonList.add(this.buttonAllowCommands = new GuiButton(6, this.width / 2 - 155, 151, 150, 20, I18n.getString(STR))); this.buttonAllowCommands.drawButton = false; this.buttonList.add(this.buttonCustomize = new GuiButton(8, this.width / 2 + 5, 120, 150, 20, I18n.getString(STR))); this.buttonCustomize.drawButton = false; this.textboxWorldName = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20); this.textboxWorldName.setFocused(true); this.textboxWorldName.setText(this.localizedNewWorldText); this.textboxSeed = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20); this.textboxSeed.setText(this.seed); this.func_82288_a(this.moreOptions); this.makeUseableName(); this.updateButtonText(); } | /**
* Adds the buttons (and other controls) to the screen in question.
*/ | Adds the buttons (and other controls) to the screen in question | initGui | {
"repo_name": "Ubiquitous-Spice/Modjam-3",
"path": "src/main/java/com/github/ubiquitousspice/mobjam/gamemodehack/HackedCreateWorld.java",
"license": "lgpl-3.0",
"size": 17185
} | [
"net.minecraft.client.gui.GuiButton",
"net.minecraft.client.gui.GuiTextField",
"net.minecraft.client.resources.I18n",
"org.lwjgl.input.Keyboard"
] | import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.resources.I18n; import org.lwjgl.input.Keyboard; | import net.minecraft.client.gui.*; import net.minecraft.client.resources.*; import org.lwjgl.input.*; | [
"net.minecraft.client",
"org.lwjgl.input"
] | net.minecraft.client; org.lwjgl.input; | 1,048,821 |
public static <R extends Number> ITuple4<R> translate(
final ITuple4<?> tupleToTranslate, final Number xTranslation,
final Number yTranslation, final Number zTranslation,
final Class<? extends R> returnType) {
IMatrix4<R> translationMatrix = GeometricOperations.translationMatrix(
xTranslation, yTranslation, zTranslation, returnType);
return VectorAlgebraicOperations.multiply(translationMatrix,
tupleToTranslate, returnType);
} | static <R extends Number> ITuple4<R> function( final ITuple4<?> tupleToTranslate, final Number xTranslation, final Number yTranslation, final Number zTranslation, final Class<? extends R> returnType) { IMatrix4<R> translationMatrix = GeometricOperations.translationMatrix( xTranslation, yTranslation, zTranslation, returnType); return VectorAlgebraicOperations.multiply(translationMatrix, tupleToTranslate, returnType); } | /**
* Translates the {@link ITuple4 Tuple} by the x, y, and z translation.
*
* @param <R>
* the {@link Number} type of the translated {@link ITuple4
* Tuple}.
*
* @param tupleToTranslate
* the {@link ITuple4 Tuple} to translate.
* @param xTranslation
* the x-translation.
* @param yTranslation
* the y-translation.
* @param zTranslation
* the z-translation.
* @param returnType
* the desired return type.
* @return the translated {@link ITuple4 Tuple}.
*/ | Translates the <code>ITuple4 Tuple</code> by the x, y, and z translation | translate | {
"repo_name": "aftenkap/jutility",
"path": "jutility-math/src/main/java/org/jutility/math/geometry/GeometricOperations.java",
"license": "apache-2.0",
"size": 125764
} | [
"org.jutility.math.vectoralgebra.IMatrix4",
"org.jutility.math.vectoralgebra.ITuple4",
"org.jutility.math.vectoralgebra.VectorAlgebraicOperations"
] | import org.jutility.math.vectoralgebra.IMatrix4; import org.jutility.math.vectoralgebra.ITuple4; import org.jutility.math.vectoralgebra.VectorAlgebraicOperations; | import org.jutility.math.vectoralgebra.*; | [
"org.jutility.math"
] | org.jutility.math; | 2,838,923 |
public final Column<String> getUrlColumn() {
return col_url;
} | final Column<String> function() { return col_url; } | /**
* Retrieves the <code>Url</code> <code>Column</code> for this
* <code>Template</code> <code>Table</code>.
*
* see org.melati.poem.prepro.FieldDef#generateColAccessor
* @return the url <code>Column</code>
*/ | Retrieves the <code>Url</code> <code>Column</code> for this <code>Template</code> <code>Table</code>. see org.melati.poem.prepro.FieldDef#generateColAccessor | getUrlColumn | {
"repo_name": "Melati/MelatiSite",
"path": "src/main/java/org/paneris/melati/site/model/generated/TemplateTableBase.java",
"license": "gpl-3.0",
"size": 7410
} | [
"org.melati.poem.Column"
] | import org.melati.poem.Column; | import org.melati.poem.*; | [
"org.melati.poem"
] | org.melati.poem; | 1,191,316 |
public static boolean blockHasWildcardAlt(@NotNull GrammarAST block) {
for (Object alt : block.getChildren()) {
if ( !(alt instanceof AltAST) ) continue;
AltAST altAST = (AltAST)alt;
if ( altAST.getChildCount()==1 ) {
Tree e = altAST.getChild(0);
if ( e.getType()==ANTLRParser.WILDCARD ) {
return true;
}
}
}
return false;
} | static boolean function(@NotNull GrammarAST block) { for (Object alt : block.getChildren()) { if ( !(alt instanceof AltAST) ) continue; AltAST altAST = (AltAST)alt; if ( altAST.getChildCount()==1 ) { Tree e = altAST.getChild(0); if ( e.getType()==ANTLRParser.WILDCARD ) { return true; } } } return false; } | /**
* {@code (BLOCK (ALT .))} or {@code (BLOCK (ALT 'a') (ALT .))}.
*/ | (BLOCK (ALT .)) or (BLOCK (ALT 'a') (ALT .)) | blockHasWildcardAlt | {
"repo_name": "deveshg/antlr4",
"path": "tool/src/org/antlr/v4/automata/ParserATNFactory.java",
"license": "bsd-3-clause",
"size": 24534
} | [
"org.antlr.runtime.tree.Tree",
"org.antlr.v4.parse.ANTLRParser",
"org.antlr.v4.runtime.misc.NotNull",
"org.antlr.v4.tool.ast.AltAST",
"org.antlr.v4.tool.ast.GrammarAST"
] | import org.antlr.runtime.tree.Tree; import org.antlr.v4.parse.ANTLRParser; import org.antlr.v4.runtime.misc.NotNull; import org.antlr.v4.tool.ast.AltAST; import org.antlr.v4.tool.ast.GrammarAST; | import org.antlr.runtime.tree.*; import org.antlr.v4.parse.*; import org.antlr.v4.runtime.misc.*; import org.antlr.v4.tool.ast.*; | [
"org.antlr.runtime",
"org.antlr.v4"
] | org.antlr.runtime; org.antlr.v4; | 1,804,316 |
protected int read(EndPoint endPoint, Buffer buffer, ConcurrentMap<String, Object> context) throws IOException
{
return endPoint.fill(buffer);
} | int function(EndPoint endPoint, Buffer buffer, ConcurrentMap<String, Object> context) throws IOException { return endPoint.fill(buffer); } | /**
* <p>Reads (with non-blocking semantic) into the given {@code buffer} from the given {@code endPoint}.</p>
*
* @param endPoint the endPoint to read from
* @param buffer the buffer to read data into
* @param context the context information related to the connection
* @return the number of bytes read (possibly 0 since the read is non-blocking)
* or -1 if the channel has been closed remotely
* @throws IOException if the endPoint cannot be read
*/ | Reads (with non-blocking semantic) into the given buffer from the given endPoint | read | {
"repo_name": "geekboxzone/mmallow_external_jetty",
"path": "src/java/org/eclipse/jetty/server/handler/ConnectHandler.java",
"license": "apache-2.0",
"size": 32646
} | [
"java.io.IOException",
"java.util.concurrent.ConcurrentMap",
"org.eclipse.jetty.io.Buffer",
"org.eclipse.jetty.io.EndPoint"
] | import java.io.IOException; import java.util.concurrent.ConcurrentMap; import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.EndPoint; | import java.io.*; import java.util.concurrent.*; import org.eclipse.jetty.io.*; | [
"java.io",
"java.util",
"org.eclipse.jetty"
] | java.io; java.util; org.eclipse.jetty; | 2,331,035 |
public static List<LoadMetadataDetails> identifySegmentsToBeMerged(String storeLocation,
CarbonLoadModel carbonLoadModel, int partitionCount, long compactionSize,
List<LoadMetadataDetails> segments, CompactionType compactionType) {
List sortedSegments = new ArrayList(segments);
sortSegments(sortedSegments);
// check preserve property and preserve the configured number of latest loads.
List<LoadMetadataDetails> listOfSegmentsAfterPreserve =
checkPreserveSegmentsPropertyReturnRemaining(sortedSegments);
// filter the segments if the compaction based on days is configured.
List<LoadMetadataDetails> listOfSegmentsLoadedInSameDateInterval =
identifySegmentsToBeMergedBasedOnLoadedDate(listOfSegmentsAfterPreserve);
List<LoadMetadataDetails> listOfSegmentsToBeMerged;
// identify the segments to merge based on the Size of the segments across partition.
if (compactionType.equals(CompactionType.MAJOR_COMPACTION)) {
listOfSegmentsToBeMerged = identifySegmentsToBeMergedBasedOnSize(compactionSize,
listOfSegmentsLoadedInSameDateInterval, carbonLoadModel, partitionCount, storeLocation);
} else {
listOfSegmentsToBeMerged =
identifySegmentsToBeMergedBasedOnSegCount(listOfSegmentsLoadedInSameDateInterval);
}
return listOfSegmentsToBeMerged;
} | static List<LoadMetadataDetails> function(String storeLocation, CarbonLoadModel carbonLoadModel, int partitionCount, long compactionSize, List<LoadMetadataDetails> segments, CompactionType compactionType) { List sortedSegments = new ArrayList(segments); sortSegments(sortedSegments); List<LoadMetadataDetails> listOfSegmentsAfterPreserve = checkPreserveSegmentsPropertyReturnRemaining(sortedSegments); List<LoadMetadataDetails> listOfSegmentsLoadedInSameDateInterval = identifySegmentsToBeMergedBasedOnLoadedDate(listOfSegmentsAfterPreserve); List<LoadMetadataDetails> listOfSegmentsToBeMerged; if (compactionType.equals(CompactionType.MAJOR_COMPACTION)) { listOfSegmentsToBeMerged = identifySegmentsToBeMergedBasedOnSize(compactionSize, listOfSegmentsLoadedInSameDateInterval, carbonLoadModel, partitionCount, storeLocation); } else { listOfSegmentsToBeMerged = identifySegmentsToBeMergedBasedOnSegCount(listOfSegmentsLoadedInSameDateInterval); } return listOfSegmentsToBeMerged; } | /**
* To identify which all segments can be merged.
*
* @param storeLocation
* @param carbonLoadModel
* @param partitionCount
* @param compactionSize
* @return
*/ | To identify which all segments can be merged | identifySegmentsToBeMerged | {
"repo_name": "foryou2030/incubator-carbondata",
"path": "integration/spark/src/main/java/org/apache/carbondata/spark/merger/CarbonDataMergerUtil.java",
"license": "apache-2.0",
"size": 26674
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.carbondata.core.load.LoadMetadataDetails",
"org.apache.carbondata.integration.spark.merger.CompactionType",
"org.apache.carbondata.spark.load.CarbonLoadModel"
] | import java.util.ArrayList; import java.util.List; import org.apache.carbondata.core.load.LoadMetadataDetails; import org.apache.carbondata.integration.spark.merger.CompactionType; import org.apache.carbondata.spark.load.CarbonLoadModel; | import java.util.*; import org.apache.carbondata.core.load.*; import org.apache.carbondata.integration.spark.merger.*; import org.apache.carbondata.spark.load.*; | [
"java.util",
"org.apache.carbondata"
] | java.util; org.apache.carbondata; | 1,345,672 |
@SuppressWarnings("unchecked")
public Builder putAllMetadata(Map<String, String> map) {
if (this.metadata == null || this.metadata instanceof EmptyParam) {
this.metadata = new HashMap<String, String>();
}
((Map<String, String>) this.metadata).putAll(map);
return this;
} | @SuppressWarnings(STR) Builder function(Map<String, String> map) { if (this.metadata == null this.metadata instanceof EmptyParam) { this.metadata = new HashMap<String, String>(); } ((Map<String, String>) this.metadata).putAll(map); return this; } | /**
* Add all map key/value pairs to `metadata` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
* See {@link TransactionUpdateParams#metadata} for the field documentation.
*/ | Add all map key/value pairs to `metadata` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See <code>TransactionUpdateParams#metadata</code> for the field documentation | putAllMetadata | {
"repo_name": "stripe/stripe-java",
"path": "src/main/java/com/stripe/param/issuing/TransactionUpdateParams.java",
"license": "mit",
"size": 6165
} | [
"com.stripe.param.common.EmptyParam",
"java.util.HashMap",
"java.util.Map"
] | import com.stripe.param.common.EmptyParam; import java.util.HashMap; import java.util.Map; | import com.stripe.param.common.*; import java.util.*; | [
"com.stripe.param",
"java.util"
] | com.stripe.param; java.util; | 2,007,642 |
public Map<String, Map<Integer, List<Integer>>> getAllSearchesCombinedPeptideLengthList_Map_KeyedOnSearchId_KeyedOnLinkType() {
return allSearchesCombinedPeptideLengthList_Map_KeyedOnSearchId_KeyedOnLinkType;
} | Map<String, Map<Integer, List<Integer>>> function() { return allSearchesCombinedPeptideLengthList_Map_KeyedOnSearchId_KeyedOnLinkType; } | /**
* Lists of peptideLength mapped by search id then link type
* Map<[link type], Map<[Search Id],List<[Peptide Length]>>>
* @return
*/ | Lists of peptideLength mapped by search id then link type Map>> | getAllSearchesCombinedPeptideLengthList_Map_KeyedOnSearchId_KeyedOnLinkType | {
"repo_name": "yeastrc/proxl-web-app",
"path": "proxl_web_app/src/main/java/org/yeastrc/xlink/www/qc_data/reported_peptide_level_merged/main/PeptideLength_Histogram_For_PSMPeptideCutoffs_Merged.java",
"license": "apache-2.0",
"size": 22587
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 426,598 |
void run(HiveConf conf, String jobName, Table t, Partition p, StorageDescriptor sd, ValidWriteIdList writeIds,
CompactionInfo ci, Worker.StatsUpdater su, IMetaStoreClient msc, Directory dir)
throws IOException, HiveException {
if(conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST) && conf.getBoolVar(HiveConf.ConfVars.HIVETESTMODEFAILCOMPACTION)) {
throw new RuntimeException(HiveConf.ConfVars.HIVETESTMODEFAILCOMPACTION.name() + "=true");
}
QueryCompactor queryCompactor = QueryCompactorFactory.getQueryCompactor(t, conf, ci);
if (queryCompactor != null) {
LOG.info("Will compact with " + queryCompactor.getClass().getName());
queryCompactor.runCompaction(conf, t, p, sd, writeIds, ci);
return;
}
JobConf job = createBaseJobConf(conf, jobName, t, sd, writeIds, ci);
List<AcidUtils.ParsedDelta> parsedDeltas = dir.getCurrentDirectories();
int maxDeltasToHandle = conf.getIntVar(HiveConf.ConfVars.COMPACTOR_MAX_NUM_DELTA);
if (parsedDeltas.size() > maxDeltasToHandle) {
LOG.warn(parsedDeltas.size() + " delta files found for " + ci.getFullPartitionName()
+ " located at " + sd.getLocation() + "! This is likely a sign of misconfiguration, " +
"especially if this message repeats. Check that compaction is running properly. Check for any " +
"runaway/mis-configured process writing to ACID tables, especially using Streaming Ingest API.");
int numMinorCompactions = parsedDeltas.size() / maxDeltasToHandle;
for (int jobSubId = 0; jobSubId < numMinorCompactions; jobSubId++) {
JobConf jobMinorCompact = createBaseJobConf(conf, jobName + "_" + jobSubId, t, sd, writeIds, ci);
launchCompactionJob(jobMinorCompact,
null, CompactionType.MINOR, null,
parsedDeltas.subList(jobSubId * maxDeltasToHandle, (jobSubId + 1) * maxDeltasToHandle),
maxDeltasToHandle, -1, conf, msc, ci.id, jobName);
}
//now recompute state since we've done minor compactions and have different 'best' set of deltas
dir = AcidUtils.getAcidState(null, new Path(sd.getLocation()), conf, writeIds, Ref.from(false), false);
}
StringableList dirsToSearch = new StringableList();
Path baseDir = null;
if (ci.isMajorCompaction()) {
// There may not be a base dir if the partition was empty before inserts or if this
// partition is just now being converted to ACID.
baseDir = dir.getBaseDirectory();
if (baseDir == null) {
List<HdfsFileStatusWithId> originalFiles = dir.getOriginalFiles();
if (!(originalFiles == null) && !(originalFiles.size() == 0)) {
// There are original format files
for (HdfsFileStatusWithId stat : originalFiles) {
Path path = stat.getFileStatus().getPath();
//note that originalFiles are all original files recursively not dirs
dirsToSearch.add(path);
LOG.debug("Adding original file " + path + " to dirs to search");
}
// Set base to the location so that the input format reads the original files.
baseDir = new Path(sd.getLocation());
}
} else {
// add our base to the list of directories to search for files in.
LOG.debug("Adding base directory " + baseDir + " to dirs to search");
dirsToSearch.add(baseDir);
}
}
launchCompactionJob(job, baseDir, ci.type, dirsToSearch, dir.getCurrentDirectories(),
dir.getCurrentDirectories().size(), dir.getObsolete().size(), conf, msc, ci.id, jobName);
if (su != null) {
su.gatherStats();
}
} | void run(HiveConf conf, String jobName, Table t, Partition p, StorageDescriptor sd, ValidWriteIdList writeIds, CompactionInfo ci, Worker.StatsUpdater su, IMetaStoreClient msc, Directory dir) throws IOException, HiveException { if(conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST) && conf.getBoolVar(HiveConf.ConfVars.HIVETESTMODEFAILCOMPACTION)) { throw new RuntimeException(HiveConf.ConfVars.HIVETESTMODEFAILCOMPACTION.name() + "=true"); } QueryCompactor queryCompactor = QueryCompactorFactory.getQueryCompactor(t, conf, ci); if (queryCompactor != null) { LOG.info(STR + queryCompactor.getClass().getName()); queryCompactor.runCompaction(conf, t, p, sd, writeIds, ci); return; } JobConf job = createBaseJobConf(conf, jobName, t, sd, writeIds, ci); List<AcidUtils.ParsedDelta> parsedDeltas = dir.getCurrentDirectories(); int maxDeltasToHandle = conf.getIntVar(HiveConf.ConfVars.COMPACTOR_MAX_NUM_DELTA); if (parsedDeltas.size() > maxDeltasToHandle) { LOG.warn(parsedDeltas.size() + STR + ci.getFullPartitionName() + STR + sd.getLocation() + STR + STR + STR); int numMinorCompactions = parsedDeltas.size() / maxDeltasToHandle; for (int jobSubId = 0; jobSubId < numMinorCompactions; jobSubId++) { JobConf jobMinorCompact = createBaseJobConf(conf, jobName + "_" + jobSubId, t, sd, writeIds, ci); launchCompactionJob(jobMinorCompact, null, CompactionType.MINOR, null, parsedDeltas.subList(jobSubId * maxDeltasToHandle, (jobSubId + 1) * maxDeltasToHandle), maxDeltasToHandle, -1, conf, msc, ci.id, jobName); } dir = AcidUtils.getAcidState(null, new Path(sd.getLocation()), conf, writeIds, Ref.from(false), false); } StringableList dirsToSearch = new StringableList(); Path baseDir = null; if (ci.isMajorCompaction()) { baseDir = dir.getBaseDirectory(); if (baseDir == null) { List<HdfsFileStatusWithId> originalFiles = dir.getOriginalFiles(); if (!(originalFiles == null) && !(originalFiles.size() == 0)) { for (HdfsFileStatusWithId stat : originalFiles) { Path path = stat.getFileStatus().getPath(); dirsToSearch.add(path); LOG.debug(STR + path + STR); } baseDir = new Path(sd.getLocation()); } } else { LOG.debug(STR + baseDir + STR); dirsToSearch.add(baseDir); } } launchCompactionJob(job, baseDir, ci.type, dirsToSearch, dir.getCurrentDirectories(), dir.getCurrentDirectories().size(), dir.getObsolete().size(), conf, msc, ci.id, jobName); if (su != null) { su.gatherStats(); } } | /**
* Run Compaction which may consist of several jobs on the cluster.
* @param conf Hive configuration file
* @param jobName name to run this job with
* @param t metastore table
* @param sd metastore storage descriptor
* @param writeIds list of valid write ids
* @param ci CompactionInfo
* @param su StatsUpdater which is null if no stats gathering is needed
* @throws java.io.IOException if the job fails
*/ | Run Compaction which may consist of several jobs on the cluster | run | {
"repo_name": "nishantmonu51/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorMR.java",
"license": "apache-2.0",
"size": 43801
} | [
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hive.common.ValidWriteIdList",
"org.apache.hadoop.hive.conf.HiveConf",
"org.apache.hadoop.hive.metastore.IMetaStoreClient",
"org.apache.hadoop.hive.metastore.api.CompactionType",
"org.apache.hadoop.hive.metastore.api.Partition",
"org.apache.hadoop.hive.metastore.api.StorageDescriptor",
"org.apache.hadoop.hive.metastore.api.Table",
"org.apache.hadoop.hive.metastore.txn.CompactionInfo",
"org.apache.hadoop.hive.ql.io.AcidUtils",
"org.apache.hadoop.hive.ql.metadata.HiveException",
"org.apache.hadoop.hive.shims.HadoopShims",
"org.apache.hadoop.mapred.JobConf",
"org.apache.hive.common.util.Ref"
] | import java.io.IOException; import java.util.List; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.common.ValidWriteIdList; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.IMetaStoreClient; import org.apache.hadoop.hive.metastore.api.CompactionType; import org.apache.hadoop.hive.metastore.api.Partition; import org.apache.hadoop.hive.metastore.api.StorageDescriptor; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.hadoop.hive.metastore.txn.CompactionInfo; import org.apache.hadoop.hive.ql.io.AcidUtils; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.shims.HadoopShims; import org.apache.hadoop.mapred.JobConf; import org.apache.hive.common.util.Ref; | import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.common.*; import org.apache.hadoop.hive.conf.*; import org.apache.hadoop.hive.metastore.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.hive.metastore.txn.*; import org.apache.hadoop.hive.ql.io.*; import org.apache.hadoop.hive.ql.metadata.*; import org.apache.hadoop.hive.shims.*; import org.apache.hadoop.mapred.*; import org.apache.hive.common.util.*; | [
"java.io",
"java.util",
"org.apache.hadoop",
"org.apache.hive"
] | java.io; java.util; org.apache.hadoop; org.apache.hive; | 492,484 |
public static boolean isKeepCubeHierarchyOnCategory( Chart cm )
{
return getBooleanProperty( cm,
EXTENDED_PROPERTY_HIERARCHY_CATEGORY,
ChartUtil.compareVersion( cm.getVersion( ), "2.5.3" ) > 0 ); //$NON-NLS-1$
} | static boolean function( Chart cm ) { return getBooleanProperty( cm, EXTENDED_PROPERTY_HIERARCHY_CATEGORY, ChartUtil.compareVersion( cm.getVersion( ), "2.5.3" ) > 0 ); } | /**
* Returns if cube hierarchy should be kept on category
*
* @param cm
* chart model
* @return result
*/ | Returns if cube hierarchy should be kept on category | isKeepCubeHierarchyOnCategory | {
"repo_name": "sguan-actuate/birt",
"path": "chart/org.eclipse.birt.chart.reportitem/src/org/eclipse/birt/chart/reportitem/api/ChartItemUtil.java",
"license": "epl-1.0",
"size": 59572
} | [
"org.eclipse.birt.chart.model.Chart",
"org.eclipse.birt.chart.util.ChartUtil"
] | import org.eclipse.birt.chart.model.Chart; import org.eclipse.birt.chart.util.ChartUtil; | import org.eclipse.birt.chart.model.*; import org.eclipse.birt.chart.util.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 2,389,318 |
public static boolean hasNullableAnnotation(Element element) {
return hasNullabilityAnnotation(element, NULLABLE_PATTERN);
} | static boolean function(Element element) { return hasNullabilityAnnotation(element, NULLABLE_PATTERN); } | /**
* Return true if a binding has a named "Nullable" annotation. Package names aren't
* checked because different nullable annotations are defined by several different
* Java frameworks.
*/ | Return true if a binding has a named "Nullable" annotation. Package names aren't checked because different nullable annotations are defined by several different Java frameworks | hasNullableAnnotation | {
"repo_name": "google/j2objc",
"path": "translator/src/main/java/com/google/devtools/j2objc/util/ElementUtil.java",
"license": "apache-2.0",
"size": 32357
} | [
"javax.lang.model.element.Element"
] | import javax.lang.model.element.Element; | import javax.lang.model.element.*; | [
"javax.lang"
] | javax.lang; | 1,421,076 |
@Override
public Spliterator<E> spliterator() {
return new CLQSpliterator<E>(this);
} | Spliterator<E> function() { return new CLQSpliterator<E>(this); } | /**
* Returns a {@link Spliterator} over the elements in this queue.
*
* <p>The returned spliterator is
* <a href="package-summary.html#Weakly"><i>weakly consistent</i></a>.
*
* <p>The {@code Spliterator} reports {@link Spliterator#CONCURRENT},
* {@link Spliterator#ORDERED}, and {@link Spliterator#NONNULL}.
*
* @implNote
* The {@code Spliterator} implements {@code trySplit} to permit limited
* parallelism.
*
* @return a {@code Spliterator} over the elements in this queue
* @since 1.8
*/ | Returns a <code>Spliterator</code> over the elements in this queue. The returned spliterator is weakly consistent. The Spliterator reports <code>Spliterator#CONCURRENT</code>, <code>Spliterator#ORDERED</code>, and <code>Spliterator#NONNULL</code> | spliterator | {
"repo_name": "upenn-acg/REMIX",
"path": "jvm-remix/openjdk/jdk/src/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java",
"license": "gpl-2.0",
"size": 35831
} | [
"java.util.Spliterator"
] | import java.util.Spliterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,854,142 |
public static WebViewCompatibilityResult initializeWebViewCompatibilityMode(
@NonNull Context appContext) {
ThreadCheck.ensureOnUiThread();
if (sWebViewCompatClassLoaderGetter != null) {
throw new AndroidRuntimeException(
"initializeWebViewCompatibilityMode() has already been called.");
}
if (sLoader != null) {
throw new AndroidRuntimeException(
"initializeWebViewCompatibilityMode() must be called before WebLayer is "
+ "loaded.");
}
try {
Pair<Callable<ClassLoader>, WebLayer.WebViewCompatibilityResult> result =
WebViewCompatibilityHelper.initialize(appContext);
sWebViewCompatClassLoaderGetter = result.first;
return result.second;
} catch (Exception e) {
Log.e(TAG, "Unable to initialize WebView compatibility", e);
return WebViewCompatibilityResult.FAILURE_OTHER;
}
} | static WebViewCompatibilityResult function( @NonNull Context appContext) { ThreadCheck.ensureOnUiThread(); if (sWebViewCompatClassLoaderGetter != null) { throw new AndroidRuntimeException( STR); } if (sLoader != null) { throw new AndroidRuntimeException( STR + STR); } try { Pair<Callable<ClassLoader>, WebLayer.WebViewCompatibilityResult> result = WebViewCompatibilityHelper.initialize(appContext); sWebViewCompatClassLoaderGetter = result.first; return result.second; } catch (Exception e) { Log.e(TAG, STR, e); return WebViewCompatibilityResult.FAILURE_OTHER; } } | /**
* Performs initialization needed to run WebView and WebLayer in the same process.
*
* @param appContext The hosting application's Context.
*/ | Performs initialization needed to run WebView and WebLayer in the same process | initializeWebViewCompatibilityMode | {
"repo_name": "endlessm/chromium-browser",
"path": "weblayer/public/java/org/chromium/weblayer/WebLayer.java",
"license": "bsd-3-clause",
"size": 26975
} | [
"android.content.Context",
"android.util.AndroidRuntimeException",
"android.util.Log",
"android.util.Pair",
"androidx.annotation.NonNull",
"java.util.concurrent.Callable"
] | import android.content.Context; import android.util.AndroidRuntimeException; import android.util.Log; import android.util.Pair; import androidx.annotation.NonNull; import java.util.concurrent.Callable; | import android.content.*; import android.util.*; import androidx.annotation.*; import java.util.concurrent.*; | [
"android.content",
"android.util",
"androidx.annotation",
"java.util"
] | android.content; android.util; androidx.annotation; java.util; | 2,201,816 |
public int getParameterValueAsInteger(Map<String, String> parameters, ConfigurationValue configurationValue) throws IllegalArgumentException
{
return getParameterValueAsInteger(configurationValue.getKey(), getParameterValue(parameters, configurationValue));
} | int function(Map<String, String> parameters, ConfigurationValue configurationValue) throws IllegalArgumentException { return getParameterValueAsInteger(configurationValue.getKey(), getParameterValue(parameters, configurationValue)); } | /**
* Gets the parameter value if found or defaults to the relative configuration setting value. The parameter value is parsed as a signed decimal integer.
*
* @param parameters the map of parameters
* @param configurationValue the configuration value
*
* @return the integer value represented by the parameter value in decimal
* @throws IllegalArgumentException if the parameter value does not contain a parsable integer
*/ | Gets the parameter value if found or defaults to the relative configuration setting value. The parameter value is parsed as a signed decimal integer | getParameterValueAsInteger | {
"repo_name": "FINRAOS/herd",
"path": "herd-code/herd-service/src/main/java/org/finra/herd/service/helper/ParameterHelper.java",
"license": "apache-2.0",
"size": 5381
} | [
"java.util.Map",
"org.finra.herd.model.dto.ConfigurationValue"
] | import java.util.Map; import org.finra.herd.model.dto.ConfigurationValue; | import java.util.*; import org.finra.herd.model.dto.*; | [
"java.util",
"org.finra.herd"
] | java.util; org.finra.herd; | 2,507,626 |
public synchronized PatternSet.NameEntry createExclude() {
if (isReference()) {
throw noChildrenAllowed();
}
ds = null;
return defaultPatterns.createExclude();
} | synchronized PatternSet.NameEntry function() { if (isReference()) { throw noChildrenAllowed(); } ds = null; return defaultPatterns.createExclude(); } | /**
* Add a name entry to the exclude list.
* @return <code>PatternSet.NameEntry</code>.
*/ | Add a name entry to the exclude list | createExclude | {
"repo_name": "BIORIMP/biorimp",
"path": "BIO-RIMP/test_data/code/antapache/src/main/org/apache/tools/ant/types/resources/Files.java",
"license": "gpl-2.0",
"size": 15654
} | [
"org.apache.tools.ant.types.PatternSet"
] | import org.apache.tools.ant.types.PatternSet; | import org.apache.tools.ant.types.*; | [
"org.apache.tools"
] | org.apache.tools; | 1,726,475 |
public ResourceEnvRefType<InterceptorType<T>> getOrCreateResourceEnvRef()
{
List<Node> nodeList = childNode.get("resource-env-ref");
if (nodeList != null && nodeList.size() > 0)
{
return new ResourceEnvRefTypeImpl<InterceptorType<T>>(this, "resource-env-ref", childNode, nodeList.get(0));
}
return createResourceEnvRef();
} | ResourceEnvRefType<InterceptorType<T>> function() { List<Node> nodeList = childNode.get(STR); if (nodeList != null && nodeList.size() > 0) { return new ResourceEnvRefTypeImpl<InterceptorType<T>>(this, STR, childNode, nodeList.get(0)); } return createResourceEnvRef(); } | /**
* If not already created, a new <code>resource-env-ref</code> element will be created and returned.
* Otherwise, the first existing <code>resource-env-ref</code> element will be returned.
* @return the instance defined for the element <code>resource-env-ref</code>
*/ | If not already created, a new <code>resource-env-ref</code> element will be created and returned. Otherwise, the first existing <code>resource-env-ref</code> element will be returned | getOrCreateResourceEnvRef | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar30/InterceptorTypeImpl.java",
"license": "epl-1.0",
"size": 39854
} | [
"java.util.List",
"org.jboss.shrinkwrap.descriptor.api.ejbjar30.InterceptorType",
"org.jboss.shrinkwrap.descriptor.api.javaee5.ResourceEnvRefType",
"org.jboss.shrinkwrap.descriptor.impl.javaee5.ResourceEnvRefTypeImpl",
"org.jboss.shrinkwrap.descriptor.spi.node.Node"
] | import java.util.List; import org.jboss.shrinkwrap.descriptor.api.ejbjar30.InterceptorType; import org.jboss.shrinkwrap.descriptor.api.javaee5.ResourceEnvRefType; import org.jboss.shrinkwrap.descriptor.impl.javaee5.ResourceEnvRefTypeImpl; import org.jboss.shrinkwrap.descriptor.spi.node.Node; | import java.util.*; import org.jboss.shrinkwrap.descriptor.api.ejbjar30.*; import org.jboss.shrinkwrap.descriptor.api.javaee5.*; import org.jboss.shrinkwrap.descriptor.impl.javaee5.*; import org.jboss.shrinkwrap.descriptor.spi.node.*; | [
"java.util",
"org.jboss.shrinkwrap"
] | java.util; org.jboss.shrinkwrap; | 2,516,197 |
void setTitle(@StringRes int resourceId); | void setTitle(@StringRes int resourceId); | /**
* Sets the title of the dialog.
*
* @param resourceId
* The resource id of the title, which should be set, as an {@link Integer}. The
* resource id must correspond to a valid string resource
*/ | Sets the title of the dialog | setTitle | {
"repo_name": "michael-rapp/AndroidMaterialDialog",
"path": "library/src/main/java/de/mrapp/android/dialog/model/MaterialDialogDecorator.java",
"license": "apache-2.0",
"size": 29588
} | [
"androidx.annotation.StringRes"
] | import androidx.annotation.StringRes; | import androidx.annotation.*; | [
"androidx.annotation"
] | androidx.annotation; | 2,788,984 |
public static <T> DataResult<T> ok(@Nullable final T data) {
return new DataResult<>(ResultType.OK, null, null, data);
} | static <T> DataResult<T> function(@Nullable final T data) { return new DataResult<>(ResultType.OK, null, null, data); } | /**
* Create a success result with some data.
*
* @param data
* Optional data.
*
* @return Result with type {@link ResultType#OK}.
*
* @param <T>
* Type of data.
*/ | Create a success result with some data | ok | {
"repo_name": "fuinorg/cqrs-4-java",
"path": "src/main/java/org/fuin/cqrs4j/DataResult.java",
"license": "lgpl-3.0",
"size": 10318
} | [
"org.fuin.objects4j.common.Nullable"
] | import org.fuin.objects4j.common.Nullable; | import org.fuin.objects4j.common.*; | [
"org.fuin.objects4j"
] | org.fuin.objects4j; | 452,019 |
public static HashMap<String, BeanElement> getBeanMap(Class<?> reflectClass, boolean checkForGet,
boolean supportEnum, Class<?>... fieldsClass) {
ArrayList<BeanElement> beans = getBeans(reflectClass, checkForGet, supportEnum, fieldsClass);
HashMap<String, BeanElement> map = new HashMap<String, BeanElement>() {
private static final long serialVersionUID = -5404691466641093312L; | static HashMap<String, BeanElement> function(Class<?> reflectClass, boolean checkForGet, boolean supportEnum, Class<?>... fieldsClass) { ArrayList<BeanElement> beans = getBeans(reflectClass, checkForGet, supportEnum, fieldsClass); HashMap<String, BeanElement> map = new HashMap<String, BeanElement>() { private static final long serialVersionUID = -5404691466641093312L; | /**
* Get all the bean elements of a class
*
* @param reflectClass
* the class to explore
* @param checkForGet
* if set to true will check for getter method as well otherwise
* only the setter is mandatory.
* @param fieldsClass
* an array of all the type of classes that are required:
* String.class, Integer.TYPE ...
* @return An map with field name as key contain all the bean elements.
*/ | Get all the bean elements of a class | getBeanMap | {
"repo_name": "Top-Q/jsystem",
"path": "jsystem-core-projects/jsystemCore/src/main/java/jsystem/utils/beans/BeanUtils.java",
"license": "apache-2.0",
"size": 17940
} | [
"java.util.ArrayList",
"java.util.HashMap"
] | import java.util.ArrayList; import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,905,680 |
private static Integer getHealthcareEntityIndex(String entityReference) {
if (!CoreUtils.isNullOrEmpty(entityReference)) {
int lastIndex = entityReference.lastIndexOf('/');
if (lastIndex != -1) {
return Integer.parseInt(entityReference.substring(lastIndex + 1));
}
}
throw LOGGER.logExceptionAsError(
new RuntimeException("Failed to parse healthcare entity index from: " + entityReference));
} | static Integer function(String entityReference) { if (!CoreUtils.isNullOrEmpty(entityReference)) { int lastIndex = entityReference.lastIndexOf('/'); if (lastIndex != -1) { return Integer.parseInt(entityReference.substring(lastIndex + 1)); } } throw LOGGER.logExceptionAsError( new RuntimeException(STR + entityReference)); } | /**
* Helper function that parse healthcare entity index from the given entity reference string.
* The entity reference format is "#/results/documents/0/entities/3".
*
* @param entityReference the given healthcare entity reference string.
*
* @return the healthcare entity index.
*/ | Helper function that parse healthcare entity index from the given entity reference string. The entity reference format is "#/results/documents/0/entities/3" | getHealthcareEntityIndex | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java",
"license": "mit",
"size": 63252
} | [
"com.azure.core.util.CoreUtils"
] | import com.azure.core.util.CoreUtils; | import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 640,439 |
void addRouteDefinition(RouteDefinition routeDefinition) throws Exception; | void addRouteDefinition(RouteDefinition routeDefinition) throws Exception; | /**
* Add a route definition to the context
*
* @param routeDefinition the route definition to add
* @throws Exception if the route definition could not be created for whatever reason
*/ | Add a route definition to the context | addRouteDefinition | {
"repo_name": "neoramon/camel",
"path": "camel-core/src/main/java/org/apache/camel/CamelContext.java",
"license": "apache-2.0",
"size": 70125
} | [
"org.apache.camel.model.RouteDefinition"
] | import org.apache.camel.model.RouteDefinition; | import org.apache.camel.model.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,942,739 |
public void unbind()
throws GramException, GSSException {
Gram.unregisterListener(this);
} | void function() throws GramException, GSSException { Gram.unregisterListener(this); } | /**
* Unregisters a callback listener for this job.
* (Disconnects from the job)
*
* @throws GramException
* if error occurs during job unregistration.
* @throws GSSException
* if user credentials are invalid.
*/ | Unregisters a callback listener for this job. (Disconnects from the job) | unbind | {
"repo_name": "gbehrmann/JGlobus",
"path": "gram/src/main/java/org/globus/gram/GramJob.java",
"license": "apache-2.0",
"size": 13418
} | [
"org.ietf.jgss.GSSException"
] | import org.ietf.jgss.GSSException; | import org.ietf.jgss.*; | [
"org.ietf.jgss"
] | org.ietf.jgss; | 1,779,107 |
private boolean createTenantWithEmailUserName(String userNameWithEmail, String pwd,
String domainName, String backendUrl)
throws XPathExpressionException, RemoteException, TenantMgtAdminServiceExceptionException {
boolean isSuccess = false;
String endPoint = backendUrl + "TenantMgtAdminService";
TenantMgtAdminServiceStub tenantMgtAdminServiceStub =
new TenantMgtAdminServiceStub(
endPoint);
AuthenticateStub.authenticateStub(gatewayContext.getSuperTenant().getContextUser().getUserName(),
gatewayContext.getSuperTenant().getContextUser().getUserName(), tenantMgtAdminServiceStub);
Date date = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
TenantInfoBean tenantInfoBean = new TenantInfoBean();
tenantInfoBean.setActive(true);
tenantInfoBean.setEmail(userNameWithEmail);
tenantInfoBean.setAdminPassword(pwd);
tenantInfoBean.setAdmin(userNameWithEmail);
tenantInfoBean.setTenantDomain(domainName);
tenantInfoBean.setCreatedDate(calendar);
tenantInfoBean.setFirstname(gatewayContext.getContextTenant().getContextUser().getUserName());
tenantInfoBean.setLastname(gatewayContext.getContextTenant().getContextUser().getUserName()
+ "wso2automation");
tenantInfoBean.setSuccessKey("true");
tenantInfoBean.setUsagePlan("demo");
TenantInfoBean tenantInfoBeanGet;
tenantInfoBeanGet = tenantMgtAdminServiceStub.getTenant(domainName);
if (!tenantInfoBeanGet.getActive() && tenantInfoBeanGet.getTenantId() != 0) {
tenantMgtAdminServiceStub.activateTenant(domainName);
log.info("Tenant domain " + domainName + " Activated successfully");
} else if (!tenantInfoBeanGet.getActive() && tenantInfoBeanGet.getTenantId() == 0) {
tenantMgtAdminServiceStub.addTenant(tenantInfoBean);
tenantMgtAdminServiceStub.activateTenant(domainName);
log.info("Tenant domain " + domainName +
" created and activated successfully");
log.info("Tenant domain " + domainName + " created and activated successfully");
isSuccess = true;
} else {
log.info("Tenant domain " + domainName + " already registered");
}
return isSuccess;
} | boolean function(String userNameWithEmail, String pwd, String domainName, String backendUrl) throws XPathExpressionException, RemoteException, TenantMgtAdminServiceExceptionException { boolean isSuccess = false; String endPoint = backendUrl + STR; TenantMgtAdminServiceStub tenantMgtAdminServiceStub = new TenantMgtAdminServiceStub( endPoint); AuthenticateStub.authenticateStub(gatewayContext.getSuperTenant().getContextUser().getUserName(), gatewayContext.getSuperTenant().getContextUser().getUserName(), tenantMgtAdminServiceStub); Date date = new Date(); Calendar calendar = new GregorianCalendar(); calendar.setTime(date); TenantInfoBean tenantInfoBean = new TenantInfoBean(); tenantInfoBean.setActive(true); tenantInfoBean.setEmail(userNameWithEmail); tenantInfoBean.setAdminPassword(pwd); tenantInfoBean.setAdmin(userNameWithEmail); tenantInfoBean.setTenantDomain(domainName); tenantInfoBean.setCreatedDate(calendar); tenantInfoBean.setFirstname(gatewayContext.getContextTenant().getContextUser().getUserName()); tenantInfoBean.setLastname(gatewayContext.getContextTenant().getContextUser().getUserName() + STR); tenantInfoBean.setSuccessKey("true"); tenantInfoBean.setUsagePlan("demo"); TenantInfoBean tenantInfoBeanGet; tenantInfoBeanGet = tenantMgtAdminServiceStub.getTenant(domainName); if (!tenantInfoBeanGet.getActive() && tenantInfoBeanGet.getTenantId() != 0) { tenantMgtAdminServiceStub.activateTenant(domainName); log.info(STR + domainName + STR); } else if (!tenantInfoBeanGet.getActive() && tenantInfoBeanGet.getTenantId() == 0) { tenantMgtAdminServiceStub.addTenant(tenantInfoBean); tenantMgtAdminServiceStub.activateTenant(domainName); log.info(STR + domainName + STR); log.info(STR + domainName + STR); isSuccess = true; } else { log.info(STR + domainName + STR); } return isSuccess; } | /**
* create a new tenant with email address as the user name.
*
* @param userNameWithEmail tenant name with email
* @param pwd tenant password
* @param domainName tenant domain name
* @param backendUrl apim backend url
* @return boolean whether tenant creation was successful or not
*/ | create a new tenant with email address as the user name | createTenantWithEmailUserName | {
"repo_name": "ruwanta/product-apim",
"path": "modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/login/EmailUserNameLoginTestCase.java",
"license": "apache-2.0",
"size": 8858
} | [
"java.rmi.RemoteException",
"java.util.Calendar",
"java.util.Date",
"java.util.GregorianCalendar",
"javax.xml.xpath.XPathExpressionException",
"org.wso2.am.admin.clients.client.utils.AuthenticateStub",
"org.wso2.carbon.tenant.mgt.stub.TenantMgtAdminServiceExceptionException",
"org.wso2.carbon.tenant.mgt.stub.TenantMgtAdminServiceStub",
"org.wso2.carbon.tenant.mgt.stub.beans.xsd.TenantInfoBean"
] | import java.rmi.RemoteException; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import javax.xml.xpath.XPathExpressionException; import org.wso2.am.admin.clients.client.utils.AuthenticateStub; import org.wso2.carbon.tenant.mgt.stub.TenantMgtAdminServiceExceptionException; import org.wso2.carbon.tenant.mgt.stub.TenantMgtAdminServiceStub; import org.wso2.carbon.tenant.mgt.stub.beans.xsd.TenantInfoBean; | import java.rmi.*; import java.util.*; import javax.xml.xpath.*; import org.wso2.am.admin.clients.client.utils.*; import org.wso2.carbon.tenant.mgt.stub.*; import org.wso2.carbon.tenant.mgt.stub.beans.xsd.*; | [
"java.rmi",
"java.util",
"javax.xml",
"org.wso2.am",
"org.wso2.carbon"
] | java.rmi; java.util; javax.xml; org.wso2.am; org.wso2.carbon; | 2,323,742 |
@IgniteSpiConfiguration(optional = true)
public TcpCommunicationSpi setLocalPort(int locPort) {
cfg.localPort(locPort);
return (TcpCommunicationSpi) this;
} | @IgniteSpiConfiguration(optional = true) TcpCommunicationSpi function(int locPort) { cfg.localPort(locPort); return (TcpCommunicationSpi) this; } | /**
* Sets local port for socket binding.
* <p>
* If not provided, default value is {@link TcpCommunicationSpi#DFLT_PORT}.
*
* @param locPort Port number.
* @return {@code this} for chaining.
*/ | Sets local port for socket binding. If not provided, default value is <code>TcpCommunicationSpi#DFLT_PORT</code> | setLocalPort | {
"repo_name": "ascherbakoff/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/internal/TcpCommunicationConfigInitializer.java",
"license": "apache-2.0",
"size": 34275
} | [
"org.apache.ignite.spi.IgniteSpiConfiguration",
"org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi"
] | import org.apache.ignite.spi.IgniteSpiConfiguration; import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi; | import org.apache.ignite.spi.*; import org.apache.ignite.spi.communication.tcp.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,094,804 |
Map<EventType, Long> countEventsByType(ZoomParams params) {
if (params.getTimeRange() != null) {
return countEventsByType(params.getTimeRange().getStartMillis() / 1000,
params.getTimeRange().getEndMillis() / 1000,
params.getFilter(), params.getTypeZoomLevel());
} else {
return Collections.emptyMap();
}
} | Map<EventType, Long> countEventsByType(ZoomParams params) { if (params.getTimeRange() != null) { return countEventsByType(params.getTimeRange().getStartMillis() / 1000, params.getTimeRange().getEndMillis() / 1000, params.getFilter(), params.getTypeZoomLevel()); } else { return Collections.emptyMap(); } } | /**
* get the count of all events that fit the given zoom params organized by
* the EvenType of the level spcified in the ZoomParams
*
* @param params the params that control what events to count and how to
* organize the returned map
*
* @return a map from event type( of the requested level) to event counts
*/ | get the count of all events that fit the given zoom params organized by the EvenType of the level spcified in the ZoomParams | countEventsByType | {
"repo_name": "mhmdfy/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/timeline/db/EventDB.java",
"license": "apache-2.0",
"size": 55923
} | [
"java.util.Collections",
"java.util.Map",
"org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType",
"org.sleuthkit.autopsy.timeline.zooming.ZoomParams"
] | import java.util.Collections; import java.util.Map; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.EventType; import org.sleuthkit.autopsy.timeline.zooming.ZoomParams; | import java.util.*; import org.sleuthkit.autopsy.timeline.datamodel.eventtype.*; import org.sleuthkit.autopsy.timeline.zooming.*; | [
"java.util",
"org.sleuthkit.autopsy"
] | java.util; org.sleuthkit.autopsy; | 515,373 |
if (stream != null) {
stream.close();
}
if (wrappedStream != null) {
try {
wrappedStream.close();
}
catch (IOException e) {
// try to close but eat IOException because it was
// already closed by the main stream or something
// else happened what we should not care about
}
}
} | if (stream != null) { stream.close(); } if (wrappedStream != null) { try { wrappedStream.close(); } catch (IOException e) { } } } | /**
* Close both streams in this holder. Possible {@code IOException} by closing wrapped stream is not thrown.
*
* @see InputStream#close()
* @see OutputStream#close()
*/ | Close both streams in this holder. Possible IOException by closing wrapped stream is not thrown | close | {
"repo_name": "AaronZhangL/SpringHbaseKiteSample",
"path": "src/main/java/org/springframework/data/hadoop/store/support/StreamsHolder.java",
"license": "apache-2.0",
"size": 3245
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,199,082 |
public synchronized List<String> getResponseHeaders() throws IOException {
try {
while (responseHeaders == null && errorCode == null) {
wait();
}
if (responseHeaders != null) {
return responseHeaders;
}
throw new IOException("stream was reset: " + errorCode);
} catch (InterruptedException e) {
InterruptedIOException rethrow = new InterruptedIOException();
rethrow.initCause(e);
throw rethrow;
}
} | synchronized List<String> function() throws IOException { try { while (responseHeaders == null && errorCode == null) { wait(); } if (responseHeaders != null) { return responseHeaders; } throw new IOException(STR + errorCode); } catch (InterruptedException e) { InterruptedIOException rethrow = new InterruptedIOException(); rethrow.initCause(e); throw rethrow; } } | /**
* Returns the stream's response headers, blocking if necessary if they
* have not been received yet.
*/ | Returns the stream's response headers, blocking if necessary if they have not been received yet | getResponseHeaders | {
"repo_name": "xiaobi625/okhttp",
"path": "okhttp-protocols/src/main/java/com/squareup/okhttp/internal/spdy/SpdyStream.java",
"license": "apache-2.0",
"size": 20771
} | [
"java.io.IOException",
"java.io.InterruptedIOException",
"java.util.List"
] | import java.io.IOException; import java.io.InterruptedIOException; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,122,683 |
public void setPerEquityInfo(final Map<String, EquityInfo> perEquityInfo) {
_perEquityInfo.clear();
_perEquityInfo.putAll(perEquityInfo);
} | void function(final Map<String, EquityInfo> perEquityInfo) { _perEquityInfo.clear(); _perEquityInfo.putAll(perEquityInfo); } | /**
* Sets the forward curve defaults for a set of equity tickers.
*
* @param perEquityInfo
* The per-equity defaults
*/ | Sets the forward curve defaults for a set of equity tickers | setPerEquityInfo | {
"repo_name": "McLeodMoores/starling",
"path": "projects/financial/src/main/java/com/opengamma/financial/analytics/model/equity/option/EquityOptionFunctions.java",
"license": "apache-2.0",
"size": 25565
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,428,239 |
public PublicationSummaryViewBean summaryView(String sampleId, HttpServletRequest request) throws Exception
{
// Prepare data.
PublicationSummaryViewBean summaryView = this.prepareSummary(sampleId, request);
HttpSession session = request.getSession();
session.setAttribute("sampleId", sampleId);
// return mapping.findForward("summaryView");
return summaryView;
} | PublicationSummaryViewBean function(String sampleId, HttpServletRequest request) throws Exception { PublicationSummaryViewBean summaryView = this.prepareSummary(sampleId, request); HttpSession session = request.getSession(); session.setAttribute(STR, sampleId); return summaryView; } | /**
* Handle summary report view request.
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws Exception
*/ | Handle summary report view request | summaryView | {
"repo_name": "NCIP/cananolab",
"path": "software/cananolab-webapp/src/gov/nih/nci/cananolab/restful/publication/PublicationBO.java",
"license": "bsd-3-clause",
"size": 37880
} | [
"gov.nih.nci.cananolab.dto.common.PublicationSummaryViewBean",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpSession"
] | import gov.nih.nci.cananolab.dto.common.PublicationSummaryViewBean; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; | import gov.nih.nci.cananolab.dto.common.*; import javax.servlet.http.*; | [
"gov.nih.nci",
"javax.servlet"
] | gov.nih.nci; javax.servlet; | 1,707,190 |
private ClientListenerResponse getColumnsMeta(OdbcQueryGetColumnsMetaRequest req) {
try {
List<OdbcColumnMeta> meta = new ArrayList<>();
String schemaPattern;
String tablePattern;
if (req.tablePattern().contains(".")) {
// Parsing two-part table name.
String[] parts = req.tablePattern().split("\\.");
schemaPattern = OdbcUtils.removeQuotationMarksIfNeeded(parts[0]);
tablePattern = parts[1];
}
else {
schemaPattern = OdbcUtils.removeQuotationMarksIfNeeded(req.schemaPattern());
tablePattern = req.tablePattern();
}
for (String cacheName : ctx.cache().publicCacheNames()) {
for (GridQueryTypeDescriptor table : ctx.query().types(cacheName)) {
if (!matches(table.schemaName(), schemaPattern) ||
!matches(table.tableName(), tablePattern))
continue;
for (Map.Entry<String, Class<?>> field : table.fields().entrySet()) {
if (!matches(field.getKey(), req.columnPattern()))
continue;
OdbcColumnMeta columnMeta = new OdbcColumnMeta(table.schemaName(), table.tableName(),
field.getKey(), field.getValue());
if (!meta.contains(columnMeta))
meta.add(columnMeta);
}
}
}
OdbcQueryGetColumnsMetaResult res = new OdbcQueryGetColumnsMetaResult(meta);
return new OdbcResponse(res);
}
catch (Exception e) {
U.error(log, "Failed to get columns metadata [reqId=" + req.requestId() + ", req=" + req + ']', e);
return exceptionToResult(e);
}
} | ClientListenerResponse function(OdbcQueryGetColumnsMetaRequest req) { try { List<OdbcColumnMeta> meta = new ArrayList<>(); String schemaPattern; String tablePattern; if (req.tablePattern().contains(".")) { String[] parts = req.tablePattern().split("\\."); schemaPattern = OdbcUtils.removeQuotationMarksIfNeeded(parts[0]); tablePattern = parts[1]; } else { schemaPattern = OdbcUtils.removeQuotationMarksIfNeeded(req.schemaPattern()); tablePattern = req.tablePattern(); } for (String cacheName : ctx.cache().publicCacheNames()) { for (GridQueryTypeDescriptor table : ctx.query().types(cacheName)) { if (!matches(table.schemaName(), schemaPattern) !matches(table.tableName(), tablePattern)) continue; for (Map.Entry<String, Class<?>> field : table.fields().entrySet()) { if (!matches(field.getKey(), req.columnPattern())) continue; OdbcColumnMeta columnMeta = new OdbcColumnMeta(table.schemaName(), table.tableName(), field.getKey(), field.getValue()); if (!meta.contains(columnMeta)) meta.add(columnMeta); } } } OdbcQueryGetColumnsMetaResult res = new OdbcQueryGetColumnsMetaResult(meta); return new OdbcResponse(res); } catch (Exception e) { U.error(log, STR + req.requestId() + STR + req + ']', e); return exceptionToResult(e); } } | /**
* {@link OdbcQueryGetColumnsMetaRequest} command handler.
*
* @param req Get columns metadata request.
* @return Response.
*/ | <code>OdbcQueryGetColumnsMetaRequest</code> command handler | getColumnsMeta | {
"repo_name": "psadusumilli/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java",
"license": "apache-2.0",
"size": 23697
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.apache.ignite.internal.processors.odbc.ClientListenerResponse",
"org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor",
"org.apache.ignite.internal.util.typedef.internal.U"
] | import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.ignite.internal.processors.odbc.ClientListenerResponse; import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor; import org.apache.ignite.internal.util.typedef.internal.U; | import java.util.*; import org.apache.ignite.internal.processors.odbc.*; import org.apache.ignite.internal.processors.query.*; import org.apache.ignite.internal.util.typedef.internal.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 1,760,671 |
public OffsetDateTime deletionDate() {
return this.deletionDate;
} | OffsetDateTime function() { return this.deletionDate; } | /**
* Get the deletionDate property: The deleted date.
*
* @return the deletionDate value.
*/ | Get the deletionDate property: The deleted date | deletionDate | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/src/main/java/com/azure/resourcemanager/keyvault/models/DeletedVaultProperties.java",
"license": "mit",
"size": 3162
} | [
"java.time.OffsetDateTime"
] | import java.time.OffsetDateTime; | import java.time.*; | [
"java.time"
] | java.time; | 460,828 |
public Date getMinSelectableDate() {
return jcalendar.getMinSelectableDate();
} | Date function() { return jcalendar.getMinSelectableDate(); } | /**
* Gets the minimum selectable date.
*
* @return the minimum selectable date
*/ | Gets the minimum selectable date | getMinSelectableDate | {
"repo_name": "DegJ/miceschoolproject",
"path": "MICE/lib/JCalendar-2/src/com/toedter/calendar/JDateChooser.java",
"license": "apache-2.0",
"size": 17372
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,582,834 |
public void press(Object... keys) {
boolean wasPaused = paused();
if (wasPaused)
resume();
for (Object key : keys) {
if (key instanceof String
&& staticIntFields(PositronAPI.Key.class).contains(key)) {
key = staticInt(PositronAPI.Key.class, (String) key);
}
if (key instanceof Integer)
sendKeyDownUpSync((Integer) key);
else if (key instanceof String)
sendStringSync((String) key);
else
throw new IllegalArgumentException();
}
if (wasPaused)
pause();
} | void function(Object... keys) { boolean wasPaused = paused(); if (wasPaused) resume(); for (Object key : keys) { if (key instanceof String && staticIntFields(PositronAPI.Key.class).contains(key)) { key = staticInt(PositronAPI.Key.class, (String) key); } if (key instanceof Integer) sendKeyDownUpSync((Integer) key); else if (key instanceof String) sendStringSync((String) key); else throw new IllegalArgumentException(); } if (wasPaused) pause(); } | /**
* sendKeyDownUpSync on all keys in order, resuming momentarily if
* necessary.
*
* @param keys
* A mixture of ints and Strings. ints are sent with
* sendKeyDownUpSync, Strings are send with sendStringSync.
* @throws IllegalArgumentException
* if something other than an int or String was passed.
*/ | sendKeyDownUpSync on all keys in order, resuming momentarily if necessary | press | {
"repo_name": "kronenpj/iqapps-broken",
"path": "IQTimeSheet-it/src/main/java/com/googlecode/iqapps/testtools/Positron.java",
"license": "apache-2.0",
"size": 24082
} | [
"com.googlecode.iqapps.testtools.ReflectionUtils"
] | import com.googlecode.iqapps.testtools.ReflectionUtils; | import com.googlecode.iqapps.testtools.*; | [
"com.googlecode.iqapps"
] | com.googlecode.iqapps; | 263,007 |
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_TEXT_RECEIVING, defaultValue = "2") // Default is FOREGROUND
@SimpleProperty()
public void ReceivingEnabled(int enabled) {
if ((enabled < ComponentConstants.TEXT_RECEIVING_OFF) ||
(enabled > ComponentConstants.TEXT_RECEIVING_ALWAYS)) {
container.$form().dispatchErrorOccurredEvent(this, "Texting",
ErrorMessages.ERROR_BAD_VALUE_FOR_TEXT_RECEIVING, enabled);
return;
}
Texting.receivingEnabled = enabled;
SharedPreferences prefs = activity.getSharedPreferences(PREF_FILE, Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(PREF_RCVENABLED, enabled);
editor.remove(PREF_RCVENABLED_LEGACY); // Remove any legacy value
editor.commit();
} | @DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_TEXT_RECEIVING, defaultValue = "2") @SimpleProperty() void function(int enabled) { if ((enabled < ComponentConstants.TEXT_RECEIVING_OFF) (enabled > ComponentConstants.TEXT_RECEIVING_ALWAYS)) { container.$form().dispatchErrorOccurredEvent(this, STR, ErrorMessages.ERROR_BAD_VALUE_FOR_TEXT_RECEIVING, enabled); return; } Texting.receivingEnabled = enabled; SharedPreferences prefs = activity.getSharedPreferences(PREF_FILE, Activity.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt(PREF_RCVENABLED, enabled); editor.remove(PREF_RCVENABLED_LEGACY); editor.commit(); } | /**
* Sets whether you want the {@link #MessageReceived(String,String)} event to
* get run when a new text message is received.
*
* @param enabled 0 = never receive, 1 = receive foreground only, 2 = receive always
*
*/ | Sets whether you want the <code>#MessageReceived(String,String)</code> event to get run when a new text message is received | ReceivingEnabled | {
"repo_name": "codimeo/codi-studio",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/Texting.java",
"license": "apache-2.0",
"size": 39969
} | [
"android.app.Activity",
"android.content.SharedPreferences",
"com.google.appinventor.components.annotations.DesignerProperty",
"com.google.appinventor.components.annotations.SimpleProperty",
"com.google.appinventor.components.common.ComponentConstants",
"com.google.appinventor.components.common.PropertyTypeConstants",
"com.google.appinventor.components.runtime.util.ErrorMessages"
] | import android.app.Activity; import android.content.SharedPreferences; import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.annotations.SimpleProperty; import com.google.appinventor.components.common.ComponentConstants; import com.google.appinventor.components.common.PropertyTypeConstants; import com.google.appinventor.components.runtime.util.ErrorMessages; | import android.app.*; import android.content.*; import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.common.*; import com.google.appinventor.components.runtime.util.*; | [
"android.app",
"android.content",
"com.google.appinventor"
] | android.app; android.content; com.google.appinventor; | 907,322 |
public void testCloning() {
XYDataItem i1 = new XYDataItem(1.0, 1.1);
XYDataItem i2 = null;
try {
i2 = (XYDataItem) i1.clone();
}
catch (CloneNotSupportedException e) {
System.err.println("XYDataItemTests.testCloning: failed to clone.");
}
assertTrue(i1 != i2);
assertTrue(i1.getClass() == i2.getClass());
assertTrue(i1.equals(i2));
} | void function() { XYDataItem i1 = new XYDataItem(1.0, 1.1); XYDataItem i2 = null; try { i2 = (XYDataItem) i1.clone(); } catch (CloneNotSupportedException e) { System.err.println(STR); } assertTrue(i1 != i2); assertTrue(i1.getClass() == i2.getClass()); assertTrue(i1.equals(i2)); } | /**
* Confirm that cloning works.
*/ | Confirm that cloning works | testCloning | {
"repo_name": "nologic/nabs",
"path": "client/trunk/shared/libraries/jfreechart-1.0.5/tests/org/jfree/data/xy/junit/XYDataItemTests.java",
"license": "gpl-2.0",
"size": 4126
} | [
"org.jfree.data.xy.XYDataItem"
] | import org.jfree.data.xy.XYDataItem; | import org.jfree.data.xy.*; | [
"org.jfree.data"
] | org.jfree.data; | 1,407,601 |
@Test(groups = {"wso2.esb"}, description = "Test ESB as an IDoc Sender")
public void testSendIdocUsingCallBlocking() throws Exception {
SimpleHttpClient soapClient = new SimpleHttpClient();
String payload = "<_-DSD_-ROUTEACCOUNT_CORDER002>\n"
+ " <IDOC BEGIN=\"1\">\n"
+ " <EDI_DC40 SEGMENT=\"1\">\n"
+ " <TABNAM>EDI_DC40</TABNAM>\n"
+ " <MANDT>405</MANDT>\n"
+ " <DOCREL>700</DOCREL>\n"
+ " <STATUS>30</STATUS>\n"
+ " <DIRECT>1</DIRECT>\n"
+ " <OUTMOD>2</OUTMOD>\n"
+ " <IDOCTYP>/DSD/ROUTEACCOUNT_CORDER002</IDOCTYP>\n"
+ " <MESTYP>/DSD/ROUTEACCOUNT_CORDER0</MESTYP>\n"
+ " <STDMES>/DSD/R</STDMES>\n"
+ " <SNDPOR>SAPCCR</SNDPOR>\n"
+ " <SNDPRT>LS</SNDPRT>\n"
+ " <SNDPRN>WSO2ESB</SNDPRN>\n"
+ " <RCVPOR>SAP_GW_IDO</RCVPOR>\n"
+ " <RCVPRT>LS</RCVPRT>\n"
+ " <RCVPRN>WSO2ESB</RCVPRN>\n"
+ " <CREDAT>20160816</CREDAT>\n"
+ " <CRETIM>132507</CRETIM>\n"
+ " </EDI_DC40>\n"
+ " <_-DSD_-E1BPRAGENERALHD SEGMENT=\"1\">\n"
+ " <TOUR_ID>2</TOUR_ID>\n"
+ " <MISSION_ID>2</MISSION_ID>\n"
+ " </_-DSD_-E1BPRAGENERALHD>\n"
+ " <_-DSD_-E1BPRAORDERHD2 SEGMENT=\"1\">\n"
+ " <VISIT_ID>0</VISIT_ID>\n"
+ " <HH_ORDER>1</HH_ORDER>\n"
+ " <ORDER_TIMESTAMP>1</ORDER_TIMESTAMP>\n"
+ " <ORDER_TIMEZONE>1</ORDER_TIMEZONE>\n"
+ " <REASON>1</REASON>\n"
+ " <PO_NUM>1</PO_NUM>\n"
+ " <ORD_TIMESTAMP>1</ORD_TIMESTAMP>\n"
+ " <ORD_TIMEZONE>1</ORD_TIMEZONE>\n"
+ " </_-DSD_-E1BPRAORDERHD2>\n"
+ " <_-DSD_-E1BPRAORDERITM2 SEGMENT=\"1\">\n"
+ " <VISIT_ID>0</VISIT_ID>\n"
+ " <HH_ORDER>2</HH_ORDER>\n"
+ " <HH_ORDER_ITM>2</HH_ORDER_ITM>\n"
+ " <MATERIAL>2</MATERIAL>\n"
+ " <QUANTITY>2</QUANTITY>\n"
+ " <UOM>2</UOM>\n"
+ " <TA_CODE>2</TA_CODE>\n"
+ " <REASON>2</REASON>\n"
+ " <ORD_TIMESTAMP>2</ORD_TIMESTAMP>\n"
+ " <ORD_TIMEZONE>2</ORD_TIMEZONE>\n"
+ " <SPEC_RETURN>0</SPEC_RETURN>\n"
+ " </_-DSD_-E1BPRAORDERITM2>\n"
+ " <_-DSD_-E1BPRAORDERCOND2 SEGMENT=\"1\">\n"
+ " <VISIT_ID>0</VISIT_ID>\n"
+ " <HH_ORDER>3</HH_ORDER>\n"
+ " <HH_ORDER_ITM>3</HH_ORDER_ITM>\n"
+ " <COND_TYPE>3</COND_TYPE>\n"
+ " <AMOUNT>3</AMOUNT>\n"
+ " <CURRENCY>3</CURRENCY>\n"
+ " <CURR_ISO>3</CURR_ISO>\n"
+ " </_-DSD_-E1BPRAORDERCOND2>\n"
+ " <E1BPPAREX SEGMENT=\"1\">\n"
+ " <STRUCTURE>0</STRUCTURE>\n"
+ " <VALUEPART1>4</VALUEPART1>\n"
+ " <VALUEPART2>5</VALUEPART2>\n"
+ " <VALUEPART3>6</VALUEPART3>\n"
+ " <VALUEPART4>7</VALUEPART4>\n"
+ " </E1BPPAREX>\n"
+ " </IDOC>\n"
+ " </_-DSD_-ROUTEACCOUNT_CORDER002>\n";
HttpResponse response = soapClient.doPost(getProxyServiceURLHttp("sapIdocUsingCallBlockingTestProxy"),
null, payload, MEDIA_TYPE_TEXT_XML);
Assert.assertEquals(response.getStatusLine().getStatusCode(), HTTP_SC_OK, "incorrect response code received");
String responseString = Util.getResponsePayload(response);
assertTrue(responseString.contains("success"),
"Incorrect response received. Received response: " + responseString);
assertTrue(!responseString.contains("<transaction-id>null</transaction-id>"),
"Transaction Id not present in the response. Received response: " + responseString);
} | @Test(groups = {STR}, description = STR) void function() throws Exception { SimpleHttpClient soapClient = new SimpleHttpClient(); String payload = STR + STR1\">\n" + STR1\">\n" + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR1\">\n" + STR + STR + STR + STR1\">\n" + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR1\">\n" + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR1\">\n" + STR + STR + STR + STR + STR + STR + STR + STR + STR1\">\n" + STR + STR + STR + STR + STR + STR + STR + STR; HttpResponse response = soapClient.doPost(getProxyServiceURLHttp(STR), null, payload, MEDIA_TYPE_TEXT_XML); Assert.assertEquals(response.getStatusLine().getStatusCode(), HTTP_SC_OK, STR); String responseString = Util.getResponsePayload(response); assertTrue(responseString.contains(STR), STR + responseString); assertTrue(!responseString.contains(STR), STR + responseString); } | /**
* Sends an IDoc to the SAP systems and asserts for the successful response.
*
* @throws Exception if an error occurs while sending the IDoc.
*/ | Sends an IDoc to the SAP systems and asserts for the successful response | testSendIdocUsingCallBlocking | {
"repo_name": "wso2/product-ei",
"path": "integration/mediation-tests/tests-platform/tests-sap/src/test/java/org/wso2/carbon/esb/sap/SapIdocTest.java",
"license": "apache-2.0",
"size": 7245
} | [
"org.apache.http.HttpResponse",
"org.testng.Assert",
"org.testng.annotations.Test",
"org.wso2.carbon.esb.sap.utils.Util",
"org.wso2.esb.integration.common.utils.clients.SimpleHttpClient"
] | import org.apache.http.HttpResponse; import org.testng.Assert; import org.testng.annotations.Test; import org.wso2.carbon.esb.sap.utils.Util; import org.wso2.esb.integration.common.utils.clients.SimpleHttpClient; | import org.apache.http.*; import org.testng.*; import org.testng.annotations.*; import org.wso2.carbon.esb.sap.utils.*; import org.wso2.esb.integration.common.utils.clients.*; | [
"org.apache.http",
"org.testng",
"org.testng.annotations",
"org.wso2.carbon",
"org.wso2.esb"
] | org.apache.http; org.testng; org.testng.annotations; org.wso2.carbon; org.wso2.esb; | 528,851 |
public static Iterator clipUpperDiagonalEdgeList(final Iterator it) {
return new GeneratorIterator(new Generator() {
// create current line list
LinkedList<int[]> cLine = new LinkedList<int[]>();
// next line holder
List nLine;
// initialise xMax, cLineY and nLineY to 0
// xMax and cLineY are exclusive of the currently finished edges,
// nLineY is equal to the new line number
int xMax = 0, nLineY = 0;
{
if (it.hasNext()) {
this.nLine = (List) it.next();
this.nLineY = ((Integer) this.nLine.get(0)).intValue();
} else {
this.nLine = new ArrayList(0);
this.nLineY = Integer.MAX_VALUE;
}
} | static Iterator function(final Iterator it) { return new GeneratorIterator(new Generator() { LinkedList<int[]> cLine = new LinkedList<int[]>(); List nLine; int xMax = 0, nLineY = 0; { if (it.hasNext()) { this.nLine = (List) it.next(); this.nLineY = ((Integer) this.nLine.get(0)).intValue(); } else { this.nLine = new ArrayList(0); this.nLineY = Integer.MAX_VALUE; } } | /**
* Takes an edge list (see {@link scanPolygon}) and clips the edges to
* produce the bounds of an enclosed polygon. The input edge list may
* contain edges that overlap and are disjoint. The produced list of
* diagonals will not overlap in either X or Y dimensions.
*
* @param pN
* (potentially) disjoint edge list
* @return
*/ | Takes an edge list (see <code>scanPolygon</code>) and clips the edges to produce the bounds of an enclosed polygon. The input edge list may contain edges that overlap and are disjoint. The produced list of diagonals will not overlap in either X or Y dimensions | clipUpperDiagonalEdgeList | {
"repo_name": "benedictpaten/pecan",
"path": "bp/pecan/PolygonFillerTest.java",
"license": "mit",
"size": 97178
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.LinkedList",
"java.util.List"
] | import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 203,705 |
private void runListPermissionGroups() {
try {
List<PermissionGroupInfo> pgs = mPm.getAllPermissionGroups(0);
int count = pgs.size();
for (int p = 0 ; p < count ; p++) {
PermissionGroupInfo pgi = pgs.get(p);
System.out.print("permission group:");
System.out.println(pgi.name);
}
} catch (RemoteException e) {
System.err.println(e.toString());
System.err.println(PM_NOT_RUNNING_ERR);
}
} | void function() { try { List<PermissionGroupInfo> pgs = mPm.getAllPermissionGroups(0); int count = pgs.size(); for (int p = 0 ; p < count ; p++) { PermissionGroupInfo pgi = pgs.get(p); System.out.print(STR); System.out.println(pgi.name); } } catch (RemoteException e) { System.err.println(e.toString()); System.err.println(PM_NOT_RUNNING_ERR); } } | /**
* Lists all the known permission groups.
*/ | Lists all the known permission groups | runListPermissionGroups | {
"repo_name": "ketanbj/eapps",
"path": "android/frameworks/base/cmds/pm/src/com/android/commands/pm/Pm.java",
"license": "mit",
"size": 70264
} | [
"android.content.pm.PermissionGroupInfo",
"android.os.RemoteException",
"java.util.List"
] | import android.content.pm.PermissionGroupInfo; import android.os.RemoteException; import java.util.List; | import android.content.pm.*; import android.os.*; import java.util.*; | [
"android.content",
"android.os",
"java.util"
] | android.content; android.os; java.util; | 1,034,521 |
EClass getParameter(); | EClass getParameter(); | /**
* Returns the meta object for class '{@link ca.mcgill.cs.sel.ram.Parameter <em>Parameter</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Parameter</em>'.
* @see ca.mcgill.cs.sel.ram.Parameter
* @generated
*/ | Returns the meta object for class '<code>ca.mcgill.cs.sel.ram.Parameter Parameter</code>'. | getParameter | {
"repo_name": "mjorod/textram",
"path": "tool/ca.mcgill.sel.ram/src/ca/mcgill/cs/sel/ram/RamPackage.java",
"license": "mit",
"size": 271132
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,065,291 |
public Property copy() throws IOException, URISyntaxException, ParseException {
if (factory == null) {
throw new UnsupportedOperationException("No factory specified");
}
// Deep copy parameter list..
final ParameterList params = new ParameterList(getParameters(), false);
return factory.createProperty(getName(), params, getValue());
} | Property function() throws IOException, URISyntaxException, ParseException { if (factory == null) { throw new UnsupportedOperationException(STR); } final ParameterList params = new ParameterList(getParameters(), false); return factory.createProperty(getName(), params, getValue()); } | /**
* Create a (deep) copy of this property.
* @return the copy of the property
* @throws IOException where an error occurs reading property data
* @throws URISyntaxException where the property contains an invalid URI value
* @throws ParseException where the property contains an invalid date value
*/ | Create a (deep) copy of this property | copy | {
"repo_name": "glorycloud/GloryMail",
"path": "CloudyMail/lib_src/net/fortuna/ical4j/model/Property.java",
"license": "apache-2.0",
"size": 15272
} | [
"java.io.IOException",
"java.net.URISyntaxException",
"java.text.ParseException"
] | import java.io.IOException; import java.net.URISyntaxException; import java.text.ParseException; | import java.io.*; import java.net.*; import java.text.*; | [
"java.io",
"java.net",
"java.text"
] | java.io; java.net; java.text; | 2,084,460 |
public static List<CurrencyCode> findByName(String regex)
{
if (regex == null)
{
throw new IllegalArgumentException("regex is null.");
}
// Compile the regular expression. This may throw
// java.util.regex.PatternSyntaxException.
Pattern pattern = Pattern.compile(regex);
return findByName(pattern);
} | static List<CurrencyCode> function(String regex) { if (regex == null) { throw new IllegalArgumentException(STR); } Pattern pattern = Pattern.compile(regex); return findByName(pattern); } | /**
* Get a list of {@code CurrencyCode} by a name regular expression.
*
* <p>
* This method is almost equivalent to {@link #findByName(Pattern)
* findByName}{@code (Pattern.compile(regex))}.
* </p>
*
* @param regex
* Regular expression for names.
*
* @return
* List of {@code CurrencyCode}. If nothing has matched,
* an empty list is returned.
*
* @throws IllegalArgumentException
* {@code regex} is {@code null}.
*
* @throws java.util.regex.PatternSyntaxException
* {@code regex} failed to be compiled.
*
* @since 1.11
*/ | Get a list of CurrencyCode by a name regular expression. This method is almost equivalent to <code>#findByName(Pattern) findByName</code>(Pattern.compile(regex)). | findByName | {
"repo_name": "TakahikoKawasaki/nv-i18n",
"path": "src/main/java/com/neovisionaries/i18n/CurrencyCode.java",
"license": "apache-2.0",
"size": 79951
} | [
"java.util.List",
"java.util.regex.Pattern"
] | import java.util.List; import java.util.regex.Pattern; | import java.util.*; import java.util.regex.*; | [
"java.util"
] | java.util; | 226,175 |
public DeleteRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel) {
request.consistencyLevel(consistencyLevel);
return this;
} | DeleteRequestBuilder function(WriteConsistencyLevel consistencyLevel) { request.consistencyLevel(consistencyLevel); return this; } | /**
* Sets the consistency level. Defaults to {@link org.elasticsearch.action.WriteConsistencyLevel#DEFAULT}.
*/ | Sets the consistency level. Defaults to <code>org.elasticsearch.action.WriteConsistencyLevel#DEFAULT</code> | setConsistencyLevel | {
"repo_name": "alexksikes/elasticsearch",
"path": "src/main/java/org/elasticsearch/action/delete/DeleteRequestBuilder.java",
"license": "apache-2.0",
"size": 4183
} | [
"org.elasticsearch.action.WriteConsistencyLevel"
] | import org.elasticsearch.action.WriteConsistencyLevel; | import org.elasticsearch.action.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 2,551,801 |
void setType(JSType type) {
Preconditions.checkState(isTypeInferred());
this.type = type;
} | void setType(JSType type) { Preconditions.checkState(isTypeInferred()); this.type = type; } | /**
* Sets this variable's type.
* @throws IllegalStateException if the variable's type is not inferred
*/ | Sets this variable's type | setType | {
"repo_name": "weitzj/closure-compiler",
"path": "src/com/google/javascript/jscomp/Scope.java",
"license": "apache-2.0",
"size": 16113
} | [
"com.google.common.base.Preconditions",
"com.google.javascript.rhino.jstype.JSType"
] | import com.google.common.base.Preconditions; import com.google.javascript.rhino.jstype.JSType; | import com.google.common.base.*; import com.google.javascript.rhino.jstype.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 1,568,660 |
public DayPartitionBuilder addExclusion(Collection<PlainDate> dates) {
dates.stream().forEach(this::addExclusion);
return this;
} | DayPartitionBuilder function(Collection<PlainDate> dates) { dates.stream().forEach(this::addExclusion); return this; } | /**
* <p>Adds multiple exclusion dates. </p>
*
* @param dates collection of calendar dates to be excluded from creating day partitions
* @return this instance for method chaining
* @see DayPartitionRule#isExcluded(PlainDate)
* @see #addExclusion(PlainDate)
*/ | Adds multiple exclusion dates. | addExclusion | {
"repo_name": "MenoData/Time4J",
"path": "base/src/main/java/net/time4j/range/DayPartitionBuilder.java",
"license": "lgpl-2.1",
"size": 18211
} | [
"java.util.Collection",
"net.time4j.PlainDate"
] | import java.util.Collection; import net.time4j.PlainDate; | import java.util.*; import net.time4j.*; | [
"java.util",
"net.time4j"
] | java.util; net.time4j; | 299,886 |
@Override
MappableBlock load(long length, FileInputStream blockIn,
FileInputStream metaIn, String blockFileName, ExtendedBlockId key)
throws IOException {
PmemMappedBlock mappableBlock = null;
String cachePath = null;
FileChannel blockChannel = null;
RandomAccessFile cacheFile = null;
try {
blockChannel = blockIn.getChannel();
if (blockChannel == null) {
throw new IOException("Block InputStream has no FileChannel.");
}
cachePath = pmemVolumeManager.getCachePath(key);
cacheFile = new RandomAccessFile(cachePath, "rw");
blockChannel.transferTo(0, length, cacheFile.getChannel());
// Verify checksum for the cached data instead of block file.
// The file channel should be repositioned.
cacheFile.getChannel().position(0);
verifyChecksum(length, metaIn, cacheFile.getChannel(), blockFileName);
mappableBlock = new PmemMappedBlock(length, key);
LOG.info("Successfully cached one replica:{} into persistent memory"
+ ", [cached path={}, length={}]", key, cachePath, length);
} finally {
IOUtils.closeQuietly(blockChannel);
IOUtils.closeQuietly(cacheFile);
if (mappableBlock == null) {
LOG.debug("Delete {} due to unsuccessful mapping.", cachePath);
FsDatasetUtil.deleteMappedFile(cachePath);
}
}
return mappableBlock;
} | MappableBlock load(long length, FileInputStream blockIn, FileInputStream metaIn, String blockFileName, ExtendedBlockId key) throws IOException { PmemMappedBlock mappableBlock = null; String cachePath = null; FileChannel blockChannel = null; RandomAccessFile cacheFile = null; try { blockChannel = blockIn.getChannel(); if (blockChannel == null) { throw new IOException(STR); } cachePath = pmemVolumeManager.getCachePath(key); cacheFile = new RandomAccessFile(cachePath, "rw"); blockChannel.transferTo(0, length, cacheFile.getChannel()); cacheFile.getChannel().position(0); verifyChecksum(length, metaIn, cacheFile.getChannel(), blockFileName); mappableBlock = new PmemMappedBlock(length, key); LOG.info(STR + STR, key, cachePath, length); } finally { IOUtils.closeQuietly(blockChannel); IOUtils.closeQuietly(cacheFile); if (mappableBlock == null) { LOG.debug(STR, cachePath); FsDatasetUtil.deleteMappedFile(cachePath); } } return mappableBlock; } | /**
* Load the block.
*
* Map the block and verify its checksum.
*
* The block will be mapped to PmemDir/BlockPoolId/subdir#/subdir#/BlockId,
* in which PmemDir is a persistent memory volume chosen by PmemVolumeManager.
*
* @param length The current length of the block.
* @param blockIn The block input stream. Should be positioned at the
* start. The caller must close this.
* @param metaIn The meta file input stream. Should be positioned at
* the start. The caller must close this.
* @param blockFileName The block file name, for logging purposes.
* @param key The extended block ID.
*
* @throws IOException If mapping block fails or checksum fails.
*
* @return The Mappable block.
*/ | Load the block. Map the block and verify its checksum. The block will be mapped to PmemDir/BlockPoolId/subdir#/subdir#/BlockId, in which PmemDir is a persistent memory volume chosen by PmemVolumeManager | load | {
"repo_name": "plusplusjiajia/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/PmemMappableBlockLoader.java",
"license": "apache-2.0",
"size": 6252
} | [
"java.io.FileInputStream",
"java.io.IOException",
"java.io.RandomAccessFile",
"java.nio.channels.FileChannel",
"org.apache.commons.io.IOUtils",
"org.apache.hadoop.hdfs.ExtendedBlockId"
] | import java.io.FileInputStream; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import org.apache.commons.io.IOUtils; import org.apache.hadoop.hdfs.ExtendedBlockId; | import java.io.*; import java.nio.channels.*; import org.apache.commons.io.*; import org.apache.hadoop.hdfs.*; | [
"java.io",
"java.nio",
"org.apache.commons",
"org.apache.hadoop"
] | java.io; java.nio; org.apache.commons; org.apache.hadoop; | 2,601,773 |
public void testMultilineInlineTag2() {
setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "20"); //$NON-NLS-1$
final String prefix= PREFIX + DELIMITER + INFIX + "{@link Objecterr}s";
final String postfix= "are cool." + DELIMITER + POSTFIX;
String input= prefix + " " + postfix; //$NON-NLS-1$
String expected= prefix + DELIMITER + INFIX + postfix;
String result= testFormat(input);
assertEquals(expected, result);
}
| void function() { setUserOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, "20"); final String prefix= PREFIX + DELIMITER + INFIX + STR; final String postfix= STR + DELIMITER + POSTFIX; String input= prefix + " " + postfix; String expected= prefix + DELIMITER + INFIX + postfix; String result= testFormat(input); assertEquals(expected, result); } | /**
* [formatting] Javadoc Formatter mishandles spaces in comments
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=49686
*/ | [formatting] Javadoc Formatter mishandles spaces in comments HREF | testMultilineInlineTag2 | {
"repo_name": "echoes-tech/eclipse.jsdt.core",
"path": "org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/JavaDocTestCase.java",
"license": "epl-1.0",
"size": 32688
} | [
"org.eclipse.wst.jsdt.core.formatter.DefaultCodeFormatterConstants"
] | import org.eclipse.wst.jsdt.core.formatter.DefaultCodeFormatterConstants; | import org.eclipse.wst.jsdt.core.formatter.*; | [
"org.eclipse.wst"
] | org.eclipse.wst; | 2,441,230 |
private void loadConcepts(BufferedReader reader) throws Exception {
// Setup vars
String line;
objectCt = 0;
int objectsAdded = 0;
int objectsUpdated = 0;
// Iterate through concept reader
while ((line = reader.readLine()) != null) {
// Split line
String fields[] = line.split("\t");
// if not header
if (!fields[0].equals("id")) {
// Check if concept exists from before
Concept concept = existingConceptCache.get(fields[0]);
// Track all delta concept ids so we can properly remove concepts later.
deltaConceptIds.add(fields[0]);
recomputePnConceptIds.add(fields[0]);
// Setup delta concept (either new or based on existing one)
Concept newConcept = null;
if (concept == null) {
newConcept = new ConceptJpa();
} else {
newConcept = new ConceptJpa(concept, true);
}
// Set fields
newConcept.setTerminologyId(fields[0]);
newConcept.setEffectiveTime(deltaLoaderStartDate);
newConcept.setActive(fields[2].equals("1") ? true : false);
newConcept.setModuleId(Long.valueOf(fields[3]));
newConcept.setDefinitionStatusId(Long.valueOf(fields[4]));
newConcept.setTerminology(terminology);
newConcept.setTerminologyVersion(version);
newConcept.setDefaultPreferredName("TBD");
// If concept is new, add it
if (concept == null) {
getLog().info(" add concept " + newConcept.getTerminologyId());
contentService.addConcept(newConcept);
objectsAdded++;
}
// If concept has changed, update it
else if (!newConcept.equals(concept)) {
getLog().info(
" update concept " + newConcept.getTerminologyId());
contentService.updateConcept(newConcept);
objectsUpdated++;
}
// Otherwise, reset effective time (for modified check later)
else {
newConcept.setEffectiveTime(concept.getEffectiveTime());
}
// Cache the concept element
cacheConcept(newConcept);
}
}
getLog().info(" new = " + objectsAdded);
getLog().info(" updated = " + objectsUpdated);
} | void function(BufferedReader reader) throws Exception { String line; objectCt = 0; int objectsAdded = 0; int objectsUpdated = 0; while ((line = reader.readLine()) != null) { String fields[] = line.split("\t"); if (!fields[0].equals("id")) { Concept concept = existingConceptCache.get(fields[0]); deltaConceptIds.add(fields[0]); recomputePnConceptIds.add(fields[0]); Concept newConcept = null; if (concept == null) { newConcept = new ConceptJpa(); } else { newConcept = new ConceptJpa(concept, true); } newConcept.setTerminologyId(fields[0]); newConcept.setEffectiveTime(deltaLoaderStartDate); newConcept.setActive(fields[2].equals("1") ? true : false); newConcept.setModuleId(Long.valueOf(fields[3])); newConcept.setDefinitionStatusId(Long.valueOf(fields[4])); newConcept.setTerminology(terminology); newConcept.setTerminologyVersion(version); newConcept.setDefaultPreferredName("TBD"); if (concept == null) { getLog().info(STR + newConcept.getTerminologyId()); contentService.addConcept(newConcept); objectsAdded++; } else if (!newConcept.equals(concept)) { getLog().info( STR + newConcept.getTerminologyId()); contentService.updateConcept(newConcept); objectsUpdated++; } else { newConcept.setEffectiveTime(concept.getEffectiveTime()); } cacheConcept(newConcept); } } getLog().info(STR + objectsAdded); getLog().info(STR + objectsUpdated); } | /**
* Loads the concepts from the delta files.
*
* @param reader the reader
* @throws Exception the exception
*/ | Loads the concepts from the delta files | loadConcepts | {
"repo_name": "WestCoastInformatics/OTF-Mapping-Service",
"path": "admin/mojo/src/main/java/org/ihtsdo/otf/mapping/mojo/TerminologyRf2DeltaLoader.java",
"license": "apache-2.0",
"size": 43984
} | [
"java.io.BufferedReader",
"org.ihtsdo.otf.mapping.rf2.Concept",
"org.ihtsdo.otf.mapping.rf2.jpa.ConceptJpa"
] | import java.io.BufferedReader; import org.ihtsdo.otf.mapping.rf2.Concept; import org.ihtsdo.otf.mapping.rf2.jpa.ConceptJpa; | import java.io.*; import org.ihtsdo.otf.mapping.rf2.*; import org.ihtsdo.otf.mapping.rf2.jpa.*; | [
"java.io",
"org.ihtsdo.otf"
] | java.io; org.ihtsdo.otf; | 771,824 |
private void addLocalScopes(APIIdentifier apiIdentifier, int tenantId, Set<URITemplate> uriTemplates)
throws APIManagementException {
String tenantDomain = APIUtil.getTenantDomainFromTenantId(tenantId);
Map<String, KeyManagerDto> tenantKeyManagers = KeyManagerHolder.getTenantKeyManagers(tenantDomain);
//Get the local scopes set to register for the API from URI templates
Set<Scope> scopesToRegister = getScopesToRegisterFromURITemplates(apiIdentifier, tenantId, uriTemplates);
//Register scopes
for (Scope scope : scopesToRegister) {
for (Map.Entry<String, KeyManagerDto> keyManagerDtoEntry : tenantKeyManagers.entrySet()) {
KeyManager keyManager = keyManagerDtoEntry.getValue().getKeyManager();
if (keyManager != null) {
String scopeKey = scope.getKey();
try {
// Check if key already registered in KM. Scope Key may be already registered for a different
// version.
if (!keyManager.isScopeExists(scopeKey)) {
//register scope in KM
keyManager.registerScope(scope);
} else {
if (log.isDebugEnabled()) {
log.debug("Scope: " + scopeKey +
" already registered in KM. Skipping registering scope.");
}
}
} catch (APIManagementException e) {
log.error("Error while registering Scope " + scopeKey + "in Key Manager " +
keyManagerDtoEntry.getKey(), e);
}
}
}
}
addScopes(scopesToRegister, tenantId);
} | void function(APIIdentifier apiIdentifier, int tenantId, Set<URITemplate> uriTemplates) throws APIManagementException { String tenantDomain = APIUtil.getTenantDomainFromTenantId(tenantId); Map<String, KeyManagerDto> tenantKeyManagers = KeyManagerHolder.getTenantKeyManagers(tenantDomain); Set<Scope> scopesToRegister = getScopesToRegisterFromURITemplates(apiIdentifier, tenantId, uriTemplates); for (Scope scope : scopesToRegister) { for (Map.Entry<String, KeyManagerDto> keyManagerDtoEntry : tenantKeyManagers.entrySet()) { KeyManager keyManager = keyManagerDtoEntry.getValue().getKeyManager(); if (keyManager != null) { String scopeKey = scope.getKey(); try { if (!keyManager.isScopeExists(scopeKey)) { keyManager.registerScope(scope); } else { if (log.isDebugEnabled()) { log.debug(STR + scopeKey + STR); } } } catch (APIManagementException e) { log.error(STR + scopeKey + STR + keyManagerDtoEntry.getKey(), e); } } } } addScopes(scopesToRegister, tenantId); } | /**
* Add local scopes for the API if the scopes does not exist as shared scopes. The local scopes to add will be
* take from the URI templates.
*
* @param apiIdentifier API Identifier
* @param uriTemplates URI Templates
* @param tenantId Tenant Id
* @throws APIManagementException if fails to add local scopes for the API
*/ | Add local scopes for the API if the scopes does not exist as shared scopes. The local scopes to add will be take from the URI templates | addLocalScopes | {
"repo_name": "tharikaGitHub/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIProviderImpl.java",
"license": "apache-2.0",
"size": 497958
} | [
"java.util.Map",
"java.util.Set",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.api.model.APIIdentifier",
"org.wso2.carbon.apimgt.api.model.KeyManager",
"org.wso2.carbon.apimgt.api.model.Scope",
"org.wso2.carbon.apimgt.api.model.URITemplate",
"org.wso2.carbon.apimgt.impl.dto.KeyManagerDto",
"org.wso2.carbon.apimgt.impl.factory.KeyManagerHolder",
"org.wso2.carbon.apimgt.impl.utils.APIUtil"
] | import java.util.Map; import java.util.Set; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.APIIdentifier; import org.wso2.carbon.apimgt.api.model.KeyManager; import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.apimgt.api.model.URITemplate; import org.wso2.carbon.apimgt.impl.dto.KeyManagerDto; import org.wso2.carbon.apimgt.impl.factory.KeyManagerHolder; import org.wso2.carbon.apimgt.impl.utils.APIUtil; | import java.util.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.dto.*; import org.wso2.carbon.apimgt.impl.factory.*; import org.wso2.carbon.apimgt.impl.utils.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 2,403,331 |
public ClientMessage sendMessageWithProperties(String address, String body, Map<String, Object> properties) {
return sendMessageWithProperties(SimpleString.toSimpleString(address), body, properties);
} | ClientMessage function(String address, String body, Map<String, Object> properties) { return sendMessageWithProperties(SimpleString.toSimpleString(address), body, properties); } | /**
* Create a new message with the specified body and properties, and send the message to an address
*
* @param address the target queueName for the message
* @param body the body for the new message
* @param properties message properties for the new message
* @return the message that was sent
*/ | Create a new message with the specified body and properties, and send the message to an address | sendMessageWithProperties | {
"repo_name": "cshannon/activemq-artemis",
"path": "artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java",
"license": "apache-2.0",
"size": 31805
} | [
"java.util.Map",
"org.apache.activemq.artemis.api.core.SimpleString",
"org.apache.activemq.artemis.api.core.client.ClientMessage"
] | import java.util.Map; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientMessage; | import java.util.*; import org.apache.activemq.artemis.api.core.*; import org.apache.activemq.artemis.api.core.client.*; | [
"java.util",
"org.apache.activemq"
] | java.util; org.apache.activemq; | 2,709,729 |
public static String getHostName() {
String hostName = ServerConfiguration.getInstance().getFirstProperty(IdentityCoreConstants.HOST_NAME);
if (hostName == null) {
try {
hostName = NetworkUtils.getLocalHostname();
} catch (SocketException e) {
throw IdentityRuntimeException.error("Error while trying to read hostname.", e);
}
}
return hostName;
} | static String function() { String hostName = ServerConfiguration.getInstance().getFirstProperty(IdentityCoreConstants.HOST_NAME); if (hostName == null) { try { hostName = NetworkUtils.getLocalHostname(); } catch (SocketException e) { throw IdentityRuntimeException.error(STR, e); } } return hostName; } | /**
* Get the host name of the server.
*
* @return Hostname
*/ | Get the host name of the server | getHostName | {
"repo_name": "wso2/carbon-identity-framework",
"path": "components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityUtil.java",
"license": "apache-2.0",
"size": 73793
} | [
"java.net.SocketException",
"org.wso2.carbon.base.ServerConfiguration",
"org.wso2.carbon.identity.base.IdentityRuntimeException",
"org.wso2.carbon.utils.NetworkUtils"
] | import java.net.SocketException; import org.wso2.carbon.base.ServerConfiguration; import org.wso2.carbon.identity.base.IdentityRuntimeException; import org.wso2.carbon.utils.NetworkUtils; | import java.net.*; import org.wso2.carbon.base.*; import org.wso2.carbon.identity.base.*; import org.wso2.carbon.utils.*; | [
"java.net",
"org.wso2.carbon"
] | java.net; org.wso2.carbon; | 90,474 |
@GET
@Produces(APPLICATION_JSON)
@Timed
@ExceptionMetered
public List<String> list(@QueryParam("namePattern") final String namePattern,
@QueryParam("selector") final List<String> hostSelectors) {
List<String> hosts = namePattern == null ? model.listHosts() : model.listHosts(namePattern);
if (!hostSelectors.isEmpty()) {
// check that all supplied selectors are parseable/valid
final List<HostSelector> selectors = hostSelectors.stream()
.map(selectorStr -> {
final HostSelector parsed = HostSelector.parse(selectorStr);
if (parsed == null) {
throw new WebApplicationException(
Response.status(Response.Status.BAD_REQUEST)
.entity("Invalid host selector: " + selectorStr)
.build()
);
}
return parsed;
})
.collect(Collectors.toList());
final Map<String, Map<String, String>> hostsAndLabels = getLabels(hosts);
final HostMatcher matcher = new HostMatcher(hostsAndLabels);
hosts = matcher.getMatchingHosts(selectors);
}
return hosts;
} | @Produces(APPLICATION_JSON) List<String> function(@QueryParam(STR) final String namePattern, @QueryParam(STR) final List<String> hostSelectors) { List<String> hosts = namePattern == null ? model.listHosts() : model.listHosts(namePattern); if (!hostSelectors.isEmpty()) { final List<HostSelector> selectors = hostSelectors.stream() .map(selectorStr -> { final HostSelector parsed = HostSelector.parse(selectorStr); if (parsed == null) { throw new WebApplicationException( Response.status(Response.Status.BAD_REQUEST) .entity(STR + selectorStr) .build() ); } return parsed; }) .collect(Collectors.toList()); final Map<String, Map<String, String>> hostsAndLabels = getLabels(hosts); final HostMatcher matcher = new HostMatcher(hostsAndLabels); hosts = matcher.getMatchingHosts(selectors); } return hosts; } | /**
* Returns the list of hostnames of known hosts/agents.
* @return The list of hostnames.
*/ | Returns the list of hostnames of known hosts/agents | list | {
"repo_name": "mavenraven/helios",
"path": "helios-services/src/main/java/com/spotify/helios/master/resources/HostsResource.java",
"license": "apache-2.0",
"size": 13869
} | [
"com.spotify.helios.common.descriptors.HostSelector",
"com.spotify.helios.master.HostMatcher",
"java.util.List",
"java.util.Map",
"java.util.stream.Collectors",
"javax.ws.rs.Produces",
"javax.ws.rs.QueryParam",
"javax.ws.rs.WebApplicationException",
"javax.ws.rs.core.Response"
] | import com.spotify.helios.common.descriptors.HostSelector; import com.spotify.helios.master.HostMatcher; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; | import com.spotify.helios.common.descriptors.*; import com.spotify.helios.master.*; import java.util.*; import java.util.stream.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"com.spotify.helios",
"java.util",
"javax.ws"
] | com.spotify.helios; java.util; javax.ws; | 1,117,929 |
private static boolean isForLoopVariable(DetailAST variableDef) {
final int parentType = variableDef.getParent().getType();
return parentType == TokenTypes.FOR_INIT
|| parentType == TokenTypes.FOR_EACH_CLAUSE;
} | static boolean function(DetailAST variableDef) { final int parentType = variableDef.getParent().getType(); return parentType == TokenTypes.FOR_INIT parentType == TokenTypes.FOR_EACH_CLAUSE; } | /**
* Checks if a variable is the loop's one.
* @param variableDef variable definition.
* @return true if a variable is the loop's one.
*/ | Checks if a variable is the loop's one | isForLoopVariable | {
"repo_name": "another-dave/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.java",
"license": "lgpl-2.1",
"size": 4540
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST",
"com.puppycrawl.tools.checkstyle.api.TokenTypes"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; | import com.puppycrawl.tools.checkstyle.api.*; | [
"com.puppycrawl.tools"
] | com.puppycrawl.tools; | 1,770,534 |
protected void setupObjectList() {
objectList.add(new ByteArraySizeTerminated(DataTypes.OBJ_DATA, this));
}
| void function() { objectList.add(new ByteArraySizeTerminated(DataTypes.OBJ_DATA, this)); } | /**
* Setup the Object List. A byte Array which will be read upto frame size
* bytes.
*/ | Setup the Object List. A byte Array which will be read upto frame size bytes | setupObjectList | {
"repo_name": "jacky8hyf/musique",
"path": "dependencies/jaudiotagger/src/main/java/org/jaudiotagger/tag/id3/framebody/FrameBodyRVAD.java",
"license": "lgpl-3.0",
"size": 2724
} | [
"org.jaudiotagger.tag.datatype.ByteArraySizeTerminated",
"org.jaudiotagger.tag.datatype.DataTypes"
] | import org.jaudiotagger.tag.datatype.ByteArraySizeTerminated; import org.jaudiotagger.tag.datatype.DataTypes; | import org.jaudiotagger.tag.datatype.*; | [
"org.jaudiotagger.tag"
] | org.jaudiotagger.tag; | 643,150 |
EReference getSprite_Sheet(); | EReference getSprite_Sheet(); | /**
* Returns the meta object for the reference '{@link fr.obeo.dsl.game.Sprite#getSheet <em>Sheet</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Sheet</em>'.
* @see fr.obeo.dsl.game.Sprite#getSheet()
* @see #getSprite()
* @generated
*/ | Returns the meta object for the reference '<code>fr.obeo.dsl.game.Sprite#getSheet Sheet</code>'. | getSprite_Sheet | {
"repo_name": "Obeo/Game-Designer",
"path": "plugins/fr.obeo.dsl.game/src-gen/fr/obeo/dsl/game/GamePackage.java",
"license": "epl-1.0",
"size": 149639
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,371,672 |
public static void insert(Any any, Any[] those)
{
org.omg.CORBA.AnySeqHelper.insert(any, those);
} | static void function(Any any, Any[] those) { org.omg.CORBA.AnySeqHelper.insert(any, those); } | /**
* Delegates call to {@link org.omg.CORBA.AnySeqHelper#insert}.
*/ | Delegates call to <code>org.omg.CORBA.AnySeqHelper#insert</code> | insert | {
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/org/omg/DynamicAny/AnySeqHelper.java",
"license": "bsd-3-clause",
"size": 3682
} | [
"org.omg.CORBA"
] | import org.omg.CORBA; | import org.omg.*; | [
"org.omg"
] | org.omg; | 1,592,101 |
public void messageReceived( OSCMessage msg, SocketAddress sender, long time ); | void function( OSCMessage msg, SocketAddress sender, long time ); | /**
* Called when a new OSC message
* arrived at the receiving local socket.
*
* @param msg the newly arrived and decoded message
* @param sender who sent the message
* @param time the time tag as returned by <code>OSCBundle.getTimeTag()</code>
* ; or <code>OSCBundle.NOW</code> if no time tag was specified
* or the message is expected to be processed immediately
*/ | Called when a new OSC message arrived at the receiving local socket | messageReceived | {
"repo_name": "wolkstein/ardroid-export",
"path": "app/src/main/java/main/java/de/sciss/net/OSCListener.java",
"license": "gpl-2.0",
"size": 2752
} | [
"java.net.SocketAddress"
] | import java.net.SocketAddress; | import java.net.*; | [
"java.net"
] | java.net; | 943,261 |
@Test
public void customDevPropSpecWithInvalidTypeKey() {
String customDevPropSpec = "{typ=disk;prop={bootable=^(true|false)$}}";
DevicePropertiesUtils utils = DevicePropertiesUtils.getInstance();
assertFalse(utils.isDevicePropertiesDefinitionValid(customDevPropSpec));
} | void function() { String customDevPropSpec = STR; DevicePropertiesUtils utils = DevicePropertiesUtils.getInstance(); assertFalse(utils.isDevicePropertiesDefinitionValid(customDevPropSpec)); } | /**
* Tries to validate custom device properties specification with invalid type key
*/ | Tries to validate custom device properties specification with invalid type key | customDevPropSpecWithInvalidTypeKey | {
"repo_name": "jtux270/translate",
"path": "ovirt/backend/manager/modules/utils/src/test/java/org/ovirt/engine/core/utils/customprop/DevicePropertiesUtilsTest.java",
"license": "gpl-3.0",
"size": 16683
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,865,869 |
final String shortName = null;
final String description = null;
final CurrencyData currency = null;
final BigDecimal principal = null;
final BigDecimal minPrincipal = null;
final BigDecimal maxPrincipal = null;
final BigDecimal tolerance = null;
final Integer numberOfRepayments = null;
final Integer minNumberOfRepayments = null;
final Integer maxNumberOfRepayments = null;
final Integer repaymentEvery = null;
final BigDecimal interestRatePerPeriod = null;
final BigDecimal minInterestRatePerPeriod = null;
final BigDecimal maxInterestRatePerPeriod = null;
final BigDecimal annualInterestRate = null;
final boolean isLinkedToFloatingInterestRates = false;
final Integer floatingRateId = null;
final String floatingRateName = null;
final BigDecimal interestRateDifferential = null;
final BigDecimal minDifferentialLendingRate = null;
final BigDecimal defaultDifferentialLendingRate = null;
final BigDecimal maxDifferentialLendingRate = null;
final boolean isFloatingInterestRateCalculationAllowed = false;
final boolean isVariableInstallmentsAllowed = false;
final Integer minimumGap = null;
final Integer maximumGap = null;
final EnumOptionData repaymentFrequencyType = null;
final EnumOptionData interestRateFrequencyType = null;
final EnumOptionData amortizationType = null;
final EnumOptionData interestType = null;
final EnumOptionData interestCalculationPeriodType = null;
final Boolean allowPartialPeriodInterestCalcualtion = null;
final Long fundId = null;
final String fundName = null;
final Long transactionProcessingStrategyId = null;
final String transactionProcessingStrategyName = null;
final Integer graceOnPrincipalPayment = null;
final Integer recurringMoratoriumOnPrincipalPeriods = null;
final Integer graceOnInterestPayment = null;
final Integer graceOnInterestCharged = null;
final Integer graceOnArrearsAgeing = null;
final Integer overdueDaysForNPA = null;
final Collection<ChargeData> charges = null;
final Collection<LoanProductBorrowerCycleVariationData> principalVariations = new ArrayList<>(1);
final Collection<LoanProductBorrowerCycleVariationData> interestRateVariations = new ArrayList<>(1);
final Collection<LoanProductBorrowerCycleVariationData> numberOfRepaymentVariations = new ArrayList<>(1);
final EnumOptionData accountingType = null;
final boolean includeInBorrowerCycle = false;
final boolean useBorrowerCycle = false;
final LocalDate startDate = null;
final LocalDate closeDate = null;
final String status = null;
final String externalId = null;
final Boolean multiDisburseLoan = null;
final Integer maxTrancheCount = null;
final BigDecimal outstandingLoanBalance = null;
final LoanProductGuaranteeData productGuaranteeData = null;
final Boolean holdGuaranteeFunds = false;
final BigDecimal principalThresholdForLastInstallment = null;
final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion = false;
final EnumOptionData daysInMonthType = null;
final EnumOptionData daysInYearType = null;
final boolean isInterestRecalculationEnabled = false;
final LoanProductInterestRecalculationData interestRecalculationData = null;
final Integer minimumDaysBetweenDisbursalAndFirstRepayment = null;
final boolean canDefineInstallmentAmount = false;
final Integer installmentAmountInMultiplesOf = null;
final LoanProductConfigurableAttributes loanProductConfigurableAttributes = null;
final boolean syncExpectedWithDisbursementDate = false;
final boolean canUseForTopup = false;
return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType, interestRateFrequencyType,
amortizationType, interestType, interestCalculationPeriodType, allowPartialPeriodInterestCalcualtion, fundId, fundName,
transactionProcessingStrategyId, transactionProcessingStrategyName, graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment,
graceOnInterestCharged, charges, accountingType, includeInBorrowerCycle, useBorrowerCycle, startDate, closeDate, status,
externalId, principalVariations, interestRateVariations, numberOfRepaymentVariations, multiDisburseLoan, maxTrancheCount,
outstandingLoanBalance, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType,
isInterestRecalculationEnabled, interestRecalculationData, minimumDaysBetweenDisbursalAndFirstRepayment,
holdGuaranteeFunds, productGuaranteeData, principalThresholdForLastInstallment,
accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf,
loanProductConfigurableAttributes, isLinkedToFloatingInterestRates, floatingRateId, floatingRateName,
interestRateDifferential, minDifferentialLendingRate, defaultDifferentialLendingRate, maxDifferentialLendingRate,
isFloatingInterestRateCalculationAllowed, isVariableInstallmentsAllowed, minimumGap, maximumGap,
syncExpectedWithDisbursementDate, canUseForTopup);
} | final String shortName = null; final String description = null; final CurrencyData currency = null; final BigDecimal principal = null; final BigDecimal minPrincipal = null; final BigDecimal maxPrincipal = null; final BigDecimal tolerance = null; final Integer numberOfRepayments = null; final Integer minNumberOfRepayments = null; final Integer maxNumberOfRepayments = null; final Integer repaymentEvery = null; final BigDecimal interestRatePerPeriod = null; final BigDecimal minInterestRatePerPeriod = null; final BigDecimal maxInterestRatePerPeriod = null; final BigDecimal annualInterestRate = null; final boolean isLinkedToFloatingInterestRates = false; final Integer floatingRateId = null; final String floatingRateName = null; final BigDecimal interestRateDifferential = null; final BigDecimal minDifferentialLendingRate = null; final BigDecimal defaultDifferentialLendingRate = null; final BigDecimal maxDifferentialLendingRate = null; final boolean isFloatingInterestRateCalculationAllowed = false; final boolean isVariableInstallmentsAllowed = false; final Integer minimumGap = null; final Integer maximumGap = null; final EnumOptionData repaymentFrequencyType = null; final EnumOptionData interestRateFrequencyType = null; final EnumOptionData amortizationType = null; final EnumOptionData interestType = null; final EnumOptionData interestCalculationPeriodType = null; final Boolean allowPartialPeriodInterestCalcualtion = null; final Long fundId = null; final String fundName = null; final Long transactionProcessingStrategyId = null; final String transactionProcessingStrategyName = null; final Integer graceOnPrincipalPayment = null; final Integer recurringMoratoriumOnPrincipalPeriods = null; final Integer graceOnInterestPayment = null; final Integer graceOnInterestCharged = null; final Integer graceOnArrearsAgeing = null; final Integer overdueDaysForNPA = null; final Collection<ChargeData> charges = null; final Collection<LoanProductBorrowerCycleVariationData> principalVariations = new ArrayList<>(1); final Collection<LoanProductBorrowerCycleVariationData> interestRateVariations = new ArrayList<>(1); final Collection<LoanProductBorrowerCycleVariationData> numberOfRepaymentVariations = new ArrayList<>(1); final EnumOptionData accountingType = null; final boolean includeInBorrowerCycle = false; final boolean useBorrowerCycle = false; final LocalDate startDate = null; final LocalDate closeDate = null; final String status = null; final String externalId = null; final Boolean multiDisburseLoan = null; final Integer maxTrancheCount = null; final BigDecimal outstandingLoanBalance = null; final LoanProductGuaranteeData productGuaranteeData = null; final Boolean holdGuaranteeFunds = false; final BigDecimal principalThresholdForLastInstallment = null; final boolean accountMovesOutOfNPAOnlyOnArrearsCompletion = false; final EnumOptionData daysInMonthType = null; final EnumOptionData daysInYearType = null; final boolean isInterestRecalculationEnabled = false; final LoanProductInterestRecalculationData interestRecalculationData = null; final Integer minimumDaysBetweenDisbursalAndFirstRepayment = null; final boolean canDefineInstallmentAmount = false; final Integer installmentAmountInMultiplesOf = null; final LoanProductConfigurableAttributes loanProductConfigurableAttributes = null; final boolean syncExpectedWithDisbursementDate = false; final boolean canUseForTopup = false; return new LoanProductData(id, name, shortName, description, currency, principal, minPrincipal, maxPrincipal, tolerance, numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod, minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, allowPartialPeriodInterestCalcualtion, fundId, fundName, transactionProcessingStrategyId, transactionProcessingStrategyName, graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged, charges, accountingType, includeInBorrowerCycle, useBorrowerCycle, startDate, closeDate, status, externalId, principalVariations, interestRateVariations, numberOfRepaymentVariations, multiDisburseLoan, maxTrancheCount, outstandingLoanBalance, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType, daysInYearType, isInterestRecalculationEnabled, interestRecalculationData, minimumDaysBetweenDisbursalAndFirstRepayment, holdGuaranteeFunds, productGuaranteeData, principalThresholdForLastInstallment, accountMovesOutOfNPAOnlyOnArrearsCompletion, canDefineInstallmentAmount, installmentAmountInMultiplesOf, loanProductConfigurableAttributes, isLinkedToFloatingInterestRates, floatingRateId, floatingRateName, interestRateDifferential, minDifferentialLendingRate, defaultDifferentialLendingRate, maxDifferentialLendingRate, isFloatingInterestRateCalculationAllowed, isVariableInstallmentsAllowed, minimumGap, maximumGap, syncExpectedWithDisbursementDate, canUseForTopup); } | /**
* Used when returning lookup information about loan product for dropdowns.
*/ | Used when returning lookup information about loan product for dropdowns | lookup | {
"repo_name": "Vishwa1311/incubator-fineract",
"path": "fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java",
"license": "apache-2.0",
"size": 64930
} | [
"java.math.BigDecimal",
"java.util.ArrayList",
"java.util.Collection",
"org.apache.fineract.infrastructure.core.data.EnumOptionData",
"org.apache.fineract.organisation.monetary.data.CurrencyData",
"org.apache.fineract.portfolio.charge.data.ChargeData",
"org.apache.fineract.portfolio.loanproduct.domain.LoanProductConfigurableAttributes",
"org.joda.time.LocalDate"
] | import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; import org.apache.fineract.infrastructure.core.data.EnumOptionData; import org.apache.fineract.organisation.monetary.data.CurrencyData; import org.apache.fineract.portfolio.charge.data.ChargeData; import org.apache.fineract.portfolio.loanproduct.domain.LoanProductConfigurableAttributes; import org.joda.time.LocalDate; | import java.math.*; import java.util.*; import org.apache.fineract.infrastructure.core.data.*; import org.apache.fineract.organisation.monetary.data.*; import org.apache.fineract.portfolio.charge.data.*; import org.apache.fineract.portfolio.loanproduct.domain.*; import org.joda.time.*; | [
"java.math",
"java.util",
"org.apache.fineract",
"org.joda.time"
] | java.math; java.util; org.apache.fineract; org.joda.time; | 2,630,168 |
public void testReplaceValue3_NullPointerException() {
ConcurrentHashMap c = new ConcurrentHashMap(5);
try {
c.replace("whatever", one, null);
shouldThrow();
} catch (NullPointerException success) {}
} | void function() { ConcurrentHashMap c = new ConcurrentHashMap(5); try { c.replace(STR, one, null); shouldThrow(); } catch (NullPointerException success) {} } | /**
* replace(x, y, null) throws NPE
*/ | replace(x, y, null) throws NPE | testReplaceValue3_NullPointerException | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/jdk/test/java/util/concurrent/tck/ConcurrentHashMapTest.java",
"license": "gpl-2.0",
"size": 27002
} | [
"java.util.concurrent.ConcurrentHashMap"
] | import java.util.concurrent.ConcurrentHashMap; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 240,501 |
public void expand(T... items) {
expand(Arrays.asList(items));
} | void function(T... items) { expand(Arrays.asList(items)); } | /**
* Expands the given items.
* <p>
* If an item is currently expanded, does nothing. If an item does not have
* any children, does nothing.
*
* @param items
* the items to expand
*/ | Expands the given items. If an item is currently expanded, does nothing. If an item does not have any children, does nothing | expand | {
"repo_name": "Darsstar/framework",
"path": "server/src/main/java/com/vaadin/ui/TreeGrid.java",
"license": "apache-2.0",
"size": 18863
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 180,466 |
@Override
public CmsRfcCI getCiById(long ciId, String cmAttrValue) {
return cmRfcMrgProcessor.getCiById(ciId, cmAttrValue);
} | CmsRfcCI function(long ciId, String cmAttrValue) { return cmRfcMrgProcessor.getCiById(ciId, cmAttrValue); } | /**
* Gets the ci by id.
*
* @param ciId the ci id
* @param cmAttrValue the cm attr value
* @return the ci by id
*/ | Gets the ci by id | getCiById | {
"repo_name": "okornev/oneops",
"path": "cmsdal/src/main/java/com/oneops/cms/dj/service/CmsCmDjManagerImpl.java",
"license": "apache-2.0",
"size": 11177
} | [
"com.oneops.cms.dj.domain.CmsRfcCI"
] | import com.oneops.cms.dj.domain.CmsRfcCI; | import com.oneops.cms.dj.domain.*; | [
"com.oneops.cms"
] | com.oneops.cms; | 36,634 |
private boolean doSearch() {
String wordToSearch = searchTF.getText();
if (StringUtils.isEmpty(wordToSearch)) {
return false;
}
Searcher searcher = isRegexpCB.isSelected() ?
new RegexpSearcher(isCaseSensitiveCB.isSelected(), searchTF.getText()) :
new RawTextSearcher(isCaseSensitiveCB.isSelected(), searchTF.getText());
return searchInNode(searcher, (SearchableTreeNode)defaultMutableTreeNode);
} | boolean function() { String wordToSearch = searchTF.getText(); if (StringUtils.isEmpty(wordToSearch)) { return false; } Searcher searcher = isRegexpCB.isSelected() ? new RegexpSearcher(isCaseSensitiveCB.isSelected(), searchTF.getText()) : new RawTextSearcher(isCaseSensitiveCB.isSelected(), searchTF.getText()); return searchInNode(searcher, (SearchableTreeNode)defaultMutableTreeNode); } | /**
* return true if a match occurred
*/ | return true if a match occurred | doSearch | {
"repo_name": "apache/jmeter",
"path": "src/components/src/main/java/org/apache/jmeter/visualizers/SearchTreePanel.java",
"license": "apache-2.0",
"size": 7402
} | [
"org.apache.commons.lang3.StringUtils",
"org.apache.jmeter.gui.action.RawTextSearcher",
"org.apache.jmeter.gui.action.RegexpSearcher",
"org.apache.jmeter.gui.action.Searcher"
] | import org.apache.commons.lang3.StringUtils; import org.apache.jmeter.gui.action.RawTextSearcher; import org.apache.jmeter.gui.action.RegexpSearcher; import org.apache.jmeter.gui.action.Searcher; | import org.apache.commons.lang3.*; import org.apache.jmeter.gui.action.*; | [
"org.apache.commons",
"org.apache.jmeter"
] | org.apache.commons; org.apache.jmeter; | 2,244,297 |
public boolean isSuccess() {
for (Status reply : proto.getStatusList()) {
if (reply != Status.SUCCESS) {
return false;
}
}
return true;
} | boolean function() { for (Status reply : proto.getStatusList()) { if (reply != Status.SUCCESS) { return false; } } return true; } | /**
* Check if this ack contains error status
* @return true if all statuses are SUCCESS
*/ | Check if this ack contains error status | isSuccess | {
"repo_name": "tseen/Federated-HDFS",
"path": "tseenliu/FedHDFS-hadoop-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/PipelineAck.java",
"license": "apache-2.0",
"size": 5874
} | [
"org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos"
] | import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos; | import org.apache.hadoop.hdfs.protocol.proto.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 430,039 |
@Endpoint(uri = "/{resourceId}" + ENVIRONMENT_CONFIGURATION_URI)
EnvironmentalConfiguration getEnvironmentalConfiguration(@PathParam("resourceId") String resourceId); | @Endpoint(uri = STR + ENVIRONMENT_CONFIGURATION_URI) EnvironmentalConfiguration getEnvironmentalConfiguration(@PathParam(STR) String resourceId); | /**
* Retrieves the environmental configuration of the enclosure identified
* by the given enclosure identifier.
*
* @param resourceId enclosure resource identifier as seen in HPE OneView.
*
* @return {@link EnvironmentalConfiguration} for the specified enclosure.
*/ | Retrieves the environmental configuration of the enclosure identified by the given enclosure identifier | getEnvironmentalConfiguration | {
"repo_name": "HewlettPackard/oneview-sdk-java",
"path": "oneview-sdk-java-lib/src/main/java/com/hp/ov/sdk/rest/client/server/EnclosureClient.java",
"license": "apache-2.0",
"size": 10320
} | [
"com.hp.ov.sdk.dto.EnvironmentalConfiguration",
"com.hp.ov.sdk.rest.reflect.Endpoint",
"com.hp.ov.sdk.rest.reflect.PathParam"
] | import com.hp.ov.sdk.dto.EnvironmentalConfiguration; import com.hp.ov.sdk.rest.reflect.Endpoint; import com.hp.ov.sdk.rest.reflect.PathParam; | import com.hp.ov.sdk.dto.*; import com.hp.ov.sdk.rest.reflect.*; | [
"com.hp.ov"
] | com.hp.ov; | 2,887,683 |
List<Item> items = new ArrayList<Item>();
// String[] friends = { idFriends.toString() };
String[] friends = idFriends.split(",");
for (String friendId : friends) {
Usuario usuario = null;
if (friendId != null && !friendId.isEmpty())
usuario = this.usuarioService.getUsuariosById(Long.parseLong(friendId));
if (usuario != null)
items.addAll(this.itemService.getItemsByUser(usuario));
}
return items;
} | List<Item> items = new ArrayList<Item>(); String[] friends = idFriends.split(","); for (String friendId : friends) { Usuario usuario = null; if (friendId != null && !friendId.isEmpty()) usuario = this.usuarioService.getUsuariosById(Long.parseLong(friendId)); if (usuario != null) items.addAll(this.itemService.getItemsByUser(usuario)); } return items; } | /**
* Obtiene los items de mis amigos
* @return
*/ | Obtiene los items de mis amigos | getItemsFriends | {
"repo_name": "waltercrdz/tacs-tit4tat-GrupoXX",
"path": "src/main/java/com/utn/tacs/tit4tat/controller/FriendsController.java",
"license": "apache-2.0",
"size": 1915
} | [
"com.utn.tacs.tit4tat.model.Item",
"com.utn.tacs.tit4tat.model.Usuario",
"java.util.ArrayList",
"java.util.List"
] | import com.utn.tacs.tit4tat.model.Item; import com.utn.tacs.tit4tat.model.Usuario; import java.util.ArrayList; import java.util.List; | import com.utn.tacs.tit4tat.model.*; import java.util.*; | [
"com.utn.tacs",
"java.util"
] | com.utn.tacs; java.util; | 2,323,743 |
long addCollectionToSingletonOutput(PCollection<?> inputValue, PCollectionView<?> outputValue);
} | long addCollectionToSingletonOutput(PCollection<?> inputValue, PCollectionView<?> outputValue); } | /**
* Adds an output to this {@code CollectionToSingleton} Dataflow step, consuming the specified
* input {@code PValue} and producing the specified output {@code PValue}. This step requires
* special treatment for its output encoding. Returns a pipeline level unique id.
*/ | Adds an output to this CollectionToSingleton Dataflow step, consuming the specified input PValue and producing the specified output PValue. This step requires special treatment for its output encoding. Returns a pipeline level unique id | addCollectionToSingletonOutput | {
"repo_name": "staslev/beam",
"path": "runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/TransformTranslator.java",
"license": "apache-2.0",
"size": 5583
} | [
"org.apache.beam.sdk.values.PCollection",
"org.apache.beam.sdk.values.PCollectionView"
] | import org.apache.beam.sdk.values.PCollection; import org.apache.beam.sdk.values.PCollectionView; | import org.apache.beam.sdk.values.*; | [
"org.apache.beam"
] | org.apache.beam; | 2,166,670 |
boolean isMethod(MessageMethod method);
| boolean isMethod(MessageMethod method); | /**
* Indicates whether this {@link Message} is of the specified
* {@link MessageMethod}.
*
* @param method
* the {@link MessageMethod} to be checked against
* @return true if this message is of the specified method, otherwise false
*/ | Indicates whether this <code>Message</code> is of the specified <code>MessageMethod</code> | isMethod | {
"repo_name": "deschbach/de.htwg.teamprojekt.uce",
"path": "stun/src/main/java/de/fhkn/in/uce/stun/message/Message.java",
"license": "gpl-3.0",
"size": 5323
} | [
"de.fhkn.in.uce.stun.header.MessageMethod"
] | import de.fhkn.in.uce.stun.header.MessageMethod; | import de.fhkn.in.uce.stun.header.*; | [
"de.fhkn.in"
] | de.fhkn.in; | 882,536 |
private void showPromptForKeyCertificateAlias(final PrivateKey key,
final Certificate certificate, String alias) {
if (getActivity() == null || getActivity().isFinishing() || key == null
|| certificate == null) {
return;
}
View passwordInputView = getActivity().getLayoutInflater().inflate(
R.layout.certificate_alias_prompt, null);
final EditText input = (EditText) passwordInputView.findViewById(R.id.alias_input);
if (!TextUtils.isEmpty(alias)) {
input.setText(alias);
input.selectAll();
}
final CheckBox userSelectableCheckbox = passwordInputView.findViewById(
R.id.alias_user_selectable);
userSelectableCheckbox.setEnabled(Util.SDK_INT >= VERSION_CODES.P);
userSelectableCheckbox.setChecked(Util.SDK_INT < VERSION_CODES.P); | void function(final PrivateKey key, final Certificate certificate, String alias) { if (getActivity() == null getActivity().isFinishing() key == null certificate == null) { return; } View passwordInputView = getActivity().getLayoutInflater().inflate( R.layout.certificate_alias_prompt, null); final EditText input = (EditText) passwordInputView.findViewById(R.id.alias_input); if (!TextUtils.isEmpty(alias)) { input.setText(alias); input.selectAll(); } final CheckBox userSelectableCheckbox = passwordInputView.findViewById( R.id.alias_user_selectable); userSelectableCheckbox.setEnabled(Util.SDK_INT >= VERSION_CODES.P); userSelectableCheckbox.setChecked(Util.SDK_INT < VERSION_CODES.P); | /**
* Shows a prompt to ask for the certificate alias. This alias will be imported together with
* the private key and certificate.
*
* @param key The private key of a certificate.
* @param certificate The certificate will be imported.
* @param alias A name that represents the certificate in the profile.
*/ | Shows a prompt to ask for the certificate alias. This alias will be imported together with the private key and certificate | showPromptForKeyCertificateAlias | {
"repo_name": "googlesamples/android-testdpc",
"path": "app/src/main/java/com/afwsamples/testdpc/policy/PolicyManagementFragment.java",
"license": "apache-2.0",
"size": 213498
} | [
"android.text.TextUtils",
"android.view.View",
"android.widget.CheckBox",
"android.widget.EditText",
"com.afwsamples.testdpc.common.Util",
"java.security.PrivateKey",
"java.security.cert.Certificate"
] | import android.text.TextUtils; import android.view.View; import android.widget.CheckBox; import android.widget.EditText; import com.afwsamples.testdpc.common.Util; import java.security.PrivateKey; import java.security.cert.Certificate; | import android.text.*; import android.view.*; import android.widget.*; import com.afwsamples.testdpc.common.*; import java.security.*; import java.security.cert.*; | [
"android.text",
"android.view",
"android.widget",
"com.afwsamples.testdpc",
"java.security"
] | android.text; android.view; android.widget; com.afwsamples.testdpc; java.security; | 2,201,541 |
public T caseParameter(Parameter object) {
return null;
} | T function(Parameter object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>Parameter</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
*
* @param object
* the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Parameter</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'Parameter'. This implementation returns null; returning a non-null result will terminate the switch. | caseParameter | {
"repo_name": "ObeoNetwork/M2Doc",
"path": "plugins/org.obeonetwork.m2doc/src-gen/org/obeonetwork/m2doc/template/util/TemplateSwitch.java",
"license": "epl-1.0",
"size": 27479
} | [
"org.obeonetwork.m2doc.template.Parameter"
] | import org.obeonetwork.m2doc.template.Parameter; | import org.obeonetwork.m2doc.template.*; | [
"org.obeonetwork.m2doc"
] | org.obeonetwork.m2doc; | 1,738,403 |
boolean isYes = url.contains("/hap/api/1.0/tts");
Log.d(TAG, "canProcess=" + isYes + " : " + url);
return isYes;
} | boolean isYes = url.contains(STR); Log.d(TAG, STR + isYes + STR + url); return isYes; } | /**
* Checks if a request can be processed.
*/ | Checks if a request can be processed | canProcess | {
"repo_name": "yangjun2/android",
"path": "androidhap/InfinitiInTouch/src/com/airbiquity/mcs/http/android/HandlerTTS.java",
"license": "unlicense",
"size": 3117
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 585,618 |
@Override // FSDatasetMBean
public long getCapacity() throws IOException {
synchronized(statsLock) {
return volumes.getCapacity();
}
} | @Override long function() throws IOException { synchronized(statsLock) { return volumes.getCapacity(); } } | /**
* Return total capacity, used and unused
*/ | Return total capacity, used and unused | getCapacity | {
"repo_name": "f7753/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java",
"license": "apache-2.0",
"size": 113025
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 767,820 |
public Action[] build(Artifact outApk) {
Builder actionBuilder = new SpawnAction.Builder()
.setExecutable(AndroidSdkProvider.fromRuleContext(ruleContext).getApkBuilder())
.setProgressMessage(message)
.setMnemonic("AndroidApkBuilder")
.addOutputArgument(outApk);
if (javaResourceZip != null) {
actionBuilder
.addArgument("-rj")
.addInputArgument(javaResourceZip);
}
Artifact nativeSymlinks = nativeLibs.createApkBuilderSymlinks(ruleContext);
if (nativeSymlinks != null) {
PathFragment nativeSymlinksDir = nativeSymlinks.getExecPath().getParentDirectory();
actionBuilder
.addInputManifest(nativeSymlinks, nativeSymlinksDir)
.addInput(nativeSymlinks)
.addInputs(nativeLibs.getAllNativeLibs())
.addArgument("-nf")
// If the native libs are "foo/bar/x86/foo.so", we need to pass "foo/bar" here
.addArgument(nativeSymlinksDir.getPathString());
}
if (nativeLibs.getName() != null) {
actionBuilder
.addArgument("-rf")
.addArgument(nativeLibs.getName().getExecPath().getParentDirectory().getPathString())
.addInput(nativeLibs.getName());
}
if (javaResourceFile != null) {
actionBuilder
.addArgument("-rf")
.addArgument((javaResourceFile.getExecPath().getParentDirectory().getPathString()))
.addInput(javaResourceFile);
}
semantics.addSigningArguments(ruleContext, sign, actionBuilder);
actionBuilder
.addArgument("-z")
.addInputArgument(resourceApk);
if (classesDex != null) {
actionBuilder
.addArgument(classesDex.getFilename().endsWith(".dex") ? "-f" : "-z")
.addInputArgument(classesDex);
}
return actionBuilder.build(ruleContext);
}
} | Action[] function(Artifact outApk) { Builder actionBuilder = new SpawnAction.Builder() .setExecutable(AndroidSdkProvider.fromRuleContext(ruleContext).getApkBuilder()) .setProgressMessage(message) .setMnemonic(STR) .addOutputArgument(outApk); if (javaResourceZip != null) { actionBuilder .addArgument("-rj") .addInputArgument(javaResourceZip); } Artifact nativeSymlinks = nativeLibs.createApkBuilderSymlinks(ruleContext); if (nativeSymlinks != null) { PathFragment nativeSymlinksDir = nativeSymlinks.getExecPath().getParentDirectory(); actionBuilder .addInputManifest(nativeSymlinks, nativeSymlinksDir) .addInput(nativeSymlinks) .addInputs(nativeLibs.getAllNativeLibs()) .addArgument("-nf") .addArgument(nativeSymlinksDir.getPathString()); } if (nativeLibs.getName() != null) { actionBuilder .addArgument("-rf") .addArgument(nativeLibs.getName().getExecPath().getParentDirectory().getPathString()) .addInput(nativeLibs.getName()); } if (javaResourceFile != null) { actionBuilder .addArgument("-rf") .addArgument((javaResourceFile.getExecPath().getParentDirectory().getPathString())) .addInput(javaResourceFile); } semantics.addSigningArguments(ruleContext, sign, actionBuilder); actionBuilder .addArgument("-z") .addInputArgument(resourceApk); if (classesDex != null) { actionBuilder .addArgument(classesDex.getFilename().endsWith(".dex") ? "-f" : "-z") .addInputArgument(classesDex); } return actionBuilder.build(ruleContext); } } | /**
* Creates a generating action for {@code outApk} that builds the APK specified.
*/ | Creates a generating action for outApk that builds the APK specified | build | {
"repo_name": "bitemyapp/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java",
"license": "apache-2.0",
"size": 55480
} | [
"com.google.devtools.build.lib.actions.Action",
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.analysis.actions.SpawnAction",
"com.google.devtools.build.lib.vfs.PathFragment"
] | import com.google.devtools.build.lib.actions.Action; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.actions.SpawnAction; import com.google.devtools.build.lib.vfs.PathFragment; | import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.actions.*; import com.google.devtools.build.lib.vfs.*; | [
"com.google.devtools"
] | com.google.devtools; | 743,675 |
BPELServer getBPELServer(); | BPELServer getBPELServer(); | /**
* Access the BPEL Engine
*
* @return BPELServer
*/ | Access the BPEL Engine | getBPELServer | {
"repo_name": "chathurace/carbon-business-process",
"path": "components/bpel/org.wso2.carbon.bpel/src/main/java/org/wso2/carbon/bpel/core/BPELEngineService.java",
"license": "apache-2.0",
"size": 946
} | [
"org.wso2.carbon.bpel.core.ode.integration.BPELServer"
] | import org.wso2.carbon.bpel.core.ode.integration.BPELServer; | import org.wso2.carbon.bpel.core.ode.integration.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 584,863 |
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_edit_stb, menu);
return true;
} | boolean function(Menu menu) { getMenuInflater().inflate(R.menu.activity_edit_stb, menu); return true; } | /**
* Overridden method that creates the options menu
* (hardware button on many phones)
* (it doesn't lead anywhere though)
*/ | Overridden method that creates the options menu (hardware button on many phones) (it doesn't lead anywhere though) | onCreateOptionsMenu | {
"repo_name": "Z-app/zmote",
"path": "src/se/z_app/zmote/gui/EditSTBActivity.java",
"license": "bsd-2-clause",
"size": 2220
} | [
"android.view.Menu"
] | import android.view.Menu; | import android.view.*; | [
"android.view"
] | android.view; | 678,646 |
ShareQrCodeDialogFragment frag = new ShareQrCodeDialogFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_KEY_URI, dataUri);
frag.setArguments(args);
return frag;
} | ShareQrCodeDialogFragment frag = new ShareQrCodeDialogFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_KEY_URI, dataUri); frag.setArguments(args); return frag; } | /**
* Creates new instance of this dialog fragment
*/ | Creates new instance of this dialog fragment | newInstance | {
"repo_name": "eric-stanley/apg",
"path": "OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareQrCodeDialogFragment.java",
"license": "gpl-3.0",
"size": 4263
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 1,665,632 |
@Nullable
@Override
public IRequest<?> getRequestForToken(@NotNull final IToken<?> token) throws IllegalArgumentException
{
return wrappedManager.getRequestHandler().getRequestOrNull(token);
} | IRequest<?> function(@NotNull final IToken<?> token) throws IllegalArgumentException { return wrappedManager.getRequestHandler().getRequestOrNull(token); } | /**
* Method to get a request for a given token.
*
* @param token The token to get a request for.
* @return The request of the given type for that token.
* @throws IllegalArgumentException when either their is no request with that token, or the token does not produce a request of the given type T.
*/ | Method to get a request for a given token | getRequestForToken | {
"repo_name": "Minecolonies/minecolonies",
"path": "src/main/java/com/minecolonies/coremod/colony/requestsystem/management/manager/wrapped/AbstractWrappedRequestManager.java",
"license": "gpl-3.0",
"size": 9408
} | [
"com.minecolonies.api.colony.requestsystem.request.IRequest",
"com.minecolonies.api.colony.requestsystem.token.IToken",
"org.jetbrains.annotations.NotNull"
] | import com.minecolonies.api.colony.requestsystem.request.IRequest; import com.minecolonies.api.colony.requestsystem.token.IToken; import org.jetbrains.annotations.NotNull; | import com.minecolonies.api.colony.requestsystem.request.*; import com.minecolonies.api.colony.requestsystem.token.*; import org.jetbrains.annotations.*; | [
"com.minecolonies.api",
"org.jetbrains.annotations"
] | com.minecolonies.api; org.jetbrains.annotations; | 654,305 |
public Integer getNumberOfBasketsESIB(Integer tenantId, Integer actionType, Double ratingNeutral, List<Integer> itemTypes) {
List<Object> args = Lists.newArrayList();
List<Integer> argt = Lists.newArrayList();
StringBuilder query = new StringBuilder(
"SELECT count(b.userId) FROM (SELECT userId, count(userId) as cnt FROM ");
query.append(BaseActionDAO.DEFAULT_TABLE_NAME);
query.append(" WHERE ").append(BaseActionDAO.DEFAULT_TENANT_COLUMN_NAME).append("=")
.append(tenantId);
query.append(" AND ").append(BaseActionDAO.DEFAULT_ACTION_TYPE_COLUMN_NAME).append("=")
.append(actionType);
if (ratingNeutral != null) {
query.append(" AND ").append(BaseActionDAO.DEFAULT_RATING_VALUE_COLUMN_NAME).append(">")
.append(ratingNeutral);
}
if (!itemTypes.isEmpty()) {
query.append(" AND ").append(BaseActionDAO.DEFAULT_ITEM_TYPE_COLUMN_NAME).append(" IN (");
for (int i = 0; i < itemTypes.size(); i++) {
query.append("?");
args.add(itemTypes.get(i));
argt.add(Types.INTEGER);
if (i < itemTypes.size() - 1) {
query.append(",");
} else {
query.append(")");
}
}
}
query.append(" GROUP BY userId HAVING cnt>1) b");
return getJdbcTemplate().queryForObject(query.toString(), args.toArray(), Ints.toArray(argt), Integer.class);
} | Integer function(Integer tenantId, Integer actionType, Double ratingNeutral, List<Integer> itemTypes) { List<Object> args = Lists.newArrayList(); List<Integer> argt = Lists.newArrayList(); StringBuilder query = new StringBuilder( STR); query.append(BaseActionDAO.DEFAULT_TABLE_NAME); query.append(STR).append(BaseActionDAO.DEFAULT_TENANT_COLUMN_NAME).append("=") .append(tenantId); query.append(STR).append(BaseActionDAO.DEFAULT_ACTION_TYPE_COLUMN_NAME).append("=") .append(actionType); if (ratingNeutral != null) { query.append(STR).append(BaseActionDAO.DEFAULT_RATING_VALUE_COLUMN_NAME).append(">") .append(ratingNeutral); } if (!itemTypes.isEmpty()) { query.append(STR).append(BaseActionDAO.DEFAULT_ITEM_TYPE_COLUMN_NAME).append(STR); for (int i = 0; i < itemTypes.size(); i++) { query.append("?"); args.add(itemTypes.get(i)); argt.add(Types.INTEGER); if (i < itemTypes.size() - 1) { query.append(","); } else { query.append(")"); } } } query.append(STR); return getJdbcTemplate().queryForObject(query.toString(), args.toArray(), Ints.toArray(argt), Integer.class); } | /**
* Number of baskets excluding single item baskets
*
* @param analysis anlysis
* @return int
*/ | Number of baskets excluding single item baskets | getNumberOfBasketsESIB | {
"repo_name": "stefanleijnen/ailabs_engine",
"path": "easyrec-plugins/easyrec-plugins-arm/src/main/java/org/easyrec/plugin/arm/store/dao/impl/RuleminingActionDAOMysqlImpl.java",
"license": "gpl-3.0",
"size": 17669
} | [
"com.google.common.collect.Lists",
"com.google.common.primitives.Ints",
"java.sql.Types",
"java.util.List",
"org.easyrec.store.dao.BaseActionDAO"
] | import com.google.common.collect.Lists; import com.google.common.primitives.Ints; import java.sql.Types; import java.util.List; import org.easyrec.store.dao.BaseActionDAO; | import com.google.common.collect.*; import com.google.common.primitives.*; import java.sql.*; import java.util.*; import org.easyrec.store.dao.*; | [
"com.google.common",
"java.sql",
"java.util",
"org.easyrec.store"
] | com.google.common; java.sql; java.util; org.easyrec.store; | 182,814 |
public Rectangle2D getPrimitiveBounds() {
if (!isVisible) return null;
if (shape == null) return null;
if (primitiveBounds != null)
return primitiveBounds;
if (shapePainter == null)
primitiveBounds = shape.getBounds2D();
else
primitiveBounds = shapePainter.getPaintedBounds2D();
// Check If we should halt early.
if (HaltingThread.hasBeenHalted()) {
// The Thread has been halted.
// Invalidate any cached values and proceed (this
// sets primitiveBounds to null).
invalidateGeometryCache();
}
return primitiveBounds;
} | Rectangle2D function() { if (!isVisible) return null; if (shape == null) return null; if (primitiveBounds != null) return primitiveBounds; if (shapePainter == null) primitiveBounds = shape.getBounds2D(); else primitiveBounds = shapePainter.getPaintedBounds2D(); if (HaltingThread.hasBeenHalted()) { invalidateGeometryCache(); } return primitiveBounds; } | /**
* Returns the bounds of the area covered by this node's primitive paint.
*/ | Returns the bounds of the area covered by this node's primitive paint | getPrimitiveBounds | {
"repo_name": "sflyphotobooks/crp-batik",
"path": "sources/org/apache/batik/gvt/ShapeNode.java",
"license": "apache-2.0",
"size": 13272
} | [
"java.awt.geom.Rectangle2D",
"org.apache.batik.util.HaltingThread"
] | import java.awt.geom.Rectangle2D; import org.apache.batik.util.HaltingThread; | import java.awt.geom.*; import org.apache.batik.util.*; | [
"java.awt",
"org.apache.batik"
] | java.awt; org.apache.batik; | 249,263 |
public int write(byte []buffer, int offset, int length, boolean isEnd)
throws IOException
{
int result;
long requestExpireTime = _requestExpireTime;
if (requestExpireTime > 0 && requestExpireTime < CurrentTime.getCurrentTime()) {
close();
throw new ClientDisconnectException(L.l("{0}: request-timeout write exp={0}s",
getRemoteAddress(),
CurrentTime.getCurrentTime() - requestExpireTime));
}
synchronized (_writeLock) {
long now = CurrentTime.getCurrentTimeActual();
long expires = _socketTimeout + now;
// _isNativeFlushRequired = true;
do {
result = writeNative(_socketFd, buffer, offset, length);
//byte []tempBuffer = _byteBuffer.array();
//System.out.println("TEMP: " + tempBuffer);
//System.arraycopy(buffer, offset, tempBuffer, 0, length);
//_byteBuffer.position(0);
//_byteBuffer.put(buffer, offset, length);
//result = writeNativeNio(_fd, _byteBuffer, 0, length);
} while (result == JniStream.TIMEOUT_EXN
&& CurrentTime.getCurrentTimeActual() < expires);
}
if (isEnd) {
close();
}
return result;
}
| int function(byte []buffer, int offset, int length, boolean isEnd) throws IOException { int result; long requestExpireTime = _requestExpireTime; if (requestExpireTime > 0 && requestExpireTime < CurrentTime.getCurrentTime()) { close(); throw new ClientDisconnectException(L.l(STR, getRemoteAddress(), CurrentTime.getCurrentTime() - requestExpireTime)); } synchronized (_writeLock) { long now = CurrentTime.getCurrentTimeActual(); long expires = _socketTimeout + now; do { result = writeNative(_socketFd, buffer, offset, length); } while (result == JniStream.TIMEOUT_EXN && CurrentTime.getCurrentTimeActual() < expires); } if (isEnd) { close(); } return result; } | /**
* Writes to the socket.
*/ | Writes to the socket | write | {
"repo_name": "mdaniel/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/vfs/JniSocketImpl.java",
"license": "gpl-2.0",
"size": 20355
} | [
"com.caucho.util.CurrentTime",
"java.io.IOException"
] | import com.caucho.util.CurrentTime; import java.io.IOException; | import com.caucho.util.*; import java.io.*; | [
"com.caucho.util",
"java.io"
] | com.caucho.util; java.io; | 1,831,177 |
@Override
public List<BusinessObjectType> fetch(String fieldName, Object value) throws SQLException
{
this.beforeFetch();
List<BusinessObjectType> bos = null;
if (value == null) {
bos = dao.query(dao.queryBuilder().where().isNull(fieldName).prepare());
} else {
bos = dao.queryForEq(fieldName, value);
}
for (BusinessObjectType bo : bos) {
this.afterFetch(bo);
}
return bos;
} | List<BusinessObjectType> function(String fieldName, Object value) throws SQLException { this.beforeFetch(); List<BusinessObjectType> bos = null; if (value == null) { bos = dao.query(dao.queryBuilder().where().isNull(fieldName).prepare()); } else { bos = dao.queryForEq(fieldName, value); } for (BusinessObjectType bo : bos) { this.afterFetch(bo); } return bos; } | /**
* Parametrized fetch for one column = value pair
*
* @param fieldName the column name
* @param value the value to compare to
*
* @return a list of all BusinessObjects matching the criteria
*
* @throws SQLException
*/ | Parametrized fetch for one column = value pair | fetch | {
"repo_name": "IAP12-16B/jManagr",
"path": "src/ch/jmanagr/dal/AbstractDAL.java",
"license": "gpl-3.0",
"size": 9296
} | [
"java.sql.SQLException",
"java.util.List"
] | import java.sql.SQLException; import java.util.List; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 484,977 |
void exitSwitchBlockStatementGroup(@NotNull Java8Parser.SwitchBlockStatementGroupContext ctx); | void exitSwitchBlockStatementGroup(@NotNull Java8Parser.SwitchBlockStatementGroupContext ctx); | /**
* Exit a parse tree produced by {@link Java8Parser#switchBlockStatementGroup}.
*
* @param ctx the parse tree
*/ | Exit a parse tree produced by <code>Java8Parser#switchBlockStatementGroup</code> | exitSwitchBlockStatementGroup | {
"repo_name": "BigDaddy-Germany/WHOAMI",
"path": "WHOAMI/src/de/aima13/whoami/modules/syntaxcheck/languages/antlrgen/Java8Listener.java",
"license": "mit",
"size": 97945
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 100,623 |
SocketAddress getClientAddress(); | SocketAddress getClientAddress(); | /**
* Gets the socket address of the LDAP client or null if there is no LDAP
* client associated with the session. Some calls to the core can be made
* by embedding applications or by non-LDAP services using a programmatic
* (virtual) session. In these cases no client address is available.
*
* @return null if the session is virtual, non-null when the session is
* associated with a real LDAP client
*/ | Gets the socket address of the LDAP client or null if there is no LDAP client associated with the session. Some calls to the core can be made by embedding applications or by non-LDAP services using a programmatic (virtual) session. In these cases no client address is available | getClientAddress | {
"repo_name": "drankye/directory-server",
"path": "core-api/src/main/java/org/apache/directory/server/core/api/CoreSession.java",
"license": "apache-2.0",
"size": 31531
} | [
"java.net.SocketAddress"
] | import java.net.SocketAddress; | import java.net.*; | [
"java.net"
] | java.net; | 2,566,312 |
public Map<String, Language> getValidLanguageMap(); | Map<String, Language> function(); | /**
* Return the list of valid languages supported by the system
*
* @return
*/ | Return the list of valid languages supported by the system | getValidLanguageMap | {
"repo_name": "theAgileFactory/app-framework",
"path": "app/framework/services/configuration/II18nMessagesPlugin.java",
"license": "gpl-2.0",
"size": 6896
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 601,082 |
protected void unsetRegistryService(RegistryService registryService) {
if (log.isDebugEnabled()) {
log.debug("RegistryService unset in Entitlement bundle");
}
EntitlementServiceComponent.registryService = null;
}
| void function(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug(STR); } EntitlementServiceComponent.registryService = null; } | /**
* un-sets registry service
*
* @param registryService <code>RegistryService</code>
*/ | un-sets registry service | unsetRegistryService | {
"repo_name": "SupunS/carbon-identity",
"path": "components/identity/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/internal/EntitlementServiceComponent.java",
"license": "apache-2.0",
"size": 17751
} | [
"org.wso2.carbon.registry.core.service.RegistryService"
] | import org.wso2.carbon.registry.core.service.RegistryService; | import org.wso2.carbon.registry.core.service.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 2,611,355 |
private MessageFormat getFormatterForFilename()
{
return myFormatterForFilename;
} | MessageFormat function() { return myFormatterForFilename; } | /**
* Get formatterForFilename.
* @return the formatterForFilename
* @since 15.06.00-SNAPSHOT
*/ | Get formatterForFilename | getFormatterForFilename | {
"repo_name": "sporniket/imagelib",
"path": "sporniket-imagelib-core/src/main/java/com/sporniket/libre/images/core/thumbnails/NameProvider.java",
"license": "lgpl-3.0",
"size": 4170
} | [
"java.text.MessageFormat"
] | import java.text.MessageFormat; | import java.text.*; | [
"java.text"
] | java.text; | 1,334,966 |
T taskCreatedAfter(Date after); | T taskCreatedAfter(Date after); | /**
* Only select tasks that are created after the given date.
*/ | Only select tasks that are created after the given date | taskCreatedAfter | {
"repo_name": "motorina0/flowable-engine",
"path": "modules/flowable-engine/src/main/java/org/flowable/engine/task/TaskInfoQuery.java",
"license": "apache-2.0",
"size": 23756
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,885,804 |
private static void installLinuxPRNGSecureRandom()
throws SecurityException {
if (getApi() > VERSION_CODE_JELLY_BEAN_MR2) {
// No need to apply the fix
return;
}
// Install a Linux PRNG-based SecureRandom implementation as the
// default, if not yet installed.
Provider[] secureRandomProviders =
Security.getProviders("SecureRandom.SHA1PRNG");
if ((secureRandomProviders == null)
|| (secureRandomProviders.length < 1)
|| (!LinuxPRNGSecureRandomProvider.class.equals(
secureRandomProviders[0].getClass()))) {
Security.insertProviderAt(new LinuxPRNGSecureRandomProvider(), 1);
}
// Assert that new SecureRandom() and
// SecureRandom.getInstance("SHA1PRNG") return a SecureRandom backed
// by the Linux PRNG-based SecureRandom implementation.
SecureRandom rng1 = new SecureRandom();
if (!LinuxPRNGSecureRandomProvider.class.equals(
rng1.getProvider().getClass())) {
throw new SecurityException(
"new SecureRandom() backed by wrong Provider: "
+ rng1.getProvider().getClass());
}
SecureRandom rng2;
try {
rng2 = SecureRandom.getInstance("SHA1PRNG");
} catch (NoSuchAlgorithmException e) {
throw new SecurityException("SHA1PRNG not available", e);
}
if (!LinuxPRNGSecureRandomProvider.class.equals(
rng2.getProvider().getClass())) {
throw new SecurityException(
"SecureRandom.getInstance(\"SHA1PRNG\") backed by wrong"
+ " Provider: " + rng2.getProvider().getClass());
}
}
@SuppressWarnings("serial")
private static class LinuxPRNGSecureRandomProvider extends Provider {
public LinuxPRNGSecureRandomProvider() {
super("LinuxPRNG",
1.0,
"A Linux-specific random number provider that uses"
+ " /dev/urandom");
// Although /dev/urandom is not a SHA-1 PRNG, some apps
// explicitly request a SHA1PRNG SecureRandom and we thus need to
// prevent them from getting the default implementation whose output
// may have low entropy.
put("SecureRandom.SHA1PRNG", LinuxPRNGSecureRandom.class.getName());
put("SecureRandom.SHA1PRNG ImplementedIn", "Software");
}
}
@SuppressWarnings("serial")
public static class LinuxPRNGSecureRandom extends SecureRandomSpi {
private static final String TAG = "PRNGFixes";
private static final File URANDOM_FILE = new File("/dev/urandom");
private static final Object sLock = new Object();
private static DataInputStream sUrandomIn;
private static OutputStream sUrandomOut;
private boolean mSeeded; | static void function() throws SecurityException { if (getApi() > VERSION_CODE_JELLY_BEAN_MR2) { return; } Provider[] secureRandomProviders = Security.getProviders(STR); if ((secureRandomProviders == null) (secureRandomProviders.length < 1) (!LinuxPRNGSecureRandomProvider.class.equals( secureRandomProviders[0].getClass()))) { Security.insertProviderAt(new LinuxPRNGSecureRandomProvider(), 1); } SecureRandom rng1 = new SecureRandom(); if (!LinuxPRNGSecureRandomProvider.class.equals( rng1.getProvider().getClass())) { throw new SecurityException( STR + rng1.getProvider().getClass()); } SecureRandom rng2; try { rng2 = SecureRandom.getInstance(STR); } catch (NoSuchAlgorithmException e) { throw new SecurityException(STR, e); } if (!LinuxPRNGSecureRandomProvider.class.equals( rng2.getProvider().getClass())) { throw new SecurityException( STRSHA1PRNG\STR + STR + rng2.getProvider().getClass()); } } @SuppressWarnings(STR) private static class LinuxPRNGSecureRandomProvider extends Provider { public LinuxPRNGSecureRandomProvider() { super(STR, 1.0, STR + STR); put(STR, LinuxPRNGSecureRandom.class.getName()); put(STR, STR); } } @SuppressWarnings(STR) public static class LinuxPRNGSecureRandom extends SecureRandomSpi { private static final String TAG = STR; private static final File URANDOM_FILE = new File(STR); private static final Object sLock = new Object(); private static DataInputStream sUrandomIn; private static OutputStream sUrandomOut; private boolean mSeeded; | /**
* Installs a Linux PRNG-backed {@code SecureRandom} implementation as the
* default. Does nothing if the implementation is already the default or if
* there is not need to install the implementation.
*
* @throws SecurityException if the fix is needed but could not be applied.
*/ | Installs a Linux PRNG-backed SecureRandom implementation as the default. Does nothing if the implementation is already the default or if there is not need to install the implementation | installLinuxPRNGSecureRandom | {
"repo_name": "Phonemetra/TurboStore",
"path": "app/src/com/phonemetra/turbo/store/compat/PRNGFixes.java",
"license": "gpl-3.0",
"size": 12456
} | [
"java.io.DataInputStream",
"java.io.File",
"java.io.OutputStream",
"java.security.NoSuchAlgorithmException",
"java.security.Provider",
"java.security.SecureRandom",
"java.security.SecureRandomSpi",
"java.security.Security"
] | import java.io.DataInputStream; import java.io.File; import java.io.OutputStream; import java.security.NoSuchAlgorithmException; import java.security.Provider; import java.security.SecureRandom; import java.security.SecureRandomSpi; import java.security.Security; | import java.io.*; import java.security.*; | [
"java.io",
"java.security"
] | java.io; java.security; | 451,784 |
public void dropDatabase(Map<String, Object> params) throws IOException {
JDBCDataStore store = new JDBCDataStore();
// get the connection params
String host = (String) HOST.lookUp(params);
int port = (Integer) PORT.lookUp(params);
String db = (String) DATABASE.lookUp(params);
String user = (String) USER.lookUp(params);
String password = (String) PASSWD.lookUp(params);
Connection cx = null;
Statement st = null;
try {
// connect to template1 instead
String url = "jdbc:postgresql" + "://" + host + ":" + port + "/template1";
cx = getConnection(user, password, url);
// drop the database
String sql = "DROP DATABASE \"" + db + "\"";
st = cx.createStatement();
st.execute(sql);
} catch (SQLException e) {
throw new IOException("Failed to drop the target database", e);
} finally {
store.closeSafe(st);
store.closeSafe(cx);
}
} | void function(Map<String, Object> params) throws IOException { JDBCDataStore store = new JDBCDataStore(); String host = (String) HOST.lookUp(params); int port = (Integer) PORT.lookUp(params); String db = (String) DATABASE.lookUp(params); String user = (String) USER.lookUp(params); String password = (String) PASSWD.lookUp(params); Connection cx = null; Statement st = null; try { String url = STR + STRDROP DATABASE \STR\STRFailed to drop the target database", e); } finally { store.closeSafe(st); store.closeSafe(cx); } } | /**
* Drops the database specified in the connection params. The database must not be in use, and
* the user must have the necessary privileges
*/ | Drops the database specified in the connection params. The database must not be in use, and the user must have the necessary privileges | dropDatabase | {
"repo_name": "geotools/geotools",
"path": "modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/PostgisNGDataStoreFactory.java",
"license": "lgpl-2.1",
"size": 16890
} | [
"java.io.IOException",
"java.sql.Connection",
"java.sql.Statement",
"java.util.Map",
"org.geotools.jdbc.JDBCDataStore"
] | import java.io.IOException; import java.sql.Connection; import java.sql.Statement; import java.util.Map; import org.geotools.jdbc.JDBCDataStore; | import java.io.*; import java.sql.*; import java.util.*; import org.geotools.jdbc.*; | [
"java.io",
"java.sql",
"java.util",
"org.geotools.jdbc"
] | java.io; java.sql; java.util; org.geotools.jdbc; | 840,960 |
public static void attemptAssignment(long id, Session db)
{
Queue.getInstance().runRigAssignment(id, db);
Rig rig = new RigDao(db).get(id);
if (rig.getSession() != null)
{
QueueActivator.notifySessionEvent(SessionEvent.ASSIGNED, rig.getSession(), db);
}
} | static void function(long id, Session db) { Queue.getInstance().runRigAssignment(id, db); Rig rig = new RigDao(db).get(id); if (rig.getSession() != null) { QueueActivator.notifySessionEvent(SessionEvent.ASSIGNED, rig.getSession(), db); } } | /**
* Attempts to assign the rig with the specified identifier.
* The provided database session is used instead of opening a new
* session.
*
* @param id rig identifier
* @param db database session
*/ | Attempts to assign the rig with the specified identifier. The provided database session is used instead of opening a new session | attemptAssignment | {
"repo_name": "sahara-labs/scheduling-server",
"path": "Queuer/src/au/edu/uts/eng/remotelabs/schedserver/queuer/QueueRun.java",
"license": "bsd-3-clause",
"size": 4214
} | [
"au.edu.uts.eng.remotelabs.schedserver.dataaccess.dao.RigDao",
"au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.Rig",
"au.edu.uts.eng.remotelabs.schedserver.dataaccess.listener.SessionEventListener",
"au.edu.uts.eng.remotelabs.schedserver.queuer.impl.Queue",
"org.hibernate.Session"
] | import au.edu.uts.eng.remotelabs.schedserver.dataaccess.dao.RigDao; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.Rig; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.listener.SessionEventListener; import au.edu.uts.eng.remotelabs.schedserver.queuer.impl.Queue; import org.hibernate.Session; | import au.edu.uts.eng.remotelabs.schedserver.dataaccess.dao.*; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.entities.*; import au.edu.uts.eng.remotelabs.schedserver.dataaccess.listener.*; import au.edu.uts.eng.remotelabs.schedserver.queuer.impl.*; import org.hibernate.*; | [
"au.edu.uts",
"org.hibernate"
] | au.edu.uts; org.hibernate; | 1,558,434 |
String confirm(RequestContext requestContext, Credential credential); | String confirm(RequestContext requestContext, Credential credential); | /**
* <p>Confirms user acknowledgement of interrupt completion before directing
* the user to a login page.</p>
*
* @param requestContext
* @param credential
* @return a {@link String} value indicating what webflow state to go to next
*/ | Confirms user acknowledgement of interrupt completion before directing the user to a login page | confirm | {
"repo_name": "ConnCollege/cas-5",
"path": "src/main/java/edu/conncoll/cas/interrupts/web/flow/ConncollInterruptsRepository.java",
"license": "apache-2.0",
"size": 2278
} | [
"org.apereo.cas.authentication.Credential",
"org.springframework.webflow.execution.RequestContext"
] | import org.apereo.cas.authentication.Credential; import org.springframework.webflow.execution.RequestContext; | import org.apereo.cas.authentication.*; import org.springframework.webflow.execution.*; | [
"org.apereo.cas",
"org.springframework.webflow"
] | org.apereo.cas; org.springframework.webflow; | 2,662,362 |
public UnsafeThreadLocal<Object> getBlockedOn() {
return blockedOn;
} | UnsafeThreadLocal<Object> function() { return blockedOn; } | /**
* Used for instrumenting blocked threads
*/ | Used for instrumenting blocked threads | getBlockedOn | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/locks/DLockService.java",
"license": "apache-2.0",
"size": 109338
} | [
"org.apache.geode.distributed.internal.deadlock.UnsafeThreadLocal"
] | import org.apache.geode.distributed.internal.deadlock.UnsafeThreadLocal; | import org.apache.geode.distributed.internal.deadlock.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,555,917 |
public Map listIdentifiers(String resumptionToken)
throws BadResumptionTokenException, OAIInternalServerError {
// purge(); // clean out old resumptionTokens
Map listIdentifiersMap = new HashMap();
ArrayList headers = new ArrayList();
ArrayList identifiers = new ArrayList();
StringTokenizer tokenizer = new StringTokenizer(resumptionToken, ":");
// String resumptionId;
String from;
String until;
String set;
int oldCount;
String metadataPrefix;
// int numRows;
try {
// resumptionId = tokenizer.nextToken();
from = tokenizer.nextToken();
until = tokenizer.nextToken();
set = tokenizer.nextToken();
if (set.equals("."))
set = null;
oldCount = Integer.parseInt(tokenizer.nextToken());
// numRows = Integer.parseInt(tokenizer.nextToken());
metadataPrefix = tokenizer.nextToken();
if (debug) {
System.out.println("JDBCLimitedOAICatalog.listIdentifiers: set=>"
+ set + "<");
}
} catch (NoSuchElementException e) {
throw new BadResumptionTokenException();
}
Connection con = null;
try {
con = startConnection();
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery(populateRangeQuery(from, until, set,
oldCount, maxListSize));
int count;
for (count = 0; count < maxListSize && rs.next(); ++count) {
HashMap nativeItem = getColumnValues(rs);
Iterator setSpecs = getSetSpecs(nativeItem);
String[] header = getRecordFactory().createHeader(nativeItem, setSpecs);
headers.add(header[0]);
identifiers.add(header[1]);
}
// if (count == maxListSize) {
if (rs.next()) {
StringBuffer resumptionTokenSb = new StringBuffer();
// resumptionTokenSb.append(resumptionId);
// resumptionTokenSb.append(":");
resumptionTokenSb.append(from);
resumptionTokenSb.append(":");
resumptionTokenSb.append(until);
resumptionTokenSb.append(":");
if (set == null)
resumptionTokenSb.append(".");
else
resumptionTokenSb.append(URLEncoder.encode(set, "UTF-8"));
resumptionTokenSb.append(":");
resumptionTokenSb.append(Integer.toString(oldCount + count));
resumptionTokenSb.append(":");
resumptionTokenSb.append(metadataPrefix);
listIdentifiersMap.put("resumptionMap", getResumptionMap(resumptionTokenSb.toString(),
-1,
oldCount));
// listIdentifiersMap.put("resumptionMap",
// getResumptionMap(resumptionTokenSb.toString()));
endConnection(con);
}
} catch (UnsupportedEncodingException e) {
if (con != null)
endConnection(con);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
} catch (SQLException e) {
if (con != null)
endConnection(con);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
listIdentifiersMap.put("headers", headers.iterator());
listIdentifiersMap.put("identifiers", identifiers.iterator());
return listIdentifiersMap;
} | Map function(String resumptionToken) throws BadResumptionTokenException, OAIInternalServerError { Map listIdentifiersMap = new HashMap(); ArrayList headers = new ArrayList(); ArrayList identifiers = new ArrayList(); StringTokenizer tokenizer = new StringTokenizer(resumptionToken, ":"); String from; String until; String set; int oldCount; String metadataPrefix; try { from = tokenizer.nextToken(); until = tokenizer.nextToken(); set = tokenizer.nextToken(); if (set.equals(".")) set = null; oldCount = Integer.parseInt(tokenizer.nextToken()); metadataPrefix = tokenizer.nextToken(); if (debug) { System.out.println(STR + set + "<"); } } catch (NoSuchElementException e) { throw new BadResumptionTokenException(); } Connection con = null; try { con = startConnection(); Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs = stmt.executeQuery(populateRangeQuery(from, until, set, oldCount, maxListSize)); int count; for (count = 0; count < maxListSize && rs.next(); ++count) { HashMap nativeItem = getColumnValues(rs); Iterator setSpecs = getSetSpecs(nativeItem); String[] header = getRecordFactory().createHeader(nativeItem, setSpecs); headers.add(header[0]); identifiers.add(header[1]); } if (rs.next()) { StringBuffer resumptionTokenSb = new StringBuffer(); resumptionTokenSb.append(from); resumptionTokenSb.append(":"); resumptionTokenSb.append(until); resumptionTokenSb.append(":"); if (set == null) resumptionTokenSb.append("."); else resumptionTokenSb.append(URLEncoder.encode(set, "UTF-8")); resumptionTokenSb.append(":"); resumptionTokenSb.append(Integer.toString(oldCount + count)); resumptionTokenSb.append(":"); resumptionTokenSb.append(metadataPrefix); listIdentifiersMap.put(STR, getResumptionMap(resumptionTokenSb.toString(), -1, oldCount)); endConnection(con); } } catch (UnsupportedEncodingException e) { if (con != null) endConnection(con); e.printStackTrace(); throw new OAIInternalServerError(e.getMessage()); } catch (SQLException e) { if (con != null) endConnection(con); e.printStackTrace(); throw new OAIInternalServerError(e.getMessage()); } listIdentifiersMap.put(STR, headers.iterator()); listIdentifiersMap.put(STR, identifiers.iterator()); return listIdentifiersMap; } | /**
* Retrieve the next set of identifiers associated with the resumptionToken
*
* @param resumptionToken implementation-dependent format taken from the
* previous listIdentifiers() Map result.
* @return a Map object containing entries for "headers" and "identifiers" Iterators
* (both containing Strings) as well as an optional "resumptionMap" Map.
* @exception BadResumptionTokenException the value of the resumptionToken
* is invalid or expired.
* @exception OAIInternalServerError signals an http status code 500 problem
*/ | Retrieve the next set of identifiers associated with the resumptionToken | listIdentifiers | {
"repo_name": "openpreserve/oaicat",
"path": "src/main/java/ORG/oclc/oai/server/catalog/JDBCLimitedOAICatalog.java",
"license": "apache-2.0",
"size": 59816
} | [
"java.io.UnsupportedEncodingException",
"java.net.URLEncoder",
"java.sql.Connection",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.Iterator",
"java.util.Map",
"java.util.NoSuchElementException",
"java.util.StringTokenizer"
] | import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; import java.util.StringTokenizer; | import java.io.*; import java.net.*; import java.sql.*; import java.util.*; | [
"java.io",
"java.net",
"java.sql",
"java.util"
] | java.io; java.net; java.sql; java.util; | 664,465 |
private void lstKeywordsValueChanged(final javax.swing.event.ListSelectionEvent evt) { //GEN-FIRST:event_lstKeywordsValueChanged
if (!evt.getValueIsAdjusting()) {
final Object o = lstKeywords.getSelectedValue();
if (o == null) {
infoBoxPanel.setInformation(NbBundle.getMessage(
ResourceWindowSearch.class,
"ResourceWindowSearch.lstKeywordsValueChanged().no")); // NOI18N
} else {
showDescriptionOfSelectedTag(lstKeywords.getSelectedValue());
}
}
} //GEN-LAST:event_lstKeywordsValueChanged | void function(final javax.swing.event.ListSelectionEvent evt) { if (!evt.getValueIsAdjusting()) { final Object o = lstKeywords.getSelectedValue(); if (o == null) { infoBoxPanel.setInformation(NbBundle.getMessage( ResourceWindowSearch.class, STR)); } else { showDescriptionOfSelectedTag(lstKeywords.getSelectedValue()); } } } | /**
* DOCUMENT ME!
*
* @param evt DOCUMENT ME!
*/ | DOCUMENT ME | lstKeywordsValueChanged | {
"repo_name": "switchonproject/cids-custom-switchon",
"path": "src/main/java/de/cismet/cids/custom/switchon/search/ResourceWindowSearch.java",
"license": "lgpl-3.0",
"size": 47929
} | [
"org.openide.util.NbBundle"
] | import org.openide.util.NbBundle; | import org.openide.util.*; | [
"org.openide.util"
] | org.openide.util; | 755,619 |
public RowMetaInterface createResultRowMetaInterface() {
RowMetaInterface rowMetaInterface = new RowMeta();
ValueMetaInterface[] valuesMeta = {
new ValueMeta("Id", ValueMeta.TYPE_INTEGER),
new ValueMeta("State", ValueMeta.TYPE_STRING),
new ValueMeta("City", ValueMeta.TYPE_STRING)
};
for (int i = 0; i < valuesMeta.length; i++) {
rowMetaInterface.addValueMeta(valuesMeta[i]);
}
return rowMetaInterface;
} | RowMetaInterface function() { RowMetaInterface rowMetaInterface = new RowMeta(); ValueMetaInterface[] valuesMeta = { new ValueMeta("Id", ValueMeta.TYPE_INTEGER), new ValueMeta("State", ValueMeta.TYPE_STRING), new ValueMeta("City", ValueMeta.TYPE_STRING) }; for (int i = 0; i < valuesMeta.length; i++) { rowMetaInterface.addValueMeta(valuesMeta[i]); } return rowMetaInterface; } | /**
* Creates a row meta interface for the fields that
* are defined by performing a getFields and by
* checking "Result filenames - Add filenames to result
* from "Text File Input" dialog.
*
* @return
*/ | Creates a row meta interface for the fields that are defined by performing a getFields and by checking "Result filenames - Add filenames to result from "Text File Input" dialog | createResultRowMetaInterface | {
"repo_name": "soluvas/pdi-ce",
"path": "test/org/pentaho/di/trans/steps/jsonoutput/JsonOutputTest.java",
"license": "apache-2.0",
"size": 22922
} | [
"org.pentaho.di.core.row.RowMeta",
"org.pentaho.di.core.row.RowMetaInterface",
"org.pentaho.di.core.row.ValueMeta",
"org.pentaho.di.core.row.ValueMetaInterface"
] | import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMeta; import org.pentaho.di.core.row.ValueMetaInterface; | import org.pentaho.di.core.row.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 1,885,942 |
public static int[] getPixels(BufferedImage img,
int x, int y, int w, int h, int[] pixels) {
if (w == 0 || h == 0) {
return new int[0];
}
if (pixels == null) {
pixels = new int[w * h];
} else if (pixels.length < w * h) {
throw new IllegalArgumentException("pixels array must have a length" +
" >= w*h");
}
int imageType = img.getType();
if (imageType == BufferedImage.TYPE_INT_ARGB ||
imageType == BufferedImage.TYPE_INT_RGB) {
Raster raster = img.getRaster();
return (int[]) raster.getDataElements(x, y, w, h, pixels);
}
// Unmanages the image
return img.getRGB(x, y, w, h, pixels, 0, w);
} | static int[] function(BufferedImage img, int x, int y, int w, int h, int[] pixels) { if (w == 0 h == 0) { return new int[0]; } if (pixels == null) { pixels = new int[w * h]; } else if (pixels.length < w * h) { throw new IllegalArgumentException(STR + STR); } int imageType = img.getType(); if (imageType == BufferedImage.TYPE_INT_ARGB imageType == BufferedImage.TYPE_INT_RGB) { Raster raster = img.getRaster(); return (int[]) raster.getDataElements(x, y, w, h, pixels); } return img.getRGB(x, y, w, h, pixels, 0, w); } | /**
* <p>Returns an array of pixels, stored as integers, from a
* <code>BufferedImage</code>. The pixels are grabbed from a rectangular
* area defined by a location and two dimensions. Calling this method on
* an image of type different from <code>BufferedImage.TYPE_INT_ARGB</code>
* and <code>BufferedImage.TYPE_INT_RGB</code> will unmanage the image.</p>
*
* @param img the source image
* @param x the x location at which to start grabbing pixels
* @param y the y location at which to start grabbing pixels
* @param w the width of the rectangle of pixels to grab
* @param h the height of the rectangle of pixels to grab
* @param pixels a pre-allocated array of pixels of size w*h; can be null
* @return <code>pixels</code> if non-null, a new array of integers
* otherwise
* @throws IllegalArgumentException is <code>pixels</code> is non-null and
* of length < w*h
*/ | Returns an array of pixels, stored as integers, from a <code>BufferedImage</code>. The pixels are grabbed from a rectangular area defined by a location and two dimensions. Calling this method on an image of type different from <code>BufferedImage.TYPE_INT_ARGB</code> and <code>BufferedImage.TYPE_INT_RGB</code> will unmanage the image | getPixels | {
"repo_name": "mmilosavljevic/horizon",
"path": "filemanager/GraphicsUtilities.java",
"license": "gpl-3.0",
"size": 24943
} | [
"java.awt.image.BufferedImage",
"java.awt.image.Raster"
] | import java.awt.image.BufferedImage; import java.awt.image.Raster; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 1,744,013 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.