method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cdef8458-18a1-4e52-a89b-4fd37905c1c0
7
public List<Square> getClickableSurround(int i, int j) { List<Square> squares = new ArrayList<Square>(); for (int x = i - 1; x <= i + 1; x++) { for (int y = j - 1; y <= j + 1; y++) { if (positionExists(x, y) || (x == i && y == j)) continue; Square s = board[x][y]; if (!s.isFlagged() && !s.isReve...
5ddd63fc-4e2a-430a-b0b9-3fd82f01f440
0
public void setIdLogEnt(int idLogEnt) { this.idLogEnt = idLogEnt; }
9d733155-9238-4df8-8912-bbbdfd9e533f
8
@Override public boolean onCommand(CommandSender sender, Command command, String sabel, String[] args) { if (Utils.commandCheck(sender, command, "sub")) { Player player = (Player) sender; if (args.length == 0) { // /power - displays power help // /power list - displays all powers (elements), with green...
1f1b7c1a-4ea3-4169-99e2-1c85f859c23d
8
public synchronized void create_tables() { Connection c = null; try { clearSoftState(); c = connectionPool.getConnection(); Statement s = c.createStatement(); s.executeQuery("show tables"); for( String t : CREATE_TABLES ) { try { s.execute(t); } catch( Exception e ) { ...
c5840d9c-55a1-424f-9196-c7740c91cdca
1
public void mousePressed(MouseEvent event) { Transition t = getDrawer().transitionAtPoint(event.getPoint()); if (t != null) { controller.transitionCollapse(t.getFromState(), t.getToState()); } }
af8e0c17-a647-413b-b6c1-382bfc2772aa
3
private ArrayList<Card> returnPairSetup() { ArrayList<Card> setup = new ArrayList<>(); if (compareCardFigures(0, 1)) { setup.add(cards.get(0)); setup.add(cards.get(1)); } else if (compareCardFigures(1, 2)) { setup.add(cards.get(1)...
c6acf1a5-0f74-4362-b60b-fe0cbd5be78b
3
public boolean isAlive() { if (this.getWorld() == null) return false; if(!this.getWorld().liesWithinBoundaries(this)) return false; if (this.getCurrentHitPoints() == 0) return false; return true; }
75b3ed2f-cf5c-45bd-bc64-92a300c4d5cb
4
@Override public List<Object> getAll(int gameID){ try { db.start(); DBCollection collection = db.getDB().getCollection("moves"); XStream xStream = new XStream(); DBCursor cursor = collection.find(); if (cursor == null) return null; List<Object> commands = new ArrayList<Object>(...
29b09764-abb3-4c31-8c3e-1161a67bbe7e
7
@Override public List<String> onTabComplete(CommandSender sender, org.bukkit.command.Command cmd, String label, String[] args) { if(!cmd.getName().equals(cmdName) || args.length > 1) { return null; } List<String> results = new LinkedList<>(); boolean ignoreArg = false; ...
e6411271-461e-4889-8018-da52716dbe78
5
private boolean pointCollides(double x, double y){ for (Building b : model.getBuildings()){ Rectangle rect = (Rectangle) b.getShape(); if (x <= rect.getX()+rect.getWidth() && x >= rect.getX() && y <= rect.getY()+rect.getHeight() && y >= rect.getY()){ ...
34dd15dc-176c-4747-862b-200d7679f78f
7
public static int getOrder(Enemy enemy){ //命令 int order = 0 ; //boss坦克在数组中的位置 int boss_y = Game.BOSS_TANK_X * Constant.WIDTH_HEIGHT ; int boss_x = Game.BOSS_TANK_Y * Constant.WIDTH_HEIGHT ; //敌人位置 int x = enemy.getLocation_x() ; int y = enemy.getLocation_y() ; // String[] mapArray = enemy.getMainFra...
aee764e8-0089-4545-986f-036592f94348
5
public void saveParamDiffsData(int cGeneration, Hypothesis h) { int hIndex = 0; int[] diffs = new int[targetValues.length]; for (int i = 0; i < targetValues.length; i++) { //Convert each block of five bits to an integer value String binStr = ""; fo...
a9f0b1f9-8e91-4904-b3bf-30bb177f6430
0
@Test public void testMyComparer() { assertTrue(true); }
419ec8e6-5831-4636-9cc4-e99246d13336
5
public String leerOpcion() throws IOException, SQLException, ParseException { String input = bf.readLine(); if(input.equals("1")){ agregarInsumo(); }else if(input.equals("2")){ consumirInsumo(); }else if(input.equals("3")){ buscarInsumo(); }else if(input.equals("4")){ agregarCantidadInsumo(); }e...
421991a6-9ccd-4b63-a553-7c142954198a
9
private OSXApplicationProxy() { try { final File file = new File("/System/Library/Java"); if(file.exists()) { ClassLoader scl = ClassLoader.getSystemClassLoader(); Class<?> clc = scl.getClass(); if(URLClassLoader.class.isAssignableFrom(clc)...
00d6068b-15a1-49a3-932c-28b154a5ec41
6
public void run() { log.logDebug( "MockAgent.Worker started"); ISemiSpaceTuple t=null; String cargo; while(isRunning) { t = blackboard.read(template, 1000); // leave up to a second System.out.println("MockAgent read "+t+" "+isRunning); if (t == null) { synchronized(synchObject) { try ...
5376bc61-58a3-4bb3-a5ce-f3ca142f9a2e
6
public static String maximumNonDuplicateSubstring(String str) { Set<Character> encountered = new HashSet<Character>(); int i = 0, firstCharacterIndex = 0, count = 0, largestCharacterIndex = 0, largestCount = -1; while (i <= str.length()) { if (i == str.length()) { System.out.printl...
0b78e7bf-d5ae-4f01-b974-600ee0981da2
5
public boolean mouseInRegion(int x1, int x2, int y1, int y2) { if (getScale() != 1) { x2 = (int) ((x2 - x1) * getScale()); x1 *= getScale(); x2 += x1; y2 = (int) ((y2 - y1) * getScale()); y1 *= getScale(); y2 += y1; x1 += Main.scaledX; x2 += Main.scaledX; y1 += Main.scaledY; y2 += Main.s...
8eba8484-d669-4f20-a6b4-52938ba9522c
8
@EventHandler public void onEntityDeath(EntityDeathEvent e) { Player player = e.getEntity().getKiller(); if (!(e.getEntity() instanceof Player)) { e.getDrops().clear(); e.getEntity().getEquipment().setBootsDropChance(0); e.getEntity().getEquipment().setHelmetDropChance(0); e.getEntity().getEquipment()....
4261ecf8-db52-4876-b785-e8ddedf376f4
2
protected void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { HttpSession session = req.getSession(true); int uid = (int)((User)session.getAttribute("currentSessionUser")).getId(); //HashMap<Product,Integer> cart = (HashMap<Product,Integer>)session.getAttribute("ca...
fe7ca35f-3f4b-4db7-838c-f7eece0475c3
0
public void setDeleted(boolean deleted) { this.deleted = deleted; }
abef86bf-25af-42e9-8947-39121d5356f2
6
private boolean isTwoPair(ArrayList<Card> player) { ArrayList<Integer> sortedHand=new ArrayList<Integer>(); sortedHand=sortHand(player); int pair1Counter=0; int pair2Counter=0; int pair1Int=100; int pair2Int=100; for(int i=0;i<player.size()-1;i++) { if(sortedHand.get(i)==sortedHand.get(i+1)){ if(sortedHan...
a27196b5-9411-4077-ac08-540d4ed13a19
6
public void givePin() { if(dead || flyingType || crashed) { return; } if (pinned) { pinned = false; setHappiness(Happiness.AVERAGE); return; } if(!pinned) { if(sleeping) wakeup(); staycount = 0; staying = false; setToFood(false); toSukkiri = false; setToShit(false); shitting...
1dd2f966-3d6f-4d7b-856a-586a03563e75
4
public String getCurTime(){ Date d = new Date (); String date_str=""; if(d.getHours()<10) date_str="0"; date_str+=d.getHours()+":"; if(d.getMinutes()<10) date_str+="0"; date_str+=d.getMinutes()+":"; if(d.getSeconds()<10) date_str+="0"; date_str+=d.getSeconds()+":"; ...
b23f46ae-15fa-40be-8080-e48937c78399
0
private void setFrameVer(){ modificar.setVisible(true); modificar.setTitle("Ver Producto"); modificar.setSize(500, 300); }
de460608-b7df-45cb-8de0-b3fd291ee09e
7
@Override public void runClient(GameEntity entity, float delta) { if(physics != null) { Vector3 position = physics.getPosition(); decal.setPosition(position.x + offset.x, position.y + offset.y, position.z + offset.z); if(up != null && rot != null) { decal.setRotation(rot, up); } else { decal....
ad172c80-3e14-41d6-8557-6e223eb4b41e
3
protected void writeAttributes(GrowableConstantPool constantPool, DataOutputStream output) throws IOException { int count = getKnownAttributeCount(); if (unknownAttributes != null) count += unknownAttributes.size(); output.writeShort(count); writeKnownAttributes(constantPool, output); if (unknownAttribu...
f9f78e27-76e0-47e3-83bf-3ee505bca173
6
public static void addConj (String conj) { switch (conjState) { case -1: days[dayNum].conj[days[dayNum].conjNum].conj[0] = conj; System.out.print("Yo Form: "); conjState++; break; case 0: days[dayNum].conj[da...
47800516-f97c-45ff-ae63-652e0c5258a4
8
public void debuffRecovery(){ recovery++; if (cc == EARTH && recovery >= 80){ entombed = false; jolly = true; recovery = 0; } else if (cc == WATER && recovery >= 60){ slowed = false; jolly = true; recovery = 0; } else if (cc == WIND && recovery >= 40){ knockedback = false; ...
f1360b11-9e28-4f65-9e35-7c870be54d5c
0
public int getWidth() { return width; }
2350bf9a-1722-48be-a3d9-3584f244bd1d
6
public BigDecimal weightedMean_as_BigDecimal() { if (!weightsSupplied) { System.out.println("weightedMean_as_BigDecimal: no weights supplied - unweighted mean returned"); return this.mean_as_BigDecimal(); } else { boolean holdW = Stat.weightingOptionS; if (weightingReset) { if (weightingOptionI) { ...
6f9bad3b-3de7-4a87-9953-5e945a717a51
9
@Test public void testCastingToVoid() { assertNull(ValueType.VOID.cast(null)); try { ValueType.VOID.cast(false); fail(); } catch(ClassCastException e) { // empty block } try { ValueType.VOID.cast((byte) 1); fail(); } catch(ClassCastException e) { /...
5fd30f5b-8cca-4559-a287-775e635d3dca
0
public void stopLiveWindowMode() {}
119465f3-6a1c-40b6-8d57-7990964f0fe0
5
@Override public void mouseClicked(MouseEvent e) { // Double-click event. if (e.getClickCount() >= 2) { // Prevent the user from taking another screenshot while cropping. if (cropWindow != null && !cropWindow.canSave()) return; // Get ...
0ec2cc5a-7aa5-4ac1-b8e5-a9c48365d7cb
3
public boolean equals(Object obj) { if (obj == null) return false; if (obj instanceof Name) return name.equals(((Name) obj).getName()); return obj instanceof String && name.equals(obj); }
83793c05-2ddc-4264-98a1-1804e9c42699
1
public static void main(String args[]) { Enumeration days; Vector dayNames = new Vector(); dayNames.add("Sunday"); dayNames.add("Monday"); dayNames.add("Tuesday"); dayNames.add("Wednesday"); dayNames.add("Thursday"); dayNames.add("Friday"); dayName...
0c425359-7566-498d-862a-f773794fbaad
4
public static BigInteger calculateRepresentationNumber(Cell[] currentBoard){ BigInteger out = BigInteger.ZERO; Cell actualCell; int ibase = Piece.values().length + 2; BigInteger base = BigInteger.valueOf(ibase); for(int i=0; i < currentBoard.length;i++)...
a49f10ec-4998-48e3-a7a3-21863004f594
4
public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { checkState(); checkAccess(access, Opcodes.ACC_PUBLIC + Opcodes.ACC_PRIVATE + Opcodes.ACC_PROTECTED + Opcodes.ACC_STATIC + Opcodes.ACC_FINAL + Opcodes.ACC_SYNCHRONI...
4f2a828c-579f-4347-b646-ea49a043bc8b
6
private void method46(int i, Stream stream) { while(stream.bitPosition + 21 < i * 8) { int k = stream.readBits(14); if(k == 16383) break; if(npcArray[k] == null) npcArray[k] = new NPC(); NPC npc = npcArray[k]; npcIndices[npcCount++] = k; npc.anInt1537 = loopCycle; int l = stream.readBits(...
50ad9fce-e539-4daa-ac30-60edd7a42b49
1
public void setPosition(Position currentpos) { this.CurrentPosition = currentpos; if (!this.trail.contains(currentpos)) { trail.add(currentpos); PlayerTrail.add(currentpos); } }
a17ac14f-815a-40b3-8b33-5577d5424d09
2
public GameResult getGameStatus() { if (getMafiaCount() == 0) return GameResult.VillagerWins; else if (getVillagerCount() <= getMafiaCount()) return GameResult.MafiaWins; return GameResult.GameStable; }
91905753-9de1-4990-bf63-7687fb865dfe
9
@Override public int onTrailerFound(COSDictionary trailer, int ordering) { if (ordering == 0) { rootID = trailer.getReference(COSName.ROOT); infoID = trailer.getReference(COSName.INFO); documentIsEncrypted = trailer.containsKey(COSName.ENCRYPT); COSArray Ids...
9c5385c9-edae-403b-ae30-2c25cfc34bbf
8
public void actionPerformed(ActionEvent event) { String actionCommand = event.getActionCommand(); if (actionCommand.equals("BROWSE")) { int returnVal = browse.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { fileLoc.setText(browse.getSelectedFile().getPath()); searchButton.set...
84a4d9df-976d-4d1c-b838-8d96d053af80
7
protected String startSetToString() { StringBuffer FString = new StringBuffer(); boolean didPrint; if (m_starting == null) { return getStartSet(); } for (int i = 0; i < m_starting.length; i++) { didPrint = false; if ((m_hasClass == false) || (m_hasClass == true && i...
a70c631e-67cd-48f7-83a8-126b2902590c
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 to * string. If we reach an early end, bail. */ for ...
9abdbf06-8904-4bee-b730-58c9e4de4c03
9
public void actionPerformed(ActionEvent event) { if(event.getActionCommand().equals("Add")) { String name = userField.getText().trim(); if (name.equals("") || name.equals("Enter User Name")) JOptionPane.showMessageDialog(null, "Invalid User Name"); else { String key = randomKeyGenerator(); ...
768c23d1-5367-4bc1-8e64-2de13b4ff44a
8
private Peer getMostUpdatedPeer() { int newestVersion = handle.getVersion(); Peer mostUpdatedPeer = null; for (Map.Entry<Integer, Peer> entry : peersTable.entrySet()) { Integer id = entry.getKey(); Peer peer = entry.getValue(); log.addLogEntry("Checking connectivity with Peer " + id); int peerVersion...
ac3abe79-f4eb-4e98-b711-6992628ceae8
4
double getDefence(Match match, Team team) { int countMatches = 0; int[] goals = new int[deep]; Match currentMatch = getPrevMatch(team, match); for (int i = 0; i < deep && currentMatch != null; i++, currentMatch = getPrevMatch( team, currentMatch), countMatches++) { ...
dc2a0d4b-3c0b-45de-ad61-c67a5a4b5087
7
public static int checkRequirements(MapleCharacter player, int itemId) { int cat = getItemType(itemId); if (cat > 1000) { return 1; } else if (MapleItemInformationProvider.getInstance().getSlotMax(itemId) < 1) { return 2; } else { int taocount = player...
809d0208-3a71-4294-8eeb-2edbca3212af
4
public void run(){ do{ int randy = (int)(Math.random()*100); if(((randy%2)==0) & (actual>0) ){ // Consumidor lleno.esperar(); mutex.esperar(); // zona critica cont++; actual--; ...
522aef42-8e25-4a7e-aabb-b2d320d37f9f
9
public HashMap<String, String> getParsedRequest(BufferedReader inFromUser) throws SocketTimeoutException, IOException { resultMap = new HashMap<String, String>(); parametersMap = new HashMap<String, String>(); String line = inFromUser.readLine(); // if end of the stream has been reached notify process threa...
9f342b3a-96c9-4b3c-9659-6664a379cd8a
4
final void method500ms() { long timeMillis = System.currentTimeMillis(); while (true) { if (System.currentTimeMillis() > timeMillis + 500) return; for (int i = 0; i < 10_000; i++) { // busy wait if (i == 10_000) break; } } }
3a806c00-9ea6-4ad3-9429-65c7d86bdf00
5
public void run(){ while(!finished && !failed){ // бесконечный цикл chooseNextNode(); // обхода вершин visitNextNode(); // и оставление феромонов в них writePheromon(); // запоминает, куда должен оставить феромоны ...
6936c514-1efb-41de-8005-d31d648230ea
3
private Integer addResults(MyRecursiveTask task1, MyRecursiveTask task2) { int value; try { value = task1.get().intValue() + task2.get().intValue(); } catch (InterruptedException e) { e.printStackTrace(); value = 0; } catch (ExecutionException e) { ...
194e73f8-9ba1-4154-b8d7-91cd9e9f71c7
6
public ListNode reverseKGroup(ListNode head, int k) { ListNode header = new ListNode(0); header.next = head; ListNode[] nodes = new ListNode[k]; int count = 0; ListNode pre = header; ListNode p = head; while (p!=null){ while(p!=...
984a6745-e90d-4a81-8e2d-b662d41e3a5d
1
@Override public void removeClientConnectListener(ConnectOnServerListener listener) { if (clientConnectListenerList != null) { clientConnectListenerList.remove(ConnectOnServerListener.class, listener); } }
7c83f651-d0d4-4d64-a486-7ea999a552c1
4
private static Body fullyConnectBody( int boxWidth, int boxHeight, Body body ) { for( int heightIdx = 0; heightIdx < boxHeight; heightIdx++ ) for( int widthIdx = 0; widthIdx < boxWidth; widthIdx++ ) { if( widthIdx < boxWidth -1 ) body.connectShape( bod...
5d125513-ec35-45e1-a968-94249baf0a6c
3
protected void paintComponent (Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; Rectangle rect; for (int i = 0; i < circles.size(); i++) { rect = circles.elementAt(i); g2d.setStroke(new BasicStroke(3.0f)); g2d.setColor(Color.black); g2d.drawString(nodeList.get(i).g...
919a5dc7-0fdc-48fd-9376-340758692ea4
4
public wordsDocument(String phrase) { String text = onlyText(phrase); String[] temp = text.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\\)", "").replaceAll("\\(", "").split(" "); for (String current : temp) { current = current.replaceAll("[\n,.?!:\";'']", ""); if (current.contains("'...
7ec97f8b-f20d-488d-933b-549976f021f2
6
public LoginWindow() { super(500,190); getContentPane().setLayout(null); usernameLabel = new JLabel(); usernameField = new JTextField(25); passwordLabel = new JLabel(); passwordField = new JPasswordField(25); loginButton = new JButton(NavalBattle.getLocalizationManager().getString("login_login")); JButt...
921a44c4-8df9-4300-91fb-ad099f5b488e
2
public void cambiarPesoNodo(long target, int peso) { for (int i = 0; i < connections.getLength(); i++) { Connection connection = connections.get(i); if (connection.getTarget()==target) { connection.setPrecio(peso); difusion(XmlToolkit.crearCambioPeso(this....
6d68e322-2f8e-4d94-87c4-383fd8c5919c
1
public static boolean propertyEqualsAsString(PropertyContainer container, String key, String test_value) { if (container != null) { return container.propertyEquals(key, test_value); } else { throw new IllegalArgumentException("Provided PropertyContainer was null."); } }
502eb219-c048-4cce-be0c-c7ff872249e6
8
private void editRackProperties(){ RackPropertiesDialog dlg = new RackPropertiesDialog(this.r.getRackProperties(),this, "Edit Rack Properties", "table goes here..."); if (dlg.getExitWithOK()){ String propName = "rows"; String str = ""; try { this.r.getRackProperties().set...
4795d3a0-acbf-4128-a6b1-3291e301c822
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < ...
629533f6-aab2-48ec-a3a8-b45f26bf8d76
5
public int computeLCS(int i, int j) { if ((i == 0) || (j == 0)) return 0; if (length[i][j] > 0) return length[i][j]; if (seq1[i] == seq2[j]) { length[i][j] = computeLCS(i-1, j-1) + 1; indices[i][j] = I * (i-1) + j-1; } else if...
3405f2b7-38e7-4911-a886-029946b7d9af
9
@Override public boolean equals(Object o) { if (!(o instanceof Container)) return false; Container container = (Container) o; if (UUID != null ? !UUID.equals(container.UUID) : container.UUID != null) return false; if (id != null ? !id.equals(container.id...
7ee1657f-b8a8-4064-9642-03fbfa962455
5
private String randomCard(int i) { String card; // String carte a retourner // Affecte la string carte au cas par cas en fonction de la valeur de l'entier. switch (i) { case 0: card = "chevalier"; break; case 1: card = "monopole"; break; case 2: card = "route"; break; case 3: ...
bcd9ccf7-abdc-43eb-be15-f65a883f30b1
8
public void beginContact(Contact c) { Fixture fa = c.getFixtureA(); Fixture fb = c.getFixtureB(); if(fa.getUserData() != null && fa.getUserData().equals("foot")) { numFootContacts++; } if(fb.getUserData() != null && fb.getUserData().equals("foot")) { numFootContacts++; } if(fa.getUserData()...
36cccdb9-36c5-48a2-9014-84ed2eb72d12
2
public static HsvImage convertToHsv(RgbImage rgb) { HsvImage hsv = new HsvImage(rgb.getWidth(), rgb.getHeight()); for (int x = 0; x < rgb.getWidth(); x++) { for (int y = 0; y < rgb.getHeight(); y++) { HsvPixel px = convertPixel(rgb, x, y); hsv.setPixel(x, y, HUE, px.hue); hsv.setPixel(x, y, SATURATIO...
2bb70e13-476c-4478-8ba4-ab6a298d67ed
1
@Override public boolean startVideoProcessing(File videoFile) { if (!videoFile.exists()) return false; processThread = createProcessThread(videoFile, this.mediator); // Start processThread.start(); return true; }
3cc97116-5fa6-4efb-a236-fbff7020c27e
7
public static void htmlDescribeInstances(String title, String head, NamedDescription relation, org.powerloom.PrintableStringWriter stream, boolean ruleP) { { Cons instances = edu.isi.powerloom.PLI.getConceptInstances(relation, null, null).consify(); Cons assertedinstances = Logic.ASSERTION_INFERENCE.levellize...
19b1917a-cfaa-475a-95e8-93935834d742
6
PluginClassLoader(final ClassLoader parent, String main, final File file) throws InvalidPluginException, MalformedURLException { super(new URL[] {file.toURI().toURL()}, parent); try { Class<?> jarClass; try { jarClass = Class.forName(main, true, this); ...
048038b5-5914-4a15-8dc3-48988ebc558a
0
public WhereIterable(Iterable<T> source, Predicate<T> predicate) { this._predicate = predicate; this._source = source; }
c8f1393f-81cf-4237-b6cd-2a24227a9f90
5
public static String[] format(String[] text) { int max = 0; int n = 0; StringBuilder sb; for(int i = 0; i < text.length; i++) { if(text[i].length() > max) max = text[i].length(); } for(int i = 0; i < text.length; i++) { sb = new StringBuilder(); if(text[i].length() < max) { n ...
101ac87e-472e-46f8-a157-0bd13f214af8
5
public static boolean compareBufferedImages(BufferedImage bufferedImage1, BufferedImage bufferedImage2) { if (bufferedImage1.getWidth() == bufferedImage2.getWidth() && bufferedImage1.getHeight() == bufferedImage2.getHeight()) { for (int x = 0; x < bufferedImage1.getWidth(); x++) { f...
0a407b52-0c60-4bfb-b1a8-c34cc888ecf5
2
@Override public boolean equals(Object obj) { if (obj == null) return false; Point p = (Point) obj; return properties == null ? p.properties == null : properties.equals(p.properties); }
2d477b49-b5d5-4b22-af1d-c9639541bed5
3
public void setZonesCount(int xCount, int yCount) { if(xCount > 64 || yCount > 46) { try { game.myControle.writeToDebugFile("Could not load that many zones. Maximum 1024*1024!"); } catch (IOException e) { System.out.println("Error setting zones in class Ma...
fe760738-032e-49fa-9697-5e0f17fddf3a
2
public void cargarArchivo(){ try { FileInputStream fileIn = new FileInputStream("configurations.txt"); ObjectInputStream in = new ObjectInputStream(fileIn); ArrayList<Configuracion> confi; confi = (ArrayList<Configuracion>) in.readObject(); if(confi...
80211266-cc72-4848-b21f-4bf6c0f14ba1
8
@EventHandler public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) { if (HyperPVP.isCycling()) { event.setCancelled(true); } if (!HyperPVP.hasMatchBeenAnnounced()) { event.setCancelled(true); return; } for (Region region : HyperPVP.getMap().getRegions(RegionType.TEAM)) { if (region.h...
5ce9e268-11e0-40e3-b9eb-296240481541
8
private void updateResiduesComputedMenu(String group3List, int[] group3Counts, boolean popup) { if (group3List == null || group3Counts == null) return; JMenu menu = popup ? residuesComputedMenu2 : residuesComputedMenu1; if (menu == null) return; for (int i = 0; i < menu.getItemCount(); i++) { proteinGr...
4caec596-8f1e-4227-addb-91eaf0635533
0
public void testByteIntConvert() { int expect = 8; byte[] bytes = ByteUtils.intToByteArray(expect); int i = ByteUtils.byteArrayToInt(bytes); assertEquals(expect, i); expect = -8; bytes = ByteUtils.intToByteArray(expect); i = ByteUtils.byteArrayToInt(bytes); assertEquals(expect, i); expect = -255; ...
f10dc676-b548-4736-ab13-09d906d9f07a
1
@Override public boolean hasNext() { if (first == null) return false; return !(current == null); }
00685a9f-5ea5-4903-90e9-fa2dc427bd7a
0
public Tile[][] getTiles() { return this.map; }
6c661387-623e-472f-acaf-68ddb69d28eb
3
public GestionarProducto(){ try{ //obtenemos el driver de para mysql Class.forName("org.gjt.mm.mysql.Driver"); //obtenemos la conexión connection = DriverManager.getConnection(url,login,password); } catch(SQLException e){ System.out.pri...
a0a579fe-3856-4f2f-89d5-f2b4a52d3d8b
8
@Override public void destroyTarget() throws Exception { Object arr[] = {this, target}; double rate = 3;// Math.random(); // generate random success if (target.isRunning()) { if (!target.isHidden()) { // if rate bigger than success rate it will destroy if (rate > War.SUCCESS_RATE) {...
0ba88729-15f1-45e2-951d-1b43eb771abb
4
private static char[] getQualityColumn (Alignment layoutMap, int index) { List<Read> reads = new ArrayList<Read>(); for (Read lay : layoutMap.values()) { if (lay.getOffset() <= index && index < lay.getOffset() + lay.getLength()) { reads.add(lay); } } char[] column = new char[reads.size()]; for (i...
d1c0e851-8e4f-4fec-9451-661a3b1f44b1
3
@SuppressWarnings("unchecked") @Get public ExeReport login() { String login = (String) getRequest().getAttributes().get("login"); String password = (String) getRequest().getAttributes().get("password"); EntityManager em = emf.createEntityManager(); List<Account> targets = null; String queryString = "sel...
ffda388d-35e4-43d4-839d-46101f424eb7
3
public static Utilisateur activerCompte(String url) throws RuntimeException { CourrielActivation c = CourrielActivationRepo.get().deLUrl(url); if (c == null) return null; EntityTransaction transaction = UtilisateurRepo.get().transaction(); try { transaction.begi...
e266a0e1-af23-4677-b958-97b9fbc5e22e
4
public static void main(String[] args) { InetAddress ip = null; Socket clientSocket = null; try { ip = InetAddress.getByName("localhost"); clientSocket = new Socket (ip, 1801); // поток для передачи векторов серверу BufferedWriter out = new Buffe...
ed59eceb-5bb7-485a-9b61-d014ffff0918
7
public byte[] getBlock(int address, int blockSize) { int offset = 0; for (int i = 0; i < offsetBits; i++) { offset |= address & (1 << i); } address >>= offsetBits; int index = 0; for (int i = 0; i < indexBits; i++) { index |= address & (1 << i); } address >>= indexBits; int tag = 0; for (int i...
a43f1a77-d3e9-4af2-aad6-5282ba344e15
2
public List<Integer> getClientIds() { synchronized(CONNECTION_LOCK) { List<Integer> clientIds = new ArrayList<Integer>(); for(Integer clientId: clients.keySet()) { if(clients.get(clientId) != null) clientIds.add(clientId); } return clientIds; } }
b37783f9-d969-42cb-87a1-acde5e0c260d
0
public int getInitialWidth() { return initialWidth; }
36cb3249-7a1f-4fc0-adea-89aff4b50319
6
public boolean sendCommand(String p_command) { int indexInit = p_command.indexOf("."); if (indexInit < 0) { return false; } String deviceName = p_command.substring(0, indexInit); String command = p_command.substring(indexInit + 1); if (deviceName.equals(this.name) && command.equalsIgnoreCase("GETPOS")) ...
f53cc457-91fa-44c3-a724-0c6f3e67d47b
1
public boolean getBoolean( String name ){ XAttribute attribute = getAttribute( name ); if( attribute == null ) throw new XException( "no attribute known with name: " + name ); return attribute.getBoolean(); }
09a1f099-6a3a-436a-8664-439c8c881392
1
public void visit_putstatic_nowb(final Instruction inst) { final Type type = ((MemberRef) inst.operand()).nameAndType().type(); stackHeight -= type.stackHeight(); if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
40d6c59d-684c-4b57-acad-15ffffb622b0
9
@EventHandler(priority = EventPriority.LOW) public void InventoryClick(InventoryClickEvent event) { if(!event.isCancelled()) { HumanEntity ent = event.getWhoClicked(); if(ent instanceof Player) { Inventory inv = event.getInventory(); if(inv instanceof AnvilInventory) { Inventory...
11c7200f-1aa4-4174-ba35-a358d33d3429
4
private void writeOutputMatrices() throws Exception { /* First read the original matrix dimensions */ BipartiteGraphInfo graphInfo = getGraphInfo(); int numLeft = graphInfo.getNumLeft(); int numRight = graphInfo.getNumRight(); VertexIdTranslate vertexIdTranslate = ...
b2a6d1a7-5da7-4831-8156-c8d59c8f5d39
5
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final StreamRolledBack other = (StreamRolledBack) obj; ...
a1214cc0-6cb3-4fbb-9fc4-8ef1d6404c40
6
public static String[] readSavedUsernames(File technicPath) { byte[] mcHash = null; String mcPass = ""; String mcUser = ""; String[] loginData = new String[2]; String[] dummyArray = { "", "", "" }; try { File lastLogin = technicPath; if (!lastLogin.exist...
5c4edc74-d2d9-4bcb-b544-fb616dc98135
7
private static void initMacApplicationInstance() { if(!isRunningOnMac()) return; //if we already have initialized these then just return if(macAdapterClass != null && macAppListenerInterface !=null && macAppEventClass != null && macAdapterInstance != null) { return; ...