method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
50a645ac-2e75-489e-a2db-0aa5a27bd52f | 6 | @Override
public void mouseDragged(MouseEvent e) {
if(state == GameState.GAME) {
if(guiCompo instanceof MenuMenu) {
if(e.getX() >= WIDTH/2 - 200 && e.getX() <= WIDTH/2 + 200) {
if(e.getY() >= HEIGHT/2 - 90 && e.getY() <= HEIGHT/2 - 70) {
taxes = (e.getX() - (WIDTH/2 - 200))/4;
}
}
}
}... |
4eec021c-62ac-4895-9b68-660a2677a333 | 3 | public void uploadFile(FileUploadEvent event) {
try {
String path = FacesContext.getCurrentInstance().getExternalContext().getRealPath("/resources/images/tmp");
String archivo = path + File.separator + event.getFile().getFileName();
FileOutputStream fileOutputStream ... |
b523c0ab-e745-4b5d-b19a-06ccc1f1ecdc | 0 | public EventDescriptionWindow() {
initComponents();
} |
d5694593-d139-49cd-9ee6-dd41021a6e5b | 3 | public void remplissageComboBox(List<Visiteur> lesVisiteurs, List<Secteur> lesSecteurs, List<Labo> lesLabos){
this.vue.getjComboBoxChercher().addItem("");
for(int i = 0; i<lesVisiteurs.size(); i++){
Visiteur unVisiteur = lesVisiteurs.get(i);
this.vue.getjComboBoxChercher().addIte... |
3adc07c4-a5e9-44cf-be53-2a56405c264a | 9 | public boolean checkCollisions(long actor) {
timesChecked++;
GameActor a1 = mainLogic.getActor(actor);
if(a1 == null || !a1.isEnabled()) {
return false;
}
StatusComponent sc1 = (StatusComponent)a1.getComponent("StatusComponent");
for(GameActor a2 : ma... |
83487c12-aa94-4280-b80e-ed2cbc43e8e8 | 1 | public JPanel getSliderMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.sliderMenu;
} |
8f116613-4072-4f3f-9191-e8ec15980138 | 5 | public PublicKey decodePublicKey(byte[] k) {
// magic
if (k[0] != Registry.MAGIC_RAW_DSS_PUBLIC_KEY[0]
|| k[1] != Registry.MAGIC_RAW_DSS_PUBLIC_KEY[1]
|| k[2] != Registry.MAGIC_RAW_DSS_PUBLIC_KEY[2]
|| k[3] != Registry.MAGIC_RAW_DSS_PUBLIC_KEY[3]) {
throw new Ill... |
e4baa3d2-6cb9-442f-8874-fed209d5fc62 | 3 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
if ("hilo".equals(oContexto.getSearchingFor())) {
oContexto.setVista("jsp/hilo/list.jsp");
oContexto.... |
2357a771-4627-425a-9bf3-b21e713fd7c4 | 8 | @Override
void merge(Book oldEntity, Book newEntity) {
if(!newEntity.getGenre().equals(oldEntity.getGenre())) oldEntity.setGenre(newEntity.getGenre());
if(!newEntity.getDescription().equals(oldEntity.getDescription())) oldEntity.setDescription(newEntity.getDescription());
if(!newEntity.getLa... |
62b05016-456e-4dd0-ad87-7b6e760e8771 | 4 | public Level(String filename, SpriteBatch batch, World world){
map = new TmxMapLoader().load(filename);
renderer = new OrthogonalTiledMapRenderer(map, 1f/Settings.TILE_SIZE, batch);
// set tile statics
TiledMapTileLayer tlayer = (TiledMapTileLayer)map.getLayers().get("Tiles");
f... |
9c711620-9e13-4e2d-8473-b29928e89fa4 | 1 | public HashCounter(final K key) {
this.key = key;
hashs = new ArrayList<Integer>(new TreeSet<Integer>(hash.hash(this.key)));
counters = cbf.get(hashs.toArray(new Integer[hashs.size()]));
for (Short i : counters) minCounter = (short)Math.min(i, minCounter);
mli = hashs.get(counters.indexOf(minCounter));
... |
99a2797f-ab8f-46ca-857d-a035419326d5 | 4 | public void createGraph(){
Scanner console = new Scanner(System.in);
String fileName;
if (gSize != 0)
clearGraph();
Scanner infile = null;
try{
System.out.print("Input file name: ");
fileName = console.nextLine();
System.out.pri... |
3ec665da-21de-48eb-a268-75db261d40b1 | 1 | private static SessionFactory buildSessionFactory() {
SessionFactory sessionFactory = null;
try {
Configuration configuration = new Configuration();
configuration.configure("hibernate.cfg.xml");
ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder().applySettings(... |
09154993-0ca0-4814-a8b1-101da34798ec | 3 | static int findEndBracket(final int i, final String program) {
int nrOpenBrackets = 1;
int p = i + 1;
while (nrOpenBrackets > 0) {
if (program.charAt(p) == '[') {
nrOpenBrackets++;
}
if (program.charAt(p) == ']') {
nrOpenBracke... |
7ff42beb-0af2-48ef-878e-f7782374f610 | 7 | private static List<String> loadLinesFromFile( String pathToFile )
{
try {
List<String> lineList = new ArrayList<String>();
FileInputStream in = new FileInputStream( pathToFile );
StringBuffer line = new StringBuffer();
while ( true )
{
... |
3b06bcc9-f18c-4d4f-b0b3-c8ca3f4b5ece | 3 | public static void conectar() throws ConexionException{
try {
if (socket == null) {
socket = new Socket("localhost", 9999);
recibirCanales();
}
} catch (UnknownHostException e) {
throw new ConexionException("Error de conexion: " + e.getMessage(),e);
} catch (IOException e) {
throw new Conexio... |
3ad2de49-95de-4942-b63f-834bbfb4b735 | 9 | @EventHandler (ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
if(!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
return;
}
Block block = event.getClickedBlock();
Player player = event.getPlayer();
if(block.getState() instanceof Sign) {
Sign sign = (Sign) bloc... |
26b3dcd6-05d0-4c26-b93b-789e56216bef | 8 | public void run()
{
while(true)
{
try
{
sleep(1000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
if(runTournament && !gameRunner.isGameRunning())
{
if(tournamentIndex1 != tournamentIndex2)
{
gameRunner.setCurrentPlayer(0, playersList.get(tournamentInde... |
bba305b3-b8cb-4797-b0dd-9e4ff9c1f2c8 | 6 | public void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
req.setCharacterEncoding("UTF-8");
resp.setContentType("text/xml");
PrintWriter writer = resp.getWriter();
String gameId = req.getParameter("gameId");
if (gameId == null || gameId.equals("")) {
writer.println("ER... |
e4b5e75d-a1ce-4f74-ac08-3ecb3b6fd400 | 5 | public static String correctFloatValueForECMiner(String floatValue) {
// 부동소수점에서 . 전후를 추출한다.
String[] strings = floatValue.split("\\.");
// .가 없다면 전체 길이가 1일 것이므로 그 보정할 필요가 없다. 그래서 그냥 입력값을 그대로 사용한다.
if (strings.length == 1) {
return floatValue;
}
// 부동소수점에서 . 이후의 값을 찾아서 그 길이가 최대 길이보다 크다면 잘라버리고 그 값만 사용한다.... |
27601633-89f0-4b0f-ac36-58f5845a0cb8 | 7 | public static int uniquePaths(int m, int n) {
// Note: The Solution object is instantiated only once and is reused by each test case.
if(m == 0 || n == 0)
return 0;
int[][] dp = new int[m][n];
dp[0][0] = 1;
for(int i = 1; i < m; i++)
dp[i][0] = 1;
... |
30388897-f17b-4002-a648-4f827f570271 | 6 | public int maxDepth(TreeNode root){
if(root == null) return 0;
LinkedList<TreeNode> queue = new LinkedList<TreeNode>();
queue.offer(root);
queue.offer(null);
int dep = 0;
while(!queue.isEmpty()){
TreeNode n = queue.poll();
if(n == null) {
++dep;
if(queue.isEmpty()) break;
que... |
d3563211-500e-403a-805a-c1219b347a16 | 9 | public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("Get Hourly Revenue Report for a particular day")) {
getHourlyRevenueReport();
}
if (e.getActionCommand().equals("Get Daily Revenue Report for a particular month")) {
getDailyRevenueReport();
}
if (e.getActionCommand().e... |
f8996468-1b02-4ca6-8c9a-b515c77e4746 | 7 | public boolean move(int newX, int newY) {
if (newX - width < -1 || newY - height < -1 || newX >= world.getXSize()
|| newY >= world.getYSize())
return false;
// check for overlap with other dudes, and invalid moves
for(int X = 0; X < width; X++)
for(int Y = 0; Y < height; Y++) {
Tile tile = world.ge... |
a6c2b295-b613-4804-90de-fa36129f7225 | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final boxState other = (boxState) obj;
if (this.toFill != other.toFill &&
(this.toFill == null || !this.toFill.equals(other.toFill))) {
return false;
}
if (this.toPut != o... |
dd76b35f-9e1e-4c43-8576-b8a3e6d67e06 | 2 | private Solution findOptimum(ArrayList<Mutantroach> mutantroaches) {
Solution optimum = new Solution(mutantroaches.get(0));
for (int i = 1; i < mutantroaches.size(); ++i) {
Solution next = new Solution(mutantroaches.get(1));
if (next.isBetterThan(optimum)) {
opti... |
2782157c-cd5b-47ec-af64-e5033cd2ccb4 | 5 | private void heapify(int index) {
int left = left(index);
int right = right(index);
int smallest;
if (right <= size) {
if (heap[left].getCost() < heap[right].getCost()) {
smallest = left;
} else {
smallest = right;
... |
60534435-9d09-46e6-9f37-5c6a085b7781 | 6 | @Override
public void exec(CommandSender sender, String commandName, String[] args, Player player, boolean isPlayer) {
String newQuitMessage = "";
if (!isPlayer) {
sender.sendMessage(ChatColor.RED + "Run this command from ingame.");
return;
}
if (!pl... |
558da022-a7a8-4554-9544-0bf8c80b5fa2 | 3 | public int countDuplicates()
{
int duplicates = 0;
// TODO: Write the code to get the number of duplicates in the list
for (int i = 0; i < list.size()-1; i++)
{
for (int j = i+1; j < list.size(); j++)
{
String current = list.get(i);
String compa... |
c926a033-6c68-4312-ac0d-ce8130c81594 | 2 | public DiffusionMenu() {
super("Diffusion");
setEnabled(true);
JMenuItem isotropic = new JMenuItem("Isotropic");
isotropic.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Panel panel = (((Window) getTopLevelAncestor()).getPanel());
if (panel.ge... |
5fc33a7b-b850-40d9-8a43-1a201b952e19 | 1 | private Boolean addOperand(CalculatorReader expressionReader) {
BigDecimal operand = getOperand(expressionReader);
if (null != operand) {
//System.out.println("--addOperand = " + operand);
expressionStack.operandStack.push(operand);
return true;
} else {
... |
c731a15c-f836-40fd-b16f-2a985b1f5f05 | 0 | public int getTrainingId() {
return trainingId;
} |
737a34b6-ea55-4486-9217-1dacf888203c | 4 | protected boolean decodeFrame() throws JavaLayerException
{
try
{
AudioDevice out = audio;
if (out==null)
return false;
Header h = bitstream.readFrame();
if (h==null)
return false;
// sample buffer set when decoder constructed
SampleBuffer output = (SampleBuffer)decoder.decod... |
d082bdec-20c1-4d59-aed5-b3ffcfda34fe | 6 | public byte[] decryptBlock(byte[] input, byte[] key) {
isKeyValid(key);
if (input.length < 16) {
throw new IllegalArgumentException("Cannot decrypt input shorter than 16 bytes(block).");
}
byte[] result = new byte[16];
byte[][] expandedKey = keyExpansion(key);
... |
e00871a3-7b70-4a76-9f49-fbe9ecda302f | 4 | private static InputNode loadInputs(ObjectInputStream ois, ArrayList<InputNode> refInputs) throws IOException {
int len = ois.readInt();
InputNode ret = null;
for(int i=0;i<len;i++) {
int input = ois.readInt();
if (refInputs != null && refInputs.size()-1-i >= 0 && refInputs.get(refInputs.size()-1-i).input... |
51853499-c8e9-4a5d-b850-b8ecbd9d9912 | 2 | public int Maximum(TreeNode root){
if(root == null) return -1;
TreeNode current = root;
while(current.right != null){
current = current.right;
}
return current.val;
} |
f3d8cdd2-7c51-47fd-8141-6ec95371baff | 1 | public void setParkings(Iterable<IParking> iterable)
throws ParkingException {
if (iterable == null) {
throw new ParkingException("Parkings is null");
}
this.parkings = iterable;
} |
e413ef42-aebd-408c-bcff-3523f6b6e4de | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
f5bf8012-16f0-4fec-bc2f-c59720cfd8b2 | 7 | private static boolean dumpEquipmentSlot(Item item) {
if (item.getDefinitions() != null && item.getDefinitions().isWearItem() != true)
return false;
ArrayList<String> lines = getPage(item);
if (lines == null) {
return false;
}
Iterator<String> iterator = lines.iterator();
try {
while(iterator.hasN... |
175e30c2-db3a-4519-9377-991b4ab4a3c5 | 6 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
searchPanel = new javax.swing.JPanel();
searchLabel = new javax.swing.JLabel();
searchField = new javax.swing.JTextField();
hi... |
c8488914-d117-4439-8cee-56bff8318729 | 6 | @Override
public void run() {
currentThread = Thread.currentThread();
for (; ; ) {
if (Thread.currentThread().isInterrupted()) {
System.out.println("Receiver Thread is interrupted");
return;
}
try {
Command command =... |
7ac4aec3-0b0a-4c25-8b9c-b2c8a5eb8243 | 7 | @Override
public JSONObject doCommand(JSONObject input) throws JSONException {
int x1 = 0;
int y1 = 0;
int id = -1;
int error = -1;
boolean won = false;
JSONArray command = null;
try {
id = input.getInt("ID");
command = input.getJSONArray("COMMAND");
} catch (JSONException e) {
System.err.p... |
baa63415-e777-4b16-9c1f-46bbd4d81bf4 | 4 | public static short[] readBytesFromImage(BufferedImage bimg, String key) {
//System.out.println("[Key] " + key);
int w = bimg.getWidth();
int h = bimg.getHeight();
RC4 prng = new RC4(EncryptionProvider.sha256(key.getBytes()));
Set<Integer> usedPixels = new HashSet<>();
... |
f5c1435a-0a89-4471-a156-792facde5248 | 8 | private int isSpecialCaseMatched(State altLink, State current,
char[] targetStr, int offset) {
while (((altLink.getCh() == targetStr[offset]) || (altLink.getCh() == State.ANY && (current == null || ((offset < targetStr.length) && (targetStr[offset] != current
.getCh()))))) && (++offset < targetStr.length)) {
... |
b1795c9f-b6c8-4ed1-bbed-4a6a3d5665f2 | 5 | private double checkDistribution_nextInt(RandomGenerator randGen) {
int[] count = new int[100] ;
int total = FAST_TEST ? 1000000 : 10000000 ;
double totalD = total ;
for (int i = 0; i < total; i++) {
int n = randGen.nextInt(100) ;
count[n]++ ;
}
double distribution = totalD / count.length ... |
93403c34-da7d-42eb-b678-6bf848e63052 | 4 | @Override
protected void calculateFitness(){
for(int i = 0; i < numberOfParticles; i++){
double currentfitness = objectiveFunction.CalculateFitness(position[i]);
sortedFitness.get(i).setFitness(currentfitness);
sortedFitness.get(i).setIndex(i);
if(maximum){
if(currentfitness > fitness.get(i)){
f... |
7f7e3bd3-a8e6-4459-9125-da88adeaa8f0 | 9 | public static int product(int[] A, int low, int high) {
if (low > high)
return -65536;
if (low == high)
return A[low];
int flag = 0;
for (int i = low; i <= high; i++) {
if (A[i] == 0) {
flag = 1;
return Math.max(0, Math.max(product(A, low, i - 1),
product(A, i + 1, high)));
}
}
... |
10fdb66e-c99d-43a1-8920-765b6fe39c63 | 3 | public String[] loadPropertiesFromFile(String localPath)
throws InvalidPropertiesFormatException, FileNotFoundException,
IOException {
Properties file = new Properties();
file.loadFromXML(new FileInputStream(new File(localPath)));
if (file.getProperty("version") != null) {
try {
String newVersion... |
a334d74f-6817-4fb5-9367-41d082be4976 | 5 | public ProducerGUI() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 572, 232);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(0, 0, 570, 203);... |
63680a31-d8ba-4b41-be76-82f040c85a78 | 3 | public Equivalence getEquivalence(JsonElement json) {
Equivalence equivalence;
String uriString = json.getAsJsonObject().getAsJsonPrimitive(URI).getAsString();
URI uri;
try {
uri = new URI(urlEncode(uriString));
} catch (Exception e) {
throw new JsonParseE... |
aff530c8-9484-4f48-bfd4-e9dae19e918b | 7 | @Override
public void run() {
log = Logger.getInstance();
relConnZones = new HashMap<String, FirebrainZones>();
relConnZones.put(TabletTypes.R.toString()+ TabletTypes.G.toString(), FirebrainZones.Y);
relConnZones.put(TabletTypes.G.toString()+ TabletTypes.R.toString(), FirebrainZones.Y);
relConnZones.put(Tabl... |
08d2f31e-c88e-44a1-b5e2-38367557a8b1 | 1 | @Override
public void run() {
int i = 0;
while (i++ < 6) {
// “线程名” + "-" + "序号"
String val = Thread.currentThread().getName()+i;
queue.add(val);
// 通过“Iterator”遍历queue。
printAll();
}
} |
c92af2e4-1a0a-48b9-9014-ad580101b5dd | 3 | public void saveImage(File file) {
if (pic == null || pic.isNull())
return;
try {
pic.save(file.getAbsolutePath(), "png");
} catch (IOException e) {
e.printStackTrace();
}
} |
b1526687-cd82-470d-bc28-e242e08f83db | 7 | public List<List<String>> read(int linestart) {
List<List<String>> newDAWNStarts = new ArrayList<List<String>>();
File file = new File(filepath);
Charset charset = Charset.forName("UTF-8");
try (BufferedReader reader = Files.newBufferedReader(file.toPath(), charset)) {
String line = null;
int linenumber ... |
3265f5b0-988d-4f1f-98e6-bc8fca62ac69 | 9 | @Override
public double calculateFractalWithPeriodicity(Complex pixel) {
iterations = 0;
check = 3;
check_counter = 0;
update = 10;
update_counter = 0;
period = new Complex();
Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel... |
95cf41a2-60fa-4a9d-8a45-dd62c8f0bb0d | 1 | @DELETE
@Path("/v2.0/ports/{portId}")
public Response deletePort(@PathParam("portId") String portId) throws MalformedURLException, IOException{
//Send the HTTP request to the REST service
HttpURLConnection conn=HTTPConnector.HTTPConnect(new URL(this.URLpath+"/"+portId), OpenstackNetProxyConstants.HTTP_METHOD_DELE... |
3f14a23d-ee65-4029-8b7d-45175a715a7a | 0 | public void setPage(int page) {
this.page = page;
} |
609f75df-b930-411a-b422-4a67902f9274 | 4 | @EventHandler
public void onEntityDeath(PlayerRespawnEvent e) {
Player player = e.getPlayer();
EntityDamageEvent ede = player.getLastDamageCause();
DamageCause dc = ede.getCause();
if (dc == DamageCause.VOID) {
if(ArenaManager.getManager().isPlayerInArena(player) != null){
Arena a = ArenaManager.getM... |
243913dd-7fb9-4271-8842-2aebcc2e4af7 | 3 | private void uiAct(){
if (selectedTower != null && refreshUi){
refreshUi = false;
ui.setTowerData (selectedTower);
ui.changeUi (3);
drawArrow (true);
if (r != null)
{
removeObject(r);
}
showRange(sele... |
77da41b2-07f1-4286-ae7f-c969baafec28 | 6 | @EventHandler
public void CreeperBlindness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getCreeperConfig().getDouble("Creeper.Bl... |
c13a3dde-e275-44e7-8445-aee19b182198 | 0 | @Test
public void testTruncate_apostrophe()
{
String s = "Breaking where is an apostrophe isn't a good idea.";
Assert.assertEquals(
"Breaking where is an apostrophe…",
_helper.truncate(s, 36)
);
} |
11820157-071f-4683-977d-89af5b469d3d | 8 | public boolean checkMotions(int newPix[] ,int oldPix[] ,int width ,int height,
int x0 ,int y0 ,byte data[] ,boolean bNotShifted ) {
int pos;
int nrMotions=0;
boolean areMotions = false;
final byte red = (byte)Color.green.getRed();
final byte green = (byte)Color.green.getGreen();
final byte blue =... |
899a23a8-87e8-4266-a933-e958791779de | 5 | public void setMajor(String singular, String plural) {
Connection conn = null;
PreparedStatement ps = null;
try
{
conn = iConomy.getiCoDatabase().getConnection();
ps = conn.prepareStatement("UPDATE " + Constants.SQLTable + "_Banks SET major = ? WHERE id = ?");
ps.setString(1, singular... |
655ea023-d9a5-4224-aff3-37a08f948cca | 1 | public final void actualiser() {
try {
remplissageComboBox(lesVisiteurs, lesSecteurs, lesLabos);
indiceVisiteurCourant = 0;
visiteurCourant = lesVisiteurs.get(indiceVisiteurCourant);
afficherVisiteur(visiteurCourant);
} catch (Exception ex) {
J... |
06e78e13-8f15-43f7-9598-a6ccd4d3ece7 | 5 | private void drawBrush(int x, int y){
sigmund.locate(x, y);
int reps = sigmund.getBrushLength();
for (int a = 0; a <= reps; a++){
int thisx = checkPoint("X", sigmund.getNextX());
int thisy = checkPoint("Y", sigmund.getNextY());
if(thisx == -1 || thisy == -1){}
else{
if(!... |
4cd1c1ab-1404-4c8f-bbbf-bdf3f62f770b | 0 | @Override
public Iterator<T> iterator() {
return new ArrayIterator(this._source);
} |
57ceaca8-4d4a-418c-989c-eebdaf1bb4c1 | 3 | public boolean bonusLanceDe(double cout) {
if (cout > 1 && this.dernierTour != Partie.getInstance().getTourEnCours()) {
if (Game.getInstance().askConf("Voulez-vous lancer le dé ? (Pouvoir)")) {
this.dernierTour = Partie.getInstance().getTourEnCours();
return true;
}
}
return false;
} |
a62d0888-fd3c-497d-9e5a-99fb786834a0 | 4 | @Override
public void run() {
try{
if(Thread.currentThread().getName().equals("conexion"))Thread.sleep(8000);
if(Thread.currentThread().getName().equals("impresion"))Thread.sleep(6000);
if(Thread.currentThread().getName().equals("guardar"))Thread.sleep(10000);
//ejecutarse.
Sys... |
18f75f2d-1e00-4cee-ab72-9197f41b5efa | 3 | public void calculateState(){
boolean[] arr = new boolean[numNodes];
int tempState=0;
for(int i=0;i<numNodes;i++){
arr[i] = nodes.get(i).getState();
}
for(int i=0;i<numNodes;i++){
tempState = tempState << 1;
tempState += (arr[i]? 1:0);
}
state = tempState;
... |
a23a28ee-8a53-45c1-aab2-687a81e75247 | 6 | public REPrimitiveFragment(String def) throws Exception{
Arrays.fill(chars, false);
char[] charArray = def.toCharArray();
char last = 0;
boolean assignment = true;
for(int i = 0; i < charArray.length ; i++)
{
if(charArray[i] == '\\')
{
i++;
last = charArray[i];
chars[charArray[i]-32] = ass... |
e5cf05fe-3775-4cf5-82aa-9815c1ea00f8 | 3 | private static void fw_write(String msg, String file)
{
FileWriter fwriter = null;
try
{
fwriter = new FileWriter(file, true);
} catch (Exception ex)
{
ex.printStackTrace();
System.out.println("Unwanted errors while opening file " + file);... |
f2b635e2-3a54-432b-bf09-88591cb842e2 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
case '[':
this.back();
return new JSONArray(this);
}
StringBuffer sb = new StringBu... |
280cf4bd-ac05-4156-96df-180f985f8249 | 1 | public String getUserData()
{
if (userData == null)
{
return null;
}
else
{
return new String(userData);
}
} |
b3051248-440b-40fb-bb1d-3c10d45bbd73 | 0 | public static Filter isAnnotation()
{
return new IsAnnotation();
} |
696ffb7f-b844-4296-997b-a41e7cb23cfa | 5 | public void connect() throws IOException {
if (level != 0) // otherwise disconnected or connect
throw new SocketException("Socket closed or already open (" + level + ")");
IOException exception = null;
Socket s = null;
for (int i = 0; i < ports.length && s == null; i++) {
... |
13c67c83-1a06-4fd5-997e-79b4cd614c11 | 6 | public boolean ApplyDeadz() {
if (IsDeadTimer == false) {
actionTimer = 0;
ResetAttack();
ResetAttackNPC();
setAnimation(2304);
IsDeadTeleporting = true;
IsDeadTimer = true;
ApplyDead();
specialAttacks();
specialAttacks2();
specialAttacks3();
... |
bdb13bc8-f807-4e81-8d80-0c9a9bcf8ef8 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
bece49f3-d1af-423f-a91e-64a37b86d380 | 0 | public void addConnection(Connection c) {
Debugger.println("network", "[ConnectionBundle] New connection to " + c.toString());
accessSemaphore.acquireUninterruptibly();
ConnectionHandler ch = new ConnectionHandler(c);
c.setListener(ch);
chl.add(ch);
connections ++;
accessSemaphore.release();
} |
57d94d6b-358b-45ff-b2fc-0c51a82d20f1 | 1 | private boolean confirmQuit(String title) {
return
Game.getThis() == null ||
JOptionPane.NO_OPTION != JOptionPane.showConfirmDialog(this, "Quit the Current Game?", "Confirm " + title, JOptionPane.YES_NO_OPTION);
} |
535a5249-6af5-4294-92e2-702c0eef6a1b | 2 | @Override
public boolean canAttack(Board board, Field currentField, Field occupiedField) {
return this.validSetupForAttack(currentField, occupiedField) && (this.differByOneVerticalAndTwoHorizontal(currentField, occupiedField) || this.differByTwoVerticalAndOneHorizontal(currentField, occupiedField));
} |
1c9f1f82-3f03-4c5d-9710-79853ab393f5 | 1 | public static List<String> divide_sentence(String str){
List<String> list=new ArrayList<String>();
list.clear();
StringTokenizer token=new StringTokenizer(str, " , . ; : : + - * / @ ! & ( ) [ ]");
while (token.hasMoreTokens()){
list.add(token.nextToken());
}
return list;
} |
843a410e-bdad-4b6e-9fa5-cb3bc8d5b97f | 6 | public boolean hapus(String kode_buku){
boolean adaKesalahan = false;
Connection cn = null;
try{
Class.forName(Koneksi.driver);
} catch (Exception ex){
adaKesalahan = true;
JOptionPane.showMessageDialog(null,"JDBC Driver tidak ditemukan atau rusak\n"+e... |
9f389062-4802-4206-8c41-774fdfbd9f48 | 6 | private final Interface10 method1690(int i, int i_35_, int i_36_,
int i_37_, int i_38_) {
anInt5822++;
Interface10 interface10 = null;
if ((i ^ 0xffffffff) == -1)
interface10 = (Interface10) r_Sub2.method3297(i_37_, i_36_, i_35_);
if (i == 1)
interface10
= (Interface10) Class348_Sub40_Sub32.method... |
a8054ea5-0e60-4042-95f7-5f4eb295233c | 0 | public void setGladiolos(int gladiolos) {
this.gladiolos = gladiolos;
} |
1dce57fb-0ac9-4618-99bb-1bc3993533ad | 8 | public Recurrence(Task protoTask, Date toDate)
{
GlobalLogger.getLogger().logp(Level.INFO, this.getClass().getName(),
"Recurrence(Task, Date)", "Constructing Recurrence");
tasks = new ArrayList<Task>();
if (protoTask.getDueDate() == null && protoTask.getStartTime() == null)
{
throw new IllegalArgumentE... |
e070fd88-4c12-4e72-91ca-3dda64a80cdb | 0 | public void setMinecraft(Minecraft minecraft){
this.minecraft = minecraft;
} |
04531fd2-1a9f-49bb-aea4-5aedb2b200a4 | 4 | public static void addAntIcon(Ant ant) {
int newXLoc = ant.getLocationX();
int newYLoc = ant.getLocationY();
if (ant.getAntType() == "scout") {
//Scout sets Node to visible
AntColony.node[newXLoc][newYLoc].showNode();
// Show Scout image icon in the new node
AntColony.node[newXLoc][newYLoc].sho... |
8eb2f762-ad05-4b6d-a33f-50664f3bb2aa | 5 | public int[] getPoints(int size)
{
EIError.debugMsg("Start", EIError.ErrorLevel.Notice);
int[] sp = new int[size];
Point q = p(2, 0);
int y = 0;
for(int i = 0; i < STEPS+1; i++)
{
sp[i] = q.y;
}
for(int i = 2; i < ptsIn.npoints - 1; i++)
... |
7c4c9202-f778-433f-88d8-e15474f05c8f | 3 | public boolean cycleExists(Object obj) {
for (IdentityHashMap<Object, Boolean> stackFrame : stack) {
Boolean containsObj = stackFrame.get(obj);
if (containsObj != null && containsObj) {
return true;
}
}
return false;
} |
d6f259f0-f9b7-4855-9e0b-d62f79d1b73a | 9 | @SuppressWarnings({ "rawtypes", "unchecked" })
private void decodeJSON_Object(HashMap map, JSONObject value)
{
Iterator keys = value.keys();
while(keys.hasNext())
{
Object key = keys.next();
Object o;
try {
o = value.get(key.toString());
String keyType = "";
if(o instanceof Number)
{
... |
975221b7-c610-4f76-9cf6-0feb517749c7 | 0 | private static String getFileName(){
return Thread.currentThread().getStackTrace()[3].getClassName();
} |
b5c74786-a3d0-4099-ae7c-88b837f32b90 | 2 | private void do_downmix()
{
for (int sb=0; sb<SSLIMIT; sb++) {
for (int ss=0; ss<SSLIMIT; ss+=3) {
lr[0][sb][ss] = (lr[0][sb][ss] + lr[1][sb][ss]) * 0.5f;
lr[0][sb][ss+1] = (lr[0][sb][ss+1] + lr[1][sb][ss+1]) * 0.5f;
lr[0][sb][ss+2] = (lr[0][sb][ss+2] + lr[1][sb][ss+2]) * 0.5f;
... |
b38f703a-3d34-47f7-b124-9cb9703b2a34 | 1 | @GET
@Produces(MediaType.APPLICATION_JSON)
public List<TaskBean> getAllTasks() throws SQLException {
List<TaskBean> taskListBean = new ArrayList<TaskBean>();
List<Task> taskList = daoHelper.getList();
for (Task task : taskList) {
TaskBean taskBean = new TaskBean(task.getId()... |
e1f4cf62-aa2a-4265-aa4b-b4cbda1a78e1 | 8 | public static Surrogate getInstanceSurrogate(Stella_Object instanceref) {
if (instanceref == null) {
return (null);
}
else if (Stella_Object.isaP(instanceref, Logic.SGT_STELLA_SURROGATE)) {
if (((Surrogate)(instanceref)).surrogateValue == null) {
return (null);
}
else {
... |
99073404-897d-4793-86c9-66c914d21c35 | 5 | public boolean ramasserObjet(Objet o)
{
if(o instanceof Arme)
{
Arme a = (Arme) o;
if(a.getCategorieArme() == this.typeArme && a.getLevel() > this.arme.getLevel())
//la catégorie de l'arme convient au personnage et le niveau de l'arme est > a celui de l'arme du perso
{
this.arme = a;
return true... |
21e1a727-e7d3-4e78-ba88-f821f633a531 | 3 | public static ArrayList<String> getFiles(String path) {
ArrayList<String> files = new ArrayList<String>();
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
// list the files
files.add(path + System.g... |
b132faa5-8488-4748-83d5-1c9db971ffb2 | 8 | protected String toJSONFragment() {
StringBuffer json = new StringBuffer();
boolean first = true;
if (isSetToken()) {
if (!first) json.append(", ");
json.append("\"Token\" : {");
Token token = getToken();
json.append(token.toJSONFragment());
... |
7054a718-5c24-435c-b013-836bd1582907 | 1 | public String getFullAlias() {
if (pack.parent == null)
return getAlias();
else
return pack.getFullAlias() + "." + getAlias();
} |
3ae2189f-d26c-44f6-8dcb-65bf0821cb75 | 0 | public JCheckBoxMenuItem getAllowStayCheckBox() {
return turingAllowStayCheckBox;
} |
af224ff3-18ac-42f3-98f4-9748a2410ef2 | 8 | public LinkedList<CellToVisit> shortestPath(int startingX, int startingY,
int endingX, int endingY,
final LinkedList<CellDescription> map, boolean g) {
/*setup some private variables*/
graphics = g;
LinkedList<CellDescription> returnCells = new LinkedList<>();
LinkedList<C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.