id stringlengths 7 14 | text stringlengths 1 37.2k |
|---|---|
13621351_1 | @Override
@Transactional(readOnly = true)
public CustomRepository findByName(String name) {
return customRepositoryRepository.findByName(name);
} |
13630800_7 | public List<Position> getPoints () {
return _points;
} |
13651430_68 | public static DesiredRateReadWriteExpression<?, Object> formula(String formula) {
DesiredRateExpression<?> exp = parseFormula(formula);
if (exp instanceof LastOfChannelExpression) {
return new DesiredRateReadWriteExpressionImpl<>(exp, org.diirt.datasource.vtype.ExpressionLanguage.vType(exp.getName()));... |
13655913_1 | public static Key get(int size) {
return new Key().allocate(size);
} |
13660977_8 | public X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String... domainNames) throws AcmeException {
return obtainCertificateChain(account, staging, null, -1, domainNames);
} |
13687370_0 | @Override
public void apply(final Project project) {
project.getPlugins().apply(GwtCompilerPlugin.class);
project.getPlugins().withType(WarPlugin.class,
(warPlugin) -> project.getPlugins().apply(GwtWarPlugin.class));
} |
13702023_0 | public static String implode(String delimiter, String[] strings)
{
if (strings.length == 0)
{
return "";
}
else
{
StringBuilder sb = new StringBuilder(strings[0]);
for (int i = 1; i < strings.length; i++)
{
sb.append(delimiter).append(strings[i]);
... |
13703429_3 | @Override
protected void encode(ChannelHandlerContext chc, UnsubscribeMessage message, ByteBuf out) {
if (message.topics().isEmpty()) {
throw new IllegalArgumentException("Found an unsubscribe message with empty topics");
}
if (message.getQos() != AbstractMessage.QOSType.LEAST_ONE) {
throw ... |
13719326_26 | @Metered(name = "meteredMethod")
public void meteredMethod() {
} |
13745124_126 | @Override
public void set(File file, String view, String attribute, Object value, boolean create) {
if (supports(attribute)) {
checkNotCreate(view, attribute, create);
file.setAttribute("dos", attribute, checkType(view, attribute, value, Boolean.class));
}
} |
13796699_2 | public String getSomeThing(String urlStr) throws IOException {
URL url = new URL(urlStr);
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
urlConn.setConnectTimeout(3000);
urlConn.setRequestMethod("GET");
urlConn.connect();
InputStream ins = null;
try {
if (... |
13853693_43 | @Privileged
static void throwAwayProperty(int first, String middle, char last) {
System.getProperty(new StringBuilder().append((char) first).append(middle).append(last).toString());
} |
13865967_128 | public Type getType() {
return type;
} |
13867926_47 | public void create(String tebase) throws TEException {
File f = new File(tebase);
if (f.exists()) {
try {
process(tebase);
} catch (Exception e) {
e.printStackTrace();
}
} else {
throw new TEBaseNotFoundException(tebase);
}
} |
13869700_0 | public boolean compare(String a, String b){
return true;
} |
13870893_182 | void close() {
for (DeleteOperation op : deleteOperations) {
// There is a rare scenario where the operation gets removed from this set and gets completed concurrently by
// the RequestResponseHandler thread when it is in poll() or handleResponse(). In order to avoid the completion
// from happening twice... |
13873695_72 | @Override
public T next() {
T next;
do {
next = delegate.next();
} while (!predicate.apply(next));
return next;
} |
13886663_2 | public void loadImage() throws IOException {
if (Files.exists(getFilepath()) && Files.isRegularFile(getFilepath())) {
InputStream inStream = Files.newInputStream(persistablePath.getPath());
loadImage(inStream);
return;
}
throw new IOException("Image at " + getFilepath().toString() + ... |
13893381_10 | public static String ConvertArabicToLetters(int num) {
String letters = "";
while (num > 0) {
num--;
letters = Character.toString((char) (65 + (num % 26))) + letters;
num = num / 26;
}
return letters.toString();
} |
13907695_14 | public Rectangle newSize(Size aNewSize) {
return new Rectangle(position, aNewSize);
} |
13910968_3 | public void deleteTodo(Long id) {
todoRepository.delete(id);
} |
13928240_0 | public static boolean isI18NextKeyCandidate(CharSequence key) {
if (key != null && key.length() > 0) {
return key.toString().matches("([a-z0-9]+((\\_)([a-z0-9]+))*)+((\\.)[a-z0-9]+((\\_)([a-z0-9]+))*)+");
} else {
return false;
}
} |
13968244_38 | @Override
public Properties process(Properties in) {
Properties out = new Properties();
for (Entry<Object, Object> entry : in.entrySet()) {
Matcher wordMatcher = Pattern.compile(PropertiesKeywords.GENERATE_WORD_REGEX.getKey()).matcher(entry.getValue().toString());
Matcher numberMatcher = Pattern... |
14057993_4 | @Override
public int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) {
try {
final RangeFilterBuilder filter = rangeFilter("_id").gte(startkey);
final SearchResponse response = client.prepareSearch(indexKey)
.setT... |
14066577_215 | public void selectModeChanged(org.apache.pivot.wtk.TreeView arg0, org.apache.pivot.wtk.TreeView.SelectMode arg1) {
if (selectModeChanged != null) {
selectModeChanged.call(arg0, arg1);
}
} |
14082560_31 | @Override
public Set<Operation<E>> findOperationsProducing(E output) {
Map<E,T> sources = matchGraph.getSourceElementsThatMatch(output);
// For each target, get the services that uses the input
Set<Operation<E>> relevantOps = new HashSet<Operation<E>>();
for(E source : sources.keySet()){
Iterabl... |
14083998_16 | public List<Edge> getEdges() {
List<Edge> edges = new ArrayList<>();
for (Class<?> clazz : classes) {
Class<?> superclass = clazz.getSuperclass();
if (isDomainClass(superclass)) {
DomainObject child = new DomainObject(clazz);
DomainObject parent = new DomainObject(supercl... |
14094143_12 | public boolean match(final File file) {
boolean result = doMmatch(file);
return filterType == INCLUDE ? result : !result;
} |
14104548_0 | ClassInfo createClassInfo(Class<?> c) {
return createClassInfo(c, Collections.<String>emptySet(), false);
} |
14105280_19 | URI getTargetJsFileUri(URI uri) throws URISyntaxException {
String path = uri.getPath() + File.separator + config.getWorkflowName() + ".js";
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(),
uri.getPort(), path, uri.getQuery(), uri.getFragment());
} |
14106147_7 | @Nullable
@Override
public List<V> update(@Nonnull List<V> values) {
if (values == ThreadSafeMultimap.NO_VALUE) {
return null;
} else if (!Iterables.contains(values, newObject)) {
final List<V> result = ThreadSafeMultimap.copy(values);
result.add(newObject);
return result;
} else {
return null;
}
} |
14135467_11 | public <E extends Exception> void doUntilSuccess(final ExceptionalSupplier<Boolean, E> task)
throws InterruptedException, BackoffStoppedException, E {
doUntilResult(() -> {
Boolean result = task.get();
return Boolean.TRUE.equals(result) ? result : null;
});
} |
14135469_6 | @Override
public void execute() throws MojoExecutionException {
final JobOperator jobOperator = getOrCreateOperator();
final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
final ClassLoader loader = createStartLoader(oldLoader);
Thread.currentThread().setContextClassLoader(load... |
14135471_81 | @Override
public void resetToVersion( final String pluginName, final int version ) {
Preconditions.checkNotNull( pluginName, "pluginName cannot be null" );
final MigrationPlugin plugin = migrationPlugins.get( pluginName );
Preconditions.checkArgument( plugin != null, "Plugin " + pluginName + " could not b... |
14142718_56 | public Property getContainerProperty(Object itemId, Object propertyId) {
Item item = getItem(itemId);
return item == null ? null : item.getItemProperty(propertyId);
} |
14145700_383 | @Override
public boolean evaluate(QueryEvaluationContext ctx) {
ctx.setResult(false);
Object value = rvalue.getValue();
LOGGER.debug("evaluate {} {} {}", field, operator, value);
KeyValueCursor<Path, JsonNode> cursor = ctx.getNodes(field);
boolean fieldValueExists = false;
while (cursor.hasNext(... |
14173210_42 | @Override
public IPacket deserialize(byte[] data, int offset, int length)
throws PacketParsingException {
ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
int magic = bb.getInt();
if (magic != BSN_MAGIC) {
throw new PacketParsingException("Invalid BSN magic " + magic);
}
this... |
14176513_11 | String prettyPrintType(final Type type) {
if(type instanceof Class) {
return ((Class<?>) type).getSimpleName();
}
if(type instanceof ParameterizedType) {
final ParameterizedType paramType = (ParameterizedType) type;
return getUnqualifiedClassName(paramType.getRawType().getTypeName()) +
Arrays
.stream(pa... |
14202062_0 | public GetFlights(WebServiceMessageFactory messageFactory) {
super(messageFactory);
} |
14212940_20 | public synchronized boolean checkAndCreateLeaseForNewShards(@NonNull final ShardDetector shardDetector,
final LeaseRefresher leaseRefresher, final InitialPositionInStreamExtended initialPosition,
final MetricsScope scope, final boolean ignoreUnexpectedChildShards, final boolean isLeaseTableEmpty)
... |
14230404_5 | public static PropertyMatchers overriddenMatchers(String property, Matcher matcher) {
return new PropertyMatchers(newHashSet(entryOf(property, matcher)));
} |
14277656_3 | public static Uri uriTransactions() {
return uriModels(TransactionsProvider.class, Tables.Transactions.TABLE_NAME);
} |
14279760_53 | @Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView = convertView == null ? createView(parent) : (TextView) convertView;
textView.setText(names.get(position));
return textView;
} |
14281190_10 | @SuppressWarnings("unchecked")
private SpscChannelConsumer<E> newConsumer(Object... args) {
return mapper.newFlyweight(SpscChannelConsumer.class, "ChannelConsumerTemplate.java",
Template.fromFile(Channel.class, "ChannelConsumerTemplate.java"), args);
} |
14281911_49 | static Position centerOfVessel(Position aisPosition, float hdg, int dimStern, int dimBow, int dimPort, int dimStarboard) {
// Compute direction of half axis alpha
final double thetaDeg = compass2cartesian(hdg);
// Transform latitude/longitude to cartesian coordinates
final Position geodeticReference = ... |
14285346_4 | public String[] getColumnValues(ResultSet rs) throws SQLException, IOException {
return this.getColumnValues(rs, false, DEFAULT_DATE_FORMAT, DEFAULT_TIMESTAMP_FORMAT);
} |
14290433_1 | @Override
public String getPartition() {
return "";
} |
14305692_432 | @EventHandler
public void handle(ChargingStationCreatedEvent event) {
LOG.debug("ChargingStationCreatedEvent creates [{}] in operator api repo", event.getChargingStationId());
ChargingStation station = new ChargingStation(event.getChargingStationId().getId());
repository.createOrUpdate(station);
} |
14333932_44 | public static RealMatrix transposeTimesSelf(LongObjectMap<float[]> M) {
if (M == null || M.isEmpty()) {
return null;
}
RealMatrix result = null;
for (LongObjectMap.MapEntry<float[]> entry : M.entrySet()) {
float[] vector = entry.getValue();
int dimension = vector.length;
if (result == null) {
... |
14339501_680 | public Map<String, String> extract(InputStream xml, String[] fields) {
Map<String, String> parsedFields = Maps.newHashMap();
try {
DocumentBuilder documentBuilder = documentBuilderSupplier.get();
if (documentBuilder == null) {
logger.warn("Could not create DocumentBuilder");
return parsedFields;... |
14340523_7 | public String login() {
return isSuccess ? INDEX_PAGE : LOGIN_PAGE;
} |
14366444_0 | public static ILexLocation extractLocation(INode node)
{
try
{
Method method = node.getClass().getMethod("getLocation");
return (ILexLocation) method.invoke(node);
} catch (NoSuchMethodException | SecurityException
| IllegalAccessException | IllegalArgumentException
| InvocationTargetException e)
{
e.pr... |
14372507_0 | public boolean addAnnotations(InputStream inputClass, File outputClassFile, Collection<String> annotations)
throws Exception {
boolean classIsModified = false;
FileOutputStream outputClass = null;
ClassWriter cw = new ClassWriter(false);
try {
ClassReader cr = new ClassReader(inputClass);
... |
14377751_5 | public static String truncVal(String s) {
if (s == null) {
return "";
}
int len = Math.min(s.length(), 10);
String postfix = "";
if (s.length() > len) {
postfix = "...";
}
return s.substring(0, len) + postfix;
} |
14393731_0 | @ToJson public String toJson(Instant instant) {
return instant.toString();
} |
14398404_63 | public List<NotConsistentRelation> checkConsitency(String rootPid, boolean repair) throws IOException, ProcessSubtreeException, LexerException, RepositoryException {
TreeProcess deep = new TreeProcess(this.fedoraAccess);
this.fedoraAccess.processSubtree(rootPid, deep);
List<NotConsistentRelation> relations ... |
14401179_53 | public DetachedChannelPipeline addLast(String name, Func0<ChannelHandler> handlerFactory) {
return _guardedAddLast(new HandlerHolder(name, handlerFactory));
} |
14426728_4 | static String pluralize(String string) {
string = string.toLowerCase(Locale.US);
if (string.endsWith("s")) {
return string;
} else if (string.endsWith("ay")) {
return string.replaceAll("ay$", "ays");
} else if (string.endsWith("ey")) {
return string.replaceAll("ey$", "eys");
... |
14444698_1 | public void receive(MessageContext messageContext) throws Exception {
interceptingTemplate.interceptRequest(messageContext, wrappedMessageReceiver);
} |
14469879_4 | public static BoolVar boolVar(String id) {
return new BoolVar(id);
} |
14490363_74 | @Override
public boolean isDocumentExists(Long id) throws PropertyNotSetException {
DocumentDTO dto = findDocumentByID(id);
return dto != null ? true : false;
} |
14496551_2 | public static String collapseLineBreaks(String string) {
return replaceLineBreaks(string, EMPTY);
} |
14505236_4 | @Override
public void execute(WfsGetFeatureRequest request, WfsGetFeatureResponse response) throws Exception {
FeatureCollection<SimpleFeatureType, SimpleFeature> features = performWfsQuery(request);
int maxCoordinates = request.getMaxCoordsPerFeature();
double distance = 10;
// Note: features.getSchema() can be nu... |
14514251_160 | @Override
public boolean add(FilteredBlock block) throws VerificationException, PrunedException {
boolean success = super.add(block);
if (success) {
trackFilteredTransactions(block.getTransactionCount());
}
return success;
} |
14518795_0 | @Override
public DecisionType combine(DecisionType op1, DecisionType op2) {
if (op1 != DecisionType.NotApplicable) {
return op1;
}
if (op2 != DecisionType.NotApplicable) {
return op2;
}
return DecisionType.NotApplicable;
} |
14538599_0 | @Override
protected Object[] convertParameters(Object[] params) {
List<Object> converted = getBinding().getKeyBinding().getKeyParameters(Arrays.asList(params));
return converted.toArray(new Object[converted.size()]);
} |
14561598_13 | public VersionMatchResult matches(DeploymentInfo info) {
// Skip if no manifest configuration
if(info.getManifest() == null || info.getManifest().size() == 0) {
return VersionMatchResult.SKIPPED;
}
for (ManifestInfo manifest: info.getManifest()) {
VersionMatchResult result = match(... |
14567924_74 | public GDELTEvent parseLine(String gdeltTabDelimitedLine) throws ParseException {
String[] columns = gdeltTabDelimitedLine.split("\\t");
GDELTEvent event = new GDELTEvent();
List<Method> methods = getGDELTMethods(GDELTEvent.class);
for (Method method : methods) {
method.setAccessible(true);
... |
14573998_10 | public <R> Stream<T2<Optional<L>, R>> rightOuterJoin(Index<K, R> other) {
return matchAndMerge(other, rightOuterJoinMerger());
} |
14581444_89 | public static Result internalServerError() {
return status(Result.INTERNAL_SERVER_ERROR).noContentIfNone();
} |
14587858_44 | @Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
return true;
} |
14591946_17 | public List<File> resolve(RepositorySystemSession session, MavenProject project, List<Dependency> dependencies) throws MojoExecutionException {
// copy&paste from org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DependencyResolutionRequest)
// aether is sad, really sad
ArtifactTypeRegistry ste... |
14612017_22 | @Override
public void write(char[] cbuf, int off, int len) throws IOException
{
getEnclosingWriter().write(cbuf, off, len);
} |
14616420_40 | @Override
public Map<String, String> filterDeniedParams(final Map<String, String> unfiltered, final Channel channel) {
final Map<String, String> filtered = new HashMap<>(unfiltered.size());
for (Map.Entry<String, String> entry : unfiltered.entrySet()) {
if (shouldProcessParam(entry.getKey(), channel)) {
filtered... |
14631775_0 | public String pythonDict(Map<String,String> map) {
return buildMap(map,"{","}","\":\"",",");
} |
14640193_0 | public static Date parseLogcatTimeStamp(String line) {
Matcher matcher = LOGCAT_TIMESTAMP_PATTERN.matcher(line);
if (matcher.find()) {
int month = Integer.valueOf(matcher.group(1));
int day = Integer.valueOf(matcher.group(2));
int hour = Integer.valueOf(matcher.group(3));
int m... |
14660359_5 | @Override
public String getRevisionAndReposition(ByteBuffer payload) {
int version = payload.getInt();
if (version == PROTOCOL_VERSION){
int schemaVersionSize = payload.getInt();
byte [] stringSchema = new byte [schemaVersionSize];
payload.get(stringSchema);
String schemaVersion... |
14661616_12 | public int getTokenCount(){
return this.tokens.size();
} |
14696091_353 | public boolean matches(T target) {
return matcher.matches(target.getDeclaredMethods());
} |
14718267_48 | public static Label createStoryLabel(String story) {
return createLabel(LabelName.STORY, story);
} |
14734876_83 | @Override
public void applyGradient(Gradients gradients, long batchSize) {
BaseNetwork.ModelCounters modelCounters = getModelCounters();
int iterationCount = modelCounters.getIterationCount();
Gradient gradient = gradients.getGradient(gradientName);
model.getUpdater().update(model, gradient, iterationCo... |
14741882_14 | @Override
public int compareTo(ByteArray that) {
int thisLength = this.byteArrayValue().length;
int res = thisLength - that.byteArrayValue().length;
if (res != 0)
return res;
for (int i = 0; i < thisLength; i++) {
res = this.byteArrayValue()[i] - that.byteArrayValue()[i];
if (res... |
14755049_47 | public static HttpResponse httpGet(String url, int timeoutms)
throws IOException, URISyntaxException {
return httpGet(url, null, timeoutms);
} |
14759829_0 | @Override
public void send(C command) {
.log(Level.FINER, "send command: " + command.getClass());
Session session = null;
try {
session = createSession(connection);
MessageProducer publisher = createProducer(session, commandQueue);
Message message = createMessage(session, command);
... |
14775640_6 | public boolean perform(Class actionClass, Object... args)
throws ArgumentsValidationException {
Action action = getAction(actionClass);
if (action != null && action.isEnabled()) {
if (action.validate(args)) {
Gdx.app.debug("Controller",
ClassReflection.getSimpleName(actionClass)
+ prettyPrintArgs(a... |
14778255_0 | public final static Long makeByteValue(String value){
if(value == null || value.isEmpty()){
return null;
}
try{
String size = value;
long f = 1L;
// Using 1000 instead of 1024 to avoid multiplications
size = size.trim().toLowerCase();
if(size.endsWith(" b")){
size = size.substring(0, size.length() - 2... |
14792686_0 | public void querySongsByChannelId(ReportType songType, String currentSongId, int playTime, int channelId, BitRate bitRate, Callback callback) {
if(channelId== ChannelConstantIds.PRIVATE_CHANNEL
||channelId== ChannelConstantIds.FAV){
this.isAuthRequire=true;
}
apiGateway.makeRequest(new S... |
14793007_58 | @Override
public void configure(final Context context) {
driver = context.getString("driver");
Preconditions.checkNotNull(driver, "Driver must be specified.");
url = context.getString("url");
Preconditions.checkNotNull(url, "URL must be specified.");
user = context.getString("user");
Preconditions.checkNotN... |
14795578_4 | @Override
public void trim(IntPredicate aIsTrimChar) {
int begin = getBegin();
int end = getEnd();
String text = _casView.getDocumentText();
// If the span is empty, or there is no text, there is nothing to trim
if (begin == end || text == null) {
return;
}
final int saved_begin = begin;
fin... |
14804125_4 | public static String buildPath(String... paths) {
StringBuffer result = new StringBuffer();
for (int i = 0; i < paths.length; i++) {
String cur = paths[i];
int curLen = cur.length();
String next = null;
if (i < paths.length - 1) {
next = paths[i + 1];
}
... |
14807800_4 | private Split() {
} |
14829187_93 | public static boolean moveToTrash(URI uri) {
return deleteWithTrash(uri, true);
} |
14841479_3 | public static boolean pingHost(String host) throws IOException {
InetAddress inet = InetAddress.getByName(host);
return inet.isReachable(5000);
} |
14865444_43 | public static Object invoke(final Object instance, final Method method, final Object... args) {
Assertion.check()
.isNotNull(instance)
.isNotNull(method);
//-----
try {
return method.invoke(instance, args);
} catch (final IllegalAccessException e) {
throw WrappedException.wrap(e, "accès impossible à la mé... |
14882085_0 | @Override
public SiriusResult handleGet(String key) {
String value = RefAppState.repository.get(key);
if (value == null) {
return SiriusResult.none();
}
return SiriusResult.some(value);
} |
14884127_0 | public boolean isLengthComputable()
{
return 0 != _total;
} |
14892701_84 | public boolean equals(Object other)
{
if(!(other instanceof DGraph<?>))
return false;
DGraph<Object> oth = (DGraph<Object>) other;
if(! oth.level().equals(level()))
return false;
if(size() != oth.size())
return false;
if(numLinks() != oth.numLinks())
return false;
if(labels().size() != oth.labels... |
14894883_34 | public Map<Path,Object> decompose(Map<Path,Object> structures) {
if (structures == null) {
throw new IllegalArgumentException("structures is null");
}
Map<Path,Object> decomposed = new HashMap<Path,Object>(structures.size());
for (Map.Entry<Path,Object> entry : structures.entrySet()) {
... |
14920951_3 | public static void parseServiceMetadataString(String metadataField, Map<String, List<String>> metadata) {
StringBuffer sb = new StringBuffer(metadataField);
int dot = 0;
int nextEquals = sb.indexOf(EQUALS_STRING, dot);
while (nextEquals > 0) {
String key = sb.substring(dot, nextEquals);
... |
14965293_1 | public static int parseInt(ByteBuffer buf, byte delimiter) {
int sign = 1;
if (buf.get(buf.position()) == (byte)'-') {
buf.get();
sign = -1;
}
int result = 0;
for (;;) {
byte ch = buf.get();
if (ch == delimiter) {
break;
}
result *= 10;
result += (byte)ch - (byte)'0';
}
r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.