method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b8b5a8e3-c61c-435f-8b38-de0b5a111f5c
0
public void setDaytime(Daytime daytime) { this.daytime = daytime; }
a6194ab9-8b90-4120-80f0-d88e457ddb5f
7
protected void processItem(ResultSet rs) throws SQLException, IOException { int cmcId = rs.getInt("p_page_id"); String url = null; String text = null; String title = rs.getString("p_title"); String content = rs.getString("p_content"); log.info("Parsing item: " + cmcId); // Need to...
697a8421-9db1-483a-b046-c53cfaab7954
7
public void actionPerformed(ActionEvent event) { Object target = event.getSource(); if (target == fJoinButton || target == fDeleteButton || target == fRoomName) { if (fRoomName.getText().length() > 0) { setVisible(false); if (fJoinButton != null) ...
201f7a67-83c2-4712-a3fe-48aeb447cc29
3
void attackPlaceDiagonallyAboveRight(int position, char[] boardElements, int dimension, int attackPlacesOnTheRight) { int positionRightAbove = 1; while (attackPlacesOnTheRight > 0) { if (isPossibleToPlaceDiagRightAbove(position, dimension, positionRightAbove) && isBoardE...
41e74b2e-fc8f-44d1-ab48-e6978c99b6a8
7
public void pollInput() { if (Mouse.isButtonDown(0)) { int x = Mouse.getX(); int y = Mouse.getY(); System.out.println("MOUSE DOWN @ X: " + x + " Y: " + y); } if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) { System.out.println("SPACE KEY IS DOWN"); } whil...
db14d44c-33fe-4797-8e6d-900ddc169601
1
private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_4(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } }
afe15316-a511-498b-bd8c-a93b4371314c
8
@EventHandler public void onPlayerInteract(PlayerInteractEvent e){ Player player = e.getPlayer(); File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml"); FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language); String name1 = U...
38521a26-88bb-4bf2-aabc-08c7b9db8ec8
0
public Cluster getCluster() { return cluster; }
811d3f9f-ce98-4352-a48f-329334c1b1b4
7
private void updatePlayerList(Stream stream, int len) { while (stream.bitOffset + 10 < len * 8) { int j = stream.getBits(11); if (j == 2047) { break; } if (localPlayers[j] == null) { localPlayers[j] = new Player(); i...
17506b57-a2b3-4010-bef2-59627d54e16d
4
static protected void FillBuff() throws java.io.IOException { int i; if (maxNextCharInd == 4096) maxNextCharInd = nextCharInd = 0; try { if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) { inputStream....
d7e21296-bcc8-4feb-881b-96d4edb04fbf
2
private int compareFloat(float float1, float float2) { if (float1 > float2) return 1; if (float2 > float1) return -1; return 0; }
a2fa9c49-461c-4723-afb3-1d25196118d2
3
public static ServiceDirectory mapToServiceDirectory(String json) { try { return mapper.readValue(json, ServiceDirectory.class); } catch (JsonParseException e) { } catch (JsonMappingException e) { } catch (IOException e) { } return null; }
0cf92c42-96eb-414d-92e1-f40435747691
8
public void executeAction(ActionListener listener, Object source, String actionCommand) { // create event ActionEvent evt = new ActionEvent(source, ActionEvent.ACTION_PERFORMED, actionCommand); // don't do anything if the action is a wrapper // (like EditAction.Wrapper) if(listener instanceof Wrappe...
1fde38ec-5f69-496b-967c-a484eba09abd
0
@Override public void keyReleased(KeyEvent event) { }
9a5964f3-7c88-47c5-abd0-ef15cf3bf2e8
6
@Override protected void acquireWriteLock() throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { if (readOnly) { // NOTE: we should not reach this code w/ the core // IndexReader classes; however, an external subclass // of IndexReader could reach this. ...
ad3c34d2-6ec4-4e74-b411-6c95cf857481
6
private final void setButtonPositions() { if (orientation == HORIZONTAL) { double cumulativeWidth = borderSize; for (int i = 0; i < tButtons.size(); i++) { TButton b = tButtons.get(i); b.setX(cumulativeWidth - (usingScrollBar ? scrollModifier : 0)); cumulativeWi...
7284038c-0edb-4e86-ba67-6ba23211ef06
1
@Override public int compare(Entity a, Entity b) { return ((a.y > b.y) ? 1 : 0); }
a5838a7f-501d-473a-8ea8-14f246abf63b
3
public boolean testHeroMove( Tester t ) { Hero hero0 = new Hero( new Posn( 100, 100 ) ); Hero heroUP = new Hero( new Posn( 100, 19 ), "images/uphero.png", true, 0 ); Hero heroRIGHT = new Hero( new Posn( 140, 100 ), "images/righthero.png", true, 0 ); Hero heroLEFT = new Hero( new Posn( 60, 100 ), "images/lefthero.p...
a07cd1c4-dda1-445a-8b06-542214370058
7
public static Condition load(final ConfigurationSection config, final Map<String, Integer> parameterIndexes) throws Exception { if (config == null) throw new IllegalArgumentException("ConfigurationSection cannot be NULL!"); final String type = config.getString("type"); if (type == null) throw new IllegalAr...
fc3ca954-72ca-4cca-80a5-500d5aa84559
3
public void setUp() { cs = new CourierSupervisor(); cs.addNewCourier("1"); for(int i = 0; i < 15; i++) { cs.incrementCarriedPickings("1"); } cs.addNewCourier("2"); for(int i = 0; i < 25; i++) { cs.incrementCarriedPickings("2"); } cs.addNewCourier("3"); for(int i = 0; i < 35; i++) { cs.increme...
039a2136-b609-4028-83dc-4d16a6e32c11
8
public void sendEvent(Event event) { if (disabled()) return; try { if (eventHandler != null) { final Method[] methods = eventHandler.getClass().getMethods(); for (final Method method : methods) { if (method.isAnnotationPresent(EventHandler.class) && method.getParameterTypes()[0] == event...
0a26bc51-68a8-4951-ab2d-436446b8b3bf
2
private void broadcast(String message) { for (SnakeMessageInbound connection : getConnections()) { try { CharBuffer buffer = CharBuffer.wrap(message); connection.getWsOutbound().writeTextMessage(buffer); } catch (IOException ignore) { // Ig...
c114e9d2-ae61-40e1-9e7d-32fcdabe9768
5
public String waitButtonClick() { while (true) { for (Widget i = wdg().child; i != null; i = i.next) { if (i instanceof Button) { Button b = (Button) i; if (b.isChanged()) return b.text.text; } } if (!JSB...
ea0ae7b6-3496-4b72-82fa-2bb1869d3cbb
2
private ArrayList<String> removeEmptyEntries(ArrayList<String> array) { // ArrayList to hold non-empty strings ArrayList<String> temporaryArray = new ArrayList<String>(); // Populates ArrayList for (String s : array) if (!s.equals("")) temporaryArray.add(s); ...
b707b0ea-c217-4c4d-9d45-a4f7a6bb9d55
3
public static String userClassToString(byte[] buf) { if (buf == null) { return null; } List list = userClassToList(buf); Iterator it = list.iterator(); StringBuffer s = new StringBuffer(); while (it.hasNext()) { s.append('"').appe...
88e91950-d295-401c-ac2d-aec330b47173
0
public static void createIcons() { // Get the colors to use Color c = Preferences.getPreferenceColor(Preferences.TEXTAREA_FOREGROUND_COLOR).cur; int hexColor = ((c.getRed() << 16) | (c.getGreen() << 8) | c.getBlue()); Color c2 = Preferences.getPreferenceColor(Preferences.TEXTAREA_BACKGROUND_COLOR).cur; int...
5fab390c-cf74-41a6-b3f9-39e85629ebff
8
public Tile getTile(int x, int y){ //position of tile //wouldn't a switch case be better? if (x < 0 || y < 0 || x >= this.width || y >= this.height){ return Tile.voidTile; } int tileID = tiles[x+y*width]; if (tileID == 0){ return Tile.grass; } else if (tileID == 1){ return Tile.flower; } else if ...
bf041ee2-5ad8-45f7-8c2c-bdfcdcde83ae
6
@Command(command = "sethome", arguments = {"target player[s]", "home name"}, description = "sets target player[s] home[s] to your current location", permissions = {"set.other"}, playerOnly = true) public static boolean setHome(CommandSender sender, String targetPlayer, String homeName) throws EssentialsCommand...
520addba-43e4-479e-a8f2-f7cb406dbc5e
0
public String getUserInfo() { return this.userInfo; }
21f50465-e65a-4694-a163-3eaf82720699
8
protected void layoutRow(IFigure parent) { int majorAdjustment = 0; int minorAdjustment = 0; int correctMajorAlignment = getMajorAlignment(); int correctMinorAlignment = getMinorAlignment(); majorAdjustment = data.area.width - data.rowWidth + getMinorSpacing(); switch (correctMajorAlignment) { case ALIG...
83436ae3-dded-469a-8eac-a79790bcc239
5
public static void communicate(SSLSocket socket) throws IOException{ Scanner read = new Scanner(System.in); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); try{ String msg; bo...
584dd602-1603-44af-b377-d27d0d97f2e5
8
public void dodgeAsteroid(){ //tries to avoid an asteroid before hitting it for(int b=0;b<objects.size();b++){ if(objects.get(b).kind!=0) continue; boolean obstacle = collisionCircle((int)(x+vx),(int)(y+vy),h/2+20,(int)(objects.get(b).x),(int)(objects.get(b).y),(...
76b3359f-32cd-4954-b76b-c810c88992ff
2
public void applyPassiveFruitEffects(Player p, Fruit f) { List<PotionEffect> pE = f.getPassiveEffects(); for (PotionEffect effect : p.getActivePotionEffects()) //Clear Effects p.removePotionEffect(effect.getType()); for(int i = 0; i < pE.size(); i++) { p.addPotionEffect(pE.get(i)); }...
a9d109b2-fa9a-413a-a9ca-c77db9084740
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); ...
b9776e93-2eae-45ae-b62a-b7e143fbbec5
8
public Matrix solve (Matrix B) { if (B.getRowDimension() != n) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } if (!isspd) { throw new RuntimeException("Matrix is not symmetric positive definite."); } // Copy right hand side. double[][]...
6b0cba08-1850-4833-8a03-f448133f37c6
1
public void testIsBefore_TOD() { Partial test1 = createHourMinPartial(); Partial test1a = createHourMinPartial(); assertEquals(false, test1.isBefore(test1a)); assertEquals(false, test1a.isBefore(test1)); assertEquals(false, test1.isBefore(test1)); assertEquals(false, test...
a8d533c2-3c9a-401c-acf0-889ca1af0cf2
2
@Override public boolean addGame(String name) { for (int i = 0; i < games.size(); i++) { if (games.get(i).getName() == name) { return false; } } Game game1 = new Game(); game1.setName(name); games.add(game1); return true; ...
e8fc8b04-e5c6-4742-93e9-dbe809a6070c
5
public boolean isCellEditable(int row, int col) { boolean result = false; if(isEnabled && col == 1 && (endEnabling == -1 || (row + startAddress >= startEnabling && row + startAddress <= endEnabling))) result = true; return result; }
28176891-b4b6-4903-986d-7f790d3438e4
2
public ChatMessage[] loadMessages(ChatChannel channel, Date joinDate){ ChatMessage[] chatMessages = null; try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); String url = "jdbc:derby:" + DBName; Connection connection = DriverManager.getConnection(url); Statement statement = connection.createSta...
c587c618-bfe4-46b4-8e76-090531642017
3
private static boolean startup() throws Exception { new FileCreator(System.getProperty("user.home") + File.separator + "Documents" + File.separator + "StreamAlive"); System.out.println(System.getProperty("user.home")+ File.separator+"Documents"); if (FileCreator.createDirectory() && FileCreator....
9fb9d04c-99f4-4204-89a1-3730055a567a
3
@EventHandler(priority = EventPriority.LOWEST) public void onPlayerPreLoginEvent(AsyncPlayerPreLoginEvent event) { try { // see if they're banned or not // query the database ArrayList<HashMap<String, Object>> results = DatabaseManager.accessQuery( "select * from banlogs where banee=? or banee=? ord...
3caa1c8b-2c6f-4fa3-9e6a-f6c2b91c9902
4
public boolean isValid() { if(x > -1 && x < 1000 && y > -1 && y < 1000) { return true; } return false; }
3e2f17fa-1373-40a5-8542-0286c644806a
3
@Override public void paint(Graphics g) { super.paint(g); if(histogram != null && histogram.size() > 0) { int ecart = histogram.size() / getWidth(); for(int i = 0; i < getWidth(); i++) { float x =((float)i*ecart / (float)histogram.size()) *getWidth(); double y = histogram.get(i*ecart)*getHeight(); ...
0dd3de91-194d-4f0c-8d15-099449980935
0
@Test public void itShouldSerialize() throws Exception { GeometryCollection gc = new GeometryCollection(); gc.add(new Point(100, 0)); gc.add(new LineString(new LngLatAlt(101, 0), new LngLatAlt(102, 1))); String expected = "{\"geometries\":[{\"coordinates\":[100.0,0.0],\"type\":\"Point\"}," + "{\"coordina...
35db56dd-4fd7-49f3-94e2-c38594c26205
2
public static void selectTab(JTabbedPane pane, String title) { int count = pane.getTabCount(); for (int i = 0; i < count; i++) { if (pane.getTitleAt(i).equals(title)) { pane.setSelectedIndex(i); break; } } }
e8c21bd3-c07c-4935-a573-4f59f157aae3
4
protected WorldSections(World world, int resolution) { this.world = world ; this.resolution = resolution ; this.depth = depthFor(world.size / resolution) ; this.hierarchy = new Section[depth][][] ; // // Next, we generate each level of the map, and initialise nodes for each- int gridSize = ...
c90a0d57-d9cc-46d9-bb4d-be32380b008c
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...
1eff9873-5eb2-45c7-8274-2960c17288a5
0
@Override public void attributesVisibilityChanged(OutlinerDocumentEvent e) {}
f5e557c9-f172-43d9-9695-5fcb77932882
4
public void fillStudentsTable() { familyService = FamilyService.getInstance(); List<Student> students = familyService.getStudents(); DefaultTableModel dtm = (DefaultTableModel) studentsTable.getModel(); for (int i = 0; i < dtm.getRowCount(); i++) { dtm.removeRow(i); } for (Student student : students) { ...
95b30b0f-51a2-457b-a383-0031378cf579
9
@Override public void render(Graphics2D g2d, int width, int height) { if(borderWidth > 0) { int c = borderColor; if(!enabled) { float[] hsb = Color.RGBtoHSB((borderColor>>16)&0xFF, (borderColor>>8)&0xFF, borderColor&0xFF, null); c = Color.HSBtoRGB(hsb[0], hsb[1]/2, Math.min(hsb[2]*1.2F, 1)); } ...
53fe89b6-28c7-406c-939f-eada3cf3baa0
6
@Override public boolean subscribeToBufferOutputPort(String portName, LockPolicy lockPolicy, Observer observer, int periodMs, int bufferSize) throws WrongPortTypeException{ OrocosDataPort port = getPort(portName); if(port.getPortType() == PortType.INPUT_PORT){ throw new WrongPortTypeException(port.getPortType()...
97a37e52-1ad6-42db-9e0b-d0cfc9f4b0bb
5
private String getCouleur(TypeMessage typeMessage) { String classeCSS = null; if(typeMessage == TypeMessage.ERREUR) classeCSS = "rouge"; else if(typeMessage == TypeMessage.NORMAL) classeCSS = "gris"; else if(typeMessage == TypeMessage.RETARD) ...
5b9d90f0-d241-4328-9d0a-ab4353a61e9a
8
private void buildFileMenu() { openItem = new JMenuItem("Abrir..."); openItem.setMnemonic(KeyEvent.VK_O); openItem.addActionListener(new OpenListener()); saveItem = new JMenuItem("Salvar"); saveItem.setMnemonic(KeyEvent.VK_S); saveItem.addActionListener(new SaveListener()); saveAsItem = new JMenuItem("...
842679ae-cef1-4a8d-a5d8-21a373b8a79d
8
@SuppressWarnings({ "rawtypes", "unchecked" }) public static void staticMerge(List<String> files, JZSequenceFile file, Comparator comparator) { final Comparator tempComparator = comparator; /* Input files */ List<JZSequenceFile> inFiles = new ArrayList<JZSequenceFile>(); /* Create the queue used to...
3fa496f3-4c3a-4ee0-87c7-fea731d3573b
2
@Override public String adiciona(HttpServletRequest request, HttpServletResponse response) { String email = request.getParameter("email"); System.out.println("Aqui " + email); String senha = request.getParameter("senha"); Usuario usuario = new UsuarioDAO().buscaPorEmailESenha(email, senha); if (usuar...
a252e1b7-d813-4c04-89cc-8fa322063a5d
1
@Override protected void logBindInfo(Method method) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("绑定" + getDescription() + "到方法[" + method + "]成功"); } }
972be2a8-60bb-4d98-bacb-5e0d4418da34
7
public static void setPieceOnBoard(char theCharacter, Point location, Board newBoard) { theCharacter-=baseValue;//get rid of the base value boolean isWhite = theCharacter/blackValue==0;//figure out whether it is black or not char type = (char) (theCharacter%6);//find what type of piece it is if(type==kingVa...
e9e5b44f-b4a9-4bd9-a3c1-90413923c1f0
1
public User saveUser(User user) { if (log.isDebugEnabled()) { log.debug("user's id: " + user.getUserId()); } getHibernateTemplate().saveOrUpdate(user); // necessary to throw a DataIntegrityViolation and catch it in UserManager getHibernateTemplate().flush(); r...
b842714e-a972-4a20-941b-0d1c26be4dd6
5
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RoomPersons other = (RoomPersons) obj; if (!Arrays.equals(childrenAges, other.childrenAges)) return false; if (numberOfAdults != other.numberOfAdults) ...
c3d9fa3d-985e-482a-bf1b-8d5da28d5f89
3
public void connect(TreeLinkNode root) { TreeLinkNode pre = root; TreeLinkNode cur ; while(pre.left != null){ cur = pre; while(cur != null){ cur.left.next = cur.right; if(cur.next != null) cur.right.next = cur.next.left; cur...
bba0740a-22e0-4edf-bb8f-90fd444b08bf
1
public Rank getSecondaryRank() { return (ranks.size() < 2 ? Rank.Null : ranks.get(1)); }
6811fcd4-1ff2-4e25-a507-e207eb97e164
9
public FloatElement[] getSortedSimilarWords(String word) throws Exception{ int index = model1.index(word); FloatElement[] similarWords = new FloatElement[model1.sizeOfVocabulary]; for (int i=0; i<model1.sizeOfVocabulary; i++){ float pmi1 = 0; float pmi2 = 0; float similarity = Float.NEGATIVE_IN...
10136c4d-d202-4d4e-888a-9a1b51a78c51
4
public int getUnsignedInt(int start, int offset) { if (start < 0 || stringData.length() < (start + offset)) return 0; int unsignedInt = 0; try { unsignedInt = Integer.parseInt( stringData.substring(start, start + offset), 16); } catch (...
94c2473d-4141-4c85-a8e9-c16fcd91350d
8
@Override public int run(String[] args) throws Exception { addInputOption(); addOutputOption(); addOption("rank", "k", "decomposition rank", true); addOption("oversampling", "p", "oversampling", String.valueOf(15)); addOption("blockHeight", "r", "Y block height (must be...
7b7d8f95-13a2-45c3-84c4-c21831209760
2
public void drawArrow(boolean ifTower){ if (ifTower){ addObject (pa, selectedTower.getX(), selectedTower.getY() - 20); pa.setMob (null); } else{ Enemy e = ui.getMob(); if (e.getHp() > 0){ pa.setMob (e); addObject (pa...
bd3b5ba2-632d-4961-948d-fb4d4681a52d
1
protected void updateTeleport() { teleport.extendDuration(1); if (teleport.isExpired()) { isTeleport = false; teleport.resetDuration(); } }
1ad1e82b-deea-4199-82ff-dabab4fe7a0a
2
void decorate(AbstractAxisChart chart) { chart.setTitle(title); chart.setSize(plotSizeX, plotSizeY); double gridx = (maxX - minX) / 10; double gridy = (maxY - minY) / 10; if( (gridx > 0) && (gridy > 0) ) chart.setGrid((maxX - minX) / 10, (maxY - minY) / 10, 3, 2); // Adding axis info to chart. chart.add...
27fb2cfe-a64d-46e7-b49f-b557274c79d3
5
public void generateProjectBoxModel() { List<Transfer> alltransfers = dao.getTransfers(" ", 0); List<String> projects = new ArrayList<String>(); boolean exists; DefaultComboBoxModel model = new DefaultComboBoxModel(); projects.clear(); for(Transfer temptransfer : alltransfers){ exists = false; f...
62ca991b-e04b-4652-a589-7bfc73220c1f
0
public static void main(String[] args) throws Exception { Car car = new Car(); ExecutorService exec = Executors.newCachedThreadPool(); exec.execute(new WaxOff(car)); exec.execute(new WaxOn(car)); TimeUnit.SECONDS.sleep(5); exec.shutdownNow(); }
3c7f109e-70d5-4331-af6c-24a2bd256726
0
public boolean hasForeignKey(String table, String column) throws SQLException { return (this.getForeignKey(table, column) != null); }
022771e5-1506-45cb-aabb-7e33def63136
0
@Override public void rotateZ(int angle) { base = DimensionalTrasform.rotateZ(angle, base); setColoredExes(); }
9ab4a647-66d7-4961-8649-d1164e34028c
8
final public void Class_variable_declaration() throws ParseException { /*@bgen(jjtree) Class_variable_declaration */ SimpleNode jjtn000 = new SimpleNode(JJTCLASS_VARIABLE_DECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1))...
bec8a23a-7cc6-4e16-b6a0-9c8d7b91fc15
1
public void sendChatMessage(String message) { Message<String> ready = new Message<>(); ready.setMessageType(eMessageType.chat); ready.setDataContainer(message); oponent.sendMessage(ready); // add message to gui if (gui != null) { gui.addChatMessage(message); ...
9647e180-4018-4aaf-a14a-78ef01274977
0
@Test public void testGetSumm() { System.out.println("getSumm"); assertEquals(12.0, new Cube(1,12,1.5).getSum(), 0.00001); }
3ba48bb0-db9b-4aea-bd20-9dd4475066cf
1
public String infoZLiens() { String s = "{"; for (Iterator<ZLien> e = elementsZLiens(); e.hasNext();) { ZLien lien = (ZLien) e.next(); s += "\n" + lien; } return s + "\n}"; }
41f8683c-a130-4ef7-9db7-32d04e06fe1d
7
@Override public void update(Observable obs, Object arg) { /*If the observable is a TimeManager, check if the bid is ended and change bidState * and notify users*/ if(obs instanceof TimeManager) { TimeManager timeManager = (TimeManager)obs; for (Bid bid : listBid) { if(timeManager.getSystemTime(...
3cc9c31d-3c15-4302-a2c5-986a84cbdd39
2
private static boolean inCircle(int x,int y,int x1,int y1){ long diffX=Math.abs(x1-x),diffY=Math.abs(y1-y); if( diffX>100001 || diffY> 100001){ return false; } return diffX*diffX+diffY*diffY<=INCLUDE_DISTANCE; }
be7da469-66a4-4707-b395-7a03a69a683d
1
public void RemoveStopMenuElement() { if (elementStop != null) { elementStop.RemoveFromMenu(); elementStop = null; } }
330a8ad2-087e-4c35-90a6-9876e013dd5e
4
private static int checkedAdd(int x, int y) { int z = x + y; if (y > 0 && z < x || y < 0 && z > x) throw new ArithmeticException("Arithmetic overflow"); else return z; }
f4675e83-a019-4353-94eb-80ed4e099519
3
protected static Element createElement(Document document, String tagname, Map attributes, String text) { // Create the new element. tagname = tagname.replaceAll("'", ""); tagname = tagname.replaceAll("&", ""); tagname = tagname.replaceAll("\"", ""); tagname = tagname.replaceAll("<",...
43aa5235-ecfc-48d0-8277-079c91924082
0
@Override public String toString() { return root.toString(); }
73d00126-b3ae-42bf-957e-40b4df8f8ed8
9
public Map<Literal, Map<ConclusionType, Conclusion>> transformConclusions( Map<ProvabilityLevel, Map<Literal, TreeMap<Temporal, ConclusionType>>> conclusions) { if (!AppConst.isDeploy) { StringBuilder sb = new StringBuilder(TextUtilities.generateHighLightedMessage("transformConclusions - origConclusions - start...
96abdc6b-e0e3-4662-b697-eeb42747f17b
8
@Override /** * This function removes a word from the Trie. * * @param obj Removes a String object from the Trie and correctly updates the ending * structure. The return value indicates that the object was removed successfully. */ public boolean remove(Object obj) { if(!(obj instanceof String)){ ret...
cb0d6e69-d0b1-4339-9d2e-9c6cee0e330d
5
public boolean equals(DoubleLinkedList other) { DoubleLinkedList clone1 = this.clone(); DoubleLinkedList clone2 = other.clone(); if (clone1.elements() != clone2.elements()) { return false; } else if (!isComparable(clone1.head.getVal(), clone2.head.getVal())) { return false; } else { while (clone1...
d02677e0-6a70-44f3-ad06-c88f2aeb4c07
2
@Override public String toString() { final StringBuffer buffer = new StringBuffer(); for (int i = 0; i < headers.length; i++) buffer.append(headers[i] + "\t"); buffer.append("\n"); for (final AcceptedOrder item : rows) { buffer.append(item.getId() + "\t"); buffer.append(item.getDateStamp() + "\t"); ...
965214a7-00f2-4091-aee6-c9c77a0bff4f
6
private void match() { if(firstClicked.returnImage() == secondClicked.returnImage()) { // The current player gets a higher score. players.addScore(numOfTurns); // Checks if the current player has succeeded in pairing cards // in a number of turns to be able to tell the player how many points // he/she ...
8d931258-e1e0-4e6d-b50b-bf8d99d79eb1
9
@Override public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); switch (key) { case KeyEvent.VK_A: case KeyEvent.VK_LEFT: //hack demoMode = false; moveManager.setNextMove(MovementManager.LEFT); break; ...
e0f307b9-ffaa-4200-9d5c-1393341e9a6f
0
public String getName() { return clientName; }
b926dec3-ceb6-4562-a76a-e0de670e9300
3
@Override public void prepareHandshakeResponse(NettyWebSocketConnection webSocketConnection) { webSocketConnection.setHybiWebSocketVersion(getHybiVersion()); if (getHybiVersion() < MIN_HYBI_VERSION) { res.setStatus(HttpResponseStatus.UPGRADE_REQUIRED); res.setHeader(SEC_WEBS...
7b7e5328-ebcb-41d0-9394-6594610be135
8
public static void main( String[] argv ) throws IOException { Scanner metaScanner = new Scanner( new File( argv[0] ) ); while ( !metaScanner.hasNextInt() ) metaScanner.next(); // skip forward to first int boolean[] validProducts = new boolean[metaScanner.nextInt()]; metaScanner.nex...
475d5810-5d76-4acc-875b-da1f27a10830
8
static final String method3561(int i, Widget class46, boolean bool) { anInt4495++; if (bool != true) method3560(68); if (!Client.method105(class46).method3301(i, !bool) && ((Widget) class46).anObjectArray741 == null) return null; if (((Widget) class46).aStringArray833 == null || ((((Widget) clas...
ee713698-8255-40ca-85e7-111aafae8354
4
private void PayloadHTTPSelectedComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PayloadHTTPSelectedComboBoxActionPerformed Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { if ((conn = this.JavaDBAccess.setConn()) != null) { Sy...
83c5cc26-8007-4f39-98ac-cd5547ebaa9a
9
Mon(Simulator sim) { SPH_watch = new SPWatch(); SPL_watch = new SPWatch(); SPProbe probe = new SPProbe(); // insert watches for SP registers MCUProperties props = sim.getMicrocontroller().getProperties(); simulator = sim; simulator.in...
6ad2f477-627b-4171-b06e-07b95ccc072a
8
private void keccakf() { long[] B = new long[25]; long[] C = new long[5]; long[] D = new long[5]; for (int n = 0; n < 24; n++) { for (int x = 0; x < 5; x++) { C[x] = A[index(x, 0)] ^ A[index(x, 1)] ^ A[index(x, 2)] ^ A[index(x, 3)] ^ A[index(x, 4)]; ...
a60acadf-4717-41ee-8e3b-632bec0c6ab4
0
public void setEWord(String s){ eWord = s; }
d7d76b6a-937a-4003-b6b4-f9298bcef4eb
2
public CriaConexao() { try { Socket socket = new Socket("127.0.0.1",6969); System.out.println("Cliente ligado!"); try (Scanner recebe = new Scanner(socket.getInputStream())) { System.out.println(recebe.nextLine()); } ...
7d7e60a3-0f45-43a8-8274-fb0ede2b8c41
1
public void eraseCourante() { Forme temp = courante.getForme(); int taille = temp.getPoints().length; int x, y; for (int i = 0; i < taille; i++) { x = getVecteur(i).get(0).intValue(); y = getVecteur(i).get(1).intValue(); plateau[x][y] = 0; } ...
3cfbe857-576a-4c2f-9bfa-df148096232b
4
private boolean read() { try { final URLConnection conn = this.url.openConnection(); conn.setConnectTimeout(5000); if (this.apiKey != null) { conn.addRequestProperty("X-API-Key", this.apiKey); } conn.addRequestProperty("User-Agent", Up...
f9242e9b-c48f-45d1-a606-25f024cc69b5
6
public static Cons getClassInstances(Stella_Object classref, boolean directP) { { Surrogate classtype = LoomApi.getInstanceSurrogate(classref); if (Logic.classP(classtype)) { if (directP) { { Cons instances = Logic.allClassInstances(classtype); Cons directinstances = Stella.NIL;...
2a76e942-81a5-4444-8c30-812b66054f5d
9
public void initialize(Object[] arguments) throws MaltChainedException { if (arguments.length != 2) { throw new FeatureException("Could not initialize MergeFeature: number of arguments are not correct. "); } if (!(arguments[0] instanceof FeatureFunction)) { throw new FeatureException("Could not initialize M...