method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
17d16dc4-ee90-4177-a081-4f6792e63206
0
public ArrayList<Target> getList() { return list; }
ff26aa86-8b32-4a2e-b411-611eb464960f
5
@SuppressWarnings("rawtypes") public static MultiColumnComparator createIntegerComparator(NumberName[] numberNames, boolean ascending, String defaultString) throws Exception { final String type="integer"; if (ascending) { if (defaultString.equals("")) { return new MultiColumnComparat...
68cd0fa8-48b7-4388-9dee-c903f2cd8a4a
2
public ArrayList<String[]> regresaMarcaSerieDeparta(int id_equipo) { String res = ""; ArrayList<String[]> resultado = new ArrayList<>(); String[] nombre = new String[4]; try { Class.forName(driver); Connection con = DriverManager.getConnection(connectString, user,...
4683ccd2-e95d-4cf1-acbd-f4b3515dfe1e
6
private void bigStrike (final Location loc) { final int radius = 8; final int radiusSq = radius * radius; final int blockX = loc.getBlockX(); final int blockY = loc.getBlockY(); final int blockZ = loc.getBlockZ(); final int fireworksY = blockY + 15; int iter...
8cabaf13-c67d-4361-a58b-26c7a6a9568e
5
final AnimatableToolkit method152(i var_i, byte i, int i_47_, boolean bool) { i var_i_48_; i var_i_49_; if (i == 1) { var_i_48_ = anI5110; var_i_49_ = anI5106; } else if (i == 2) { var_i_48_ = anI5107; var_i_49_ = anI5111; } else if (i == 3) { var_i_48_ = anI5109; var_i_49_ = anI5108;...
609c73d0-03b4-48fb-bc36-408c1695e901
8
public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); Random rnd = new Random(); int random = rnd.nextInt(100); int count = 7; String again = ""; boolean play = true; System.out.println("Enter your name"); String name = scan.next(); w...
1820bd5f-b6af-414c-aed7-d10dd03b4695
2
public void download() throws IOException { if (!file.exists()) { File temp = new File(file.toString().substring(0, file.toString().lastIndexOf("\\") + 1)); temp.mkdirs(); file.createNewFile(); } BufferedInputStream bis = new BufferedInputStream(url.openStream()); BufferedOutputStream bos = new Bu...
7beb566a-933c-423e-8689-7f8b09e6f6d1
4
private short[] findY1(short t1Index, short t2Index){ int numTries = 0; short pathT2Index = path[t2Index]; x1Dist = dist(pathT2Index, path[t1Index]); short stopBefore = mod(t1Index - 2); for(short t3Index = mod(t2Index + 2); t3Index != stopBefore && numTries < LIMIT; t3Index = mod(t3Index + 1)){ // visua...
7a662148-1b64-4aa9-b52b-e9fea1f1cc74
5
@Override public boolean equals(Object o){ if(!(o instanceof Sum)){ return false; } Sum comparing = (Sum) o; if(comparing.quarter == this.quarter && comparing.dime == this.dime && comparing.nickel == this.nickel && comparing.penny == this.penny){ return true; } ...
e3f08355-8a3a-4474-91e5-81ab23e3d992
3
public static void print(Object o) { Date date = new Date(); String hours = date.getHours() > 10 ? "" + date.getHours() : "0" + date.getHours(); String minutes = date.getMinutes() > 10 ? "" + date.getMinutes() : "0" + date.getMinutes(); String seconds = date.getSeconds() > 10 ? "" + date.getSeconds() : "0" + da...
5bd6a072-78b9-44b9-a08f-0baa12b07269
6
@Override public T build(Map<Class<?>, ClassBuilder<?>> how) { T newInstance; try { newInstance = this.underConstruction.newInstance(); } catch (Exception e) { e.printStackTrace(); throw new NecesitamosUnConstructorException(e,this.underConstruction); } for (PropertyBuilder propBuilder : properti...
2e7a023e-c52e-4164-8005-b4a515de6b58
6
public void testLRUCache() throws Exception { final int n = 100; Object dummy = new Object(); Cache cache = new SimpleLRUCache(n); for (int i = 0; i < n; i++) { cache.put(Integer.valueOf(i), dummy); } // access every 2nd item in cache for (int i = 0; i < n; i+=2) { ...
d5d1bf32-3208-495b-b5ec-2d2fec062813
2
protected void add() { if (!dialog.showAddDialog()) return;// ûȡζԻ // ݿв,ɹѧstudents if (database.addStudent(dialog.student)) { students.add(dialog.student); this.updateDisplay(); } else JOptionPane.showMessageDialog(this, "ӵѧѧѧѧųͻ", "ѧʧ", JOptionPane.WARNING_MESSAGE); }
9501bac0-a0f5-4c62-a5bd-31638d14a1ed
9
public void testCheckMinIdleObjectPool() throws Exception { try { PoolUtils.checkMinIdle(null, 1, 1); fail("PoolUtils.checkMinIdle(ObjectPool,,) must not allow null pool."); } catch (IllegalArgumentException iae) { // expected } try { final...
0daf89ac-dc2e-45ef-9984-43fcf0b73c80
9
private void readRDCInput(File file) { try { Format fileFormat = getFileFormat(file); switch(fileFormat) { case Simple: if(media.size() == 0) { JOptionPane.showMessageDialog(mainFrame, "Please add at least one medium", "Alert", JOptionPane.WARNING_MESSAGE); return; } RDCTypeSelectD...
e9f6437c-1449-4dd0-ae9d-66aa2db08bd1
2
public CipherPanel(int cipherID) { this.cipherID = cipherID; this.cipherResult = new JTextField(); ImageIcon regExCheck = makeImageIcon("/images/regex_maybe.png"); this.regExImage = new JLabel(regExCheck); this.cipherInformation = CipherHandler.getCipherInformation(cipherID); ...
6eb624ef-be87-419a-b517-8533b3c7d10c
7
static final int method3055(int i, Class304 class304) { anInt9106++; if (i < 94) method3054(false, -98, -116); if (class304 != AbstractMouseEvent.aClass304_7103) { if (Class108.aClass304_1662 == class304) return 6408; if (class304 == Class348_Sub40_Sub38.aClass304_9471) return 6406; if (Class...
d025340c-22f9-42e3-bca7-410639fb4061
2
public ArrayList<Edge> kruskalAlg() { ArrayList<Edge> mst = new ArrayList<Edge>(); while (mst.size() < this.cells.size() - 1) { //Select a random edge from the list of edges Random rand = new Random(); Edge randEdge = this.edges.get(rand.nextInt...
5765b218-1110-4ffb-a56c-4da675a5435d
4
@Test public void comparePerformance() { long timeStringConcatenation = measureTime(() -> { for (int i = 0; i < StringExampleTest.LOOP_COUNT; i++) { testStringConcatenation(); } } ); System.out.p...
0e7b9e81-9f23-4281-a8b3-8ba9212df448
0
@Override public void mouseReleased(MouseEvent e) {}
8a8de230-6d28-46ee-824f-d2dad8f1f189
9
private void loadScenario() { Pilot pilot = data.getCurrentPilot(); Sailplane glider = data.getCurrentSailplane(); Airfield airfield = data.getCurrentAirfield(); GliderPosition position = data.getCurrentGliderPosition(); Runway runway = data.getCurrentRunway(); W...
a1591b29-1b08-4bc1-bb51-6e368e1d39de
1
public static void main(String[] args) { try { AppGameContainer app = new AppGameContainer(new main()); app.setDisplayMode(1280, 768, false); //was 960 and 1080 app.setTargetFrameRate(60); app.setFullscreen(false);; app.start(); } catch (SlickException e) { e.printStackTrace(); } }
8067cd29-161a-462b-ab4b-b455259d0846
5
protected synchronized @Override Module retrieveModule(final String locator, final long revision) throws StorageException { // bottleneck alert: the file storage implementation is not really meant for multithreading use assert (locator != null): "Supplied locator is null"; assert (!"".equals(locator)): "No stora...
52dc57e1-2061-449b-b3f2-52874911967c
4
public List<CalendarObject> loadFile(String filename){ myFile = new File(filename); try { myDocument = builder.build(myFile); } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } List<Calend...
af8db77f-18f6-4662-ae92-af29fcf9c252
9
private void check_protocol (String protocol_) { // First check out whether the protcol is something we are aware of. if (!protocol_.equals("inproc") && !protocol_.equals("ipc") && !protocol_.equals("tcp") /*&& !protocol_.equals("pgm") && !protocol_.equals("epgm")*/) { ZEr...
e14f4e1b-5c91-4680-aa40-3203741d0812
1
private void addAnafores(){ anafores=con.getAnafores(); //pairnei tis anafores apo thn vash anaforesInfo = new HashMap<String, String>(); //dimiourgia HashMap for(int i=0;i<anafores.size();i++){ anaforesInfo=anafores.get(i); //pairnei ta stoixia mias seiras listModel.addElement((i+1)+ ") "+anaforesInfo...
e96c1c78-6170-44c9-8563-fe0a30f66b9c
7
public int getArrowProjectileGfxId(int weaponId, int arrowId) { if (arrowId == 884) { return 11; } else if (arrowId == 886) { return 12; } else if (arrowId == 888) { return 13; } else if (arrowId == 890) { return 14; } else if (arrowId == 892) return 15; else if (arrowId == 11212) return 1...
9b1adf26-c8b2-4403-a470-cec933a9358a
9
@EventHandler public void onSpoutcraftAuth(SpoutCraftEnableEvent event) { SpoutPlayer sPlayer = event.getPlayer(); if (!sPlayer.hasPermission("PlayerPlus.use")) { for(AccessoryType ttype : AccessoryType.values()) { String url = get(event.getPlayer().getName(), ttype); sPlayer.removeAccessory(ttype);...
581ecf3b-0196-4b76-992a-eecf5bb73fad
4
public static GbAudio rewriteTo4bitSimple(short[] samples) { int len = samples.length / 2; int[] outSamples = new int[len * 2]; int[] soValues = new int[len]; for (int pos = 0; pos < len; pos++) { int so = 7; for (int offset = 0; offset < 2; offset++) { int minError = Integer.MAX_VA...
02756cf6-9671-4cae-8377-fd0d33dcae17
8
public static boolean specializingPropositionsIteratorDnextP(SpecializingPropositionsIterator self) { { Cons specializingrelations = self.specializingRelations; for (;;) { if (TruePropositionsIterator.truePropositionsIteratorDnextP(self)) { if ((specializingrelations != null) && ...
4468999c-ffb0-4109-b750-53b7045a68f1
0
public String getDepartmentName() { return departmentName; }
bdad3084-02ec-4c3e-97df-6a111634d554
4
private File getConfigFile(String file) { if (file.isEmpty() || file == null) { return null; } File configFile; if (file.contains("/")) { if (file.startsWith("/")) { configFile = new File(plugin.getDataFolder() + file.replace("/", File.separator)); } else { configFile = new File(plugi...
361074ac-db62-4633-9442-fb61abc8b235
2
public void onDisable() { cC.config.set("spawns.1.world", spawn1.getWorld().getName()); cC.config.set("spawns.1.x", spawn1.getBlockX()); cC.config.set("spawns.1.y", spawn1.getBlockY()); cC.config.set("spawns.1.z", spawn1.getBlockZ()); cC.config.set("spawns.1.yaw", spawn1.getYaw()); cC.config.set("spawns....
81579f13-0ff3-422f-81f3-0031e10d0b80
4
public boolean collision(int xa, int ya) { boolean solid = false; for (int c = 0; c < 4; c++) { int xt = ((x + xa) + (((c % 2) * 17) + 7)) >> 5; int yt = ((y + ya) + (((c / 2) * 16) + 8)) >> 5; if (loadLevel.getTile(xt, yt).solid()) { solid = true; ...
b283d904-2d2b-4a7f-9da4-e2a548d5f9e3
5
public void morrisTraverse(TreeNode root) { while (root != null) { if (root.getLeft() == null) { System.out.println(root.getData()); root = root.getRight(); } else { TreeNode ptr = root.getLeft(); while (ptr.getRight() != null && ptr.getRight() != root) ptr = ptr.getRight(); if (ptr....
d4d6ae15-6007-4c38-8f12-a504fa3b3385
6
private Enemy(Vector2 position, float health, float shield, float speed, TreeMap<Integer,Pair<Integer,Integer>> FRAME_ROWS, int FRAME_COLS, Texture texture) { this.position = position; this.health = health; this.shield = shield; this.speed = speed; this.sprite = new Rectangle(); this.texture = texture...
65e9ee5e-92e5-4487-839b-65243af5df25
8
public String levelUpDisplay() {// don't use this in game this is to test // the basic leveling implementation with an output int[] out = new int[5]; this.level++; out[0] = (int) (this.nextExp * 1.1 - this.nextExp); this.nextExp *= 1.1; int total = 0; while (total == 0) ...
b2a1cb6c-acc3-49d9-a0a9-2b9ae73d823c
0
public String getTotal() { return this.total; }
01a5bd7f-617f-469b-b479-4fc78b133e4c
3
public List<String> reverseSortedKeys() { //Returns a List of type String, sorted based on their corresponding values. Uses insertion sort. List<String> keysList = getKeys(); int index; int v; String s; for(int i = 0; i < keysList.size(); i++) { index = i; s = keysList.remove(i); v = getInt(s); fo...
dfee313b-48f4-45bd-8403-1279eddc3b8e
2
@EventHandler(priority = EventPriority.MONITOR) public void onPlayerDeathInArena(PlayerDeathInArenaEvent evt) { Player victim = evt.getVictim(); if (evt.getCause() == DeathCause.ENVIRONMENT) { PlayerStorage storage = SE.getStorage(victim.getName()); if (storage != null) { String lastAttacker = storage.ge...
ebe8003f-a7ec-45b3-a8b7-cb1ce739f523
4
private TextureResource loadTexture(String fileName, int textureTarget, int[] filter, int[] internalFormat, int[] format, boolean clamp, int[] attachment) { String[] splitArray = fileName.split("\\."); String ext = splitArray[splitArray.length - 1]; try { BufferedImage image = Image...
305d91b1-633c-483a-a324-680197cefad3
5
public double averageWeigthDiff(Organism org) { double W = 0.0; int i = 0, j = 0; double count = 0.0; while (i < this.getGenomeSize() && j < org.getGenomeSize()) { if (this.getGenome().getGenes().get(i).getInnovation_num() == org.getGenome().getGenes().get(j).getInnovation_nu...
ad00f226-43f6-4a0a-950f-1cfa0fc0df6d
8
public static boolean cantMakeACompleteRobot() { int i = GameApplet.thisApplet.getGameState().getPolymetals(); int j = GameApplet.thisApplet.getGameState().getEnergyUnits(); Robot localRobot = GameApplet.thisApplet.getBuildPanel().getRobotOnRamp(); if (localRobot != null) { i += 20; j +=...
21d17364-4428-4683-a7fc-eb39f5aa6c42
5
public static void main(String[] args) { Scanner in = new Scanner(System.in); char grade = in.next().charAt(0); switch (grade) { case 'A': System.out.println("Excellent"); case 'B': System.out.println("Good"); case 'C': System.out.println("So so"); case 'D': System.out.println("Fails"); case 'F': System.out....
43f8a201-3cca-4c24-a2f9-05c904a4f37e
5
@Override public void onDraw(Graphics G, int viewX, int viewY) { if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300) { G.setColor(Color.ORANGE); G.fillArc((int)(X-16)-viewX, (int)(Y-10)-viewY, 32, 20, 0, 360); G.setColor(Color.BLACK); G.drawArc((in...
fb1f7c3a-52de-4b2f-9f98-2f6300ea6f3a
0
public void setRNC(String rNC) { RNC = rNC; }
024c5f2e-0188-42ba-b0bc-8dad893ec29f
9
public int consumeIncoming(short[] incoming, TelnetClient client) { int read = 0; if (incoming[0] == client.IAC && incoming[1] == client.SB && incoming[2] == getCode() && incoming[3] == IS) { int iacIndex = 0; // from [4] to the next IAC is the regime to be supported. for (int i = 4; i < incomi...
178f4619-0314-4332-86dc-a7ad452cf62f
9
private void connect(String host, int port, String password) { // Close current if (connection != null) { try { this.close(); } catch (Exception cause) { /* nothing */ } } synchronized (lock) { active = true; new RedisConnectionThread(host, port, lock).start(); // waite channel ...
d362b1c0-f754-4f93-a7ad-13ee19c1892b
9
public int minDepth(TreeNode root) { // Start typing your Java solution below // DO NOT write main() function if (root == null) return 0; if (root.left == null && root.right == null) return 1; ArrayList<TreeNode> cur, next; cur = new ArrayList<TreeNode>(); cur.add(root); int minDep = 0; while ...
43e9c6b6-d793-486e-8b87-f1c405b72e09
0
public JTextField getTxtPrenom() { return txtPrenom; }
a0cd3192-c79a-494b-829f-257c599091eb
9
public OFMatch loadFromPacket(byte[] packetData, short inputPort) { short scratch; int transportOffset = 34; ByteBuffer packetDataBB = ByteBuffer.wrap(packetData); int limit = packetDataBB.limit(); this.wildcards = 0; // all fields have explicit entries this.inputPort =...
a3a9d802-3a48-475c-9269-8dc4af2d3cd6
5
void del(File f) throws IOException{ if(f.exists() && f.isDirectory()){ if(f.listFiles().length==0){//del it if it's empty f.delete(); }else{ File delFile[]=f.listFiles(); int i =f.listFiles().length; for(int j=0;j<i;j++){ if(delFile[j].isDirec...
ae8e7b36-3701-4b75-8877-053a5aba2bb8
0
public void setDefaultSaveFileFormat(SaveFileFormat defaultSaveFileFormat) { this.defaultSaveFileFormat = defaultSaveFileFormat; }
8b006616-921d-4301-b450-370cda3a9605
7
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 0, 12, 4, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); fillWithBlocks(par1World, par3StructureBoundingB...
b2e4f410-be7a-4df3-9b07-3bfbccdc74a3
3
@Test public void testMain() throws Exception { // pre-conditions Assert.assertFalse(outputFile.exists()); // execute Main.main(null); // post conditions Assert.assertTrue(outputFile.exists()); Scanner scanner = new Scanner(outputFile); ArrayList<Str...
abc31cc1-f51e-47ab-aa6d-913401dd69aa
7
public boolean hasCycle(ListNode head) { if (head == null || head.next == null) return false; ListNode slow = head; ListNode fast = head; while (true) { slow = slow.next; if (fast.next == null) return false; else fast = fast.next.next; if (slow.equals(fast)) return true; if ((...
c1d61ee8-f91d-4a1f-a9d6-dae1e636ae01
6
public void addPriceStep(double startPrice, double endPrice, double fixedPrice, double variablePricePercent) throws RemoteException { // trimming to 2 decimal points startPrice = round(startPrice); endPrice = round(endPrice); fixedPrice = round(fixedPrice); variablePricePercent = round(variablePricePerc...
0e3a0619-b1e5-4d70-8340-6092cad93fce
0
public void setParameters(Object value) { this.parameters = value; }
9bbf836f-9264-4985-8931-92f3c6709820
5
public void punch(){ if(knockedOut) return; setAnimation(Anim.PUNCHING, LoopBehavior.ONCE, Vars.ACTION_ANIMATION_RATE/1.25f); for(Entity e : attackables){ if(e instanceof Mob) if(((Mob)e).getIFF()!=IFFTag.FRIENDLY) ((Mob) e).damage(strength, DamageType.PHYSICAL, this); else{ // either damage ...
0e1e2181-375f-4547-8f54-5627a706b756
0
public String getMinecraftColor() { return "§" + MinecraftColor; }
0e88dc39-2351-47e8-9cd6-08d42e83924b
8
public static LinkedQueue mergeSortedQueues(LinkedQueue q1, LinkedQueue q2) { LinkedQueue out = new LinkedQueue(); Object item1 = null; Object item2 = null; int flag = 0; int iterate = 0; while(!q1.isEmpty() && !q2.isEmpty()){ try{ item1 = q1.front(); item2 = q2.front();...
2ae43bb0-90c4-4106-bcd2-18d325f81d5e
0
public String[] toArray() { String[] result = new String[size]; System.arraycopy(data, 0, result, 0, size); return result; }
b1404afc-17d9-458f-a923-24d5ad60dbcd
8
@Override public Object run() throws Exception { if (getModel() == null) { throw new ComponentException("missing 'model'."); } if (calib_start == null) { throw new ComponentException("missing 'calibration_start'"); } if (steps.isEmpty()) { ...
170dbe2a-7081-4d0a-9a98-bad006c6f9a0
3
public void processAnswer() { GameStrategyFactory factory = GameStrategyFactory.getInstance(); GameStrategy gameStrategy = factory.getStrategy(isCorrect); gameStrategy.handleGameStatus(gameStatus, caretaker); if (caretaker.isFinalRound() && !isCorrect) { sleepQuiz(); ...
9d5398bd-90cc-4082-89fa-2dd63cb7a50f
1
public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] A = new int[n]; for (int i = 0; i < n; i++) { A[i] = in.nextInt(); } System.out.println(binarySearch(A, 5, 0, A.length-1)); }
2f189b37-60b5-4d2d-afb8-294632463ea4
0
private HandRank(int value) { this.value = value; }
9bde8323-b0a0-4ec8-a607-6f5bf334bd87
6
public void write(File file, boolean append) { Properties properties = new Properties(); properties.setProperty(USER, getUser() == null ? DEFAULT_USER : getUser()); properties.setProperty(POLL_INTERVAL, getPollInterval() <= 0 ? DEFAULT_POLL_INTERVAL : String.valueOf(getPollInterval())); properties.setProperty(A...
49d2d0fd-4b1d-47a7-a973-d4af6caccf9d
2
private void recurseFft(double[] input, double[] output, int numFftPoints, boolean invert) { double divisor; /** * The direct and inverse FFT are essentially the same algorithm, except for two difference: * a scaling factor of "numberFftPoints" and the signal of the exponent in the w...
062aa9cd-ae1c-4fb8-990f-913f5080fac4
7
public boolean isItemUsableInBattle() { if (itemnumber <= 13) { inBattle = true; } else if (itemnumber >= 14 && itemnumber <=32) { inBattle = false; } else if (itemnumber == 33 || itemnumber == 34 || itemnumber == 35 || itemnumber == 36) { inBattle = true; ...
816aeb2f-052d-47c4-86f8-068f42a276b1
8
@Override public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (OK.equals(command)) { ui.updateOption(); getGUI().removeFromCanvas(this); setResponse(group); } else if (CANCEL.equals(command)) { getGUI(...
20840d1e-0c3f-4284-833a-548191ce61e0
1
public void setSocket(Socket s) { this.serverSide = s; try { serverSideWriter = new PrintWriter(serverSide.getOutputStream(), true); serverSideReader = new BufferedReader(new InputStreamReader(serverSide.getInputStream())); clientSide = new Socket("127.0.0.1", match.p...
7d68b8fa-bf7e-4bf5-98a1-24b760142109
2
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); Composite composite = new Composite(shell, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); composite.setLayout(new GridLay...
dd76e3f5-07f9-4d20-b90d-efa9b1bb8c33
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 fe...
0e9cb1d0-b8cc-4184-a8a2-8cd3879ef597
1
public boolean CloseFile() { boolean result = false; try { //flush the buffer br.flush(); //close the file out.close(); //set status flag result = true; } catch(Exception e){} //...
8793dd8a-c79b-4e57-9d5e-255ccf707bca
5
private boolean insertActivity(Activity activity) { String activityName = activity.getName(); boolean saved = false; try { Connection conn = Dao.getConnection(); if (!"".equals(activityName)) { if (!activityDao.nameExists(conn, activityName)) { int insertActivity = activityDao.insertActivity(con...
037b04d4-c6b0-45ab-aef9-e5f2b69bcb04
1
public synchronized void add(long count) { this.bytes += count; if (this.reset == 0) { this.reset = System.currentTimeMillis(); } this.last = System.currentTimeMillis(); }
ef779fdc-bf48-42ce-972c-9112232450da
0
@Override public int compareTo(Node o) { return this.cnt-o.cnt; }
0e9ff9a9-428c-4d74-8652-008459682790
8
public int[] willBreakGround(int startX, int startZ, int endX, int endZ) { int[] groundLoc = new int[4]; groundLoc[0] = 0; groundLoc[1] = 0; groundLoc[2] = 0; groundLoc[3] = 0; int dx = endX - startX; int dz = endZ - startZ; int count = (int) Math.sqrt(dx ...
dac484e5-9580-4190-8dd2-b07d579032a3
5
public boolean isValidBSTRec(TreeNode root, int min, int max){ if(root == null) return true; if(root.val <= min || root.val >= max) return false; boolean l = isValidBSTRec(root.left, min, root.val); if(!l) return false; boolean r = isValidBSTRec(root.right, root.val, max); ...
a623f8d2-0fea-467c-8832-74243daf3c32
9
@Override public void iterate() { for (int i = 0; i < this.length; i++) { String cellPattern = "" + cells().leftOf(i, 1) + cells().getCell(i).toBit() + cells().rightOf(i,1); switch(cellPattern){ case "111": applyRule(0, i); break; case "110": ...
b3803f03-a01b-45e0-9854-ff7845aade13
5
@Override public Object getValueAt(int rowIndex, int columnIndex) { DeliveryPacket packet = delivertPackets.get(rowIndex); if (columnIndex == DELIVERY_PACKET_ID) { return packet.getId(); } else if (columnIndex == MEMBER_NAME) { return packet.getMember().getFullName();...
a435ac35-a4d7-46f8-993f-8f6cbc644d64
2
public GedcomObjectFactory findFactoryForTag(String tag) { if (tag.equalsIgnoreCase("DATE")) return dateFactory; else if (tag.equalsIgnoreCase("PLAC")) return placeFactory; else return null; }
3ee1076d-b6ca-4398-814f-8c259b909180
3
@Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(aiTimer)) { if (ballMovement) { updateStatus(); updateRemote(); moveBall(); repaint(); } } else if (e.getSource().equals(playerTimer...
201f4b05-e466-4c11-af3f-b98aff73eb25
8
public void saveHighScores() throws IOException { if (highScores == null || highScores.isEmpty()) { return; } Collections.sort(highScores, highScoreComparator); XMLOutputFactory xof = XMLOutputFactory.newInstance(); FileOutputStream fos = null; try { ...
b90b947c-9308-4def-8210-91a157d9d726
9
private boolean parseMapFile(File f) { try { FileReader fr = new FileReader(f); int readInt = 0; StringBuilder sb = new StringBuilder(); while ((readInt = fr.read()) != -1) { sb.append((char) readInt); } System.out.println(s...
21211209-5e61-47c3-959a-c54eb5afce4f
7
public Stella_Object pop() { { HashSet self = this; { Stella_Object element = null; Stella_Object setmap = self.theMap; if (setmap != null) { if (self.crossoverPoint == 0) { { StellaHashTable map = ((StellaHashTable)(setmap)); KvCons[] table = map.theTable...
d3cafb91-0b0f-473b-a19f-3db95fd8ce54
8
public void DoAction() { Scanner sc = new Scanner(System.in); String action; boolean valid = false; while(!valid) { action = Input.getStringInput(sc); if(action.equalsIgnoreCase("EXPLORE")) { explore.Traveling()...
c164ad84-82c5-477b-9684-2549747182cb
6
@Override public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if(src == btLogin){ try{ if(tfEnterNickname.getText().length() <= 12){ User Loginuser = new User(tfEnterNickname.getText()); this.out.writeObject(Loginuser); tfEnterNickname.setText(""); setVisible(false); ...
cbb5967d-57b2-4218-85d3-c3d11474024c
2
public static int loadTexture(BufferedImage image) { int[] pixels = new int[image.getWidth() * image.getHeight()]; image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth()); ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.get...
0f21cf17-3494-449d-92e1-368bbe38b63a
9
public TreeRow selectUp(boolean extend) { TreeRow scrollTo = null; if (mRoot.getChildCount() > 0) { int count = mSelectedRows.size(); if (extend && count > 0) { scrollTo = getLastSelectedRow(); if (scrollTo == mAnchorRow) { scrollTo = getBeforeFirstSelectedRow(); if (scrollTo != null) { ...
587c5610-d16c-4926-bc9f-53ac440d4c27
4
public long getLong(String key) throws JSONException { Object o = get(key); if(o==null) return 0; if(o instanceof String){ if(o.toString().length()>0){ return Long.valueOf((o.toString())); }else return 0; } return o instanceof Numbe...
40d0ba7e-64a6-477c-8858-93608e926eae
5
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (plugin.warpList.containsKey("Spawn")) { try { plugin.warpList.get("Spawn").warpPlayer((ProxiedPlayer) sender); ...
3e3e1d16-3dc5-4378-ac4f-eb65ea1956cf
2
public List<Ticket> getTicketsByCOid(int coID) { List<Ticket> coTickets = new ArrayList<Ticket>(); for (Ticket ticket : tickets) { if (ticket.getCashOffice().getNumber() == coID) { coTickets.add(ticket); } } return coTickets; }
87665d01-ffc9-44e4-8419-1a08974c8763
0
public Integer getId() { return id; }
064e7114-3135-43ff-ae80-b32c98258826
7
public static final Iterator<SecFlag> getSecurityCodes(final MOB mob, final Room room) { if((mob==null)||(mob.playerStats()==null)) return EMPTYSECFLAGS; final MultiIterator<SecFlag> it=new MultiIterator<SecFlag>(); it.add(mob.playerStats().getSecurityFlags().flags()); it.add(mob.baseCharStats().getCurrentC...
342bc47b-a1af-4369-a4b0-f6d8440cd590
0
public void mouseWheelMoved(MouseWheelEvent e) { mouseHelper(MOUSE_WHEEL_UP, MOUSE_WHEEL_DOWN, e.getWheelRotation()); }
1449f0f5-8d51-4035-bd27-fc0ff725ce5f
2
public static void main(String[] args) throws Exception { if (args.length != 1) { System.err.println( "Usage: java Sink <processing server address>"); System.exit(1); } // get the dest host + port from console String dest_host = args[0]; ...
6c6664b6-9136-46e7-a2f0-fa08b5435169
2
private void drawSelectingCollection() { // Draws collection window parent.stroke(0); parent.fill(225); parent.rect(posX + 270, posY + 150, 235, 300); float start = posY + 167; for (int i = 0; i < parent.getCollectionLength(); i++) { if (indexSelected == i) { parent.noStroke(); parent.fill(190...
2873ff7a-a95e-4e4b-b177-170861d121ab
1
public boolean areCoordinatesSet() { return (row != null && col != null); }
411a6193-ed9f-48f5-8db7-4d17c71ae279
6
public static int compatibleRealMethods(MethodSlot prototypemethod, Surrogate abstracttype, Object [] MV_returnarray) { { Symbol methodname = prototypemethod.slotName; int nofrealsubtypes = 0; int nofrealmethods = 0; boolean compatiblesignaturesP = true; { Surrogate sub = null; Cons...