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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
PagedFlux<ShareItem> listSharesWithOptionalTimeout(String marker, ListSharesOptions options, Duration timeout,
Context context) {
final String prefix = (options != null) ? options.getPrefix() : null;
final Integer maxResultsPerPage = (options != null) ? options.getMaxResultsPerPage() : null;
List<ListSharesIncludeType> include = new ArrayList<>();
if (options != null) {
if (options.isIncludeDeleted()) {
include.add(ListSharesIncludeType.DELETED);
}
if (options.isIncludeMetadata()) {
include.add(ListSharesIncludeType.METADATA);
}
if (options.isIncludeSnapshots()) {
include.add(ListSharesIncludeType.SNAPSHOTS);
}
}
BiFunction<String, Integer, Mono<PagedResponse<ShareItem>>> retriever =
(nextMarker, pageSize) -> StorageImplUtils.applyOptionalTimeout(this.azureFileStorageClient.getServices()
.listSharesSegmentSinglePageAsync(
prefix, nextMarker, pageSize == null ? maxResultsPerPage : pageSize, include, null, context)
.map(response -> {
List<ShareItem> value = response.getValue() == null
? Collections.emptyList()
: response.getValue().stream()
.map(ModelHelper::populateShareItem)
.collect(Collectors.toList());
return new PagedResponseBase<>(response.getRequest(),
response.getStatusCode(),
response.getHeaders(),
value,
response.getContinuationToken(),
ModelHelper.transformListSharesHeaders(response.getHeaders()));
}), timeout);
return new PagedFlux<>(pageSize -> retriever.apply(marker, pageSize), retriever);
}
/**
* Retrieves the properties of the storage account's File service. The properties range from storage analytics and
* metrics to CORS (Cross-Origin Resource Sharing).
*
* <p><strong>Code Samples</strong></p>
*
* <p>Retrieve File service properties</p>
*
* <!-- src_embed com.azure.storage.file.share.ShareServiceAsyncClient.getProperties -->
* <pre>
* fileServiceAsyncClient.getProperties()
* .subscribe(properties -> {
* System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b",
* properties.getHourMetrics().isEnabled(), properties.getMinuteMetrics().isEnabled());
* });
* </pre>
* <!-- end com.azure.storage.file.share.ShareServiceAsyncClient.getProperties -->
*
* <p>For more information, see the
* <a href="https://docs.microsoft.com/rest/api/storageservices/get-file-service-properties">Azure
* Docs</a>.</p>
*
* @return Storage account {@link ShareServiceProperties File service properties} | PagedFlux<ShareItem> listSharesWithOptionalTimeout(String marker, ListSharesOptions options, Duration timeout, Context context) { final String prefix = (options != null) ? options.getPrefix() : null; final Integer maxResultsPerPage = (options != null) ? options.getMaxResultsPerPage() : null; List<ListSharesIncludeType> include = new ArrayList<>(); if (options != null) { if (options.isIncludeDeleted()) { include.add(ListSharesIncludeType.DELETED); } if (options.isIncludeMetadata()) { include.add(ListSharesIncludeType.METADATA); } if (options.isIncludeSnapshots()) { include.add(ListSharesIncludeType.SNAPSHOTS); } } BiFunction<String, Integer, Mono<PagedResponse<ShareItem>>> retriever = (nextMarker, pageSize) -> StorageImplUtils.applyOptionalTimeout(this.azureFileStorageClient.getServices() .listSharesSegmentSinglePageAsync( prefix, nextMarker, pageSize == null ? maxResultsPerPage : pageSize, include, null, context) .map(response -> { List<ShareItem> value = response.getValue() == null ? Collections.emptyList() : response.getValue().stream() .map(ModelHelper::populateShareItem) .collect(Collectors.toList()); return new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), value, response.getContinuationToken(), ModelHelper.transformListSharesHeaders(response.getHeaders())); }), timeout); return new PagedFlux<>(pageSize -> retriever.apply(marker, pageSize), retriever); } /** * Retrieves the properties of the storage account's File service. The properties range from storage analytics and * metrics to CORS (Cross-Origin Resource Sharing). * * <p><strong>Code Samples</strong></p> * * <p>Retrieve File service properties</p> * * <!-- src_embed com.azure.storage.file.share.ShareServiceAsyncClient.getProperties --> * <pre> * fileServiceAsyncClient.getProperties() * .subscribe(properties -> { * System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", * properties.getHourMetrics().isEnabled(), properties.getMinuteMetrics().isEnabled()); * }); * </pre> * <!-- end com.azure.storage.file.share.ShareServiceAsyncClient.getProperties --> * * <p>For more information, see the * <a href="https: * Docs</a>.</p> * * @return Storage account {@link ShareServiceProperties File service properties} | /**
* Lists the shares in the storage account that pass the filter starting at the specified marker.
*
* @param marker Starting point to list the shares
* @param options Options for listing shares
* @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout
* concludes a {@link RuntimeException} will be thrown.
* @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements
*/ | Lists the shares in the storage account that pass the filter starting at the specified marker | listSharesWithOptionalTimeout | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/ShareServiceAsyncClient.java",
"license": "mit",
"size": 42555
} | [
"com.azure.core.http.rest.PagedFlux",
"com.azure.core.http.rest.PagedResponse",
"com.azure.core.http.rest.PagedResponseBase",
"com.azure.core.util.Context",
"com.azure.storage.common.implementation.StorageImplUtils",
"com.azure.storage.file.share.implementation.models.ListSharesIncludeType",
"com.azure.... | import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.storage.common.implementation.StorageImplUtils; import com.azure.storage.file.share.implementation.models.ListSharesIncludeType; import com.azure.storage.file.share.implementation.util.ModelHelper; import com.azure.storage.file.share.models.ListSharesOptions; import com.azure.storage.file.share.models.ShareItem; import com.azure.storage.file.share.models.ShareServiceProperties; import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.BiFunction; import java.util.stream.Collectors; | import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.storage.common.implementation.*; import com.azure.storage.file.share.implementation.models.*; import com.azure.storage.file.share.implementation.util.*; import com.azure.storage.file.share.models.*; import java.time.*; import java.util.*; import java.util.function.*; import java.util.stream.*; | [
"com.azure.core",
"com.azure.storage",
"java.time",
"java.util"
] | com.azure.core; com.azure.storage; java.time; java.util; | 2,175,438 |
@Override
public TileEntity createNewTileEntity(World var1)
{
return null;
} | TileEntity function(World var1) { return null; } | /**
* Returns the TileEntity used by this block. You should use the metadata sensitive version of
* this to get the maximum optimization!
*/ | Returns the TileEntity used by this block. You should use the metadata sensitive version of this to get the maximum optimization | createNewTileEntity | {
"repo_name": "hunator/Galacticraft",
"path": "common/micdoodle8/mods/galacticraft/core/blocks/GCCoreBlockTile.java",
"license": "lgpl-3.0",
"size": 3637
} | [
"net.minecraft.tileentity.TileEntity",
"net.minecraft.world.World"
] | import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; | import net.minecraft.tileentity.*; import net.minecraft.world.*; | [
"net.minecraft.tileentity",
"net.minecraft.world"
] | net.minecraft.tileentity; net.minecraft.world; | 2,514,191 |
@Override public void exitTypedRecordFields(@NotNull ErlangParser.TypedRecordFieldsContext ctx) { } | @Override public void exitTypedRecordFields(@NotNull ErlangParser.TypedRecordFieldsContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | enterTypedRecordFields | {
"repo_name": "lyskouski/erlang-netbeans",
"path": "src/by/creativity/erlang/lexer/ErlangBaseListener.java",
"license": "gpl-2.0",
"size": 35296
} | [
"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; | 2,291,957 |
public void saveScholarship (ScholarshipModel scholarship) throws IOException {
FileOutputStream fileOutputStream = new FileOutputStream("out.bin");
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
objectOutputStream.writeObject(scholarship);
objectOutputStream.close();
}
| void function (ScholarshipModel scholarship) throws IOException { FileOutputStream fileOutputStream = new FileOutputStream(STR); ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream); objectOutputStream.writeObject(scholarship); objectOutputStream.close(); } | /**
* Saves a scholarship
* @param filename file being saved to
* @param scholarship scholarship object being saved
* @throws IOException
*/ | Saves a scholarship | saveScholarship | {
"repo_name": "MarsEdge/OUCS2334",
"path": "Project4/src/ScholarshipModel.java",
"license": "gpl-3.0",
"size": 5884
} | [
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.ObjectOutputStream"
] | import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,162,859 |
private static ImmutableMap<BuildTarget, IjModule> createModules(
TargetGraph targetGraph,
IjModuleFactory moduleFactory,
final int minimumPathDepth) {
final BlockedPathNode blockedPathTree = createAggregationHaltPoints(targetGraph); | static ImmutableMap<BuildTarget, IjModule> function( TargetGraph targetGraph, IjModuleFactory moduleFactory, final int minimumPathDepth) { final BlockedPathNode blockedPathTree = createAggregationHaltPoints(targetGraph); | /**
* Create all the modules we are capable of representing in IntelliJ from the supplied graph.
*
* @param targetGraph graph whose nodes will be converted to {@link IjModule}s.
* @return map which for every BuildTarget points to the corresponding IjModule. Multiple
* BuildTarget can point to one IjModule (many:one mapping), the BuildTargets which
* can't be prepresented in IntelliJ are missing from this mapping.
*/ | Create all the modules we are capable of representing in IntelliJ from the supplied graph | createModules | {
"repo_name": "janicduplessis/buck",
"path": "src/com/facebook/buck/jvm/java/intellij/IjModuleGraph.java",
"license": "apache-2.0",
"size": 16756
} | [
"com.facebook.buck.model.BuildTarget",
"com.facebook.buck.rules.TargetGraph",
"com.google.common.collect.ImmutableMap"
] | import com.facebook.buck.model.BuildTarget; import com.facebook.buck.rules.TargetGraph; import com.google.common.collect.ImmutableMap; | import com.facebook.buck.model.*; import com.facebook.buck.rules.*; import com.google.common.collect.*; | [
"com.facebook.buck",
"com.google.common"
] | com.facebook.buck; com.google.common; | 2,746,473 |
public OperationFuture<List<Server>> setAutoscalePolicyOnServer(
AutoscalePolicy autoscalePolicy,
Server... servers
) {
return setAutoscalePolicyOnServer(autoscalePolicy, Arrays.asList(servers));
} | OperationFuture<List<Server>> function( AutoscalePolicy autoscalePolicy, Server... servers ) { return setAutoscalePolicyOnServer(autoscalePolicy, Arrays.asList(servers)); } | /**
* set autoscale policy on servers
*
* @param autoscalePolicy autoscale policy
* @param servers servers
* @return OperationFuture wrapper for servers
*/ | set autoscale policy on servers | setAutoscalePolicyOnServer | {
"repo_name": "CenturyLinkCloud/clc-java-sdk",
"path": "sdk/src/main/java/com/centurylink/cloud/sdk/policy/services/dsl/AutoscalePolicyService.java",
"license": "apache-2.0",
"size": 8024
} | [
"com.centurylink.cloud.sdk.base.services.dsl.domain.queue.OperationFuture",
"com.centurylink.cloud.sdk.policy.services.dsl.domain.autoscale.refs.AutoscalePolicy",
"com.centurylink.cloud.sdk.server.services.dsl.domain.server.refs.Server",
"java.util.Arrays",
"java.util.List"
] | import com.centurylink.cloud.sdk.base.services.dsl.domain.queue.OperationFuture; import com.centurylink.cloud.sdk.policy.services.dsl.domain.autoscale.refs.AutoscalePolicy; import com.centurylink.cloud.sdk.server.services.dsl.domain.server.refs.Server; import java.util.Arrays; import java.util.List; | import com.centurylink.cloud.sdk.base.services.dsl.domain.queue.*; import com.centurylink.cloud.sdk.policy.services.dsl.domain.autoscale.refs.*; import com.centurylink.cloud.sdk.server.services.dsl.domain.server.refs.*; import java.util.*; | [
"com.centurylink.cloud",
"java.util"
] | com.centurylink.cloud; java.util; | 1,288,887 |
public static List<Criterion> notBetween(final String operand, final Object value1, final Object value2) {
// Initialize.
List<Criterion> criterions = new ArrayList<Criterion>();
// x NOT BETWEEN y AND z is equivalent to x < y OR x > z
criterions.add(Comparison.operation(Comparison.Operator.LESS_THAN, operand, value1));
criterions.add(Logical.or(Comparison.operation(Comparison.Operator.GREATER_THAN, operand, value2)));
return criterions;
} | static List<Criterion> function(final String operand, final Object value1, final Object value2) { List<Criterion> criterions = new ArrayList<Criterion>(); criterions.add(Comparison.operation(Comparison.Operator.LESS_THAN, operand, value1)); criterions.add(Logical.or(Comparison.operation(Comparison.Operator.GREATER_THAN, operand, value2))); return criterions; } | /**
* Not between comparison operation.
*
* @param operand the operand.
* @param value1 the first value.
* @param value2 the second value.
*
* @return the resulting criterions.
*/ | Not between comparison operation | notBetween | {
"repo_name": "lazydog-org/repository-parent",
"path": "repository-api/src/main/java/org/lazydog/repository/criterion/Comparison.java",
"license": "lgpl-3.0",
"size": 11418
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,325,615 |
public SwipeBack setSwipeBackView(int layoutResId) {
mSwipeBackContainer.removeAllViews();
mSwipeBackView = LayoutInflater.from(getContext()).inflate(layoutResId,
mSwipeBackContainer, false);
mSwipeBackContainer.addView(mSwipeBackView);
notifySwipeBackViewCreated(mSwipeBackView);
return this;
} | SwipeBack function(int layoutResId) { mSwipeBackContainer.removeAllViews(); mSwipeBackView = LayoutInflater.from(getContext()).inflate(layoutResId, mSwipeBackContainer, false); mSwipeBackContainer.addView(mSwipeBackView); notifySwipeBackViewCreated(mSwipeBackView); return this; } | /**
* Set the swipe back view from a layout resource.
*
* @param layoutResId
* Resource ID to be inflated.
*/ | Set the swipe back view from a layout resource | setSwipeBackView | {
"repo_name": "iainconnor/SwipeBack",
"path": "library/src/com/hannesdorfmann/swipeback/SwipeBack.java",
"license": "apache-2.0",
"size": 40503
} | [
"android.view.LayoutInflater"
] | import android.view.LayoutInflater; | import android.view.*; | [
"android.view"
] | android.view; | 2,286,273 |
@Test(groups = { "unit" }, dataProvider = "documentUrl")
public void createWithResourceNameURL(String documentUrlWithId, String documentUrlWithName,
OperationType operationType) {
RxDocumentServiceRequest request = RxDocumentServiceRequest.create(mockDiagnosticsClientContext(),
operationType,
ResourceType.Document,
documentUrlWithName,
new HashedMap<String, String>(), AuthorizationTokenType.PrimaryMasterKey);
assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey);
assertThat(request.getResourceAddress())
.isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT));
assertThat(request.getResourceId()).isNull();
Document document = getDocumentDefinition();
byte[] bytes = document.toJson().getBytes(StandardCharsets.UTF_8);
request = RxDocumentServiceRequest.create(mockDiagnosticsClientContext(),
operationType,
ResourceType.Document,
documentUrlWithName,
bytes,
new HashedMap<String, String>(),
AuthorizationTokenType.SecondaryMasterKey);
assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.SecondaryMasterKey);
assertThat(request.getResourceAddress())
.isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT));
assertThat(request.getResourceId()).isNull();
assertThat(request.getContentAsByteArray()).isEqualTo(bytes);
// Creating one request without giving AuthorizationTokenType , it should take
// PrimaryMasterKey by default
request = RxDocumentServiceRequest.create(mockDiagnosticsClientContext(),
operationType,
ResourceType.Document,
documentUrlWithName,
new HashedMap<String, String>());
assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey);
assertThat(request.getResourceAddress())
.isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT));
assertThat(request.getResourceId()).isNull();
} | @Test(groups = { "unit" }, dataProvider = STR) void function(String documentUrlWithId, String documentUrlWithName, OperationType operationType) { RxDocumentServiceRequest request = RxDocumentServiceRequest.create(mockDiagnosticsClientContext(), operationType, ResourceType.Document, documentUrlWithName, new HashedMap<String, String>(), AuthorizationTokenType.PrimaryMasterKey); assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); assertThat(request.getResourceAddress()) .isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT)); assertThat(request.getResourceId()).isNull(); Document document = getDocumentDefinition(); byte[] bytes = document.toJson().getBytes(StandardCharsets.UTF_8); request = RxDocumentServiceRequest.create(mockDiagnosticsClientContext(), operationType, ResourceType.Document, documentUrlWithName, bytes, new HashedMap<String, String>(), AuthorizationTokenType.SecondaryMasterKey); assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.SecondaryMasterKey); assertThat(request.getResourceAddress()) .isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT)); assertThat(request.getResourceId()).isNull(); assertThat(request.getContentAsByteArray()).isEqualTo(bytes); request = RxDocumentServiceRequest.create(mockDiagnosticsClientContext(), operationType, ResourceType.Document, documentUrlWithName, new HashedMap<String, String>()); assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); assertThat(request.getResourceAddress()) .isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT)); assertThat(request.getResourceId()).isNull(); } | /**
* This test case will cover various create method through resource url with name in detail for document resource.
* @param documentUrlWithId Document url with id
* @param documentUrlWithName Document url with name
* @param operationType Operation type
*/ | This test case will cover various create method through resource url with name in detail for document resource | createWithResourceNameURL | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cosmos/azure-cosmos/src/test/java/com/azure/cosmos/implementation/RxDocumentServiceRequestTest.java",
"license": "mit",
"size": 28567
} | [
"java.nio.charset.StandardCharsets",
"org.apache.commons.collections4.map.HashedMap",
"org.apache.commons.lang3.StringUtils",
"org.assertj.core.api.Assertions",
"org.testng.annotations.Test"
] | import java.nio.charset.StandardCharsets; import org.apache.commons.collections4.map.HashedMap; import org.apache.commons.lang3.StringUtils; import org.assertj.core.api.Assertions; import org.testng.annotations.Test; | import java.nio.charset.*; import org.apache.commons.collections4.map.*; import org.apache.commons.lang3.*; import org.assertj.core.api.*; import org.testng.annotations.*; | [
"java.nio",
"org.apache.commons",
"org.assertj.core",
"org.testng.annotations"
] | java.nio; org.apache.commons; org.assertj.core; org.testng.annotations; | 997,825 |
@SmallTest
public void testChangeCursorColumns() {
TestSimpleCursorAdapter ca = new TestSimpleCursorAdapter(mContext, mLayout, mCursor2x2,
mFrom, mTo);
// check columns of original - mFrom and mTo should line up
int[] columns = ca.getConvertedFrom();
assertEquals(columns[0], 0);
assertEquals(columns[1], 1);
// Now make a new cursor with similar data but rearrange the columns
String[] swappedFrom = new String[]{"Column2", "Column1", "_id"};
Cursor c2 = createCursor(swappedFrom, mData2x2);
ca.changeCursor(c2);
assertEquals(2, ca.getCount());
// check columns to see if rearrangement tracked (should be swapped now)
columns = ca.getConvertedFrom();
assertEquals(columns[0], 1);
assertEquals(columns[1], 0);
} | void function() { TestSimpleCursorAdapter ca = new TestSimpleCursorAdapter(mContext, mLayout, mCursor2x2, mFrom, mTo); int[] columns = ca.getConvertedFrom(); assertEquals(columns[0], 0); assertEquals(columns[1], 1); String[] swappedFrom = new String[]{STR, STR, "_id"}; Cursor c2 = createCursor(swappedFrom, mData2x2); ca.changeCursor(c2); assertEquals(2, ca.getCount()); columns = ca.getConvertedFrom(); assertEquals(columns[0], 1); assertEquals(columns[1], 0); } | /**
* Test changeCursor() with differing column layout. This confirms that the Adapter can
* deal with cursors that have the same essential data (as defined by the original mFrom
* array) but it's OK if the physical structure of the cursor changes (columns rearranged).
*/ | Test changeCursor() with differing column layout. This confirms that the Adapter can deal with cursors that have the same essential data (as defined by the original mFrom array) but it's OK if the physical structure of the cursor changes (columns rearranged) | testChangeCursorColumns | {
"repo_name": "xorware/android_frameworks_base",
"path": "core/tests/coretests/src/android/widget/SimpleCursorAdapterTest.java",
"license": "apache-2.0",
"size": 9391
} | [
"android.database.Cursor"
] | import android.database.Cursor; | import android.database.*; | [
"android.database"
] | android.database; | 2,605,342 |
@Test()
public void testDeregisterAllDevicesSuccess()
throws Exception
{
final String[] args =
{
"--hostname", "127.0.0.1",
"--port", String.valueOf(successDS.getListenPort()),
"--bindDN", "cn=Directory Manager",
"--bindPassword", "password",
"--deregister",
"--authID", "u:test.user",
"--userPassword", "userPassword"
};
final ResultCode rc = RegisterYubiKeyOTPDevice.main(args, null, null);
assertEquals(rc, ResultCode.SUCCESS);
} | @Test() void function() throws Exception { final String[] args = { STR, STR, STR, String.valueOf(successDS.getListenPort()), STR, STR, STR, STR, STR, STR, STR, STR, STR }; final ResultCode rc = RegisterYubiKeyOTPDevice.main(args, null, null); assertEquals(rc, ResultCode.SUCCESS); } | /**
* Tests the behavior when attempting to deregister all devices for a
* specified user when a success result is expected.
*
* @throws Exception If an unexpected problem occurs.
*/ | Tests the behavior when attempting to deregister all devices for a specified user when a success result is expected | testDeregisterAllDevicesSuccess | {
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/RegisterYubiKeyOTPDeviceTestCase.java",
"license": "gpl-2.0",
"size": 15201
} | [
"com.unboundid.ldap.sdk.ResultCode",
"org.testng.annotations.Test"
] | import com.unboundid.ldap.sdk.ResultCode; import org.testng.annotations.Test; | import com.unboundid.ldap.sdk.*; import org.testng.annotations.*; | [
"com.unboundid.ldap",
"org.testng.annotations"
] | com.unboundid.ldap; org.testng.annotations; | 2,527,282 |
public Paint getLinePaint() {
return this.linePaint;
}
| Paint function() { return this.linePaint; } | /**
* Returns the line paint.
*
* @return The paint.
*
* @see #setLinePaint(Paint)
*/ | Returns the line paint | getLinePaint | {
"repo_name": "apetresc/JFreeChart",
"path": "src/main/java/org/jfree/chart/title/LegendGraphic.java",
"license": "lgpl-2.1",
"size": 22996
} | [
"java.awt.Paint"
] | import java.awt.Paint; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,382,819 |
Optional<Filter> legacyFilter() {
final List<Filter> statements = new ArrayList<>();
if (filter.isPresent()) {
statements.add(filter.get());
}
if (tags.isPresent()) {
for (final Map.Entry<String, String> entry : tags.get().entrySet()) {
statements.add(new MatchTagFilter(entry.getKey(), entry.getValue()));
}
}
if (key.isPresent()) {
statements.add(new MatchKeyFilter(key.get()));
}
if (statements.isEmpty()) {
return Optional.empty();
}
if (statements.size() == 1) {
return Optional.of(statements.get(0).optimize());
}
return Optional.of(new AndFilter(statements).optimize());
} | Optional<Filter> legacyFilter() { final List<Filter> statements = new ArrayList<>(); if (filter.isPresent()) { statements.add(filter.get()); } if (tags.isPresent()) { for (final Map.Entry<String, String> entry : tags.get().entrySet()) { statements.add(new MatchTagFilter(entry.getKey(), entry.getValue())); } } if (key.isPresent()) { statements.add(new MatchKeyFilter(key.get())); } if (statements.isEmpty()) { return Optional.empty(); } if (statements.size() == 1) { return Optional.of(statements.get(0).optimize()); } return Optional.of(new AndFilter(statements).optimize()); } | /**
* Convert a MetricsRequest into a filter.
* <p>
* This is meant to stay backwards compatible, since every filtering in MetricsRequest can be
* expressed as filter objects.
*/ | Convert a MetricsRequest into a filter. This is meant to stay backwards compatible, since every filtering in MetricsRequest can be expressed as filter objects | legacyFilter | {
"repo_name": "lucilecoutouly/heroic",
"path": "heroic-component/src/main/java/com/spotify/heroic/QueryBuilder.java",
"license": "apache-2.0",
"size": 6930
} | [
"com.spotify.heroic.filter.AndFilter",
"com.spotify.heroic.filter.Filter",
"com.spotify.heroic.filter.MatchKeyFilter",
"com.spotify.heroic.filter.MatchTagFilter",
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"java.util.Optional"
] | import com.spotify.heroic.filter.AndFilter; import com.spotify.heroic.filter.Filter; import com.spotify.heroic.filter.MatchKeyFilter; import com.spotify.heroic.filter.MatchTagFilter; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; | import com.spotify.heroic.filter.*; import java.util.*; | [
"com.spotify.heroic",
"java.util"
] | com.spotify.heroic; java.util; | 2,314,807 |
void onHeadExtraContent() throws JspException; | void onHeadExtraContent() throws JspException; | /**
* With this hook one can insert content in the heading
*
* @throws JspException
* exception
*/ | With this hook one can insert content in the heading | onHeadExtraContent | {
"repo_name": "xkollar/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/taglibs/list/decorators/ListDecorator.java",
"license": "gpl-2.0",
"size": 4273
} | [
"javax.servlet.jsp.JspException"
] | import javax.servlet.jsp.JspException; | import javax.servlet.jsp.*; | [
"javax.servlet"
] | javax.servlet; | 2,622,066 |
public int getComplexRegion(Object receiver, int startIndex, int size, Object buffer, InteropLibrary bufferInterop) {
return getRegion(receiver, startIndex, size, buffer, bufferInterop, RType.Complex);
} | int function(Object receiver, int startIndex, int size, Object buffer, InteropLibrary bufferInterop) { return getRegion(receiver, startIndex, size, buffer, bufferInterop, RType.Complex); } | /**
* See {@link #getIntRegion}.
*/ | See <code>#getIntRegion</code> | getComplexRegion | {
"repo_name": "graalvm/fastr",
"path": "com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/VectorDataLibrary.java",
"license": "gpl-2.0",
"size": 99922
} | [
"com.oracle.truffle.api.interop.InteropLibrary",
"com.oracle.truffle.r.runtime.RType"
] | import com.oracle.truffle.api.interop.InteropLibrary; import com.oracle.truffle.r.runtime.RType; | import com.oracle.truffle.api.interop.*; import com.oracle.truffle.r.runtime.*; | [
"com.oracle.truffle"
] | com.oracle.truffle; | 2,731,411 |
void setType(TypeType value); | void setType(TypeType value); | /**
* Sets the value of the '{@link net.opengis.gml311.CurvePropertyType#getType <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Type</em>' attribute.
* @see org.w3.xlink.TypeType
* @see #isSetType()
* @see #unsetType()
* @see #getType()
* @generated
*/ | Sets the value of the '<code>net.opengis.gml311.CurvePropertyType#getType Type</code>' attribute. | setType | {
"repo_name": "geotools/geotools",
"path": "modules/ogc/net.opengis.wmts/src/net/opengis/gml311/CurvePropertyType.java",
"license": "lgpl-2.1",
"size": 14519
} | [
"org.w3.xlink.TypeType"
] | import org.w3.xlink.TypeType; | import org.w3.xlink.*; | [
"org.w3.xlink"
] | org.w3.xlink; | 1,502,797 |
public float cleanupProgress() throws IOException {
try {
return job.cleanupProgress();
} catch (InterruptedException ie) {
throw new IOException(ie);
}
} | float function() throws IOException { try { return job.cleanupProgress(); } catch (InterruptedException ie) { throw new IOException(ie); } } | /**
* A float between 0.0 and 1.0, indicating the % of cleanup work
* completed.
*/ | A float between 0.0 and 1.0, indicating the % of cleanup work completed | cleanupProgress | {
"repo_name": "robzor92/hops",
"path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobClient.java",
"license": "apache-2.0",
"size": 39958
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,049,666 |
public void setExpression(JRExpression expression)
{
Object old = this.expression;
this.expression = expression;
getEventSupport().firePropertyChange(PROPERTY_EXPRESSION, old, this.expression);
}
/**
* Sets the sorting type.
*
* @param orderValue one of
* <ul>
* <li>{@link SortOrderEnum#ASCENDING SortOrderEnum.ASCENDING}</li>
* <li>{@link SortOrderEnum#DESCENDING SortOrderEnum.DESCENDING}</li>
* </ul>
* @see DataLevelBucket#getOrderValue()
*
* @deprecated replaced by {@link #setOrder(BucketOrder)} | void function(JRExpression expression) { Object old = this.expression; this.expression = expression; getEventSupport().firePropertyChange(PROPERTY_EXPRESSION, old, this.expression); } /** * Sets the sorting type. * * @param orderValue one of * <ul> * <li>{@link SortOrderEnum#ASCENDING SortOrderEnum.ASCENDING}</li> * <li>{@link SortOrderEnum#DESCENDING SortOrderEnum.DESCENDING}</li> * </ul> * @see DataLevelBucket#getOrderValue() * * @deprecated replaced by {@link #setOrder(BucketOrder)} | /**
* Sets the grouping expression.
*
* @param expression the grouping expression
* @see DataLevelBucket#getExpression()
*/ | Sets the grouping expression | setExpression | {
"repo_name": "juniormesquitadandao/report4all",
"path": "lib/src/net/sf/jasperreports/engine/analytics/dataset/DesignDataLevelBucket.java",
"license": "mit",
"size": 5349
} | [
"net.sf.jasperreports.engine.JRExpression",
"net.sf.jasperreports.engine.type.SortOrderEnum"
] | import net.sf.jasperreports.engine.JRExpression; import net.sf.jasperreports.engine.type.SortOrderEnum; | import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.type.*; | [
"net.sf.jasperreports"
] | net.sf.jasperreports; | 2,368,160 |
public ReverseDepBuildTargetsQueue createBuildTargetsQueue(
Iterable<BuildTarget> targetsToBuild,
CoordinatorBuildRuleEventsPublisher coordinatorBuildRuleEventsPublisher,
int mostBuildRulesFinishedPercentageThreshold) {
LOG.info("Starting to create the %s.", BuildTargetsQueue.class.getName());
GraphTraversalData results = traverseGraphFromTopLevelUsingAvailableCaches(targetsToBuild);
// Notify distributed build clients that they should not wait for any of the nodes that were
// pruned (as they will never be built remotely)
ImmutableList<String> prunedTargets =
ImmutableList.copyOf(
results
.prunedRules
.stream()
.filter(BuildRule::isCacheable) // Client always skips uncacheables
.map(BuildRule::getFullyQualifiedName)
.collect(Collectors.toList()));
int numTotalCachableRules =
results.visitedRules.size() - results.uncachableTargets.size() + prunedTargets.size();
LOG.info(
String.format(
"[%d/%d] cacheable build rules were pruned from graph.",
prunedTargets.size(), numTotalCachableRules));
coordinatorBuildRuleEventsPublisher.createBuildRuleStartedEvents(prunedTargets);
coordinatorBuildRuleEventsPublisher.createBuildRuleCompletionEvents(prunedTargets);
if (shouldBuildSelectedTargetsLocally) {
// Consider all (transitively) 'buildLocally' rules as uncachable for DistBuild purposes - we
// cannot build them remotely and, hence, we cannot put them in cache for local client to
// consume.
// NOTE: this needs to be after uncacheability property is used for graph nodes visiting (and,
// hence, pruning and scheduling) - we want caches to be checked for these rules while doing
// the visiting (local build could have uploaded artifacts for these rules).
ImmutableList<String> transitiveBuildLocallyTargets =
ImmutableList.copyOf(findTransitiveBuildLocallyTargets(results));
results.uncachableTargets.addAll(transitiveBuildLocallyTargets);
// Unlock all rules which will not be built remotely so that local client does not get stuck
// waiting for them (some of them may be cachable from client point of view). DO NOT use
// completed/finished events as we are building deps of these rules remotely.
coordinatorBuildRuleEventsPublisher.createBuildRuleUnlockedEvents(
transitiveBuildLocallyTargets);
}
// Do the reference counting and create the EnqueuedTargets.
ImmutableSet.Builder<DistributableNode> zeroDependencyNodes = ImmutableSet.builder();
ImmutableMap.Builder<String, DistributableNode> allNodes = ImmutableMap.builder();
for (BuildRule buildRule : results.visitedRules) {
String target = buildRule.getFullyQualifiedName();
Iterable<String> currentRevDeps;
if (results.allReverseDeps.containsKey(target)) {
currentRevDeps = results.allReverseDeps.get(target);
} else {
currentRevDeps = new ArrayList<>();
}
DistributableNode distributableNode =
new DistributableNode(
target,
ImmutableSet.copyOf(currentRevDeps),
ImmutableSet.copyOf(Objects.requireNonNull(results.allForwardDeps.get(target))),
results.uncachableTargets.contains(target));
allNodes.put(target, distributableNode);
if (distributableNode.areAllDependenciesResolved()) {
zeroDependencyNodes.add(distributableNode);
}
}
// Wait for local uploads (in case of local coordinator) to finish.
try {
LOG.info("Waiting for cache uploads to finish.");
Futures.allAsList(artifactCache.getAllUploadRuleFutures()).get();
} catch (InterruptedException | ExecutionException e) {
LOG.error(e, "Failed to upload artifacts from the local cache.");
}
return new ReverseDepBuildTargetsQueue(
new DistributableBuildGraph(allNodes.build(), zeroDependencyNodes.build()),
mostBuildRulesFinishedPercentageThreshold);
} | ReverseDepBuildTargetsQueue function( Iterable<BuildTarget> targetsToBuild, CoordinatorBuildRuleEventsPublisher coordinatorBuildRuleEventsPublisher, int mostBuildRulesFinishedPercentageThreshold) { LOG.info(STR, BuildTargetsQueue.class.getName()); GraphTraversalData results = traverseGraphFromTopLevelUsingAvailableCaches(targetsToBuild); ImmutableList<String> prunedTargets = ImmutableList.copyOf( results .prunedRules .stream() .filter(BuildRule::isCacheable) .map(BuildRule::getFullyQualifiedName) .collect(Collectors.toList())); int numTotalCachableRules = results.visitedRules.size() - results.uncachableTargets.size() + prunedTargets.size(); LOG.info( String.format( STR, prunedTargets.size(), numTotalCachableRules)); coordinatorBuildRuleEventsPublisher.createBuildRuleStartedEvents(prunedTargets); coordinatorBuildRuleEventsPublisher.createBuildRuleCompletionEvents(prunedTargets); if (shouldBuildSelectedTargetsLocally) { ImmutableList<String> transitiveBuildLocallyTargets = ImmutableList.copyOf(findTransitiveBuildLocallyTargets(results)); results.uncachableTargets.addAll(transitiveBuildLocallyTargets); coordinatorBuildRuleEventsPublisher.createBuildRuleUnlockedEvents( transitiveBuildLocallyTargets); } ImmutableSet.Builder<DistributableNode> zeroDependencyNodes = ImmutableSet.builder(); ImmutableMap.Builder<String, DistributableNode> allNodes = ImmutableMap.builder(); for (BuildRule buildRule : results.visitedRules) { String target = buildRule.getFullyQualifiedName(); Iterable<String> currentRevDeps; if (results.allReverseDeps.containsKey(target)) { currentRevDeps = results.allReverseDeps.get(target); } else { currentRevDeps = new ArrayList<>(); } DistributableNode distributableNode = new DistributableNode( target, ImmutableSet.copyOf(currentRevDeps), ImmutableSet.copyOf(Objects.requireNonNull(results.allForwardDeps.get(target))), results.uncachableTargets.contains(target)); allNodes.put(target, distributableNode); if (distributableNode.areAllDependenciesResolved()) { zeroDependencyNodes.add(distributableNode); } } try { LOG.info(STR); Futures.allAsList(artifactCache.getAllUploadRuleFutures()).get(); } catch (InterruptedException ExecutionException e) { LOG.error(e, STR); } return new ReverseDepBuildTargetsQueue( new DistributableBuildGraph(allNodes.build(), zeroDependencyNodes.build()), mostBuildRulesFinishedPercentageThreshold); } | /**
* Create {@link BuildTargetsQueue} with the given parameters.
*
* @param targetsToBuild top-level targets that need to be built.
* @return an instance of {@link BuildTargetsQueue} with the top-level targets at the root.
*/ | Create <code>BuildTargetsQueue</code> with the given parameters | createBuildTargetsQueue | {
"repo_name": "brettwooldridge/buck",
"path": "src/com/facebook/buck/distributed/build_slave/CacheOptimizedBuildTargetsQueueFactory.java",
"license": "apache-2.0",
"size": 16944
} | [
"com.facebook.buck.core.model.BuildTarget",
"com.facebook.buck.core.rules.BuildRule",
"com.facebook.buck.distributed.build_slave.DistributableBuildGraph",
"com.google.common.collect.ImmutableList",
"com.google.common.collect.ImmutableMap",
"com.google.common.collect.ImmutableSet",
"com.google.common.uti... | import com.facebook.buck.core.model.BuildTarget; import com.facebook.buck.core.rules.BuildRule; import com.facebook.buck.distributed.build_slave.DistributableBuildGraph; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.Futures; import java.util.ArrayList; import java.util.Objects; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; | import com.facebook.buck.core.model.*; import com.facebook.buck.core.rules.*; import com.facebook.buck.distributed.build_slave.*; import com.google.common.collect.*; import com.google.common.util.concurrent.*; import java.util.*; import java.util.concurrent.*; import java.util.stream.*; | [
"com.facebook.buck",
"com.google.common",
"java.util"
] | com.facebook.buck; com.google.common; java.util; | 1,253,905 |
File file1 = (File)obj1;
File file2 = (File)obj2;
long size1 = 0;
if (file1.isDirectory()) {
size1 = sumDirectoryContents && file1.exists() ? FileUtils.sizeOfDirectory(file1) : 0;
} else {
size1 = file1.length();
}
long size2 = 0;
if (file2.isDirectory()) {
size2 = sumDirectoryContents && file2.exists() ? FileUtils.sizeOfDirectory(file2) : 0;
} else {
size2 = file2.length();
}
long result = size1 - size2;
if (result < 0) {
return -1;
} else if (result > 0) {
return 1;
} else {
return 0;
}
} | File file1 = (File)obj1; File file2 = (File)obj2; long size1 = 0; if (file1.isDirectory()) { size1 = sumDirectoryContents && file1.exists() ? FileUtils.sizeOfDirectory(file1) : 0; } else { size1 = file1.length(); } long size2 = 0; if (file2.isDirectory()) { size2 = sumDirectoryContents && file2.exists() ? FileUtils.sizeOfDirectory(file2) : 0; } else { size2 = file2.length(); } long result = size1 - size2; if (result < 0) { return -1; } else if (result > 0) { return 1; } else { return 0; } } | /**
* Compare the length of two files.
*
* @param obj1 The first file to compare
* @param obj2 The second file to compare
* @return a negative value if the first file's length
* is less than the second, zero if the lengths are the
* same and a positive value if the first files length
* is greater than the second file.
*
*/ | Compare the length of two files | compare | {
"repo_name": "wiyarmir/GPT-Organize",
"path": "src/org/apache/commons/io/comparator/SizeFileComparator.java",
"license": "gpl-3.0",
"size": 4987
} | [
"java.io.File",
"org.apache.commons.io.FileUtils"
] | import java.io.File; import org.apache.commons.io.FileUtils; | import java.io.*; import org.apache.commons.io.*; | [
"java.io",
"org.apache.commons"
] | java.io; org.apache.commons; | 1,074,277 |
EDataType getUnsignedByteObject(); | EDataType getUnsignedByteObject(); | /**
* Returns the meta object for data type '{@link java.lang.Short <em>Unsigned Byte Object</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for data type '<em>Unsigned Byte Object</em>'.
* @see java.lang.Short
* @model instanceClass="java.lang.Short"
* extendedMetaData="name='unsignedByte:Object' baseType='unsignedByte'"
* @generated
*/ | Returns the meta object for data type '<code>java.lang.Short Unsigned Byte Object</code>'. | getUnsignedByteObject | {
"repo_name": "markus1978/clickwatch",
"path": "external/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/XMLTypePackage.java",
"license": "apache-2.0",
"size": 81795
} | [
"org.eclipse.emf.ecore.EDataType"
] | import org.eclipse.emf.ecore.EDataType; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,176,608 |
void decode(InputStream input, OutputStream output, String charsetName) throws IOException; | void decode(InputStream input, OutputStream output, String charsetName) throws IOException; | /**
* Decode a Calabrian text, read from the input, into Italian, written directly to the output., specifying the char set.
*
* @param input the input where the Calabrian text is read
* @param output the output where the Italian text is written
* @param charsetName the input/output text char set
* @throws IOException if any read/write error occurs
*/ | Decode a Calabrian text, read from the input, into Italian, written directly to the output., specifying the char set | decode | {
"repo_name": "tteofili/calabrize",
"path": "src/main/java/com/github/tteofili/calabrize/CalabrianDecoder.java",
"license": "apache-2.0",
"size": 2449
} | [
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,280,733 |
public Iterator<BusinessDayConvention> enumerateAvailableBusinessDayConventions() {
return Iterators.unmodifiableIterator(_conventions.iterator());
} | Iterator<BusinessDayConvention> function() { return Iterators.unmodifiableIterator(_conventions.iterator()); } | /**
* Iterates over the available conventions. No particular ordering is specified and conventions may
* exist in the system not provided by this factory that aren't included as part of this enumeration.
*
* @return the available conventions, not null
*/ | Iterates over the available conventions. No particular ordering is specified and conventions may exist in the system not provided by this factory that aren't included as part of this enumeration | enumerateAvailableBusinessDayConventions | {
"repo_name": "charles-cooper/idylfin",
"path": "src/com/opengamma/financial/convention/businessday/BusinessDayConventionFactory.java",
"license": "apache-2.0",
"size": 3100
} | [
"com.google.common.collect.Iterators",
"java.util.Iterator"
] | import com.google.common.collect.Iterators; import java.util.Iterator; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 2,561,990 |
@Override
public void addView(View child, int index, LayoutParams params) {
throw new UnsupportedOperationException("addView(View, int, LayoutParams) " + "is not supported in AdapterView");
} | void function(View child, int index, LayoutParams params) { throw new UnsupportedOperationException(STR + STR); } | /**
* This method is not supported and throws an UnsupportedOperationException
* when called.
*
* @param child
* Ignored.
* @param index
* Ignored.
* @param params
* Ignored.
*
* @throws UnsupportedOperationException
* Every time this method is invoked.
*/ | This method is not supported and throws an UnsupportedOperationException when called | addView | {
"repo_name": "ShawnDongAi/AEASSISTANT",
"path": "AEAssistant/src/com/zzn/aeassistant/view/pla/internal/PLA_AdapterView.java",
"license": "apache-2.0",
"size": 32062
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,160,624 |
@Override
public void printStackTrace(final PrintWriter pw) {
if (getCause() == null) {
super.printStackTrace(pw);
} else {
pw.println(this);
getCause().printStackTrace(pw);
}
} | void function(final PrintWriter pw) { if (getCause() == null) { super.printStackTrace(pw); } else { pw.println(this); getCause().printStackTrace(pw); } } | /**
* Print the composite message and the embedded stack trace to the specified
* print writer.
*
* @param pw
* the print writer
*/ | Print the composite message and the embedded stack trace to the specified print writer | printStackTrace | {
"repo_name": "unkascrack/lucene-jdbcdirectory",
"path": "src/main/java/com/github/lucene/store/jdbc/JdbcStoreException.java",
"license": "apache-2.0",
"size": 4403
} | [
"java.io.PrintWriter"
] | import java.io.PrintWriter; | import java.io.*; | [
"java.io"
] | java.io; | 2,185,576 |
public Scan setTimeStamp(long timestamp) {
try {
tr = new TimeRange(timestamp, timestamp+1);
} catch(IOException e) {
// Will never happen
}
return this;
} | Scan function(long timestamp) { try { tr = new TimeRange(timestamp, timestamp+1); } catch(IOException e) { } return this; } | /**
* Get versions of columns with the specified timestamp. Note, default maximum
* versions to return is 1. If your time range spans more than one version
* and you want all versions returned, up the number of versions beyond the
* defaut.
* @param timestamp version timestamp
* @see #setMaxVersions()
* @see #setMaxVersions(int)
* @return this
*/ | Get versions of columns with the specified timestamp. Note, default maximum versions to return is 1. If your time range spans more than one version and you want all versions returned, up the number of versions beyond the defaut | setTimeStamp | {
"repo_name": "matteobertozzi/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/client/Scan.java",
"license": "apache-2.0",
"size": 20737
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.io.TimeRange"
] | import java.io.IOException; import org.apache.hadoop.hbase.io.TimeRange; | import java.io.*; import org.apache.hadoop.hbase.io.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,682,392 |
@VisibleForTesting // Should be protected
public <T> Attribute.ComputedDefault getComputedDefault(String attributeName, Type<T> type) {
int index = getIndexWithTypeCheck(attributeName, type);
Object value = attributes.getAttributeValue(index);
if (value instanceof Attribute.ComputedDefault) {
return (Attribute.ComputedDefault) value;
} else {
return null;
}
} | @VisibleForTesting <T> Attribute.ComputedDefault function(String attributeName, Type<T> type) { int index = getIndexWithTypeCheck(attributeName, type); Object value = attributes.getAttributeValue(index); if (value instanceof Attribute.ComputedDefault) { return (Attribute.ComputedDefault) value; } else { return null; } } | /**
* Returns the given attribute if it's a computed default, null otherwise.
*
* @throws IllegalArgumentException if the given attribute doesn't exist with the specified
* type. This happens whether or not it's a computed default.
*/ | Returns the given attribute if it's a computed default, null otherwise | getComputedDefault | {
"repo_name": "Krasnyanskiy/bazel",
"path": "src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java",
"license": "apache-2.0",
"size": 8413
} | [
"com.google.common.annotations.VisibleForTesting"
] | import com.google.common.annotations.VisibleForTesting; | import com.google.common.annotations.*; | [
"com.google.common"
] | com.google.common; | 646,027 |
public @JavaType(Throwable.class) static StaticObject initExceptionWithCause(@JavaType(Throwable.class) ObjectKlass exceptionKlass, @JavaType(Throwable.class) StaticObject cause) {
assert exceptionKlass.getMeta().java_lang_Throwable.isAssignableFrom(exceptionKlass);
assert StaticObject.isNull(cause) || exceptionKlass.getMeta().java_lang_Throwable.isAssignableFrom(cause.getKlass());
return exceptionKlass.getMeta().dispatch.initEx(exceptionKlass, null, cause);
} | @JavaType(Throwable.class) static StaticObject function(@JavaType(Throwable.class) ObjectKlass exceptionKlass, @JavaType(Throwable.class) StaticObject cause) { assert exceptionKlass.getMeta().java_lang_Throwable.isAssignableFrom(exceptionKlass); assert StaticObject.isNull(cause) exceptionKlass.getMeta().java_lang_Throwable.isAssignableFrom(cause.getKlass()); return exceptionKlass.getMeta().dispatch.initEx(exceptionKlass, null, cause); } | /**
* Allocate and initializes an exception of the given guest klass.
*
* <p>
* A guest instance is allocated and initialized by calling the
* {@link Throwable#Throwable(Throwable) constructor with cause}. The given guest class must
* have such constructor declared.
*
* @param exceptionKlass guest exception class, subclass of guest {@link #java_lang_Throwable
* Throwable}.
*/ | Allocate and initializes an exception of the given guest klass. A guest instance is allocated and initialized by calling the <code>Throwable#Throwable(Throwable) constructor with cause</code>. The given guest class must have such constructor declared | initExceptionWithCause | {
"repo_name": "smarr/Truffle",
"path": "espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java",
"license": "gpl-2.0",
"size": 133002
} | [
"com.oracle.truffle.espresso.impl.ObjectKlass",
"com.oracle.truffle.espresso.runtime.StaticObject",
"com.oracle.truffle.espresso.substitutions.JavaType"
] | import com.oracle.truffle.espresso.impl.ObjectKlass; import com.oracle.truffle.espresso.runtime.StaticObject; import com.oracle.truffle.espresso.substitutions.JavaType; | import com.oracle.truffle.espresso.impl.*; import com.oracle.truffle.espresso.runtime.*; import com.oracle.truffle.espresso.substitutions.*; | [
"com.oracle.truffle"
] | com.oracle.truffle; | 1,500,110 |
Locale locale;
String[] parts = value.split("_");
switch (parts.length) {
case 1:
locale = new Locale(parts[0]);
break;
case 2:
locale = new Locale(parts[0], parts[1]);
break;
case 3:
locale = new Locale(parts[0], parts[1], parts[2]);
break;
default:
throw new AluminumException("found more than three locale parts; ",
"only the language, country and variant should be given");
}
return locale;
} | Locale locale; String[] parts = value.split("_"); switch (parts.length) { case 1: locale = new Locale(parts[0]); break; case 2: locale = new Locale(parts[0], parts[1]); break; case 3: locale = new Locale(parts[0], parts[1], parts[2]); break; default: throw new AluminumException(STR, STR); } return locale; } | /**
* Converts a {@link String string} into a {@link Locale locale}. The following formats are supported:
* <ul>
* <li><i>language</i>;
* <li><i>language</i>_<i>country</i>;
* <li><i>language</i>_<i>country</i>_<i>variant</i>.
* </ul>
* This means that {@code "nl"}, {@code "nl_NL"}, and {@code "nl_NL_Amsterdam"} can all be converted into a locale.
*
* @param value the value to convert
* @return the converted locale
* @throws AluminumException when the value can't be converted into a locale
*/ | Converts a <code>String string</code> into a <code>Locale locale</code>. The following formats are supported: language; language_country; language_country_variant. This means that "nl", "nl_NL", and "nl_NL_Amsterdam" can all be converted into a locale | convertLocale | {
"repo_name": "levi-h/aluminumproject",
"path": "libraries/general/g11n/src/main/java/com/googlecode/aluminumproject/utilities/GlobalisationUtilities.java",
"license": "apache-2.0",
"size": 3077
} | [
"com.googlecode.aluminumproject.AluminumException",
"java.util.Locale"
] | import com.googlecode.aluminumproject.AluminumException; import java.util.Locale; | import com.googlecode.aluminumproject.*; import java.util.*; | [
"com.googlecode.aluminumproject",
"java.util"
] | com.googlecode.aluminumproject; java.util; | 1,562,860 |
Call<ResponseBody> putSubResourceAsync(SubProduct product, final ServiceCallback<SubProduct> serviceCallback); | Call<ResponseBody> putSubResourceAsync(SubProduct product, final ServiceCallback<SubProduct> serviceCallback); | /**
* Long running put request with sub resource.
*
* @param product Sub Product to put
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link Call} object
*/ | Long running put request with sub resource | putSubResourceAsync | {
"repo_name": "vulcansteel/autorest",
"path": "AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsOperations.java",
"license": "mit",
"size": 53651
} | [
"com.microsoft.rest.ServiceCallback",
"com.squareup.okhttp.ResponseBody"
] | import com.microsoft.rest.ServiceCallback; import com.squareup.okhttp.ResponseBody; | import com.microsoft.rest.*; import com.squareup.okhttp.*; | [
"com.microsoft.rest",
"com.squareup.okhttp"
] | com.microsoft.rest; com.squareup.okhttp; | 1,090,816 |
public static JToggleButton waitJToggleButton(Container cont, ComponentChooser chooser) {
return waitJToggleButton(cont, chooser, 0);
} | static JToggleButton function(Container cont, ComponentChooser chooser) { return waitJToggleButton(cont, chooser, 0); } | /**
* Waits 0'th JToggleButton in container.
*
* @param cont Container to search component in.
* @param chooser org.netbeans.jemmy.ComponentChooser implementation.
* @return JToggleButton instance.
* @throws TimeoutExpiredException
*/ | Waits 0'th JToggleButton in container | waitJToggleButton | {
"repo_name": "md-5/jdk10",
"path": "test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToggleButtonOperator.java",
"license": "gpl-2.0",
"size": 10185
} | [
"java.awt.Container",
"javax.swing.JToggleButton",
"org.netbeans.jemmy.ComponentChooser"
] | import java.awt.Container; import javax.swing.JToggleButton; import org.netbeans.jemmy.ComponentChooser; | import java.awt.*; import javax.swing.*; import org.netbeans.jemmy.*; | [
"java.awt",
"javax.swing",
"org.netbeans.jemmy"
] | java.awt; javax.swing; org.netbeans.jemmy; | 524,436 |
return DefaultSetHolder.DEFAULT_STOP_SET;
}
private static class DefaultSetHolder {
static final CharArraySet DEFAULT_STOP_SET;
static {
try {
DEFAULT_STOP_SET = loadStopwordSet(false, RomanianAnalyzer.class,
DEFAULT_STOPWORD_FILE, STOPWORDS_COMMENT);
} catch (IOException ex) {
// default set should always be present as it is part of the
// distribution (JAR)
throw new RuntimeException("Unable to load default stopword set");
}
}
}
public RomanianAnalyzer(Version matchVersion) {
this(matchVersion, DefaultSetHolder.DEFAULT_STOP_SET);
}
public RomanianAnalyzer(Version matchVersion, CharArraySet stopwords) {
this(matchVersion, stopwords, CharArraySet.EMPTY_SET);
}
public RomanianAnalyzer(Version matchVersion, CharArraySet stopwords, CharArraySet stemExclusionSet) {
super(matchVersion, stopwords);
this.stemExclusionSet = CharArraySet.unmodifiableSet(CharArraySet.copy(
matchVersion, stemExclusionSet));
}
/**
* Creates a
* {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
* which tokenizes all the text in the provided {@link Reader}.
*
* @return A
* {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
* built from an {@link StandardTokenizer} filtered with
* {@link StandardFilter}, {@link LowerCaseFilter}, {@link StopFilter} | return DefaultSetHolder.DEFAULT_STOP_SET; } private static class DefaultSetHolder { static final CharArraySet DEFAULT_STOP_SET; static { try { DEFAULT_STOP_SET = loadStopwordSet(false, RomanianAnalyzer.class, DEFAULT_STOPWORD_FILE, STOPWORDS_COMMENT); } catch (IOException ex) { throw new RuntimeException(STR); } } } public RomanianAnalyzer(Version matchVersion) { this(matchVersion, DefaultSetHolder.DEFAULT_STOP_SET); } public RomanianAnalyzer(Version matchVersion, CharArraySet stopwords) { this(matchVersion, stopwords, CharArraySet.EMPTY_SET); } public RomanianAnalyzer(Version matchVersion, CharArraySet stopwords, CharArraySet stemExclusionSet) { super(matchVersion, stopwords); this.stemExclusionSet = CharArraySet.unmodifiableSet(CharArraySet.copy( matchVersion, stemExclusionSet)); } /** * Creates a * {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents} * which tokenizes all the text in the provided {@link Reader}. * * @return A * {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents} * built from an {@link StandardTokenizer} filtered with * {@link StandardFilter}, {@link LowerCaseFilter}, {@link StopFilter} | /**
* Returns an unmodifiable instance of the default stop words set.
* @return default stop words set.
*/ | Returns an unmodifiable instance of the default stop words set | getDefaultStopSet | {
"repo_name": "pkarmstr/NYBC",
"path": "solr-4.2.1/lucene/analysis/common/src/java/org/apache/lucene/analysis/ro/RomanianAnalyzer.java",
"license": "apache-2.0",
"size": 5130
} | [
"java.io.IOException",
"java.io.Reader",
"org.apache.lucene.analysis.Analyzer",
"org.apache.lucene.analysis.core.LowerCaseFilter",
"org.apache.lucene.analysis.core.StopFilter",
"org.apache.lucene.analysis.standard.StandardFilter",
"org.apache.lucene.analysis.standard.StandardTokenizer",
"org.apache.lu... | import java.io.IOException; import java.io.Reader; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.core.LowerCaseFilter; import org.apache.lucene.analysis.core.StopFilter; import org.apache.lucene.analysis.standard.StandardFilter; import org.apache.lucene.analysis.standard.StandardTokenizer; import org.apache.lucene.analysis.util.CharArraySet; import org.apache.lucene.util.Version; | import java.io.*; import org.apache.lucene.analysis.*; import org.apache.lucene.analysis.core.*; import org.apache.lucene.analysis.standard.*; import org.apache.lucene.analysis.util.*; import org.apache.lucene.util.*; | [
"java.io",
"org.apache.lucene"
] | java.io; org.apache.lucene; | 1,783,816 |
private void reorderPrimaryKeys() {
if ((table == null)
|| ((table.partition().length == 0) && (table.clustering().length == 0))) {
return; // nothing to do so keep original order
}
// clone keys map so we can modify the original ones
final Map<String, FieldInfoImpl<T>> partition = new LinkedHashMap<>(partitionKeyColumns);
final Map<String, FieldInfoImpl<T>> clustering = new LinkedHashMap<>(clusteringKeyColumns);
primaryKeyColumns.clear();
partitionKeyColumns.clear();
clusteringKeyColumns.clear();
// start with partition keys specified in @Table
for (final String columnName: table.partition()) {
final FieldInfoImpl<T> field = partition.remove(columnName);
org.apache.commons.lang3.Validate.isTrue(
field != null,
"@Table partition key '%s' not found in pojo '%s' for table '%s'",
columnName,
clazz.getSimpleName(),
table.name()
);
primaryKeyColumns.put(columnName, field);
partitionKeyColumns.put(columnName, field);
}
// add remaining partition keys
primaryKeyColumns.putAll(partition);
partitionKeyColumns.putAll(partition);
// now deal with clustering keys specified in @Table
for (final String columnName: table.clustering()) {
final FieldInfoImpl<T> field = clustering.remove(columnName);
org.apache.commons.lang3.Validate.isTrue(
field != null,
"@Table clustering key '%s' not found in pojo '%s' for table '%s'",
columnName,
clazz.getSimpleName(),
table.name()
);
primaryKeyColumns.put(columnName, field);
clusteringKeyColumns.put(columnName, field);
}
// add remaining clustering keys
primaryKeyColumns.putAll(clustering);
clusteringKeyColumns.putAll(clustering);
} | void function() { if ((table == null) ((table.partition().length == 0) && (table.clustering().length == 0))) { return; } final Map<String, FieldInfoImpl<T>> partition = new LinkedHashMap<>(partitionKeyColumns); final Map<String, FieldInfoImpl<T>> clustering = new LinkedHashMap<>(clusteringKeyColumns); primaryKeyColumns.clear(); partitionKeyColumns.clear(); clusteringKeyColumns.clear(); final FieldInfoImpl<T> field = partition.remove(columnName); org.apache.commons.lang3.Validate.isTrue( field != null, STR, columnName, clazz.getSimpleName(), table.name() ); primaryKeyColumns.put(columnName, field); partitionKeyColumns.put(columnName, field); } primaryKeyColumns.putAll(partition); partitionKeyColumns.putAll(partition); final FieldInfoImpl<T> field = clustering.remove(columnName); org.apache.commons.lang3.Validate.isTrue( field != null, STR, columnName, clazz.getSimpleName(), table.name() ); primaryKeyColumns.put(columnName, field); clusteringKeyColumns.put(columnName, field); } primaryKeyColumns.putAll(clustering); clusteringKeyColumns.putAll(clustering); } | /**
* Re-order primary keys based on @Table annotation specifications.
*
* @author paouelle
*/ | Re-order primary keys based on @Table annotation specifications | reorderPrimaryKeys | {
"repo_name": "helenusdriver/helenus",
"path": "impl/src/main/java/org/helenus/driver/impl/TableInfoImpl.java",
"license": "apache-2.0",
"size": 91987
} | [
"java.util.LinkedHashMap",
"java.util.Map"
] | import java.util.LinkedHashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 432,860 |
@SuppressWarnings("static-access")
public Enumeration<String> getPortNames() {
return serial.getSerialPortIdentifiers();
} | @SuppressWarnings(STR) Enumeration<String> function() { return serial.getSerialPortIdentifiers(); } | /**
* Retrieve a list of the platform appropriate port names for this adapter.
* A port must be selected with the method 'selectPort' before any other
* communication methods can be used. Using a communcation method before
* 'selectPort' will result in a <code>OneWireException</code> exception.
*
* @return enumeration of type <code>String</code> that contains the port
* names
*/ | Retrieve a list of the platform appropriate port names for this adapter. A port must be selected with the method 'selectPort' before any other communication methods can be used. Using a communcation method before 'selectPort' will result in a <code>OneWireException</code> exception | getPortNames | {
"repo_name": "marcass/dz",
"path": "dz3-master/dz3-owapi/src/main/java/com/dalsemi/onewire/adapter/USerialAdapter.java",
"license": "gpl-3.0",
"size": 87093
} | [
"java.util.Enumeration"
] | import java.util.Enumeration; | import java.util.*; | [
"java.util"
] | java.util; | 2,645,630 |
public static ElementFactory find(String name) {
if (LOG.isLoggable(Level.FINER)) {
LOG.entering("ElementFactory", "find", name);
}
ElementFactory factory = GSTELEMENTFACTORY_API.gst_element_factory_find(name);
if (factory == null) {
throw new IllegalArgumentException("No such Gstreamer factory: " + name);
}
return factory;
}
//
// public static List<ElementFactory> listFilter(List<ElementFactory> list, Caps caps,
// PadDirection direction, boolean subsetonly) {
// GList glist = null;
// List<ElementFactory> filterList = new ArrayList<ElementFactory>();
//
// for (ElementFactory fact : list) {
// fact.ref();
// glist = GLIB_API.g_list_append(glist, fact.handle());
// }
//
// GList gFilterList = GSTELEMENTFACTORY_API.gst_element_factory_list_filter(glist, caps, direction, subsetonly);
//
// GList next = gFilterList;
// while (next != null) {
// if (next.data != null) {
// ElementFactory fact = new ElementFactory(initializer(next.data, true, true));
// filterList.add(fact);
// }
// next = next.next();
// }
//
// GSTPLUGIN_API.gst_plugin_list_free(glist);
// GSTPLUGIN_API.gst_plugin_list_free(gFilterList);
//
// return filterList;
// }
/**
* Get a list of factories that match the given type. Only elements with a
* rank greater or equal to minrank will be returned. The list of factories
* is returned by decreasing rank.
*
* @param type a {@link ListType} | static ElementFactory function(String name) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(STR, "find", name); } ElementFactory factory = GSTELEMENTFACTORY_API.gst_element_factory_find(name); if (factory == null) { throw new IllegalArgumentException(STR + name); } return factory; } /** * Get a list of factories that match the given type. Only elements with a * rank greater or equal to minrank will be returned. The list of factories * is returned by decreasing rank. * * @param type a {@link ListType} | /**
* Retrieve an instance of a factory that can produce {@link Element}s
*
* @param name The type of {@link Element} to produce.
* @return An ElementFactory that will produce {@link Element}s of the
* desired type.
*/ | Retrieve an instance of a factory that can produce <code>Element</code>s | find | {
"repo_name": "isaacrj/gst1-java-core",
"path": "src/org/freedesktop/gstreamer/ElementFactory.java",
"license": "lgpl-3.0",
"size": 14388
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 2,034,165 |
protected ResultSet executeQuery()
throws SQLException
{
return _userQuery.executeQuery();
} | ResultSet function() throws SQLException { return _userQuery.executeQuery(); } | /**
* Executes the query returning a result set.
*/ | Executes the query returning a result set | executeQuery | {
"repo_name": "mdaniel/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/amber/ejb3/QueryImpl.java",
"license": "gpl-2.0",
"size": 9512
} | [
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,462,056 |
public void maxFailure( String msg, String[] usr, String[] plcy )
{
LogUtil.logIt( msg );
try
{
PwPolicyMgr policyMgr = getManagedPswdMgr();
AdminMgr adminMgr = AdminMgrImplTest.getManagedAdminMgr();
AccessMgr accessMgr = AccessMgrFactory.createInstance( TestUtils.getContext() );
User user = UserTestData.getUser( usr );
policyMgr.updateUserPolicy( user.getUserId(), PolicyTestData.getName( plcy ) );
int maxFailures = PolicyTestData.getMaxFailure( plcy );
for ( int i = 0; i < maxFailures; i++ )
{
try
{
User badUser = new User( user.getUserId(), "wrongpw" );
accessMgr.createSession( badUser, false );
fail( CLS_NM + ".maxFailure name [" + PolicyTestData.getName( plcy ) + "] user ["
+ UserTestData.getUserId( usr ) + "] failed max failure test=" + maxFailures + " iteration="
+ i );
}
catch ( SecurityException ex )
{
assertTrue( CLS_NM + ".maxFailure invalid error message userId [" + UserTestData.getUserId( usr )
+ "]", ex.getErrorId() == GlobalErrIds.USER_PW_INVLD );
// still good
TestUtils.sleep( 1 );
}
}
try
{
// now try with valid password - better be locked out...
accessMgr.createSession( user, false );
fail( CLS_NM + ".maxFailure name [" + PolicyTestData.getName( plcy ) + "] user ["
+ UserTestData.getUserId( usr ) + "] failed max failure test 2" );
}
catch ( SecurityException ex )
{
assertTrue(
CLS_NM + ".maxFailure invalid error message userId [" + UserTestData.getUserId( usr ) + "]",
ex.getErrorId() == GlobalErrIds.USER_PW_LOCKED );
// still good
}
adminMgr.unlockUserAccount( user );
// now try with valid password - better work this time...
accessMgr.createSession( user, false );
}
catch ( SecurityException ex )
{
LOG.error(
"maxFailure caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex );
fail( ex.getMessage() );
}
} | void function( String msg, String[] usr, String[] plcy ) { LogUtil.logIt( msg ); try { PwPolicyMgr policyMgr = getManagedPswdMgr(); AdminMgr adminMgr = AdminMgrImplTest.getManagedAdminMgr(); AccessMgr accessMgr = AccessMgrFactory.createInstance( TestUtils.getContext() ); User user = UserTestData.getUser( usr ); policyMgr.updateUserPolicy( user.getUserId(), PolicyTestData.getName( plcy ) ); int maxFailures = PolicyTestData.getMaxFailure( plcy ); for ( int i = 0; i < maxFailures; i++ ) { try { User badUser = new User( user.getUserId(), STR ); accessMgr.createSession( badUser, false ); fail( CLS_NM + STR + PolicyTestData.getName( plcy ) + STR + UserTestData.getUserId( usr ) + STR + maxFailures + STR + i ); } catch ( SecurityException ex ) { assertTrue( CLS_NM + STR + UserTestData.getUserId( usr ) + "]", ex.getErrorId() == GlobalErrIds.USER_PW_INVLD ); TestUtils.sleep( 1 ); } } try { accessMgr.createSession( user, false ); fail( CLS_NM + STR + PolicyTestData.getName( plcy ) + STR + UserTestData.getUserId( usr ) + STR ); } catch ( SecurityException ex ) { assertTrue( CLS_NM + STR + UserTestData.getUserId( usr ) + "]", ex.getErrorId() == GlobalErrIds.USER_PW_LOCKED ); } adminMgr.unlockUserAccount( user ); accessMgr.createSession( user, false ); } catch ( SecurityException ex ) { LOG.error( STR + ex.getErrorId() + STR + ex.getMessage(), ex ); fail( ex.getMessage() ); } } | /**
* PT7
* 5.2.11 pwdMaxFailure
* <p>
* This attribute specifies the number of consecutive failed bind
* attempts after which the password may not be used to authenticate.
* If this attribute is not present, or if the value is 0, this policy
* is not checked, and the value of pwdLockout will be ignored.
*
* @param msg
* @param usr
* @param plcy
*/ | PT7 5.2.11 pwdMaxFailure This attribute specifies the number of consecutive failed bind attempts after which the password may not be used to authenticate. If this attribute is not present, or if the value is 0, this policy is not checked, and the value of pwdLockout will be ignored | maxFailure | {
"repo_name": "PennState/directory-fortress-core-1",
"path": "src/test/java/org/apache/directory/fortress/core/impl/PswdPolicyMgrImplTest.java",
"license": "apache-2.0",
"size": 59055
} | [
"org.apache.directory.fortress.core.AccessMgr",
"org.apache.directory.fortress.core.AccessMgrFactory",
"org.apache.directory.fortress.core.AdminMgr",
"org.apache.directory.fortress.core.GlobalErrIds",
"org.apache.directory.fortress.core.PwPolicyMgr",
"org.apache.directory.fortress.core.SecurityException",... | import org.apache.directory.fortress.core.AccessMgr; import org.apache.directory.fortress.core.AccessMgrFactory; import org.apache.directory.fortress.core.AdminMgr; import org.apache.directory.fortress.core.GlobalErrIds; import org.apache.directory.fortress.core.PwPolicyMgr; import org.apache.directory.fortress.core.SecurityException; import org.apache.directory.fortress.core.model.User; import org.apache.directory.fortress.core.util.LogUtil; | import org.apache.directory.fortress.core.*; import org.apache.directory.fortress.core.model.*; import org.apache.directory.fortress.core.util.*; | [
"org.apache.directory"
] | org.apache.directory; | 1,365,939 |
public static TxIsolation fromLevel(int connectionIsolationLevel) {
switch (connectionIsolationLevel) {
case Connection.TRANSACTION_READ_UNCOMMITTED:
return TxIsolation.READ_UNCOMMITTED;
case Connection.TRANSACTION_READ_COMMITTED:
return TxIsolation.READ_COMMITED;
case Connection.TRANSACTION_REPEATABLE_READ:
return TxIsolation.REPEATABLE_READ;
case Connection.TRANSACTION_SERIALIZABLE:
return TxIsolation.SERIALIZABLE;
case Connection.TRANSACTION_NONE:
return TxIsolation.NONE;
case -1:
return TxIsolation.DEFAULT;
default:
throw new RuntimeException("Unknown isolation level " + connectionIsolationLevel);
}
} | static TxIsolation function(int connectionIsolationLevel) { switch (connectionIsolationLevel) { case Connection.TRANSACTION_READ_UNCOMMITTED: return TxIsolation.READ_UNCOMMITTED; case Connection.TRANSACTION_READ_COMMITTED: return TxIsolation.READ_COMMITED; case Connection.TRANSACTION_REPEATABLE_READ: return TxIsolation.REPEATABLE_READ; case Connection.TRANSACTION_SERIALIZABLE: return TxIsolation.SERIALIZABLE; case Connection.TRANSACTION_NONE: return TxIsolation.NONE; case -1: return TxIsolation.DEFAULT; default: throw new RuntimeException(STR + connectionIsolationLevel); } } | /**
* Return the TxIsolation given the java.sql.Connection isolation level.
* <p>
* Note that -1 denotes the default isolation level.
* </p>
*/ | Return the TxIsolation given the java.sql.Connection isolation level. Note that -1 denotes the default isolation level. | fromLevel | {
"repo_name": "gzwfdy/meetime",
"path": "src/main/java/com/avaje/ebean/TxIsolation.java",
"license": "apache-2.0",
"size": 2245
} | [
"java.sql.Connection"
] | import java.sql.Connection; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,335,974 |
ConvexHull getConvexHull(int clusterId); | ConvexHull getConvexHull(int clusterId); | /**
* Gets the convex hull for the cluster. The hull includes any points within child clusters. Hulls
* are computed by {@link #computeConvexHulls()}.
*
* @param clusterId the cluster id
* @return the convex hull (or null if not available)
*/ | Gets the convex hull for the cluster. The hull includes any points within child clusters. Hulls are computed by <code>#computeConvexHulls()</code> | getConvexHull | {
"repo_name": "aherbert/GDSC-Core",
"path": "src/main/java/uk/ac/sussex/gdsc/core/clustering/optics/ClusteringResult.java",
"license": "gpl-3.0",
"size": 2832
} | [
"uk.ac.sussex.gdsc.core.utils.ConvexHull"
] | import uk.ac.sussex.gdsc.core.utils.ConvexHull; | import uk.ac.sussex.gdsc.core.utils.*; | [
"uk.ac.sussex"
] | uk.ac.sussex; | 309,221 |
@NonNull
public static Observable conditionalObservable(
@NonNull final Condition condition, @NonNull final Observable... observables) {
return new ConditionalObservable(compositeObservable(observables), condition);
} | static Observable function( @NonNull final Condition condition, @NonNull final Observable... observables) { return new ConditionalObservable(compositeObservable(observables), condition); } | /**
* Returns an {@link Observable} that notifies added {@link Updatable}s that any of the
* {@code observables} have changed only if the {@code condition} applies.
*/ | Returns an <code>Observable</code> that notifies added <code>Updatable</code>s that any of the observables have changed only if the condition applies | conditionalObservable | {
"repo_name": "google/agera",
"path": "agera/src/main/java/com/google/android/agera/Observables.java",
"license": "apache-2.0",
"size": 7956
} | [
"android.support.annotation.NonNull"
] | import android.support.annotation.NonNull; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 2,749,213 |
public void setSLAs(List<SLA> newSLAs) {
sLAs = newSLAs;
}
| void function(List<SLA> newSLAs) { sLAs = newSLAs; } | /**
* Sets the '{@link Broker#getSLAs() <em>SLAs</em>}' feature.
*
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @param newSLAs
* the new value of the '{@link Broker#getSLAs() SLAs}' feature.
* @generated
*/ | Sets the '<code>Broker#getSLAs() SLAs</code>' feature. | setSLAs | {
"repo_name": "SmartInfrastructures/xipi",
"path": "portlets/eu.xipi.bro4xipi.brokermodel/src/main/java/gr/upatras/ece/nam/broker/Broker.java",
"license": "agpl-3.0",
"size": 18334
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,338,282 |
private static void print(File file, String indent) {
assert file != null : "file can't be null";
assert indent != null : "indent can't be null";
System.out.print(indent);
System.out.println(file.getName());
if (file.isDirectory()) {
print(new ArrayIterator(file.listFiles()), indent + SPACES);
}
} | static void function(File file, String indent) { assert file != null : STR; assert indent != null : STR; System.out.print(indent); System.out.println(file.getName()); if (file.isDirectory()) { print(new ArrayIterator(file.listFiles()), indent + SPACES); } } | /**
* Prints a file or directory with the given indentation.
*
* @param file The file or directory to print.
* @param indent The amount of indentation.
*/ | Prints a file or directory with the given indentation | print | {
"repo_name": "xuzhikethinker/t4f-data",
"path": "algorithm/src/main/java/aos/algo/tree/RecursiveDirectoryTreePrinter.java",
"license": "apache-2.0",
"size": 3141
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 466,236 |
public StepMeta getSelectedStep(int nr) {
int i, count;
count = 0;
for (i = 0; i < nrSteps(); i++) {
StepMeta stepMeta = getStep(i);
if (stepMeta.isSelected() && stepMeta.isDrawn()) {
if (nr == count)
return stepMeta;
count++;
}
}
return null;
} | StepMeta function(int nr) { int i, count; count = 0; for (i = 0; i < nrSteps(); i++) { StepMeta stepMeta = getStep(i); if (stepMeta.isSelected() && stepMeta.isDrawn()) { if (nr == count) return stepMeta; count++; } } return null; } | /**
* Get the selected step at a certain location
*
* @param nr
* The location
* @return The selected step
*/ | Get the selected step at a certain location | getSelectedStep | {
"repo_name": "panbasten/imeta",
"path": "imeta2.x/imeta-src/imeta/src/main/java/com/panet/imeta/trans/TransMeta.java",
"license": "gpl-2.0",
"size": 209743
} | [
"com.panet.imeta.trans.step.StepMeta"
] | import com.panet.imeta.trans.step.StepMeta; | import com.panet.imeta.trans.step.*; | [
"com.panet.imeta"
] | com.panet.imeta; | 2,303,860 |
Set<String> extractExamples() throws BuildEncyclopediaDocException {
String[] lines = htmlDocumentation.split(DocgenConsts.LS);
Set<String> examples = new HashSet<>();
StringBuilder sb = null;
boolean inExampleCode = false;
int lineCount = 0;
for (String line : lines) {
if (!inExampleCode) {
if (DocgenConsts.BLAZE_RULE_EXAMPLE_START.matcher(line).matches()) {
inExampleCode = true;
sb = new StringBuilder();
} else if (DocgenConsts.BLAZE_RULE_EXAMPLE_END.matcher(line).matches()) {
throw new BuildEncyclopediaDocException(fileName, startLineCount + lineCount,
"No matching start example tag (#BLAZE_RULE.EXAMPLE) for end example tag.");
}
} else {
if (DocgenConsts.BLAZE_RULE_EXAMPLE_END.matcher(line).matches()) {
inExampleCode = false;
examples.add(sb.toString());
sb = null;
} else if (DocgenConsts.BLAZE_RULE_EXAMPLE_START.matcher(line).matches()) {
throw new BuildEncyclopediaDocException(fileName, startLineCount + lineCount,
"No start example tags (#BLAZE_RULE.EXAMPLE) in a row.");
} else {
sb.append(line + DocgenConsts.LS);
}
}
lineCount++;
}
return examples;
} | Set<String> extractExamples() throws BuildEncyclopediaDocException { String[] lines = htmlDocumentation.split(DocgenConsts.LS); Set<String> examples = new HashSet<>(); StringBuilder sb = null; boolean inExampleCode = false; int lineCount = 0; for (String line : lines) { if (!inExampleCode) { if (DocgenConsts.BLAZE_RULE_EXAMPLE_START.matcher(line).matches()) { inExampleCode = true; sb = new StringBuilder(); } else if (DocgenConsts.BLAZE_RULE_EXAMPLE_END.matcher(line).matches()) { throw new BuildEncyclopediaDocException(fileName, startLineCount + lineCount, STR); } } else { if (DocgenConsts.BLAZE_RULE_EXAMPLE_END.matcher(line).matches()) { inExampleCode = false; examples.add(sb.toString()); sb = null; } else if (DocgenConsts.BLAZE_RULE_EXAMPLE_START.matcher(line).matches()) { throw new BuildEncyclopediaDocException(fileName, startLineCount + lineCount, STR); } else { sb.append(line + DocgenConsts.LS); } } lineCount++; } return examples; } | /**
* Returns a set of examples based on markups which can be used as BUILD file
* contents for testing.
*/ | Returns a set of examples based on markups which can be used as BUILD file contents for testing | extractExamples | {
"repo_name": "mikelikespie/bazel",
"path": "src/main/java/com/google/devtools/build/docgen/RuleDocumentation.java",
"license": "apache-2.0",
"size": 12544
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,842,180 |
public static String extractValueForLogging(Object obj, Message message, String prepend, boolean allowStreams, boolean allowFiles, int maxChars) {
if (maxChars < 0) {
return prepend + "[Body is not logged]";
}
if (obj == null) {
return prepend + "[Body is null]";
}
if (!allowStreams) {
if (instanceOf(obj, "java.xml.transform.Source")) {
return prepend + "[Body is instance of java.xml.transform.Source]";
} else if (obj instanceof StreamCache) {
return prepend + "[Body is instance of org.apache.camel.StreamCache]";
} else if (obj instanceof InputStream) {
return prepend + "[Body is instance of java.io.InputStream]";
} else if (obj instanceof OutputStream) {
return prepend + "[Body is instance of java.io.OutputStream]";
} else if (obj instanceof Reader) {
return prepend + "[Body is instance of java.io.Reader]";
} else if (obj instanceof Writer) {
return prepend + "[Body is instance of java.io.Writer]";
} else if (obj instanceof WrappedFile || obj instanceof File) {
if (!allowFiles) {
return prepend + "[Body is file based: " + obj + "]";
}
}
}
if (!allowFiles) {
if (obj instanceof WrappedFile || obj instanceof File) {
return prepend + "[Body is file based: " + obj + "]";
}
}
// is the body a stream cache or input stream
StreamCache cache = null;
InputStream is = null;
if (obj instanceof StreamCache) {
cache = (StreamCache)obj;
is = null;
} else if (obj instanceof InputStream) {
cache = null;
is = (InputStream) obj;
}
// grab the message body as a string
String body = null;
if (message.getExchange() != null) {
try {
body = message.getExchange().getContext().getTypeConverter().tryConvertTo(String.class, message.getExchange(), obj);
} catch (Throwable e) {
// ignore as the body is for logging purpose
}
}
if (body == null) {
try {
body = obj.toString();
} catch (Throwable e) {
// ignore as the body is for logging purpose
}
}
// reset stream cache after use
if (cache != null) {
cache.reset();
} else if (is != null && is.markSupported()) {
try {
is.reset();
} catch (IOException e) {
// ignore
}
}
if (body == null) {
return prepend + "[Body is null]";
}
// clip body if length enabled and the body is too big
if (maxChars > 0 && body.length() > maxChars) {
body = body.substring(0, maxChars) + "... [Body clipped after " + maxChars + " chars, total length is " + body.length() + "]";
}
return prepend + body;
} | static String function(Object obj, Message message, String prepend, boolean allowStreams, boolean allowFiles, int maxChars) { if (maxChars < 0) { return prepend + STR; } if (obj == null) { return prepend + STR; } if (!allowStreams) { if (instanceOf(obj, STR)) { return prepend + STR; } else if (obj instanceof StreamCache) { return prepend + STR; } else if (obj instanceof InputStream) { return prepend + STR; } else if (obj instanceof OutputStream) { return prepend + STR; } else if (obj instanceof Reader) { return prepend + STR; } else if (obj instanceof Writer) { return prepend + STR; } else if (obj instanceof WrappedFile obj instanceof File) { if (!allowFiles) { return prepend + STR + obj + "]"; } } } if (!allowFiles) { if (obj instanceof WrappedFile obj instanceof File) { return prepend + STR + obj + "]"; } } StreamCache cache = null; InputStream is = null; if (obj instanceof StreamCache) { cache = (StreamCache)obj; is = null; } else if (obj instanceof InputStream) { cache = null; is = (InputStream) obj; } String body = null; if (message.getExchange() != null) { try { body = message.getExchange().getContext().getTypeConverter().tryConvertTo(String.class, message.getExchange(), obj); } catch (Throwable e) { } } if (body == null) { try { body = obj.toString(); } catch (Throwable e) { } } if (cache != null) { cache.reset(); } else if (is != null && is.markSupported()) { try { is.reset(); } catch (IOException e) { } } if (body == null) { return prepend + STR; } if (maxChars > 0 && body.length() > maxChars) { body = body.substring(0, maxChars) + STR + maxChars + STR + body.length() + "]"; } return prepend + body; } | /**
* Extracts the value for logging purpose.
* <p/>
* Will clip the value if its too big for logging.
*
* @see org.apache.camel.Exchange#LOG_DEBUG_BODY_MAX_CHARS
* @param obj the value
* @param message the message
* @param prepend a message to prepend
* @param allowStreams whether or not streams is allowed
* @param allowFiles whether or not files is allowed (currently not in use)
* @param maxChars limit to maximum number of chars. Use 0 for not limit, and -1 for turning logging message body off.
* @return the logging message
*/ | Extracts the value for logging purpose. Will clip the value if its too big for logging | extractValueForLogging | {
"repo_name": "davidkarlsen/camel",
"path": "core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java",
"license": "apache-2.0",
"size": 23848
} | [
"java.io.File",
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream",
"java.io.Reader",
"java.io.Writer",
"org.apache.camel.Message",
"org.apache.camel.StreamCache",
"org.apache.camel.WrappedFile"
] | import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; import org.apache.camel.Message; import org.apache.camel.StreamCache; import org.apache.camel.WrappedFile; | import java.io.*; import org.apache.camel.*; | [
"java.io",
"org.apache.camel"
] | java.io; org.apache.camel; | 2,208,990 |
List<HistoricIdentityLink> getHistoricIdentityLinksForProcessInstance(String processInstanceId);
| List<HistoricIdentityLink> getHistoricIdentityLinksForProcessInstance(String processInstanceId); | /**
* Retrieves the {@link HistoricIdentityLink}s associated with the given process instance. Such an {@link IdentityLink} informs how a certain identity (eg. group or user) is associated with a
* certain process instance, even if the instance is completed as opposed to {@link IdentityLink}s which only exist for active instances.
*/ | Retrieves the <code>HistoricIdentityLink</code>s associated with the given process instance. Such an <code>IdentityLink</code> informs how a certain identity (eg. group or user) is associated with a certain process instance, even if the instance is completed as opposed to <code>IdentityLink</code>s which only exist for active instances | getHistoricIdentityLinksForProcessInstance | {
"repo_name": "roberthafner/flowable-engine",
"path": "modules/flowable-engine/src/main/java/org/activiti/engine/HistoryService.java",
"license": "apache-2.0",
"size": 5781
} | [
"java.util.List",
"org.activiti.engine.history.HistoricIdentityLink"
] | import java.util.List; import org.activiti.engine.history.HistoricIdentityLink; | import java.util.*; import org.activiti.engine.history.*; | [
"java.util",
"org.activiti.engine"
] | java.util; org.activiti.engine; | 191,681 |
@Override public void visitTerminal(TerminalNode node) { } | @Override public void visitTerminal(TerminalNode node) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitEveryRule | {
"repo_name": "wellingtondellamura/compilers-codes-samples",
"path": "parsers/antlr/antlr2019/teste_parser/TesteBaseListener.java",
"license": "gpl-3.0",
"size": 2221
} | [
"org.antlr.v4.runtime.tree.TerminalNode"
] | import org.antlr.v4.runtime.tree.TerminalNode; | import org.antlr.v4.runtime.tree.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 517,284 |
private boolean exportPrivKeyCertChainPKCS12(String sEntryAlias)
{
KeyStore keyStore = m_keyStoreWrap.getKeyStore();
// Get the entry's password (we may already know it from the wrapper)
char[] cPassword = m_keyStoreWrap.getEntryPassword(sEntryAlias);
if (cPassword == null)
{
cPassword = KeyStoreUtil.DUMMY_PASSWORD;
if (m_keyStoreWrap.getKeyStoreType().isEntryPasswordSupported())
{
DGetPassword dGetPassword = new DGetPassword(this, RB.getString("FPortecle.KeyEntryPassword.Title"));
dGetPassword.setLocationRelativeTo(this);
SwingHelper.showAndWait(dGetPassword);
cPassword = dGetPassword.getPassword();
if (cPassword == null)
{
return false;
}
}
}
File fExportFile = null;
try
{
// Get the private key and certificate chain from the entry
Key privKey = keyStore.getKey(sEntryAlias, cPassword);
Certificate[] certs = keyStore.getCertificateChain(sEntryAlias);
// Update the keystore wrapper
m_keyStoreWrap.setEntryPassword(sEntryAlias, cPassword);
// Create a new PKCS #12 keystore
KeyStore pkcs12 = KeyStoreUtil.createKeyStore(KeyStoreType.PKCS12);
// Place the private key and certificate chain into the PKCS #12 keystore under the same alias as
// it has in the loaded keystore
pkcs12.setKeyEntry(sEntryAlias, privKey, new char[0], certs);
// Get a new password for the PKCS #12 keystore
DGetNewPassword dGetNewPassword = new DGetNewPassword(this, RB.getString("FPortecle.Pkcs12Password.Title"));
dGetNewPassword.setLocationRelativeTo(this);
SwingHelper.showAndWait(dGetNewPassword);
char[] cPKCS12Password = dGetNewPassword.getPassword();
if (cPKCS12Password == null)
{
return false;
}
String basename = null;
if (certs.length > 0 && certs[0] instanceof X509Certificate)
{
basename = X509CertUtil.getCertificateAlias((X509Certificate) certs[0]);
}
if (basename == null || basename.isEmpty())
{
basename = sEntryAlias;
}
// Let the user choose the export PKCS #12 file
fExportFile = chooseExportPKCS12File(basename);
if (fExportFile == null)
{
return false;
}
if (!confirmOverwrite(fExportFile, getTitle()))
{
return false;
}
// Store the keystore to disk
KeyStoreUtil.saveKeyStore(pkcs12, fExportFile, cPKCS12Password);
m_lastDir.updateLastDir(fExportFile);
return true;
}
catch (FileNotFoundException ex)
{
String sMessage =
MessageFormat.format(RB.getString("FPortecle.NoWriteFile.message"), fExportFile.getName());
JOptionPane.showMessageDialog(this, sMessage, getTitle(), JOptionPane.WARNING_MESSAGE);
return false;
}
catch (CryptoException | GeneralSecurityException | IOException ex)
{
DThrowable.showAndWait(this, null, ex);
return false;
}
} | boolean function(String sEntryAlias) { KeyStore keyStore = m_keyStoreWrap.getKeyStore(); char[] cPassword = m_keyStoreWrap.getEntryPassword(sEntryAlias); if (cPassword == null) { cPassword = KeyStoreUtil.DUMMY_PASSWORD; if (m_keyStoreWrap.getKeyStoreType().isEntryPasswordSupported()) { DGetPassword dGetPassword = new DGetPassword(this, RB.getString(STR)); dGetPassword.setLocationRelativeTo(this); SwingHelper.showAndWait(dGetPassword); cPassword = dGetPassword.getPassword(); if (cPassword == null) { return false; } } } File fExportFile = null; try { Key privKey = keyStore.getKey(sEntryAlias, cPassword); Certificate[] certs = keyStore.getCertificateChain(sEntryAlias); m_keyStoreWrap.setEntryPassword(sEntryAlias, cPassword); KeyStore pkcs12 = KeyStoreUtil.createKeyStore(KeyStoreType.PKCS12); pkcs12.setKeyEntry(sEntryAlias, privKey, new char[0], certs); DGetNewPassword dGetNewPassword = new DGetNewPassword(this, RB.getString(STR)); dGetNewPassword.setLocationRelativeTo(this); SwingHelper.showAndWait(dGetNewPassword); char[] cPKCS12Password = dGetNewPassword.getPassword(); if (cPKCS12Password == null) { return false; } String basename = null; if (certs.length > 0 && certs[0] instanceof X509Certificate) { basename = X509CertUtil.getCertificateAlias((X509Certificate) certs[0]); } if (basename == null basename.isEmpty()) { basename = sEntryAlias; } fExportFile = chooseExportPKCS12File(basename); if (fExportFile == null) { return false; } if (!confirmOverwrite(fExportFile, getTitle())) { return false; } KeyStoreUtil.saveKeyStore(pkcs12, fExportFile, cPKCS12Password); m_lastDir.updateLastDir(fExportFile); return true; } catch (FileNotFoundException ex) { String sMessage = MessageFormat.format(RB.getString(STR), fExportFile.getName()); JOptionPane.showMessageDialog(this, sMessage, getTitle(), JOptionPane.WARNING_MESSAGE); return false; } catch (CryptoException GeneralSecurityException IOException ex) { DThrowable.showAndWait(this, null, ex); return false; } } | /**
* Export the private key and certificates of the keystore entry to a PKCS #12 keystore file.
*
* @param sEntryAlias Entry alias
* @return True if the export is successful, false otherwise
*/ | Export the private key and certificates of the keystore entry to a PKCS #12 keystore file | exportPrivKeyCertChainPKCS12 | {
"repo_name": "gavioto/portecle",
"path": "src/main/net/sf/portecle/FPortecle.java",
"license": "gpl-2.0",
"size": 188859
} | [
"java.io.File",
"java.io.FileNotFoundException",
"java.io.IOException",
"java.security.GeneralSecurityException",
"java.security.Key",
"java.security.KeyStore",
"java.security.cert.Certificate",
"java.security.cert.X509Certificate",
"java.text.MessageFormat",
"javax.swing.JOptionPane",
"net.sf.p... | import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.Key; import java.security.KeyStore; import java.security.cert.Certificate; import java.security.cert.X509Certificate; import java.text.MessageFormat; import javax.swing.JOptionPane; import net.sf.portecle.crypto.CryptoException; import net.sf.portecle.crypto.KeyStoreType; import net.sf.portecle.crypto.KeyStoreUtil; import net.sf.portecle.crypto.X509CertUtil; import net.sf.portecle.gui.SwingHelper; import net.sf.portecle.gui.error.DThrowable; import net.sf.portecle.gui.password.DGetNewPassword; import net.sf.portecle.gui.password.DGetPassword; | import java.io.*; import java.security.*; import java.security.cert.*; import java.text.*; import javax.swing.*; import net.sf.portecle.crypto.*; import net.sf.portecle.gui.*; import net.sf.portecle.gui.error.*; import net.sf.portecle.gui.password.*; | [
"java.io",
"java.security",
"java.text",
"javax.swing",
"net.sf.portecle"
] | java.io; java.security; java.text; javax.swing; net.sf.portecle; | 1,182,482 |
public static Throwable assertThrows(@Nullable IgniteLogger log, Callable<?> call,
Class<? extends Throwable> cls, @Nullable String msg) {
assert call != null;
assert cls != null;
try {
call.call();
}
catch (Throwable e) {
if (cls != e.getClass()) {
if (e.getClass() == CacheException.class && e.getCause() != null && e.getCause().getClass() == cls)
e = e.getCause();
else {
U.error(log, "Unexpected exception.", e);
fail("Exception class is not as expected [expected=" + cls + ", actual=" + e.getClass() + ']', e);
}
}
if (msg != null && (e.getMessage() == null || !e.getMessage().contains(msg))) {
U.error(log, "Unexpected exception message.", e);
fail("Exception message is not as expected [expected=" + msg + ", actual=" + e.getMessage() + ']', e);
}
if (log != null) {
if (log.isInfoEnabled())
log.info("Caught expected exception: " + e.getMessage());
}
else
X.println("Caught expected exception: " + e.getMessage());
return e;
}
throw new AssertionError("Exception has not been thrown.");
} | static Throwable function(@Nullable IgniteLogger log, Callable<?> call, Class<? extends Throwable> cls, @Nullable String msg) { assert call != null; assert cls != null; try { call.call(); } catch (Throwable e) { if (cls != e.getClass()) { if (e.getClass() == CacheException.class && e.getCause() != null && e.getCause().getClass() == cls) e = e.getCause(); else { U.error(log, STR, e); fail(STR + cls + STR + e.getClass() + ']', e); } } if (msg != null && (e.getMessage() == null !e.getMessage().contains(msg))) { U.error(log, STR, e); fail(STR + msg + STR + e.getMessage() + ']', e); } if (log != null) { if (log.isInfoEnabled()) log.info(STR + e.getMessage()); } else X.println(STR + e.getMessage()); return e; } throw new AssertionError(STR); } | /**
* Checks whether callable throws expected exception or not.
*
* @param log Logger (optional).
* @param call Callable.
* @param cls Exception class.
* @param msg Exception message (optional). If provided exception message
* and this message should be equal.
* @return Thrown throwable.
*/ | Checks whether callable throws expected exception or not | assertThrows | {
"repo_name": "wmz7year/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java",
"license": "apache-2.0",
"size": 65162
} | [
"java.util.concurrent.Callable",
"javax.cache.CacheException",
"org.apache.ignite.IgniteLogger",
"org.apache.ignite.internal.util.typedef.X",
"org.apache.ignite.internal.util.typedef.internal.U",
"org.jetbrains.annotations.Nullable"
] | import java.util.concurrent.Callable; import javax.cache.CacheException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.Nullable; | import java.util.concurrent.*; import javax.cache.*; import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*; | [
"java.util",
"javax.cache",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.util; javax.cache; org.apache.ignite; org.jetbrains.annotations; | 539,833 |
public boolean implementsValidatable(EntityMode entityMode);
public Class getConcreteProxyClass(EntityMode entityMode); | boolean implementsValidatable(EntityMode entityMode); public Class function(EntityMode entityMode); | /**
* Get the proxy interface that instances of <em>this</em> concrete class will be
* cast to (optional operation).
*/ | Get the proxy interface that instances of this concrete class will be cast to (optional operation) | getConcreteProxyClass | {
"repo_name": "cacheonix/cacheonix-core",
"path": "3rdparty/hibernate-3.2/src/org/hibernate/persister/entity/EntityPersister.java",
"license": "lgpl-2.1",
"size": 21188
} | [
"org.hibernate.EntityMode"
] | import org.hibernate.EntityMode; | import org.hibernate.*; | [
"org.hibernate"
] | org.hibernate; | 1,792,280 |
public static String replaceTemplateString(String templateString, Map<String, String> replacementValues) throws
TemplateManagerHelperException {
StrSubstitutor substitutor = new StrSubstitutor(replacementValues);
String replacedString = substitutor.replace(templateString);
// If any templated value has no replacements
if (replacedString.contains(TemplateManagerConstants.TEMPLATED_ELEMENT_PATTERN_PREFIX)) {
throw new TemplateManagerHelperException("No matching replacement found for the value - " +
StringUtils.substringBetween(replacedString, TemplateManagerConstants
.TEMPLATED_ELEMENT_PATTERN_PREFIX, TemplateManagerConstants
.TEMPLATED_ELEMENT_PATTERN_SUFFIX));
}
return replacedString;
} | static String function(String templateString, Map<String, String> replacementValues) throws TemplateManagerHelperException { StrSubstitutor substitutor = new StrSubstitutor(replacementValues); String replacedString = substitutor.replace(templateString); if (replacedString.contains(TemplateManagerConstants.TEMPLATED_ELEMENT_PATTERN_PREFIX)) { throw new TemplateManagerHelperException(STR + StringUtils.substringBetween(replacedString, TemplateManagerConstants .TEMPLATED_ELEMENT_PATTERN_PREFIX, TemplateManagerConstants .TEMPLATED_ELEMENT_PATTERN_SUFFIX)); } return replacedString; } | /**
* Replaces elements templated within characters '${' and '}', with provided replacement values
*
* @param templateString
* @param replacementValues
* @return
* @throws TemplateManagerHelperException
*/ | Replaces elements templated within characters '${' and '}', with provided replacement values | replaceTemplateString | {
"repo_name": "minudika/carbon-analytics",
"path": "components/org.wso2.carbon.business.rules.core/src/main/java/org/wso2/carbon/business/rules/core/util/TemplateManagerHelper.java",
"license": "apache-2.0",
"size": 24917
} | [
"java.util.Map",
"org.apache.commons.lang3.StringUtils",
"org.apache.commons.lang3.text.StrSubstitutor",
"org.wso2.carbon.business.rules.core.exceptions.TemplateManagerHelperException"
] | import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.text.StrSubstitutor; import org.wso2.carbon.business.rules.core.exceptions.TemplateManagerHelperException; | import java.util.*; import org.apache.commons.lang3.*; import org.apache.commons.lang3.text.*; import org.wso2.carbon.business.rules.core.exceptions.*; | [
"java.util",
"org.apache.commons",
"org.wso2.carbon"
] | java.util; org.apache.commons; org.wso2.carbon; | 281,270 |
public double getRating(Team team, Player player, int time) {
// System.out.println("Calculating rating for player: " + player.getFamilyName());
Double currentValue = null;
double totalValue = 0;
double statsSize = 0;
Tactics.TacticLine yPos = team.getPosYByPlayer(player);
Tactics.TacticPosition xPos = team.getPosXByPlayer(player);
int posQualifier = 0;
boolean unrated = true;
// Gk long pass
currentValue = gkLongPass.getCurrentRating(RealWorldMapping.EXP_GkLongPass, 0, time);
// System.out.println("Rating after goalkeeper long pass: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_GkLongPass);
statsSize += (1 + RealWorldMapping.EVAL_GkLongPass);
unrated = false;
}
// Long pass
if (yPos == Tactics.TacticLine.DEFENDER) {
posQualifier = RealWorldMapping.THR_LongPass_DEF;
} else if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_LongPass_MID;
}
currentValue = longPass.getCurrentRating(RealWorldMapping.EXP_LongPass, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after long pass: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_LongPass);
statsSize += (1 + RealWorldMapping.EVAL_LongPass);
unrated = false;
}
// Forward pass
if (yPos == Tactics.TacticLine.DEFENDER) {
posQualifier = RealWorldMapping.THR_ForwPass_DEF;
} else if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_ForwPass_MID;
}
currentValue = forwardPass.getCurrentRating(RealWorldMapping.EXP_ForwardPass, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after forward pass: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_ForwardPass);
statsSize += (1 + RealWorldMapping.EVAL_ForwardPass);
unrated = false;
}
// Flank pass
if (yPos == Tactics.TacticLine.DEFENDER) {
posQualifier = RealWorldMapping.THR_FlankPass_DEF;
} else if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_FlankPass_MID;
}
currentValue = flankPass .getCurrentRating(RealWorldMapping.EXP_FlankPass, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after flank pass: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_FlankPass);
statsSize += (1 + RealWorldMapping.EVAL_FlankPass);
unrated = false;
}
// Ball control
if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_BallControl_MID;
} else if (yPos == Tactics.TacticLine.FORWARD) {
posQualifier = RealWorldMapping.THR_BallControl_FOR;
}
currentValue = ballControl.getCurrentRating(RealWorldMapping.EXP_BallControl, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after ball control: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_BallControl);
statsSize += (1 + RealWorldMapping.EVAL_BallControl);
unrated = false;
}
// Pass
if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_Pass_MID;
}
currentValue = pass.getCurrentRating(RealWorldMapping.EXP_Pass, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after pass: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_Pass);
statsSize += (1 + RealWorldMapping.EVAL_Pass);
unrated = false;
}
// Run ball
if (yPos == Tactics.TacticLine.DEFENDER) {
posQualifier = RealWorldMapping.THR_RunBall_DEF;
} else if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_RunBall_MID;
}
currentValue = runBall.getCurrentRating(RealWorldMapping.EXP_RunBall, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after run ball: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_RunBall);
statsSize += (1 + RealWorldMapping.EVAL_RunBall);
unrated = false;
}
// Low cross
if (yPos == Tactics.TacticLine.MIDFIELDER) {
if (xPos == Tactics.TacticPosition.LEFT_AXIS || xPos == Tactics.TacticPosition.RIGHT_AXIS) {
posQualifier = RealWorldMapping.THR_LowCross_MID_CF;
} else if (xPos == Tactics.TacticPosition.LEFT || xPos == Tactics.TacticPosition.RIGHT) {
posQualifier = RealWorldMapping.THR_LowCross_MID_F;
}
} else if (yPos == Tactics.TacticLine.FORWARD) {
if (xPos == Tactics.TacticPosition.LEFT_AXIS || xPos == Tactics.TacticPosition.RIGHT_AXIS) {
posQualifier = RealWorldMapping.THR_LowCross_FOR_CF;
} else if (xPos == Tactics.TacticPosition.LEFT || xPos == Tactics.TacticPosition.RIGHT) {
posQualifier = RealWorldMapping.THR_LowCross_FOR_F;
}
}
currentValue = lowCross.getCurrentRating(RealWorldMapping.EXP_LowCross, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after low cross: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_LowCross);
statsSize += (1 + RealWorldMapping.EVAL_LowCross);
unrated = false;
}
// Cross
if (yPos == Tactics.TacticLine.DEFENDER) {
if (xPos == Tactics.TacticPosition.LEFT_AXIS || xPos == Tactics.TacticPosition.RIGHT_AXIS) {
posQualifier = RealWorldMapping.THR_Cross_DEF_CF;
} else if (xPos == Tactics.TacticPosition.LEFT || xPos == Tactics.TacticPosition.RIGHT) {
posQualifier = RealWorldMapping.THR_Cross_DEF_F;
}
} else if (yPos == Tactics.TacticLine.MIDFIELDER) {
if (xPos == Tactics.TacticPosition.AXIS) {
posQualifier = RealWorldMapping.THR_Cross_MID_C;
} else if (xPos == Tactics.TacticPosition.LEFT_AXIS || xPos == Tactics.TacticPosition.RIGHT_AXIS) {
posQualifier = RealWorldMapping.THR_Cross_MID_CF;
} else if (xPos == Tactics.TacticPosition.LEFT || xPos == Tactics.TacticPosition.RIGHT) {
posQualifier = RealWorldMapping.THR_Cross_MID_F;
}
} else if (yPos == Tactics.TacticLine.FORWARD) {
if (xPos == Tactics.TacticPosition.LEFT_AXIS || xPos == Tactics.TacticPosition.RIGHT_AXIS) {
posQualifier = RealWorldMapping.THR_Cross_FOR_CF;
} else if (xPos == Tactics.TacticPosition.LEFT || xPos == Tactics.TacticPosition.RIGHT) {
posQualifier = RealWorldMapping.THR_Cross_FOR_F;
}
}
currentValue = cross.getCurrentRating(RealWorldMapping.EXP_Cross, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after cross: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_Cross);
statsSize += (1 + RealWorldMapping.EVAL_Cross);
unrated = false;
}
// Shots
if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_SHOTS_MID;
} else if (yPos == Tactics.TacticLine.FORWARD) {
posQualifier = RealWorldMapping.THR_SHOTS_FOR;
}
currentValue = shots.getCurrentRating(1 / (RealWorldMapping.avgFinishing + RealWorldMapping.avgShooting + 1),
adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after shots: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_Shots);
statsSize += (1 + RealWorldMapping.EVAL_Shots);
unrated = false;
}
// Headings
if (xPos == Tactics.TacticPosition.LEFT_AXIS || xPos == Tactics.TacticPosition.RIGHT_AXIS) {
posQualifier = RealWorldMapping.THR_HEADINGS_FOR_CF;
} else if (xPos == Tactics.TacticPosition.LEFT || xPos == Tactics.TacticPosition.RIGHT) {
posQualifier = RealWorldMapping.THR_HEADINGS_FOR_C;
}
currentValue = headingsOnTarget.getRating(1 / (RealWorldMapping.avgFinishing + RealWorldMapping.avgShooting + 1),
adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after headings: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * (1 + RealWorldMapping.EVAL_Shots);
statsSize += (1 + RealWorldMapping.EVAL_Shots);
unrated = false;
}
// Dribbling
if (yPos == Tactics.TacticLine.DEFENDER) {
posQualifier = RealWorldMapping.THR_Dribbling_DEF;
} else if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_Dribbling_MID;
} else if (yPos == Tactics.TacticLine.FORWARD) {
posQualifier = RealWorldMapping.THR_Dribbling_FOR;
}
currentValue = dribbling.getCurrentRating(RealWorldMapping.EXP_Dribbling, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after dribbling: " + currentValue);
if (currentValue != null) { // Dribbling evaluation factor is one
totalValue += currentValue;
++statsSize;
unrated = false;
}
// Long flank pass
if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_LongFlankPass_MID;
}
currentValue = longFlankPass.getCurrentRating(RealWorldMapping.EXP_LongFlankPass, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after long flank pass: " + currentValue);
if (currentValue != null) {
totalValue += currentValue;
++statsSize;
unrated = false;
}
// Area pass
if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_AreaPass_MID;
} else if (yPos == Tactics.TacticLine.FORWARD) {
posQualifier = RealWorldMapping.THR_AreaPass_FOR;
}
currentValue = areaPass.getCurrentRating(RealWorldMapping.EXP_AreaPass, adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after area pass: " + currentValue);
if (currentValue != null) {
totalValue += currentValue;
++statsSize;
unrated = false;
}
// Individual challenges
if (yPos == Tactics.TacticLine.DEFENDER) {
posQualifier = RealWorldMapping.THR_IndCh_DEF;
} else if (yPos == Tactics.TacticLine.MIDFIELDER) {
posQualifier = RealWorldMapping.THR_IndCh_MID;
}
currentValue = personalChallenges.getCurrentRating(adjustThresholdToTime(posQualifier, time), time);
// System.out.println("Rating after personal challenges: " + currentValue);
if (currentValue != null) {
totalValue += currentValue;
++statsSize;
unrated = false;
}
// Interceptions
currentValue = interceptions.getCurrentRating(0, time);
// System.out.println("Rating after interceptions: " + currentValue);
if (currentValue != null) {
totalValue += currentValue;
++statsSize;
unrated = false;
}
// Saves
currentValue = saves.getCurrentRating(0, time);
// System.out.println("Rating after saves: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * RealWorldMapping.EVAL_SAVES;
statsSize += RealWorldMapping.EVAL_SAVES;
unrated = false;
}
// Concedings
currentValue = concedings.getNegativeRating(time);
// System.out.println("Rating after concedings: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * RealWorldMapping.EVAl_CONCEDINGS;
statsSize += RealWorldMapping.EVAl_CONCEDINGS;
unrated = false;
}
// Penalties missed
int currentPenaltiesMissed = adjustToTime(this.penaltiesMissedRecord, time).size();
currentValue = new UnitStats(currentPenaltiesMissed).getNegativeRating();
// System.out.println("Rating after penalties missed: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * RealWorldMapping.EVAL_PENALTIES_MISSED;
statsSize += RealWorldMapping.EVAL_PENALTIES_MISSED;
unrated = false;
}
// Penalties saved
int currentPenaltiesSaved = adjustToTime(this.penaltiesSavedRecord, time).size();
currentValue = new UnitStats(currentPenaltiesSaved).getNegativeRating();
// System.out.println("Rating after penalties saved: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * RealWorldMapping.EVAL_PENALTIES_SAVED;
statsSize += RealWorldMapping.EVAL_PENALTIES_SAVED;
unrated = false;
}
// Goals scored from penalties
int currentGoalsScored = adjustToTime(this.goalsRecord, time).size();
int currentSuccShots = this.getAllShotsSucc(time);
currentValue = new UnitStats(currentGoalsScored - currentSuccShots).getRating(0);
// System.out.println("Rating after goals scored from penalties: " + currentValue);
if (currentValue != null) {
totalValue += currentValue * RealWorldMapping.EVAL_PENALTY_GOALS;
statsSize += RealWorldMapping.EVAL_PENALTY_GOALS;
unrated = false;
}
// System.out.println("Total value: " + totalValue);
if (unrated) return -1;
return totalValue / statsSize;
}
| double function(Team team, Player player, int time) { Double currentValue = null; double totalValue = 0; double statsSize = 0; Tactics.TacticLine yPos = team.getPosYByPlayer(player); Tactics.TacticPosition xPos = team.getPosXByPlayer(player); int posQualifier = 0; boolean unrated = true; currentValue = gkLongPass.getCurrentRating(RealWorldMapping.EXP_GkLongPass, 0, time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_GkLongPass); statsSize += (1 + RealWorldMapping.EVAL_GkLongPass); unrated = false; } if (yPos == Tactics.TacticLine.DEFENDER) { posQualifier = RealWorldMapping.THR_LongPass_DEF; } else if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_LongPass_MID; } currentValue = longPass.getCurrentRating(RealWorldMapping.EXP_LongPass, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_LongPass); statsSize += (1 + RealWorldMapping.EVAL_LongPass); unrated = false; } if (yPos == Tactics.TacticLine.DEFENDER) { posQualifier = RealWorldMapping.THR_ForwPass_DEF; } else if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_ForwPass_MID; } currentValue = forwardPass.getCurrentRating(RealWorldMapping.EXP_ForwardPass, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_ForwardPass); statsSize += (1 + RealWorldMapping.EVAL_ForwardPass); unrated = false; } if (yPos == Tactics.TacticLine.DEFENDER) { posQualifier = RealWorldMapping.THR_FlankPass_DEF; } else if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_FlankPass_MID; } currentValue = flankPass .getCurrentRating(RealWorldMapping.EXP_FlankPass, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_FlankPass); statsSize += (1 + RealWorldMapping.EVAL_FlankPass); unrated = false; } if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_BallControl_MID; } else if (yPos == Tactics.TacticLine.FORWARD) { posQualifier = RealWorldMapping.THR_BallControl_FOR; } currentValue = ballControl.getCurrentRating(RealWorldMapping.EXP_BallControl, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_BallControl); statsSize += (1 + RealWorldMapping.EVAL_BallControl); unrated = false; } if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_Pass_MID; } currentValue = pass.getCurrentRating(RealWorldMapping.EXP_Pass, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_Pass); statsSize += (1 + RealWorldMapping.EVAL_Pass); unrated = false; } if (yPos == Tactics.TacticLine.DEFENDER) { posQualifier = RealWorldMapping.THR_RunBall_DEF; } else if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_RunBall_MID; } currentValue = runBall.getCurrentRating(RealWorldMapping.EXP_RunBall, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_RunBall); statsSize += (1 + RealWorldMapping.EVAL_RunBall); unrated = false; } if (yPos == Tactics.TacticLine.MIDFIELDER) { if (xPos == Tactics.TacticPosition.LEFT_AXIS xPos == Tactics.TacticPosition.RIGHT_AXIS) { posQualifier = RealWorldMapping.THR_LowCross_MID_CF; } else if (xPos == Tactics.TacticPosition.LEFT xPos == Tactics.TacticPosition.RIGHT) { posQualifier = RealWorldMapping.THR_LowCross_MID_F; } } else if (yPos == Tactics.TacticLine.FORWARD) { if (xPos == Tactics.TacticPosition.LEFT_AXIS xPos == Tactics.TacticPosition.RIGHT_AXIS) { posQualifier = RealWorldMapping.THR_LowCross_FOR_CF; } else if (xPos == Tactics.TacticPosition.LEFT xPos == Tactics.TacticPosition.RIGHT) { posQualifier = RealWorldMapping.THR_LowCross_FOR_F; } } currentValue = lowCross.getCurrentRating(RealWorldMapping.EXP_LowCross, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_LowCross); statsSize += (1 + RealWorldMapping.EVAL_LowCross); unrated = false; } if (yPos == Tactics.TacticLine.DEFENDER) { if (xPos == Tactics.TacticPosition.LEFT_AXIS xPos == Tactics.TacticPosition.RIGHT_AXIS) { posQualifier = RealWorldMapping.THR_Cross_DEF_CF; } else if (xPos == Tactics.TacticPosition.LEFT xPos == Tactics.TacticPosition.RIGHT) { posQualifier = RealWorldMapping.THR_Cross_DEF_F; } } else if (yPos == Tactics.TacticLine.MIDFIELDER) { if (xPos == Tactics.TacticPosition.AXIS) { posQualifier = RealWorldMapping.THR_Cross_MID_C; } else if (xPos == Tactics.TacticPosition.LEFT_AXIS xPos == Tactics.TacticPosition.RIGHT_AXIS) { posQualifier = RealWorldMapping.THR_Cross_MID_CF; } else if (xPos == Tactics.TacticPosition.LEFT xPos == Tactics.TacticPosition.RIGHT) { posQualifier = RealWorldMapping.THR_Cross_MID_F; } } else if (yPos == Tactics.TacticLine.FORWARD) { if (xPos == Tactics.TacticPosition.LEFT_AXIS xPos == Tactics.TacticPosition.RIGHT_AXIS) { posQualifier = RealWorldMapping.THR_Cross_FOR_CF; } else if (xPos == Tactics.TacticPosition.LEFT xPos == Tactics.TacticPosition.RIGHT) { posQualifier = RealWorldMapping.THR_Cross_FOR_F; } } currentValue = cross.getCurrentRating(RealWorldMapping.EXP_Cross, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_Cross); statsSize += (1 + RealWorldMapping.EVAL_Cross); unrated = false; } if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_SHOTS_MID; } else if (yPos == Tactics.TacticLine.FORWARD) { posQualifier = RealWorldMapping.THR_SHOTS_FOR; } currentValue = shots.getCurrentRating(1 / (RealWorldMapping.avgFinishing + RealWorldMapping.avgShooting + 1), adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_Shots); statsSize += (1 + RealWorldMapping.EVAL_Shots); unrated = false; } if (xPos == Tactics.TacticPosition.LEFT_AXIS xPos == Tactics.TacticPosition.RIGHT_AXIS) { posQualifier = RealWorldMapping.THR_HEADINGS_FOR_CF; } else if (xPos == Tactics.TacticPosition.LEFT xPos == Tactics.TacticPosition.RIGHT) { posQualifier = RealWorldMapping.THR_HEADINGS_FOR_C; } currentValue = headingsOnTarget.getRating(1 / (RealWorldMapping.avgFinishing + RealWorldMapping.avgShooting + 1), adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue * (1 + RealWorldMapping.EVAL_Shots); statsSize += (1 + RealWorldMapping.EVAL_Shots); unrated = false; } if (yPos == Tactics.TacticLine.DEFENDER) { posQualifier = RealWorldMapping.THR_Dribbling_DEF; } else if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_Dribbling_MID; } else if (yPos == Tactics.TacticLine.FORWARD) { posQualifier = RealWorldMapping.THR_Dribbling_FOR; } currentValue = dribbling.getCurrentRating(RealWorldMapping.EXP_Dribbling, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue; ++statsSize; unrated = false; } if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_LongFlankPass_MID; } currentValue = longFlankPass.getCurrentRating(RealWorldMapping.EXP_LongFlankPass, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue; ++statsSize; unrated = false; } if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_AreaPass_MID; } else if (yPos == Tactics.TacticLine.FORWARD) { posQualifier = RealWorldMapping.THR_AreaPass_FOR; } currentValue = areaPass.getCurrentRating(RealWorldMapping.EXP_AreaPass, adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue; ++statsSize; unrated = false; } if (yPos == Tactics.TacticLine.DEFENDER) { posQualifier = RealWorldMapping.THR_IndCh_DEF; } else if (yPos == Tactics.TacticLine.MIDFIELDER) { posQualifier = RealWorldMapping.THR_IndCh_MID; } currentValue = personalChallenges.getCurrentRating(adjustThresholdToTime(posQualifier, time), time); if (currentValue != null) { totalValue += currentValue; ++statsSize; unrated = false; } currentValue = interceptions.getCurrentRating(0, time); if (currentValue != null) { totalValue += currentValue; ++statsSize; unrated = false; } currentValue = saves.getCurrentRating(0, time); if (currentValue != null) { totalValue += currentValue * RealWorldMapping.EVAL_SAVES; statsSize += RealWorldMapping.EVAL_SAVES; unrated = false; } currentValue = concedings.getNegativeRating(time); if (currentValue != null) { totalValue += currentValue * RealWorldMapping.EVAl_CONCEDINGS; statsSize += RealWorldMapping.EVAl_CONCEDINGS; unrated = false; } int currentPenaltiesMissed = adjustToTime(this.penaltiesMissedRecord, time).size(); currentValue = new UnitStats(currentPenaltiesMissed).getNegativeRating(); if (currentValue != null) { totalValue += currentValue * RealWorldMapping.EVAL_PENALTIES_MISSED; statsSize += RealWorldMapping.EVAL_PENALTIES_MISSED; unrated = false; } int currentPenaltiesSaved = adjustToTime(this.penaltiesSavedRecord, time).size(); currentValue = new UnitStats(currentPenaltiesSaved).getNegativeRating(); if (currentValue != null) { totalValue += currentValue * RealWorldMapping.EVAL_PENALTIES_SAVED; statsSize += RealWorldMapping.EVAL_PENALTIES_SAVED; unrated = false; } int currentGoalsScored = adjustToTime(this.goalsRecord, time).size(); int currentSuccShots = this.getAllShotsSucc(time); currentValue = new UnitStats(currentGoalsScored - currentSuccShots).getRating(0); if (currentValue != null) { totalValue += currentValue * RealWorldMapping.EVAL_PENALTY_GOALS; statsSize += RealWorldMapping.EVAL_PENALTY_GOALS; unrated = false; } if (unrated) return -1; return totalValue / statsSize; } | /**
* Calculate a player's rating in the match in a specific time point
* @param team The player's team
* @param player The player object
* @param time The virtual time point up to which the player's rating will be calculated
* @return The player's rating
*/ | Calculate a player's rating in the match in a specific time point | getRating | {
"repo_name": "lukecampbell99/OpenSoccer",
"path": "src/com/lukeyboy1/core/PlayerStats.java",
"license": "gpl-3.0",
"size": 65880
} | [
"com.lukeyboy1.gameplay.Player",
"com.lukeyboy1.utility.RealWorldMapping",
"com.lukeyboy1.utility.Tactics"
] | import com.lukeyboy1.gameplay.Player; import com.lukeyboy1.utility.RealWorldMapping; import com.lukeyboy1.utility.Tactics; | import com.lukeyboy1.gameplay.*; import com.lukeyboy1.utility.*; | [
"com.lukeyboy1.gameplay",
"com.lukeyboy1.utility"
] | com.lukeyboy1.gameplay; com.lukeyboy1.utility; | 1,939,969 |
public DataHandler getContentFile() {
return contentFile;
} | DataHandler function() { return contentFile; } | /**
* Returns a data handler that contains the content. Used to deliver content through web services.
*
* @return content
*/ | Returns a data handler that contains the content. Used to deliver content through web services | getContentFile | {
"repo_name": "sameerak/carbon-registry",
"path": "components/registry/org.wso2.carbon.registry.ws.api/src/main/java/org/wso2/carbon/registry/ws/api/WSResource.java",
"license": "apache-2.0",
"size": 9224
} | [
"javax.activation.DataHandler"
] | import javax.activation.DataHandler; | import javax.activation.*; | [
"javax.activation"
] | javax.activation; | 793,384 |
public static Date getDate(
java.util.Calendar cal,
String str,
LocaleFinder localeFinder)
throws StandardException
{
if( str == null)
return null;
SQLDate internalDate = new SQLDate(str, false, localeFinder);
return internalDate.getDate(cal);
} | static Date function( java.util.Calendar cal, String str, LocaleFinder localeFinder) throws StandardException { if( str == null) return null; SQLDate internalDate = new SQLDate(str, false, localeFinder); return internalDate.getDate(cal); } | /**
* Static function to Get date from a string.
*
* @see DataValueDescriptor#getDate
*
* @exception StandardException thrown on failure to convert
**/ | Static function to Get date from a string | getDate | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.engine/org/apache/derby/iapi/types/SQLChar.java",
"license": "apache-2.0",
"size": 99002
} | [
"java.sql.Date",
"java.util.Calendar",
"org.apache.derby.shared.common.error.StandardException",
"org.apache.derby.shared.common.i18n.LocaleFinder"
] | import java.sql.Date; import java.util.Calendar; import org.apache.derby.shared.common.error.StandardException; import org.apache.derby.shared.common.i18n.LocaleFinder; | import java.sql.*; import java.util.*; import org.apache.derby.shared.common.error.*; import org.apache.derby.shared.common.i18n.*; | [
"java.sql",
"java.util",
"org.apache.derby"
] | java.sql; java.util; org.apache.derby; | 2,305,244 |
private void readBlockMeta(String path,
boolean dirsOnly,
MetadataContext metaContext) throws IOException {
Stopwatch timer = Stopwatch.createStarted();
Path p = new Path(path);
Path parentDir = Path.getPathWithoutSchemeAndAuthority(p.getParent()); // parent directory of the metadata file
String parentDirString = parentDir.toUri().toString(); // string representation for parent directory of the metadata file
ObjectMapper mapper = new ObjectMapper();
final SimpleModule serialModule = new SimpleModule();
serialModule.addDeserializer(SchemaPath.class, new SchemaPath.De());
serialModule.addKeyDeserializer(ColumnTypeMetadata_v2.Key.class, new ColumnTypeMetadata_v2.Key.DeSerializer());
serialModule.addKeyDeserializer(ColumnTypeMetadata_v3.Key.class, new ColumnTypeMetadata_v3.Key.DeSerializer());
AfterburnerModule module = new AfterburnerModule();
module.setUseOptimizedBeanDeserializer(true);
mapper.registerModule(serialModule);
mapper.registerModule(module);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
FSDataInputStream is = fs.open(p);
boolean alreadyCheckedModification = false;
boolean newMetadata = false;
if (metaContext != null) {
alreadyCheckedModification = metaContext.getStatus(parentDirString);
}
if (dirsOnly) {
parquetTableMetadataDirs = mapper.readValue(is, ParquetTableMetadataDirs.class);
logger.info("Took {} ms to read directories from directory cache file", timer.elapsed(TimeUnit.MILLISECONDS));
timer.stop();
parquetTableMetadataDirs.updateRelativePaths(parentDirString);
if (!alreadyCheckedModification && tableModified(parquetTableMetadataDirs.getDirectories(), p, parentDir, metaContext)) {
parquetTableMetadataDirs =
(createMetaFilesRecursively(Path.getPathWithoutSchemeAndAuthority(p.getParent()).toString())).getRight();
newMetadata = true;
}
} else {
parquetTableMetadata = mapper.readValue(is, ParquetTableMetadataBase.class);
logger.info("Took {} ms to read metadata from cache file", timer.elapsed(TimeUnit.MILLISECONDS));
timer.stop();
if (parquetTableMetadata instanceof ParquetTableMetadata_v3) {
((ParquetTableMetadata_v3) parquetTableMetadata).updateRelativePaths(parentDirString);
}
if (!alreadyCheckedModification && tableModified(parquetTableMetadata.getDirectories(), p, parentDir, metaContext)) {
parquetTableMetadata =
(createMetaFilesRecursively(Path.getPathWithoutSchemeAndAuthority(p.getParent()).toString())).getLeft();
newMetadata = true;
}
// DRILL-5009: Remove the RowGroup if it is empty
List<? extends ParquetFileMetadata> files = parquetTableMetadata.getFiles();
for (ParquetFileMetadata file : files) {
List<? extends RowGroupMetadata> rowGroups = file.getRowGroups();
for (Iterator<? extends RowGroupMetadata> iter = rowGroups.iterator(); iter.hasNext(); ) {
RowGroupMetadata r = iter.next();
if (r.getRowCount() == 0) {
iter.remove();
}
}
}
}
if (newMetadata && metaContext != null) {
// if new metadata files were created, invalidate the existing metadata context
metaContext.clear();
}
} | void function(String path, boolean dirsOnly, MetadataContext metaContext) throws IOException { Stopwatch timer = Stopwatch.createStarted(); Path p = new Path(path); Path parentDir = Path.getPathWithoutSchemeAndAuthority(p.getParent()); String parentDirString = parentDir.toUri().toString(); ObjectMapper mapper = new ObjectMapper(); final SimpleModule serialModule = new SimpleModule(); serialModule.addDeserializer(SchemaPath.class, new SchemaPath.De()); serialModule.addKeyDeserializer(ColumnTypeMetadata_v2.Key.class, new ColumnTypeMetadata_v2.Key.DeSerializer()); serialModule.addKeyDeserializer(ColumnTypeMetadata_v3.Key.class, new ColumnTypeMetadata_v3.Key.DeSerializer()); AfterburnerModule module = new AfterburnerModule(); module.setUseOptimizedBeanDeserializer(true); mapper.registerModule(serialModule); mapper.registerModule(module); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); FSDataInputStream is = fs.open(p); boolean alreadyCheckedModification = false; boolean newMetadata = false; if (metaContext != null) { alreadyCheckedModification = metaContext.getStatus(parentDirString); } if (dirsOnly) { parquetTableMetadataDirs = mapper.readValue(is, ParquetTableMetadataDirs.class); logger.info(STR, timer.elapsed(TimeUnit.MILLISECONDS)); timer.stop(); parquetTableMetadataDirs.updateRelativePaths(parentDirString); if (!alreadyCheckedModification && tableModified(parquetTableMetadataDirs.getDirectories(), p, parentDir, metaContext)) { parquetTableMetadataDirs = (createMetaFilesRecursively(Path.getPathWithoutSchemeAndAuthority(p.getParent()).toString())).getRight(); newMetadata = true; } } else { parquetTableMetadata = mapper.readValue(is, ParquetTableMetadataBase.class); logger.info(STR, timer.elapsed(TimeUnit.MILLISECONDS)); timer.stop(); if (parquetTableMetadata instanceof ParquetTableMetadata_v3) { ((ParquetTableMetadata_v3) parquetTableMetadata).updateRelativePaths(parentDirString); } if (!alreadyCheckedModification && tableModified(parquetTableMetadata.getDirectories(), p, parentDir, metaContext)) { parquetTableMetadata = (createMetaFilesRecursively(Path.getPathWithoutSchemeAndAuthority(p.getParent()).toString())).getLeft(); newMetadata = true; } List<? extends ParquetFileMetadata> files = parquetTableMetadata.getFiles(); for (ParquetFileMetadata file : files) { List<? extends RowGroupMetadata> rowGroups = file.getRowGroups(); for (Iterator<? extends RowGroupMetadata> iter = rowGroups.iterator(); iter.hasNext(); ) { RowGroupMetadata r = iter.next(); if (r.getRowCount() == 0) { iter.remove(); } } } } if (newMetadata && metaContext != null) { metaContext.clear(); } } | /**
* Read the parquet metadata from a file
*
* @param path
* @return
* @throws IOException
*/ | Read the parquet metadata from a file | readBlockMeta | {
"repo_name": "sindhurirayavaram/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java",
"license": "apache-2.0",
"size": 63654
} | [
"com.fasterxml.jackson.databind.DeserializationFeature",
"com.fasterxml.jackson.databind.ObjectMapper",
"com.fasterxml.jackson.databind.module.SimpleModule",
"com.fasterxml.jackson.module.afterburner.AfterburnerModule",
"com.google.common.base.Stopwatch",
"java.io.IOException",
"java.util.Iterator",
"... | import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.module.afterburner.AfterburnerModule; import com.google.common.base.Stopwatch; import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.concurrent.TimeUnit; import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.exec.store.dfs.MetadataContext; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.Path; | import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.module.*; import com.fasterxml.jackson.module.afterburner.*; import com.google.common.base.*; import java.io.*; import java.util.*; import java.util.concurrent.*; import org.apache.drill.common.expression.*; import org.apache.drill.exec.store.dfs.*; import org.apache.hadoop.fs.*; | [
"com.fasterxml.jackson",
"com.google.common",
"java.io",
"java.util",
"org.apache.drill",
"org.apache.hadoop"
] | com.fasterxml.jackson; com.google.common; java.io; java.util; org.apache.drill; org.apache.hadoop; | 1,508,392 |
@Override
public boolean containsContext(final HttpServletRequest request) {
final Optional<String> token = getToken(request);
if (token.isPresent()) {
LOGGER.debug("HttpServletRequest Contains a security context (JWT)");
}
return token.isPresent();
} | boolean function(final HttpServletRequest request) { final Optional<String> token = getToken(request); if (token.isPresent()) { LOGGER.debug(STR); } return token.isPresent(); } | /**
* Returns whether or not the HttpServlet Request appears to contain a JWT in the Authorization Header
* @param request An instance of the Servlet request
* @return true if the request contains a JWT header
*/ | Returns whether or not the HttpServlet Request appears to contain a JWT in the Authorization Header | containsContext | {
"repo_name": "rmanders/kbdb",
"path": "src/main/java/org/schlocknet/kbdb/security/AuthServiceSecurityContextRepository.java",
"license": "gpl-2.0",
"size": 5225
} | [
"java.util.Optional",
"javax.servlet.http.HttpServletRequest"
] | import java.util.Optional; import javax.servlet.http.HttpServletRequest; | import java.util.*; import javax.servlet.http.*; | [
"java.util",
"javax.servlet"
] | java.util; javax.servlet; | 2,050,114 |
@Override
public J setNextLink(BSCarouselControl nextLink)
{
getChildren().remove(this.nextLink);
this.nextLink = nextLink;
if (this.nextLink != null)
{
nextLink.addClass("right");
nextLink.addClass(BSComponentCarouselOptions.Carousel_Control);
nextLink.addAttribute("role", "button");
nextLink.addAttribute("data-slide", "next");
Span iconSpan = new Span();
iconSpan.addAttribute(GlobalAttributes.Aria_Hidden, "true");
iconSpan.addClass(BSComponentCarouselOptions.Icon_Next);
Span readerFriendly = new Span("Next");
readerFriendly.addClass(BSColoursOptions.Sr_Only);
nextLink.add(iconSpan);
nextLink.add(readerFriendly);
}
return (J) this;
} | J function(BSCarouselControl nextLink) { getChildren().remove(this.nextLink); this.nextLink = nextLink; if (this.nextLink != null) { nextLink.addClass("right"); nextLink.addClass(BSComponentCarouselOptions.Carousel_Control); nextLink.addAttribute("role", STR); nextLink.addAttribute(STR, "next"); Span iconSpan = new Span(); iconSpan.addAttribute(GlobalAttributes.Aria_Hidden, "true"); iconSpan.addClass(BSComponentCarouselOptions.Icon_Next); Span readerFriendly = new Span("Next"); readerFriendly.addClass(BSColoursOptions.Sr_Only); nextLink.add(iconSpan); nextLink.add(readerFriendly); } return (J) this; } | /**
* Sets the next link
*
* @param nextLink
*
* @return
*/ | Sets the next link | setNextLink | {
"repo_name": "GedMarc/JWebSwing-BootstrapPlugin",
"path": "src/main/java/com/jwebmp/plugins/bootstrap/carousel/BSCarousel.java",
"license": "gpl-3.0",
"size": 9883
} | [
"com.jwebmp.core.base.html.Span",
"com.jwebmp.core.base.html.attributes.GlobalAttributes",
"com.jwebmp.plugins.bootstrap.options.BSColoursOptions"
] | import com.jwebmp.core.base.html.Span; import com.jwebmp.core.base.html.attributes.GlobalAttributes; import com.jwebmp.plugins.bootstrap.options.BSColoursOptions; | import com.jwebmp.core.base.html.*; import com.jwebmp.core.base.html.attributes.*; import com.jwebmp.plugins.bootstrap.options.*; | [
"com.jwebmp.core",
"com.jwebmp.plugins"
] | com.jwebmp.core; com.jwebmp.plugins; | 2,638,117 |
private LocalDate analyzeDates(final Family family) {
if (family == null) {
return null;
}
LocalDate earliestDate = null;
final FamilyAnalysisVisitor visitor = new FamilyAnalysisVisitor();
family.accept(visitor);
for (final Attribute attribute : visitor.getTrimmedAttributes()) {
basicOrderCheck(attribute);
setSeenEvent(attribute);
final LocalDate date = createLocalDate(attribute);
earliestDate = minDate(earliestDate, date);
}
return earliestDate(visitor);
} | LocalDate function(final Family family) { if (family == null) { return null; } LocalDate earliestDate = null; final FamilyAnalysisVisitor visitor = new FamilyAnalysisVisitor(); family.accept(visitor); for (final Attribute attribute : visitor.getTrimmedAttributes()) { basicOrderCheck(attribute); setSeenEvent(attribute); final LocalDate date = createLocalDate(attribute); earliestDate = minDate(earliestDate, date); } return earliestDate(visitor); } | /**
* Analyze the family. Add any date order problems to the analysis.
*
* @param family the family to check
* @return the earliest date of an event in the family
*/ | Analyze the family. Add any date order problems to the analysis | analyzeDates | {
"repo_name": "dickschoeller/gedbrowser",
"path": "gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/order/FamilyOrderAnalyzer.java",
"license": "apache-2.0",
"size": 4810
} | [
"org.joda.time.LocalDate",
"org.schoellerfamily.gedbrowser.analytics.visitor.FamilyAnalysisVisitor",
"org.schoellerfamily.gedbrowser.datamodel.Attribute",
"org.schoellerfamily.gedbrowser.datamodel.Family"
] | import org.joda.time.LocalDate; import org.schoellerfamily.gedbrowser.analytics.visitor.FamilyAnalysisVisitor; import org.schoellerfamily.gedbrowser.datamodel.Attribute; import org.schoellerfamily.gedbrowser.datamodel.Family; | import org.joda.time.*; import org.schoellerfamily.gedbrowser.analytics.visitor.*; import org.schoellerfamily.gedbrowser.datamodel.*; | [
"org.joda.time",
"org.schoellerfamily.gedbrowser"
] | org.joda.time; org.schoellerfamily.gedbrowser; | 1,150,987 |
private List<Table> expandTable(Graph g, net.sf.jailer.datamodel.Table table, Association toRender) {
List<Table> result = new ArrayList<Table>();
if (table != null && (!expandedTables.contains(table) || toRender != null)) {
List<Table> toCheck = new ArrayList<Table>();
result = addEdges(g, table, toRender, toCheck, false);
// expandedTables.add(table);
checkForExpansion(g, toCheck);
}
return result;
} | List<Table> function(Graph g, net.sf.jailer.datamodel.Table table, Association toRender) { List<Table> result = new ArrayList<Table>(); if (table != null && (!expandedTables.contains(table) toRender != null)) { List<Table> toCheck = new ArrayList<Table>(); result = addEdges(g, table, toRender, toCheck, false); checkForExpansion(g, toCheck); } return result; } | /**
* Expands a node representing a table.
*
* @param g the graph
* @param table the table node
* @param toRender if not null, the only association to make visible
*
* @return list of newly rendered tables
*/ | Expands a node representing a table | expandTable | {
"repo_name": "Recombine/jailer",
"path": "src/main/net/sf/jailer/ui/graphical_view/GraphicalDataModelView.java",
"license": "apache-2.0",
"size": 62732
} | [
"java.util.ArrayList",
"java.util.List",
"net.sf.jailer.datamodel.Association",
"net.sf.jailer.datamodel.Table"
] | import java.util.ArrayList; import java.util.List; import net.sf.jailer.datamodel.Association; import net.sf.jailer.datamodel.Table; | import java.util.*; import net.sf.jailer.datamodel.*; | [
"java.util",
"net.sf.jailer"
] | java.util; net.sf.jailer; | 1,985,914 |
private @NonNull File getAppDir() {
return new File(getRootDataDir(), getApplicationID());
} | @NonNull File function() { return new File(getRootDataDir(), getApplicationID()); } | /**
* Get the data directory for the current application ID.
*
* @return The data directory for the current application ID.
*/ | Get the data directory for the current application ID | getAppDir | {
"repo_name": "algolia/algoliasearch-client-android",
"path": "algoliasearch/src/offline/java/com/algolia/search/saas/OfflineClient.java",
"license": "mit",
"size": 16976
} | [
"android.support.annotation.NonNull",
"java.io.File"
] | import android.support.annotation.NonNull; import java.io.File; | import android.support.annotation.*; import java.io.*; | [
"android.support",
"java.io"
] | android.support; java.io; | 2,411,265 |
public static synchronized void listProviders(final Writer out, final Locale locale)
throws IOException
{
getServiceRegistry().getServiceProviders(DatumFactory.class); // Force the initialization of ServiceRegistry
final TableWriter table = new TableWriter(out, " \u2502 ");
table.setMultiLinesCells(true);
table.writeHorizontalSeparator();
table.write("Factory");
table.nextColumn();
table.write("Implementation(s)");
table.writeHorizontalSeparator();
for (final Iterator categories=getServiceRegistry().getCategories(); categories.hasNext();) {
final Class category = (Class)categories.next();
table.write(Utilities.getShortName(category));
table.nextColumn();
boolean first = true;
for (final Iterator providers=getServiceRegistry().getServiceProviders(category); providers.hasNext();) {
if (!first) {
table.write('\n');
}
first = false;
final Factory provider = (Factory)providers.next();
final Citation vendor = provider.getVendor();
table.write(vendor.getTitle().toString(locale));
}
table.nextLine();
}
table.writeHorizontalSeparator();
table.flush();
} | static synchronized void function(final Writer out, final Locale locale) throws IOException { getServiceRegistry().getServiceProviders(DatumFactory.class); final TableWriter table = new TableWriter(out, STR); table.setMultiLinesCells(true); table.writeHorizontalSeparator(); table.write(STR); table.nextColumn(); table.write(STR); table.writeHorizontalSeparator(); for (final Iterator categories=getServiceRegistry().getCategories(); categories.hasNext();) { final Class category = (Class)categories.next(); table.write(Utilities.getShortName(category)); table.nextColumn(); boolean first = true; for (final Iterator providers=getServiceRegistry().getServiceProviders(category); providers.hasNext();) { if (!first) { table.write('\n'); } first = false; final Factory provider = (Factory)providers.next(); final Citation vendor = provider.getVendor(); table.write(vendor.getTitle().toString(locale)); } table.nextLine(); } table.writeHorizontalSeparator(); table.flush(); } | /**
* List all available factory implementations in a tabular format. For each factory interface,
* the first implementation listed is the default one. This method provides a way to check the
* state of a system, usually for debugging purpose.
*
* @param out The output stream where to format the list.
* @param locale The locale for the list, or <code>null</code>.
* @throws IOException if an error occurs while writting to <code>out</code>.
*
* @todo Localize the title line.
*/ | List all available factory implementations in a tabular format. For each factory interface, the first implementation listed is the default one. This method provides a way to check the state of a system, usually for debugging purpose | listProviders | {
"repo_name": "iCarto/siga",
"path": "libFMap/src/com/iver/cit/gvsig/fmap/core/gt2/factory/FactoryFinder.java",
"license": "gpl-3.0",
"size": 35638
} | [
"java.io.IOException",
"java.io.Writer",
"java.util.Iterator",
"java.util.Locale",
"org.geotools.io.TableWriter",
"org.geotools.resources.Utilities",
"org.opengis.metadata.citation.Citation",
"org.opengis.referencing.Factory",
"org.opengis.referencing.datum.DatumFactory"
] | import java.io.IOException; import java.io.Writer; import java.util.Iterator; import java.util.Locale; import org.geotools.io.TableWriter; import org.geotools.resources.Utilities; import org.opengis.metadata.citation.Citation; import org.opengis.referencing.Factory; import org.opengis.referencing.datum.DatumFactory; | import java.io.*; import java.util.*; import org.geotools.io.*; import org.geotools.resources.*; import org.opengis.metadata.citation.*; import org.opengis.referencing.*; import org.opengis.referencing.datum.*; | [
"java.io",
"java.util",
"org.geotools.io",
"org.geotools.resources",
"org.opengis.metadata",
"org.opengis.referencing"
] | java.io; java.util; org.geotools.io; org.geotools.resources; org.opengis.metadata; org.opengis.referencing; | 539,517 |
public List<String> getTableCellAlignment() {
List<String> cellWidthList = new ArrayList<String>();
List<Class<? extends Formatter>> numberFormatters = this.getNumberFormatters();
for (Map.Entry<String, String> entry : orderedPropertyNameToHeaderLabelMap.entrySet()) {
String attributeName = entry.getKey();
boolean isNumber = false;
if (!attributeName.startsWith(KFSConstants.ReportConstants.EMPTY_CELL_ENTRY_KEY_PREFIX)) {
try {
Class<? extends Formatter> formatterClass = this.retrievePropertyFormatterClass(dataDictionaryBusinessObjectClass, attributeName);
isNumber = numberFormatters.contains(formatterClass);
} catch (Exception e) {
throw new RuntimeException("Failed getting propertyName=" + attributeName + " from businessObjecName=" + dataDictionaryBusinessObjectClass.getName(), e);
}
}
cellWidthList.add(isNumber ? RIGHT_ALIGNMENT : LEFT_ALIGNMENT);
}
return cellWidthList;
} | List<String> function() { List<String> cellWidthList = new ArrayList<String>(); List<Class<? extends Formatter>> numberFormatters = this.getNumberFormatters(); for (Map.Entry<String, String> entry : orderedPropertyNameToHeaderLabelMap.entrySet()) { String attributeName = entry.getKey(); boolean isNumber = false; if (!attributeName.startsWith(KFSConstants.ReportConstants.EMPTY_CELL_ENTRY_KEY_PREFIX)) { try { Class<? extends Formatter> formatterClass = this.retrievePropertyFormatterClass(dataDictionaryBusinessObjectClass, attributeName); isNumber = numberFormatters.contains(formatterClass); } catch (Exception e) { throw new RuntimeException(STR + attributeName + STR + dataDictionaryBusinessObjectClass.getName(), e); } } cellWidthList.add(isNumber ? RIGHT_ALIGNMENT : LEFT_ALIGNMENT); } return cellWidthList; } | /**
* get the alignment definitions of all table cells in one row according to the property's formatter class
*
* @return the alignment definitions of all table cells in one row according to the property's formatter class
*/ | get the alignment definitions of all table cells in one row according to the property's formatter class | getTableCellAlignment | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-core/src/main/java/org/kuali/kfs/sys/report/BusinessObjectReportHelper.java",
"license": "agpl-3.0",
"size": 24573
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.kuali.kfs.sys.KFSConstants",
"org.kuali.rice.core.web.format.Formatter"
] | import java.util.ArrayList; import java.util.List; import java.util.Map; import org.kuali.kfs.sys.KFSConstants; import org.kuali.rice.core.web.format.Formatter; | import java.util.*; import org.kuali.kfs.sys.*; import org.kuali.rice.core.web.format.*; | [
"java.util",
"org.kuali.kfs",
"org.kuali.rice"
] | java.util; org.kuali.kfs; org.kuali.rice; | 2,373,728 |
@Named("updateDomain")
@GET
@QueryParams(keys = "command", values = "updateDomain")
@SelectJson("domain")
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(NullOnNotFoundOr404.class)
Domain updateDomain(@QueryParam("id") String domainId, UpdateDomainOptions... options); | @Named(STR) @QueryParams(keys = STR, values = STR) @SelectJson(STR) @Consumes(MediaType.APPLICATION_JSON) @Fallback(NullOnNotFoundOr404.class) Domain updateDomain(@QueryParam("id") String domainId, UpdateDomainOptions... options); | /**
* Update a domain
*
* @param domainId
* the ID of the domain
* @param options
* optional arguments
* @return
* domain instance
*/ | Update a domain | updateDomain | {
"repo_name": "yanzhijun/jclouds-aliyun",
"path": "apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/GlobalDomainApi.java",
"license": "apache-2.0",
"size": 3508
} | [
"javax.inject.Named",
"javax.ws.rs.Consumes",
"javax.ws.rs.QueryParam",
"javax.ws.rs.core.MediaType",
"org.jclouds.Fallbacks",
"org.jclouds.cloudstack.domain.Domain",
"org.jclouds.cloudstack.options.UpdateDomainOptions",
"org.jclouds.rest.annotations.Fallback",
"org.jclouds.rest.annotations.QueryPar... | import javax.inject.Named; import javax.ws.rs.Consumes; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.jclouds.Fallbacks; import org.jclouds.cloudstack.domain.Domain; import org.jclouds.cloudstack.options.UpdateDomainOptions; import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.SelectJson; | import javax.inject.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.jclouds.*; import org.jclouds.cloudstack.domain.*; import org.jclouds.cloudstack.options.*; import org.jclouds.rest.annotations.*; | [
"javax.inject",
"javax.ws",
"org.jclouds",
"org.jclouds.cloudstack",
"org.jclouds.rest"
] | javax.inject; javax.ws; org.jclouds; org.jclouds.cloudstack; org.jclouds.rest; | 760,065 |
public void setExtraTopOffset(float offset) {
mExtraTopOffset = Utils.convertDpToPixel(offset);
} | void function(float offset) { mExtraTopOffset = Utils.convertDpToPixel(offset); } | /**
* Set an extra offset to be appended to the viewport's top
*/ | Set an extra offset to be appended to the viewport's top | setExtraTopOffset | {
"repo_name": "codezork/BlueNodes",
"path": "mobile/bluenodes/src/main/java/com/github/mikephil/charting/charts/Chart.java",
"license": "apache-2.0",
"size": 51621
} | [
"com.github.mikephil.charting.utils.Utils"
] | import com.github.mikephil.charting.utils.Utils; | import com.github.mikephil.charting.utils.*; | [
"com.github.mikephil"
] | com.github.mikephil; | 689,705 |
public DMNType resolveTypeRef(DMNModelImpl dmnModel, NamedElement model, DMNModelInstrumentedBase localElement, QName typeRef) {
if ( typeRef != null ) {
QName nsAndName = getNamespaceAndName(localElement, dmnModel.getImportAliasesForNS(), typeRef, dmnModel.getNamespace());
DMNType type = dmnModel.getTypeRegistry().resolveType(nsAndName.getNamespaceURI(), nsAndName.getLocalPart());
if (type == null && localElement.getURIFEEL().equals(nsAndName.getNamespaceURI())) {
if ( model instanceof Decision && ((Decision) model).getExpression() instanceof DecisionTable ) {
DecisionTable dt = (DecisionTable) ((Decision) model).getExpression();
if ( dt.getOutput().size() > 1 ) {
// implicitly define a type for the decision table result
CompositeTypeImpl compType = new CompositeTypeImpl( dmnModel.getNamespace(), model.getName()+"_Type", model.getId(), dt.getHitPolicy().isMultiHit() );
for ( OutputClause oc : dt.getOutput() ) {
DMNType fieldType = resolveTypeRef(dmnModel, model, oc, oc.getTypeRef());
compType.addField( oc.getName(), fieldType );
}
dmnModel.getTypeRegistry().registerType( compType );
return compType;
} else if ( dt.getOutput().size() == 1 ) {
return resolveTypeRef(dmnModel, model, dt.getOutput().get(0), dt.getOutput().get(0).getTypeRef());
}
}
} else if( type == null ) {
MsgUtil.reportMessage( logger,
DMNMessage.Severity.ERROR,
localElement,
dmnModel,
null,
null,
Msg.UNKNOWN_TYPE_REF_ON_NODE,
typeRef.toString(),
localElement.getParentDRDElement().getIdentifierString() );
type = dmnModel.getTypeRegistry().unknown();
}
return type;
}
return dmnModel.getTypeRegistry().unknown();
} | DMNType function(DMNModelImpl dmnModel, NamedElement model, DMNModelInstrumentedBase localElement, QName typeRef) { if ( typeRef != null ) { QName nsAndName = getNamespaceAndName(localElement, dmnModel.getImportAliasesForNS(), typeRef, dmnModel.getNamespace()); DMNType type = dmnModel.getTypeRegistry().resolveType(nsAndName.getNamespaceURI(), nsAndName.getLocalPart()); if (type == null && localElement.getURIFEEL().equals(nsAndName.getNamespaceURI())) { if ( model instanceof Decision && ((Decision) model).getExpression() instanceof DecisionTable ) { DecisionTable dt = (DecisionTable) ((Decision) model).getExpression(); if ( dt.getOutput().size() > 1 ) { CompositeTypeImpl compType = new CompositeTypeImpl( dmnModel.getNamespace(), model.getName()+"_Type", model.getId(), dt.getHitPolicy().isMultiHit() ); for ( OutputClause oc : dt.getOutput() ) { DMNType fieldType = resolveTypeRef(dmnModel, model, oc, oc.getTypeRef()); compType.addField( oc.getName(), fieldType ); } dmnModel.getTypeRegistry().registerType( compType ); return compType; } else if ( dt.getOutput().size() == 1 ) { return resolveTypeRef(dmnModel, model, dt.getOutput().get(0), dt.getOutput().get(0).getTypeRef()); } } } else if( type == null ) { MsgUtil.reportMessage( logger, DMNMessage.Severity.ERROR, localElement, dmnModel, null, null, Msg.UNKNOWN_TYPE_REF_ON_NODE, typeRef.toString(), localElement.getParentDRDElement().getIdentifierString() ); type = dmnModel.getTypeRegistry().unknown(); } return type; } return dmnModel.getTypeRegistry().unknown(); } | /**
* Resolve the QName typeRef accordingly to definition of builtin (FEEL) types, local model ItemDef or imported definitions.
* If the typeRef cannot be resolved, (FEEL) UNKNOWN is returned and an error logged using standard DMN message logging.
*/ | Resolve the QName typeRef accordingly to definition of builtin (FEEL) types, local model ItemDef or imported definitions. If the typeRef cannot be resolved, (FEEL) UNKNOWN is returned and an error logged using standard DMN message logging | resolveTypeRef | {
"repo_name": "mbiarnes/drools",
"path": "kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNCompilerImpl.java",
"license": "apache-2.0",
"size": 36325
} | [
"javax.xml.namespace.QName",
"org.kie.dmn.api.core.DMNMessage",
"org.kie.dmn.api.core.DMNType",
"org.kie.dmn.core.impl.CompositeTypeImpl",
"org.kie.dmn.core.impl.DMNModelImpl",
"org.kie.dmn.core.util.Msg",
"org.kie.dmn.core.util.MsgUtil",
"org.kie.dmn.feel.lang.Type",
"org.kie.dmn.model.api.DMNModel... | import javax.xml.namespace.QName; import org.kie.dmn.api.core.DMNMessage; import org.kie.dmn.api.core.DMNType; import org.kie.dmn.core.impl.CompositeTypeImpl; import org.kie.dmn.core.impl.DMNModelImpl; import org.kie.dmn.core.util.Msg; import org.kie.dmn.core.util.MsgUtil; import org.kie.dmn.feel.lang.Type; import org.kie.dmn.model.api.DMNModelInstrumentedBase; import org.kie.dmn.model.api.Decision; import org.kie.dmn.model.api.DecisionTable; import org.kie.dmn.model.api.NamedElement; import org.kie.dmn.model.api.OutputClause; | import javax.xml.namespace.*; import org.kie.dmn.api.core.*; import org.kie.dmn.core.impl.*; import org.kie.dmn.core.util.*; import org.kie.dmn.feel.lang.*; import org.kie.dmn.model.api.*; | [
"javax.xml",
"org.kie.dmn"
] | javax.xml; org.kie.dmn; | 2,877,022 |
static List<Node> getLeadingComments(Node nodeToBeAdopted) {
ImmutableList.Builder<Node> nodesToAdopt = new ImmutableList.Builder<Node>();
Node previousSibling = nodeToBeAdopted.getPreviousSibling();
while (previousSibling != null
&& (previousSibling.getNodeType() == Node.COMMENT_NODE
|| previousSibling.getNodeType() == Node.TEXT_NODE)) {
// we really only care about comments.
if (previousSibling.getNodeType() == Node.COMMENT_NODE) {
nodesToAdopt.add(previousSibling);
}
previousSibling = previousSibling.getPreviousSibling();
}
return nodesToAdopt.build().reverse();
} | static List<Node> getLeadingComments(Node nodeToBeAdopted) { ImmutableList.Builder<Node> nodesToAdopt = new ImmutableList.Builder<Node>(); Node previousSibling = nodeToBeAdopted.getPreviousSibling(); while (previousSibling != null && (previousSibling.getNodeType() == Node.COMMENT_NODE previousSibling.getNodeType() == Node.TEXT_NODE)) { if (previousSibling.getNodeType() == Node.COMMENT_NODE) { nodesToAdopt.add(previousSibling); } previousSibling = previousSibling.getPreviousSibling(); } return nodesToAdopt.build().reverse(); } | /**
* Returns all leading comments in the source xml before the node to be adopted.
* @param nodeToBeAdopted node that will be added as a child to this node.
*/ | Returns all leading comments in the source xml before the node to be adopted | getLeadingComments | {
"repo_name": "tranleduy2000/javaide",
"path": "aosp/manifest-merger/src/main/java/com/android/manifmerger/XmlElement.java",
"license": "gpl-3.0",
"size": 39940
} | [
"com.google.common.collect.ImmutableList",
"java.util.List",
"org.w3c.dom.Node"
] | import com.google.common.collect.ImmutableList; import java.util.List; import org.w3c.dom.Node; | import com.google.common.collect.*; import java.util.*; import org.w3c.dom.*; | [
"com.google.common",
"java.util",
"org.w3c.dom"
] | com.google.common; java.util; org.w3c.dom; | 2,021,839 |
public void doCancel_preview_to_list_submission(RunData data)
{
doCancel_grade_submission(data);
} // doCancel_preview_to_list_submission
| void function(RunData data) { doCancel_grade_submission(data); } | /**
* Action is to cancel the preview grade process
*/ | Action is to cancel the preview grade process | doCancel_preview_to_list_submission | {
"repo_name": "rodriguezdevera/sakai",
"path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java",
"license": "apache-2.0",
"size": 685575
} | [
"org.sakaiproject.cheftool.RunData"
] | import org.sakaiproject.cheftool.RunData; | import org.sakaiproject.cheftool.*; | [
"org.sakaiproject.cheftool"
] | org.sakaiproject.cheftool; | 1,051,792 |
public static Path getBackReferencesDir(final Path storeDir, final String fileName) {
return new Path(storeDir, BACK_REFERENCES_DIRECTORY_PREFIX + fileName);
} | static Path function(final Path storeDir, final String fileName) { return new Path(storeDir, BACK_REFERENCES_DIRECTORY_PREFIX + fileName); } | /**
* Get the directory to store the link back references
*
* <p>To simplify the reference count process, during the FileLink creation
* a back-reference is added to the back-reference directory of the specified file.
*
* @param storeDir Root directory for the link reference folder
* @param fileName File Name with links
* @return Path for the link back references.
*/ | Get the directory to store the link back references To simplify the reference count process, during the FileLink creation a back-reference is added to the back-reference directory of the specified file | getBackReferencesDir | {
"repo_name": "grokcoder/pbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/io/FileLink.java",
"license": "apache-2.0",
"size": 15620
} | [
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 941,338 |
public Project createProject(); | Project function(); | /**
* Creates a new project and returns it.
*
* @return
*/ | Creates a new project and returns it | createProject | {
"repo_name": "zyxist/opentrans",
"path": "opentrans-lightweight/src/main/java/org/invenzzia/opentrans/lightweight/app/IProjectFactory.java",
"license": "gpl-3.0",
"size": 1099
} | [
"org.invenzzia.opentrans.visitons.Project"
] | import org.invenzzia.opentrans.visitons.Project; | import org.invenzzia.opentrans.visitons.*; | [
"org.invenzzia.opentrans"
] | org.invenzzia.opentrans; | 76,731 |
public static <T> Set<T> intersection(Set<T> setA, Set<T> setB) throws NullPointerException {
Objects.requireNonNull(setA, EXCEPTION_MESSAGE);
Objects.requireNonNull(setB, EXCEPTION_MESSAGE);
Set<T> setACopy = new HashSet<>(setA);
Set<T> setBCopy = new HashSet<>(setB);
Set<T> setC = new HashSet<>();
setACopy.stream().filter((item) -> (setBCopy.contains(item))).forEach((item) -> {
setC.add(item);
});
return setC;
} | static <T> Set<T> function(Set<T> setA, Set<T> setB) throws NullPointerException { Objects.requireNonNull(setA, EXCEPTION_MESSAGE); Objects.requireNonNull(setB, EXCEPTION_MESSAGE); Set<T> setACopy = new HashSet<>(setA); Set<T> setBCopy = new HashSet<>(setB); Set<T> setC = new HashSet<>(); setACopy.stream().filter((item) -> (setBCopy.contains(item))).forEach((item) -> { setC.add(item); }); return setC; } | /**
* Performs the mathematical Intersection on two sets.
* @param <T> the Class type of the sets
* @param setA a set
* @param setB another set
* @return the intersection of set A and set B
* @throws NullPointerException thrown if {@code setA} or {@code setB} is null
* @since 1.0
*/ | Performs the mathematical Intersection on two sets | intersection | {
"repo_name": "paulmjarosch/pj_jcommon",
"path": "src/pj/common/tools/SetTools.java",
"license": "mit",
"size": 5484
} | [
"java.util.HashSet",
"java.util.Objects",
"java.util.Set"
] | import java.util.HashSet; import java.util.Objects; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,037,033 |
public String processCheckAll()
{
LOG.debug("processCheckAll()");
selectAll= true;
multiDeleteSuccess = false;
return null;
}
////////////////////////////// ATTACHMENT PROCESSING //////////////////////////
private ArrayList attachments = new ArrayList();
private String removeAttachId = null;
private ArrayList prepareRemoveAttach = new ArrayList();
private boolean attachCaneled = false;
private ArrayList oldAttachments = new ArrayList();
private List allAttachments = new ArrayList(); | String function() { LOG.debug(STR); selectAll= true; multiDeleteSuccess = false; return null; } private ArrayList attachments = new ArrayList(); private String removeAttachId = null; private ArrayList prepareRemoveAttach = new ArrayList(); private boolean attachCaneled = false; private ArrayList oldAttachments = new ArrayList(); private List allAttachments = new ArrayList(); | /**
* process isSelected for all decorated messages
* @return same page i.e. will be pvtMsg
*/ | process isSelected for all decorated messages | processCheckAll | {
"repo_name": "hackbuteer59/sakai",
"path": "msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/PrivateMessagesTool.java",
"license": "apache-2.0",
"size": 173551
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,510,481 |
public Position getObserverPosition() {
return observerPos;
} | Position function() { return observerPos; } | /**
* Get the observer's geographical position.
*
* @return The observer's geographical position.
*/ | Get the observer's geographical position | getObserverPosition | {
"repo_name": "ryanpeng84/HermitLibrary",
"path": "src/org/hermit/astro/Observation.java",
"license": "gpl-2.0",
"size": 35761
} | [
"org.hermit.geo.Position"
] | import org.hermit.geo.Position; | import org.hermit.geo.*; | [
"org.hermit.geo"
] | org.hermit.geo; | 2,239,981 |
public void findTemplates(Dictionary templates) {
if (_default != null) {
templates.put(_default, this);
}
for (int i = 0; i < _patterns.size(); i++) {
final LocationPathPattern pattern =
(LocationPathPattern)_patterns.elementAt(i);
templates.put(pattern.getTemplate(), this);
}
} | void function(Dictionary templates) { if (_default != null) { templates.put(_default, this); } for (int i = 0; i < _patterns.size(); i++) { final LocationPathPattern pattern = (LocationPathPattern)_patterns.elementAt(i); templates.put(pattern.getTemplate(), this); } } | /**
* Returns, by reference, the templates that are included in
* this test sequence. Note that a single template can occur
* in several test sequences if its pattern is a union.
*/ | Returns, by reference, the templates that are included in this test sequence. Note that a single template can occur in several test sequences if its pattern is a union | findTemplates | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/TestSeq.java",
"license": "gpl-2.0",
"size": 9599
} | [
"java.util.Dictionary"
] | import java.util.Dictionary; | import java.util.*; | [
"java.util"
] | java.util; | 1,766,064 |
public View getTarget() {
return target;
} | View function() { return target; } | /**
* Returns the target View this badge has been attached to.
*
*/ | Returns the target View this badge has been attached to | getTarget | {
"repo_name": "Consoar/9X9",
"path": "src/bos/consoar/ninebynine/views/BadgeView.java",
"license": "apache-2.0",
"size": 11938
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,564,360 |
public EntityRole getRegexEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) {
return getRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body();
} | EntityRole function(UUID appId, String versionId, UUID entityId, UUID roleId) { return getRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); } | /**
* Get one role for a given regular expression entity in a version of the application.
*
* @param appId The application ID.
* @param versionId The version ID.
* @param entityId entity ID.
* @param roleId entity role ID.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the EntityRole object if successful.
*/ | Get one role for a given regular expression entity in a version of the application | getRegexEntityRole | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/cognitiveservices/ms-azure-cs-luis-authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java",
"license": "mit",
"size": 818917
} | [
"com.microsoft.azure.cognitiveservices.language.luis.authoring.models.EntityRole"
] | import com.microsoft.azure.cognitiveservices.language.luis.authoring.models.EntityRole; | import com.microsoft.azure.cognitiveservices.language.luis.authoring.models.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,213,558 |
public void colorInsertedBefore(float f, int idx) throws DOMException {
switch (getPaintType()) {
case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR:
StringBuffer sb =
new StringBuffer(getValue().item(0).getCssText());
sb.append(" icc-color(");
ICCColor iccc = (ICCColor)getValue().item(1);
sb.append(iccc.getColorProfile());
for (int i = 0; i < idx; i++) {
sb.append( ',' );
sb.append(iccc.getColor(i));
}
sb.append( ',' );
sb.append(f);
for (int i = idx; i < iccc.getLength(); i++) {
sb.append( ',' );
sb.append(iccc.getColor(i));
}
sb.append( ')' );
textChanged(sb.toString());
break;
case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR:
sb = new StringBuffer(getValue().item(0).getCssText());
sb.append( ' ' );
sb.append(getValue().item(1).getCssText());
sb.append(" icc-color(");
iccc = (ICCColor)getValue().item(1);
sb.append(iccc.getColorProfile());
for (int i = 0; i < idx; i++) {
sb.append( ',' );
sb.append(iccc.getColor(i));
}
sb.append( ',' );
sb.append(f);
for (int i = idx; i < iccc.getLength(); i++) {
sb.append( ',' );
sb.append(iccc.getColor(i));
}
sb.append( ')' );
textChanged(sb.toString());
break;
default:
throw new DOMException
(DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
}
} | void function(float f, int idx) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(STR); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(STR); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); for (int i = 0; i < idx; i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ',' ); sb.append(f); for (int i = idx; i < iccc.getLength(); i++) { sb.append( ',' ); sb.append(iccc.getColor(i)); } sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } } | /**
* Called when the ICC color has been inserted.
*/ | Called when the ICC color has been inserted | colorInsertedBefore | {
"repo_name": "sflyphotobooks/crp-batik",
"path": "sources/org/apache/batik/css/dom/CSSOMSVGPaint.java",
"license": "apache-2.0",
"size": 32481
} | [
"org.apache.batik.css.engine.value.svg.ICCColor",
"org.w3c.dom.DOMException"
] | import org.apache.batik.css.engine.value.svg.ICCColor; import org.w3c.dom.DOMException; | import org.apache.batik.css.engine.value.svg.*; import org.w3c.dom.*; | [
"org.apache.batik",
"org.w3c.dom"
] | org.apache.batik; org.w3c.dom; | 183,013 |
private void writeServiceContext(ServiceContext ctx, BinaryRawWriterEx writer) {
writer.writeString(ctx.name());
writer.writeUuid(ctx.executionId());
writer.writeBoolean(ctx.isCancelled());
writer.writeString(ctx.cacheName());
writer.writeObject(ctx.affinityKey());
} | void function(ServiceContext ctx, BinaryRawWriterEx writer) { writer.writeString(ctx.name()); writer.writeUuid(ctx.executionId()); writer.writeBoolean(ctx.isCancelled()); writer.writeString(ctx.cacheName()); writer.writeObject(ctx.affinityKey()); } | /**
* Writes service context.
*
* @param ctx Context.
* @param writer Writer.
*/ | Writes service context | writeServiceContext | {
"repo_name": "agura/incubator-ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/services/PlatformAbstractService.java",
"license": "apache-2.0",
"size": 7391
} | [
"org.apache.ignite.internal.binary.BinaryRawWriterEx",
"org.apache.ignite.services.ServiceContext"
] | import org.apache.ignite.internal.binary.BinaryRawWriterEx; import org.apache.ignite.services.ServiceContext; | import org.apache.ignite.internal.binary.*; import org.apache.ignite.services.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 52,669 |
public void flush(TableName tableName) throws IOException {
getMiniHBaseCluster().flushcache(tableName);
} | void function(TableName tableName) throws IOException { getMiniHBaseCluster().flushcache(tableName); } | /**
* Flushes all caches in the mini hbase cluster
* @throws IOException
*/ | Flushes all caches in the mini hbase cluster | flush | {
"repo_name": "mahak/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java",
"license": "apache-2.0",
"size": 151013
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 404,195 |
public static Collection<GlobalMetric> getGlobalPhoenixClientMetrics() {
return GlobalClientMetrics.getMetrics();
} | static Collection<GlobalMetric> function() { return GlobalClientMetrics.getMetrics(); } | /**
* Exposes the various internal phoenix metrics collected at the client JVM level.
*/ | Exposes the various internal phoenix metrics collected at the client JVM level | getGlobalPhoenixClientMetrics | {
"repo_name": "shehzaadn/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java",
"license": "apache-2.0",
"size": 71130
} | [
"java.util.Collection",
"org.apache.phoenix.monitoring.GlobalClientMetrics",
"org.apache.phoenix.monitoring.GlobalMetric"
] | import java.util.Collection; import org.apache.phoenix.monitoring.GlobalClientMetrics; import org.apache.phoenix.monitoring.GlobalMetric; | import java.util.*; import org.apache.phoenix.monitoring.*; | [
"java.util",
"org.apache.phoenix"
] | java.util; org.apache.phoenix; | 1,660,382 |
@Override
public boolean mousePressed(Minecraft minecraft, int i, int j) {
InvTweaksObfuscation obf = new InvTweaksObfuscation(minecraft);
InvTweaksConfig config = cfgManager.getConfig();
if(super.mousePressed(minecraft, i, j)) {
// Put hold item down if necessary
ContainerSectionManager containerMgr;
try {
containerMgr = new ContainerSectionManager(ContainerSection.INVENTORY);
if(obf.getHeldStack() != null) {
try {
// Put hold item down
for(int k = containerMgr.getSize() - 1; k >= 0; k--) {
if(containerMgr.getItemStack(k) == null) {
containerMgr.leftClick(k);
break;
}
}
} catch(TimeoutException e) {
InvTweaks.logInGameErrorStatic("invtweaks.sort.releaseitem.error", e);
}
}
} catch(Exception e) {
log.error("mousePressed", e);
}
// Refresh config
cfgManager.makeSureConfigurationIsLoaded();
// Display menu
obf.displayGuiScreen(new InvTweaksGuiSettings(minecraft, obf.getCurrentScreen(), config));
return true;
} else {
return false;
}
} | boolean function(Minecraft minecraft, int i, int j) { InvTweaksObfuscation obf = new InvTweaksObfuscation(minecraft); InvTweaksConfig config = cfgManager.getConfig(); if(super.mousePressed(minecraft, i, j)) { ContainerSectionManager containerMgr; try { containerMgr = new ContainerSectionManager(ContainerSection.INVENTORY); if(obf.getHeldStack() != null) { try { for(int k = containerMgr.getSize() - 1; k >= 0; k--) { if(containerMgr.getItemStack(k) == null) { containerMgr.leftClick(k); break; } } } catch(TimeoutException e) { InvTweaks.logInGameErrorStatic(STR, e); } } } catch(Exception e) { log.error(STR, e); } cfgManager.makeSureConfigurationIsLoaded(); obf.displayGuiScreen(new InvTweaksGuiSettings(minecraft, obf.getCurrentScreen(), config)); return true; } else { return false; } } | /**
* Displays inventory settings GUI
*/ | Displays inventory settings GUI | mousePressed | {
"repo_name": "PrinceOfAmber/inventory-tweaks",
"path": "src/main/java/invtweaks/InvTweaksGuiSettingsButton.java",
"license": "mit",
"size": 2672
} | [
"java.util.concurrent.TimeoutException",
"net.minecraft.client.Minecraft"
] | import java.util.concurrent.TimeoutException; import net.minecraft.client.Minecraft; | import java.util.concurrent.*; import net.minecraft.client.*; | [
"java.util",
"net.minecraft.client"
] | java.util; net.minecraft.client; | 2,451,699 |
Classifier getType(); | Classifier getType(); | /**
* Returns the value of the '<em><b>Type</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Type</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Type</em>' reference.
* @see #isSetType()
* @see #unsetType()
* @see #setType(Classifier)
* @see de.cooperateproject.modeling.textual.cls.cls.ClsPackage#getProperty_Type()
* @model unsettable="true" transient="true"
* @generated
*/ | Returns the value of the 'Type' reference. If the meaning of the 'Type' reference isn't clear, there really should be more of a description here... | getType | {
"repo_name": "Cooperate-Project/Cooperate",
"path": "bundles/de.cooperateproject.modeling.textual.cls.metamodel/src-gen/de/cooperateproject/modeling/textual/cls/cls/Property.java",
"license": "epl-1.0",
"size": 2829
} | [
"org.eclipse.uml2.uml.Classifier"
] | import org.eclipse.uml2.uml.Classifier; | import org.eclipse.uml2.uml.*; | [
"org.eclipse.uml2"
] | org.eclipse.uml2; | 1,307,190 |
public void dumpValue(StringBuffer buffer, String prefix) {
buffer.append(prefix).append("KeyUsage [\n");
for (int i=0; i<keyUsage.length; i++) {
if (keyUsage[i]) {
buffer.append(prefix).append(" ")
.append(USAGES[i]).append('\n');
}
}
buffer.append(prefix).append("]\n");
}
private static final ASN1Type ASN1 = new ASN1BitString.ASN1NamedBitList(9); | void function(StringBuffer buffer, String prefix) { buffer.append(prefix).append(STR); for (int i=0; i<keyUsage.length; i++) { if (keyUsage[i]) { buffer.append(prefix).append(" ") .append(USAGES[i]).append('\n'); } } buffer.append(prefix).append("]\n"); } private static final ASN1Type ASN1 = new ASN1BitString.ASN1NamedBitList(9); | /**
* Places the string representation of extension value
* into the StringBuffer object.
*/ | Places the string representation of extension value into the StringBuffer object | dumpValue | {
"repo_name": "openweave/openweave-core",
"path": "third_party/android/platform-libcore/android-platform-libcore/luni/src/main/java/org/apache/harmony/security/x509/KeyUsage.java",
"license": "apache-2.0",
"size": 3419
} | [
"org.apache.harmony.security.asn1.ASN1BitString",
"org.apache.harmony.security.asn1.ASN1Type"
] | import org.apache.harmony.security.asn1.ASN1BitString; import org.apache.harmony.security.asn1.ASN1Type; | import org.apache.harmony.security.asn1.*; | [
"org.apache.harmony"
] | org.apache.harmony; | 670,137 |
public boolean markObsoleteIfEmpty(@Nullable GridCacheVersion ver) throws IgniteCheckedException; | boolean function(@Nullable GridCacheVersion ver) throws IgniteCheckedException; | /**
* Sets obsolete flag if entry value is {@code null} or entry is expired and no
* locks are held.
*
* @param ver Version to set as obsolete.
* @return {@code True} if entry was marked obsolete.
* @throws IgniteCheckedException If failed.
*/ | Sets obsolete flag if entry value is null or entry is expired and no locks are held | markObsoleteIfEmpty | {
"repo_name": "ascherbakoff/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java",
"license": "apache-2.0",
"size": 47622
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.processors.cache.version.GridCacheVersion",
"org.jetbrains.annotations.Nullable"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.jetbrains.annotations.Nullable; | import org.apache.ignite.*; import org.apache.ignite.internal.processors.cache.version.*; import org.jetbrains.annotations.*; | [
"org.apache.ignite",
"org.jetbrains.annotations"
] | org.apache.ignite; org.jetbrains.annotations; | 2,252,330 |
public Map<String, VglParameter> getJobParameters() {
return jobParameters;
}
| Map<String, VglParameter> function() { return jobParameters; } | /**
* A set of VglJobParameter objects
* @return
*/ | A set of VglJobParameter objects | getJobParameters | {
"repo_name": "victortey/VEGL-Portal",
"path": "src/main/java/org/auscope/portal/server/vegl/VEGLJob.java",
"license": "gpl-3.0",
"size": 8578
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 217,057 |
public Builder applyToAllApiMethods(ApiCallSettings.Builder apiCallSettings) throws Exception {
super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings);
return this;
} | Builder function(ApiCallSettings.Builder apiCallSettings) throws Exception { super.applyToAllApiMethods(methodSettingsBuilders, apiCallSettings); return this; } | /**
* Applies the given settings to all of the API methods in this service. Only
* values that are non-null will be applied, so this method is not capable
* of un-setting any values.
*/ | Applies the given settings to all of the API methods in this service. Only values that are non-null will be applied, so this method is not capable of un-setting any values | applyToAllApiMethods | {
"repo_name": "ethanbao/api-client-staging-1",
"path": "generated/java/google-devtools-clouderrorreporting-v1beta1/src/main/java/com/google/cloud/errorreporting/spi/v1beta1/ReportErrorsServiceSettings.java",
"license": "bsd-3-clause",
"size": 10203
} | [
"com.google.api.gax.grpc.ApiCallSettings"
] | import com.google.api.gax.grpc.ApiCallSettings; | import com.google.api.gax.grpc.*; | [
"com.google.api"
] | com.google.api; | 1,122,254 |
public void verify(TransactionOutput output) throws VerificationException {
if (!getOutpoint().getHash().equals(output.parentTransaction.getHash()))
throw new VerificationException("This input does not refer to the tx containing the output.");
if (getOutpoint().getIndex() != output.getIndex())
throw new VerificationException("This input refers to a different output on the given tx.");
Script pubKey = output.getScriptPubKey();
int myIndex = parentTransaction.getInputs().indexOf(this);
getScriptSig().correctlySpends(parentTransaction, myIndex, pubKey, true);
} | void function(TransactionOutput output) throws VerificationException { if (!getOutpoint().getHash().equals(output.parentTransaction.getHash())) throw new VerificationException(STR); if (getOutpoint().getIndex() != output.getIndex()) throw new VerificationException(STR); Script pubKey = output.getScriptPubKey(); int myIndex = parentTransaction.getInputs().indexOf(this); getScriptSig().correctlySpends(parentTransaction, myIndex, pubKey, true); } | /**
* Verifies that this input can spend the given output. Note that this input must be a part of a transaction.
* Also note that the consistency of the outpoint will be checked, even if this input has not been connected.
*
* @param output the output that this input is supposed to spend.
* @throws ScriptException If the script doesn't verify.
* @throws VerificationException If the outpoint doesn't match the given output.
*/ | Verifies that this input can spend the given output. Note that this input must be a part of a transaction. Also note that the consistency of the outpoint will be checked, even if this input has not been connected | verify | {
"repo_name": "hank/litecoinj-new",
"path": "core/src/main/java/com/google/litecoin/core/TransactionInput.java",
"license": "apache-2.0",
"size": 18502
} | [
"com.google.litecoin.script.Script"
] | import com.google.litecoin.script.Script; | import com.google.litecoin.script.*; | [
"com.google.litecoin"
] | com.google.litecoin; | 2,113,738 |
public void unlockAchievement(Player playerIn, StatBase statIn, int p_150873_3_)
{
int i = statIn.isAchievement() ? this.readStat(statIn) : 0;
super.unlockAchievement(playerIn, statIn, p_150873_3_);
this.field_150888_e.add(statIn);
if (statIn.isAchievement() && i == 0 && p_150873_3_ > 0)
{
this.field_150886_g = true;
if (this.mcServer.isAnnouncingPlayerAchievements())
{
this.mcServer.getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.achievement", new Object[] {playerIn.getDisplayName(), statIn.func_150955_j()}));
}
}
if (statIn.isAchievement() && i > 0 && p_150873_3_ == 0)
{
this.field_150886_g = true;
if (this.mcServer.isAnnouncingPlayerAchievements())
{
this.mcServer.getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.achievement.taken", new Object[] {playerIn.getDisplayName(), statIn.func_150955_j()}));
}
}
} | void function(Player playerIn, StatBase statIn, int p_150873_3_) { int i = statIn.isAchievement() ? this.readStat(statIn) : 0; super.unlockAchievement(playerIn, statIn, p_150873_3_); this.field_150888_e.add(statIn); if (statIn.isAchievement() && i == 0 && p_150873_3_ > 0) { this.field_150886_g = true; if (this.mcServer.isAnnouncingPlayerAchievements()) { this.mcServer.getConfigurationManager().sendChatMsg(new ChatComponentTranslation(STR, new Object[] {playerIn.getDisplayName(), statIn.func_150955_j()})); } } if (statIn.isAchievement() && i > 0 && p_150873_3_ == 0) { this.field_150886_g = true; if (this.mcServer.isAnnouncingPlayerAchievements()) { this.mcServer.getConfigurationManager().sendChatMsg(new ChatComponentTranslation(STR, new Object[] {playerIn.getDisplayName(), statIn.func_150955_j()})); } } } | /**
* Triggers the logging of an achievement and attempts to announce to server
*/ | Triggers the logging of an achievement and attempts to announce to server | unlockAchievement | {
"repo_name": "TorchPowered/Thallium",
"path": "src/main/java/net/minecraft/stats/StatisticsFile.java",
"license": "mit",
"size": 9428
} | [
"net.minecraft.entity.player.Player",
"net.minecraft.util.ChatComponentTranslation"
] | import net.minecraft.entity.player.Player; import net.minecraft.util.ChatComponentTranslation; | import net.minecraft.entity.player.*; import net.minecraft.util.*; | [
"net.minecraft.entity",
"net.minecraft.util"
] | net.minecraft.entity; net.minecraft.util; | 2,441,192 |
void revoke(EntityId entity); | void revoke(EntityId entity); | /**
* Revokes all user's permissions on an entity.
*
* @param entity the entity
*/ | Revokes all user's permissions on an entity | revoke | {
"repo_name": "chtyim/cdap",
"path": "cdap-security/src/main/java/co/cask/cdap/security/authorization/AuthorizationPlugin.java",
"license": "apache-2.0",
"size": 2144
} | [
"co.cask.cdap.proto.id.EntityId"
] | import co.cask.cdap.proto.id.EntityId; | import co.cask.cdap.proto.id.*; | [
"co.cask.cdap"
] | co.cask.cdap; | 1,396,451 |
Venue getContent(); | Venue getContent(); | /**
* Gets the Venue object relating to this VenueContent object
*
* @return The Venue object
*/ | Gets the Venue object relating to this VenueContent object | getContent | {
"repo_name": "zackpollard/JavaTelegramBot-API",
"path": "core/src/main/java/pro/zackpollard/telegrambot/api/chat/message/content/VenueContent.java",
"license": "gpl-3.0",
"size": 586
} | [
"pro.zackpollard.telegrambot.api.chat.message.content.type.Venue"
] | import pro.zackpollard.telegrambot.api.chat.message.content.type.Venue; | import pro.zackpollard.telegrambot.api.chat.message.content.type.*; | [
"pro.zackpollard.telegrambot"
] | pro.zackpollard.telegrambot; | 2,042,385 |
public static void xa_close(Connection connection, int xaConId)
throws SQLException {
JtdsConnection con = (JtdsConnection)connection;
if (con.isXaEmulation()) {
//
// Emulate xa_close method
//
con.setXaState(0);
if (con.getXid() != null) {
con.setXid(null);
try {
con.rollback();
} catch(SQLException e) {
Logger.println("xa_close: rollback() returned " + e);
}
try {
con.setAutoCommit(true);
} catch(SQLException e) {
Logger.println("xa_close: setAutoCommit() returned " + e);
}
throw new SQLException(
Messages.get("error.xasupport.activetran", "xa_close"),
"HY000");
}
return;
}
//
// Execute xa_close via MSDTC
//
int args[] = new int[5];
args[1] = XA_CLOSE;
args[2] = xaConId;
args[3] = XA_RMID;
args[4] = XAResource.TMNOFLAGS;
((JtdsConnection) connection).sendXaPacket(args, TM_ID.getBytes());
} | static void function(Connection connection, int xaConId) throws SQLException { JtdsConnection con = (JtdsConnection)connection; if (con.isXaEmulation()) { if (con.getXid() != null) { con.setXid(null); try { con.rollback(); } catch(SQLException e) { Logger.println(STR + e); } try { con.setAutoCommit(true); } catch(SQLException e) { Logger.println(STR + e); } throw new SQLException( Messages.get(STR, STR), "HY000"); } return; } args[1] = XA_CLOSE; args[2] = xaConId; args[3] = XA_RMID; args[4] = XAResource.TMNOFLAGS; ((JtdsConnection) connection).sendXaPacket(args, TM_ID.getBytes()); } | /**
* Invoke the xa_close routine on the SQL Server.
*
* @param connection JDBC Connection to be enlisted in the transaction
* @param xaConId the connection ID allocated by the server
*/ | Invoke the xa_close routine on the SQL Server | xa_close | {
"repo_name": "TRITON-DLP/jtds-patch",
"path": "src/main/net/sourceforge/jtds/jdbc/XASupport.java",
"license": "gpl-2.0",
"size": 25755
} | [
"java.sql.Connection",
"java.sql.SQLException",
"javax.transaction.xa.XAResource",
"net.sourceforge.jtds.util.Logger"
] | import java.sql.Connection; import java.sql.SQLException; import javax.transaction.xa.XAResource; import net.sourceforge.jtds.util.Logger; | import java.sql.*; import javax.transaction.xa.*; import net.sourceforge.jtds.util.*; | [
"java.sql",
"javax.transaction",
"net.sourceforge.jtds"
] | java.sql; javax.transaction; net.sourceforge.jtds; | 763,257 |
public static JSDocInfo parseJsdoc(String toParse) {
JsDocInfoParser parser = getParser(toParse);
parser.parse();
return parser.retrieveAndResetParsedJSDocInfo();
} | static JSDocInfo function(String toParse) { JsDocInfoParser parser = getParser(toParse); parser.parse(); return parser.retrieveAndResetParsedJSDocInfo(); } | /**
* Parses a string containing a JsDoc declaration, returning the entire JSDocInfo
* if the parsing succeeded or {@code null} if it failed.
*/ | Parses a string containing a JsDoc declaration, returning the entire JSDocInfo if the parsing succeeded or null if it failed | parseJsdoc | {
"repo_name": "brad4d/closure-compiler",
"path": "src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java",
"license": "apache-2.0",
"size": 86616
} | [
"com.google.javascript.rhino.JSDocInfo"
] | import com.google.javascript.rhino.JSDocInfo; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 2,119,478 |
public static FlowMap getSubFlowMap(long dpid) {
// assumes that new OFMatch() matches everything
synchronized (FVConfig.class) {
return FlowSpaceUtil.getSubFlowMap(FVConfig.getFlowSpaceFlowMap(),
dpid, new OFMatch());
}
} | static FlowMap function(long dpid) { synchronized (FVConfig.class) { return FlowSpaceUtil.getSubFlowMap(FVConfig.getFlowSpaceFlowMap(), dpid, new OFMatch()); } } | /**
* Get the FlowMap that is the intersection of the Master FlowSpace and this
* dpid
*
* @param dpid
* As returned from OFFeatureReply
* @return A valid flowmap (never null)
*/ | Get the FlowMap that is the intersection of the Master FlowSpace and this dpid | getSubFlowMap | {
"repo_name": "routeflow/AutomaticConfigurationRouteFlow",
"path": "FLOWVISOR/src/org/flowvisor/flows/FlowSpaceUtil.java",
"license": "apache-2.0",
"size": 9807
} | [
"org.flowvisor.config.FVConfig",
"org.openflow.protocol.OFMatch"
] | import org.flowvisor.config.FVConfig; import org.openflow.protocol.OFMatch; | import org.flowvisor.config.*; import org.openflow.protocol.*; | [
"org.flowvisor.config",
"org.openflow.protocol"
] | org.flowvisor.config; org.openflow.protocol; | 908,379 |
public Interactive findInteractive(DrawingPanel panel, int xpix, int ypix) {
return null;
} | Interactive function(DrawingPanel panel, int xpix, int ypix) { return null; } | /**
* Returns null. This method should be overridden by subclasses.
*
* @param panel the drawing panel
* @param xpix the x pixel position on the panel
* @param ypix the y pixel position on the panel
* @return null
*/ | Returns null. This method should be overridden by subclasses | findInteractive | {
"repo_name": "dobrown/tracker-mvn",
"path": "src/main/java/org/opensourcephysics/media/core/TPoint.java",
"license": "gpl-3.0",
"size": 20038
} | [
"org.opensourcephysics.display.DrawingPanel",
"org.opensourcephysics.display.Interactive"
] | import org.opensourcephysics.display.DrawingPanel; import org.opensourcephysics.display.Interactive; | import org.opensourcephysics.display.*; | [
"org.opensourcephysics.display"
] | org.opensourcephysics.display; | 1,360,928 |
public static void create(SQLConnection sql) throws ApiException {
try {
Connection connection = sql.connection;
PreparedStatement createStatement
= connection.prepareStatement(CREATE_TABLE_QUERY);
createStatement.execute();
createStatement.close();
} catch (SQLException ex) {
throw new ApiException(ApiStatus.DATABASE_ERROR, ex);
}
} | static void function(SQLConnection sql) throws ApiException { try { Connection connection = sql.connection; PreparedStatement createStatement = connection.prepareStatement(CREATE_TABLE_QUERY); createStatement.execute(); createStatement.close(); } catch (SQLException ex) { throw new ApiException(ApiStatus.DATABASE_ERROR, ex); } } | /**
* Creates this table, failing if it already exists.
* @param sql The SQLConnection instance. Probably requires root.
*/ | Creates this table, failing if it already exists | create | {
"repo_name": "gundermanc/pinata",
"path": "service/src/main/java/com/pinata/service/datatier/UserTable.java",
"license": "lgpl-3.0",
"size": 6883
} | [
"com.pinata.shared.ApiException",
"com.pinata.shared.ApiStatus",
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException"
] | import com.pinata.shared.ApiException; import com.pinata.shared.ApiStatus; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; | import com.pinata.shared.*; import java.sql.*; | [
"com.pinata.shared",
"java.sql"
] | com.pinata.shared; java.sql; | 1,746,590 |
public static Optional<DatabaseUser> fromConfig() {
String userKey = ConfigKey.databaseUsername.getKey();
String passKey = ConfigKey.databasePassword.getKey();
ConfigFile config = ConfigFile.getInstance();
String username = config.getProperty(userKey);
String password = config.getProperty(passKey);
DatabaseUser user = null;
if (username != null && password != null) {
user = new DatabaseUser(username, password);
}
return Optional.ofNullable(user);
} | static Optional<DatabaseUser> function() { String userKey = ConfigKey.databaseUsername.getKey(); String passKey = ConfigKey.databasePassword.getKey(); ConfigFile config = ConfigFile.getInstance(); String username = config.getProperty(userKey); String password = config.getProperty(passKey); DatabaseUser user = null; if (username != null && password != null) { user = new DatabaseUser(username, password); } return Optional.ofNullable(user); } | /**
* Tries to retrieve the user from the {@link ConfigFile}.
*
* @return User from the {@link ConfigFile}, empty Optional otherwise.
*/ | Tries to retrieve the user from the <code>ConfigFile</code> | fromConfig | {
"repo_name": "Bachelorpraktikum/VisualisierbaR",
"path": "src/main/java/com/github/bachelorpraktikum/visualisierbar/database/DatabaseUser.java",
"license": "mit",
"size": 1412
} | [
"com.github.bachelorpraktikum.visualisierbar.config.ConfigFile",
"com.github.bachelorpraktikum.visualisierbar.config.ConfigKey",
"java.util.Optional"
] | import com.github.bachelorpraktikum.visualisierbar.config.ConfigFile; import com.github.bachelorpraktikum.visualisierbar.config.ConfigKey; import java.util.Optional; | import com.github.bachelorpraktikum.visualisierbar.config.*; import java.util.*; | [
"com.github.bachelorpraktikum",
"java.util"
] | com.github.bachelorpraktikum; java.util; | 1,591,453 |
List<RichUser> findRichUsersWithAttributesByExactMatch(PerunSession sess, String searchString, List<String> attrNames)
throws UserNotExistsException, PrivilegeException; | List<RichUser> findRichUsersWithAttributesByExactMatch(PerunSession sess, String searchString, List<String> attrNames) throws UserNotExistsException, PrivilegeException; | /**
* Returns list of RichUsers with attributes who matches the searchString, searching name, id, uuid, email, logins.
* Name part is searched for exact match.
*
* @param sess
* @param searchString
* @param attrNames
* @return list of RichUsers with selected attributes
* @throws InternalErrorException
* @throws UserNotExistsException
* @throws PrivilegeException
*/ | Returns list of RichUsers with attributes who matches the searchString, searching name, id, uuid, email, logins. Name part is searched for exact match | findRichUsersWithAttributesByExactMatch | {
"repo_name": "mvocu/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/UsersManager.java",
"license": "bsd-2-clause",
"size": 59026
} | [
"cz.metacentrum.perun.core.api.exceptions.PrivilegeException",
"cz.metacentrum.perun.core.api.exceptions.UserNotExistsException",
"java.util.List"
] | import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.UserNotExistsException; import java.util.List; | import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 415,222 |
private void createFieldsFromTemplate() {
for (int i = 0; i < platformSpecificOptionPanel.getComponentCount(); i++) {
Component c = platformSpecificOptionPanel.getComponent(i);
if (c instanceof JTextField) {
((JTextField) c).getDocument().removeDocumentListener(urlUpdater);
}
}
platformSpecificOptionPanel.removeAll();
if (template != null) {
Map<String, String> map = template.retrieveURLParsing(dbUrlField.getText());
if (map.size() == 0) {
map = template.retrieveURLDefaults();
}
for(String key : map.keySet()) {
String var = key;
String def = map.get(key);
platformSpecificOptionPanel.add(new JLabel(var));
JTextField field = new JTextField(def);
platformSpecificOptionPanel.add(field);
field.getDocument().addDocumentListener(urlUpdater);
logger.debug("The default value for key " + key + " is: " + def); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
platformSpecificOptionPanel.add(new JLabel(Messages.getString("PlatformSpecificConnectionOptionPanel.unknownDriverClass"))); //$NON-NLS-1$
}
platformSpecificOptionPanel.revalidate();
platformSpecificOptionPanel.repaint();
} | void function() { for (int i = 0; i < platformSpecificOptionPanel.getComponentCount(); i++) { Component c = platformSpecificOptionPanel.getComponent(i); if (c instanceof JTextField) { ((JTextField) c).getDocument().removeDocumentListener(urlUpdater); } } platformSpecificOptionPanel.removeAll(); if (template != null) { Map<String, String> map = template.retrieveURLParsing(dbUrlField.getText()); if (map.size() == 0) { map = template.retrieveURLDefaults(); } for(String key : map.keySet()) { String var = key; String def = map.get(key); platformSpecificOptionPanel.add(new JLabel(var)); JTextField field = new JTextField(def); platformSpecificOptionPanel.add(field); field.getDocument().addDocumentListener(urlUpdater); logger.debug(STR + key + STR + def); } } else { platformSpecificOptionPanel.add(new JLabel(Messages.getString(STR))); } platformSpecificOptionPanel.revalidate(); platformSpecificOptionPanel.repaint(); } | /**
* Sets up the platformSpecificOptionPanel component to contain labels and
* text fields associated with each variable in the current template.
*/ | Sets up the platformSpecificOptionPanel component to contain labels and text fields associated with each variable in the current template | createFieldsFromTemplate | {
"repo_name": "amitkr/sqlpower-library",
"path": "src/main/java/ca/sqlpower/swingui/PlatformSpecificConnectionOptionPanel.java",
"license": "gpl-3.0",
"size": 12233
} | [
"java.awt.Component",
"java.util.Map",
"javax.swing.JLabel",
"javax.swing.JTextField"
] | import java.awt.Component; import java.util.Map; import javax.swing.JLabel; import javax.swing.JTextField; | import java.awt.*; import java.util.*; import javax.swing.*; | [
"java.awt",
"java.util",
"javax.swing"
] | java.awt; java.util; javax.swing; | 71,005 |
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
public static MultiCurrencyAmountArray.Meta meta() {
return MultiCurrencyAmountArray.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(MultiCurrencyAmountArray.Meta.INSTANCE);
}
private static final long serialVersionUID = 1L; | static MultiCurrencyAmountArray.Meta function() { return MultiCurrencyAmountArray.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(MultiCurrencyAmountArray.Meta.INSTANCE); } private static final long serialVersionUID = 1L; | /**
* The meta-bean for {@code MultiCurrencyAmountArray}.
* @return the meta-bean, not null
*/ | The meta-bean for MultiCurrencyAmountArray | meta | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/basics/src/main/java/com/opengamma/strata/basics/currency/MultiCurrencyAmountArray.java",
"license": "apache-2.0",
"size": 22607
} | [
"org.joda.beans.JodaBeanUtils"
] | import org.joda.beans.JodaBeanUtils; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 2,091,461 |
public static Map getDispatchedMessagesMapForTesting() {
return Collections.unmodifiableMap(dispatchedMessagesMap);
} | static Map function() { return Collections.unmodifiableMap(dispatchedMessagesMap); } | /**
* Used for testing purposes only
*
* @return Map object
*/ | Used for testing purposes only | getDispatchedMessagesMapForTesting | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java",
"license": "apache-2.0",
"size": 150325
} | [
"java.util.Collections",
"java.util.Map"
] | import java.util.Collections; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,851,821 |
Collection<String> getHITIds(); | Collection<String> getHITIds(); | /**
* Convenience method to get the HIT IDs for this group of workers.
* @return
*/ | Convenience method to get the HIT IDs for this group of workers | getHITIds | {
"repo_name": "HarvardEconCS/TurkServer",
"path": "turkserver/src/main/java/edu/harvard/econcs/turkserver/api/HITWorkerGroup.java",
"license": "mit",
"size": 665
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 473,285 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.