Datasets:
repo_name stringlengths 7 104 | file_path stringlengths 11 238 | context list | import_statement stringlengths 103 6.85k | code stringlengths 60 38.4k | next_line stringlengths 10 824 | gold_snippet_index int32 0 8 |
|---|---|---|---|---|---|---|
sastix/cms | server/src/main/java/com/sastix/cms/server/services/content/impl/ZipHandlerServiceImpl.java | [
"@Getter @Setter @NoArgsConstructor @ToString\npublic class CreateResourceDTO {\n\n /**\n * The media-type of this new resource.\n */\n @NotNull\n private String resourceMediaType;\n\n /**\n * The author creating this resource.\n */\n @NotNull\n private String resourceAuthor;\n\n ... | import com.sastix.cms.common.content.CreateResourceDTO;
import com.sastix.cms.common.content.ResourceDTO;
import com.sastix.cms.common.content.exceptions.ResourceAccessError;
import com.sastix.cms.server.domain.entities.Resource;
import com.sastix.cms.server.services.content.DistributedCacheService;
import com.sastix.cms.server.services.content.HashedDirectoryService;
import com.sastix.cms.server.services.content.ResourceService;
import com.sastix.cms.server.services.content.ZipHandlerService;
import org.apache.tika.Tika;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.parser.Parser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.json.GsonJsonParser;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; | /*
* Copyright(c) 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sastix.cms.server.services.content.impl;
@Slf4j
@Service
public class ZipHandlerServiceImpl implements ZipHandlerService {
public static final String METADATA_XML_FILE = "imsmanifest.xml";
public static final String METADATA_JSON_FILE = "info.json";
public static final String METADATA_STARTPAGE = "startpage";
public static final String METADATA_STARTPAGE_CAMEL = "startPage";
private final GsonJsonParser gsonJsonParser = new GsonJsonParser();
@Autowired
DistributedCacheService distributedCacheService;
@Autowired | HashedDirectoryService hashedDirectoryService; | 5 |
melloc/roguelike | game/src/main/java/edu/brown/cs/roguelike/game/GUIApp.java | [
"public final class Vec2i implements Serializable {\r\n\tprivate static final long serialVersionUID = 5659632794862666943L;\r\n\t\r\n\t/**\r\n\t * Since {@link Vec2i} instances are immutable, their x and y fields may be accessed without getters.\r\n\t */\r\n\tpublic final int x, y;\r\n\t\r\n\t/**\r\n\t * Creates a ... | import cs195n.Vec2i;
import edu.brown.cs.roguelike.engine.config.ConfigurationException;
import edu.brown.cs.roguelike.engine.game.CumulativeTurnManager;
import edu.brown.cs.roguelike.engine.game.Game;
import edu.brown.cs.roguelike.engine.graphics.Application;
import edu.brown.cs.roguelike.engine.proc.BSPLevelGenerator;
import edu.brown.cs.roguelike.engine.save.SaveManager; | package edu.brown.cs.roguelike.game;
public class GUIApp extends Application {
private final static Vec2i SCREEN_SIZE = new Vec2i(80,30);
private final static int POINTS_PER_TURN = 10;
private SaveManager sm; | private CumulativeTurnManager tm; | 2 |
IncQueryLabs/smarthome-cep-demonstrator | runtime/com.incquerylabs.smarthome.eventbus.api/src/main/java/com/incquerylabs/smarthome/eventbus/api/IEventSubscriber.java | [
"public class GroupItemStateChangedEvent extends ItemStateChangedEvent {\n\n\tpublic GroupItemStateChangedEvent(Item item, State newState, State oldState) {\n\t\tsuper(item, newState, oldState);\n\t}\n\t\n @Override\n public String toString() {\n return String.format(\"%s group state changed from %s to... | import java.util.Collection;
import org.eclipse.smarthome.core.items.Item;
import com.incquerylabs.smarthome.eventbus.api.events.GroupItemStateChangedEvent;
import com.incquerylabs.smarthome.eventbus.api.events.ItemAddedEvent;
import com.incquerylabs.smarthome.eventbus.api.events.ItemCommandEvent;
import com.incquerylabs.smarthome.eventbus.api.events.ItemRemovedEvent;
import com.incquerylabs.smarthome.eventbus.api.events.ItemStateChangedEvent;
import com.incquerylabs.smarthome.eventbus.api.events.ItemStateEvent;
import com.incquerylabs.smarthome.eventbus.api.events.ItemUpdatedEvent; | package com.incquerylabs.smarthome.eventbus.api;
public interface IEventSubscriber {
public void stateUpdated(ItemStateEvent event);
public void stateChanged(ItemStateChangedEvent event);
public void groupStateChanged(GroupItemStateChangedEvent event);
public void commandReceived(ItemCommandEvent event);
public void initItems(Collection<Item> items);
public void itemAdded(ItemAddedEvent event);
| public void itemRemoved(ItemRemovedEvent event); | 3 |
integeruser/jgltut | src/integeruser/jgltut/tut13/GeomImpostor.java | [
"public enum MouseButtons {\n MB_LEFT_BTN,\n MB_RIGHT_BTN,\n MB_MIDDLE_BTN\n}",
"public static class ViewData {\n public Vector3f targetPos;\n public Quaternionf orient;\n public float radius;\n public float degSpinRotation;\n\n public ViewData(Vector3f targetPos, Quaternionf orient, float... | import integeruser.jglsdk.glutil.MousePoles.MouseButtons;
import integeruser.jglsdk.glutil.MousePoles.ViewData;
import integeruser.jglsdk.glutil.MousePoles.ViewPole;
import integeruser.jglsdk.glutil.MousePoles.ViewScale;
import integeruser.jgltut.Tutorial;
import integeruser.jgltut.commons.*;
import integeruser.jgltut.framework.Framework;
import integeruser.jgltut.framework.Mesh;
import integeruser.jgltut.framework.MousePole;
import integeruser.jgltut.framework.Timer;
import org.joml.*;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL15;
import java.lang.Math;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL15.*;
import static org.lwjgl.opengl.GL20.*;
import static org.lwjgl.opengl.GL30.*;
import static org.lwjgl.opengl.GL31.*;
import static org.lwjgl.opengl.GL32.*; | package integeruser.jgltut.tut13;
/**
* Visit https://github.com/integeruser/jgltut for info and updates.
* Original: https://bitbucket.org/alfonse/gltut/src/default/Tut%2013%20Impostors/GeomImpostor.cpp
* <p>
* Part III. Illumination
* Chapter 13. Lies and Impostors
* <p>
* W,A,S,D - move the cameras forward/backwards and left/right, relative to the camera's current orientation. Holding
* SHIFT with these keys will move in smaller increments.
* Q,E - raise and lower the camera, relative to its current orientation. Holding SHIFT with these keys will move
* in smaller increments.
* P - toggle pausing on/off.
* -,= - rewind/jump forward time by 0.5 second (of real-time).
* T - toggle viewing the look-at point.
* G - toggle the drawing of the light source.
* <p>
* LEFT CLICKING and DRAGGING - rotate the camera around the target point, both horizontally and vertically.
* LEFT CLICKING and DRAGGING + CTRL - rotate the camera around the target point, either horizontally or vertically.
* LEFT CLICKING and DRAGGING + ALT - change the camera's up direction.
* WHEEL SCROLLING - move the camera closer to it's target point or farther away.
*/
public class GeomImpostor extends Tutorial {
public static void main(String[] args) {
Framework.CURRENT_TUTORIAL_DATAPATH = "/integeruser/jgltut/tut13/data/";
new GeomImpostor().start(500, 500);
}
@Override
protected void init() {
initializePrograms();
planeMesh = new Mesh("LargePlane.xml");
cubeMesh = new Mesh("UnitCube.xml");
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CW);
final float depthZNear = 0.0f;
final float depthZFar = 1.0f;
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
glDepthFunc(GL_LEQUAL);
glDepthRange(depthZNear, depthZFar);
glEnable(GL_DEPTH_CLAMP);
// Setup our Uniform Buffers
lightUniformBuffer = glGenBuffers();
glBindBuffer(GL_UNIFORM_BUFFER, lightUniformBuffer);
GL15.glBufferData(GL_UNIFORM_BUFFER, LightBlock.BYTES, GL_DYNAMIC_DRAW);
projectionUniformBuffer = glGenBuffers();
glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
glBufferData(GL_UNIFORM_BUFFER, ProjectionBlock.BYTES, GL_DYNAMIC_DRAW);
// Bind the static buffers.
glBindBufferRange(GL_UNIFORM_BUFFER, lightBlockIndex, lightUniformBuffer, 0, LightBlock.BYTES);
glBindBufferRange(GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, ProjectionBlock.BYTES);
glBindBuffer(GL_UNIFORM_BUFFER, 0);
imposterVBO = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, imposterVBO);
glBufferData(GL_ARRAY_BUFFER, NUMBER_OF_SPHERES * 4 * Float.BYTES, GL_STREAM_DRAW);
imposterVAO = glGenVertexArrays();
glBindVertexArray(imposterVAO);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, false, 16, 0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 1, GL_FLOAT, false, 16, 12);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glEnable(GL_PROGRAM_POINT_SIZE);
createMaterials();
glfwSetKeyCallback(window, (window, key, scancode, action, mods) -> {
if (action == GLFW_PRESS) {
switch (key) {
case GLFW_KEY_P:
sphereTimer.togglePause();
break;
case GLFW_KEY_MINUS:
sphereTimer.rewind(0.5f);
break;
case GLFW_KEY_EQUAL:
sphereTimer.fastForward(0.5f);
break;
case GLFW_KEY_T:
drawCameraPos = !drawCameraPos;
break;
case GLFW_KEY_G:
drawLights = !drawLights;
break;
case GLFW_KEY_ESCAPE:
glfwSetWindowShouldClose(window, true);
break;
}
}
});
glfwSetMouseButtonCallback(window, (window, button, action, mods) -> {
boolean pressed = action == GLFW_PRESS;
glfwGetCursorPos(window, mouseBuffer1, mouseBuffer2);
int x = (int) mouseBuffer1.get(0);
int y = (int) mouseBuffer2.get(0); | MousePole.forwardMouseButton(window, viewPole, button, pressed, x, y); | 7 |
CagataySonmez/EdgeCloudSim | src/edu/boun/edgecloudsim/applications/sample_app2/SampleNetworkModel.java | [
"public class SimManager extends SimEntity {\r\n\tprivate static final int CREATE_TASK = 0;\r\n\tprivate static final int CHECK_ALL_VM = 1;\r\n\tprivate static final int GET_LOAD_LOG = 2;\r\n\tprivate static final int PRINT_PROGRESS = 3;\r\n\tprivate static final int STOP_SIMULATION = 4;\r\n\t\r\n\tprivate String s... | import org.cloudbus.cloudsim.core.CloudSim;
import edu.boun.edgecloudsim.core.SimManager;
import edu.boun.edgecloudsim.core.SimSettings;
import edu.boun.edgecloudsim.edge_client.Task;
import edu.boun.edgecloudsim.network.NetworkModel;
import edu.boun.edgecloudsim.utils.Location;
import edu.boun.edgecloudsim.utils.SimLogger;
| /*
* Title: EdgeCloudSim - Network Model
*
* Description:
* SampleNetworkModel uses
* -> the result of an empirical study for the WLAN and WAN delays
* The experimental network model is developed
* by taking measurements from the real life deployments.
*
* -> MMPP/MMPP/1 queue model for MAN delay
* MAN delay is observed via a single server queue model with
* Markov-modulated Poisson process (MMPP) arrivals.
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.applications.sample_app2;
public class SampleNetworkModel extends NetworkModel {
public static enum NETWORK_TYPE {WLAN, LAN};
public static enum LINK_TYPE {DOWNLOAD, UPLOAD};
public static double MAN_BW = 1300*1024; //Kbps
@SuppressWarnings("unused")
private int manClients;
private int[] wanClients;
private int[] wlanClients;
private double lastMM1QueueUpdateTime;
private double ManPoissonMeanForDownload; //seconds
private double ManPoissonMeanForUpload; //seconds
private double avgManTaskInputSize; //bytes
private double avgManTaskOutputSize; //bytes
//record last n task statistics during MM1_QUEUE_MODEL_UPDATE_INTEVAL seconds to simulate mmpp/m/1 queue model
private double totalManTaskInputSize;
private double totalManTaskOutputSize;
private double numOfManTaskForDownload;
private double numOfManTaskForUpload;
public static final double[] experimentalWlanDelay = {
/*1 Client*/ 88040.279 /*(Kbps)*/,
/*2 Clients*/ 45150.982 /*(Kbps)*/,
/*3 Clients*/ 30303.641 /*(Kbps)*/,
/*4 Clients*/ 27617.211 /*(Kbps)*/,
/*5 Clients*/ 24868.616 /*(Kbps)*/,
/*6 Clients*/ 22242.296 /*(Kbps)*/,
/*7 Clients*/ 20524.064 /*(Kbps)*/,
/*8 Clients*/ 18744.889 /*(Kbps)*/,
/*9 Clients*/ 17058.827 /*(Kbps)*/,
/*10 Clients*/ 15690.455 /*(Kbps)*/,
/*11 Clients*/ 14127.744 /*(Kbps)*/,
/*12 Clients*/ 13522.408 /*(Kbps)*/,
/*13 Clients*/ 13177.631 /*(Kbps)*/,
/*14 Clients*/ 12811.330 /*(Kbps)*/,
/*15 Clients*/ 12584.387 /*(Kbps)*/,
/*15 Clients*/ 12135.161 /*(Kbps)*/,
/*16 Clients*/ 11705.638 /*(Kbps)*/,
/*17 Clients*/ 11276.116 /*(Kbps)*/,
/*18 Clients*/ 10846.594 /*(Kbps)*/,
/*19 Clients*/ 10417.071 /*(Kbps)*/,
/*20 Clients*/ 9987.549 /*(Kbps)*/,
/*21 Clients*/ 9367.587 /*(Kbps)*/,
/*22 Clients*/ 8747.625 /*(Kbps)*/,
/*23 Clients*/ 8127.663 /*(Kbps)*/,
/*24 Clients*/ 7907.701 /*(Kbps)*/,
/*25 Clients*/ 7887.739 /*(Kbps)*/,
/*26 Clients*/ 7690.831 /*(Kbps)*/,
/*27 Clients*/ 7393.922 /*(Kbps)*/,
/*28 Clients*/ 7297.014 /*(Kbps)*/,
/*29 Clients*/ 7100.106 /*(Kbps)*/,
/*30 Clients*/ 6903.197 /*(Kbps)*/,
/*31 Clients*/ 6701.986 /*(Kbps)*/,
/*32 Clients*/ 6500.776 /*(Kbps)*/,
/*33 Clients*/ 6399.565 /*(Kbps)*/,
/*34 Clients*/ 6098.354 /*(Kbps)*/,
/*35 Clients*/ 5897.143 /*(Kbps)*/,
/*36 Clients*/ 5552.127 /*(Kbps)*/,
/*37 Clients*/ 5207.111 /*(Kbps)*/,
/*38 Clients*/ 4862.096 /*(Kbps)*/,
/*39 Clients*/ 4517.080 /*(Kbps)*/,
/*40 Clients*/ 4172.064 /*(Kbps)*/,
/*41 Clients*/ 4092.922 /*(Kbps)*/,
/*42 Clients*/ 4013.781 /*(Kbps)*/,
/*43 Clients*/ 3934.639 /*(Kbps)*/,
/*44 Clients*/ 3855.498 /*(Kbps)*/,
/*45 Clients*/ 3776.356 /*(Kbps)*/,
/*46 Clients*/ 3697.215 /*(Kbps)*/,
/*47 Clients*/ 3618.073 /*(Kbps)*/,
/*48 Clients*/ 3538.932 /*(Kbps)*/,
/*49 Clients*/ 3459.790 /*(Kbps)*/,
/*50 Clients*/ 3380.649 /*(Kbps)*/,
/*51 Clients*/ 3274.611 /*(Kbps)*/,
/*52 Clients*/ 3168.573 /*(Kbps)*/,
/*53 Clients*/ 3062.536 /*(Kbps)*/,
/*54 Clients*/ 2956.498 /*(Kbps)*/,
/*55 Clients*/ 2850.461 /*(Kbps)*/,
/*56 Clients*/ 2744.423 /*(Kbps)*/,
/*57 Clients*/ 2638.386 /*(Kbps)*/,
/*58 Clients*/ 2532.348 /*(Kbps)*/,
/*59 Clients*/ 2426.310 /*(Kbps)*/,
/*60 Clients*/ 2320.273 /*(Kbps)*/,
/*61 Clients*/ 2283.828 /*(Kbps)*/,
/*62 Clients*/ 2247.383 /*(Kbps)*/,
/*63 Clients*/ 2210.939 /*(Kbps)*/,
/*64 Clients*/ 2174.494 /*(Kbps)*/,
/*65 Clients*/ 2138.049 /*(Kbps)*/,
/*66 Clients*/ 2101.604 /*(Kbps)*/,
/*67 Clients*/ 2065.160 /*(Kbps)*/,
/*68 Clients*/ 2028.715 /*(Kbps)*/,
/*69 Clients*/ 1992.270 /*(Kbps)*/,
/*70 Clients*/ 1955.825 /*(Kbps)*/,
/*71 Clients*/ 1946.788 /*(Kbps)*/,
/*72 Clients*/ 1937.751 /*(Kbps)*/,
/*73 Clients*/ 1928.714 /*(Kbps)*/,
/*74 Clients*/ 1919.677 /*(Kbps)*/,
/*75 Clients*/ 1910.640 /*(Kbps)*/,
/*76 Clients*/ 1901.603 /*(Kbps)*/,
/*77 Clients*/ 1892.566 /*(Kbps)*/,
/*78 Clients*/ 1883.529 /*(Kbps)*/,
/*79 Clients*/ 1874.492 /*(Kbps)*/,
/*80 Clients*/ 1865.455 /*(Kbps)*/,
/*81 Clients*/ 1833.185 /*(Kbps)*/,
/*82 Clients*/ 1800.915 /*(Kbps)*/,
/*83 Clients*/ 1768.645 /*(Kbps)*/,
/*84 Clients*/ 1736.375 /*(Kbps)*/,
/*85 Clients*/ 1704.106 /*(Kbps)*/,
/*86 Clients*/ 1671.836 /*(Kbps)*/,
/*87 Clients*/ 1639.566 /*(Kbps)*/,
/*88 Clients*/ 1607.296 /*(Kbps)*/,
/*89 Clients*/ 1575.026 /*(Kbps)*/,
/*90 Clients*/ 1542.756 /*(Kbps)*/,
/*91 Clients*/ 1538.544 /*(Kbps)*/,
/*92 Clients*/ 1534.331 /*(Kbps)*/,
/*93 Clients*/ 1530.119 /*(Kbps)*/,
/*94 Clients*/ 1525.906 /*(Kbps)*/,
/*95 Clients*/ 1521.694 /*(Kbps)*/,
/*96 Clients*/ 1517.481 /*(Kbps)*/,
/*97 Clients*/ 1513.269 /*(Kbps)*/,
/*98 Clients*/ 1509.056 /*(Kbps)*/,
/*99 Clients*/ 1504.844 /*(Kbps)*/,
/*100 Clients*/ 1500.631 /*(Kbps)*/
};
public static final double[] experimentalWanDelay = {
/*1 Client*/ 20703.973 /*(Kbps)*/,
/*2 Clients*/ 12023.957 /*(Kbps)*/,
/*3 Clients*/ 9887.785 /*(Kbps)*/,
/*4 Clients*/ 8915.775 /*(Kbps)*/,
/*5 Clients*/ 8259.277 /*(Kbps)*/,
/*6 Clients*/ 7560.574 /*(Kbps)*/,
/*7 Clients*/ 7262.140 /*(Kbps)*/,
/*8 Clients*/ 7155.361 /*(Kbps)*/,
/*9 Clients*/ 7041.153 /*(Kbps)*/,
/*10 Clients*/ 6994.595 /*(Kbps)*/,
/*11 Clients*/ 6653.232 /*(Kbps)*/,
/*12 Clients*/ 6111.868 /*(Kbps)*/,
/*13 Clients*/ 5570.505 /*(Kbps)*/,
/*14 Clients*/ 5029.142 /*(Kbps)*/,
/*15 Clients*/ 4487.779 /*(Kbps)*/,
/*16 Clients*/ 3899.729 /*(Kbps)*/,
/*17 Clients*/ 3311.680 /*(Kbps)*/,
/*18 Clients*/ 2723.631 /*(Kbps)*/,
/*19 Clients*/ 2135.582 /*(Kbps)*/,
/*20 Clients*/ 1547.533 /*(Kbps)*/,
/*21 Clients*/ 1500.252 /*(Kbps)*/,
/*22 Clients*/ 1452.972 /*(Kbps)*/,
/*23 Clients*/ 1405.692 /*(Kbps)*/,
/*24 Clients*/ 1358.411 /*(Kbps)*/,
/*25 Clients*/ 1311.131 /*(Kbps)*/
};
public SampleNetworkModel(int _numberOfMobileDevices, String _simScenario) {
super(_numberOfMobileDevices, _simScenario);
}
@Override
public void initialize() {
wanClients = new int[SimSettings.getInstance().getNumOfEdgeDatacenters()]; //we have one access point for each datacenter
wlanClients = new int[SimSettings.getInstance().getNumOfEdgeDatacenters()]; //we have one access point for each datacenter
int numOfApp = SimSettings.getInstance().getTaskLookUpTable().length;
SimSettings SS = SimSettings.getInstance();
for(int taskIndex=0; taskIndex<numOfApp; taskIndex++) {
if(SS.getTaskLookUpTable()[taskIndex][0] == 0) {
SimLogger.printLine("Usage percentage of task " + taskIndex + " is 0! Terminating simulation...");
System.exit(0);
}
else{
double weight = SS.getTaskLookUpTable()[taskIndex][0]/(double)100;
//assume half of the tasks use the MAN at the beginning
ManPoissonMeanForDownload += ((SS.getTaskLookUpTable()[taskIndex][2])*weight) * 4;
ManPoissonMeanForUpload = ManPoissonMeanForDownload;
avgManTaskInputSize += SS.getTaskLookUpTable()[taskIndex][5]*weight;
avgManTaskOutputSize += SS.getTaskLookUpTable()[taskIndex][6]*weight;
}
}
ManPoissonMeanForDownload = ManPoissonMeanForDownload/numOfApp;
ManPoissonMeanForUpload = ManPoissonMeanForUpload/numOfApp;
avgManTaskInputSize = avgManTaskInputSize/numOfApp;
avgManTaskOutputSize = avgManTaskOutputSize/numOfApp;
lastMM1QueueUpdateTime = SimSettings.CLIENT_ACTIVITY_START_TIME;
totalManTaskOutputSize = 0;
numOfManTaskForDownload = 0;
totalManTaskInputSize = 0;
numOfManTaskForUpload = 0;
}
/**
* source device is always mobile device in our simulation scenarios!
*/
@Override
public double getUploadDelay(int sourceDeviceId, int destDeviceId, Task task) {
double delay = 0;
//special case for man communication
if(sourceDeviceId == destDeviceId && sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID){
return delay = getManUploadDelay();
}
| Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(sourceDeviceId,CloudSim.clock());
| 4 |
aurbroszniowski/Rainfall-core | src/main/java/io/rainfall/execution/Executions.java | ["public abstract class Execution {\n\n public enum ExecutionState {\n UNKNOWN,\n BEGINNING,\(...TRUNCATED) | "import io.rainfall.Execution;\nimport io.rainfall.Unit;\nimport io.rainfall.unit.Every;\nimport io.(...TRUNCATED) | "/*\n * Copyright (c) 2014-2022 Aurélien Broszniowski\n *\n * Licensed under the Apache License, Ve(...TRUNCATED) | public static InParallel inParallel(int count, Unit unit, Every every, Over over) { | 4 |
jenkinsci/ghprb-plugin | "src/test/java/org/jenkinsci/plugins/ghprb/manager/impl/downstreambuilds/BuildFlowBuildManagerTest.j(...TRUNCATED) | ["public abstract class GhprbITBaseTestCase {\n\n @Mock\n protected GHCommitPointer commitPoin(...TRUNCATED) | "import com.cloudbees.plugins.flow.BuildFlow;\nimport com.cloudbees.plugins.flow.FlowRun;\nimport co(...TRUNCATED) | "package org.jenkinsci.plugins.ghprb.manager.impl.downstreambuilds;\n\n\n\n\n/**\n * @author mdelape(...TRUNCATED) | public JenkinsRuleWithBuildFlow jenkinsRule = new JenkinsRuleWithBuildFlow(); | 4 |
criticalmaps/criticalmaps-android | app/src/main/java/de/stephanlindauer/criticalmaps/service/ServerSyncService.java | ["public class App extends Application {\n\n private static AppComponent appComponent;\n\n pub(...TRUNCATED) | "import android.app.Service;\nimport android.content.Intent;\nimport android.os.IBinder;\nimport and(...TRUNCATED) | "package de.stephanlindauer.criticalmaps.service;\n\n\n\n\n\n\n\npublic class ServerSyncService exte(...TRUNCATED) | EventBus eventBus; | 4 |
w3c/epubcheck | src/main/java/com/adobe/epubcheck/bitmap/BitmapChecker.java | ["public final class EPUBLocation implements Comparable<EPUBLocation>\n{\n\n public static EPUBLoca(...TRUNCATED) | "import javax.imageio.stream.FileImageInputStream;\nimport javax.imageio.stream.ImageInputStream;\ni(...TRUNCATED) | "/*\n * Copyright (c) 2007 Adobe Systems Incorporated\n *\n * Permission is hereby granted, free of(...TRUNCATED) | private final Report report; | 1 |
sorinMD/MCTS | src/main/java/mcts/tree/selection/PUCT.java | ["public interface Game {\n\n\t/**\n\t * @return a clone of the game state\n\t */\n\tpublic int[] ge(...TRUNCATED) | "import java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.concurrent.ThreadLocal(...TRUNCATED) | "package mcts.tree.selection;\n\n\n\n\n/**\n * PUCT selection policy for handling a prior probabilit(...TRUNCATED) | " protected Selection selectChild(StandardNode node, Tree tree, GameFactory factory, Game obsGame(...TRUNCATED) | 6 |
Dataset Card for RepoBench-R
Dataset Summary
RepoBench-R (Retrieval) is a subtask of RepoBench(GitHub, arXiv), targeting the retrieval component of a repository-level auto-completion system, focusing on retrieving the most relevant code snippet from a project repository for next-line code prediction.
Settings
cff: short for cross_file_first, indicating the cross-file module in next line is first used in the current file.cfr: short for cross_file_random, indicating the cross-file module in next line is not first used in the current file.
Supported Tasks
The dataset has 4 subsets:
python_cff: python dataset withcffsetting.python_cfr: python dataset withcfrsetting.java_cff: java dataset withcffsetting.java_cfr: java dataset withcfrsetting.
Each subset has 4 splits:
train_easy: training set with easy difficulty, where the number of code snippets in the context satisfies .train_hard: training set with hard difficulty, where the number of code snippets in the context satisfies .test_easy: testing set with easy difficulty.test_hard: testing set with hard difficulty.
Loading Data
For example, if you want to load the test cross_file_first python dataset with easy difficulty, you can use the following code:
from datasets import load_dataset
dataset = load_dataset("tianyang/repobench-r", "python_cff", split="test_easy")
Note: The
splitargument is optional. If not provided, the entire dataset (including, train and test data with easy and hard level) will be loaded.
Dataset Structure
{
"repo_name": "repository name of the data point",
"file_path": "path/to/file",
"context": [
"snippet 1",
"snippet 2",
// ...
"snippet k"
],
"import_statement": "all import statements in the file",
"gold_snippet_idex": 2, // the index of the gold snippet in the context list, 0~k-1
"code": "the code for next-line prediction",
"next_line": "the next line of the code"
}
Licensing Information
CC BY-NC-ND 4.0
Citation Information
@misc{liu2023repobench,
title={RepoBench: Benchmarking Repository-Level Code Auto-Completion Systems},
author={Tianyang Liu and Canwen Xu and Julian McAuley},
year={2023},
eprint={2306.03091},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Contributions
Thanks to @Leolty for adding this dataset.
- Downloads last month
- 79