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 com.google.cloud.spanner;
import static com.google.common.base.Preconditions.checkState;
import com.google.cloud.ByteArray;
import com.google.cloud.Date;
import com.google.cloud.Timestamp;
import java.math.BigDecimal;
import java.util.List;
/**
* Base class for assisting {@link StructReader} implementations... | google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractStructReader.java | 0.915271 | 0.494202 | AbstractStructReader.java | starcoder |
package com.mingshashan.learn.lt.l066;
/**
* You are given a large integer represented as an integer array digits,
* where each digits[i] is the ith digit of the integer.
* The digits are ordered from most significant to least significant in left-to-right order.
* The large integer does not contain any leading 0's... | src/main/java/com/mingshashan/learn/lt/l066/Solution_66.java | 0.859044 | 0.583678 | Solution_66.java | starcoder |
package alternate8888.machine;
/**
* Stores status bits in binary, but allows easy access to the state with getter
* methods
*
* @author <NAME>
*/
public class StatusBitRegister implements Register {
/**
* This bit is set to 1 if a carry has occurred. The Carry Bit is usually
* affected by such operation... | src/main/java/alternate8888/machine/StatusBitRegister.java | 0.89826 | 0.494995 | StatusBitRegister.java | starcoder |
package com.datastax.driver.core;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import com.google.common.r... | driver-core/src/main/java/com/datastax/driver/core/AbstractGettableByIndexData.java | 0.91721 | 0.428353 | AbstractGettableByIndexData.java | starcoder |
package org.lwjgl.opengles;
import org.lwjgl.system.*;
/**
* Native bindings to the <a target="_blank" href="https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_raster_multisample.txt">EXT_raster_multisample</a> extension.
*
* <p>This extension allows rendering to a non-multisample color buffer while raste... | modules/lwjgl/opengles/src/generated/java/org/lwjgl/opengles/EXTRasterMultisample.java | 0.856017 | 0.484929 | EXTRasterMultisample.java | starcoder |
package dev.lucifer.benchmarks;
import jdk.incubator.vector.ByteVector;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorOperators;
import jdk.incubator.vector.VectorSpecies;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotatio... | src/main/java/dev/lucifer/benchmarks/ArrayMismatchBenchmark.java | 0.739234 | 0.518546 | ArrayMismatchBenchmark.java | starcoder |
package fitaview.tree;
import java.io.File;
import java.io.IOException;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.xml.sax.SAXException;
import fitaview.Pair;
public class TreeReaderTest
{
public static final String DIRECTORY = "test_files/TreeRead... | test/fitaview/tree/TreeReaderTest.java | 0.690768 | 0.46393 | TreeReaderTest.java | starcoder |
a.
Write the simulate method, which simulates the frog attempting to hop in a straight line to a goal from the frog's starting position of 0 within a maximum number of hops. The method returns true if the frog successfully reached the goal within the maximum number of hops; otherwise, the method returns false.
The Frog... | FRQ Practice/Collegeboard/FrogSimulation.java | 0.609873 | 0.930774 | FrogSimulation.java | starcoder |
package com.xmu.arac.draw;
import java.util.Vector;
//Class:Rectangle
//Usage:Easy to Create Rectangle for
public class Rectangle {
private int length;
private int height;
private int width;
//The center Point of the Rectangle
private Vertex3D center;
public Vector points8;
Rectangle(){... | app/src/main/java/com/xmu/arac/draw/Rectangle.java | 0.835819 | 0.540499 | Rectangle.java | starcoder |
package org.apache.tapestry5.ioc.services;
import org.apache.tapestry5.plastic.PlasticUtils;
/**
* An immutable object that represents a mapping from one type to another. This is also the contribution type when
* building the {@link org.apache.tapestry5.ioc.services.TypeCoercer} service. Wraps a
* {@link org.apac... | tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/CoercionTuple.java | 0.925474 | 0.443781 | CoercionTuple.java | starcoder |
package com.jstarcraft.recommendation.recommender.collaborative.rating;
import com.jstarcraft.ai.math.structure.DefaultScalar;
import com.jstarcraft.ai.math.structure.MathCalculator;
import com.jstarcraft.ai.math.structure.matrix.DenseMatrix;
import com.jstarcraft.ai.math.structure.matrix.MatrixScalar;
import co... | src/main/java/com/jstarcraft/recommendation/recommender/collaborative/rating/ASVDPlusPlusRecommender.java | 0.672224 | 0.407893 | ASVDPlusPlusRecommender.java | starcoder |
package rx.internal.util.unsafe;
import static rx.internal.util.unsafe.UnsafeAccess.UNSAFE;
import java.util.AbstractQueue;
import java.util.Iterator;
abstract class ConcurrentCircularArrayQueueL0Pad<E> extends AbstractQueue<E> implements MessagePassingQueue<E> {
long p00, p01, p02, p03, p04, p05, p06, p07;
... | src/main/java/rx/internal/util/unsafe/ConcurrentCircularArrayQueue.java | 0.924432 | 0.517388 | ConcurrentCircularArrayQueue.java | starcoder |
package com.google.security.zynamics.binnavi.API.disassembly;
import java.util.ArrayList;
import java.util.List;
import com.google.common.base.Preconditions;
// / Represents a single block of a function.
/**
* Represents a function in a callgraph.
*/
public final class FunctionBlock implements IGraphNode<FunctionB... | src/main/java/com/google/security/zynamics/binnavi/API/disassembly/FunctionBlock.java | 0.930584 | 0.50415 | FunctionBlock.java | starcoder |
public class Circle {
private double radius;
private String colour;
private int centreX, centreY;
/** Creates a black circle with radius=50 and centered at (100,100). */
public Circle()
{
radius = 50;
colour = "black";
centreX = 100;
centreY = 100;
}
/*... | code/basic/Circle.java | 0.928466 | 0.512815 | Circle.java | starcoder |
package datastrutures.backtracking;
/**
* Created by archithrapaka on 2/25/17.
* Given a 2D gird of letters , search for a word
* Backtrack
*/
public class SearchAword {
static int path = 1;
static int xDirection[] = {-1, -1, -1, 0, 0, 1, 1, 1};
static int yDirection[] = {-1, 0, 1, -1, 1, -1, 0, 1};
... | algorithms/src/main/java/datastrutures/backtracking/SearchAword.java | 0.709422 | 0.455744 | SearchAword.java | starcoder |
package com.facebook.common.internal;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import static com.facebook.common.internal.Preconditions.checkNotNull;
/**
... | fbcore/src/main/java/com/facebook/common/internal/ByteStreams.java | 0.888964 | 0.473292 | ByteStreams.java | starcoder |
package org.orekit.forces.drag;
import java.util.ArrayList;
import java.util.List;
import java.util.NavigableSet;
import java.util.stream.Stream;
import org.hipparchus.Field;
import org.hipparchus.RealFieldElement;
import org.hipparchus.analysis.differentiation.DerivativeStructure;
import org.hipparchus.analysis.diff... | src/main/java/org/orekit/forces/drag/TimeSpanDragForce.java | 0.871912 | 0.463323 | TimeSpanDragForce.java | starcoder |
package com.sunny.grokkingalgorithms.basic_2020.warmup;
public class MissingInteger {
/*
* Write a function:
class Solution { public int solution(int[] A); }
that, given an array A of N integers, returns the smallest positive integer (greater than 0)
that does not occur in A.
For example, given A = [1, 3, 6, 4... | src/main/java/com/sunny/grokkingalgorithms/basic_2020/warmup/MissingInteger.java | 0.58948 | 0.57338 | MissingInteger.java | starcoder |
package com.github.imzhoukunqiang.parser.utils;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BooleanSupplier;
import java.util.function.Function;
import java.util.function.Supplier;
public final class ... | src/main/java/com/github/imzhoukunqiang/parser/utils/Commons.java | 0.718792 | 0.499207 | Commons.java | starcoder |
package com.revolsys.collection.map;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.function.Supplier;
public class MapMap<K1, K2, V, M extends Map<K2, V>> extends DelegatingMap<K1, M> {
public static <NK1, NK2, NV> MapMap<NK1, NK2, NV, Ma... | revolsys-core/src/main/java/com/revolsys/collection/map/MapMap.java | 0.902962 | 0.427935 | MapMap.java | starcoder |
package in.vikk.dailycoding;
import in.vikk.ds.tree.BinaryTree;
//A unival tree (which stands for "universal value") is a tree where all nodes under it have the same value.
//Given the root to a binary tree, count the number of unival subtrees.
public class UniValTree<T extends Comparable<T>> extends BinaryTree<T> {... | src/in/vikk/dailycoding/UniValTree.java | 0.849019 | 0.476823 | UniValTree.java | starcoder |
package structures.graph;
import internal.Preconditions;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
public class UnDirectedGraph {
private int nodeNum;
private Edge[] edges;
private int totalWeight;
private UnDirectedGraph() {}
public int getNodeNum() {
return nodeNum... | DataStructures/src/main/java/structures/graph/UnDirectedGraph.java | 0.759136 | 0.415077 | UnDirectedGraph.java | starcoder |
package org.threeten.extra.scale;
import static java.time.temporal.ChronoField.INSTANT_SECONDS;
import static java.time.temporal.ChronoField.NANO_OF_SECOND;
import static org.threeten.extra.scale.UtcRules.NANOS_PER_SECOND;
import static org.threeten.extra.scale.UtcRules.OFFSET_MJD_EPOCH;
import static org.threeten.ext... | src/main/java/org/threeten/extra/scale/UtcInstant.java | 0.949206 | 0.509154 | UtcInstant.java | starcoder |
package q850;
import org.junit.runner.RunWith;
import util.runner.Answer;
import util.runner.LeetCodeRunner;
import util.runner.TestData;
import util.runner.data.DataExpectation;
/**
* https://leetcode.com/problems/largest-triangle-area/
*
* You have a list of points in the plane. Return the area of the largest tr... | src/main/java/q850/Q812_LargestTriangleArea.java | 0.836555 | 0.452354 | Q812_LargestTriangleArea.java | starcoder |
package com.robotzero.render;
import com.robotzero.infrastructure.Window;
import org.joml.Matrix4f;
import org.joml.Vector2f;
import org.joml.Vector3f;
public class Camera {
private boolean isPerspective = false;
private Matrix4f projectionMatrix, viewMatrix, inverseProjection;
private float fov = 45;
private... | src/main/java/com/robotzero/render/Camera.java | 0.858467 | 0.53522 | Camera.java | starcoder |
package utils.lang;
public abstract class Lang {
public static final ELang lang = ELang.EN_US;
public static final String[] pt_br = new String[] {
"Portuguese",
"Portugu�s",
};
public static final String[] en_us = new String[] { "English", "Ingl�s" };
public static final String[] language = new Str... | src/utils/lang/Lang.java | 0.629205 | 0.527986 | Lang.java | starcoder |
package shared.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Set;
// This class models a generic graph data structure.
// We repre... | sharedlib/src/main/java/shared/util/Graph.java | 0.885891 | 0.54958 | Graph.java | starcoder |
package fr.univ_artois.lgi2a.similar.extendedkernel.examples.bubblechamber.model.environment.chamber;
import java.awt.geom.Point2D;
import java.util.Map;
import fr.univ_artois.lgi2a.similar.extendedkernel.examples.bubblechamber.model.agents.BubbleChamberAgentCategoriesList;
import fr.univ_artois.lgi2a.similar.extende... | similar-extendedKernel-examples/src/main/java/fr/univ_artois/lgi2a/similar/extendedkernel/examples/bubblechamber/model/environment/chamber/EnvNaturalInChamber.java | 0.528777 | 0.526221 | EnvNaturalInChamber.java | starcoder |
package io.virtdata.core;
import io.virtdata.api.FunctionType;
import io.virtdata.api.DataMapper;
import java.util.function.*;
/**
* <p>This class implements an obtuse way of avoiding autoboxing and M:N type
* mapping complexity by way of doublish dispatch. It was preferred over a more
* generalized reflection an... | virtdata-api/src/main/java/io/virtdata/core/DataMapperFunctionMapper.java | 0.768212 | 0.476336 | DataMapperFunctionMapper.java | starcoder |
package com.opengamma.strata.product.swap;
import static com.opengamma.strata.collect.Guavate.toImmutableList;
import static com.opengamma.strata.collect.Guavate.toImmutableSet;
import java.io.Serializable;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementExcepti... | modules/product/src/main/java/com/opengamma/strata/product/swap/Swap.java | 0.926728 | 0.600305 | Swap.java | starcoder |
import java.util.Iterator;
public interface MusicList {
/**
* The number of channels in the SoundList
* @return The number f channels in the SoundList
*/
public int getNumChannels();
/**
* Returns the sample rate, in samples per second
* @return The sample rate, in samples per second
*/
... | src/MusicList.java | 0.853958 | 0.554229 | MusicList.java | starcoder |
package org.gu.dcore.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.gu.dcore.utils.Utils;
public class AtomSet implements Iterable<Atom> {
private ArrayList<Atom> atoms;
private Set<... | src/main/java/org/gu/dcore/model/AtomSet.java | 0.761982 | 0.413596 | AtomSet.java | starcoder |
package minijava.util;
import java.io.PrintStream;
import java.util.*;
public class SimpleGraph<NodeInfo> {
private final Set<Node> nodes = new HashSet<>();
private Map<Node, Set<Node>> successors = new HashMap<>();
private Map<Node, Set<Node>> predecessors = new HashMap<>();
public class Node {
... | src/minijava/util/SimpleGraph.java | 0.815159 | 0.589716 | SimpleGraph.java | starcoder |
package Hard;
import java.util.*;
/**
*
* Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.
*
* get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
* put(key, value) -... | Java/src/Hard/LRUCache.java | 0.868674 | 0.411288 | LRUCache.java | starcoder |
package main.be.ua.mbarbier.external;
import java.awt.Polygon;
import ij.gui.Roi;
/*
* Object histogram,
* 2 parameters imp en treshold
* methodes:
* *exec
*/
public class Hausdorff_Distance2 {
double hausdorffDistance;
double averagedHausdorffDistance;
public Hausdorff_Distance2() {
this.hausdorffD... | src/main/be/ua/mbarbier/external/Hausdorff_Distance2.java | 0.59302 | 0.478651 | Hausdorff_Distance2.java | starcoder |
package org.jacoco.core.internal.analysis;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Collections;
import org.jacoco.core.analysis.ICoverageNode;
import org.jaco... | org.jacoco.core.test/src/org/jacoco/core/internal/analysis/ClassCoverageImplTest.java | 0.834508 | 0.456289 | ClassCoverageImplTest.java | starcoder |
package org.tensorflow.lite.support.image;
import android.graphics.Bitmap;
import android.graphics.Color;
import java.nio.ByteBuffer;
import org.tensorflow.lite.DataType;
import org.tensorflow.lite.support.tensorbuffer.TensorBuffer;
/** Creates test images for other test files. */
final class TestImageCreator {
/**... | tensorflow_lite_support/java/src/javatests/org/tensorflow/lite/support/image/TestImageCreator.java | 0.873188 | 0.650037 | TestImageCreator.java | starcoder |
package gridsim.auction;
import eduni.simjava.Sim_event;
import eduni.simjava.Sim_port;
import gridsim.GridSim;
import gridsim.GridSimTags;
/**
* This class represents an one-sided auction. One-sided auctions
* send announcements of a good to be sold and receive bids from
* bidders. It can have several rounds.
*
... | hcu/hcu-external-lib/src/main/java/gridsim/auction/OneSidedAuction.java | 0.783285 | 0.533154 | OneSidedAuction.java | starcoder |
package io.github.m;
import java.util.HashMap;
import java.util.Map;
/**
* M wrapper class for data.
*/
public interface Data extends Value.Delegate {
/**
* The type of the data.
*/
Symbol type();
/**
* The value of a field given a name.
*/
Value get(Symbol name);
/**
... | src/main/java/io/github/m/Data.java | 0.930229 | 0.441191 | Data.java | starcoder |
package com.sportradar.unifiedodds.sdk.caching.ci;
import com.google.common.base.Preconditions;
import com.sportradar.uf.sportsapi.datamodel.SAPISportEventConditions;
import com.sportradar.unifiedodds.sdk.caching.exportable.ExportableSportEventConditionsCI;
import com.sportradar.unifiedodds.sdk.entities.Pitcher;
impo... | sdk-core/src/main/java/com/sportradar/unifiedodds/sdk/caching/ci/SportEventConditionsCI.java | 0.897024 | 0.426322 | SportEventConditionsCI.java | starcoder |
package alfredo.sprite;
import alfredo.geom.Point;
/**
* A Transform encapsulates a position and a direction.
*
* The position is a Point and can be used as such, while the
* direction is a double for maximum accuracy.
* @author TheMonsterFromTheDeep
*/
public class Transform implements Worldly {
protected... | src/alfredo/sprite/Transform.java | 0.94699 | 0.581065 | Transform.java | starcoder |
import java.util.*;
class SequenceReconstruction {
public static boolean canConstruct(int[] originalSeq, int[][] sequences) {
if(originalSeq == null || originalSeq.length == 0) return false;
//Initialize graph
Map<Integer, Integer> inDegree = new HashMap<Integer, Integer>();
Map<Integer, List<In... | algorithms/src/graphs/sequence_reconstruction/SequenceReconstruction.java | 0.675551 | 0.49231 | SequenceReconstruction.java | starcoder |
package com.sirfoga.hal.maths.geometry;
/**
* Abstract geometry class to subclass all 3d planes
*/
public class Geometry3d extends Geometry {
public static final int X_AXIS = 2;
public static final int Y_AXIS = 3;
public static final int Z_AXIS = 4;
/*
* Constructors
*/
public Geometr... | vsm/app/src/main/java/com/sirfoga/hal/maths/geometry/Geometry3d.java | 0.936489 | 0.457197 | Geometry3d.java | starcoder |
package com.qihoo.qsql.plan.proc;
import com.qihoo.qsql.org.apache.calcite.rel.TreeNode;
import com.qihoo.qsql.plan.ProcedureVisitor;
import com.qihoo.qsql.plan.Traversable;
import java.util.List;
/**
* QueryProcedure, the basic description in QSql for SQL. <p> In QSql, a SQL line is divided into sub-SQLs ... | core/src/main/java/com/qihoo/qsql/plan/proc/QueryProcedure.java | 0.781664 | 0.45042 | QueryProcedure.java | starcoder |
package uk.ac.leeds.ccg.v3d.geometry;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import uk.ac.leeds.ccg.math.number.Math_BigRational;
/**
* A set of V3D_Tetrahedron.
*
* @author <NAME>
* @version 1.0
*/
public class V3D_Tetrahe... | src/main/java/uk/ac/leeds/ccg/v3d/geometry/V3D_Tetrahedrons.java | 0.953665 | 0.414603 | V3D_Tetrahedrons.java | starcoder |
package util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by clwang on 1/7/16.
*/
public class CombinationGenerator {
// Given a list of objects, return a list containing all permutations of the object
public static <T> List<List<T>> genCombination(List<T> list... | scythe/src/util/CombinationGenerator.java | 0.83924 | 0.429669 | CombinationGenerator.java | starcoder |
package seedu.address.model.vendor;
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.H... | src/main/java/seedu/address/model/vendor/VendorPredicate.java | 0.913136 | 0.401453 | VendorPredicate.java | starcoder |
import java.util.List;
import java.util.ArrayList;
/**
* The ElevensBoard class represents the board in a game of Elevens.
* AP Computer Science A 2015
*/
public class ElevensBoard {
/**
* The size (number of cards) on the board.
*/
private static final int BOARD_SIZE = 9;
/**
* The cards on th... | src/main/java/com/justinwflory/assignments/spring/elevens-lab/ElevensBoard.java | 0.856092 | 0.546133 | ElevensBoard.java | starcoder |
package levels;
import java.awt.*;
import java.util.ArrayList;
import levels.Room.RoomType;
/**
* The minimap for the level that displays rooms in the level. It only shows
* rooms that the player has visited. Green rooms are locked rooms, red rooms
* are boss rooms, black rooms are regular rooms and the white room... | levels/Minimap.java | 0.842378 | 0.453564 | Minimap.java | starcoder |
class Solution {
public int[] findErrorNums(int[] nums) {
int[] count = new int[nums.length + 1];
for(int i = 0; i < nums.length; ++i)
count[nums[i]]++;
int duplicate = -1;
int missing = -1;
for(int i = 1; i < count.length; ++i) {
if(count[i] == 0)
... | Array/Java/645_Set_Mismatch.java | 0.719186 | 0.441673 | 645_Set_Mismatch.java | starcoder |
package io.github.rowak.nanoleafapi;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
/**
* <p>Static effects are a subset of custom effects; they are effects with no motion.
* A static effect is made up of fr... | src/main/java/io/github/rowak/nanoleafapi/StaticEffect.java | 0.904804 | 0.401131 | StaticEffect.java | starcoder |
package org.nschmidt.ldparteditor.helper.math;
import java.math.BigDecimal;
import java.math.MathContext;
import org.nschmidt.csg.VectorCSGd;
import org.nschmidt.ldparteditor.data.Vertex;
import org.nschmidt.ldparteditor.enumtype.Threshold;
/**
* Holds a 3-tuple BigDecimal vector for maximum numeric precision.
*
... | src/org/nschmidt/ldparteditor/helper/math/Vector3d.java | 0.965127 | 0.794823 | Vector3d.java | starcoder |
package net.wukl.cacofony.http.request;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* A request or response header.
*
* The header has a non-{@code null} name and zero or more values. Values also can not be
* {@code null}.
*
* When using HTTP/2,... | src/main/java/net/wukl/cacofony/http/request/Header.java | 0.946014 | 0.454472 | Header.java | starcoder |
import java.util.ArrayList;
import java.util.Collections;
/**
* Can represent a position as well as a velocity.
*/
class Vector {
private double[] vector;
private double limit = Double.MAX_VALUE;
Vector (int dimentions) {
vector = new double[dimentions];
}
Vector (double[] other) {
... | PSO/Vector.java | 0.833019 | 0.549338 | Vector.java | starcoder |
package jkanvas.table.bin;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Objects;
import jkanvas.table.DataTable;
/**
* A row of a table. Tha values are binned.
*
* @author Joschi <<EMAIL>>
*/
public class TableRow implements Iterable<Integer>, Comparable<TableRow> {
/*... | src/main/java/jkanvas/table/bin/TableRow.java | 0.867106 | 0.414603 | TableRow.java | starcoder |
package io.github.galbiston.geosparql_jena.implementation;
import io.github.galbiston.geosparql_jena.implementation.datatype.WKTDatatype;
import org.apache.jena.rdf.model.Literal;
import org.apache.jena.rdf.model.ResourceFactory;
/**
* Convenience methods to produce WKT Literals.
*
*/
public class WKTLiteralFactor... | src/main/java/io/github/galbiston/geosparql_jena/implementation/WKTLiteralFactory.java | 0.840783 | 0.518302 | WKTLiteralFactory.java | starcoder |
package thanatos.android.camera.core;
import android.graphics.PointF;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Rational;
import android.util.Size;
import java.util.Set;
/**
* A {@link MeteringPointFactory} that can create {@link MeteringPoint} by sen... | camera-core/src/main/java/thanatos/android/camera/core/SensorOrientedMeteringPointFactory.java | 0.945638 | 0.600013 | SensorOrientedMeteringPointFactory.java | starcoder |
package burlap.statehashing.simple;
import burlap.mdp.core.state.State;
import burlap.statehashing.HashableState;
import burlap.statehashing.HashableStateFactory;
/**
* A straightforward factory for creating {@link burlap.statehashing.HashableState} objects from
* {@link State} instances. It produces either a {@lin... | src/main/java/burlap/statehashing/simple/SimpleHashableStateFactory.java | 0.745954 | 0.491883 | SimpleHashableStateFactory.java | starcoder |
package me.xenodevs.xeno.utils.player;
import com.mojang.realmsclient.gui.ChatFormatting;
import me.wolfsurge.api.util.Globals;
import net.minecraft.entity.Entity;
import net.minecraft.network.play.client.CPacketPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.mine... | src/main/java/me/xenodevs/xeno/utils/player/RotationUtil.java | 0.621081 | 0.454593 | RotationUtil.java | starcoder |
package asteroids.objects;
import asteroids.Game;
import asteroids.subobjects.VariableDistancePolygon;
import asteroids.subobjects.Vector2d;
/**
* @author Dominik
*
*/
public class Asteroid {
private static final int SHAPE_SIDES = 6;
private static final int SMALLEST_SIZE = 8;
/**
* @return new random locati... | src/asteroids/objects/Asteroid.java | 0.907419 | 0.578478 | Asteroid.java | starcoder |
import java.util.*;
/**
* use the static mutator FHsort.setRecursionLimit(int)
* to change this limit to any int value in the range of 2 to 300 to find
* the optimal recursion limit arrays of various sizes
*
* @author <NAME>, <NAME>
*/
public class FH_QS_Test
{
/**
* recursion two level
* The size i... | 05_Computer Alghorithm/dixonzhao-cs1c-project08-master/src/FH_QS_Test.java | 0.583559 | 0.413418 | FH_QS_Test.java | starcoder |
package shape;
import javax.vecmath.Point2d;
import javax.vecmath.Vector2d;
import static org.testng.Assert.*;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
*
* @author masao
*/
public class TPoint2dNGTest {
public TPoint2dNGTest() {
}
@BeforeMethod
publi... | test/shape/TPoint2dNGTest.java | 0.834069 | 0.772831 | TPoint2dNGTest.java | starcoder |
package gov.sandia.cognition.learning.function.categorization;
import gov.sandia.cognition.math.matrix.Matrix;
import gov.sandia.cognition.math.matrix.Vector;
import gov.sandia.cognition.math.matrix.Vectorizable;
import gov.sandia.cognition.statistics.distribution.UnivariateGaussian;
/**
* A default implementation o... | Components/LearningCore/Source/gov/sandia/cognition/learning/function/categorization/DefaultConfidenceWeightedBinaryCategorizer.java | 0.956033 | 0.633141 | DefaultConfidenceWeightedBinaryCategorizer.java | starcoder |
package org.soulwing.prospecto.api.listener;
/**
* A listener that is notified as instances of model types are created or
* discarded during view application.
* <p>
* When a to-one or to-many association between model types is encountered
* as a view is applied to update a model, instances of the associate's
* m... | prospecto-api/src/main/java/org/soulwing/prospecto/api/listener/ViewNodeEntityListener.java | 0.906146 | 0.477859 | ViewNodeEntityListener.java | starcoder |
package com.opengg.core.model;
import com.opengg.core.engine.Resource;
import com.opengg.core.physics.collision.colliders.BoundingBox;
import com.opengg.core.physics.RigidBody;
import com.opengg.core.physics.collision.colliders.ConvexHull;
import com.opengg.core.render.Renderable;
import com.opengg.core.render.objects... | modules/core/classes/com/opengg/core/model/Model.java | 0.864182 | 0.445228 | Model.java | starcoder |
package modelo.recursos;
import modelo.Juego;
import modelo.herramientas.FabricaHerramientas;
import modelo.herramientas.Herramienta;
import modelo.jugador.InventarioMateriales;
import org.junit.Test;
import static org.junit.Assert.*;
public class BloqueMaderaTest {
@Test
public void test01... | test/modelo/recursos/BloqueMaderaTest.java | 0.558688 | 0.454109 | BloqueMaderaTest.java | starcoder |
package chalmers.pimp.model.canvas.layer;
import chalmers.pimp.model.IRenderer;
import chalmers.pimp.model.Point;
import chalmers.pimp.model.pixeldata.IPixel;
import chalmers.pimp.model.pixeldata.IRasterData;
import chalmers.pimp.model.pixeldata.IReadOnlyRasterData;
import chalmers.pimp.model.pixeldata.RasterDataFacto... | src/main/java/chalmers/pimp/model/canvas/layer/Raster.java | 0.936234 | 0.400222 | Raster.java | starcoder |
package com.github.sasakicks.draggableflipview;
import android.view.MotionEvent;
import java.util.HashMap;
/**
* a class detecting drag of user
*
* Created by sasakicks on 2015/09/09.
*/
public class DragGestureDetector {
public float deltaX;
public float deltaY;
public float prevDeltaX;
public f... | draggable-flipview/src/main/java/com/github/sasakicks/draggableflipview/DragGestureDetector.java | 0.888414 | 0.448185 | DragGestureDetector.java | starcoder |
package software.leonov.common.util.concurrent;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.Lin... | src/main/java/software/leonov/common/util/concurrent/CountingCompletionService.java | 0.920776 | 0.458046 | CountingCompletionService.java | starcoder |
package tumor.junit;
import java.util.ArrayList;
import java.util.Collection;
import jam.junit.NumericTestBase;
import jam.math.DoubleUtil;
import jam.math.Probability;
import tumor.growth.GrowthCount;
import tumor.growth.GrowthRate;
import org.junit.*;
import static org.junit.Assert.*;
public class GrowthRateTest... | src/tumor/junit/GrowthRateTest.java | 0.878731 | 0.672735 | GrowthRateTest.java | starcoder |
package gov.sandia.cognition.statistics.distribution;
import gov.sandia.cognition.math.matrix.Matrix;
import gov.sandia.cognition.math.matrix.Vector;
import gov.sandia.cognition.statistics.MultivariateClosedFormComputableDistributionTestHarness;
/**
* Unit tests for NormalInverseWishartDistributionTest.
*
* @autho... | Components/LearningCore/Test/gov/sandia/cognition/statistics/distribution/NormalInverseWishartDistributionTest.java | 0.870694 | 0.583559 | NormalInverseWishartDistributionTest.java | starcoder |
package nosubmmitted;
/**
* 256. Paint House
* https://leetcode.com/problems/paint-house/
* Difficulty: Medium <pre>
* There are a row of n houses, each house can be painted with one of the
* three colors: red, blue or green. The cost of painting each house with
* a certain color is different. You have to paint... | arrows/src/main/java/nosubmmitted/LC256PaintHouse.java | 0.922172 | 0.574872 | LC256PaintHouse.java | starcoder |
package miscellaneous.interval.lc163_missingranges;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Given a sorted integer array where the range of elements are [lower, upper] inclusive, return its missing ... | 1-algorithm/13-leetcode/java/src/miscellaneous/interval/lc163_missingranges/Solution.java | 0.908684 | 0.496155 | Solution.java | starcoder |
package com.bluenimble.platform.json.xpath.eval;
/**
* User: kalle stenflo
* Date: 2/4/11
* Time: 9:21 PM
*/
public class ExpressionEvaluator {
public static <T> boolean eval(T actual, String comparator, String expected) {
comparator = comparator.trim();
if (actual instanceof Long) {
... | sdks/bluenimble-jvm-sdk/src/main/java/com/bluenimble/platform/json/xpath/eval/ExpressionEvaluator.java | 0.673084 | 0.403714 | ExpressionEvaluator.java | starcoder |
package core;
/**
* 函数流
*/
public class FuncFlow extends Flow {
private Flowable paramFlow; // 参数流
private BlockFlow blockFlow; // 函数语句块流
public FuncFlow(ListFlow paramFlow, BlockFlow blockFlow) {
this.paramFlow = paramFlow;
this.blockFlow = blockFlow;
}
@Override
pub... | src/main/java/core/FuncFlow.java | 0.761982 | 0.58053 | FuncFlow.java | starcoder |
package net.mindengine.oculus.experior.framework.verification.number;
public class AssertionNumberVerificator<T extends Number> implements NumberVerificator<T> {
private NumberVerificator<T> numberVerificator;
public AssertionNumberVerificator(NumberVerificator<T> numberVerificator) {
this.numberVerificator =... | src/main/java/net/mindengine/oculus/experior/framework/verification/number/AssertionNumberVerificator.java | 0.761804 | 0.424531 | AssertionNumberVerificator.java | starcoder |
package hex.gam.GamSplines;
import hex.gam.MatrixFrameUtils.TriDiagonalMatrix;
import hex.util.LinearAlgebraUtils;
import water.util.ArrayUtils;
import static hex.util.LinearAlgebraUtils.generateTriDiagMatrix;
public class CubicRegressionSplines {
public double[] _knots; // store knot values for the spline class
... | h2o-algos/src/main/java/hex/gam/GamSplines/CubicRegressionSplines.java | 0.699254 | 0.57087 | CubicRegressionSplines.java | starcoder |
package com.jeantessier.classreader;
import java.util.*;
import org.jmock.*;
import org.jmock.integration.junit3.*;
public class TestLocalVariableFinder extends MockObjectTestCase {
private static final int LOCAL_VARIABLE_INDEX = 1;
private static final int START_PC = 3;
private static final int LENGTH =... | tests/com/jeantessier/classreader/TestLocalVariableFinder.java | 0.772959 | 0.441312 | TestLocalVariableFinder.java | starcoder |
package si.isystem.commons.collections;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import java.util.TreeSet;
public class ISysUniqueSortedDoubleArray {
private static final int INITIAL_ARRAY_SIZE = 1 << 12;
private double[] m_array = new double[INITIAL_ARRAY_SIZE];
... | common/si.isystem.commons.plugin/src/si/isystem/commons/collections/ISysUniqueSortedDoubleArray.java | 0.604399 | 0.453564 | ISysUniqueSortedDoubleArray.java | starcoder |
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;
public class CelestialBody {
private PlanetData planetData;
private double currentXPosition;
private double currentYPosition;
private double currentZPosition;
private double currentXVelocity;
private double currentYVelocit... | src/main/java/CelestialBody.java | 0.709824 | 0.636085 | CelestialBody.java | starcoder |
package seedu.address.model;
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import java.util.Iterator;
import java.util.List;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
/**
* A list of {@code Identif... | src/main/java/seedu/address/model/UniqueList.java | 0.920258 | 0.425009 | UniqueList.java | starcoder |
import java.util.*;
public class C {
private static List<List<Edge>> graph;
public static void main(String[] args) {
initialize();
System.out.println(minCostFlow(8));
}
private static void initialize() {
Scanner in = new Scanner(System.in);
int r1 = in.nextInt();
... | algorithms/term-4/min-cost-flow/C.java | 0.760473 | 0.467514 | C.java | starcoder |
package uk.ac.rdg.resc.edal.dataset.cdm;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import ucar.unidata.geoloc.LatLonPoint;
import ucar.unidata.geoloc.LatLonPointImpl;
import ucar.unidata.geoloc.Projection;
import ucar.unidata.geoloc.ProjectionImpl;
import ucar.unidata.geoloc.ProjectionPoint;
impor... | cdm/src/main/java/uk/ac/rdg/resc/edal/dataset/cdm/RotatedOffsetProjection.java | 0.908446 | 0.467393 | RotatedOffsetProjection.java | starcoder |
package sun.java2d.pisces;
import sun.awt.geom.PathConsumer2D;
import java.awt.geom.AffineTransform;
final class TransformingPathConsumer2D {
public static PathConsumer2D
transformConsumer(PathConsumer2D out,
AffineTransform at)
{
if (at == null) {
return ... | openjdk/classes/sun/java2d/pisces/TransformingPathConsumer2D.java | 0.841272 | 0.427546 | TransformingPathConsumer2D.java | starcoder |
package main.de.superioz.sgol;
import main.de.superioz.sgol.util.LabelManager;
import java.util.*;
/**
* Class created on 19.03.2015
*/
public class CellWorld {
private HashMap<String, Cell> cellMap = new HashMap<>();
public int[][] cells;
private int cellsWidthSize;
private int cellsHeightSize;
... | src/main/de/superioz/sgol/CellWorld.java | 0.78789 | 0.492432 | CellWorld.java | starcoder |
package problem.habitat;
import problem.Problem;
import problem.registry.Registry;
import sudoku.SudokuGrid;
import java.util.Arrays;
/**
* Represents an individual in the world of sudoku-grids
*/
public final class Individual extends SudokuGrid implements Comparable<Individual> {
private Problem problem;
... | src/problem/habitat/Individual.java | 0.823541 | 0.4231 | Individual.java | starcoder |
package com.nzt.b2d;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.physics.box2d.Shape;
import com.nzt.gdx.logger.utils.NzLoggable;
//TODO a voir si poolable
//TODO voir l'utilité
pu... | src/main/java/com/nzt/b2d/FixtureDefWrapper.java | 0.57332 | 0.438845 | FixtureDefWrapper.java | starcoder |
package com.github.fedorov_s_n.graphs;
import com.github.fedorov_s_n.graphs.representation.JPanelRepresentation;
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicIntege... | src/main/java/com/github/fedorov_s_n/graphs/Graph.java | 0.954616 | 0.491395 | Graph.java | starcoder |
import java.util.*;
/** The PhoneRecord class
* Description: Contains a single name and phone number.
* This version of the class implements comparable.
*/
public class PhoneRecord implements Comparable{
private String name;
private String phone;
/**
* PhoneRecord constructor
* Creates an object c... | java-sourcecode/ch16/PhoneRecord.java | 0.75985 | 0.465509 | PhoneRecord.java | starcoder |
package com.teacore.math;
/**
* This class provides some utility math functions, mostly the creation of common matrices.
*
* @author ShietStone
*/
public class MathUtil {
/**
* Returns a 4x4 projection matrix defined by the given parameters.
*
* @param aspect The aspect ratio (width divid... | src/com/teacore/math/MathUtil.java | 0.953827 | 0.724481 | MathUtil.java | starcoder |
package org.apache.lucene.spatial.prefix.tree;
import org.apache.lucene.util.BytesRef;
import org.locationtech.spatial4j.context.SpatialContext;
import org.locationtech.spatial4j.shape.Shape;
/**
* A spatial Prefix Tree, or Trie, which decomposes shapes into prefixed strings at variable lengths
* corresponding to v... | lucene/spatial-extras/src/java/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTree.java | 0.958963 | 0.465327 | SpatialPrefixTree.java | starcoder |
import com.studiohartman.jamepad.ControllerState;
import java.util.Arrays;
/**
* Qobj.java
* Purpose: Object for a LinkedBlockingQueue serving as communication from the {@link Gui GUI} and {@link Cstate GPAD} threads to the MAIN thread.
* All fields are public, but immutable.
*/
public final class Qobj {
/*... | src/main/java/Qobj.java | 0.769946 | 0.546012 | Qobj.java | starcoder |
package graphics;
import engine.loader.animatedModelLoader.dataStructures.MeshData;
import engine.loader.data.OBJData;
import engine.loader.data.PLYData;
import org.lwjgl.system.MemoryUtil;
import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Lis... | src/graphics/AnimatedMesh.java | 0.805135 | 0.482124 | AnimatedMesh.java | starcoder |
package com.badlogic.gdx.graphics.g3d.utils.shapebuilders;
import com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Vector3;
/** Helper class with static methods to build arrow shapes using {@link MeshPartBuilder}.
* @author xoppa */
public class A... | gdx/src/com/badlogic/gdx/graphics/g3d/utils/shapebuilders/ArrowShapeBuilder.java | 0.868074 | 0.703155 | ArrowShapeBuilder.java | starcoder |
package training.binarysearch;
import org.junit.jupiter.api.Test;
import java.util.function.ToIntFunction;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* 154. 寻找旋转排序数组中的最小值 II: https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array-ii/
*
* 假设以升序排序的数组在事先未知的某个元素上旋转。例如[0,1,2,4,5,6... | src/training/binarysearch/E154_Hard_FindMinimumInRotatedSortedArrayII.java | 0.7641 | 0.460835 | E154_Hard_FindMinimumInRotatedSortedArrayII.java | starcoder |
package org.seedstack.seed.testing.spi;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.seedstack.seed.spi.SeedLauncher;
import org.seedstack.seed.testing.LaunchMode;
/**
* Interface for implementing test plugins that can alter ... | python/experiments/projects/seedstack-seed/real_error_dataset/1/72/TestPlugin.java | 0.913722 | 0.508117 | TestPlugin.java | starcoder |
import java.util.Random;
import java.util.Vector;
abstract class ConvexHull {
static Vertex getStart(Vector<Vertex> vector) {
Vertex start = null;
for(Vertex v : vector) {
if(start == null)
start = v;
else if(start.y > v.y)
start = v;
... | src/ConvexHull.java | 0.824885 | 0.546194 | ConvexHull.java | starcoder |
package geometry;
import java.util.Comparator;
import java.util.Objects;
import math.FpUtil;
// Represents a point in 2D space.
public class Point2D extends Object {
public final double x;
public final double y;
public Point2D() {
this(0, 0);
}
public Point2D(double x, double y) {
this.x = x;
this.y =... | src/geometry/Point2D.java | 0.907929 | 0.550547 | Point2D.java | starcoder |
package io.github.mateusz00.MandelbrotSet.mandelbrot;
import io.github.mateusz00.MandelbrotSet.RGBPickers.RGBPicker;
import io.github.mateusz00.MandelbrotSet.utilities.Procedure;
import io.github.mateusz00.MandelbrotSet.utilities.Utility;
import java.awt.*;
import java.awt.geom.Point2D;
import java.awt.image.Buffered... | MandelbrotSet/src/main/java/io/github/mateusz00/MandelbrotSet/mandelbrot/MandelbrotSetController.java | 0.768299 | 0.413122 | MandelbrotSetController.java | starcoder |
package org.hibnet.jsourcemap;
import static org.hibnet.jsourcemap.TestUtil.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.Collections;
impo... | jsourcemap-test/src/java/org/hibnet/jsourcemap/SourceMapConsumerTest.java | 0.731346 | 0.604165 | SourceMapConsumerTest.java | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.