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
@Test public void testListItemIdNullRootRepoPathDoesNotExist() throws Exception { // Set up mock objects when(contentManagerMock.list(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString())).thenReturn(createItemListMock()); when(contentManagerMock.createFolder(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn(createItemMock()); when(securityServiceMock.validate(Mockito.any(Context.class))).thenReturn(true); when(pathServiceMock.getItemIdByPath(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn(null); // set up parameters Context context = new Context(UUID.randomUUID().toString(), new Tenant()); String site = RandomStringUtils.random(10); // execute list method List<Item> itemList = descriptorServiceSUT.list(context, site, null); verify(contentManagerMock, times(1)).list(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString()); verify(contentManagerMock, times(1)).createFolder(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); verify(securityServiceMock, times(1)).validate(Mockito.any(Context.class)); verify(pathServiceMock, times(1)).getItemIdByPath(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); }
void function() throws Exception { when(contentManagerMock.list(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString())).thenReturn(createItemListMock()); when(contentManagerMock.createFolder(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn(createItemMock()); when(securityServiceMock.validate(Mockito.any(Context.class))).thenReturn(true); when(pathServiceMock.getItemIdByPath(Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn(null); Context context = new Context(UUID.randomUUID().toString(), new Tenant()); String site = RandomStringUtils.random(10); List<Item> itemList = descriptorServiceSUT.list(context, site, null); verify(contentManagerMock, times(1)).list(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString()); verify(contentManagerMock, times(1)).createFolder(Mockito.any(Context.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); verify(securityServiceMock, times(1)).validate(Mockito.any(Context.class)); verify(pathServiceMock, times(1)).getItemIdByPath(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); }
/** * Use case 50: * Test list method without Item ID and root repo path does not exist. * * @throws java.lang.Exception */
Use case 50: Test list method without Item ID and root repo path does not exist
testListItemIdNullRootRepoPathDoesNotExist
{ "repo_name": "craftercms/studio3", "path": "impl/src/test/java/org/craftercms/studio/impl/content/DescriptorServiceImplTest.java", "license": "gpl-3.0", "size": 87171 }
[ "java.util.List", "java.util.UUID", "org.apache.commons.lang.RandomStringUtils", "org.craftercms.studio.commons.dto.Context", "org.craftercms.studio.commons.dto.Item", "org.craftercms.studio.commons.dto.Tenant", "org.mockito.Mockito" ]
import java.util.List; import java.util.UUID; import org.apache.commons.lang.RandomStringUtils; import org.craftercms.studio.commons.dto.Context; import org.craftercms.studio.commons.dto.Item; import org.craftercms.studio.commons.dto.Tenant; import org.mockito.Mockito;
import java.util.*; import org.apache.commons.lang.*; import org.craftercms.studio.commons.dto.*; import org.mockito.*;
[ "java.util", "org.apache.commons", "org.craftercms.studio", "org.mockito" ]
java.util; org.apache.commons; org.craftercms.studio; org.mockito;
2,177,983
public void setRawObject(@Nonnull final ISerializer serializer, @Nonnull final JsonObject json) { if (json.has("bundles")) { bundles = serializer.deserializeObject(json.get("bundles"), DriveItemCollectionPage.class); } if (json.has("following")) { following = serializer.deserializeObject(json.get("following"), DriveItemCollectionPage.class); } if (json.has("items")) { items = serializer.deserializeObject(json.get("items"), DriveItemCollectionPage.class); } if (json.has("special")) { special = serializer.deserializeObject(json.get("special"), DriveItemCollectionPage.class); } }
void function(@Nonnull final ISerializer serializer, @Nonnull final JsonObject json) { if (json.has(STR)) { bundles = serializer.deserializeObject(json.get(STR), DriveItemCollectionPage.class); } if (json.has(STR)) { following = serializer.deserializeObject(json.get(STR), DriveItemCollectionPage.class); } if (json.has("items")) { items = serializer.deserializeObject(json.get("items"), DriveItemCollectionPage.class); } if (json.has(STR)) { special = serializer.deserializeObject(json.get(STR), DriveItemCollectionPage.class); } }
/** * Sets the raw JSON object * * @param serializer the serializer * @param json the JSON object to set this object to */
Sets the raw JSON object
setRawObject
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/models/Drive.java", "license": "mit", "size": 4945 }
[ "com.google.gson.JsonObject", "com.microsoft.graph.requests.DriveItemCollectionPage", "com.microsoft.graph.serializer.ISerializer", "javax.annotation.Nonnull" ]
import com.google.gson.JsonObject; import com.microsoft.graph.requests.DriveItemCollectionPage; import com.microsoft.graph.serializer.ISerializer; import javax.annotation.Nonnull;
import com.google.gson.*; import com.microsoft.graph.requests.*; import com.microsoft.graph.serializer.*; import javax.annotation.*;
[ "com.google.gson", "com.microsoft.graph", "javax.annotation" ]
com.google.gson; com.microsoft.graph; javax.annotation;
132,473
public void testIsLocalReturnsFalse() { HelperDef helperDef = (new JavascriptHelperDef.Builder()).build(); assertFalse(helperDef.isLocal()); }
void function() { HelperDef helperDef = (new JavascriptHelperDef.Builder()).build(); assertFalse(helperDef.isLocal()); }
/** * Verify JavascriptHelperDef is non-local. */
Verify JavascriptHelperDef is non-local
testIsLocalReturnsFalse
{ "repo_name": "badlogicmanpreet/aura", "path": "aura-integration-test/src/test/java/org/auraframework/integration/test/helper/JavascriptHelperDefTest.java", "license": "apache-2.0", "size": 2351 }
[ "org.auraframework.def.HelperDef", "org.auraframework.impl.javascript.helper.JavascriptHelperDef" ]
import org.auraframework.def.HelperDef; import org.auraframework.impl.javascript.helper.JavascriptHelperDef;
import org.auraframework.def.*; import org.auraframework.impl.javascript.helper.*;
[ "org.auraframework.def", "org.auraframework.impl" ]
org.auraframework.def; org.auraframework.impl;
1,172,936
public void setValue(float x, float y) { data[0] = x; data[1] = y; try { node.setValue(fieldIndex, data, 2); } catch(FieldException ife) { } }
void function(float x, float y) { data[0] = x; data[1] = y; try { node.setValue(fieldIndex, data, 2); } catch(FieldException ife) { } }
/** * Set the value of the field to the given set of component colors. * * @param x The x component of the color * @param y The y component of the color */
Set the value of the field to the given set of component colors
setValue
{ "repo_name": "Norkart/NK-VirtualGlobe", "path": "Xj3D/src/java/org/web3d/vrml/scripting/jsai/JSAISFVec2f.java", "license": "gpl-2.0", "size": 5066 }
[ "org.web3d.vrml.lang.FieldException" ]
import org.web3d.vrml.lang.FieldException;
import org.web3d.vrml.lang.*;
[ "org.web3d.vrml" ]
org.web3d.vrml;
2,032,747
void unsubscribe(String subscription, AsyncResult request) throws IOException, JMSException;
void unsubscribe(String subscription, AsyncResult request) throws IOException, JMSException;
/** * Remove a durable topic subscription by name. * * A provider can throw an instance of JMSException to indicate that it cannot perform the * un-subscribe operation due to bad security credentials etc. * * @param subscription * the name of the durable subscription that is to be removed. * @param request * The request object that should be signaled when this operation completes. * * @throws IOException if an error occurs or the Provider is already closed. * @throws JMSException if an error occurs due to JMS violation such not authorized. */
Remove a durable topic subscription by name. A provider can throw an instance of JMSException to indicate that it cannot perform the un-subscribe operation due to bad security credentials etc
unsubscribe
{ "repo_name": "andrew-buckley/qpid-jms", "path": "qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/Provider.java", "license": "apache-2.0", "size": 15308 }
[ "java.io.IOException", "javax.jms.JMSException" ]
import java.io.IOException; import javax.jms.JMSException;
import java.io.*; import javax.jms.*;
[ "java.io", "javax.jms" ]
java.io; javax.jms;
1,679,994
@SuppressWarnings("unchecked") public static boolean isCustomJavaSerialization(Class cls) { for (Class c = cls; c != null && !c.equals(Object.class); c = c.getSuperclass()) { if (Externalizable.class.isAssignableFrom(c)) return true; try { Method writeObj = c.getDeclaredMethod("writeObject", ObjectOutputStream.class); Method readObj = c.getDeclaredMethod("readObject", ObjectInputStream.class); if (!Modifier.isStatic(writeObj.getModifiers()) && !Modifier.isStatic(readObj.getModifiers()) && writeObj.getReturnType() == void.class && readObj.getReturnType() == void.class) return true; } catch (NoSuchMethodException ignored) { // No-op. } } return false; }
@SuppressWarnings(STR) static boolean function(Class cls) { for (Class c = cls; c != null && !c.equals(Object.class); c = c.getSuperclass()) { if (Externalizable.class.isAssignableFrom(c)) return true; try { Method writeObj = c.getDeclaredMethod(STR, ObjectOutputStream.class); Method readObj = c.getDeclaredMethod(STR, ObjectInputStream.class); if (!Modifier.isStatic(writeObj.getModifiers()) && !Modifier.isStatic(readObj.getModifiers()) && writeObj.getReturnType() == void.class && readObj.getReturnType() == void.class) return true; } catch (NoSuchMethodException ignored) { } } return false; }
/** * Determines whether class contains custom Java serialization logic. * * @param cls Class. * @return {@code true} if custom Java serialization logic exists, {@code false} otherwise. */
Determines whether class contains custom Java serialization logic
isCustomJavaSerialization
{ "repo_name": "ryanzz/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryUtils.java", "license": "apache-2.0", "size": 66305 }
[ "java.io.Externalizable", "java.io.ObjectInputStream", "java.io.ObjectOutputStream", "java.lang.reflect.Method", "java.lang.reflect.Modifier" ]
import java.io.Externalizable; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.lang.reflect.Method; import java.lang.reflect.Modifier;
import java.io.*; import java.lang.reflect.*;
[ "java.io", "java.lang" ]
java.io; java.lang;
1,428,555
public Map parse(final char[] chars, int offset, int length, char separator) { if (chars == null) { return new HashMap(); } HashMap params = new HashMap(); this.chars = chars; this.pos = offset; this.len = length; String paramName = null; String paramValue = null; while (hasChar()) { paramName = parseToken(new char[] { '=', separator }); paramValue = null; if (hasChar() && (chars[pos] == '=')) { pos++; // skip '=' paramValue = parseQuotedToken(new char[] { separator }); } if (hasChar() && (chars[pos] == separator)) { pos++; // skip separator } if ((paramName != null) && (paramName.length() > 0)) { if (this.lowerCaseNames) { paramName = paramName.toLowerCase(); } params.put(paramName, paramValue); } } return params; }
Map function(final char[] chars, int offset, int length, char separator) { if (chars == null) { return new HashMap(); } HashMap params = new HashMap(); this.chars = chars; this.pos = offset; this.len = length; String paramName = null; String paramValue = null; while (hasChar()) { paramName = parseToken(new char[] { '=', separator }); paramValue = null; if (hasChar() && (chars[pos] == '=')) { pos++; paramValue = parseQuotedToken(new char[] { separator }); } if (hasChar() && (chars[pos] == separator)) { pos++; } if ((paramName != null) && (paramName.length() > 0)) { if (this.lowerCaseNames) { paramName = paramName.toLowerCase(); } params.put(paramName, paramValue); } } return params; }
/** * Extracts a map of name/value pairs from the given array of characters. Names are expected to be unique. * * @param chars the array of characters that contains a sequence of name/value pairs * @param offset - the initial offset. * @param length - the length. * @param separator the name/value pairs separator * @return a map of name/value pairs */
Extracts a map of name/value pairs from the given array of characters. Names are expected to be unique
parse
{ "repo_name": "pellcorp/multipartrequest", "path": "src/main/java/com/pellcorp/multipartrequest/commons/fileupload/ParameterParser.java", "license": "lgpl-2.1", "size": 8640 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,001,676
@POST @Consumes(MediaType.APPLICATION_JSON) public Response postTimelimit(JSONObject jsonEntity) { String id; final TimeLimitEntity timeLimitEntity = new TimeLimitEntity(); URI timeLimitUri = null; try { timeLimitEntity.setLimitname(jsonEntity.getString("limitname")); timeLimitEntity.setLimittime(ResourcesUtils.getTime(jsonEntity .getString("limittime"))); entityManagerConfig.getTransaction().begin(); entityManagerConfig.persist(timeLimitEntity); id = timeLimitEntity.getLimitname(); entityManagerConfig.getTransaction().commit(); } catch (JSONException je) { logger.error(ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_JSON, je); throw new ApplicationJsonException(je, ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_JSON, Response.Status.BAD_REQUEST.getStatusCode()); } catch (NumberFormatException nfe) { logger.error(ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_NUMBER_FORMAT, nfe); throw new ApplicationJsonException( nfe, ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_NUMBER_FORMAT, Response.Status.BAD_REQUEST.getStatusCode()); } catch (RollbackException re) { ApplicationJsonException.handleSQLException(re, ERROR_MESSAGE_POST_TIME_LIMITS, logger); logger.error( ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_ROLLBACK, re); throw re; } catch (ParseException pe) { logger.error(ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_PARSE, pe); throw new ApplicationJsonException(pe, ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_PARSE, Response.Status.BAD_REQUEST.getStatusCode()); } finally { if (null != entityManagerConfig) { entityManagerConfig.close(); } } timeLimitUri = getUriInfo().getAbsolutePathBuilder() .path(timeLimitEntity.toString()).build(); return JsonResponseWrapper.getResponse(id, Response.Status.CREATED, timeLimitUri); }
@Consumes(MediaType.APPLICATION_JSON) Response function(JSONObject jsonEntity) { String id; final TimeLimitEntity timeLimitEntity = new TimeLimitEntity(); URI timeLimitUri = null; try { timeLimitEntity.setLimitname(jsonEntity.getString(STR)); timeLimitEntity.setLimittime(ResourcesUtils.getTime(jsonEntity .getString(STR))); entityManagerConfig.getTransaction().begin(); entityManagerConfig.persist(timeLimitEntity); id = timeLimitEntity.getLimitname(); entityManagerConfig.getTransaction().commit(); } catch (JSONException je) { logger.error(ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_JSON, je); throw new ApplicationJsonException(je, ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_JSON, Response.Status.BAD_REQUEST.getStatusCode()); } catch (NumberFormatException nfe) { logger.error(ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_NUMBER_FORMAT, nfe); throw new ApplicationJsonException( nfe, ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_NUMBER_FORMAT, Response.Status.BAD_REQUEST.getStatusCode()); } catch (RollbackException re) { ApplicationJsonException.handleSQLException(re, ERROR_MESSAGE_POST_TIME_LIMITS, logger); logger.error( ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_ROLLBACK, re); throw re; } catch (ParseException pe) { logger.error(ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_PARSE, pe); throw new ApplicationJsonException(pe, ERROR_MESSAGE_POST_TIME_LIMITS + ERROR_REASON_PARSE, Response.Status.BAD_REQUEST.getStatusCode()); } finally { if (null != entityManagerConfig) { entityManagerConfig.close(); } } timeLimitUri = getUriInfo().getAbsolutePathBuilder() .path(timeLimitEntity.toString()).build(); return JsonResponseWrapper.getResponse(id, Response.Status.CREATED, timeLimitUri); }
/** * POST method : creates a time limit * * @param jsonEntity * JSONObject * @return Response */
POST method : creates a time limit
postTimelimit
{ "repo_name": "FinTP/fintp_api", "path": "src/main/java/ro/allevo/fintpws/resources/TimeLimitsResource.java", "license": "gpl-3.0", "size": 8472 }
[ "java.text.ParseException", "javax.persistence.RollbackException", "javax.ws.rs.Consumes", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.codehaus.jettison.json.JSONException", "org.codehaus.jettison.json.JSONObject", "ro.allevo.fintpws.exceptions.ApplicationJsonException", "ro.allevo.fintpws.model.TimeLimitEntity", "ro.allevo.fintpws.util.JsonResponseWrapper", "ro.allevo.fintpws.util.ResourcesUtils" ]
import java.text.ParseException; import javax.persistence.RollbackException; import javax.ws.rs.Consumes; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import ro.allevo.fintpws.exceptions.ApplicationJsonException; import ro.allevo.fintpws.model.TimeLimitEntity; import ro.allevo.fintpws.util.JsonResponseWrapper; import ro.allevo.fintpws.util.ResourcesUtils;
import java.text.*; import javax.persistence.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.codehaus.jettison.json.*; import ro.allevo.fintpws.exceptions.*; import ro.allevo.fintpws.model.*; import ro.allevo.fintpws.util.*;
[ "java.text", "javax.persistence", "javax.ws", "org.codehaus.jettison", "ro.allevo.fintpws" ]
java.text; javax.persistence; javax.ws; org.codehaus.jettison; ro.allevo.fintpws;
2,154,320
public int getSerializedSizeAsMessageSet() { int result = 0; for (final Map.Entry<Integer, Field> entry : fields.entrySet()) { result += entry.getValue().getSerializedSizeAsMessageSetExtension( entry.getKey()); } return result; }
int function() { int result = 0; for (final Map.Entry<Integer, Field> entry : fields.entrySet()) { result += entry.getValue().getSerializedSizeAsMessageSetExtension( entry.getKey()); } return result; }
/** * Get the number of bytes required to encode this set using * {@code MessageSet} wire format. */
Get the number of bytes required to encode this set using MessageSet wire format
getSerializedSizeAsMessageSet
{ "repo_name": "spotify/ffwd-java", "path": "protobuf250/src/main/java/com/spotify/ffwd/protobuf250/UnknownFieldSet.java", "license": "apache-2.0", "size": 32633 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,784,304
private boolean checkGrantTypes(final String type, final OAuth20GrantTypes... expectedTypes) { LOGGER.debug("Grant type: [{}]", type); for (final OAuth20GrantTypes expectedType : expectedTypes) { if (isGrantType(type, expectedType)) { return true; } } LOGGER.error("Unsupported grant type: [{}]", type); return false; }
boolean function(final String type, final OAuth20GrantTypes... expectedTypes) { LOGGER.debug(STR, type); for (final OAuth20GrantTypes expectedType : expectedTypes) { if (isGrantType(type, expectedType)) { return true; } } LOGGER.error(STR, type); return false; }
/** * Check the grant type against expected grant types. * * @param type the current grant type * @param expectedTypes the expected grant types * @return whether the grant type is supported */
Check the grant type against expected grant types
checkGrantTypes
{ "repo_name": "gabedwrds/cas", "path": "support/cas-server-support-oauth/src/main/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20AccessTokenEndpointController.java", "license": "apache-2.0", "size": 13850 }
[ "org.apereo.cas.support.oauth.OAuth20GrantTypes" ]
import org.apereo.cas.support.oauth.OAuth20GrantTypes;
import org.apereo.cas.support.oauth.*;
[ "org.apereo.cas" ]
org.apereo.cas;
60,439
public CoinbaseAccount createCoinbaseAccount(String name) throws IOException { CreateCoinbaseAccountPayload payload = new CreateCoinbaseAccountPayload(name); String path = "/v2/accounts"; String apiKey = exchange.getExchangeSpecification().getApiKey(); BigDecimal timestamp = coinbase.getTime(Coinbase.CB_VERSION_VALUE).getData().getEpoch(); String body = new ObjectMapper().writeValueAsString(payload); String signature = getSignature(timestamp, HttpMethod.POST, path, body); showCurl(HttpMethod.POST, apiKey, timestamp, signature, path, body); return coinbase .createAccount( MediaType.APPLICATION_JSON, Coinbase.CB_VERSION_VALUE, apiKey, signature, timestamp, payload) .getData(); }
CoinbaseAccount function(String name) throws IOException { CreateCoinbaseAccountPayload payload = new CreateCoinbaseAccountPayload(name); String path = STR; String apiKey = exchange.getExchangeSpecification().getApiKey(); BigDecimal timestamp = coinbase.getTime(Coinbase.CB_VERSION_VALUE).getData().getEpoch(); String body = new ObjectMapper().writeValueAsString(payload); String signature = getSignature(timestamp, HttpMethod.POST, path, body); showCurl(HttpMethod.POST, apiKey, timestamp, signature, path, body); return coinbase .createAccount( MediaType.APPLICATION_JSON, Coinbase.CB_VERSION_VALUE, apiKey, signature, timestamp, payload) .getData(); }
/** * Authenticated resource that creates a new BTC account for the current user. * * @see <a * href="https://developers.coinbase.com/api/v2#create-account">developers.coinbase.com/api/v2#create-account</a> */
Authenticated resource that creates a new BTC account for the current user
createCoinbaseAccount
{ "repo_name": "chrisrico/XChange", "path": "xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseAccountServiceRaw.java", "license": "mit", "size": 4940 }
[ "com.fasterxml.jackson.databind.ObjectMapper", "java.io.IOException", "java.math.BigDecimal", "javax.ws.rs.core.MediaType", "org.knowm.xchange.coinbase.v2.Coinbase", "org.knowm.xchange.coinbase.v2.dto.account.CoinbaseAccountData" ]
import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.math.BigDecimal; import javax.ws.rs.core.MediaType; import org.knowm.xchange.coinbase.v2.Coinbase; import org.knowm.xchange.coinbase.v2.dto.account.CoinbaseAccountData;
import com.fasterxml.jackson.databind.*; import java.io.*; import java.math.*; import javax.ws.rs.core.*; import org.knowm.xchange.coinbase.v2.*; import org.knowm.xchange.coinbase.v2.dto.account.*;
[ "com.fasterxml.jackson", "java.io", "java.math", "javax.ws", "org.knowm.xchange" ]
com.fasterxml.jackson; java.io; java.math; javax.ws; org.knowm.xchange;
2,556,616
public long next() { final long curNextValue = pubHeadAndTailCache.nextValue; final long nextSequence = curNextValue + 1L; final long wrapPoint = nextSequence - bufferSize; final long cachedGatingSequence = pubHeadAndTailCache.tailCache; if(wrapPoint > cachedGatingSequence || cachedGatingSequence > curNextValue) { long minSequence; while(wrapPoint > (minSequence = getMinimumSequence(tails, curNextValue))) LockSupport.parkNanos(1L); pubHeadAndTailCache.tailCache = minSequence; } pubHeadAndTailCache.nextValue = nextSequence; return nextSequence; }
long function() { final long curNextValue = pubHeadAndTailCache.nextValue; final long nextSequence = curNextValue + 1L; final long wrapPoint = nextSequence - bufferSize; final long cachedGatingSequence = pubHeadAndTailCache.tailCache; if(wrapPoint > cachedGatingSequence cachedGatingSequence > curNextValue) { long minSequence; while(wrapPoint > (minSequence = getMinimumSequence(tails, curNextValue))) LockSupport.parkNanos(1L); pubHeadAndTailCache.tailCache = minSequence; } pubHeadAndTailCache.nextValue = nextSequence; return nextSequence; }
/** * This is used by the publishing thread to claim the given number of entries * in the buffer all of the underlying {@link RingBufferControl}s. The sequence * returned should be supplied to the {@link RingBufferControlWorkerPool#publish(long)} command once the publisher * thread has prepared the * entries. * * @return the sequence to provide to the {@link RingBufferControl#publish(long)} or the * {@link RingBufferControl#index(long)} methods. */
This is used by the publishing thread to claim the given number of entries in the buffer all of the underlying <code>RingBufferControl</code>s. The sequence returned should be supplied to the <code>RingBufferControlWorkerPool#publish(long)</code> command once the publisher thread has prepared the entries
next
{ "repo_name": "Dempsy/dempsy-commons", "path": "dempsy-ringbuffer/src/main/java/net/dempsy/ringbuffer/RingBufferControlWorkerPool.java", "license": "apache-2.0", "size": 14932 }
[ "java.util.concurrent.locks.LockSupport" ]
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.*;
[ "java.util" ]
java.util;
476,310
private void fillByGroundSource(RPAction action) { int itemid = action.getInt(EquipActionConsts.BASE_ITEM); Entity entity = (Entity) zone.get(new RPObject.ID(itemid, zone.getID())); if (entity instanceof Item) { item = (Item) entity; } slot = new GroundSlot(zone, item); }
void function(RPAction action) { int itemid = action.getInt(EquipActionConsts.BASE_ITEM); Entity entity = (Entity) zone.get(new RPObject.ID(itemid, zone.getID())); if (entity instanceof Item) { item = (Item) entity; } slot = new GroundSlot(zone, item); }
/** * handles items on the ground * * @param action RPAction */
handles items on the ground
fillByGroundSource
{ "repo_name": "sourceress-project/archestica", "path": "src/games/stendhal/server/entity/equip/ItemIdentificationPath.java", "license": "gpl-2.0", "size": 6042 }
[ "games.stendhal.common.EquipActionConsts", "games.stendhal.server.entity.Entity", "games.stendhal.server.entity.item.Item", "games.stendhal.server.entity.slot.GroundSlot" ]
import games.stendhal.common.EquipActionConsts; import games.stendhal.server.entity.Entity; import games.stendhal.server.entity.item.Item; import games.stendhal.server.entity.slot.GroundSlot;
import games.stendhal.common.*; import games.stendhal.server.entity.*; import games.stendhal.server.entity.item.*; import games.stendhal.server.entity.slot.*;
[ "games.stendhal.common", "games.stendhal.server" ]
games.stendhal.common; games.stendhal.server;
2,650,425
EReference getIFMLModel_DomainModel();
EReference getIFMLModel_DomainModel();
/** * Returns the meta object for the containment reference '{@link IFML.Core.IFMLModel#getDomainModel <em>Domain Model</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Domain Model</em>'. * @see IFML.Core.IFMLModel#getDomainModel() * @see #getIFMLModel() * @generated */
Returns the meta object for the containment reference '<code>IFML.Core.IFMLModel#getDomainModel Domain Model</code>'.
getIFMLModel_DomainModel
{ "repo_name": "ifml/ifml-editor", "path": "plugins/IFMLEditor/src/IFML/Core/CorePackage.java", "license": "mit", "size": 245317 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,546,719
public static List<String[]> resultSetToStringArrayList(ResultSet resultSet) { List<String[]> stringArrayList = Lists.newArrayList(); stringArrayList.add(getColumnLabels(resultSet).toArray(new String[] {})); if (resultSet.getRows() != null) { for (Row row : resultSet.getRows()) { try { stringArrayList.add(getRowStringValues(row).toArray(new String[] {})); } catch (IllegalArgumentException e) { throw new IllegalStateException("Cannot convert result set to string array list", e); } } } return stringArrayList; }
static List<String[]> function(ResultSet resultSet) { List<String[]> stringArrayList = Lists.newArrayList(); stringArrayList.add(getColumnLabels(resultSet).toArray(new String[] {})); if (resultSet.getRows() != null) { for (Row row : resultSet.getRows()) { try { stringArrayList.add(getRowStringValues(row).toArray(new String[] {})); } catch (IllegalArgumentException e) { throw new IllegalStateException(STR, e); } } } return stringArrayList; }
/** * Gets the result set as list of string arrays, which can be transformed to a CSV using {@code * CsvFiles} such as * * <pre> * <code> * ResultSet combinedResultSet = Pql.combineResultSet(resultSet1, resultSet2); * //... * combinedResultSet = Pql.combineResultSet(combinedResultSet, resultSet3); * CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath); * </code> * </pre> * * @param resultSet the result set to convert to a CSV compatible format * @return a list of string arrays representing the result set */
Gets the result set as list of string arrays, which can be transformed to a CSV using CsvFiles such as <code> <code> ResultSet combinedResultSet = Pql.combineResultSet(resultSet1, resultSet2); ... combinedResultSet = Pql.combineResultSet(combinedResultSet, resultSet3); CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath); </code> </code>
resultSetToStringArrayList
{ "repo_name": "googleads/googleads-java-lib", "path": "modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/utils/v202105/Pql.java", "license": "apache-2.0", "size": 18561 }
[ "com.google.api.ads.admanager.jaxws.v202105.ResultSet", "com.google.api.ads.admanager.jaxws.v202105.Row", "com.google.common.collect.Lists", "java.util.List" ]
import com.google.api.ads.admanager.jaxws.v202105.ResultSet; import com.google.api.ads.admanager.jaxws.v202105.Row; import com.google.common.collect.Lists; import java.util.List;
import com.google.api.ads.admanager.jaxws.v202105.*; import com.google.common.collect.*; import java.util.*;
[ "com.google.api", "com.google.common", "java.util" ]
com.google.api; com.google.common; java.util;
2,318,808
static native void setLongNative(Field field, Object obj, long val);
static native void setLongNative(Field field, Object obj, long val);
/** * Sets the value of the specified "long" field, allowing final values * to be assigned. * * @param field Field to set the value. * @param obj Instance which will have its field set. * @param val Value to put in the field. */
Sets the value of the specified "long" field, allowing final values to be assigned
setLongNative
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/java/io/VMObjectStreamClass.java", "license": "gpl-2.0", "size": 4980 }
[ "java.lang.reflect.Field" ]
import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,171,093
public static void instantiateSelf(File project) throws PersistenceException, VilException { instantiateSelf(project, (Map<String, Object>) null); }
static void function(File project) throws PersistenceException, VilException { instantiateSelf(project, (Map<String, Object>) null); }
/** * Instantiates the given project. * The project must: * <ul> * <li>be a valid EASy project with the usual configuration files and folders.</li> * <li>contain a frozen configuration</li> * <li>contain VIL script which can be applied to itself</li> * </ul> * * @param project The toplevel absolute folder of the project (must have a valid EASy structure) * * @throws PersistenceException Will be thrown if the project could not be loaded, e.g. if the project has no * valid EASy structure. * @throws VilException In case that artifact operations or script execution fails */
Instantiates the given project. The project must: be a valid EASy project with the usual configuration files and folders. contain a frozen configuration contain VIL script which can be applied to itself
instantiateSelf
{ "repo_name": "SSEHUB/EASyProducer", "path": "EASy-Standalone/EASyCommandLine/src/net/ssehub/easy/standalone/cmd/InstantiationCommands.java", "license": "apache-2.0", "size": 38211 }
[ "java.io.File", "java.util.Map", "net.ssehub.easy.instantiation.core.model.common.VilException", "net.ssehub.easy.producer.core.persistence.PersistenceException" ]
import java.io.File; import java.util.Map; import net.ssehub.easy.instantiation.core.model.common.VilException; import net.ssehub.easy.producer.core.persistence.PersistenceException;
import java.io.*; import java.util.*; import net.ssehub.easy.instantiation.core.model.common.*; import net.ssehub.easy.producer.core.persistence.*;
[ "java.io", "java.util", "net.ssehub.easy" ]
java.io; java.util; net.ssehub.easy;
1,654,613
public void zoomOutRange(double x, double y) { Plot p = this.chart.getPlot(); if (p instanceof Zoomable) { Zoomable z = (Zoomable) p; z.zoomRangeAxes(this.zoomOutFactor, this.info.getPlotInfo(), translateScreenToJava2D(new Point((int) x, (int) y)), this.zoomAroundAnchor); } }
void function(double x, double y) { Plot p = this.chart.getPlot(); if (p instanceof Zoomable) { Zoomable z = (Zoomable) p; z.zoomRangeAxes(this.zoomOutFactor, this.info.getPlotInfo(), translateScreenToJava2D(new Point((int) x, (int) y)), this.zoomAroundAnchor); } }
/** * Increases the length the range axis, centered about the given * coordinate on the screen. The length of the range axis is increased * by the value of {@link #getZoomOutFactor()}. * * @param x the x coordinate (in screen coordinates). * @param y the y-coordinate (in screen coordinates). */
Increases the length the range axis, centered about the given coordinate on the screen. The length of the range axis is increased by the value of <code>#getZoomOutFactor()</code>
zoomOutRange
{ "repo_name": "ibestvina/multithread-centiscape", "path": "CentiScaPe2.1/src/main/java/org/jfree/chart/ChartPanel.java", "license": "mit", "size": 88952 }
[ "java.awt.Point", "org.jfree.chart.plot.Plot", "org.jfree.chart.plot.Zoomable" ]
import java.awt.Point; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.Zoomable;
import java.awt.*; import org.jfree.chart.plot.*;
[ "java.awt", "org.jfree.chart" ]
java.awt; org.jfree.chart;
485,945
public List<SadlCommand> getSadlCommands();
List<SadlCommand> function();
/** * Method to obtain the sadl commands in a SADL model * @return -- the SadlCommands of the model */
Method to obtain the sadl commands in a SADL model
getSadlCommands
{ "repo_name": "crapo/sadlos2", "path": "sadl3/com.ge.research.sadl.parent/com.ge.research.sadl.jena/src/com/ge/research/sadl/jena/IJenaBasedModelProcessor.java", "license": "epl-1.0", "size": 4525 }
[ "com.ge.research.sadl.model.gp.SadlCommand", "java.util.List" ]
import com.ge.research.sadl.model.gp.SadlCommand; import java.util.List;
import com.ge.research.sadl.model.gp.*; import java.util.*;
[ "com.ge.research", "java.util" ]
com.ge.research; java.util;
2,322,971
public static void writeStringListToConfAsBase64(String key, List<String> list, Configuration conf) { Preconditions.checkNotNull(list); Iterator<String> iter = list.iterator(); StringBuilder sb = new StringBuilder(); while(iter.hasNext()) { byte[] bytes = Base64.encodeBase64(iter.next().getBytes(Charsets.UTF_8), false); sb.append(new String(bytes, Charsets.UTF_8)); if (iter.hasNext()) { sb.append(','); } } conf.set(key, sb.toString()); }
static void function(String key, List<String> list, Configuration conf) { Preconditions.checkNotNull(list); Iterator<String> iter = list.iterator(); StringBuilder sb = new StringBuilder(); while(iter.hasNext()) { byte[] bytes = Base64.encodeBase64(iter.next().getBytes(Charsets.UTF_8), false); sb.append(new String(bytes, Charsets.UTF_8)); if (iter.hasNext()) { sb.append(','); } } conf.set(key, sb.toString()); }
/** * Writes a list of strings into a configuration by base64 encoding them and separating * them with commas * * @param key for the configuration * @param list to write * @param conf to write to */
Writes a list of strings into a configuration by base64 encoding them and separating them with commas
writeStringListToConfAsBase64
{ "repo_name": "InMobi/elephant-bird", "path": "core/src/main/java/com/twitter/elephantbird/util/HadoopUtils.java", "license": "apache-2.0", "size": 7189 }
[ "com.google.common.base.Charsets", "com.google.common.base.Preconditions", "java.util.Iterator", "java.util.List", "org.apache.commons.codec.binary.Base64", "org.apache.hadoop.conf.Configuration" ]
import com.google.common.base.Charsets; import com.google.common.base.Preconditions; import java.util.Iterator; import java.util.List; import org.apache.commons.codec.binary.Base64; import org.apache.hadoop.conf.Configuration;
import com.google.common.base.*; import java.util.*; import org.apache.commons.codec.binary.*; import org.apache.hadoop.conf.*;
[ "com.google.common", "java.util", "org.apache.commons", "org.apache.hadoop" ]
com.google.common; java.util; org.apache.commons; org.apache.hadoop;
205,338
void update(DashboardMetadata dashboardMetadata) throws DashboardException;
void update(DashboardMetadata dashboardMetadata) throws DashboardException;
/** * DashboardMetadata update operation. * * @param dashboardMetadata Updated instance of existing DashboardMetadata * @throws DashboardException if an error occurs */
DashboardMetadata update operation
update
{ "repo_name": "udarakr/carbon-dashboards", "path": "components/org.wso2.carbon.dashboards.core/src/main/java/org/wso2/carbon/dashboards/core/internal/dao/DashboardMetadataDAO.java", "license": "apache-2.0", "size": 6926 }
[ "org.wso2.carbon.dashboards.core.bean.DashboardMetadata", "org.wso2.carbon.dashboards.core.exception.DashboardException" ]
import org.wso2.carbon.dashboards.core.bean.DashboardMetadata; import org.wso2.carbon.dashboards.core.exception.DashboardException;
import org.wso2.carbon.dashboards.core.bean.*; import org.wso2.carbon.dashboards.core.exception.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
226,028
public ServerBuilder maxHttp1HeaderSize(int maxHttp1HeaderSize) { this.maxHttp1HeaderSize = validateNonNegative(maxHttp1HeaderSize, "maxHttp1HeaderSize"); return this; }
ServerBuilder function(int maxHttp1HeaderSize) { this.maxHttp1HeaderSize = validateNonNegative(maxHttp1HeaderSize, STR); return this; }
/** * Sets the maximum length of all headers in an HTTP/1 response. */
Sets the maximum length of all headers in an HTTP/1 response
maxHttp1HeaderSize
{ "repo_name": "jmostella/armeria", "path": "core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java", "license": "apache-2.0", "size": 48086 }
[ "com.linecorp.armeria.server.ServerConfig" ]
import com.linecorp.armeria.server.ServerConfig;
import com.linecorp.armeria.server.*;
[ "com.linecorp.armeria" ]
com.linecorp.armeria;
2,111,750
public static SuggestionsInfo getInDictEmptySuggestions() { return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY, EMPTY_STRING_ARRAY); }
static SuggestionsInfo function() { return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY, EMPTY_STRING_ARRAY); }
/** * Returns an empty suggestionInfo with flags signaling the word is in the dictionary. * @return the empty SuggestionsInfo with the appropriate flags set. */
Returns an empty suggestionInfo with flags signaling the word is in the dictionary
getInDictEmptySuggestions
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "packages/inputmethods/LatinIME/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java", "license": "gpl-3.0", "size": 22006 }
[ "android.view.textservice.SuggestionsInfo" ]
import android.view.textservice.SuggestionsInfo;
import android.view.textservice.*;
[ "android.view" ]
android.view;
452,916
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux<ChatThreadMember> listChatThreadMembersAsync(String chatThreadId, Context context) { return new PagedFlux<>( () -> listChatThreadMembersSinglePageAsync(chatThreadId, context), nextLink -> listChatThreadMembersNextSinglePageAsync(nextLink, context)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<ChatThreadMember> function(String chatThreadId, Context context) { return new PagedFlux<>( () -> listChatThreadMembersSinglePageAsync(chatThreadId, context), nextLink -> listChatThreadMembersNextSinglePageAsync(nextLink, context)); }
/** * Gets the members of a thread. * * @param chatThreadId Thread id to get members for. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the members of a thread. */
Gets the members of a thread
listChatThreadMembersAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/communication/azure-communication-chat/src/main/java/com/azure/communication/chat/implementation/AzureCommunicationChatServiceImpl.java", "license": "mit", "size": 111033 }
[ "com.azure.communication.chat.implementation.models.ChatThreadMember", "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedFlux", "com.azure.core.util.Context" ]
import com.azure.communication.chat.implementation.models.ChatThreadMember; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.core.util.Context;
import com.azure.communication.chat.implementation.models.*; import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*;
[ "com.azure.communication", "com.azure.core" ]
com.azure.communication; com.azure.core;
2,282,191
public static void generateRPClass() { final RPClass entity = new RPClass(RPCLASS_SPELL); entity.isA("entity"); entity.addAttribute(ATTR_NAME, Type.STRING); entity.addAttribute(ATTR_AMOUNT, Type.INT); entity.addAttribute(ATTR_ATK, Type.INT); entity.addAttribute(ATTR_COOLDOWN, Type.INT); entity.addAttribute(ATTR_DEF, Type.INT); entity.addAttribute(ATTR_LIFESTEAL, Type.FLOAT); entity.addAttribute(ATTR_MANA, Type.INT); entity.addAttribute(ATTR_MINIMUMLEVEL, Type.INT); entity.addAttribute(ATTR_NATURE, Type.STRING); entity.addAttribute(ATTR_RANGE, Type.INT); entity.addAttribute(ATTR_RATE, Type.INT); entity.addAttribute(ATTR_REGEN, Type.INT); entity.addAttribute(ATTR_MODIFIER, Type.FLOAT); entity.addAttribute(ATTR_TIMESTAMP, Type.STRING); // class = nature entity.addAttribute("class", Type.STRING); entity.addAttribute("subclass", Type.STRING); } public Spell(final RPObject object) { super(object); if(!object.has(ATTR_TIMESTAMP)) { setTimestamp(0); } setNature(Nature.parse(object.get(ATTR_NATURE))); setRPClass(RPCLASS_SPELL); } public Spell( final String name, final Nature nature, final int amount, final int atk, final int cooldown, final int def, final double lifesteal, final int mana, final int minimumlevel, final int range, final int rate, final int regen, double modifier) { setRPClass(RPCLASS_SPELL); put(ATTR_NAME, name); put("subclass", name); put("class", nature.toString().toLowerCase()); put(ATTR_AMOUNT, amount); put(ATTR_ATK, atk); put(ATTR_COOLDOWN, cooldown); put(ATTR_DEF, def); put(ATTR_LIFESTEAL, lifesteal); put(ATTR_MANA, mana); put(ATTR_MINIMUMLEVEL, minimumlevel); put(ATTR_RANGE, range); put(ATTR_RATE, rate); put(ATTR_REGEN, regen); put(ATTR_NATURE, nature.name()); put(ATTR_MODIFIER, modifier); put(ATTR_TIMESTAMP, 0); put("type", "spell"); }
static void function() { final RPClass entity = new RPClass(RPCLASS_SPELL); entity.isA(STR); entity.addAttribute(ATTR_NAME, Type.STRING); entity.addAttribute(ATTR_AMOUNT, Type.INT); entity.addAttribute(ATTR_ATK, Type.INT); entity.addAttribute(ATTR_COOLDOWN, Type.INT); entity.addAttribute(ATTR_DEF, Type.INT); entity.addAttribute(ATTR_LIFESTEAL, Type.FLOAT); entity.addAttribute(ATTR_MANA, Type.INT); entity.addAttribute(ATTR_MINIMUMLEVEL, Type.INT); entity.addAttribute(ATTR_NATURE, Type.STRING); entity.addAttribute(ATTR_RANGE, Type.INT); entity.addAttribute(ATTR_RATE, Type.INT); entity.addAttribute(ATTR_REGEN, Type.INT); entity.addAttribute(ATTR_MODIFIER, Type.FLOAT); entity.addAttribute(ATTR_TIMESTAMP, Type.STRING); entity.addAttribute("class", Type.STRING); entity.addAttribute(STR, Type.STRING); } public Spell(final RPObject object) { super(object); if(!object.has(ATTR_TIMESTAMP)) { setTimestamp(0); } setNature(Nature.parse(object.get(ATTR_NATURE))); setRPClass(RPCLASS_SPELL); } public Spell( final String name, final Nature nature, final int amount, final int atk, final int cooldown, final int def, final double lifesteal, final int mana, final int minimumlevel, final int range, final int rate, final int regen, double modifier) { setRPClass(RPCLASS_SPELL); put(ATTR_NAME, name); put(STR, name); put("class", nature.toString().toLowerCase()); put(ATTR_AMOUNT, amount); put(ATTR_ATK, atk); put(ATTR_COOLDOWN, cooldown); put(ATTR_DEF, def); put(ATTR_LIFESTEAL, lifesteal); put(ATTR_MANA, mana); put(ATTR_MINIMUMLEVEL, minimumlevel); put(ATTR_RANGE, range); put(ATTR_RATE, rate); put(ATTR_REGEN, regen); put(ATTR_NATURE, nature.name()); put(ATTR_MODIFIER, modifier); put(ATTR_TIMESTAMP, 0); put("type", "spell"); }
/** * Generate the RPClass for spells */
Generate the RPClass for spells
generateRPClass
{ "repo_name": "acsid/stendhal", "path": "src/games/stendhal/server/entity/spell/Spell.java", "license": "gpl-2.0", "size": 13153 }
[ "games.stendhal.common.constants.Nature" ]
import games.stendhal.common.constants.Nature;
import games.stendhal.common.constants.*;
[ "games.stendhal.common" ]
games.stendhal.common;
2,058,108
public boolean canCreate(String repository) { if (canAdmin()) { // admins can create any repository return true; } if (canCreate) { String projectPath = StringUtils.getFirstPathElement(repository); if (!StringUtils.isEmpty(projectPath) && projectPath.equalsIgnoreCase("~" + username)) { // personal repository return true; } } return false; }
boolean function(String repository) { if (canAdmin()) { return true; } if (canCreate) { String projectPath = StringUtils.getFirstPathElement(repository); if (!StringUtils.isEmpty(projectPath) && projectPath.equalsIgnoreCase("~" + username)) { return true; } } return false; }
/** * Returns true if the user is allowed to create the specified repository. * * @param repository * @return true if the user can create the repository */
Returns true if the user is allowed to create the specified repository
canCreate
{ "repo_name": "BullShark/IRCBlit", "path": "src/main/java/com/gitblit/models/UserModel.java", "license": "apache-2.0", "size": 18123 }
[ "com.gitblit.utils.StringUtils" ]
import com.gitblit.utils.StringUtils;
import com.gitblit.utils.*;
[ "com.gitblit.utils" ]
com.gitblit.utils;
2,457,774
public static IOFileFilter nameFileFilter(String name, IOCase caseSensitivity) { return new NameFileFilter(name, caseSensitivity); }
static IOFileFilter function(String name, IOCase caseSensitivity) { return new NameFileFilter(name, caseSensitivity); }
/** * Returns a filter that returns true if the filename matches the specified text. * * @param name the filename * @param caseSensitivity how to handle case sensitivity, null means case-sensitive * @return a name checking filter * @see NameFileFilter * @since Commons IO 2.0 */
Returns a filter that returns true if the filename matches the specified text
nameFileFilter
{ "repo_name": "sebastiansemmle/acio", "path": "src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java", "license": "apache-2.0", "size": 28777 }
[ "org.apache.commons.io.IOCase" ]
import org.apache.commons.io.IOCase;
import org.apache.commons.io.*;
[ "org.apache.commons" ]
org.apache.commons;
2,439,403
public Observable<ServiceResponse<Page<Product>>> getSinglePagesFailureNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); }
Observable<ServiceResponse<Page<Product>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); }
/** * A paging operation that receives a 400 on the first call. * ServiceResponse<PageImpl<Product>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @return the List&lt;Product&gt; object wrapped in {@link ServiceResponse} if successful. */
A paging operation that receives a 400 on the first call
getSinglePagesFailureNextSinglePageAsync
{ "repo_name": "haocs/autorest", "path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/paging/implementation/PagingsImpl.java", "license": "mit", "size": 132597 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,014,458
@Test @Tag("slow") public void testPILOT_WE() { CuteNetlibCase.doTest("PILOT-WE.SIF", "-2720107.5328449034", "20770.464669007524", NumberContext.of(7, 4)); }
@Tag("slow") void function() { CuteNetlibCase.doTest(STR, STR, STR, NumberContext.of(7, 4)); }
/** * <pre> * 2019-02-13: Tagged as slow since too large for promotional/community version of CPLEX * 2019-02-13: Tagged as unstable since ojAlgo takes too long or fails validation * </pre> */
<code> 2019-02-13: Tagged as slow since too large for promotional/community version of CPLEX 2019-02-13: Tagged as unstable since ojAlgo takes too long or fails validation </code>
testPILOT_WE
{ "repo_name": "optimatika/ojAlgo", "path": "src/test/java/org/ojalgo/optimisation/linear/CuteNetlibCase.java", "license": "mit", "size": 42381 }
[ "org.junit.jupiter.api.Tag", "org.ojalgo.type.context.NumberContext" ]
import org.junit.jupiter.api.Tag; import org.ojalgo.type.context.NumberContext;
import org.junit.jupiter.api.*; import org.ojalgo.type.context.*;
[ "org.junit.jupiter", "org.ojalgo.type" ]
org.junit.jupiter; org.ojalgo.type;
1,383,514
static LxControl createControl(LxWsClient client, LxUuid uuid, LxJsonControl json, LxContainer room, LxCategory category) { if (json == null || json.type == null || json.name == null) { return null; } LxControl ctrl = null; String type = json.type.toLowerCase(); if (LxControlSwitch.accepts(type)) { ctrl = new LxControlSwitch(client, uuid, json, room, category); } else if (LxControlPushbutton.accepts(type)) { ctrl = new LxControlPushbutton(client, uuid, json, room, category); } else if (LxControlTimedSwitch.accepts(type)) { ctrl = new LxControlTimedSwitch(client, uuid, json, room, category); } else if (LxControlDimmer.accepts(type)) { ctrl = new LxControlDimmer(client, uuid, json, room, category); } else if (LxControlJalousie.accepts(type)) { ctrl = new LxControlJalousie(client, uuid, json, room, category); } else if (LxControlTextState.accepts(type)) { ctrl = new LxControlTextState(client, uuid, json, room, category); } else if (json.details != null) { if (LxControlInfoOnlyDigital.accepts(type) && json.details.text != null) { ctrl = new LxControlInfoOnlyDigital(client, uuid, json, room, category); } else if (LxControlInfoOnlyAnalog.accepts(type)) { ctrl = new LxControlInfoOnlyAnalog(client, uuid, json, room, category); } else if (LxControlLightController.accepts(type)) { ctrl = new LxControlLightController(client, uuid, json, room, category); } else if (LxControlRadio.accepts(type)) { ctrl = new LxControlRadio(client, uuid, json, room, category); } } return ctrl; }
static LxControl createControl(LxWsClient client, LxUuid uuid, LxJsonControl json, LxContainer room, LxCategory category) { if (json == null json.type == null json.name == null) { return null; } LxControl ctrl = null; String type = json.type.toLowerCase(); if (LxControlSwitch.accepts(type)) { ctrl = new LxControlSwitch(client, uuid, json, room, category); } else if (LxControlPushbutton.accepts(type)) { ctrl = new LxControlPushbutton(client, uuid, json, room, category); } else if (LxControlTimedSwitch.accepts(type)) { ctrl = new LxControlTimedSwitch(client, uuid, json, room, category); } else if (LxControlDimmer.accepts(type)) { ctrl = new LxControlDimmer(client, uuid, json, room, category); } else if (LxControlJalousie.accepts(type)) { ctrl = new LxControlJalousie(client, uuid, json, room, category); } else if (LxControlTextState.accepts(type)) { ctrl = new LxControlTextState(client, uuid, json, room, category); } else if (json.details != null) { if (LxControlInfoOnlyDigital.accepts(type) && json.details.text != null) { ctrl = new LxControlInfoOnlyDigital(client, uuid, json, room, category); } else if (LxControlInfoOnlyAnalog.accepts(type)) { ctrl = new LxControlInfoOnlyAnalog(client, uuid, json, room, category); } else if (LxControlLightController.accepts(type)) { ctrl = new LxControlLightController(client, uuid, json, room, category); } else if (LxControlRadio.accepts(type)) { ctrl = new LxControlRadio(client, uuid, json, room, category); } } return ctrl; }
/** * Create a {@link LxControl} object for a control received from the Miniserver * * @param client * websocket client to facilitate communication with Miniserver * @param uuid * UUID of the control to be created * @param json * JSON describing the control as received from the Miniserver * @param room * Room that this control belongs to * @param category * Category that this control belongs to * @return * created control object or null if error */
Create a <code>LxControl</code> object for a control received from the Miniserver
createControl
{ "repo_name": "beowulfe/openhab2", "path": "addons/binding/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/core/LxControl.java", "license": "epl-1.0", "size": 9460 }
[ "org.openhab.binding.loxone.internal.core.LxJsonApp3" ]
import org.openhab.binding.loxone.internal.core.LxJsonApp3;
import org.openhab.binding.loxone.internal.core.*;
[ "org.openhab.binding" ]
org.openhab.binding;
1,041,218
@Operation(desc = "Move the message corresponding to the given messageID to another queue", impact = MBeanOperationInfo.ACTION) boolean moveMessage(@Parameter(name = "messageID", desc = "A message ID") long messageID, @Parameter(name = "otherQueueName", desc = "The name of the queue to move the message to") String otherQueueName, @Parameter(name = "rejectDuplicates", desc = "Reject messages identified as duplicate by the duplicate message") boolean rejectDuplicates) throws Exception;
@Operation(desc = STR, impact = MBeanOperationInfo.ACTION) boolean moveMessage(@Parameter(name = STR, desc = STR) long messageID, @Parameter(name = STR, desc = STR) String otherQueueName, @Parameter(name = STR, desc = STR) boolean rejectDuplicates) throws Exception;
/** * Moves the message corresponding to the specified message ID to the specified other queue. * * @return {@code true} if the message was moved, {@code false} else */
Moves the message corresponding to the specified message ID to the specified other queue
moveMessage
{ "repo_name": "d0k1/activemq-artemis", "path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/QueueControl.java", "license": "apache-2.0", "size": 22193 }
[ "javax.management.MBeanOperationInfo" ]
import javax.management.MBeanOperationInfo;
import javax.management.*;
[ "javax.management" ]
javax.management;
2,848,359
@Deprecated void deleteColumn(final TableName tableName, final byte[] columnFamily) throws IOException;
void deleteColumn(final TableName tableName, final byte[] columnFamily) throws IOException;
/** * Delete a column family from a table. Asynchronous operation. * * @param tableName name of table * @param columnFamily name of column family to be deleted * @throws IOException if a remote or network exception occurs * @deprecated As of release 2.0.0. * (<a href="https://issues.apache.org/jira/browse/HBASE-1989">HBASE-1989</a>). * This will be removed in HBase 3.0.0. * Use {@link #deleteColumnFamily(TableName, byte[])}}. */
Delete a column family from a table. Asynchronous operation
deleteColumn
{ "repo_name": "SeekerResource/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java", "license": "apache-2.0", "size": 60792 }
[ "java.io.IOException", "org.apache.hadoop.hbase.TableName" ]
import java.io.IOException; import org.apache.hadoop.hbase.TableName;
import java.io.*; import org.apache.hadoop.hbase.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,880,998
int queue(String queueName); /** * Put a set of {@link Function} at the end of a queue. * * Example: * * <pre class="code"> * $("#foo").queue("myQueue", new Function(){ * public void f(Element e){ * $(e).css(CSS.BACKGROUNG_COLOR.with(RGBColor.RED)); * dequeue("myQueue"); * } * }) * .delay(500, "myQueue") * .queue("myQueue", lazy().css(CSS.COLOR.with(RGBColor.YELLOW)).dequeue("myQueue").done()); * </pre> * * When this statement is executed, the background color of the element is set to red, then wait * 500ms before to set the text color of the element to yellow. right for 400ms. * * Please note that {@link #dequeue()} function is needed at the end of your function to start the * next function in the queue. In lazy() methods you should call dequeue() just before the done() * call. {@see #dequeue()}
int queue(String queueName); /** * Put a set of {@link Function} at the end of a queue. * * Example: * * <pre class="code"> * $("#foo").queue(STR, new Function(){ * void f(Element e){ * $(e).css(CSS.BACKGROUNG_COLOR.with(RGBColor.RED)); * dequeue(STR); * } * }) * .delay(500, STR) * .queue(STR, lazy().css(CSS.COLOR.with(RGBColor.YELLOW)).dequeue(STR).done()); * </pre> * * When this statement is executed, the background color of the element is set to red, then wait * 500ms before to set the text color of the element to yellow. right for 400ms. * * Please note that {@link #dequeue()} function is needed at the end of your function to start the * next function in the function. In lazy() methods you should call dequeue() just before the done() * call. {@see #dequeue()}
/** * Show the number of functions in the queued named as queueName to be executed on the first * matched element. */
Show the number of functions in the queued named as queueName to be executed on the first matched element
queue
{ "repo_name": "lucasam/gwtquery", "path": "gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java", "license": "mit", "size": 90576 }
[ "com.google.gwt.dom.client.Element" ]
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.*;
[ "com.google.gwt" ]
com.google.gwt;
1,459,766
@Nonnull public DeviceConfigurationUserStatusRequestBuilder userStatuses(@Nonnull final String id) { return new DeviceConfigurationUserStatusRequestBuilder(getRequestUrlWithAdditionalSegment("userStatuses") + "/" + id, getClient(), null); }
DeviceConfigurationUserStatusRequestBuilder function(@Nonnull final String id) { return new DeviceConfigurationUserStatusRequestBuilder(getRequestUrlWithAdditionalSegment(STR) + "/" + id, getClient(), null); }
/** * Gets a request builder for the DeviceConfigurationUserStatus item * * @return the request builder * @param id the item identifier */
Gets a request builder for the DeviceConfigurationUserStatus item
userStatuses
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/MacOSDeviceFeaturesConfigurationRequestBuilder.java", "license": "mit", "size": 8016 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,626,902
public SqlConnector getSqlConnector(){ return conn; }
SqlConnector function(){ return conn; }
/** * De connectie met de database. * @return conn */
De connectie met de database
getSqlConnector
{ "repo_name": "redrock9/PAD", "path": "photo-slider/src/main/java/nl/amsta09/web/util/RequestWrapper.java", "license": "gpl-2.0", "size": 4289 }
[ "nl.amsta09.data.SqlConnector" ]
import nl.amsta09.data.SqlConnector;
import nl.amsta09.data.*;
[ "nl.amsta09.data" ]
nl.amsta09.data;
1,206,585
void registerMethodSubstitution(Class<?> substituteDeclaringClass, String name, String substituteName, Type... argumentTypes);
void registerMethodSubstitution(Class<?> substituteDeclaringClass, String name, String substituteName, Type... argumentTypes);
/** * Registers a substitution method. * * @param substituteDeclaringClass the class declaring the substitute method * @param name the name of both the original method * @param substituteName the name of the substitute method * @param argumentTypes the argument types of the method. Element 0 of this array must be * {@link #getReceiverType()} iff the method is non-static. Upon returning, element 0 * will have been rewritten to {@code declaringClass}. */
Registers a substitution method
registerMethodSubstitution
{ "repo_name": "zapster/graal-core", "path": "graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/MethodSubstitutionRegistry.java", "license": "gpl-2.0", "size": 2733 }
[ "java.lang.reflect.Type" ]
import java.lang.reflect.Type;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,069,386
public List<SimpleObject> getDiagnosisAutocomplete(@RequestParam(value = "query", required = false) String query, @RequestParam(value = "conceptDiagnosisClass", required = false) String requireConceptClass, @SpringBean("conceptService") ConceptService service, UiUtils ui) { List<ConceptClass> requireClasses = new ArrayList<ConceptClass>(); if ((requireConceptClass == null) || (requireConceptClass.equals(""))) { requireClasses = null; } else { for (ConceptClass cl : service.getAllConceptClasses()) { if (requireConceptClass.equals(cl.getName())) { requireClasses.add(cl); // System.out.println("Concept Class Name Found: " + cl.getName()); break; } } } // the following will return at most 100 matches List<ConceptSearchResult> results = Context.getConceptService() .getConcepts(query, null, false, requireClasses, null, null, null, null, 0, 100); List<Concept> names = new ArrayList<Concept>(); for (ConceptSearchResult con : results) { names.add(con.getConcept()); // con.getConcept().getName().getName() // System.out.println("Concept: " + con.getConceptName()); } String[] properties = new String[] { "name" }; return SimpleObject.fromCollection(names, ui, properties); }
List<SimpleObject> function(@RequestParam(value = "query", required = false) String query, @RequestParam(value = STR, required = false) String requireConceptClass, @SpringBean(STR) ConceptService service, UiUtils ui) { List<ConceptClass> requireClasses = new ArrayList<ConceptClass>(); if ((requireConceptClass == null) (requireConceptClass.equals(STRname" }; return SimpleObject.fromCollection(names, ui, properties); }
/** * Auto complete feature for the diagnosis * * @param query to get diagnosis concepts * @param requireConceptClass diagnosis concept class * @param service ConceptService * @param ui UiUtils * @return 100 matches diagnosis concepts */
Auto complete feature for the diagnosis
getDiagnosisAutocomplete
{ "repo_name": "WangchukSFSU/Radiology", "path": "omod/src/main/java/org/openmrs/module/radiology/fragment/controller/CreateViewRadiologyOrderFragmentController.java", "license": "mpl-2.0", "size": 20460 }
[ "java.util.ArrayList", "java.util.List", "org.openmrs.ConceptClass", "org.openmrs.api.ConceptService", "org.openmrs.ui.framework.SimpleObject", "org.openmrs.ui.framework.UiUtils", "org.openmrs.ui.framework.annotation.SpringBean", "org.springframework.web.bind.annotation.RequestParam" ]
import java.util.ArrayList; import java.util.List; import org.openmrs.ConceptClass; import org.openmrs.api.ConceptService; import org.openmrs.ui.framework.SimpleObject; import org.openmrs.ui.framework.UiUtils; import org.openmrs.ui.framework.annotation.SpringBean; import org.springframework.web.bind.annotation.RequestParam;
import java.util.*; import org.openmrs.*; import org.openmrs.api.*; import org.openmrs.ui.framework.*; import org.openmrs.ui.framework.annotation.*; import org.springframework.web.bind.annotation.*;
[ "java.util", "org.openmrs", "org.openmrs.api", "org.openmrs.ui", "org.springframework.web" ]
java.util; org.openmrs; org.openmrs.api; org.openmrs.ui; org.springframework.web;
992,097
public CloseableResource<T> transfer() { checkState(closer != null, "%s has transferred ownership", CloseableResource.class.getName()); checkState(!isClosed, "% is closed", CloseableResource.class.getName()); CloseableResource<T> other = CloseableResource.of(resource, closer); this.closer = null; return other; }
CloseableResource<T> function() { checkState(closer != null, STR, CloseableResource.class.getName()); checkState(!isClosed, STR, CloseableResource.class.getName()); CloseableResource<T> other = CloseableResource.of(resource, closer); this.closer = null; return other; }
/** * Returns a new {@link CloseableResource} that owns the underlying resource and relinquishes * ownership from this {@link CloseableResource}. {@link #close()} on the original instance * becomes a no-op. */
Returns a new <code>CloseableResource</code> that owns the underlying resource and relinquishes ownership from this <code>CloseableResource</code>. <code>#close()</code> on the original instance becomes a no-op
transfer
{ "repo_name": "tgroh/incubator-beam", "path": "runners/reference/java/src/main/java/org/apache/beam/runners/reference/CloseableResource.java", "license": "apache-2.0", "size": 4395 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,570,398
List<String> getOptions();
List<String> getOptions();
/** * Returns the available options from which the user can pick one. * * @return a list with Strings that identifies the options */
Returns the available options from which the user can pick one
getOptions
{ "repo_name": "ckaestne/LEADT", "path": "workspace/argouml_critics/argouml-app/src/org/argouml/uml/reveng/SettingsTypes.java", "license": "gpl-3.0", "size": 7376 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
389,491
public final native Event getOriginalEvent() ;
final native Event function() ;
/** * Return the original event (the one created by the browser). */
Return the original event (the one created by the browser)
getOriginalEvent
{ "repo_name": "lucasam/gwtquery", "path": "gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/GqEvent.java", "license": "mit", "size": 3328 }
[ "com.google.gwt.user.client.Event" ]
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.*;
[ "com.google.gwt" ]
com.google.gwt;
589,267
private static void renameOrElse(File from, File to) throws IOException { if (!from.renameTo(to)) throw new IOException("Error renaming '" + from + "' to '" + to + "'"); }
static void function(File from, File to) throws IOException { if (!from.renameTo(to)) throw new IOException(STR + from + STR + to + "'"); }
/** * Utility function to perform a rename, and throw an exception if the it * fails. * @throws IOException */
Utility function to perform a rename, and throw an exception if the it fails
renameOrElse
{ "repo_name": "CDLUC3/dash-xtf", "path": "xtf/WEB-INF/src/org/cdlib/xtf/textIndexer/TextIndexer.java", "license": "mit", "size": 26292 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,332,719
RefTable refTable() { return myRefTable; }
RefTable refTable() { return myRefTable; }
/** * Get the ref table. * * @return the object ref table that resolves object reference strings for * messages sent to this server. */
Get the ref table
refTable
{ "repo_name": "frandallfarmer/Elko", "path": "ServerCore/java/org/elkoserver/server/repository/Repository.java", "license": "mit", "size": 3995 }
[ "org.elkoserver.foundation.actor.RefTable" ]
import org.elkoserver.foundation.actor.RefTable;
import org.elkoserver.foundation.actor.*;
[ "org.elkoserver.foundation" ]
org.elkoserver.foundation;
1,767,976
@Test public void testGetEnd() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 8, 1, 59, 59); cal.set(Calendar.MILLISECOND, 999); Hour h = new Hour(1, 8, 1, 2006); assertEquals(cal.getTime(), h.getEnd()); Locale.setDefault(saved); }
void function() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 8, 1, 59, 59); cal.set(Calendar.MILLISECOND, 999); Hour h = new Hour(1, 8, 1, 2006); assertEquals(cal.getTime(), h.getEnd()); Locale.setDefault(saved); }
/** * Some checks for the getEnd() method. */
Some checks for the getEnd() method
testGetEnd
{ "repo_name": "aaronc/jfreechart", "path": "tests/org/jfree/data/time/HourTest.java", "license": "lgpl-2.1", "size": 11869 }
[ "java.util.Calendar", "java.util.Locale", "org.junit.Assert" ]
import java.util.Calendar; import java.util.Locale; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
2,640,029
public Object query(String query, String ql, Map<String, Object> context) throws Exception { IQueryEngine q = hawk.getModelIndexer().getKnownQueryLanguages().get(ql); if (q == null) { throw new NoSuchElementException(); } return q.query(hawk.getModelIndexer(), query, context); }
Object function(String query, String ql, Map<String, Object> context) throws Exception { IQueryEngine q = hawk.getModelIndexer().getKnownQueryLanguages().get(ql); if (q == null) { throw new NoSuchElementException(); } return q.query(hawk.getModelIndexer(), query, context); }
/** * Performs a query and returns its result. For the result types, see * {@link #contextFullQuery(File, String, Map)}. * * @throws NoSuchElementException * Unknown query language. */
Performs a query and returns its result. For the result types, see <code>#contextFullQuery(File, String, Map)</code>
query
{ "repo_name": "Orjuwan-alwadeai/mondo-hawk", "path": "plugins/org.hawk.osgiserver/src/org/hawk/osgiserver/HModel.java", "license": "epl-1.0", "size": 21603 }
[ "java.util.Map", "java.util.NoSuchElementException", "org.hawk.core.query.IQueryEngine" ]
import java.util.Map; import java.util.NoSuchElementException; import org.hawk.core.query.IQueryEngine;
import java.util.*; import org.hawk.core.query.*;
[ "java.util", "org.hawk.core" ]
java.util; org.hawk.core;
89,636
@VisibleForTesting public static boolean hasPrerenderedUrl(Profile profile, String url, WebContents webContents) { return nativeHasPrerenderedUrl(profile, url, webContents); }
static boolean function(Profile profile, String url, WebContents webContents) { return nativeHasPrerenderedUrl(profile, url, webContents); }
/** * Check whether a given url has been prerendering for the given profile and session id for the * given web contents. * @param profile The profile to check for prerendering. * @param url The url to check for prerender. * @param webContents The {@link WebContents} for which to compare the session info. * @return Whether the given url was prerendered. */
Check whether a given url has been prerendering for the given profile and session id for the given web contents
hasPrerenderedUrl
{ "repo_name": "highweb-project/highweb-webcl-html5spec", "path": "chrome/android/java/src/org/chromium/chrome/browser/prerender/ExternalPrerenderHandler.java", "license": "bsd-3-clause", "size": 5005 }
[ "org.chromium.chrome.browser.profiles.Profile", "org.chromium.content_public.browser.WebContents" ]
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.content_public.browser.WebContents;
import org.chromium.chrome.browser.profiles.*; import org.chromium.content_public.browser.*;
[ "org.chromium.chrome", "org.chromium.content_public" ]
org.chromium.chrome; org.chromium.content_public;
590,716
final WeakReference<LoadUserCallback> loadUserCallback = new WeakReference<>(callback);
final WeakReference<LoadUserCallback> loadUserCallback = new WeakReference<>(callback);
/** * Get the user from the data source, cache it and notify via the callback that the user has * been retrieved. * * @param callback callback that gets called when the user was retrieved from the data source. */
Get the user from the data source, cache it and notify via the callback that the user has been retrieved
getUser
{ "repo_name": "android/architecture-components-samples", "path": "PersistenceMigrationsSample/app/src/sqlite/java/com/example/android/persistence/migrations/UserRepository.java", "license": "apache-2.0", "size": 3700 }
[ "java.lang.ref.WeakReference" ]
import java.lang.ref.WeakReference;
import java.lang.ref.*;
[ "java.lang" ]
java.lang;
68,308
final BookmarkModel bookmarkModel = TestThreadUtils.runOnUiThreadBlockingNoException(BookmarkModel::new); CriteriaHelper.pollUiThread(bookmarkModel::isBookmarkModelLoaded); TestThreadUtils.runOnUiThreadBlocking(bookmarkModel::destroy); }
final BookmarkModel bookmarkModel = TestThreadUtils.runOnUiThreadBlockingNoException(BookmarkModel::new); CriteriaHelper.pollUiThread(bookmarkModel::isBookmarkModelLoaded); TestThreadUtils.runOnUiThreadBlocking(bookmarkModel::destroy); }
/** * Waits until the bookmark model is loaded, i.e. until * {@link BookmarkModel#isBookmarkModelLoaded()} is true. */
Waits until the bookmark model is loaded, i.e. until <code>BookmarkModel#isBookmarkModelLoaded()</code> is true
waitForBookmarkModelLoaded
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/chrome/test/android/javatests/src/org/chromium/chrome/test/util/BookmarkTestUtil.java", "license": "bsd-3-clause", "size": 965 }
[ "org.chromium.base.test.util.CriteriaHelper", "org.chromium.chrome.browser.bookmarks.BookmarkModel", "org.chromium.content_public.browser.test.util.TestThreadUtils" ]
import org.chromium.base.test.util.CriteriaHelper; import org.chromium.chrome.browser.bookmarks.BookmarkModel; import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.base.test.util.*; import org.chromium.chrome.browser.bookmarks.*; import org.chromium.content_public.browser.test.util.*;
[ "org.chromium.base", "org.chromium.chrome", "org.chromium.content_public" ]
org.chromium.base; org.chromium.chrome; org.chromium.content_public;
1,610,446
@SuppressWarnings("unchecked") public static <T extends Event, E extends EventPipeline<T>> EventType<T, E> getByEvent(final Class<T> clazz) { return (EventType<T, E>) byEventClass.get(clazz); } /** * Gets event type by given event instance. <br> * It just pass class of given object to {@link #getByEvent(Class)}
@SuppressWarnings(STR) static <T extends Event, E extends EventPipeline<T>> EventType<T, E> function(final Class<T> clazz) { return (EventType<T, E>) byEventClass.get(clazz); } /** * Gets event type by given event instance. <br> * It just pass class of given object to {@link #getByEvent(Class)}
/** * Gets event type by given event class. <br> * * @param clazz event class to find event type for it. * @param <T> type of event. * @param <E> type of pipeline for this event. * * @return event type for that event or null. */
Gets event type by given event class.
getByEvent
{ "repo_name": "sgdc3/Diorite", "path": "DioriteAPI/src/main/java/org/diorite/event/EventType.java", "license": "mit", "size": 6084 }
[ "org.diorite.event.pipelines.EventPipeline" ]
import org.diorite.event.pipelines.EventPipeline;
import org.diorite.event.pipelines.*;
[ "org.diorite.event" ]
org.diorite.event;
594,312
public static InputStream getUrlAsStream(String urlString) throws IOException { URL url = new URL(urlString); URLConnection conn = url.openConnection(); return conn.getInputStream(); }
static InputStream function(String urlString) throws IOException { URL url = new URL(urlString); URLConnection conn = url.openConnection(); return conn.getInputStream(); }
/** * Gets a URL as an input stream * * @param urlString * - the URL to get * @return An input stream with the data from the URL * @throws java.io.IOException * If the resource cannot be found or read */
Gets a URL as an input stream
getUrlAsStream
{ "repo_name": "f1194361820/helper", "path": "commons/src/main/java/com/fjn/helper/common/io/file/common/Resources.java", "license": "gpl-2.0", "size": 9743 }
[ "java.io.IOException", "java.io.InputStream", "java.net.URLConnection" ]
import java.io.IOException; import java.io.InputStream; import java.net.URLConnection;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
1,778,376
void registerForNumberInfo(Handler h, int what, Object obj);
void registerForNumberInfo(Handler h, int what, Object obj);
/** * Register for CDMA number information record notification from the network. * Message.obj will contain an AsyncResult. * AsyncResult.result will be a CdmaInformationRecords.CdmaNumberInfoRec * instance. * * @param h Handler that receives the notification message. * @param what User-defined message code. * @param obj User object. */
Register for CDMA number information record notification from the network. Message.obj will contain an AsyncResult. AsyncResult.result will be a CdmaInformationRecords.CdmaNumberInfoRec instance
registerForNumberInfo
{ "repo_name": "rex-xxx/mt6572_x201", "path": "frameworks/opt/telephony/src/java/com/android/internal/telephony/Phone.java", "license": "gpl-2.0", "size": 87022 }
[ "android.os.Handler" ]
import android.os.Handler;
import android.os.*;
[ "android.os" ]
android.os;
1,805,970
public synchronized void addTabCloseListener(TabClosedListener listener) { if (closeListeners == null) { closeListeners = new ArrayList<TabClosedListener>(3); } closeListeners.add(listener); }
synchronized void function(TabClosedListener listener) { if (closeListeners == null) { closeListeners = new ArrayList<TabClosedListener>(3); } closeListeners.add(listener); }
/** * Add a TabClosedListener to the listener list. * * @param listener The TabClosedListener to be added */
Add a TabClosedListener to the listener list
addTabCloseListener
{ "repo_name": "zenovalle/tn5250j", "path": "src/org/tn5250j/gui/ButtonTabComponent.java", "license": "gpl-2.0", "size": 9599 }
[ "java.util.ArrayList", "org.tn5250j.event.TabClosedListener" ]
import java.util.ArrayList; import org.tn5250j.event.TabClosedListener;
import java.util.*; import org.tn5250j.event.*;
[ "java.util", "org.tn5250j.event" ]
java.util; org.tn5250j.event;
854,199
public static List<Scope> asList(final String scope) { return Arrays.asList(scope.split(" ")).stream().map(Scope::forKey).collect(Collectors.toList()); }
static List<Scope> function(final String scope) { return Arrays.asList(scope.split(" ")).stream().map(Scope::forKey).collect(Collectors.toList()); }
/** * Utility method for converting a space-separated String of scopes to a List of Scopes * * @param scope the space-separated string of scopes to convert * @return the list of scopes */
Utility method for converting a space-separated String of scopes to a List of Scopes
asList
{ "repo_name": "shaneagibson/hmrc4j", "path": "hmrc4j/src/main/java/uk/co/epsilontechnologies/hmrc4j/core/oauth20/Scope.java", "license": "apache-2.0", "size": 2260 }
[ "java.util.Arrays", "java.util.List", "java.util.stream.Collectors" ]
import java.util.Arrays; import java.util.List; import java.util.stream.Collectors;
import java.util.*; import java.util.stream.*;
[ "java.util" ]
java.util;
1,328,471
public void testDerby4310CallableStatement() throws SQLException, XAException { XADataSource xads = J2EEDataSource.getXADataSource(); J2EEDataSource.setBeanProperty(xads, "databaseName", "wombat"); XAConnection xaconn = xads.getXAConnection(); XAResource xar = xaconn.getXAResource(); Xid xid = XATestUtil.getXid(1,93,18); Connection conn = xaconn.getConnection(); Statement s = conn.createStatement(); s.executeUpdate("CREATE PROCEDURE ZA() LANGUAGE JAVA "+ "EXTERNAL NAME 'org.apache.derbyTesting.functionTests.tests.jdbcapi.XATest.zeroArg' "+ "PARAMETER STYLE JAVA"); conn.commit(); CallableStatement cs = conn.prepareCall("CALL ZA()"); cs.execute(); xar.start(xid, XAResource.TMNOFLAGS); xar.end(xid, XAResource.TMSUCCESS); Connection conn2 = getConnection(); Statement s2 = conn2.createStatement(); s2.execute("DROP PROCEDURE ZA"); conn2.commit(); conn2.close(); try { cs.close(); } finally { xar.rollback(xid); conn.close(); xaconn.close(); } }
void function() throws SQLException, XAException { XADataSource xads = J2EEDataSource.getXADataSource(); J2EEDataSource.setBeanProperty(xads, STR, STR); XAConnection xaconn = xads.getXAConnection(); XAResource xar = xaconn.getXAResource(); Xid xid = XATestUtil.getXid(1,93,18); Connection conn = xaconn.getConnection(); Statement s = conn.createStatement(); s.executeUpdate(STR+ STR+ STR); conn.commit(); CallableStatement cs = conn.prepareCall(STR); cs.execute(); xar.start(xid, XAResource.TMNOFLAGS); xar.end(xid, XAResource.TMSUCCESS); Connection conn2 = getConnection(); Statement s2 = conn2.createStatement(); s2.execute(STR); conn2.commit(); conn2.close(); try { cs.close(); } finally { xar.rollback(xid); conn.close(); xaconn.close(); } }
/** * This test checks the fix on DERBY-4310, for not repreparing CallableStatements * upon calling close() on them. */
This test checks the fix on DERBY-4310, for not repreparing CallableStatements upon calling close() on them
testDerby4310CallableStatement
{ "repo_name": "kavin256/Derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/XATest.java", "license": "apache-2.0", "size": 54819 }
[ "java.sql.CallableStatement", "java.sql.Connection", "java.sql.SQLException", "java.sql.Statement", "javax.sql.XAConnection", "javax.sql.XADataSource", "javax.transaction.xa.XAException", "javax.transaction.xa.XAResource", "javax.transaction.xa.Xid", "org.apache.derbyTesting.junit.J2EEDataSource", "org.apache.derbyTesting.junit.XATestUtil" ]
import java.sql.CallableStatement; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import javax.sql.XAConnection; import javax.sql.XADataSource; import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; import org.apache.derbyTesting.junit.J2EEDataSource; import org.apache.derbyTesting.junit.XATestUtil;
import java.sql.*; import javax.sql.*; import javax.transaction.xa.*; import org.apache.*;
[ "java.sql", "javax.sql", "javax.transaction", "org.apache" ]
java.sql; javax.sql; javax.transaction; org.apache;
790,428
public AffineTransform getGlyphTransform(int glyphIndex) { if (transforms == null) return null; else return transforms[glyphIndex]; }
AffineTransform function(int glyphIndex) { if (transforms == null) return null; else return transforms[glyphIndex]; }
/** * Returns the affine transformation that is applied to the * glyph at the specified index. * * @param glyphIndex the index of the glyph whose transformation * is to be retrieved. * * @return an affine transformation, or <code>null</code> * for the identity transformation. * * @throws IndexOutOfBoundsException if <code>glyphIndex</code> is * not in the range <code[0 .. getNumGlyphs() - 1]</code>. */
Returns the affine transformation that is applied to the glyph at the specified index
getGlyphTransform
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java", "license": "bsd-3-clause", "size": 17498 }
[ "java.awt.geom.AffineTransform" ]
import java.awt.geom.AffineTransform;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,949,034
@Override public synchronized long tryCheckpoint(long checkpointTargetLSN) throws HyracksDataException { LOGGER.info("Attemping soft checkpoint..."); final long minSecuredLSN = getMinSecuredLSN(); if (minSecuredLSN != NO_SECURED_LSN && checkpointTargetLSN >= minSecuredLSN) { return minSecuredLSN; } final long minFirstLSN = txnSubsystem.getRecoveryManager().getMinFirstLSN(); boolean checkpointSucceeded = minFirstLSN >= checkpointTargetLSN; if (!checkpointSucceeded) { // Flush datasets with indexes behind target checkpoint LSN final IDatasetLifecycleManager dlcm = txnSubsystem.getApplicationContext().getDatasetLifecycleManager(); dlcm.asyncFlushMatchingIndexes(newLaggingDatasetPredicate(checkpointTargetLSN)); } capture(minFirstLSN, false); if (checkpointSucceeded) { txnSubsystem.getLogManager().deleteOldLogFiles(minFirstLSN); LOGGER.info(String.format("soft checkpoint succeeded at LSN(%s)", minFirstLSN)); } return minFirstLSN; }
synchronized long function(long checkpointTargetLSN) throws HyracksDataException { LOGGER.info(STR); final long minSecuredLSN = getMinSecuredLSN(); if (minSecuredLSN != NO_SECURED_LSN && checkpointTargetLSN >= minSecuredLSN) { return minSecuredLSN; } final long minFirstLSN = txnSubsystem.getRecoveryManager().getMinFirstLSN(); boolean checkpointSucceeded = minFirstLSN >= checkpointTargetLSN; if (!checkpointSucceeded) { final IDatasetLifecycleManager dlcm = txnSubsystem.getApplicationContext().getDatasetLifecycleManager(); dlcm.asyncFlushMatchingIndexes(newLaggingDatasetPredicate(checkpointTargetLSN)); } capture(minFirstLSN, false); if (checkpointSucceeded) { txnSubsystem.getLogManager().deleteOldLogFiles(minFirstLSN); LOGGER.info(String.format(STR, minFirstLSN)); } return minFirstLSN; }
/*** * Attempts to perform a soft checkpoint at the specified {@code checkpointTargetLSN}. * If a checkpoint cannot be captured due to datasets having LSN < {@code checkpointTargetLSN}, * an asynchronous flush is triggered on them. When a checkpoint is successful, all transaction * log files that end with LSN < {@code checkpointTargetLSN} are deleted. */
Attempts to perform a soft checkpoint at the specified checkpointTargetLSN. If a checkpoint cannot be captured due to datasets having LSN < checkpointTargetLSN, an asynchronous flush is triggered on them. When a checkpoint is successful, all transaction log files that end with LSN < checkpointTargetLSN are deleted
tryCheckpoint
{ "repo_name": "ecarm002/incubator-asterixdb", "path": "asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/service/recovery/CheckpointManager.java", "license": "apache-2.0", "size": 5989 }
[ "org.apache.asterix.common.api.IDatasetLifecycleManager", "org.apache.hyracks.api.exceptions.HyracksDataException" ]
import org.apache.asterix.common.api.IDatasetLifecycleManager; import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.asterix.common.api.*; import org.apache.hyracks.api.exceptions.*;
[ "org.apache.asterix", "org.apache.hyracks" ]
org.apache.asterix; org.apache.hyracks;
2,171,944
List<CosmosPermissionProperties> getPermissions() { return permissions; }
List<CosmosPermissionProperties> getPermissions() { return permissions; }
/** * Gets the permission list, which contains the * resource tokens needed to access resources. * * @return the permission list */
Gets the permission list, which contains the resource tokens needed to access resources
getPermissions
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosClientBuilder.java", "license": "mit", "size": 34333 }
[ "com.azure.cosmos.models.CosmosPermissionProperties", "java.util.List" ]
import com.azure.cosmos.models.CosmosPermissionProperties; import java.util.List;
import com.azure.cosmos.models.*; import java.util.*;
[ "com.azure.cosmos", "java.util" ]
com.azure.cosmos; java.util;
567
public static File getJobDir(JobID jobid) { return getJobDir(jobid.toString()); }
static File function(JobID jobid) { return getJobDir(jobid.toString()); }
/** * Get the user log directory for the job jobid. * * @param jobid the jobid object * @return user log directory for the job */
Get the user log directory for the job jobid
getJobDir
{ "repo_name": "InMobi/hadoop", "path": "src/mapred/org/apache/hadoop/mapred/TaskLog.java", "license": "apache-2.0", "size": 24091 }
[ "java.io.File", "org.apache.hadoop.mapreduce.JobID" ]
import java.io.File; import org.apache.hadoop.mapreduce.JobID;
import java.io.*; import org.apache.hadoop.mapreduce.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
260,101
@Test public void testGetModeParamValidRequestParam() { // Arrange when(request.getParameter(eq(AuraContextFilter.mode.name))).thenReturn(Mode.JSTEST.name()); // Act final Mode mode = AuraContextFilter.getModeParam(request, null, null); // Assert assertThat("Expected the correct mode from the request", mode, equalTo(Mode.JSTEST)); }
void function() { when(request.getParameter(eq(AuraContextFilter.mode.name))).thenReturn(Mode.JSTEST.name()); final Mode mode = AuraContextFilter.getModeParam(request, null, null); assertThat(STR, mode, equalTo(Mode.JSTEST)); }
/** * Test for the * {@link AuraContextFilter#getModeParam(HttpServletRequest, java.util.Map, java.util.Collection)} method * when a valid mode parameter is in the request and the {@code allowedModes} is {@code null}. */
Test for the <code>AuraContextFilter#getModeParam(HttpServletRequest, java.util.Map, java.util.Collection)</code> method when a valid mode parameter is in the request and the allowedModes is null
testGetModeParamValidRequestParam
{ "repo_name": "forcedotcom/aura", "path": "aura/src/test/java/org/auraframework/http/AuraContextFilterTest.java", "license": "apache-2.0", "size": 20634 }
[ "org.auraframework.system.AuraContext", "org.hamcrest.Matchers", "org.junit.Assert", "org.mockito.Mockito" ]
import org.auraframework.system.AuraContext; import org.hamcrest.Matchers; import org.junit.Assert; import org.mockito.Mockito;
import org.auraframework.system.*; import org.hamcrest.*; import org.junit.*; import org.mockito.*;
[ "org.auraframework.system", "org.hamcrest", "org.junit", "org.mockito" ]
org.auraframework.system; org.hamcrest; org.junit; org.mockito;
1,935,555
public int print(Graphics _g, PageFormat pageFormat, int pageIndex){ // // On the first page, take a snapshot of the vector of // TranscodeInputs. // if(printedInputs == null){ printedInputs = new ArrayList( inputs ); } // // If we have already printed each page, return // if(pageIndex >= printedInputs.size()){ curIndex = -1; if (theCtx != null) theCtx.dispose(); userAgent.displayMessage("Done"); return NO_SUCH_PAGE; } // // Load a new document now if we are printing a new page // if(curIndex != pageIndex){ if (theCtx != null) theCtx.dispose(); // The following call will invoke this class' transcode // method which takes a document as an input. That method // builds the GVT root tree.{ try{ width = (int)pageFormat.getImageableWidth(); height = (int)pageFormat.getImageableHeight(); super.transcode ((TranscoderInput)printedInputs.get(pageIndex),null); curIndex = pageIndex; }catch(TranscoderException e){ drawError(_g, e); return PAGE_EXISTS; } } // Cast to Graphics2D to access Java 2D features Graphics2D g = (Graphics2D)_g; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.setRenderingHint(RenderingHintsKeyExt.KEY_TRANSCODING, RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING); // // Compute transform so that the SVG document fits on one page // AffineTransform t = g.getTransform(); Shape clip = g.getClip(); // System.err.println("X/Y: " + pageFormat.getImageableX() + ", " + // pageFormat.getImageableY()); // System.err.println("W/H: " + width + ", " + height); // System.err.println("Clip: " + clip.getBounds2D()); // Offset 0,0 to the start of the imageable Area. g.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); // // Append transform to selected area // g.transform(curTxf); // // Delegate rendering to painter // try{ root.paint(g); }catch(Exception e){ g.setTransform(t); g.setClip(clip); drawError(_g, e); } // // Restore transform and clip // g.setTransform(t); g.setClip(clip); // g.setPaint(Color.black); // g.drawString(uris[pageIndex], 30, 30); // // Return status indicated that we did paint a page // return PAGE_EXISTS; }
int function(Graphics _g, PageFormat pageFormat, int pageIndex){ printedInputs = new ArrayList( inputs ); } curIndex = -1; if (theCtx != null) theCtx.dispose(); userAgent.displayMessage("Done"); return NO_SUCH_PAGE; } if (theCtx != null) theCtx.dispose(); try{ width = (int)pageFormat.getImageableWidth(); height = (int)pageFormat.getImageableHeight(); super.transcode ((TranscoderInput)printedInputs.get(pageIndex),null); curIndex = pageIndex; }catch(TranscoderException e){ drawError(_g, e); return PAGE_EXISTS; } } Graphics2D g = (Graphics2D)_g; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g.setRenderingHint(RenderingHintsKeyExt.KEY_TRANSCODING, RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING); Shape clip = g.getClip(); g.translate(pageFormat.getImageableX(), pageFormat.getImageableY()); root.paint(g); }catch(Exception e){ g.setTransform(t); g.setClip(clip); drawError(_g, e); } g.setClip(clip); }
/** * Printable implementation */
Printable implementation
print
{ "repo_name": "Squeegee/batik", "path": "sources/org/apache/batik/transcoder/print/PrintTranscoder.java", "license": "apache-2.0", "size": 30014 }
[ "java.awt.Graphics", "java.awt.Graphics2D", "java.awt.RenderingHints", "java.awt.Shape", "java.awt.print.PageFormat", "java.util.ArrayList", "org.apache.batik.ext.awt.RenderingHintsKeyExt", "org.apache.batik.transcoder.TranscoderException", "org.apache.batik.transcoder.TranscoderInput" ]
import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.Shape; import java.awt.print.PageFormat; import java.util.ArrayList; import org.apache.batik.ext.awt.RenderingHintsKeyExt; import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderInput;
import java.awt.*; import java.awt.print.*; import java.util.*; import org.apache.batik.ext.awt.*; import org.apache.batik.transcoder.*;
[ "java.awt", "java.util", "org.apache.batik" ]
java.awt; java.util; org.apache.batik;
1,663,874
public static List<User> parseCSV(final File studIpCSVFile) throws IOException { if (studIpCSVFile == null) { throw new IOException( "The parameter studIpCSVFile must be a valid CSV File"); } final CSVReader reader = new CSVReader(new InputStreamReader( new FileInputStream(studIpCSVFile.getPath()), LATIN_ONE_ENCODING), SEPARATOR, QUOTE_CHAR, SKIPPED_LINES); final List<String[]> rows = reader.readAll(); final List<User> users = new ArrayList<>(rows.size()); for (String[] row: rows) { if (row == null || row.length != NUM_COLS) { log.error("Skipping row, the row is either null " + "or its length is not as expected"); continue; } final String firstName = row[COL_FIRST_NAME]; final String lastName = row[COL_LAST_NAME]; final String email = row[COL_EMAIL]; if (!validName(firstName) || !validName(lastName) || !validEmail(email)) { log.error(String.format("The skippimg row," + "the first name %s, last name %s or email %s is not valid", firstName, lastName, email)); continue; } final User user = new User(); user.setEmail(email); user.setFirstName(firstName); user.setLastName(lastName); users.add(user); } return users; }
static List<User> function(final File studIpCSVFile) throws IOException { if (studIpCSVFile == null) { throw new IOException( STR); } final CSVReader reader = new CSVReader(new InputStreamReader( new FileInputStream(studIpCSVFile.getPath()), LATIN_ONE_ENCODING), SEPARATOR, QUOTE_CHAR, SKIPPED_LINES); final List<String[]> rows = reader.readAll(); final List<User> users = new ArrayList<>(rows.size()); for (String[] row: rows) { if (row == null row.length != NUM_COLS) { log.error(STR + STR); continue; } final String firstName = row[COL_FIRST_NAME]; final String lastName = row[COL_LAST_NAME]; final String email = row[COL_EMAIL]; if (!validName(firstName) !validName(lastName) !validEmail(email)) { log.error(String.format(STR + STR, firstName, lastName, email)); continue; } final User user = new User(); user.setEmail(email); user.setFirstName(firstName); user.setLastName(lastName); users.add(user); } return users; }
/** * Parses a Stud IP course export csv file and returns a list of Users with * the first name, last name and emails for each row of the file. * @param studIpCSVFile The stud ip CSV File. It shouldnt be altered after * downloading from stud ip. * @return A List of users with the first name, last name and email fields * of the CSV File. All users are not registered in the database nor * have any other fields, nor interact as objects in any way with * the system. * @throws IOException If the file can't be opened, * the file doesn't havethe same structure as a normal stud ip * course export file, or the names or emails are not valid. * @throws IOException If the Parameter @studIpCSVFile is null, * or if parsing goes wrong */
Parses a Stud IP course export csv file and returns a list of Users with the first name, last name and emails for each row of the file
parseCSV
{ "repo_name": "stefanoberdoerfer/exmatrikulator", "path": "src/main/java/de/unibremen/opensores/util/csv/StudIpParser.java", "license": "agpl-3.0", "size": 6894 }
[ "com.opencsv.CSVReader", "de.unibremen.opensores.model.User", "java.io.File", "java.io.FileInputStream", "java.io.IOException", "java.io.InputStreamReader", "java.util.ArrayList", "java.util.List" ]
import com.opencsv.CSVReader; import de.unibremen.opensores.model.User; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List;
import com.opencsv.*; import de.unibremen.opensores.model.*; import java.io.*; import java.util.*;
[ "com.opencsv", "de.unibremen.opensores", "java.io", "java.util" ]
com.opencsv; de.unibremen.opensores; java.io; java.util;
2,012,448
public void testRemoveElement() { ArrayDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i += 2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i - 1)); } for (int i = 0; i < SIZE; i += 2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i + 1)); assertFalse(q.contains(i + 1)); } assertTrue(q.isEmpty()); }
void function() { ArrayDeque q = populatedDeque(SIZE); for (int i = 1; i < SIZE; i += 2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertTrue(q.contains(i - 1)); } for (int i = 0; i < SIZE; i += 2) { assertTrue(q.contains(i)); assertTrue(q.remove(i)); assertFalse(q.contains(i)); assertFalse(q.remove(i + 1)); assertFalse(q.contains(i + 1)); } assertTrue(q.isEmpty()); }
/** * remove(x) removes x and returns true if present */
remove(x) removes x and returns true if present
testRemoveElement
{ "repo_name": "md-5/jdk10", "path": "test/jdk/java/util/concurrent/tck/ArrayDequeTest.java", "license": "gpl-2.0", "size": 29764 }
[ "java.util.ArrayDeque" ]
import java.util.ArrayDeque;
import java.util.*;
[ "java.util" ]
java.util;
660,487
@Override protected void step_updateInvoiceCandidates(List<I_C_Invoice_Candidate> invoiceCandidates, List<I_M_InOutLine> inOutLines) { final I_C_Invoice_Candidate ic = ListUtils.singleElement(invoiceCandidates); ic.setQualityDiscountPercent_Override(config_getQualityDiscount_Override()); InterfaceWrapperHelper.save(ic); }
void function(List<I_C_Invoice_Candidate> invoiceCandidates, List<I_M_InOutLine> inOutLines) { final I_C_Invoice_Candidate ic = ListUtils.singleElement(invoiceCandidates); ic.setQualityDiscountPercent_Override(config_getQualityDiscount_Override()); InterfaceWrapperHelper.save(ic); }
/** * Need to set the QualityDiscountPercent_Override value again, because it was unset by the first run of the IC-update. */
Need to set the QualityDiscountPercent_Override value again, because it was unset by the first run of the IC-update
step_updateInvoiceCandidates
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.swat/de.metas.swat.base/src/test/java/de/metas/invoicecandidate/api/impl/aggregationEngine/TestQualityDiscountPercentOverrideToZero.java", "license": "gpl-2.0", "size": 4351 }
[ "java.util.List", "org.adempiere.model.InterfaceWrapperHelper", "org.adempiere.util.collections.ListUtils" ]
import java.util.List; import org.adempiere.model.InterfaceWrapperHelper; import org.adempiere.util.collections.ListUtils;
import java.util.*; import org.adempiere.model.*; import org.adempiere.util.collections.*;
[ "java.util", "org.adempiere.model", "org.adempiere.util" ]
java.util; org.adempiere.model; org.adempiere.util;
2,171,304
public void setAnimationStateListener(Element element, AnimationStateListener listener) { ((Jso)element).addField(ATTR_STATE_LISTENER, listener); }
void function(Element element, AnimationStateListener listener) { ((Jso)element).addField(ATTR_STATE_LISTENER, listener); }
/** * Sets the listener for animation state change events. * <p/> * <p/> * If an element is not visible in the UI when an animation is applied, the animation will never * complete and the element will stay in the state HIDING until some other animation is applied. */
Sets the listener for animation state change events. If an element is not visible in the UI when an animation is applied, the animation will never complete and the element will stay in the state HIDING until some other animation is applied
setAnimationStateListener
{ "repo_name": "cemalkilic/che", "path": "ide/commons-gwt/src/main/java/org/eclipse/che/ide/util/AnimationController.java", "license": "epl-1.0", "size": 20589 }
[ "org.eclipse.che.ide.collections.Jso" ]
import org.eclipse.che.ide.collections.Jso;
import org.eclipse.che.ide.collections.*;
[ "org.eclipse.che" ]
org.eclipse.che;
479,809
public static <K, VV, EV, Message> VertexCentricIteration<K, VV, EV, Message> withEdges( DataSet<Edge<K, EV>> edgesWithValue, ComputeFunction<K, VV, EV, Message> cf, MessageCombiner<K, Message> mc, int maximumNumberOfIterations) { return new VertexCentricIteration<>(cf, edgesWithValue, mc, maximumNumberOfIterations); }
static <K, VV, EV, Message> VertexCentricIteration<K, VV, EV, Message> function( DataSet<Edge<K, EV>> edgesWithValue, ComputeFunction<K, VV, EV, Message> cf, MessageCombiner<K, Message> mc, int maximumNumberOfIterations) { return new VertexCentricIteration<>(cf, edgesWithValue, mc, maximumNumberOfIterations); }
/** * Creates a new vertex-centric iteration operator for graphs where the edges are associated with a value (such as * a weight or distance). * * @param edgesWithValue The data set containing edges. * @param cf The compute function. * @param mc The function that combines messages sent to a vertex during a superstep. * * @param <K> The type of the vertex key (the vertex identifier). * @param <VV> The type of the vertex value (the state of the vertex). * @param <Message> The type of the message sent between vertices along the edges. * @param <EV> The type of the values that are associated with the edges. * * @return An instance of the vertex-centric graph computation operator. */
Creates a new vertex-centric iteration operator for graphs where the edges are associated with a value (such as a weight or distance)
withEdges
{ "repo_name": "hequn8128/flink", "path": "flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java", "license": "apache-2.0", "size": 20362 }
[ "org.apache.flink.api.java.DataSet", "org.apache.flink.graph.Edge" ]
import org.apache.flink.api.java.DataSet; import org.apache.flink.graph.Edge;
import org.apache.flink.api.java.*; import org.apache.flink.graph.*;
[ "org.apache.flink" ]
org.apache.flink;
2,138,044
@Test public void RSSamlIDPInitiatedConfigTests_audiences_missing() throws Exception { RSSamlConfigSettings updatedRsSamlSettings = rsConfigSettings.copyConfigSettings(); RSSamlProviderSettings updatedProviderSettings = updatedRsSamlSettings.getDefaultRSSamlProviderSettings(); updatedProviderSettings.setAudiences(null); List<validationData> expectations = commonUtils.getGoodExpectationsForJaxrsGet(flowType, testSettings); generalConfigTest(updatedRsSamlSettings, expectations, testSettings); }
void function() throws Exception { RSSamlConfigSettings updatedRsSamlSettings = rsConfigSettings.copyConfigSettings(); RSSamlProviderSettings updatedProviderSettings = updatedRsSamlSettings.getDefaultRSSamlProviderSettings(); updatedProviderSettings.setAudiences(null); List<validationData> expectations = commonUtils.getGoodExpectationsForJaxrsGet(flowType, testSettings); generalConfigTest(updatedRsSamlSettings, expectations, testSettings); }
/** * Test purpose: - audiences: Not specified (default value: ANY) Expected * results: - The SAML token should be successfully processed by JAX-RS. * * @throws Exception */
Test purpose: - audiences: Not specified (default value: ANY) Expected results: - The SAML token should be successfully processed by JAX-RS
RSSamlIDPInitiatedConfigTests_audiences_missing
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.security.saml.sso_fat.jaxrs.config/fat/src/com/ibm/ws/security/saml/fat/jaxrs/config/IDPInitiated/RSSamlIDPInitiatedMiscConfigTests.java", "license": "epl-1.0", "size": 47360 }
[ "com.ibm.ws.security.saml.fat.jaxrs.config.utils.RSSamlConfigSettings", "com.ibm.ws.security.saml.fat.jaxrs.config.utils.RSSamlProviderSettings", "java.util.List" ]
import com.ibm.ws.security.saml.fat.jaxrs.config.utils.RSSamlConfigSettings; import com.ibm.ws.security.saml.fat.jaxrs.config.utils.RSSamlProviderSettings; import java.util.List;
import com.ibm.ws.security.saml.fat.jaxrs.config.utils.*; import java.util.*;
[ "com.ibm.ws", "java.util" ]
com.ibm.ws; java.util;
1,874,721
public Command processed(UUID processingId) { checkNotNull(processingId, "processingId must not be null"); checkArgument(processingId.version() == 1, "processingId must be type 1 UUID"); return new Command(aggregateId, commandTimestamp, Optional.of(processingId), commandName, parameters, resultType); }
Command function(UUID processingId) { checkNotNull(processingId, STR); checkArgument(processingId.version() == 1, STR); return new Command(aggregateId, commandTimestamp, Optional.of(processingId), commandName, parameters, resultType); }
/** * Return a copy of this {@link Command}, updated with a processing id which uniquely identifies the command and * indicates when it was processed. * @param processingId The processing id to add to the command. * @return The updated command. */
Return a copy of this <code>Command</code>, updated with a processing id which uniquely identifies the command and indicates when it was processed
processed
{ "repo_name": "opencredo/concourse", "path": "concursus-domain/src/main/java/com/opencredo/concursus/domain/commands/Command.java", "license": "mit", "size": 7134 }
[ "com.google.common.base.Preconditions", "java.util.Optional" ]
import com.google.common.base.Preconditions; import java.util.Optional;
import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
149,029
public void testRequiresMore() throws IOException { BytesRef lake = new BytesRef("lake"); BytesRef star = new BytesRef("star"); BytesRef ret = new BytesRef("ret"); Input keys[] = new Input[]{ new Input("top of the lake", 18, lake), new Input("star wars: episode v - the empire strikes back", 12, star), new Input("the returned", 10, ret), }; File tempDir = _TestUtil.getTempDir("BlendedInfixSuggesterTest"); Analyzer a = new StandardAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET);
void function() throws IOException { BytesRef lake = new BytesRef("lake"); BytesRef star = new BytesRef("star"); BytesRef ret = new BytesRef("ret"); Input keys[] = new Input[]{ new Input(STR, 18, lake), new Input(STR, 12, star), new Input(STR, 10, ret), }; File tempDir = _TestUtil.getTempDir(STR); Analyzer a = new StandardAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET);
/** * Assert that the factor is important to get results that might be lower in term of weight but * would be pushed up after the blending transformation */
Assert that the factor is important to get results that might be lower in term of weight but would be pushed up after the blending transformation
testRequiresMore
{ "repo_name": "pengzong1111/solr4", "path": "lucene/suggest/src/test/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggesterTest.java", "license": "apache-2.0", "size": 8552 }
[ "java.io.File", "java.io.IOException", "org.apache.lucene.analysis.Analyzer", "org.apache.lucene.analysis.standard.StandardAnalyzer", "org.apache.lucene.analysis.util.CharArraySet", "org.apache.lucene.search.suggest.Input", "org.apache.lucene.util.BytesRef" ]
import java.io.File; import java.io.IOException; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.analysis.util.CharArraySet; import org.apache.lucene.search.suggest.Input; import org.apache.lucene.util.BytesRef;
import java.io.*; import org.apache.lucene.analysis.*; import org.apache.lucene.analysis.standard.*; import org.apache.lucene.analysis.util.*; import org.apache.lucene.search.suggest.*; import org.apache.lucene.util.*;
[ "java.io", "org.apache.lucene" ]
java.io; org.apache.lucene;
1,031,305
public static AffineTransform getPreserveAspectRatioTransform(Element e, String viewBox, String aspectRatio, float w, float h, BridgeContext ctx) { // no viewBox specified if (viewBox.length() == 0) { return new AffineTransform(); } float[] vb = parseViewBoxAttribute(e, viewBox, ctx); // 'preserveAspectRatio' attribute PreserveAspectRatioParser p = new PreserveAspectRatioParser(); ViewHandler ph = new ViewHandler(); p.setPreserveAspectRatioHandler(ph); try { p.parse(aspectRatio); } catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); } return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h); }
static AffineTransform function(Element e, String viewBox, String aspectRatio, float w, float h, BridgeContext ctx) { if (viewBox.length() == 0) { return new AffineTransform(); } float[] vb = parseViewBoxAttribute(e, viewBox, ctx); PreserveAspectRatioParser p = new PreserveAspectRatioParser(); ViewHandler ph = new ViewHandler(); p.setPreserveAspectRatioHandler(ph); try { p.parse(aspectRatio); } catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); } return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h); }
/** * Returns the transformation matrix to apply to initalize a viewport or * null if the specified viewBox disables the rendering of the element. * * @param e the element with a viewbox * @param viewBox the viewBox definition * @param w the width of the effective viewport * @param h The height of the effective viewport * @param ctx The BridgeContext to use for error information */
Returns the transformation matrix to apply to initalize a viewport or null if the specified viewBox disables the rendering of the element
getPreserveAspectRatioTransform
{ "repo_name": "adufilie/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ViewBox.java", "license": "apache-2.0", "size": 26968 }
[ "java.awt.geom.AffineTransform", "org.apache.flex.forks.batik.parser.ParseException", "org.apache.flex.forks.batik.parser.PreserveAspectRatioParser", "org.w3c.dom.Element" ]
import java.awt.geom.AffineTransform; import org.apache.flex.forks.batik.parser.ParseException; import org.apache.flex.forks.batik.parser.PreserveAspectRatioParser; import org.w3c.dom.Element;
import java.awt.geom.*; import org.apache.flex.forks.batik.parser.*; import org.w3c.dom.*;
[ "java.awt", "org.apache.flex", "org.w3c.dom" ]
java.awt; org.apache.flex; org.w3c.dom;
2,904,197
protected void publish(final HomematicBindingConfig bindingConfig, final HmValueItem hmValueItem) { new ProviderItemIterator().iterate(bindingConfig, new ProviderItemIteratorCallback() {
void function(final HomematicBindingConfig bindingConfig, final HmValueItem hmValueItem) { new ProviderItemIterator().iterate(bindingConfig, new ProviderItemIteratorCallback() {
/** * Iterate through all items and publishes the state. */
Iterate through all items and publishes the state
publish
{ "repo_name": "gregfinley/openhab", "path": "bundles/binding/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/CcuStateHolder.java", "license": "epl-1.0", "size": 7485 }
[ "org.openhab.binding.homematic.internal.communicator.ProviderItemIterator", "org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig", "org.openhab.binding.homematic.internal.model.HmValueItem" ]
import org.openhab.binding.homematic.internal.communicator.ProviderItemIterator; import org.openhab.binding.homematic.internal.config.binding.HomematicBindingConfig; import org.openhab.binding.homematic.internal.model.HmValueItem;
import org.openhab.binding.homematic.internal.communicator.*; import org.openhab.binding.homematic.internal.config.binding.*; import org.openhab.binding.homematic.internal.model.*;
[ "org.openhab.binding" ]
org.openhab.binding;
873,476
@Override public void updateNull(String columnName) throws SQLException { updateNull(findColumn(columnName)); }
void function(String columnName) throws SQLException { updateNull(findColumn(columnName)); }
/** * JDBC 2.0 Update a column with a null value. The updateXXX() methods are * used to update column values in the current row, or the insert row. The * updateXXX() methods do not update the underlying database, instead the * updateRow() or insertRow() methods are called to update the database. * * @param columnName * the name of the column * * @exception SQLException * if a database-access error occurs */
JDBC 2.0 Update a column with a null value. The updateXXX() methods are used to update column values in the current row, or the insert row. The updateXXX() methods do not update the underlying database, instead the updateRow() or insertRow() methods are called to update the database
updateNull
{ "repo_name": "scopej/mysql-connector-j", "path": "src/com/mysql/jdbc/UpdatableResultSet.java", "license": "gpl-2.0", "size": 96615 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
13,446
@Deprecated public MaintainableItemDefinition getMaintainableItem( String docTypeName, String itemName );
MaintainableItemDefinition function( String docTypeName, String itemName );
/** * Returns the definition for the maintainable item identified by "itemName". * * @param docTypeName * @param itemName * @return The item or <b>null</b> if the item does not exist. */
Returns the definition for the maintainable item identified by "itemName"
getMaintainableItem
{ "repo_name": "sbower/kuali-rice-1", "path": "kns/src/main/java/org/kuali/rice/kns/service/MaintenanceDocumentDictionaryService.java", "license": "apache-2.0", "size": 12083 }
[ "org.kuali.rice.kns.datadictionary.MaintainableItemDefinition" ]
import org.kuali.rice.kns.datadictionary.MaintainableItemDefinition;
import org.kuali.rice.kns.datadictionary.*;
[ "org.kuali.rice" ]
org.kuali.rice;
2,188,314
@RequestMapping("/oauth/error") public ModelAndView handleOAuthClientError(HttpServletRequest req) { TreeMap<String, Object> model = new TreeMap<>(); Object error = req.getAttribute("error"); // The error summary may contain malicious user input, // it needs to be escaped to prevent XSS Map<String, String> errorParams = new HashMap<>(); errorParams.put("date", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); if (error instanceof OAuth2Exception) { OAuth2Exception oauthError = (OAuth2Exception) error; errorParams.put("status", String.format("%d", oauthError.getHttpErrorCode())); errorParams.put("code", oauthError.getOAuth2ErrorCode()); errorParams.put("message", HtmlUtils.htmlEscape(oauthError.getMessage())); // transform the additionalInfo map to a comma seperated list of key: value pairs if (oauthError.getAdditionalInformation() != null) { errorParams.put("additionalInfo", HtmlUtils.htmlEscape(String.join(", ", oauthError.getAdditionalInformation().entrySet().stream() .map(entry -> entry.getKey() + ": " + entry.getValue()) .collect(Collectors.toList())))); } } // Copy non-empty entries to the model. Empty entries will not be present in the model, // so the default value will be rendered in the view. for (Map.Entry<String, String> entry : errorParams.entrySet()) { if (!entry.getValue().equals("")) { model.put(entry.getKey(), entry.getValue()); } } return new ModelAndView("error", model); }
@RequestMapping(STR) ModelAndView function(HttpServletRequest req) { TreeMap<String, Object> model = new TreeMap<>(); Object error = req.getAttribute("error"); Map<String, String> errorParams = new HashMap<>(); errorParams.put("date", new SimpleDateFormat(STR).format(new Date())); if (error instanceof OAuth2Exception) { OAuth2Exception oauthError = (OAuth2Exception) error; errorParams.put(STR, String.format("%d", oauthError.getHttpErrorCode())); errorParams.put("code", oauthError.getOAuth2ErrorCode()); errorParams.put(STR, HtmlUtils.htmlEscape(oauthError.getMessage())); if (oauthError.getAdditionalInformation() != null) { errorParams.put(STR, HtmlUtils.htmlEscape(String.join(STR, oauthError.getAdditionalInformation().entrySet().stream() .map(entry -> entry.getKey() + STR + entry.getValue()) .collect(Collectors.toList())))); } } for (Map.Entry<String, String> entry : errorParams.entrySet()) { if (!entry.getValue().equals(STRerror", model); }
/** * A page to render errors that arised during an OAuth flow. * @param req the servlet request * @return a ModelAndView to render the page */
A page to render errors that arised during an OAuth flow
handleOAuthClientError
{ "repo_name": "RADAR-CNS/ManagementPortal", "path": "src/main/java/org/radarcns/management/config/OAuth2LoginUiWebConfig.java", "license": "apache-2.0", "size": 4993 }
[ "java.text.SimpleDateFormat", "java.util.Date", "java.util.HashMap", "java.util.Map", "java.util.TreeMap", "java.util.stream.Collectors", "javax.servlet.http.HttpServletRequest", "org.springframework.security.oauth2.common.exceptions.OAuth2Exception", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.servlet.ModelAndView", "org.springframework.web.util.HtmlUtils" ]
import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.util.HtmlUtils;
import java.text.*; import java.util.*; import java.util.stream.*; import javax.servlet.http.*; import org.springframework.security.oauth2.common.exceptions.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*; import org.springframework.web.util.*;
[ "java.text", "java.util", "javax.servlet", "org.springframework.security", "org.springframework.web" ]
java.text; java.util; javax.servlet; org.springframework.security; org.springframework.web;
521,017
@Override public boolean hasPotentialAvailableSpace(int fileSize) { if (fileSize <= 0) { return false; } // check if enough space left if (getAvailableSpace() > fileSize) { return true; } Iterator<File> it = fileList.iterator(); File file = null; int deletedFileSize = 0; // if not enough space, then if want to clear/delete some files // then check whether it still have space or not boolean result = false; while (it.hasNext()) { file = it.next(); if (!file.isReadOnly()) { deletedFileSize += file.getSize(); } if (deletedFileSize > fileSize) { result = true; break; } } return result; }
boolean function(int fileSize) { if (fileSize <= 0) { return false; } if (getAvailableSpace() > fileSize) { return true; } Iterator<File> it = fileList.iterator(); File file = null; int deletedFileSize = 0; boolean result = false; while (it.hasNext()) { file = it.next(); if (!file.isReadOnly()) { deletedFileSize += file.getSize(); } if (deletedFileSize > fileSize) { result = true; break; } } return result; }
/** * Checks whether there is enough space on the storage for a certain file. * * @param fileSize a FileAttribute object to compare to * @return <tt>true</tt> if enough space available, <tt>false</tt> otherwise */
Checks whether there is enough space on the storage for a certain file
hasPotentialAvailableSpace
{ "repo_name": "mithilarun/Swift-OpenSim", "path": "src/org/opensim/swift/OpensimStorageServer.java", "license": "lgpl-3.0", "size": 22342 }
[ "java.util.Iterator", "org.cloudbus.cloudsim.File" ]
import java.util.Iterator; import org.cloudbus.cloudsim.File;
import java.util.*; import org.cloudbus.cloudsim.*;
[ "java.util", "org.cloudbus.cloudsim" ]
java.util; org.cloudbus.cloudsim;
102,375
public void registerDiscoveryService(DSCAlarmDiscoveryService discoveryService) { if (discoveryService == null) { throw new IllegalArgumentException("registerDiscoveryService(): Illegal Argument. Not allowed to be Null!"); } else { this.dscAlarmDiscoveryService = discoveryService; logger.trace("registerDiscoveryService(): Discovery Service Registered!"); } }
void function(DSCAlarmDiscoveryService discoveryService) { if (discoveryService == null) { throw new IllegalArgumentException(STR); } else { this.dscAlarmDiscoveryService = discoveryService; logger.trace(STR); } }
/** * Register the Discovery Service. * * @param discoveryService */
Register the Discovery Service
registerDiscoveryService
{ "repo_name": "peuter/openhab2-addons", "path": "addons/binding/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/handler/DSCAlarmBaseBridgeHandler.java", "license": "epl-1.0", "size": 28014 }
[ "org.openhab.binding.dscalarm.internal.discovery.DSCAlarmDiscoveryService" ]
import org.openhab.binding.dscalarm.internal.discovery.DSCAlarmDiscoveryService;
import org.openhab.binding.dscalarm.internal.discovery.*;
[ "org.openhab.binding" ]
org.openhab.binding;
1,224,641
private void saveImage(INodeDirectory current, DataOutputStream out, boolean toSaveSubtree, boolean inSnapshot, Counter counter) throws IOException { // write the inode id of the directory out.writeLong(current.getId()); if (!toSaveSubtree) { return; } final ReadOnlyList<INode> children = current .getChildrenList(Snapshot.CURRENT_STATE_ID); int dirNum = 0; List<INodeDirectory> snapshotDirs = null; DirectoryWithSnapshotFeature sf = current.getDirectoryWithSnapshotFeature(); if (sf != null) { snapshotDirs = new ArrayList<INodeDirectory>(); sf.getSnapshotDirectory(snapshotDirs); dirNum += snapshotDirs.size(); } // 2. Write INodeDirectorySnapshottable#snapshotsByNames to record all // Snapshots if (current.isDirectory() && current.asDirectory().isSnapshottable()) { SnapshotFSImageFormat.saveSnapshots(current.asDirectory(), out); } else { out.writeInt(-1); // # of snapshots } // 3. Write children INode dirNum += saveChildren(children, out, inSnapshot, counter); // 4. Write DirectoryDiff lists, if there is any. SnapshotFSImageFormat.saveDirectoryDiffList(current, out, referenceMap); // Write sub-tree of sub-directories, including possible snapshots of // deleted sub-directories out.writeInt(dirNum); // the number of sub-directories for(INode child : children) { if(!child.isDirectory()) { continue; } // make sure we only save the subtree under a reference node once boolean toSave = child.isReference() ? referenceMap.toProcessSubtree(child.getId()) : true; saveImage(child.asDirectory(), out, toSave, inSnapshot, counter); } if (snapshotDirs != null) { for (INodeDirectory subDir : snapshotDirs) { // make sure we only save the subtree under a reference node once boolean toSave = subDir.getParentReference() != null ? referenceMap.toProcessSubtree(subDir.getId()) : true; saveImage(subDir, out, toSave, true, counter); } } }
void function(INodeDirectory current, DataOutputStream out, boolean toSaveSubtree, boolean inSnapshot, Counter counter) throws IOException { out.writeLong(current.getId()); if (!toSaveSubtree) { return; } final ReadOnlyList<INode> children = current .getChildrenList(Snapshot.CURRENT_STATE_ID); int dirNum = 0; List<INodeDirectory> snapshotDirs = null; DirectoryWithSnapshotFeature sf = current.getDirectoryWithSnapshotFeature(); if (sf != null) { snapshotDirs = new ArrayList<INodeDirectory>(); sf.getSnapshotDirectory(snapshotDirs); dirNum += snapshotDirs.size(); } if (current.isDirectory() && current.asDirectory().isSnapshottable()) { SnapshotFSImageFormat.saveSnapshots(current.asDirectory(), out); } else { out.writeInt(-1); } dirNum += saveChildren(children, out, inSnapshot, counter); SnapshotFSImageFormat.saveDirectoryDiffList(current, out, referenceMap); out.writeInt(dirNum); for(INode child : children) { if(!child.isDirectory()) { continue; } boolean toSave = child.isReference() ? referenceMap.toProcessSubtree(child.getId()) : true; saveImage(child.asDirectory(), out, toSave, inSnapshot, counter); } if (snapshotDirs != null) { for (INodeDirectory subDir : snapshotDirs) { boolean toSave = subDir.getParentReference() != null ? referenceMap.toProcessSubtree(subDir.getId()) : true; saveImage(subDir, out, toSave, true, counter); } } }
/** * Save file tree image starting from the given root. * This is a recursive procedure, which first saves all children and * snapshot diffs of a current directory and then moves inside the * sub-directories. * * @param current The current node * @param out The DataoutputStream to write the image * @param toSaveSubtree Whether or not to save the subtree to fsimage. For * reference node, its subtree may already have been * saved before. * @param inSnapshot Whether the current directory is in snapshot * @param counter Counter to increment for namenode startup progress */
Save file tree image starting from the given root. This is a recursive procedure, which first saves all children and snapshot diffs of a current directory and then moves inside the sub-directories
saveImage
{ "repo_name": "zhe-thoughts/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java", "license": "apache-2.0", "size": 54267 }
[ "java.io.DataOutputStream", "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature", "org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot", "org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotFSImageFormat", "org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress", "org.apache.hadoop.hdfs.util.ReadOnlyList" ]
import java.io.DataOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature; import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot; import org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotFSImageFormat; import org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress; import org.apache.hadoop.hdfs.util.ReadOnlyList;
import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.server.namenode.snapshot.*; import org.apache.hadoop.hdfs.server.namenode.startupprogress.*; import org.apache.hadoop.hdfs.util.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,562,195
public void initialize (ModelValidationEngine engine, MClient client) { //client = null for global validator if (client != null) { m_AD_Client_ID = client.getAD_Client_ID(); log.info(client.toString()); } else { log.info("Initializing global validator: "+this.toString()); } engine.addModelChange(MBPartner.Table_Name, this); engine.addModelChange(MBPartnerLocation.Table_Name, this); engine.addModelChange(MOrgInfo.Table_Name, this); } // initialize
void function (ModelValidationEngine engine, MClient client) { if (client != null) { m_AD_Client_ID = client.getAD_Client_ID(); log.info(client.toString()); } else { log.info(STR+this.toString()); } engine.addModelChange(MBPartner.Table_Name, this); engine.addModelChange(MBPartnerLocation.Table_Name, this); engine.addModelChange(MOrgInfo.Table_Name, this); }
/** * Initialize Validation * @param engine validation engine * @param client client */
Initialize Validation
initialize
{ "repo_name": "arthurmelo88/palmetalADP", "path": "adempierelbr/base/src/org/adempierelbr/validator/ValidatorBPartner.java", "license": "gpl-2.0", "size": 17456 }
[ "org.compiere.model.MBPartner", "org.compiere.model.MBPartnerLocation", "org.compiere.model.MClient", "org.compiere.model.MOrgInfo", "org.compiere.model.ModelValidationEngine" ]
import org.compiere.model.MBPartner; import org.compiere.model.MBPartnerLocation; import org.compiere.model.MClient; import org.compiere.model.MOrgInfo; import org.compiere.model.ModelValidationEngine;
import org.compiere.model.*;
[ "org.compiere.model" ]
org.compiere.model;
809,547
public Observable<ServiceResponse<SummarizeResultsInner>> summarizeForPolicyDefinitionWithServiceResponseAsync(String subscriptionId, String policyDefinitionName) { if (subscriptionId == null) { throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); } if (policyDefinitionName == null) { throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); }
Observable<ServiceResponse<SummarizeResultsInner>> function(String subscriptionId, String policyDefinitionName) { if (subscriptionId == null) { throw new IllegalArgumentException(STR); } if (policyDefinitionName == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); }
/** * Summarizes policy states for the subscription level policy definition. * * @param subscriptionId Microsoft Azure subscription ID. * @param policyDefinitionName Policy definition name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the SummarizeResultsInner object */
Summarizes policy states for the subscription level policy definition
summarizeForPolicyDefinitionWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/policyinsights/mgmt-v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java", "license": "mit", "size": 215800 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,702,753
@Test @LoadGraphWith(MODERN) @FeatureRequirement(featureClass = GraphFeatures.class, feature = GraphFeatures.FEATURE_ORDERABILITY_SEMANTICS) @FeatureRequirement(featureClass = EdgeFeatures.class, feature = EdgeFeatures.FEATURE_ADD_PROPERTY) public void g_E_properties_order_value() { { // add some more edge properties final AtomicInteger a = new AtomicInteger(); g.E().forEachRemaining(e -> e.property("a", a.getAndIncrement())); } final Traversal asc = get_g_E_properties_order_value(); printTraversalForm(asc); checkOrderedResults(Arrays.asList( 0, 1, 2, 3, 4, 5, 0.2, 0.4, 0.4, 0.5, 1.0, 1.0 ), asc); final Traversal desc = get_g_E_properties_order_byXdescX_value(); printTraversalForm(desc); checkOrderedResults(Arrays.asList( 1.0, 1.0, 0.5, 0.4, 0.4, 0.2, 5, 4, 3, 2, 1, 0 ), desc); }
@LoadGraphWith(MODERN) @FeatureRequirement(featureClass = GraphFeatures.class, feature = GraphFeatures.FEATURE_ORDERABILITY_SEMANTICS) @FeatureRequirement(featureClass = EdgeFeatures.class, feature = EdgeFeatures.FEATURE_ADD_PROPERTY) void function() { { final AtomicInteger a = new AtomicInteger(); g.E().forEachRemaining(e -> e.property("a", a.getAndIncrement())); } final Traversal asc = get_g_E_properties_order_value(); printTraversalForm(asc); checkOrderedResults(Arrays.asList( 0, 1, 2, 3, 4, 5, 0.2, 0.4, 0.4, 0.5, 1.0, 1.0 ), asc); final Traversal desc = get_g_E_properties_order_byXdescX_value(); printTraversalForm(desc); checkOrderedResults(Arrays.asList( 1.0, 1.0, 0.5, 0.4, 0.4, 0.2, 5, 4, 3, 2, 1, 0 ), desc); }
/** * Order by edge property (orders by key, then value). */
Order by edge property (orders by key, then value)
g_E_properties_order_value
{ "repo_name": "apache/incubator-tinkerpop", "path": "gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/OrderabilityTest.java", "license": "apache-2.0", "size": 23585 }
[ "java.util.Arrays", "java.util.concurrent.atomic.AtomicInteger", "org.apache.tinkerpop.gremlin.FeatureRequirement", "org.apache.tinkerpop.gremlin.LoadGraphWith", "org.apache.tinkerpop.gremlin.process.traversal.Traversal", "org.apache.tinkerpop.gremlin.structure.Graph" ]
import java.util.Arrays; import java.util.concurrent.atomic.AtomicInteger; import org.apache.tinkerpop.gremlin.FeatureRequirement; import org.apache.tinkerpop.gremlin.LoadGraphWith; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.structure.Graph;
import java.util.*; import java.util.concurrent.atomic.*; import org.apache.tinkerpop.gremlin.*; import org.apache.tinkerpop.gremlin.process.traversal.*; import org.apache.tinkerpop.gremlin.structure.*;
[ "java.util", "org.apache.tinkerpop" ]
java.util; org.apache.tinkerpop;
1,481,954
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) { mViewPagerPageChangeListener = listener; }
void function(ViewPager.OnPageChangeListener listener) { mViewPagerPageChangeListener = listener; }
/** * Set the {@link ViewPager.OnPageChangeListener}. When using {@link SlidingTabLayout} you are * required to set any {@link ViewPager.OnPageChangeListener} through this method. This is so * that the layout can update it's scroll position correctly. * * @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener) */
Set the <code>ViewPager.OnPageChangeListener</code>. When using <code>SlidingTabLayout</code> you are required to set any <code>ViewPager.OnPageChangeListener</code> through this method. This is so that the layout can update it's scroll position correctly
setOnPageChangeListener
{ "repo_name": "arutsudar/SavePlaces", "path": "app/src/main/java/com/gabm/fancyplaces/ui/SlidingTabLayout.java", "license": "gpl-3.0", "size": 11207 }
[ "android.support.v4.view.ViewPager" ]
import android.support.v4.view.ViewPager;
import android.support.v4.view.*;
[ "android.support" ]
android.support;
776,344
static List<String> getJavaArguments() { LinkedList<String> list = new LinkedList<String>(); String java = System.getProperty("java.home") + "/bin/java"; list.add(java); list.add(_mode); list.add("-classpath"); list.add(_jarFile); String prop = "pflow.core.libpath"; String libpath = System.getProperty(prop); if (libpath != null) { list.add("-D" + prop + "=" + libpath); } return list; }
static List<String> getJavaArguments() { LinkedList<String> list = new LinkedList<String>(); String java = System.getProperty(STR) + STR; list.add(java); list.add(_mode); list.add(STR); list.add(_jarFile); String prop = STR; String libpath = System.getProperty(prop); if (libpath != null) { list.add("-D" + prop + "=" + libpath); } return list; }
/** * <p> * Return a list which contains command line arguments to spawn a * new Java process. * </p> * <p> * To spawn a new Java process, the caller must append the main * class name to the returned list. * </p> * * @return List of command line arguments. */
Return a list which contains command line arguments to spawn a new Java process. To spawn a new Java process, the caller must append the main class name to the returned list.
getJavaArguments
{ "repo_name": "opendaylight/vtn", "path": "coordinator/core/test/java/pfc_util/src/org/opendaylight/vtn/core/util/TestBase.java", "license": "epl-1.0", "size": 7613 }
[ "java.util.LinkedList", "java.util.List" ]
import java.util.LinkedList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,277,583
Optional<Progress> batchUpdateCourseState(String accountId, Course.CourseEvent event, String... courseIds) throws IOException;
Optional<Progress> batchUpdateCourseState(String accountId, Course.CourseEvent event, String... courseIds) throws IOException;
/** * Change the workflow state of multiple courses at once * * This operation happens asynchronously and returns a Progress object to monitor its execution. * Valid events are: offer, conclude, delete and undelete. It is NOT possible to claim a course using this method. * See: https://canvas.instructure.com/doc/api/courses.html#method.courses.batch_update * * @param accountId The ID of the account in which to perform this bulk operation * @param event The course event type to push * @param courseIds A list of course IDs to perform this operation on * @return Progress object to monitor the state of the batch operation * @throws IOException When there is an error communicating with Canvas */
Change the workflow state of multiple courses at once This operation happens asynchronously and returns a Progress object to monitor its execution. Valid events are: offer, conclude, delete and undelete. It is NOT possible to claim a course using this method. See: HREF
batchUpdateCourseState
{ "repo_name": "kstateome/canvas-api", "path": "src/main/java/edu/ksu/canvas/interfaces/CourseWriter.java", "license": "lgpl-3.0", "size": 3644 }
[ "edu.ksu.canvas.model.Course", "edu.ksu.canvas.model.Progress", "java.io.IOException", "java.util.Optional" ]
import edu.ksu.canvas.model.Course; import edu.ksu.canvas.model.Progress; import java.io.IOException; import java.util.Optional;
import edu.ksu.canvas.model.*; import java.io.*; import java.util.*;
[ "edu.ksu.canvas", "java.io", "java.util" ]
edu.ksu.canvas; java.io; java.util;
1,549,203
@Test public void saveArtefact() { // create artefact final Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.set(Calendar.MILLISECOND, 0); final Date collectionDate = cal.getTime(); AbstractArtefact artefact = epFrontendManager.createAndPersistArtefact(ident1, "Forum"); artefact.setTitle("artefact-title"); artefact.setBusinessPath("business-path"); artefact.setCollectionDate(collectionDate); artefact.setDescription("artefact-description"); artefact.setReflexion("artefact-reflexion"); artefact.setSignature(70); artefact.setFulltextContent("fulltext-content"); artefact.setSource("artefact-source"); artefact = epFrontendManager.updateArtefact(artefact); dbInstance.commitAndCloseSession(); // test if the link is persisted final AbstractArtefact retrievedArtefact = epFrontendManager.loadArtefactByKey(artefact.getKey()); assertNotNull(retrievedArtefact); assertEquals(artefact.getKey(), retrievedArtefact.getKey()); assertEquals("artefact-title", retrievedArtefact.getTitle()); assertEquals("business-path", retrievedArtefact.getBusinessPath()); assertEquals("artefact-description", retrievedArtefact.getDescription()); assertEquals("artefact-reflexion", retrievedArtefact.getReflexion()); assertEquals(70, retrievedArtefact.getSignature()); assertEquals("fulltext-content", retrievedArtefact.getFulltextContent()); assertEquals("artefact-source", retrievedArtefact.getSource()); assertEquals(ident1.getKey(), retrievedArtefact.getAuthor().getKey()); // check date assertNotNull(retrievedArtefact.getCollectionDate()); final Calendar cal1 = Calendar.getInstance(); cal1.setTime(collectionDate); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(retrievedArtefact.getCollectionDate()); assertTrue(cal1.compareTo(cal2) == 0); }
void function() { final Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.set(Calendar.MILLISECOND, 0); final Date collectionDate = cal.getTime(); AbstractArtefact artefact = epFrontendManager.createAndPersistArtefact(ident1, "Forum"); artefact.setTitle(STR); artefact.setBusinessPath(STR); artefact.setCollectionDate(collectionDate); artefact.setDescription(STR); artefact.setReflexion(STR); artefact.setSignature(70); artefact.setFulltextContent(STR); artefact.setSource(STR); artefact = epFrontendManager.updateArtefact(artefact); dbInstance.commitAndCloseSession(); final AbstractArtefact retrievedArtefact = epFrontendManager.loadArtefactByKey(artefact.getKey()); assertNotNull(retrievedArtefact); assertEquals(artefact.getKey(), retrievedArtefact.getKey()); assertEquals(STR, retrievedArtefact.getTitle()); assertEquals(STR, retrievedArtefact.getBusinessPath()); assertEquals(STR, retrievedArtefact.getDescription()); assertEquals(STR, retrievedArtefact.getReflexion()); assertEquals(70, retrievedArtefact.getSignature()); assertEquals(STR, retrievedArtefact.getFulltextContent()); assertEquals(STR, retrievedArtefact.getSource()); assertEquals(ident1.getKey(), retrievedArtefact.getAuthor().getKey()); assertNotNull(retrievedArtefact.getCollectionDate()); final Calendar cal1 = Calendar.getInstance(); cal1.setTime(collectionDate); final Calendar cal2 = Calendar.getInstance(); cal2.setTime(retrievedArtefact.getCollectionDate()); assertTrue(cal1.compareTo(cal2) == 0); }
/** * Persist all properties and check them */
Persist all properties and check them
saveArtefact
{ "repo_name": "RLDevOps/Demo", "path": "src/test/java/org/olat/portfolio/EPStructureToArtefactTest.java", "license": "apache-2.0", "size": 19027 }
[ "java.util.Calendar", "java.util.Date", "org.junit.Assert", "org.olat.portfolio.model.artefacts.AbstractArtefact" ]
import java.util.Calendar; import java.util.Date; import org.junit.Assert; import org.olat.portfolio.model.artefacts.AbstractArtefact;
import java.util.*; import org.junit.*; import org.olat.portfolio.model.artefacts.*;
[ "java.util", "org.junit", "org.olat.portfolio" ]
java.util; org.junit; org.olat.portfolio;
639,913
@ParameterizedTest @MethodSource("branchSessionProvider") public void onRemoveBranchTest(GlobalSession globalSession, BranchSession branchSession) throws Exception { for (SessionManager sessionManager : sessionManagerList) { sessionManager.onBegin(globalSession); sessionManager.onAddBranch(globalSession, branchSession); sessionManager.onRemoveBranch(globalSession, branchSession); sessionManager.onEnd(globalSession); } }
@MethodSource(STR) void function(GlobalSession globalSession, BranchSession branchSession) throws Exception { for (SessionManager sessionManager : sessionManagerList) { sessionManager.onBegin(globalSession); sessionManager.onAddBranch(globalSession, branchSession); sessionManager.onRemoveBranch(globalSession, branchSession); sessionManager.onEnd(globalSession); } }
/** * On remove branch test. * * @param globalSession the global session * @param branchSession the branch session * @throws Exception the exception */
On remove branch test
onRemoveBranchTest
{ "repo_name": "seata/seata", "path": "server/src/test/java/io/seata/server/session/FileSessionManagerTest.java", "license": "apache-2.0", "size": 22752 }
[ "org.junit.jupiter.params.provider.MethodSource" ]
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.*;
[ "org.junit.jupiter" ]
org.junit.jupiter;
2,311,792
@Test public void testMarshalUnmarshalDeliveryPattern() throws Exception { DeliveryPattern deliveryTitleInfos = new DeliveryPattern(); deliveryTitleInfos.addDeliveryPattern("aarhusstiftstidende", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("arbejderen", new WeekPattern(FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern("berlingsketidende", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("boersen", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern("bornholmstidende", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("bt", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("dagbladetkoege", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("dagbladetringsted", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("dagbladetroskilde", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("dagbladetstruer", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("dernordschleswiger", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("ekstrabladet", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("flensborgavis", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("fredericiadagblad1890", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("frederiksborgamtsavis", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("fyensstiftstidende", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("fynsamtsavissvendborg", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("helsingoerdagblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("herningfolkeblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("holstebrodagblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("horsensfolkeblad1866", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("information", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("jydskevestkystensoenderborg", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("jydskevestkystenbillund", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("jydskevestkystenvarde", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("jydskevestkystenesbjerg", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("jydskevestkystenhaderslev", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("jydskevestkystenkolding1995", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("jydskevestkystentoender", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("jydskevestkystenaabenraa", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("jydskevestkystenvejen", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("kristeligtdagblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("lemvigfolkeblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("licitationen", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("lollandfalstersfolketidende", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern("metroxpressoest", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern("metroxpressvest", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern("midtjyllandsavis1857", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("morgenavisenjyllandsposten", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("morsoefolkeblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("nordjyskestiftstidendeaalborg", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("nordjyskestiftstidendehimmerland", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("nordjyskestiftstidendevendsyssel", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("nordvestnytholbaek", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("nordvestnytkalundborg", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("politiken", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("politikenweekly", new WeekPattern(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern("randersamtsavis", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("ringkjoebingamtsdagblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("sjaellandskenaestved", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("sjaellandskeslagelse", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("skivefolkeblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("thisteddagblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern("vejleamtsfolkeblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("viborgstiftsfolkeblad", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("weekendavisen", new WeekPattern(FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE)); File tempFile = createTestFile("DeliveryPattern"); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, FALSE); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(deliveryTitleInfos, tempFile); InputStream is = new FileInputStream(tempFile); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); DeliveryPattern deserializedObject = (DeliveryPattern) jaxbUnmarshaller.unmarshal(is); WeekPattern deliveryInfo = deserializedObject.getWeekPattern("viborgstiftsfolkeblad"); assertEquals(deliveryInfo.getDayState(DayOfWeek.MONDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.TUESDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.WEDNESDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.THURSDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.FRIDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.SATURDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.SUNDAY), FALSE); }
void function() throws Exception { DeliveryPattern deliveryTitleInfos = new DeliveryPattern(); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern("bt", new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE)); deliveryTitleInfos.addDeliveryPattern(STR, new WeekPattern(FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE)); File tempFile = createTestFile(STR); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, FALSE); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(deliveryTitleInfos, tempFile); InputStream is = new FileInputStream(tempFile); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); DeliveryPattern deserializedObject = (DeliveryPattern) jaxbUnmarshaller.unmarshal(is); WeekPattern deliveryInfo = deserializedObject.getWeekPattern(STR); assertEquals(deliveryInfo.getDayState(DayOfWeek.MONDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.TUESDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.WEDNESDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.THURSDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.FRIDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.SATURDAY), TRUE); assertEquals(deliveryInfo.getDayState(DayOfWeek.SUNDAY), FALSE); }
/** * Validate that it is possible to convert between xml and the object DeliveryTitleInfo * @throws Exception */
Validate that it is possible to convert between xml and the object DeliveryTitleInfo
testMarshalUnmarshalDeliveryPattern
{ "repo_name": "statsbiblioteket/digital-pligtaflevering-aviser-tools", "path": "tools/dpa-manualcontrol/src/test/java/org/statsbiblioteket/digital_pligtaflevering_aviser/ui/TestSerializing.java", "license": "apache-2.0", "size": 16492 }
[ "dk.statsbiblioteket.digital_pligtaflevering_aviser.tools.convertersFunctions.DeliveryPattern", "dk.statsbiblioteket.digital_pligtaflevering_aviser.tools.convertersFunctions.WeekPattern", "java.io.File", "java.io.FileInputStream", "java.io.InputStream", "java.time.DayOfWeek", "javax.xml.bind.Marshaller", "javax.xml.bind.Unmarshaller", "org.junit.Assert" ]
import dk.statsbiblioteket.digital_pligtaflevering_aviser.tools.convertersFunctions.DeliveryPattern; import dk.statsbiblioteket.digital_pligtaflevering_aviser.tools.convertersFunctions.WeekPattern; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.time.DayOfWeek; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import org.junit.Assert;
import dk.statsbiblioteket.digital_pligtaflevering_aviser.tools.*; import java.io.*; import java.time.*; import javax.xml.bind.*; import org.junit.*;
[ "dk.statsbiblioteket.digital_pligtaflevering_aviser", "java.io", "java.time", "javax.xml", "org.junit" ]
dk.statsbiblioteket.digital_pligtaflevering_aviser; java.io; java.time; javax.xml; org.junit;
295,636
public Iterator<T> iterator() { return iterable.iterator(); }
Iterator<T> function() { return iterable.iterator(); }
/** * Returns an iterator for this iterable. * @return An iterator for this iterable */
Returns an iterator for this iterable
iterator
{ "repo_name": "jeroenvanmaanen/common", "path": "src/main/java/org/leialearns/common/TypedIterable.java", "license": "lgpl-3.0", "size": 2577 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,909,966
String type = settings.getGloablSettings().getSetting(CompassEnvironment.Xsem.XmlContent.TYPE); if (type == null) { throw new ConfigurationException("[" + CompassEnvironment.Xsem.XmlContent.TYPE + "] configuration can not be found, please set it in the configuration settings"); } XmlContentConverter xmlContentConverter; if (CompassEnvironment.Xsem.XmlContent.JDom.TYPE_SAX.equals(type)) { xmlContentConverter = new SAXBuilderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.JDom.TYPE_STAX.equals(type)) { xmlContentConverter = new STAXBuilderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Dom4j.TYPE_STAX.equals(type)) { xmlContentConverter = new STAXReaderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Dom4j.TYPE_SAX.equals(type)) { xmlContentConverter = new SAXReaderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Dom4j.TYPE_XPP.equals(type)) { xmlContentConverter = new XPPReaderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Dom4j.TYPE_XPP3.equals(type)) { xmlContentConverter = new XPP3ReaderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Javax.TYPE_NODE.equals(type)) { xmlContentConverter = new NodeXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Javax.TYPE_STAX.equals(type)) { xmlContentConverter = new StaxNodeXmlContentConverter(); } else { try { xmlContentConverter = (XmlContentConverter) ClassUtils.forName(type, settings.getClassLoader()).newInstance(); } catch (Exception e) { throw new ConfigurationException("Failed to create xmlContent [" + type + "]", e); } } if (xmlContentConverter instanceof CompassConfigurable) { ((CompassConfigurable) xmlContentConverter).configure(settings); } if (xmlContentConverter instanceof SupportsXmlContentWrapper) { String wrapper = settings.getGloablSettings().getSetting(CompassEnvironment.Xsem.XmlContent.WRAPPER, CompassEnvironment.Xsem.XmlContent.WRAPPER_PROTOTYPE); if (!((SupportsXmlContentWrapper) xmlContentConverter).supports(wrapper)) { throw new SupportsXmlContentWrapper.NotSupportedXmlContentWrapperException(xmlContentConverter, wrapper); } } return xmlContentConverter; }
String type = settings.getGloablSettings().getSetting(CompassEnvironment.Xsem.XmlContent.TYPE); if (type == null) { throw new ConfigurationException("[" + CompassEnvironment.Xsem.XmlContent.TYPE + STR); } XmlContentConverter xmlContentConverter; if (CompassEnvironment.Xsem.XmlContent.JDom.TYPE_SAX.equals(type)) { xmlContentConverter = new SAXBuilderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.JDom.TYPE_STAX.equals(type)) { xmlContentConverter = new STAXBuilderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Dom4j.TYPE_STAX.equals(type)) { xmlContentConverter = new STAXReaderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Dom4j.TYPE_SAX.equals(type)) { xmlContentConverter = new SAXReaderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Dom4j.TYPE_XPP.equals(type)) { xmlContentConverter = new XPPReaderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Dom4j.TYPE_XPP3.equals(type)) { xmlContentConverter = new XPP3ReaderXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Javax.TYPE_NODE.equals(type)) { xmlContentConverter = new NodeXmlContentConverter(); } else if (CompassEnvironment.Xsem.XmlContent.Javax.TYPE_STAX.equals(type)) { xmlContentConverter = new StaxNodeXmlContentConverter(); } else { try { xmlContentConverter = (XmlContentConverter) ClassUtils.forName(type, settings.getClassLoader()).newInstance(); } catch (Exception e) { throw new ConfigurationException(STR + type + "]", e); } } if (xmlContentConverter instanceof CompassConfigurable) { ((CompassConfigurable) xmlContentConverter).configure(settings); } if (xmlContentConverter instanceof SupportsXmlContentWrapper) { String wrapper = settings.getGloablSettings().getSetting(CompassEnvironment.Xsem.XmlContent.WRAPPER, CompassEnvironment.Xsem.XmlContent.WRAPPER_PROTOTYPE); if (!((SupportsXmlContentWrapper) xmlContentConverter).supports(wrapper)) { throw new SupportsXmlContentWrapper.NotSupportedXmlContentWrapperException(xmlContentConverter, wrapper); } } return xmlContentConverter; }
/** * Creates a new {@link org.compass.core.converter.xsem.XmlContentConverter} based on the given settings. */
Creates a new <code>org.compass.core.converter.xsem.XmlContentConverter</code> based on the given settings
createXmlContentConverter
{ "repo_name": "unkascrack/compass-fork", "path": "compass-core/src/main/java/org/compass/core/converter/xsem/XmlContentConverterUtils.java", "license": "apache-2.0", "size": 3886 }
[ "org.compass.core.config.CompassConfigurable", "org.compass.core.config.CompassEnvironment", "org.compass.core.config.ConfigurationException", "org.compass.core.util.ClassUtils", "org.compass.core.xml.dom4j.converter.SAXReaderXmlContentConverter", "org.compass.core.xml.dom4j.converter.STAXReaderXmlContentConverter", "org.compass.core.xml.dom4j.converter.XPP3ReaderXmlContentConverter", "org.compass.core.xml.dom4j.converter.XPPReaderXmlContentConverter", "org.compass.core.xml.javax.converter.NodeXmlContentConverter", "org.compass.core.xml.javax.converter.StaxNodeXmlContentConverter", "org.compass.core.xml.jdom.converter.SAXBuilderXmlContentConverter", "org.compass.core.xml.jdom.converter.STAXBuilderXmlContentConverter" ]
import org.compass.core.config.CompassConfigurable; import org.compass.core.config.CompassEnvironment; import org.compass.core.config.ConfigurationException; import org.compass.core.util.ClassUtils; import org.compass.core.xml.dom4j.converter.SAXReaderXmlContentConverter; import org.compass.core.xml.dom4j.converter.STAXReaderXmlContentConverter; import org.compass.core.xml.dom4j.converter.XPP3ReaderXmlContentConverter; import org.compass.core.xml.dom4j.converter.XPPReaderXmlContentConverter; import org.compass.core.xml.javax.converter.NodeXmlContentConverter; import org.compass.core.xml.javax.converter.StaxNodeXmlContentConverter; import org.compass.core.xml.jdom.converter.SAXBuilderXmlContentConverter; import org.compass.core.xml.jdom.converter.STAXBuilderXmlContentConverter;
import org.compass.core.config.*; import org.compass.core.util.*; import org.compass.core.xml.dom4j.converter.*; import org.compass.core.xml.javax.converter.*; import org.compass.core.xml.jdom.converter.*;
[ "org.compass.core" ]
org.compass.core;
266,853
@SuppressWarnings("unchecked") public final List<IValidator<? super T>> getValidators() { final List<IValidator<? super T>> list = new ArrayList<IValidator<? super T>>(); for (Behavior behavior : getBehaviors()) { if (behavior instanceof IValidator) { list.add((IValidator<? super T>)behavior); } } return Collections.unmodifiableList(list); }
@SuppressWarnings(STR) final List<IValidator<? super T>> function() { final List<IValidator<? super T>> list = new ArrayList<IValidator<? super T>>(); for (Behavior behavior : getBehaviors()) { if (behavior instanceof IValidator) { list.add((IValidator<? super T>)behavior); } } return Collections.unmodifiableList(list); }
/** * Gets an unmodifiable list of validators for this FormComponent. * * @return List of validators */
Gets an unmodifiable list of validators for this FormComponent
getValidators
{ "repo_name": "mafulafunk/wicket", "path": "wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java", "license": "apache-2.0", "size": 43022 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "org.apache.wicket.behavior.Behavior", "org.apache.wicket.validation.IValidator" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.wicket.behavior.Behavior; import org.apache.wicket.validation.IValidator;
import java.util.*; import org.apache.wicket.behavior.*; import org.apache.wicket.validation.*;
[ "java.util", "org.apache.wicket" ]
java.util; org.apache.wicket;
2,437,448
public static InstantType withCurrentTime() { return new InstantType(new Date(), TemporalPrecisionEnum.MILLI, TimeZone.getDefault()); }
static InstantType function() { return new InstantType(new Date(), TemporalPrecisionEnum.MILLI, TimeZone.getDefault()); }
/** * Factory method which creates a new InstantDt with millisecond precision and initializes it with the * current time and the system local timezone. */
Factory method which creates a new InstantDt with millisecond precision and initializes it with the current time and the system local timezone
withCurrentTime
{ "repo_name": "Cloudyle/hapi-fhir", "path": "hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/InstantType.java", "license": "apache-2.0", "size": 7086 }
[ "java.util.Date", "java.util.TimeZone" ]
import java.util.Date; import java.util.TimeZone;
import java.util.*;
[ "java.util" ]
java.util;
2,540,317
public Iterable<? extends EntityId> getOwners() { return owners; }
Iterable<? extends EntityId> function() { return owners; }
/** * Returns a list of ID who owns this program context. */
Returns a list of ID who owns this program context
getOwners
{ "repo_name": "caskdata/cdap", "path": "cdap-app-fabric/src/main/java/co/cask/cdap/internal/app/runtime/AbstractContext.java", "license": "apache-2.0", "size": 13774 }
[ "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;
2,731,763
private static void loadVariables( CommandLine commandLine, StellarShellExecutor executor) throws IOException { if(commandLine.hasOption("v")) { // load variables defined in a file String variablePath = commandLine.getOptionValue("v"); Map<String, Object> variables = JSONUtils.INSTANCE.load( new File(variablePath), JSONUtils.MAP_SUPPLIER); // for each variable... for(Map.Entry<String, Object> kv : variables.entrySet()) { String variable = kv.getKey(); Object value = kv.getValue(); // define the variable - no expression available executor.assign(variable, value, Optional.empty()); } } }
static void function( CommandLine commandLine, StellarShellExecutor executor) throws IOException { if(commandLine.hasOption("v")) { String variablePath = commandLine.getOptionValue("v"); Map<String, Object> variables = JSONUtils.INSTANCE.load( new File(variablePath), JSONUtils.MAP_SUPPLIER); for(Map.Entry<String, Object> kv : variables.entrySet()) { String variable = kv.getKey(); Object value = kv.getValue(); executor.assign(variable, value, Optional.empty()); } } }
/** * Loads any variables defined in an external file. * @param commandLine The command line arguments. * @param executor The stellar executor. * @throws IOException */
Loads any variables defined in an external file
loadVariables
{ "repo_name": "JonZeolla/metron", "path": "metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/shell/cli/StellarShell.java", "license": "apache-2.0", "size": 14455 }
[ "java.io.File", "java.io.IOException", "java.util.Map", "java.util.Optional", "org.apache.commons.cli.CommandLine", "org.apache.metron.stellar.common.shell.StellarShellExecutor", "org.apache.metron.stellar.common.utils.JSONUtils" ]
import java.io.File; import java.io.IOException; import java.util.Map; import java.util.Optional; import org.apache.commons.cli.CommandLine; import org.apache.metron.stellar.common.shell.StellarShellExecutor; import org.apache.metron.stellar.common.utils.JSONUtils;
import java.io.*; import java.util.*; import org.apache.commons.cli.*; import org.apache.metron.stellar.common.shell.*; import org.apache.metron.stellar.common.utils.*;
[ "java.io", "java.util", "org.apache.commons", "org.apache.metron" ]
java.io; java.util; org.apache.commons; org.apache.metron;
2,253,675
public boolean parse(String calibrationURL) throws ParseException { this.calibrationURL = calibrationURL; this.calibrationsMap = new HashMap<String, BasicHierarchicalMap>(); int count = 0; // track lines in the file int coeffCount = 0; // track current number of coefficient lines boolean success = false; // track parsing success String key = ""; // unique identifier String line; // current line being parsed String[] parts; // array of current line fields String type; // placeholder calibration field String id; // placeholder calibration field String units; // placeholder calibration field Integer fieldLength; // placeholder calibration field String dataType; // placeholder calibration field Integer coeffLines; // placeholder calibration field String fitType; // placeholder calibration field Double coefficient; // placeholder calibration field try { // open the calibration URL for reading URL calibrationFile = new URL(this.calibrationURL); BufferedReader inputReader = new BufferedReader( new InputStreamReader( calibrationFile.openStream())); this.calibrationLines = new ArrayList<String>(); // and read each line while ((line = inputReader.readLine()) != null) { // extract each line of the file this.calibrationLines.add(line); count++; } // end while() inputReader.close(); // parse non-empty lines or those without comments for (Iterator cIterator = calibrationLines.iterator(); cIterator.hasNext();) { line = ((String) cIterator.next()).trim(); // handle sensor definition lines if ( line.matches("^[A-Za-z].*") ) { parts = line.split(" "); key = parts[1].toUpperCase().equals("NONE") ? parts[0] : parts[0] + "_" + parts[1]; type = parts[0]; id = parts[1]; units = parts[2].replaceAll("'", ""); fieldLength = new Integer(parts[3]); dataType = parts[4]; coeffLines = new Integer(parts[5]); fitType = parts[6]; if ( coeffCount == 0 ) { // create a new calibration entry this.calibrationMap = new BasicHierarchicalMap(); coeffCount = coeffLines; } // populate the map this.calibrationMap.put("calibration/type", type); this.calibrationMap.put("calibration/id", id); this.calibrationMap.put("calibration/units", units); this.calibrationMap.put("calibration/fieldLength", fieldLength); this.calibrationMap.put("calibration/dataType", dataType); this.calibrationMap.put("calibration/coeffLines", coeffLines); this.calibrationMap.put("calibration/fitType", fitType); //log.debug(this.calibrationMap.toXMLString(1000)); // add the map if there are no more coefficient lines if ( coeffCount == 0 ) { this.calibrationsMap.put(key, (BasicHierarchicalMap) this.calibrationMap.clone()); this.calibrationMap.removeAll("*"); } // handle coefficient lines } else if ( line.matches("^[0-9].*") ){ parts = line.split(" "); // extract each coefficient and add it to the map for ( int j=0; j < parts.length; j++ ) { coefficient = new Double(parts[j]); this.calibrationMap.add("calibration/coefficient", coefficient); } coeffCount--; // add the map if there are no more coefficient lines if ( coeffCount == 0 ) { this.calibrationsMap.put(key, (BasicHierarchicalMap) this.calibrationMap.clone()); this.calibrationMap.removeAll("*"); } // handle comments and blank lines } else if ( line.matches("^#.*") || line.matches("^$") ) { //log.debug("Skipping blank or commented calibration file lines."); } // end if() } // end for() success = true; } catch ( NumberFormatException nfe ) { throw new ParseException("There was a problem parsing" + " the calibration line string: " + nfe.getMessage(), 0); } catch (IOException ioe) { throw new ParseException("There was a problem reading the calibration file " + "from " + this.calibrationURL + ": " + ioe.getMessage(), 0); } // end try/catch //log.debug(this.calibrationsMap.toString()); return success; }
boolean function(String calibrationURL) throws ParseException { this.calibrationURL = calibrationURL; this.calibrationsMap = new HashMap<String, BasicHierarchicalMap>(); int count = 0; int coeffCount = 0; boolean success = false; String key = STR^[A-Za-z].*STR STRNONESTR_STR'STRSTRcalibration/typeSTRcalibration/idSTRcalibration/unitsSTRcalibration/fieldLengthSTRcalibration/dataTypeSTRcalibration/coeffLinesSTRcalibration/fitTypeSTR*STR^[0-9].*STR STRcalibration/coefficientSTR*STR^#.*STR^$STRThere was a problem parsingSTR the calibration line string: STRThere was a problem reading the calibration file STRfrom STR: " + ioe.getMessage(), 0); } return success; }
/** * A method that parses a Satlantic calibration or telemetry definition file. * * @param calibrationURL the URL of the calibration or telementry definition file * @return parsed - True if the file is parsed * @throws ParseException - parse exception */
A method that parses a Satlantic calibration or telemetry definition file
parse
{ "repo_name": "csjx/realtime-data", "path": "src/main/java/edu/hawaii/soest/hioos/satlantic/Calibration.java", "license": "gpl-2.0", "size": 22689 }
[ "java.text.ParseException", "java.util.HashMap", "org.dhmp.util.BasicHierarchicalMap" ]
import java.text.ParseException; import java.util.HashMap; import org.dhmp.util.BasicHierarchicalMap;
import java.text.*; import java.util.*; import org.dhmp.util.*;
[ "java.text", "java.util", "org.dhmp.util" ]
java.text; java.util; org.dhmp.util;
1,024,831
public List<DiffEntry> compute(ObjectReader reader, ProgressMonitor pm) throws IOException { final ContentSource cs = ContentSource.create(reader); return compute(new ContentSource.Pair(cs, cs), pm); }
List<DiffEntry> function(ObjectReader reader, ProgressMonitor pm) throws IOException { final ContentSource cs = ContentSource.create(reader); return compute(new ContentSource.Pair(cs, cs), pm); }
/** * Detect renames in the current file set. * * @param reader * reader to obtain objects from the repository with. * @param pm * report progress during the detection phases. * @return an unmodifiable list of {@link DiffEntry}s representing all files * that have been changed. * @throws IOException * file contents cannot be read from the repository. */
Detect renames in the current file set
compute
{ "repo_name": "DanielliUrbieta/ProjetoHidraWS", "path": "src/org/eclipse/jgit/diff/RenameDetector.java", "license": "gpl-2.0", "size": 22105 }
[ "java.io.IOException", "java.util.List", "org.eclipse.jgit.lib.ObjectReader", "org.eclipse.jgit.lib.ProgressMonitor" ]
import java.io.IOException; import java.util.List; import org.eclipse.jgit.lib.ObjectReader; import org.eclipse.jgit.lib.ProgressMonitor;
import java.io.*; import java.util.*; import org.eclipse.jgit.lib.*;
[ "java.io", "java.util", "org.eclipse.jgit" ]
java.io; java.util; org.eclipse.jgit;
1,726,574
ExtinguishRequest finishCurrentUnitLoad(ExtinguishRequest req, String transfer) throws PickingException, LOSLocationException, ReportException, FacadeException;
ExtinguishRequest finishCurrentUnitLoad(ExtinguishRequest req, String transfer) throws PickingException, LOSLocationException, ReportException, FacadeException;
/** * At the end of the picking process or whenever the UnitLoad to which goods * are picked becomes full, it is transported to the transfer or goods out * location. * * @param req * @param transfer * @return * @throws PickingException * @throws LOSLocationException * @throws FacadeException */
At the end of the picking process or whenever the UnitLoad to which goods are picked becomes full, it is transported to the transfer or goods out location
finishCurrentUnitLoad
{ "repo_name": "tedvals/mywms", "path": "server.app/los.inventory-ejb/src/de/linogistix/los/inventory/facade/ExtinguishFacade.java", "license": "gpl-3.0", "size": 4238 }
[ "de.linogistix.los.inventory.pick.exception.PickingException", "de.linogistix.los.inventory.pick.model.ExtinguishRequest", "de.linogistix.los.location.exception.LOSLocationException", "de.linogistix.los.report.businessservice.ReportException", "org.mywms.facade.FacadeException" ]
import de.linogistix.los.inventory.pick.exception.PickingException; import de.linogistix.los.inventory.pick.model.ExtinguishRequest; import de.linogistix.los.location.exception.LOSLocationException; import de.linogistix.los.report.businessservice.ReportException; import org.mywms.facade.FacadeException;
import de.linogistix.los.inventory.pick.exception.*; import de.linogistix.los.inventory.pick.model.*; import de.linogistix.los.location.exception.*; import de.linogistix.los.report.businessservice.*; import org.mywms.facade.*;
[ "de.linogistix.los", "org.mywms.facade" ]
de.linogistix.los; org.mywms.facade;
2,825,651
public void deleteProperty(String name) { String[] propName = parsePropertyName(name); // Search for this property by traversing down the XML heirarchy. Element element = doc.getRootElement(); for (int i = 0; i < propName.length - 1; i++) { element = element.getChild(propName[i]); // Can't find the property so return. if (element == null) { return; } } // Found the correct element to remove, so remove it... element.removeChild(propName[propName.length - 1]); }
void function(String name) { String[] propName = parsePropertyName(name); Element element = doc.getRootElement(); for (int i = 0; i < propName.length - 1; i++) { element = element.getChild(propName[i]); if (element == null) { return; } } element.removeChild(propName[propName.length - 1]); }
/** * Deletes the specified property. * * @param name * the property to delete. */
Deletes the specified property
deleteProperty
{ "repo_name": "linqingyicen/jdonframework", "path": "src/main/java/com/jdon/util/jdom/XMLProperties.java", "license": "apache-2.0", "size": 8237 }
[ "org.jdom.Element" ]
import org.jdom.Element;
import org.jdom.*;
[ "org.jdom" ]
org.jdom;
642,214
protected String getApprovalViewName() { return OAuth20Constants.CONFIRM_VIEW; }
String function() { return OAuth20Constants.CONFIRM_VIEW; }
/** * Gets approval view name. * * @return the approval view name */
Gets approval view name
getApprovalViewName
{ "repo_name": "petracvv/cas", "path": "support/cas-server-support-oauth/src/main/java/org/apereo/cas/support/oauth/web/views/OAuth20ConsentApprovalViewResolver.java", "license": "apache-2.0", "size": 3654 }
[ "org.apereo.cas.support.oauth.OAuth20Constants" ]
import org.apereo.cas.support.oauth.OAuth20Constants;
import org.apereo.cas.support.oauth.*;
[ "org.apereo.cas" ]
org.apereo.cas;
765,331
public void setICID(String icid) throws ParseException { if (icid == null) throw new NullPointerException( "JAIN-SIP Exception, " + "P-Charging-Vector, setICID(), the icid parameter is null."); setParameter(ParameterNamesIms.ICID_VALUE, icid); }
void function(String icid) throws ParseException { if (icid == null) throw new NullPointerException( STR + STR); setParameter(ParameterNamesIms.ICID_VALUE, icid); }
/** * <p> * Set the icid-value parameter * </p> * * @param icid - * value to set in the icid-value parameter * @throws ParseException */
Set the icid-value parameter
setICID
{ "repo_name": "fhg-fokus-nubomedia/ims-connector", "path": "src/main/java/gov/nist/javax/sip/header/ims/PChargingVector.java", "license": "apache-2.0", "size": 6536 }
[ "gov.nist.javax.sip.header.ims.ParameterNamesIms", "java.text.ParseException" ]
import gov.nist.javax.sip.header.ims.ParameterNamesIms; import java.text.ParseException;
import gov.nist.javax.sip.header.ims.*; import java.text.*;
[ "gov.nist.javax", "java.text" ]
gov.nist.javax; java.text;
2,604,100
public Optional<SetOperationNode> merge() { checkState(node instanceof UnionNode || node instanceof IntersectNode, "unexpected node type: %s", node.getClass().getSimpleName()); Lookup lookup = context.getLookup(); List<PlanNode> sources = node.getSources().stream() .flatMap(lookup::resolveGroup) .collect(Collectors.toList()); ImmutableListMultimap.Builder<Symbol, Symbol> newMappingsBuilder = ImmutableListMultimap.builder(); boolean resultIsDistinct = false; boolean rewritten = false; for (int i = 0; i < sources.size(); i++) { PlanNode source = sources.get(i); // Determine if set operations can be merged and whether the resulting set operation is quantified DISTINCT or ALL Optional<Boolean> mergedQuantifier = mergedQuantifierIsDistinct(node, source); if (mergedQuantifier.isPresent()) { addMergedMappings((SetOperationNode) source, i, newMappingsBuilder); resultIsDistinct |= mergedQuantifier.get(); rewritten = true; } else { // Keep mapping as it is addOriginalMappings(source, i, newMappingsBuilder); } } if (!rewritten) { return Optional.empty(); } if (node instanceof UnionNode) { return Optional.of(new UnionNode(node.getId(), newSources, newMappingsBuilder.build(), node.getOutputSymbols())); } return Optional.of(new IntersectNode(node.getId(), newSources, newMappingsBuilder.build(), node.getOutputSymbols(), resultIsDistinct)); }
Optional<SetOperationNode> function() { checkState(node instanceof UnionNode node instanceof IntersectNode, STR, node.getClass().getSimpleName()); Lookup lookup = context.getLookup(); List<PlanNode> sources = node.getSources().stream() .flatMap(lookup::resolveGroup) .collect(Collectors.toList()); ImmutableListMultimap.Builder<Symbol, Symbol> newMappingsBuilder = ImmutableListMultimap.builder(); boolean resultIsDistinct = false; boolean rewritten = false; for (int i = 0; i < sources.size(); i++) { PlanNode source = sources.get(i); Optional<Boolean> mergedQuantifier = mergedQuantifierIsDistinct(node, source); if (mergedQuantifier.isPresent()) { addMergedMappings((SetOperationNode) source, i, newMappingsBuilder); resultIsDistinct = mergedQuantifier.get(); rewritten = true; } else { addOriginalMappings(source, i, newMappingsBuilder); } } if (!rewritten) { return Optional.empty(); } if (node instanceof UnionNode) { return Optional.of(new UnionNode(node.getId(), newSources, newMappingsBuilder.build(), node.getOutputSymbols())); } return Optional.of(new IntersectNode(node.getId(), newSources, newMappingsBuilder.build(), node.getOutputSymbols(), resultIsDistinct)); }
/** * Merge all matching source nodes. This method is assumed to be used only for associative set operations: UNION and INTERSECT. * * @return Merged plan node if applied. */
Merge all matching source nodes. This method is assumed to be used only for associative set operations: UNION and INTERSECT
merge
{ "repo_name": "erichwang/presto", "path": "presto-main/src/main/java/io/prestosql/sql/planner/iterative/rule/SetOperationMerge.java", "license": "apache-2.0", "size": 8721 }
[ "com.google.common.base.Preconditions", "com.google.common.collect.ImmutableListMultimap", "io.prestosql.sql.planner.Symbol", "io.prestosql.sql.planner.iterative.Lookup", "io.prestosql.sql.planner.plan.IntersectNode", "io.prestosql.sql.planner.plan.PlanNode", "io.prestosql.sql.planner.plan.SetOperationNode", "io.prestosql.sql.planner.plan.UnionNode", "java.util.List", "java.util.Optional", "java.util.stream.Collectors" ]
import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableListMultimap; import io.prestosql.sql.planner.Symbol; import io.prestosql.sql.planner.iterative.Lookup; import io.prestosql.sql.planner.plan.IntersectNode; import io.prestosql.sql.planner.plan.PlanNode; import io.prestosql.sql.planner.plan.SetOperationNode; import io.prestosql.sql.planner.plan.UnionNode; import java.util.List; import java.util.Optional; import java.util.stream.Collectors;
import com.google.common.base.*; import com.google.common.collect.*; import io.prestosql.sql.planner.*; import io.prestosql.sql.planner.iterative.*; import io.prestosql.sql.planner.plan.*; import java.util.*; import java.util.stream.*;
[ "com.google.common", "io.prestosql.sql", "java.util" ]
com.google.common; io.prestosql.sql; java.util;
1,908,653
public void addInterface() { Object target = getTarget(); if (Model.getFacade().isANamespace(target)) { Object ns = target; Object ownedElem = Model.getCoreFactory().createInterface(); Model.getCoreHelper().addOwnedElement(ns, ownedElem); TargetManager.getInstance().setTarget(ownedElem); } }
void function() { Object target = getTarget(); if (Model.getFacade().isANamespace(target)) { Object ns = target; Object ownedElem = Model.getCoreFactory().createInterface(); Model.getCoreHelper().addOwnedElement(ns, ownedElem); TargetManager.getInstance().setTarget(ownedElem); } }
/** * Create a new interface. */
Create a new interface
addInterface
{ "repo_name": "ckaestne/LEADT", "path": "workspace/argouml_critics/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelNamespace.java", "license": "gpl-3.0", "size": 4212 }
[ "org.argouml.model.Model", "org.argouml.ui.targetmanager.TargetManager" ]
import org.argouml.model.Model; import org.argouml.ui.targetmanager.TargetManager;
import org.argouml.model.*; import org.argouml.ui.targetmanager.*;
[ "org.argouml.model", "org.argouml.ui" ]
org.argouml.model; org.argouml.ui;
857,789
private Procedureable loadProcedure(String className) { logger.debug("try to load " + className); List<URL> jars = listJarFiles(); ClassLoader classLoader = URLClassLoader.newInstance( jars.toArray(new URL[] {})); try { Class<?> procedure = Class.forName(className, true, classLoader); Class<?>[] interfaces = procedure.getInterfaces(); boolean implementsProcedure = false; for (Class<?> i : interfaces) { if (i.getClass() == Procedureable.class.getClass()) { implementsProcedure = true; } } if (implementsProcedure) { Procedureable p = (Procedureable)procedure.newInstance(); return p; } else { logger.warn(className + " does not implement " + Procedureable.class.getName()); } } catch (ClassNotFoundException e) { logger.warn("could not load " + className + ": " + e); } catch (InstantiationException e) { logger.warn("could not initialize " + className + ": " + e); } catch (IllegalAccessException e) { logger.warn("could not access " + className + ": " + e); } // loading failed return null return null; }
Procedureable function(String className) { logger.debug(STR + className); List<URL> jars = listJarFiles(); ClassLoader classLoader = URLClassLoader.newInstance( jars.toArray(new URL[] {})); try { Class<?> procedure = Class.forName(className, true, classLoader); Class<?>[] interfaces = procedure.getInterfaces(); boolean implementsProcedure = false; for (Class<?> i : interfaces) { if (i.getClass() == Procedureable.class.getClass()) { implementsProcedure = true; } } if (implementsProcedure) { Procedureable p = (Procedureable)procedure.newInstance(); return p; } else { logger.warn(className + STR + Procedureable.class.getName()); } } catch (ClassNotFoundException e) { logger.warn(STR + className + STR + e); } catch (InstantiationException e) { logger.warn(STR + className + STR + e); } catch (IllegalAccessException e) { logger.warn(STR + className + STR + e); } return null; }
/** * Try to load a class with the given name and returns a fresh instance * of that class. If loading fails, <code>null</code> is returned. */
Try to load a class with the given name and returns a fresh instance of that class. If loading fails, <code>null</code> is returned
loadProcedure
{ "repo_name": "MReichenbach/irondetect", "path": "src/main/java/de/hshannover/f4/trust/irondetect/procedure/ProcedureRepository.java", "license": "apache-2.0", "size": 6254 }
[ "java.net.URLClassLoader", "java.util.List" ]
import java.net.URLClassLoader; import java.util.List;
import java.net.*; import java.util.*;
[ "java.net", "java.util" ]
java.net; java.util;
2,022,011
private void updateNear(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) { assert nearEnabled; if (res.remapKeys() != null || !req.hasPrimary()) return; GridNearAtomicCache near = (GridNearAtomicCache)cctx.dht().near(); near.processNearAtomicUpdateResponse(req, res); }
void function(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res) { assert nearEnabled; if (res.remapKeys() != null !req.hasPrimary()) return; GridNearAtomicCache near = (GridNearAtomicCache)cctx.dht().near(); near.processNearAtomicUpdateResponse(req, res); }
/** * Updates near cache. * * @param req Update request. * @param res Update response. */
Updates near cache
updateNear
{ "repo_name": "tkpanther/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicSingleUpdateFuture.java", "license": "apache-2.0", "size": 22093 }
[ "org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache" ]
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache;
import org.apache.ignite.internal.processors.cache.distributed.near.*;
[ "org.apache.ignite" ]
org.apache.ignite;
602,463