code stringlengths 114 1.05M | path stringlengths 3 312 | quality_prob float64 0.5 0.99 | learning_prob float64 0.2 1 | filename stringlengths 3 168 | kind stringclasses 1
value |
|---|---|---|---|---|---|
package seedu.address.model.event;
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.AppUtil.checkArgument;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.format.DateTimeParseException;
/**
* Represents an Event's date in the address book.
* Guarante... | src/main/java/seedu/address/model/event/EventDate.java | 0.921145 | 0.416144 | EventDate.java | starcoder |
package org.apache.gobblin.service.modules.flowgraph;
import java.util.Collection;
import org.apache.gobblin.annotation.Alpha;
import org.apache.gobblin.runtime.api.FlowSpec;
import org.apache.gobblin.service.modules.flow.FlowGraphPath;
import org.apache.gobblin.service.modules.flowgraph.pathfinder.PathFinder;
/**
... | gobblin-service/src/main/java/org/apache/gobblin/service/modules/flowgraph/FlowGraph.java | 0.925491 | 0.727613 | FlowGraph.java | starcoder |
public final class DataWriter {
private DataWriter(){}
public static final int writeByte(byte[] array, int offset, byte value, boolean consume){
if(consume){
array[offset] = value;
return offset + 1;
} else {
array[offset] |= value;
return offset;
}
}
public static final int... | src/generators/java/DataWriter.java | 0.568056 | 0.45417 | DataWriter.java | starcoder |
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class GridTest {
// http://codingdojo.org/cgi-bin/wiki.pl?KataGameOfLife
// 1. Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
// 2. Any live cell with more than thre... | tests/GridTest.java | 0.848361 | 0.768038 | GridTest.java | starcoder |
package org.compass.core;
import java.util.Locale;
/**
* An object representing a Compass query. The query is created using the
* {@link org.compass.core.CompassQueryBuilder}, and used to get the
* matching {@link org.compass.core.CompassHits}.
* <p>
* The query be sorted as well using one of the <code>addSort</... | src/main/src/org/compass/core/CompassQuery.java | 0.957695 | 0.550547 | CompassQuery.java | starcoder |
package gov.sandia.cognition.learning.algorithm.regression;
import gov.sandia.cognition.evaluator.Evaluator;
import gov.sandia.cognition.learning.algorithm.minimization.FunctionMinimizer;
import gov.sandia.cognition.learning.algorithm.minimization.FunctionMinimizerDirectionSetPowell;
import gov.sandia.cognition.learni... | Components/LearningCore/Source/gov/sandia/cognition/learning/algorithm/regression/ParameterDerivativeFreeCostMinimizer.java | 0.936103 | 0.606265 | ParameterDerivativeFreeCostMinimizer.java | starcoder |
package org.spongepowered.asm.mixin.injection.modify;
import org.spongepowered.asm.mixin.injection.code.*;
import org.spongepowered.asm.mixin.injection.*;
import java.util.*;
import org.spongepowered.asm.mixin.injection.throwables.*;
import org.spongepowered.asm.mixin.injection.struct.*;
import org.spongepowered.asm.l... | org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector.java | 0.826362 | 0.410874 | ModifyVariableInjector.java | starcoder |
package com.github.paganini2008.devtools.math;
import static com.github.paganini2008.devtools.NumberUtils.format;
import java.math.BigDecimal;
import java.math.BigInteger;
import com.github.paganini2008.devtools.ArrayUtils;
import com.github.paganini2008.devtools.Assert;
import com.github.paganini2008.devtools.Compa... | devtools-lang/src/main/java/com/github/paganini2008/devtools/math/BigIntegerUtils.java | 0.870735 | 0.555918 | BigIntegerUtils.java | starcoder |
package coursera.graphs.week3;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
public class Bipartite {
private static class Node {
List<Node> neighbours;
int value;
Node(int value)... | src/main/java/coursera/graphs/week3/Bipartite.java | 0.885817 | 0.415017 | Bipartite.java | starcoder |
package com.stuypulse.stuylib.control;
import com.stuypulse.stuylib.math.SLMath;
import com.stuypulse.stuylib.network.SmartNumber;
import com.stuypulse.stuylib.streams.filters.IFilter;
import com.stuypulse.stuylib.streams.filters.IFilterGroup;
import com.stuypulse.stuylib.streams.filters.TimedMovingAverage;
import co... | src/com/stuypulse/stuylib/control/PIDCalculator.java | 0.934768 | 0.453504 | PIDCalculator.java | starcoder |
package ch.fhnw.util.math.geometry;
import ch.fhnw.util.HashUtilities;
import ch.fhnw.util.math.MathUtilities;
import ch.fhnw.util.math.Vec3;
/**
* Basic plane representation. Loosely based on Apache Commons Math3. Immutable.
*
* @author radar
*
*/
public final class Plane {
private Vec3 origin;
private Vec3 ... | ether-core/src/main/java/ch/fhnw/util/math/geometry/Plane.java | 0.91636 | 0.63494 | Plane.java | starcoder |
package eu.isas.peptideshaker.export.exportfeatures;
import com.compomics.util.io.export.ExportFeature;
import java.util.ArrayList;
import java.util.Arrays;
/**
* This enum lists the export features linked to the validation process.
*
* @author <NAME>
*/
public enum PsValidationFeature implements Expor... | src/main/java/eu/isas/peptideshaker/export/exportfeatures/PsValidationFeature.java | 0.909847 | 0.652034 | PsValidationFeature.java | starcoder |
package net.finkn.inputspec.tools;
import static net.finkn.inputspec.tools.Unit.*;
import static org.junit.Assert.*;
import org.junit.Test;
public class GeneratorExceptionMessageTest {
private final String msg = "Custom static message.";
private final String toMsg = "Custom dynamic message.";
private final Gen... | test/src/net/finkn/inputspec/tools/GeneratorExceptionMessageTest.java | 0.877122 | 0.458652 | GeneratorExceptionMessageTest.java | starcoder |
package edu.nyu.vida.data_polygamy.scalar_function;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.HashMap;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import com.google.common.collect.ComparisonChain;
import edu.nyu.vida.data_polygam... | data-polygamy/src/main/java/edu/nyu/vida/data_polygamy/scalar_function/Gradient.java | 0.854278 | 0.401424 | Gradient.java | starcoder |
package androidx.media2.widget;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.RootMatchers.isPlatformPopup;
import static androidx.t... | media2/widget/src/androidTest/java/androidx/media2/widget/MediaControlView_WithPlayerTest.java | 0.709724 | 0.502563 | MediaControlView_WithPlayerTest.java | starcoder |
package com.github.daedalus.core.process;
import com.github.daedalus.core.data.DataParser;
import com.github.daedalus.core.data.DataMapping;
import com.github.daedalus.core.data.Document;
import com.github.daedalus.core.data.IncorrectTypeException;
import com.github.daedalus.core.stream.DataSource;
import java.util.*... | core/src/main/java/com/github/daedalus/core/process/Reshaper.java | 0.920191 | 0.426322 | Reshaper.java | starcoder |
package com.github.jessemull.microflex.doubleflex.math;
/* ------------------------------ Dependencies ------------------------------ */
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import com.github.jessemull.microflex.doubleflex.plate.PlateDouble;
import com... | src/main/java/com/github/jessemull/microflex/doubleflex/math/MathOperationDoubleBinary.java | 0.698946 | 0.463384 | MathOperationDoubleBinary.java | starcoder |
package com.softideas.weather.forecast.api.domain.model;
import java.io.Serializable;
/**
* +
* weather forecasting data, since it's average of model data,
* so i take design decision to let data precision as double rather than decimal.
*/
public class ForecastData implements Serializable {
private static f... | forecast-api/src/main/java/com/softideas/weather/forecast/api/domain/model/ForecastData.java | 0.938534 | 0.42173 | ForecastData.java | starcoder |
package drunkfly;
import java.util.HashMap;
public class ZXImage
{
public static final int CHAR_WIDTH = 8;
public static final int CHAR_HEIGHT = 8;
private final int widthInChars;
private final int heightInChars;
private final byte[] pixels;
private final byte[] attribs;
public ZXImage(i... | Sources/Java/Tools/drunkfly/ZXImage.java | 0.856137 | 0.651868 | ZXImage.java | starcoder |
package org.javimmutable.collections.list;
import org.javimmutable.collections.Func2;
import org.javimmutable.collections.Proc1Throws;
import org.javimmutable.collections.Sum1Throws;
import org.javimmutable.collections.common.ArrayHelper;
import org.javimmutable.collections.common.ToStringHelper;
import org.javimmuta... | src/main/java/org/javimmutable/collections/list/MultiValueNode.java | 0.888602 | 0.558508 | MultiValueNode.java | starcoder |
package org.ebookdroid.xpsdroid.codec;
import org.ebookdroid.core.bitmaps.BitmapManager;
import org.ebookdroid.core.bitmaps.BitmapRef;
import org.ebookdroid.core.codec.CodecPage;
import org.ebookdroid.pdfdroid.codec.PdfContext;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.Re... | EBookDroid/src/org/ebookdroid/xpsdroid/codec/XpsPage.java | 0.863579 | 0.411229 | XpsPage.java | starcoder |
package com.wavesplatform.crypto;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
/**
* Contains static methods to work with byte arrays.
*/
@SuppressWarnings({"WeakerAccess", "unused"})
public abstract class Bytes {
/**
* Creates an e... | src/main/java/com/wavesplatform/crypto/Bytes.java | 0.941888 | 0.501831 | Bytes.java | starcoder |
package org.springframework.data.jdbc.core;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.lang.Nullable;
/**
* Specifies a operations one can perform on a database, based on an <em>Domain Type</em>... | spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/JdbcAggregateOperations.java | 0.884545 | 0.428532 | JdbcAggregateOperations.java | starcoder |
package treenodes;
import attributefiltering.Pixel;
/**
* Parameters in canonical nodes.
* @author <NAME>
*/
public class Params {
private int area;
private double perimeter;
private double centroid_x;
private double centroid_y;
private double compactness;
private double eccentricity;
p... | AttributeFiltering/src/treenodes/Params.java | 0.805364 | 0.449574 | Params.java | starcoder |
package org.uberfire.io.regex;
import java.net.URI;
import java.util.Collection;
import org.uberfire.java.nio.file.Path;
import static org.kie.soup.commons.validation.Preconditions.checkNotNull;
public final class AntPathMatcher {
private static final String PATTERNS = "patterns";
private static org.uberfi... | uberfire-io/src/main/java/org/uberfire/io/regex/AntPathMatcher.java | 0.866316 | 0.413418 | AntPathMatcher.java | starcoder |
package algorithms.imageProcessing;
import algorithms.misc.Misc;
import algorithms.util.ResourceFinder;
import junit.framework.TestCase;
/**
*
* @author nichole
*/
public class ImageProcessor6Test extends TestCase {
public void test0() throws Exception {
/* pt values:
red = 0 - 18
... | tests/algorithms/imageProcessing/ImageProcessor6Test.java | 0.63375 | 0.482673 | ImageProcessor6Test.java | starcoder |
package org.craftyserver.server.dataparser;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import org.craftyserver.server.connection.BacklogInputStream;
/**
* Static methodes to read different data types of the Minecraft(TM) protocol from a {@link BacklogInputStream}.
* See <a>https://wiki.vg/Pro... | src/org/craftyserver/server/dataparser/DataTypeParser.java | 0.720073 | 0.577197 | DataTypeParser.java | starcoder |
package deltawye.lib;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
@SuppressWarnings("javadoc")
public class MedialGraphTest {
private static AtomicPlaneGraph createPlaneK2() {
int[][] k2 = { { 1, 2 }, { 2, 1 } };
return AtomicPlaneGraph.readAdjacencyList(k2);
}
p... | test/deltawye/lib/MedialGraphTest.java | 0.915209 | 0.71034 | MedialGraphTest.java | starcoder |
package quantum.api.block.state;
import quantum.api.block.Block;
import quantum.api.model.Model;
import quantum.util.Property;
import quantum.util.pair.Pair;
import java.util.List;
/**
* Represents a possible State of a Block in the {@linkplain
* quantum.api.world.World World}. A common example is crops, which upd... | API/src/quantum/api/block/state/State.java | 0.87068 | 0.527742 | State.java | starcoder |
package DsAlgoMadeEasyInJava.Graph;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
class GraphNode {
int node;
int distance;
GraphNode(int node, int distance) {
this.node = node;
this.distance = distance;
}
@Override
public boolean e... | DsAlgoMadeEasyInJava/Graph/SingleSourceShortestPath.java | 0.894769 | 0.45181 | SingleSourceShortestPath.java | starcoder |
package util;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Random;
public class BigIntegerUtils {
/**
* Finds the square root of a BigInteger
* @param n BigInteger to find the square root of
* @return Square root of n
*/
public static BigInteger sqrt(BigInteger n)... | src/util/BigIntegerUtils.java | 0.927569 | 0.666816 | BigIntegerUtils.java | starcoder |
package com.microsoft.azure.cosmosdb.rx;
import com.microsoft.azure.cosmosdb.BridgeInternal;
import com.microsoft.azure.cosmosdb.DocumentClientException;
import com.microsoft.azure.cosmosdb.Error;
import com.microsoft.azure.cosmosdb.internal.HttpConstants;
import com.microsoft.azure.cosmosdb.internal.directconnectivit... | commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FailureValidator.java | 0.925259 | 0.49048 | FailureValidator.java | starcoder |
import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
MinMaxStack stack = new MinMaxStack();
stack.push(5);
System.out.println(stack.getMin());
System.out.println(stack.getMax());
System.out.println(stack.peek());
stack.push(7);
... | questions/MMSC/1/Main.java | 0.700588 | 0.500671 | Main.java | starcoder |
package org.openrewrite.xml.format;
import org.openrewrite.Tree;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.xml.XmlIsoVisitor;
import org.openrewrite.xml.tree.Misc;
import org.openrewrite.xml.tree.Xml;
public class LineBreaksVisitor<P> extends XmlIsoVisitor<P> {
@Nullable
private fi... | rewrite-xml/src/main/java/org/openrewrite/xml/format/LineBreaksVisitor.java | 0.812756 | 0.413892 | LineBreaksVisitor.java | starcoder |
package fir.needle.joint.colleclions;
import java.util.List;
public class SimpleParametrizedPrefixTree<V> {
private Node<V> root;
private final CharSequence delimiter;
public SimpleParametrizedPrefixTree(final CharSequence delimiter) {
this.delimiter = delimiter;
}
public V find(final Ch... | src/main/java/fir/needle/joint/colleclions/SimpleParametrizedPrefixTree.java | 0.826782 | 0.479321 | SimpleParametrizedPrefixTree.java | starcoder |
package org.apache.lucene.jmh.base.rndgen;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** The type Lists. ... | lucene/jmh/src/java/org/apache/lucene/jmh/base/rndgen/Lists.java | 0.912163 | 0.442516 | Lists.java | starcoder |
package io.github.thepun.unsafe;
import sun.misc.Unsafe;
/**
* Allows to get access to raw off-heap memory.
*
* Memory should be allocated and freed manually.
*/
public final class OffHeapMemory {
private static final Unsafe UNSAFE_INSTANCE = UnsafeLocator.getUnsafe();
public static long allocate(int si... | src/main/java/io/github/thepun/unsafe/OffHeapMemory.java | 0.846292 | 0.538559 | OffHeapMemory.java | starcoder |
package lumberjack;
import java.util.HashSet;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
/**
* Models the state of the lumberjack's forest.
*
* The forest is represented by a 2d grid of integers. Flat spo... | src/main/java/lumberjack/State.java | 0.935546 | 0.705696 | State.java | starcoder |
package com.example.colibris.multi.graph;
import android.util.Log;
import com.example.colibris.configuration.Configuration;
import com.example.colibris.calib.Meeting;
/**
* The {@code DirectedEdge} class represents a weighted edge in an
* {@link EdgeWeightedDigraph}. Each edge consists of two integers
* (nam... | app/src/main/java/com/example/colibris/multi/graph/DirectedEdge.java | 0.891014 | 0.506225 | DirectedEdge.java | starcoder |
package hu.kosztolanyigergely.gpxsplicer;
import javafx.util.Pair;
import java.util.LinkedList;
import java.util.List;
/**
* Created by gerusz on 2016. 05. 19..
*/
public class GPXPointInterpolator {
public static void interpolatePoints(GPXFile toInterpolate, GPXFile interpolationSource) {
interpolate... | src/hu/kosztolanyigergely/gpxsplicer/GPXPointInterpolator.java | 0.854718 | 0.435181 | GPXPointInterpolator.java | starcoder |
package gov.sandia.cognition.learning.function.scalar;
import gov.sandia.cognition.math.AbstractDifferentiableUnivariateScalarFunction;
import gov.sandia.cognition.annotation.CodeReview;
import gov.sandia.cognition.annotation.CodeReviews;
import gov.sandia.cognition.annotation.PublicationReference;
import gov.sandia.c... | Components/LearningCore/Source/gov/sandia/cognition/learning/function/scalar/SigmoidFunction.java | 0.931673 | 0.427397 | SigmoidFunction.java | starcoder |
package edu.psu.presenations.utilities;
import java.util.OptionalLong;
import java.util.stream.LongStream;
public class PrimeUtilities {
private PrimeUtilities() {
}
public static LongStream factorStream(long number) {
return LongStream.rangeClosed(2, (long) Math.sqrt(number))
.filter(f -> number ... | presentation-examples-jar/src/main/java/edu/psu/presenations/utilities/PrimeUtilities.java | 0.857574 | 0.429609 | PrimeUtilities.java | starcoder |
package com.easyms.common.utils;
import lombok.AllArgsConstructor;
import java.io.Serializable;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.function.Function;
/**
* Either represents a value of two possible types. An Either is either a {@link Left} or a {@link Right}.
* <p>
... | easyms-rest-starter/src/main/java/com/easyms/common/utils/Either.java | 0.949142 | 0.456591 | Either.java | starcoder |
package org.dizitart.no2.filters;
import lombok.experimental.UtilityClass;
import org.dizitart.no2.Filter;
/**
* A helper class to create all type of {@link Filter}s.
*
* @since 1.0
* @author <NAME>
*/
@UtilityClass
public class Filters {
/**
* A filter to select all elements.
*/
public static ... | nitrite/src/main/java/org/dizitart/no2/filters/Filters.java | 0.947332 | 0.48182 | Filters.java | starcoder |
package io.gatling.javaapi.core.loop;
import io.gatling.javaapi.core.ChainBuilder;
import io.gatling.javaapi.core.Session;
import io.gatling.javaapi.core.StructureBuilder;
import io.gatling.javaapi.core.internal.loop.ScalaRepeat;
import java.util.UUID;
import java.util.function.Function;
import javax.annotation.Nonnul... | gatling-core-java/src/main/java/io/gatling/javaapi/core/loop/Repeat.java | 0.916189 | 0.433202 | Repeat.java | starcoder |
package oracle.kv.avro;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.specific.SpecificRecord;
import oracle.kv.Value;
import oracle.kv.Value.Format;
import oracle.kv.ValueBinding;
/**
* The {@code AvroBinding} interface has the same methods as {@link
* ValueBinding}, but adds semantics and ... | kv-3.5.2/src/oracle/kv/avro/AvroBinding.java | 0.936742 | 0.549399 | AvroBinding.java | starcoder |
package eu.hoefel.unit.level;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.NavigableMap;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.function.BiFunction;
import java.util.fun... | src/main/java/eu/hoefel/unit/level/LevelUnit.java | 0.863478 | 0.427606 | LevelUnit.java | starcoder |
package com.opengamma.strata.pricer.impl.tree;
import com.opengamma.strata.basics.value.ValueDerivatives;
import com.opengamma.strata.collect.ArgChecker;
import com.opengamma.strata.collect.array.DoubleArray;
import com.opengamma.strata.pricer.fxopt.RecombiningTrinomialTreeData;
/**
* Trinomial tree.
* <p>
* Optio... | modules/pricer/src/main/java/com/opengamma/strata/pricer/impl/tree/TrinomialTree.java | 0.916559 | 0.73756 | TrinomialTree.java | starcoder |
package codekata.checkout.domain;
import java.util.Objects;
import java.util.SortedMap;
import java.util.TreeMap;
/**
* Simple Basket to hold the checkout transaction
*/
public class Basket {
private final TreeMap<Item, Integer> basketItems;
private TreeMap<Promotion, AppliedDiscount> appliedDiscounts;
... | src/main/java/codekata/checkout/domain/Basket.java | 0.867219 | 0.50061 | Basket.java | starcoder |
import java.util.*;
import java.io.*;
import java.awt.Point;
import java.awt.geom.*;
import java.math.*;
public class abstractart {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLin... | Java/Kattis/Geometry/abstractart.java | 0.648578 | 0.40392 | abstractart.java | starcoder |
package org.opencb.opencga.storage.core.variant.query.executors.accumulators;
import org.opencb.biodata.models.variant.avro.VariantType;
import org.opencb.commons.datastore.core.FacetField;
import org.opencb.opencga.storage.core.variant.adaptors.VariantField;
import java.util.*;
import java.util.function.Function;
p... | opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/accumulators/VariantTypeAccumulator.java | 0.617282 | 0.446796 | VariantTypeAccumulator.java | starcoder |
package main;
import java.math.BigInteger;
import java.util.Random;
public class PrimalityTester {
private int[] checkList;
private BigInteger k;
public PrimalityTester(int[] checkList, BigInteger k){
this.checkList = checkList;
this.k = k;
}
public boolean probablePrime(BigInte... | src/main/PrimalityTester.java | 0.83545 | 0.52543 | PrimalityTester.java | starcoder |
package episode_38;
import org.lwjgl.util.vector.Vector3f;
public class ParticleEmitterBuilder {
private Vector3f location = new Vector3f(0, 0, 0);
private float spawningRate = 3;
private int particleLifeTime = 300;
private Vector3f gravity = new Vector3f(0, -0.0003f, 0);
private boolean enable3D... | src/episode_38/ParticleEmitterBuilder.java | 0.935839 | 0.564158 | ParticleEmitterBuilder.java | starcoder |
package org.apache.nlpcraft.model;
import java.util.*;
/**
* Detected model element. A token is a detected model element and is a part of the
* parsed user input. Sequence of tokens represents a fully parsed (see {@link NCContext#getVariants()} method) user input. A single
* token corresponds to a one or more word... | nlpcraft/src/main/scala/org/apache/nlpcraft/model/NCToken.java | 0.951108 | 0.495484 | NCToken.java | starcoder |
package me.thehutch.fusion.engine.component;
import me.thehutch.fusion.api.component.IComponent;
import me.thehutch.fusion.api.maths.Quaternion;
import me.thehutch.fusion.api.maths.Vector3;
/**
* @author thehutch
*/
public class TransformComponent implements IComponent {
private Quaternion rotation;
private Vecto... | Engine/src/main/java/me/thehutch/fusion/engine/component/TransformComponent.java | 0.762601 | 0.569015 | TransformComponent.java | starcoder |
package breakingBad;
import java.awt.Graphics;
import java.awt.Rectangle;
/**
*
* @author <NAME> A00822649 | <NAME> A01410921
*/
public class Ball extends Item{
private int width; // to know the width of the ball
private int height; // to know the height of the ball
... | BreakingBad/src/breakingBad/Ball.java | 0.831177 | 0.497559 | Ball.java | starcoder |
package org.jiserte.leaftion.math;
public class SpaceTimeDerivatives {
private static final double[][] pre = new double[][] {
{ 0.5 ,0.5 } ,
{ 0.223755 ,0.552490 , 0.223755 } ,
{ 0.092645 ,0.407355 , 0.407355 , 0.092645 } ,
{ 0.036420 ,0.248972 , 0.429217 , 0.248972 , 0.036420 ... | Leaftion/src/org/jiserte/leaftion/math/SpaceTimeDerivatives.java | 0.528533 | 0.444324 | SpaceTimeDerivatives.java | starcoder |
package com.diffplug.common.rx;
import com.diffplug.common.base.Box;
import io.reactivex.Observable;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* Represents a value which can be accessed through a traditional
* `get()` method or by listening t... | src/main/java/com/diffplug/common/rx/RxGetter.java | 0.949283 | 0.628393 | RxGetter.java | starcoder |
package com.ma;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.TreeMap;
/**
* Graph encodes the trajectory-neighborhood and their affinity values:
* Every vertex maps to an trajectory label. An edge b... | Source/segmentation/kernighan_lin/src/main/java/com/ma/Graph.java | 0.780328 | 0.525734 | Graph.java | starcoder |
package Medium;
/**
* You are given two non-empty linked lists representing two non-negative integers.
* The digits are stored in reverse order and each of their nodes contain a single digit.
* Add the two numbers and return it as a linked list.
*
* You may assume the two numbers do not contain any leading zero, ... | src/Medium/AddTwoNumbers.java | 0.781664 | 0.518059 | AddTwoNumbers.java | starcoder |
package com.andavin.util;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BooleanSupplier;
import java.util.... | Images-Common/src/main/java/com/andavin/util/Scheduler.java | 0.952286 | 0.581749 | Scheduler.java | starcoder |
package InterviewBit.src.Courses.Programming.Level7_DynamicProgramming.Knapsack.EqualAveragePartition.Java;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
public class Solution {
public static void main(String[] args) {
ArrayList<Integer> A = new ArrayList<Integer>(Arra... | src/InterviewBit/src/Courses/Programming/Level7_DynamicProgramming/Knapsack/EqualAveragePartition/Java/Solution.java | 0.839997 | 0.413063 | Solution.java | starcoder |
package org.JMathStudio.DataStructure.Iterator.Iterator2D;
import org.JMathStudio.DataStructure.Complex;
import org.JMathStudio.DataStructure.Cell.CCell;
import org.JMathStudio.Exceptions.BugEncounterException;
import org.JMathStudio.Exceptions.IteratorOutOfBoundsException;
/**
* This class define a 2D Iterator for ... | org/JMathStudio/DataStructure/Iterator/Iterator2D/CCellIterator.java | 0.888178 | 0.413477 | CCellIterator.java | starcoder |
import java.awt.Color;
/**Implantation de la classe Cercle Un cercle est une courbe plane fermée
* constituée des points situés à égale distance d’un point nommé centre, La
* valeur de cette distance est appelée rayon du cercle, On appelle diamètre la
* distance entre deux points diamétralement opposés.
* @author ... | 1A/S6/TOB/TPs/mini-projet/Cercle.java | 0.661158 | 0.478041 | Cercle.java | starcoder |
package cs6375.github.io;
public class DecisionTreeNode {
String attribute;
boolean label;
int depth;
DecisionTreeNode left;
DecisionTreeNode right;
boolean pruned = false;
TrainingDataSet dataSet;
public DecisionTreeNode(TrainingDataSet dataSet) {
this.dataSet = dataSet;
... | src/main/java/cs6375/github/io/DecisionTreeNode.java | 0.876463 | 0.550487 | DecisionTreeNode.java | starcoder |
public class Money {
private final int euros;
private final int cents;
public Money(int euros, int cents) {
if (cents > 99) {
euros += cents / 100;
cents %= 100;
}
this.euros = euros;
this.cents = cents;
}
public int euros() {
retu... | week6-095.Money/src/Money.java | 0.698227 | 0.409457 | Money.java | starcoder |
package linkedlist;
import linkedlist.util.LinkedListNode;
import linkedlist.util.LinkedListUtils;
/**
* 02/11/18
* <p>
* Question:
* Implement an algorithm that will check if a list is a palindrome
* <p>
* NOTE: as there is no mentioning of type and permutation, I will assume the type is Integer and the list n... | src/main/java/linkedlist/ListPalindromeV1.java | 0.711832 | 0.411288 | ListPalindromeV1.java | starcoder |
package dev.coderator.algopractice.datastructure.tree;
import java.util.LinkedList;
import java.util.Objects;
public class BinarySearchTree {
private class Node {
private int value;
private Node rightChild;
private Node leftChild;
public Node(int value) {
this.value = value;
}
@Override
public Str... | src/main/java/dev/coderator/algopractice/datastructure/tree/BinarySearchTree.java | 0.858481 | 0.418935 | BinarySearchTree.java | starcoder |
package experimental;
import java.util.*;
public class KdTreePointQuery2 {
public static class Point {
int x, y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
}
int[] tx;
int[] ty;
public KdTreePointQuery2(Point[] points) {
int n... | java/src/experimental/KdTreePointQuery2.java | 0.759761 | 0.460289 | KdTreePointQuery2.java | starcoder |
package joist.util;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
public class Inflector {
private static final Pattern lower = Pattern.compile("[a-z]");
private static final Pattern numeric = Pattern.compile("[0-9]");
private Inflector() {
}
public static String unde... | util/src/main/java/joist/util/Inflector.java | 0.705684 | 0.403626 | Inflector.java | starcoder |
package com.google.common.geometry;
import com.google.common.annotations.GwtIncompatible;
import com.google.common.collect.Lists;
import com.google.common.geometry.PrimitiveArrays.Bytes;
import com.google.common.geometry.PrimitiveArrays.Cursor;
import com.google.common.geometry.S2Point.Shape;
import com.google.common.... | tests/com/google/common/geometry/S2TaggedShapeCoderTest.java | 0.840488 | 0.614943 | S2TaggedShapeCoderTest.java | starcoder |
package us.ihmc.humanoidRobotics.footstep;
import java.util.ArrayList;
import java.util.List;
import us.ihmc.euclid.axisAngle.AxisAngle;
import us.ihmc.euclid.geometry.ConvexPolygon2D;
import us.ihmc.euclid.geometry.interfaces.Vertex2DSupplier;
import us.ihmc.euclid.referenceFrame.FramePoint2D;
import us.ihmc.euclid.... | ihmc-humanoid-robotics/src/main/java/us/ihmc/humanoidRobotics/footstep/SingleFootstepVisualizer.java | 0.724481 | 0.571707 | SingleFootstepVisualizer.java | starcoder |
package com.devteam.tutorial.algorithms.ds;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.devteam.tutorial.algorithms.ds.Tree.Node;
public class BinaryTree<T extends Comparable<T>> implements Tree<T> {
private Node<T> root;
private int size;
public BinaryTree() {... | tutorial/src/main/java/com/devteam/tutorial/algorithms/ds/BinaryTree.java | 0.803444 | 0.408454 | BinaryTree.java | starcoder |
import java.util.LinkedList;
import java.util.Queue;
public class BST {
// Creating the Binary Search tree's root Node
Node root;
// Using a Constructor to make an empty Binary Search Tree
// Will use the insert function below to add values to the BST
BST() {
root = null;
}
// Fun... | Semester Project/src/BST.java | 0.885111 | 0.746942 | BST.java | starcoder |
package com.mcherm.gobliniupdater;
import java.util.List;
/**
* This is the bind object for messages of the format STRUCTURED_DATA_UPDATE.
*
* <pre>
* STRUCTURED_DATA_UPDATE is a JSON format used for sending updates. It always consists
* of a JSON object with five fields:
* "version" - if using this document... | src/main/java/com/mcherm/gobliniupdater/StructuredDataUpdate.java | 0.666931 | 0.501526 | StructuredDataUpdate.java | starcoder |
package util.file_hierarchy_inspector;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class ExpectedFileHierarchy {
public String hierarchyRoot;
public List<ExpectedFileHierarchy> expectedFileHierarchyList;
public List<String> expectedFileList;
public ExpectedFileHier... | src/main/java/util/file_hierarchy_inspector/ExpectedFileHierarchy.java | 0.784897 | 0.419529 | ExpectedFileHierarchy.java | starcoder |
package io.opentelemetry.auto.instrumentation.opentelemetryapi.metrics;
import java.util.Map;
import unshaded.io.opentelemetry.metrics.LongValueRecorder;
class UnshadedLongValueRecorder implements LongValueRecorder {
private final io.opentelemetry.metrics.LongValueRecorder shadedLongValueRecorder;
protected Uns... | instrumentation/opentelemetry-api-beta/src/main/java/io/opentelemetry/auto/instrumentation/opentelemetryapi/metrics/UnshadedLongValueRecorder.java | 0.919331 | 0.435601 | UnshadedLongValueRecorder.java | starcoder |
M
方法1: 利用 BST的性质,可以直接搜到target node,而做成两个长度不一定相等的list。然后很简单找到LCA
方法2: Brutly寻找p和q的common ancestor, 然后recursively drive left/right. 非常巧妙, 但是也比较局限; 稍微变条件, 就很难recursive.
```
/*
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.
According to the definition of LCA on Wi... | LintCode-master/Java/Lowest Common Ancestor of a Binary Search Tree.java | 0.756537 | 0.991505 | Lowest Common Ancestor of a Binary Search Tree.java | starcoder |
package com.hit.basmath.learn.others;
/**
* 808. Soup Servings
* <p>
* There are two types of soup: type A and type B. Initially we have N ml of each type of soup. There are four kinds of operations:
* <p>
* Serve 100 ml of soup A and 0 ml of soup B
* Serve 75 ml of soup A and 25 ml of soup B
* Serve 50 ml of s... | codes/java/leetcodes/src/main/java/com/hit/basmath/learn/others/_808.java | 0.798147 | 0.637581 | _808.java | starcoder |
package org.sparky.parser;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
/**
* This class provides an empty implementation of {@link SparkyVisitor},
* which can be extended to create a visitor which only needs to handle a subset
* of the available methods.
*
* @param <T> The return type of the visit ... | java/src/main/java/org/sparky/parser/SparkyBaseVisitor.java | 0.892082 | 0.443661 | SparkyBaseVisitor.java | starcoder |
package de.buw.tmdt.plasma.services.sas.core.model.syntaxmodel;
import de.buw.tmdt.plasma.services.sas.core.model.Traversable;
import de.buw.tmdt.plasma.services.sas.core.model.exception.SchemaAnalysisException;
import de.buw.tmdt.plasma.services.sas.core.model.semanticmodel.EntityConcept;
import de.buw.tmdt.plasma.se... | components/schema-analysis-service/service/src/main/java/de/buw/tmdt/plasma/services/sas/core/model/syntaxmodel/PrimitiveNode.java | 0.824144 | 0.412826 | PrimitiveNode.java | starcoder |
package src.domain;
import org.junit.Before;
import org.junit.Test;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import static org.junit.Assert.*;
/**
* Created by <NAME> on 3/3/17.
*/
public class DayReportTest {
private DayReport report;
@Before
public voi... | test/src/domain/DayReportTest.java | 0.853134 | 0.423518 | DayReportTest.java | starcoder |
package com.team1458.turtleshell2.sensor;
import java.util.TimerTask;
import com.team1458.turtleshell2.util.TurtleMaths;
import com.team1458.turtleshell2.util.TurtleMaths.RangeShifter;
import com.team1458.turtleshell2.util.types.Angle;
import com.team1458.turtleshell2.util.types.Rate;
import com.team1458.turtleshell2... | TurtwigBot/src/com/team1458/turtleshell2/sensor/TurtleXtrinsicMagnetometer.java | 0.771499 | 0.422326 | TurtleXtrinsicMagnetometer.java | starcoder |
package org.pathvisio.biopax3.layout;
/**
* A bare-minimum definition of a graph. A given edge in a graph can
* be either <i>directed</i> or <i>undirected</i>. Directedness of edges
* is an important part of graph topology for calculations such as
* finding a path <i>from</i> node A <i>to</i> node B. A number ... | src/org/pathvisio/biopax3/layout/GraphTopology.java | 0.862598 | 0.691673 | GraphTopology.java | starcoder |
package de.nec.nle.siafu.model;
import java.io.InputStream;
import org.apache.commons.configuration.Configuration;
import org.eclipse.swt.graphics.ImageData;
import de.nec.nle.siafu.graphics.Overlayable;
import de.nec.nle.siafu.types.Publishable;
/**
* An overlay is in essence a matrix which maps a value to each p... | siafu/Siafu/src/main/java/de/nec/nle/siafu/model/Overlay.java | 0.886076 | 0.553385 | Overlay.java | starcoder |
package su.knst.lokutils.render.tools;
import org.lwjgl.BufferUtils;
import org.lwjgl.util.vector.Matrix4f;
import java.nio.FloatBuffer;
import static org.lwjgl.opengl.GL11.*;
public class MatrixTools {
public static Matrix4f createPerspectiveMatrix(float fov, float aspect, float near, float far) {
Matr... | src/main/java/su/knst/lokutils/render/tools/MatrixTools.java | 0.865594 | 0.564639 | MatrixTools.java | starcoder |
package org.apache.lucene.search;
import java.io.IOException;
import org.apache.lucene.index.Term;
/** Internal class used for scoring.
* <p>Public only so that the indexing code can compute and store the
* normalization byte for each document. */
public final class Similarity {
private Similarity() {} // n... | src/java/org/apache/lucene/search/Similarity.java | 0.760651 | 0.49939 | Similarity.java | starcoder |
package ds;
import keyedElement.DoubleKeyedElement;
import keyedElement.FloatKeyedElement;
import keyedElement.IntKeyedElement;
import keyedElement.LongKeyedElement;
public final class Heaps {
private static String INSTANTIATION_ERROR_MESSAGE = String.format("Class %s should not be initialized.", Heaps.class.get... | src/main/java/ds/Heaps.java | 0.656328 | 0.424054 | Heaps.java | starcoder |
package com.netcetera.trema.core;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
/**
* Represents a status for a text.
* <p>
* <b>Notes</b>:
* <ul>
* <li>The name of the status has to match the status string in the XML
* schema.</li>
* <li>The status ... | src/main/java/com/netcetera/trema/core/Status.java | 0.869673 | 0.452596 | Status.java | starcoder |
package com.google.cloud.pso.dofns;
import com.google.bigtable.v2.*;
import com.google.protobuf.ByteString;
import java.util.ArrayList;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.transforms.SerializableBiFunction;
import org.apache.beam.sdk.values.KV;
/**
* This {@link DoFn} applies a fun... | examples/bigtable-change-key/src/main/java/com/google/cloud/pso/dofns/UpdateKey.java | 0.903125 | 0.417925 | UpdateKey.java | starcoder |
package co.nyzo.verifier.client;
import java.util.*;
public class ConsoleUtil {
public static void printTable(CommandOutput output, String... values) {
List<List<String>> columns = new ArrayList<>();
for (String value : values) {
columns.add(Collections.singletonList(value));
... | src/main/java/co/nyzo/verifier/client/ConsoleUtil.java | 0.838217 | 0.448909 | ConsoleUtil.java | starcoder |
package com.foundationdb.tuple;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import com.foundationdb.tuple.TupleUtil.Decod... | fdb-sql-layer-core/src/main/java/com/foundationdb/tuple/TupleFloatingUtil.java | 0.927445 | 0.450178 | TupleFloatingUtil.java | starcoder |
package de.uros.citlab.errorrate.interfaces;
/**
* With classes implementing this interface it is possible to calculate confidence intervals for a CER calculated from
* text line samples.<br/>
* First, {@link #setAlpha(double)} have to be set to configure the confidence level.
* Typical values are 0.05 or 0.01.<b... | src/main/java/de/uros/citlab/errorrate/interfaces/ICalcStatistic.java | 0.95212 | 0.563918 | ICalcStatistic.java | starcoder |
package com.ephipi.algo.tree;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import com.ephipi.algo.tree.BinaryTree.Node;
import com.ephipi.algo.tree.BinaryTreeTraverse.Order;
public class TestBinaryTree
{
private List<Node<Integer>> ... | src/main/java/com/ephipi/algo/tree/TestBinaryTree.java | 0.830113 | 0.447823 | TestBinaryTree.java | starcoder |
package com.midterm;
public class t_pyramid extends isosceles implements Volume{
private double Height;private double Frame;private double areaTriangle;
t_pyramid(double base_t, double height_t) {
super(base_t, height_t);
}
// ----Call or return the value of an attribute to the c... | triangular_calculation/t_pyramid.java | 0.661486 | 0.404802 | t_pyramid.java | starcoder |
package com.octopod.util;
/**
* @author Octopod - <EMAIL>
*/
public class Vector
{
private double x, y, z;
public Vector(double x, double y, double z)
{
this.x = x;
this.y = y;
this.z = z;
}
public Vector(Vector vec)
{
this(vec.X(), vec.Y(), vec.Z());
}
public double X() {return x;}
public double... | src/main/java/com/octopod/util/Vector.java | 0.938046 | 0.717037 | Vector.java | starcoder |
package com.puresoltechnologies.graphs.graph;
import static java.util.Objects.requireNonNull;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
public class SubgraphAnalyzer {
/**
* This method searches a given {@link Graph} for disconnected subgraphs.
*
* @param <V>
* is ... | graph/src/main/java/com/puresoltechnologies/graphs/graph/SubgraphAnalyzer.java | 0.904558 | 0.473962 | SubgraphAnalyzer.java | starcoder |
package io.github.jspinak.brobot.actions.actionResultCombo;
import io.github.jspinak.brobot.actions.actionOptions.ActionOptions;
import io.github.jspinak.brobot.actions.parameterTuning.ParameterCollection;
import io.github.jspinak.brobot.datatypes.state.ObjectCollection;
import lombok.Getter;
import lombok.Setter;
im... | library/src/main/java/io/github/jspinak/brobot/actions/actionResultCombo/ActionResultCombo.java | 0.830766 | 0.517876 | ActionResultCombo.java | starcoder |
package com.jacobgen.microsoft.msword;
import com.jacob.com.*;
public class Indexes extends Dispatch {
public static final String componentName = "Word.Indexes";
public Indexes() {
super(componentName);
}
/**
* This constructor is used instead of a case operation to
* turn a Dispatch object into a wider ob... | myffmpeg-java20140728/MySpeech/gensrc/com/jacobgen/microsoft/msword/Indexes.java | 0.887881 | 0.469338 | Indexes.java | starcoder |
package ru.spbstu.util;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class DisjointSets<E> {
protected Map<E, Node> map;
public DisjointSets() {
this.map = new HashMap();
}
public DisjointSets(int initialCapacity) {
this.map = new HashMap(4 * ini... | src/main/kotlin/ru/spbstu/util/DisjointSets.java | 0.822082 | 0.47457 | DisjointSets.java | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.