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 org.algorithms.chap2;
import org.util.IoUtil;
/**
* @author duanweidong
* @version 2021/7/17 16:48
*/
public class MergeInsertionSort {
public static void main(String[] args) {
int[] array = new int[] {5, 4, 3, 2, 1};
mergeInsertionSort(array, 6);
IoUtil.print(array);
m... | src/main/java/org/algorithms/chap2/MergeInsertionSort.java | 0.602062 | 0.461017 | MergeInsertionSort.java | starcoder |
package edu.cnm.deepdive.celestialbodies.controller;
import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.openActionB... | app/src/androidTest/java/edu/cnm/deepdive/celestialbodies/controller/FullTest.java | 0.700178 | 0.434521 | FullTest.java | starcoder |
package dk.cloudcreate.essentials.types;
import java.math.*;
import static dk.cloudcreate.essentials.shared.FailFast.requireNonNull;
/**
* Immutable Percentage concept, where a {@link BigDecimal} value of "100" is the same as 100%<br>
*/
public class Percentage extends BigDecimalType<Percentage> {
public stati... | types/src/main/java/dk/cloudcreate/essentials/types/Percentage.java | 0.946163 | 0.48621 | Percentage.java | starcoder |
package learning.example.guava;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.goo... | learning-9-guava/src/main/java/learning/example/guava/CollectExamples.java | 0.713731 | 0.451629 | CollectExamples.java | starcoder |
public class ShannonEntropy {
protected double movements;
protected double[] entropy;
protected double[] zeroCounter;
protected double[] oneCounter;
protected double[] zeroProbability;
protected double[] oneProbability;
public ShannonEntropy(int dimension) {
movements = 0;
zeroCounter = new double[dimens... | BBAS/src/ShannonEntropy.java | 0.52756 | 0.609611 | ShannonEntropy.java | starcoder |
package com.storedobject.chart;
import java.util.function.*;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.Stream;
/**
* Representation of data as a mathematical function of another data or stream of values.
* The resulting data is always of {@link Double} type.
*... | src/main/java/com/storedobject/chart/FunctionData.java | 0.947962 | 0.711443 | FunctionData.java | starcoder |
package com.secondthorn.solitaire.pyramid.service.solver;
import com.secondthorn.solitaire.pyramid.service.model.Solution;
import com.secondthorn.solitaire.pyramid.service.model.Step;
import gnu.trove.map.TLongLongMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* BFSSolver ... | src/main/java/com/secondthorn/solitaire/pyramid/service/solver/BFSSolver.java | 0.859811 | 0.470737 | BFSSolver.java | starcoder |
package umontreal.ssj.rng;
import umontreal.ssj.rng.RandomStream;
import umontreal.ssj.rng.RandomStreamBase;
import umontreal.ssj.util.ArithmeticMod;
import java.io.Serializable;
/**
* Extends the abstract class @ref RandomStreamBase, thus implementing the
* @ref RandomStream interface indirectly. The backbone ge... | src/main/java/umontreal/ssj/rng/MRG31k3p.java | 0.843573 | 0.433921 | MRG31k3p.java | starcoder |
package org.broadinstitute.hellbender.utils.codecs.gencode;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* A Gencode GTF Feature representing a gene.
*
* A GTF Feature represents one row of a GTF File.
* The specification of a GTF file is defined here:
* http://mblab.wustl.edu... | src/main/java/org/broadinstitute/hellbender/utils/codecs/gencode/GencodeGtfGeneFeature.java | 0.925693 | 0.418459 | GencodeGtfGeneFeature.java | starcoder |
package io.ppatierno.formula1.data;
import io.netty.buffer.ByteBuf;
import io.ppatierno.formula1.enums.InfringementType;
import io.ppatierno.formula1.enums.PenaltyType;
public class Penalty {
private PenaltyType penaltyType;
private InfringementType infringementType;
private short vehicleIdx;
private... | f1-telemetry/src/main/java/io/ppatierno/formula1/data/Penalty.java | 0.865977 | 0.42674 | Penalty.java | starcoder |
package io.github.townyadvanced.flagwar.objects;
import io.github.townyadvanced.flagwar.CellAttackThread;
import io.github.townyadvanced.flagwar.FlagWar;
import io.github.townyadvanced.flagwar.config.FlagWarConfig;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.log... | src/main/java/io/github/townyadvanced/flagwar/objects/CellUnderAttack.java | 0.81946 | 0.412885 | CellUnderAttack.java | starcoder |
package uk.co.openkappa.reservoir;
import java.util.concurrent.ThreadLocalRandom;
import java.util.function.DoubleConsumer;
import static java.lang.Math.exp;
import static java.lang.Math.log;
public class AlgorithmZ implements ReservoirSampler {
private final double[] reservoir;
private long counter;
pri... | src/main/java/uk/co/openkappa/reservoir/AlgorithmZ.java | 0.858036 | 0.442034 | AlgorithmZ.java | starcoder |
package org.kie.lienzo.client.util;
import com.ait.lienzo.client.core.shape.Shape;
import com.ait.lienzo.client.core.types.Point2DArray;
public class Util {
public static final double generateValueWithinBoundary(int maxValue, int safeValue) {
double value = Math.random() * maxValue;
if (value <... | packages/stunner-editors/lienzo-webapp/src/main/java/org/kie/lienzo/client/util/Util.java | 0.908484 | 0.443902 | Util.java | starcoder |
package qub;
public interface DiceExpressionTests
{
public static void test(TestRunner runner)
{
runner.testGroup(DiceExpression.class, () ->
{
runner.testGroup("constant(int)", () ->
{
final Action1<Integer> constantTest = (Integer constant) ->
... | tests/qub/DiceExpressionTests.java | 0.821832 | 0.695816 | DiceExpressionTests.java | starcoder |
package com.evgenii.walktocircle.utils;
import android.location.Location;
public class WalkGeo {
/**
* @return random degree in the interval [0, 360)
*/
public static Double randomBetween0and360Degrees() {
Double min = 0.0;
Double max = 360.0;
return WalkRandomNumberGenerat... | app/src/main/java/com/evgenii/walktocircle/Utils/WalkGeo.java | 0.893478 | 0.666541 | WalkGeo.java | starcoder |
package net.kaeff.pluck;
import java.util.function.Function;
/**
* Use the static `pluck()` function to create a `Function` that represents a method call on an object.
*/
public final class Pluck {
private Pluck() {
}
/**
* Plucks a method by method name.
*
* @param pluckedClass Type to... | src/main/java/net/kaeff/pluck/Pluck.java | 0.95402 | 0.601681 | Pluck.java | starcoder |
package pk.com.habsoft.robosim.filters.core.values;
import java.util.Collection;
import java.util.Set;
import pk.com.habsoft.robosim.filters.core.Attribute;
/**
* An abstract class for representing a value assignment for an attribute.
* Different value subclasses will use different internal representations such
*... | src/main/java/pk/com/habsoft/robosim/filters/core/values/Value.java | 0.912312 | 0.475605 | Value.java | starcoder |
package rapaio.core.distributions;
import static java.lang.StrictMath.sqrt;
import java.io.Serializable;
import rapaio.core.RandomSource;
import rapaio.data.VarDouble;
/**
* Interface which models all types of uni-variate statistical distributions.
* <p>
* Created by <a href="mailto:<EMAIL>"><NAME></a> at 11/3/1... | src/rapaio/core/distributions/Distribution.java | 0.901667 | 0.431704 | Distribution.java | starcoder |
package entities;
import static main.Main.*;
import java.util.*;
import main.*;
import processing.core.*;
import terrain.*;
import util.*;
public abstract class Entity {
public static float epsilon = 0.1f;
private static float gravityDy = 0.8f;
private static float airResis = 0.85f;
protected Rectangle hitbo... | src/entities/Entity.java | 0.727685 | 0.437223 | Entity.java | starcoder |
package com.akkaserverless.javasdk.replicatedentity;
import java.util.Set;
import java.util.function.Function;
/**
* A Replicated Map that allows both the addition and removal of objects in a map.
*
* <p>Use the more specialized maps if possible, such as {@link ReplicatedCounterMap}, {@link
* ReplicatedRegisterMa... | sdk/src/main/java/com/akkaserverless/javasdk/replicatedentity/ReplicatedMap.java | 0.886948 | 0.595669 | ReplicatedMap.java | starcoder |
package com.univocity.parsers.fixed;
import com.univocity.parsers.annotations.*;
import com.univocity.parsers.annotations.helpers.*;
import com.univocity.parsers.common.*;
import com.univocity.parsers.common.input.*;
import java.util.*;
/**
* This is the configuration class used by the Fixed-Width parser ({@link Fi... | src/main/java/com/univocity/parsers/fixed/FixedWidthParserSettings.java | 0.925949 | 0.484075 | FixedWidthParserSettings.java | starcoder |
package bappleton.vocal;
import android.util.Log;
import be.tarsos.dsp.pitch.PitchDetectionResult;
/**
* Created by Brian on 10/27/2016.
* Important information about this class:
*
* Regarding purpose:
* This class accepts a TarsosDSP PitchDetectionResult object
* It uses the PitchDeteti... | app/src/main/java/bappleton/vocal/vocalPitchResult.java | 0.780955 | 0.469642 | vocalPitchResult.java | starcoder |
package org.apache.servicecomb.it.schema.objectparams;
import java.util.Objects;
public class FlattenObjectRequest {
private byte aByte;
private short aShort;
private int anInt;
private long aLong;
private float aFloat;
private double aDouble;
private boolean aBoolean;
private char aChar;
pr... | integration-tests/it-common/src/main/java/org/apache/servicecomb/it/schema/objectparams/FlattenObjectRequest.java | 0.876317 | 0.490724 | FlattenObjectRequest.java | starcoder |
package com.jayantkrish.jklol.util;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.colle... | src/com/jayantkrish/jklol/util/PairCountAccumulator.java | 0.957288 | 0.60212 | PairCountAccumulator.java | starcoder |
import java.util.*;
class Solution {
public String multiply(String num1, String num2) {
if (num1.equals("0") || num2.equals("0")) {
return "0";
}
if (num1.length() <= num2.length()) {
return multi(num1, num2);
} else {
return multi(num2, num1);
... | java/unclassified/algorithms/43.multiply-strings.java | 0.72662 | 0.430626 | 43.multiply-strings.java | starcoder |
package com.interface21.beans.factory;
import com.interface21.beans.BeansException;
/**
* Interface to be implemented by objects that hold a number of bean definitions,
* each uniquely identified by a String name. An independent instance of any of
* these objects can be obtained (the Prototype design pattern), or ... | src/com/interface21/beans/factory/BeanFactory.java | 0.902026 | 0.437463 | BeanFactory.java | starcoder |
package org.apache.geode.management;
import static org.apache.geode.management.MXBeanAwaitility.getSystemManagementService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.lang.management.ManagementFactory;
... | geode-core/src/distributedTest/java/org/apache/geode/management/MemberMBeanAttributesDUnitTest.java | 0.809728 | 0.555857 | MemberMBeanAttributesDUnitTest.java | starcoder |
package com.hncboy;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
/**
* @author hncboy
* @date 2019/12/2 19:43
* @description 743.网络延迟时间
*
* 有 N 个网络节点,标记为 1 到 N。
* 给定一个列表 times,表示信号经过有向边的传递时间。
* times[i] = (u, v, w),其中 u 是源节点,v 是目标节点, w 是一个信号从源节点传递到目标节点的时间。
* 现在,我们向当前的节点 K 发送了... | src/com/hncboy/NetworkDelayTime.java | 0.531209 | 0.469703 | NetworkDelayTime.java | starcoder |
package com.tunnelvisionlabs.util.validation;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public class RequiresTest {
@Rule
public final ExpectedException thrown = ExpectedException.none();
@Test
public void testNotNull_NotNullValue_WithParameter() {
Requires.notNull... | test/com/tunnelvisionlabs/util/validation/RequiresTest.java | 0.882276 | 0.567337 | RequiresTest.java | starcoder |
package org.apache.wss4j.common.saml.bean;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.joda.time.DateTime;
/**
* Class SubjectConfirmationDataBean represents a SAML (2) SubjectConfirmationData. Please note that
* KeyInfo functionality is in Subject... | ws-security-common/src/main/java/org/apache/wss4j/common/saml/bean/SubjectConfirmationDataBean.java | 0.889343 | 0.405566 | SubjectConfirmationDataBean.java | starcoder |
package com.parrot.drone.groundsdk.internal.device.pilotingitf;
import com.parrot.drone.groundsdk.device.pilotingitf.PilotingItf;
import com.parrot.drone.groundsdk.device.pilotingitf.PointOfInterestPilotingItf;
import com.parrot.drone.groundsdk.internal.component.ComponentDescriptor;
import com.parrot.drone.groundsdk.... | groundsdk/src/main/java/com/parrot/drone/groundsdk/internal/device/pilotingitf/PointOfInterestPilotingItfCore.java | 0.859118 | 0.410166 | PointOfInterestPilotingItfCore.java | starcoder |
class Solution{
/*
There are four types of binary tree traversals:
Note- Traversal signifies visiting a node of the tree.
Inorder: Left -> Root -> Right (For each subtree in the tree)
PreOrder: Root -> Left -> Right (For each subtree in the tree)
PostOrder: Left -> Right -> Root (For each subtree i... | Trees/BT-Traversals.java | 0.648578 | 0.595934 | BT-Traversals.java | starcoder |
package pengenalanpola.if5181.if5181pengenalanpola;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
class Thinning {
... | app/src/main/java/pengenalanpola/if5181/if5181pengenalanpola/Thinning.java | 0.537284 | 0.414899 | Thinning.java | starcoder |
package nl.talsmasoftware.umldoclet.uml;
import nl.talsmasoftware.umldoclet.configuration.TypeDisplay;
import java.io.IOException;
import java.util.Comparator;
import static java.lang.String.CASE_INSENSITIVE_ORDER;
import static java.util.Comparator.naturalOrder;
import static java.util.Objects.requireNonNull;
/**
... | java-8/src/main/java/nl/talsmasoftware/umldoclet/uml/TypeName.java | 0.859826 | 0.444143 | TypeName.java | starcoder |
package easy;
/**
* We have an array A of integers, and an array queries of queries.
* For the i-th query val = queries[i][0], index = queries[i][1], we add val to A[index].
* Then, the answer to the i-th query is the sum of the even values of A.
* (Here, the given index = queries[i][1] is a 0-based index, and eac... | src/easy/SumOfEvenNumbers.java | 0.869271 | 0.479991 | SumOfEvenNumbers.java | starcoder |
package render;
import linalg.EuclideanVector;
import mesh.Vertex;
/**
* A class to implement a (very simple) perspective camera.
*/
public class Camera {
private EuclideanVector position;
private EuclideanVector lock;
private EuclideanVector upGuide;
private EuclideanVector look = new EuclideanVect... | src/render/Camera.java | 0.952871 | 0.673195 | Camera.java | starcoder |
package com.opengamma.batch;
import java.util.Map;
import java.util.Set;
import com.opengamma.batch.domain.MarketData;
import com.opengamma.batch.domain.MarketDataValue;
import com.opengamma.batch.domain.RiskRun;
import com.opengamma.engine.view.ViewComputationResultModel;
import com.opengamma.engine.view.cycle.ViewC... | projects/financial/src/main/java/com/opengamma/batch/BatchRunWriter.java | 0.875001 | 0.431225 | BatchRunWriter.java | starcoder |
package com.revolsys.geometry.planargraph;
import java.util.Iterator;
/**
* The base class for all graph component classes.
* Maintains flags of use in generic graph algorithms.
* Provides two flags:
* <ul>
* <li><b>marked</b> - typically this is used to indicate a state that persists
* for the course of the gr... | revolsys-core/src/main/java/com/revolsys/geometry/planargraph/GraphComponent.java | 0.946818 | 0.490053 | GraphComponent.java | starcoder |
package me.julb.commons.time.date;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalUnit;
import java.util.Date;
import java.util.TimeZone;
import me.julb.commons.constants.Temporals;
/**
* A date util... | commons-time/src/main/java/me/julb/commons/time/date/DateUtility.java | 0.943361 | 0.540621 | DateUtility.java | starcoder |
package no.hvl.past.webui.transfer.quickRuleEngine.domain;
import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
public abstract class WorldObject extends Thing implements Cloneable {
private boolean isSingleton;
private Collection<WorldObject> children;
private Col... | src/main/java/no/hvl/past/webui/transfer/quickRuleEngine/domain/WorldObject.java | 0.519521 | 0.41745 | WorldObject.java | starcoder |
package com.google.ar.core.examples.java.rawdepth;
import android.content.Context;
import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.opengl.Matrix;
import com.google.ar.core.examples.java.common.rendering.ShaderUtil;
import java.io.IOException;
import java.util.ArrayList;
/** Renders t... | samples/raw_depth_java/app/src/main/java/com/google/ar/core/examples/java/rawdepth/Renderer.java | 0.936648 | 0.401923 | Renderer.java | starcoder |
package com.arctos6135.robotpathfinder.core.path;
/**
* An enum of different path types. Differently typed paths use different types
* of internal spline segments. See the Javadoc for the values for more
* information.
*
* @author <NAME>
* @since 3.0.0
*/
public enum PathType {
/**
* The path spline consist... | src/main/java/com/arctos6135/robotpathfinder/core/path/PathType.java | 0.896178 | 0.405566 | PathType.java | starcoder |
package jmetal.qualityIndicator;
import java.util.Arrays;
/**
* This class implements the generalized spread metric for two or more dimensions.
* It can be used also as command line program just by typing.
* $ java jmetal.qualityIndicator.GeneralizedSpread <solutionFrontFile> <trueFrontFile> <getNumberOfObjective... | src/jmetal/qualityIndicator/GeneralizedSpread.java | 0.906957 | 0.466481 | GeneralizedSpread.java | starcoder |
class Delaunay{
class Point implements Comparable<Point> {
long x, y;
public int compareTo(Point o) {
if (x != o.x)
return Long.signum(x - o.x);
return Long.signum(y - o.y);
}
Point(long x, long y) {
this.x = x;
this.y... | @DOC by DIPTA/collected/Shakil Aust/WJMZBMR + Zhenyang Dai (geo)/Delaunay.java | 0.691497 | 0.69194 | Delaunay.java | starcoder |
package com.fishercoder.solutions;
import java.util.ArrayDeque;
import java.util.Deque;
/**
* 439. Ternary Expression Parser
*
* Given a string representing arbitrarily nested ternary expressions, calculate the result of the expression.
* You can always assume that the given expression is valid and only consists ... | src/main/java/com/fishercoder/solutions/_439.java | 0.881742 | 0.700818 | _439.java | starcoder |
package us.ihmc.commonWalkingControlModules.configurations;
/**
* Parameters to tune the ICP (Instantaneous Capture Point) planner for each robot. The ICP planner
* is a module that predicts the desired ICP trajectory accordingly to the upcoming footsteps. This
* is one of the critical modules of the walking contro... | ihmc-common-walking-control-modules/src/main/java/us/ihmc/commonWalkingControlModules/configurations/ICPTrajectoryPlannerParameters.java | 0.888099 | 0.74468 | ICPTrajectoryPlannerParameters.java | starcoder |
package com.example.examplemod.util;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
public class TreePos extends Matrix
{
public static final TreePos ZERO = new TreePos(0.0, 0.0, 0.0);
public TreePos()
{
super(4, 4, 0.0);
for(int n = 0; n < this.row; n++)
this.set(n, n, 1.0... | src/main/java/com/example/examplemod/util/TreePos.java | 0.807992 | 0.626267 | TreePos.java | starcoder |
package com.google.errorprone.matchers;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.errorprone.VisitorState;
import com.google.errorprone.annotations.ForOverride;
import com.sun.source.tree.Tree;
import com.sun.so... | check_api/src/main/java/com/google/errorprone/matchers/ChildMultiMatcher.java | 0.9226 | 0.486758 | ChildMultiMatcher.java | starcoder |
package io.lambdadepot.function;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
import java.util.function.Consumer;
/**
* Represents an operation that accepts a single input argument and returns no
* result. Unlike most other functional interfaces, {@code Consumer} is expected... | src/main/java/io/lambdadepot/function/Consumer1.java | 0.933309 | 0.438004 | Consumer1.java | starcoder |
package leetcodejava.string;
import org.junit.Assert;
import org.junit.Test;
import java.util.*;
/**
* This is the solution of No.890 problem in the LeetCode,
* the website of the problem is as follow:
* https://leetcode-cn.com/problems/find-and-replace-pattern
* <p>
* The description of problem is as follow:
... | src/leetcodejava/string/ReplacePattern890.java | 0.805135 | 0.405154 | ReplacePattern890.java | starcoder |
package org.red5.stream.util;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class BufferUtils {
/**
* FloatShortsToBytes
*
* Convert a float array to short array.
*
* After that, convert 16-bit integer (short) into two bytes.
*
*/
public static byte[] flo... | src/main/java/org/red5/stream/util/BufferUtils.java | 0.881679 | 0.503357 | BufferUtils.java | starcoder |
import com.sun.istack.internal.NotNull;
import java.util.ArrayList;
import java.util.List;
/**
* Pawn -- Extension of the ChessPiece class. Used to represent a pawn object in a game of Chess.
* @author sahil1105
*/
public class Pawn extends ChessPiece{
/**
* Constructor for the Pawn class. Simply calls ... | src/Pawn.java | 0.734976 | 0.554591 | Pawn.java | starcoder |
public class Node<E>
{
// Invariant of the Node class:
// 1. Each node has one reference to an E Object, stored in the instance
// variable data.
// 2. For the final node of a list, the link part is null.
// Otherwise, the link part is a reference to the
// next node of the list.
... | CS_211/Node.java | 0.785843 | 0.438966 | Node.java | starcoder |
package com.chair49.astroids.model;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.Box2D;
import com.badlogic.gdx.physics.box2d.World;
import com.chair49.astroids.controller.Ast... | core/src/com/chair49/astroids/model/AsteroidField.java | 0.874332 | 0.401306 | AsteroidField.java | starcoder |
package us.ihmc.atlas.parameters;
import java.util.ArrayList;
import java.util.List;
import us.ihmc.atlas.AtlasRobotVersion;
import us.ihmc.avatar.initialSetup.DRCSCSInitialSetup;
import us.ihmc.euclid.Axis3D;
import us.ihmc.euclid.referenceFrame.FrameBox3D;
import us.ihmc.euclid.referenceFrame.FrameCapsule3D;
import... | atlas/src/main/java/us/ihmc/atlas/parameters/AtlasSimulationCollisionModel.java | 0.873444 | 0.437824 | AtlasSimulationCollisionModel.java | starcoder |
package advanced.dp.onedim.lc213_houserobber2;
/**
* Note: This is an extension of House Robber.
* After robbing those houses on that street, the thief has found himself a new place for his thievery
* so that he will not get too much attention. This time, all houses at this place are arranged in a circle.
* That m... | 1-algorithm/13-leetcode/java/src/advanced/dp/onedim/lc213_houserobber2/Solution.java | 0.709523 | 0.472683 | Solution.java | starcoder |
package _2017;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
// http://adventofcode.com/2017/day/11
// Flat-topped hexagon movement
public class day11 {
// ----- Hex helpers -----
public static class Cu... | src/main/_2017/day11.java | 0.731251 | 0.422207 | day11.java | starcoder |
package daily.d210802p743networkdelaytime;
import java.util.Arrays;
/**
* 743. Network Delay Time
*
* https://leetcode-cn.com/problems/network-delay-time/
*
* You are given a network of n nodes, labeled from 1 to n. You are also given times,
* a list of travel times as directed edges times[i] = (ui, vi, wi),
*... | leetcode-java/src/daily/d210802p743networkdelaytime/Solution.java | 0.808181 | 0.466785 | Solution.java | starcoder |
package org.deeplearning4j.zoo;
import org.deeplearning4j.nn.conf.WorkspaceMode;
import org.deeplearning4j.zoo.model.*;
import java.util.HashMap;
import java.util.Map;
/**
* Helper class for selecting multiple models from the zoo.
*
* @author <NAME> (crockpotveggies)
*/
public class ModelSelector {
public s... | deeplearning4j-zoo/src/main/java/org/deeplearning4j/zoo/ModelSelector.java | 0.878249 | 0.561395 | ModelSelector.java | starcoder |
package com.fundynamic.d2tm.math;
import org.newdawn.slick.geom.Vector2f;
public class Vector2D {
private final Vector2f vec;
public static Vector2D zero() {
return new Vector2D(0, 0);
}
public static Vector2D create(float x, float y) {
return new Vector2D(x, y);
}
/**
... | src/main/java/com/fundynamic/d2tm/math/Vector2D.java | 0.959212 | 0.806929 | Vector2D.java | starcoder |
package titan.ccp.kiekerbridge.raritan.simulator;
import java.text.MessageFormat;
/**
* Reads the value from a (simulated) sensor and makes it accessible.
*/
public class SensorReader {
private final JsonTemplate jsonTemplate = new JsonTemplate();
private final SimulatedSensor sensor;
private final long st... | record-bridge-raritan/raritan-simulator/src/main/java/titan/ccp/kiekerbridge/raritan/simulator/SensorReader.java | 0.924671 | 0.442034 | SensorReader.java | starcoder |
package org.jupiter.common.concurrent.disruptor;
/**
* The default wait strategy used by the Disruptor is the BlockingWaitStrategy.
*
* BlockingWaitStrategy:
* Internally the BlockingWaitStrategy uses a typical lock and condition variable to handle thread wake-up.
* The BlockingWaitStrategy is the slowest of the ... | jupiter-common/src/main/java/org/jupiter/common/concurrent/disruptor/WaitStrategyType.java | 0.808143 | 0.525856 | WaitStrategyType.java | starcoder |
import edu.princeton.cs.algs4.In;
import edu.princeton.cs.algs4.StdIn;
import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdRandom;
import java.io.File;
import java.util.Arrays;
public class Filtering {
public static void main(String[] args) {
StdOut.print("Enter the file name:");
... | Courses + Books/Algorithms/Book/Part 1/01 - Fundamentals/01_1 - Basic Programming Model/Creative Problems/Filtering.java | 0.620737 | 0.46557 | Filtering.java | starcoder |
package org.locationtech.geowave.core.store.query.filter.expression.text;
import org.locationtech.geowave.core.store.query.filter.expression.ComparableExpression;
import org.locationtech.geowave.core.store.query.filter.expression.ComparisonOperator.CompareOp;
import org.locationtech.geowave.core.store.query.filter.exp... | core/store/src/main/java/org/locationtech/geowave/core/store/query/filter/expression/text/TextExpression.java | 0.938836 | 0.595698 | TextExpression.java | starcoder |
package lol.game;
import java.util.*;
// The battlefield is the place where teams compete.
// It is a square grid with ground tiles (such as grass and rock), and destructible entities (such as champion and nexus).
// The overlapping of ground tiles with destructible entities forms the state of the battlefield.
// Whe... | src/main/java/lol/game/Battlefield.java | 0.801703 | 0.567577 | Battlefield.java | starcoder |
package java.lang;
/**
* A string buffer implements a mutable sequence of characters. A string buffer is like a String, but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls.
* String buffers... | classpath/src/main/java/java/lang/StringBuffer.java | 0.89991 | 0.642573 | StringBuffer.java | starcoder |
package gov.nasa.jpl.aerie.contrib.cells.linear;
import gov.nasa.jpl.aerie.merlin.framework.CellRef;
import gov.nasa.jpl.aerie.merlin.protocol.model.Applicator;
import gov.nasa.jpl.aerie.merlin.protocol.types.Duration;
import gov.nasa.jpl.aerie.merlin.protocol.types.RealDynamics;
import java.util.function.Function;
... | contrib/src/main/java/gov/nasa/jpl/aerie/contrib/cells/linear/LinearIntegrationCell.java | 0.925474 | 0.46478 | LinearIntegrationCell.java | starcoder |
package org.modeshape.common.text;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Locale;
import java.util.NoSuchElementException;
import org.modeshape.common.CommonI18n;
import org.modeshape.common.annotation.Immutable;
import org.modeshap... | modeshape-jcr/src/main/java/org/modeshape/common/text/TokenStream.java | 0.859855 | 0.631054 | TokenStream.java | starcoder |
package com.mousebird.maply;
import java.lang.ref.WeakReference;
/**
* This object parses Mapbox Vector Tile format one tile at a time.
* Set it up and then ask it to parse the given blob of data into vector objects.
* <br>
* Just supports vector data for now.
*/
public class MapboxVectorTileParser
{
VectorS... | android/library/maply/src/main/java/com/mousebird/maply/MapboxVectorTileParser.java | 0.900404 | 0.479138 | MapboxVectorTileParser.java | starcoder |
package org.point85.uom;
import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.HashMap;
import java.util.Map;
/**
* UnitType is an enumeration of unit of measure types. Only units of measure
* with the same type can be converted.
*
* @author <NAME>
*
*/
public enum UnitType {
// dimension-less "... | src/main/java/org/point85/uom/UnitType.java | 0.739046 | 0.637313 | UnitType.java | starcoder |
package com.aionemu.gameserver.model.geometry;
import com.aionemu.gameserver.model.templates.zone.Point2D;
import com.aionemu.gameserver.utils.MathUtil;
import com.aionemu.gameserver.world.zone.ZoneName;
/**
* @author MrPoke
*/
public class SphereArea implements Area {
protected float x;
protected float y;... | AL-Game/src/com/aionemu/gameserver/model/geometry/SphereArea.java | 0.878601 | 0.465509 | SphereArea.java | starcoder |
package edu.log;
import java.util.Stack;
import java.util.StringTokenizer;
/**
* Esta quiza es la clase mas importante de la aplicacion ya que es la que convierte la entrada
* en la salida, funciona para funciones matematicas basicas, como suma, resta, multiplicacion,
* division, exponenciacion y precedenc... | edu/log/DemultiplexorExpresion.java | 0.503418 | 0.466116 | DemultiplexorExpresion.java | starcoder |
package codebook.math;
import java.util.ArrayList;
public class PolynomialRootFinder {
static final double EPS = 1e-9;
static final double INF = 1e30;
static double evaluate(ArrayList<Monomial> polynomial, double x) {
double ret = 0;
for (Monomial m : polynomial)
ret += m.evaluate(x);
return... | src/codebook/math/PolynomialRootFinder.java | 0.851583 | 0.633949 | PolynomialRootFinder.java | starcoder |
package edu.princeton.cs.exercise.chapter1_3;
import edu.princeton.cs.algs4.StdOut;
/**
* 1.3.39 Ring buffer. A ring buffer, or circular queue, is a FIFO data structure of a fixed size N.
* It is useful for transferring data between asynchronous processes or for storing log files. When
* the buffer is empty, the c... | alg4/src/edu/princeton/cs/exercise/chapter1_3/E01_03_39.java | 0.651244 | 0.494141 | E01_03_39.java | starcoder |
package org.locationtech.geowave.adapter.vector.util;
import java.util.HashMap;
import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.locationtech.jts.densify.Densifier;
import org.locationtech.jts.geom.Geometry;
import org.locat... | extensions/adapters/vector/src/main/java/org/locationtech/geowave/adapter/vector/util/PolygonAreaCalculator.java | 0.877464 | 0.417746 | PolygonAreaCalculator.java | starcoder |
package Chapter06GraphModellingAndFloodfill.Section4Floodfill;
import java.util.ArrayDeque;
import java.util.Queue;
public class SolutionBFS {
/**
* 四联通偏移分量
*/
private int[][] dirs = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
/**
* 栅格的行数
*/
private int R;
/**
* 栅格的列
*/
p... | Part2BasicGraph/src/main/java/Chapter06GraphModellingAndFloodfill/Section4Floodfill/SolutionBFS.java | 0.529263 | 0.422505 | SolutionBFS.java | starcoder |
package com.kaylerrenslow.armaplugin.lang.sqf.syntax;
import com.kaylerrenslow.armaplugin.lang.sqf.syntax.ValueType.BaseType;
import org.junit.Test;
import static com.kaylerrenslow.armaplugin.lang.sqf.syntax.ValueType.typeEquivalent;
import static org.junit.Assert.assertEquals;
/**
* @author Kayler
* @since 11/19/... | tests/com/kaylerrenslow/armaplugin/lang/sqf/syntax/ValueTypeEquivalenceTest.java | 0.69946 | 0.450239 | ValueTypeEquivalenceTest.java | starcoder |
package org.mastodon.adapter;
import org.mastodon.Ref;
/**
* Bidirectional mapping between "left" ({@code L}) and "right" ({@code R})
* elements. This is used (for example) by adapters between model graph entities
* and view graph entities.
* <p>
* The interface reflects that often both {@code L} and {@code R} a... | src/main/java/org/mastodon/adapter/RefBimap.java | 0.924747 | 0.507934 | RefBimap.java | starcoder |
package us.ihmc.commonWalkingControlModules.trajectories;
import us.ihmc.euclid.referenceFrame.FramePoint3D;
import us.ihmc.euclid.referenceFrame.FramePose3D;
import us.ihmc.euclid.referenceFrame.FrameQuaternion;
import us.ihmc.euclid.referenceFrame.FrameVector3D;
import us.ihmc.euclid.referenceFrame.ReferenceFrame;
i... | ihmc-common-walking-control-modules/src/main/java/us/ihmc/commonWalkingControlModules/trajectories/SoftTouchdownPoseTrajectoryGenerator.java | 0.901078 | 0.552479 | SoftTouchdownPoseTrajectoryGenerator.java | starcoder |
package de.doe300.activerecord.dsl;
import de.doe300.activerecord.AssertException;
import de.doe300.activerecord.RecordBase;
import de.doe300.activerecord.RecordCore;
import de.doe300.activerecord.TestBase;
import de.doe300.activerecord.TestInterface;
import de.doe300.activerecord.TestServer;
import de.doe300.activere... | test/de/doe300/activerecord/dsl/SimpleConditionTest.java | 0.696887 | 0.460956 | SimpleConditionTest.java | starcoder |
package au.org.ands.vocabs.registry.notification;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang3.builder.Diff;
import au.org.ands.vocabs.registry.enums.Regi... | src/main/java/au/org/ands/vocabs/registry/notification/VocabularyDifferences.java | 0.918626 | 0.51013 | VocabularyDifferences.java | starcoder |
package com.android.server.telecom;
/**
* Defines call-state constants of the different states in which a call can exist. Although states
* have the notion of normal transitions, due to the volatile nature of telephony systems, code
* that uses these states should be resilient to unexpected state changes outside of... | services/Telecomm/src/com/android/server/telecom/CallState.java | 0.887686 | 0.523968 | CallState.java | starcoder |
package eu.socialsensor.graphdatabases;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Represents a graph database
*
* @author sotbeis, <EMAIL>
* @author <NAME>
*/
public interface GraphDatabase<VertexIteratorType, EdgeIteratorType, VertexType, EdgeType>
{
//ed... | src/main/java/eu/socialsensor/graphdatabases/GraphDatabase.java | 0.841272 | 0.48249 | GraphDatabase.java | starcoder |
package net.imglib2.histogram;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.imglib2.Cursor;
import net.imglib2.Interval;
import net.imglib2.Positionable;
import net.imglib2.RandomAccess;
import net.imglib2.RealPositionable;
import net.imglib2.img.Img;
import net.imglib2.img... | src/main/java/net/imglib2/histogram/DiscreteFrequencyDistribution.java | 0.903497 | 0.432663 | DiscreteFrequencyDistribution.java | starcoder |
package simple.example.kocheng;
import android.content.Context;
import java.util.ArrayList;
import java.util.List;
import simple.example.kocheng.model.Anjing;
import simple.example.kocheng.model.Kucing;
import simple.example.kocheng.model.Beruang;
public class DataProvider {
private static List<Kucing> kucings ... | app/src/main/java/simple/example/kocheng/DataProvider.java | 0.581897 | 0.476519 | DataProvider.java | starcoder |
package com.chopshop166.chopshoplib.outputs;
import java.util.function.BooleanSupplier;
import java.util.function.DoublePredicate;
import java.util.function.DoubleUnaryOperator;
import com.chopshop166.chopshoplib.SampleBuffer;
import com.google.common.math.Stats;
/**
* A function from double to double, converting a... | core/src/main/java/com/chopshop166/chopshoplib/outputs/Modifier.java | 0.938569 | 0.409988 | Modifier.java | starcoder |
package org.tensorflow.keras.metrics;
import org.tensorflow.DataType;
import org.tensorflow.Operand;
import org.tensorflow.keras.backend.tf.Tuple;
import org.tensorflow.keras.losses.LossFunction;
import org.tensorflow.keras.metrics.impl.MeanMetricWrapper;
import org.tensorflow.keras.metrics.impl.MetricUtils;
import or... | src/main/java/org/tensorflow/keras/metrics/Accuracy.java | 0.946039 | 0.519278 | Accuracy.java | starcoder |
package org.eclipse.jdt.debug.tests.eval;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue;
public class ArrayInitializationTests extends Tests {
public ArrayInitializationTests(String arg) {
... | corpus/class/eclipse.jdt.debug/725.java | 0.575946 | 0.433142 | 725.java | starcoder |
package types.io;
import java.util.ArrayList;
import types.core.SyntacticType;
public class WhileyParser {
private String input;
private int index;
public WhileyParser(String input) {
this.input = input;
this.index = 0;
}
public SyntacticType parse() {
SyntacticType lhs = parseUnion();
skipWhiteSpace()... | src/types/io/WhileyParser.java | 0.79956 | 0.55917 | WhileyParser.java | starcoder |
package org.onosproject.meshmanager.api.message;
public class LinkStats {
private double throughputUl;
private double throughputDl;
private Long numDataBytesUl;
private Long numDataBytesDl;
private Long numGoodPktsUl;
private Long numGoodPktsDl;
private Long numBadPktsUl;
private Long n... | ONOS/src/apps/meshmanager/src/main/java/org/onosproject/meshmanager/api/message/LinkStats.java | 0.760117 | 0.519399 | LinkStats.java | starcoder |
package org.orekit.bodies;
import java.io.Serializable;
import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
import org.apache.commons.math3.geometry.euclidean.threed.Line;
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.apache.commons.math3.geometry.euclidean.twod.Vector2D... | src/main/java/org/orekit/bodies/OneAxisEllipsoid.java | 0.965698 | 0.530236 | OneAxisEllipsoid.java | starcoder |
package org.culturegraph.mf.biblio.iso2709;
import java.nio.charset.Charset;
import org.culturegraph.mf.framework.FormatException;
/**
* Provides methods for reading and writing strings and integers in a byte
* array.
* <p>
* All methods except for the {#stringAt(int, int, Charset)} method assume
* that the byt... | src/main/java/org/culturegraph/mf/biblio/iso2709/Iso646ByteBuffer.java | 0.955131 | 0.627923 | Iso646ByteBuffer.java | starcoder |
* Pack multiple values into a single long using bit-shifting
* @author pavlo
*/
package pt.haslab.htapbench.util;
import java.io.IOException;
import java.util.Arrays;
import pt.haslab.htapbench.util.json.JSONException;
import pt.haslab.htapbench.util.json.JSONObject;
import pt.haslab.htapbench.util.json.JSONStringer;... | src/pt/haslab/htapbench/util/CompositeId.java | 0.867359 | 0.529507 | CompositeId.java | starcoder |
package com.gdx.main.physics;
import java.lang.Math;
import com.badlogic.gdx.math.Vector2;
public class Vector2D {
public float x, y;
public Vector2D(float x, float y) {
this.x = x;
this.y = y;
}
public Vector2D(float m, float d, boolean israd) {
d = (float)(israd ? d : Math.toRadians(d));
x = (float)... | core/src/com/gdx/main/physics/Vector2D.java | 0.867359 | 0.822474 | Vector2D.java | starcoder |
package com.cowboysmall.playful.math;
import java.util.Arrays;
import static java.lang.Math.sqrt;
import static java.lang.String.format;
public class Vector4D {
private final double[] values;
//_________________________________________________________________________
public Vector4D(double x, double ... | playful-util/src/main/java/com/cowboysmall/playful/math/Vector4D.java | 0.694717 | 0.854885 | Vector4D.java | starcoder |
package org.eng.aisp.classifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.function.Predicate;
import org.eng.aisp.AISPException;
import org.eng.aisp.ILabeledDataWindow;
import org.eng.aisp.AISPRuntime;
import org.eng.aisp.feature.Featu... | aisp-core/aisp-core-main/src/main/java/org/eng/aisp/classifier/AbstractFixableFeatureExtractingClassifier.java | 0.742795 | 0.474266 | AbstractFixableFeatureExtractingClassifier.java | starcoder |
package org.apache.flink.table.planner.functions.casting;
import org.apache.flink.annotation.Internal;
import org.apache.flink.table.types.logical.LogicalType;
import org.apache.flink.table.types.logical.LogicalTypeFamily;
import org.apache.flink.table.types.logical.LogicalTypeRoot;
import javax.annotation.Nullable;
... | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/CastRulePredicate.java | 0.885946 | 0.524638 | CastRulePredicate.java | starcoder |
package org.tensorflow.framework.metrics;
import static org.tensorflow.framework.utils.CastHelper.cast;
import java.util.ArrayList;
import java.util.List;
import org.tensorflow.Operand;
import org.tensorflow.framework.initializers.Zeros;
import org.tensorflow.framework.losses.impl.LossTuple;
import org.tensorflow.fra... | tensorflow-framework/src/main/java/org/tensorflow/framework/metrics/MeanTensor.java | 0.94843 | 0.461017 | MeanTensor.java | starcoder |
package com.clearspring.analytics.stream.cardinality;
import java.io.Serializable;
import java.util.Arrays;
import com.clearspring.analytics.hash.Lookup3Hash;
import com.clearspring.analytics.util.IBuilder;
/**
* <p>
* Based on the adaptive counting approach of:<br/>
* <i>Fast and Accurate Traffic Matrix Measurem... | src/main/java/com/clearspring/analytics/stream/cardinality/AdaptiveCounting.java | 0.723993 | 0.435902 | AdaptiveCounting.java | starcoder |
package kenny.net.buffer;
import java.nio.ByteOrder;
/**
* Created by kennylbj on 16/10/4.
*/
public class BigEndianHeapBuffer extends HeapBuffer {
/**
* Creates a new big-endian heap buffer with a newly allocated byte array.
*
* @param length the length of the new byte array
*/
public ... | kiwi-core/src/main/java/kenny/net/buffer/BigEndianHeapBuffer.java | 0.928644 | 0.480905 | BigEndianHeapBuffer.java | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.