method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2303909b-b120-40cd-a505-e677516331b7
5
public void makeBlack() { Tile activeTile; blackCheckers = new ArrayList<Checker>(); x_cord = 50; y_cord = 0; for(int i = 0; i < 12 ; i++) { blackCheckers.add(new Checker(Checkers.BLACK, x_cord, y_cord)); activeTile = getTile(x_cord, ...
8057a5af-1941-4827-afa0-306fc70ff203
9
public void consoleRunLoop() throws Exception{ currentGameState = GameState.xPlays; boolean shouldExit = false; while(!shouldExit){ System.out.println(currentGameState.toString()); System.out.println(gameBoard); if (currentGameState == GameState.xPlays || currentGameState == GameState.oPlays) { hand...
f28c0488-c9f8-4335-b2f7-492fd486450b
2
public void loadDefaultConfiguration() { InputStream resource = Game.class .getResourceAsStream("/default.cfg.xml"); ConfigLoader loader = new JAXBConfigLoader(resource); GameConfiguration conf = loader.load(); long dly = 100; if (conf != null) { if (sim != null) { dly = sim.getDelay(); sim.sto...
dd28fe37-8827-4eb2-bf44-c25a8eb8fd8d
9
public void actionPerformed(ActionEvent e){ if (e.getSource() == close){//タイトル画面へ //ボタンとテキストフィールドを取り除く remove(close); remove(regist); remove(send); remove(name); remove(com); sd.REGIST = false; setting();//初期設定 }else if (e.getSource() == regist){//登録画面へ remove(regist); add(send); ...
b2a0f591-0581-4793-9fa2-5c0a9f8ef3d3
0
@Override public void setError(boolean error) { this.error = error; }
37d98d5f-d23c-41ff-8f78-67c7b335aee7
6
@Override public void onEnable() { p = this; // Register common listeners getServer().getPluginManager().registerEvents(new CommonMobListener(), this); /* #### CONFIG #### */ getConfig(); // Initialize configuration for components boolean somethingEnabled = false; for (int i = 0; i < Componen...
739842f9-055a-4133-99e2-9e9ee4537cfc
8
@Override public Object getValueAt(int row, int col) { OrderRow fullOrder = m_orders.get( row); NewOrder order = fullOrder.m_order; switch( col) { case 0: return order.permId(); case 1: return order.clientId(); case 2: return order.orderId(); case 3: return order.account(); case 4: return o...
06fcf692-9f00-43f1-ad90-aee525e511f5
0
@Override public void execute(VirtualMachine vm) { vm.pushRunTimeStack(literalValue); }
d306fa2f-5a9e-4573-9b87-88922362e297
9
@Override public void finishPopulate() { double top = 0, btm = 0, left = 0, right = 0; if (getCoordinates() != null && getCoordinates().size() > 0) { top = getCoordinates().get(0).get(0).get(0).getLatitude(); btm = getCoordinates().get(0).get(0).get(0).getLatitude(); left = getCoordinates().get(0).get(0...
692b2534-c721-43fd-89aa-4a8c2f41a77d
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof UserMaster)) { return false; } UserMaster other = (UserMaster) object; if ((this.userID == null && other.userID...
9d023a52-b538-490d-ae2d-600bbaef46ed
0
public static void init(boolean fullScreen1) { fullScreen = fullScreen1; calcParam(); }
646e2fd8-a029-48cc-a9aa-163f12418ad4
0
public void setClientId(int clientId) { this.clientId = clientId; }
0a89a3f3-ae2a-40db-ac01-c207ecf4ff15
8
public void setOptions(String[] options) throws Exception { String optionString; resetOptions(); optionString = Utils.getOption('X',options); if (optionString.length() != 0) { m_CVFolds = Integer.parseInt(optionString); } m_useIBk = Utils.getFlag('I',options); m_displayRules = Uti...
50b303ac-6f4b-4f5f-bb3a-bf217207125a
7
protected void suspect(List<Address> suspects) { if(suspects == null || suspects.isEmpty()) return; num_suspect_events+=suspects.size(); final List<Address> eligible_mbrs=new ArrayList<>(); synchronized(this) { for(Address suspect: suspects) { su...
439ff5a9-3736-4b5e-8f93-2189ecbf1880
2
public void closeAllTabs() { while (privateChatTabs.size() > 0) removePrivateChatTab( privateChatTabs.get(0) ); while (channelTabs.size() > 0) removeChannelTab( channelTabs.get(0) ); connection.disconnect(); connection.removeServerEventsListener(); Setti...
0d3d2043-3899-4f0e-a0fa-167632960651
5
protected void createBufferImage() { if ((this.Added) && (getSize().width > 0) && (getSize().height > 0)) { if (this.GroundBufferGraphics != null) this.GroundBufferGraphics.dispose(); if (this.GroundBufferImage != null) { this.GroundBufferImage.flush(); } this.GroundBuf...
5ca0f5b2-a922-4ff8-9cf2-ad0c7caa7509
2
@Override public EntidadBancaria read(Integer idEntidadBancaria) throws SQLException { Connection connection = connectionFactory.getConnection(); EntidadBancaria entidadBancaria; String selectSQL = "SELECT * FROM entidadBancaria WHERE idEntidad = ?"; PreparedStatement preparedStat...
5213091d-b1ee-4453-b788-3c9cbdefb279
4
@Override public void mousePressed(MouseEvent mouse) { try { Tool tool = controls.getTool(); noClick = false; begin = graph.getVertex(mouseGetX(mouse), mouseGetY(mouse)); xlast = mouseGetX(mouse); ylast = mouseGetY(mouse); preClickX = m...
a8b5b3fb-af2f-42ac-8511-1b10d9e51519
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
83e6c7b4-eef3-4dc3-bfa4-2f2351ff695b
4
public com.novativa.www.ws.streamsterapi.Desk[] getDesks() throws java.rmi.RemoteException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.setOperation(_operations[4]); _c...
224af5ba-1d42-4087-a110-f99154b65004
9
private void parseLocation(JSONObject data) { if (myParent.verbose) System.out.println("CosmParser: parseLocation()"); JSONObject location = data.getJSONObject("location"); @SuppressWarnings("static-access") String[] rows = location.getNames(location); for (int i = 0; i < rows.length; i++) { String row ...
fb315857-de43-4db0-94ef-0cfbf176d426
3
public void addFieldListener(Identifier ident) { if (ident == null) throw new NullPointerException(); if (fieldListeners == null) fieldListeners = new HashSet(); if (!fieldListeners.contains(ident)) fieldListeners.add(ident); }
3fc922af-47b9-4795-a8f6-59989dbc9683
1
public void test_wordBased_ja_checkRedundantSeparator() { try { // Spaces are not valid separators in Japanese PeriodFormat.wordBased(JA).parsePeriod("2\u65E5 "); fail("No exception was caught"); } catch (Exception e) { assertEquals(IllegalArgumentExceptio...
fbc48152-9371-4728-bece-dc5268cf48cd
1
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
fd9a91f8-e460-4a6a-8b24-28c7154d1bb4
2
@EventHandler public void onEntityTarget(EntityTargetEvent event) { if (event.getEntity() instanceof Player) { if (HyperPVP.getSpectators().contains(((Player)event.getEntity()).getName())) { event.setCancelled(true); return; } } }
abcc11ea-2d90-4c1d-87d9-9e24e840b628
3
public boolean isInRectangle(int x, int y, int width, int height) { return super.getIntX() >= x && super.getIntY() >= y && Math.abs(super.getIntX() - x) <= width && Math.abs(super.getIntY() - y) <= height; }
bcc1b611-b44d-4a9f-bec5-92be59b00751
8
private boolean pushInsert(T e) { int code=e.hashCode(); int hash =hash(code); int hash2 = hash2(code); int hash3 =hash3(code); hash =hash & mask; hash2 =hash2 & mask; hash3 =hash3 & mask; while (true) { for (int i =0; i < size; i++) { if (table[hash] == null) { table[hash] =e; // Syste...
ead00872-4c2f-4ad4-a4d8-a5403b483767
7
@Override public ArrayList<Task> loadTasks() { LocalDateTime now = DateTime.now().toLocalDateTime(); if (isStorageExists()) { try { YamlReader rd = new YamlReader(new FileReader(storagePath)); Task t; while ((t = (Task) rd.read())!=null) { storage.add(t); } } catch (IOException e) { ...
5ab38138-301e-4238-a258-763536665a36
7
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (URL != null ? URL.hashCode() : 0); result = 31 * result + (domainName != null ? domainName.hashCode() : 0); result = 31 * result + (pageTitle != null ? pageTitle.hashCode() : 0); ...
d5a9527f-0d08-40aa-aa1f-39f4fe550590
9
private void formScreen(String action, Connection database, HttpSession session, HttpServletRequest request, PrintWriter webPageOutput) { int changeLog=0; int bugNew=0; String changeText=""; Routines.tableStart(false,webPageOutput); boolean newEntry=false; if("Change Entry".equ...
ad9d9db0-31c4-44c1-af28-21cb347f244d
4
public void destroy() { // kill game thread el.is_exited=true; // applets cannot interrupt threads; their threads will // be destroyed for them (not always, though ...). if (thread!=null) { if (!i_am_applet) thread.interrupt(); try { thread.join(2000); // give up after 2 sec } catch (Interrupted...
f856ba40-1fa5-48a4-905d-4607bcfe0e24
8
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
7038889a-2bdf-4634-9f98-49d4396992d9
7
private boolean fillBuffer(int minimum) throws IOException { char[] buffer = this.buffer; lineStart -= pos; if (limit != pos) { limit -= pos; System.arraycopy(buffer, pos, buffer, 0, limit); } else { limit = 0; } pos = 0; int total; while ((total = in.read(buffer, limi...
3733d102-41b6-45d6-8e92-e22632aad128
3
public Integer getSkip(Object[] args) { if (skipIndex == -1) { return skip; } Object arg = args[skipIndex]; if (arg == null) { return null; } else if (arg instanceof Integer) { return (Integer) arg; } else { return null; } }
9a0809fa-3aa5-481c-8ad3-0798aec55789
5
public void sendFilteredData(float[] data, float groupDelay) { //CurrentDataObjectSet.getCurrentDataObjectSet().forceUpdate(); //0-torque, 1-tension, 2-cable_speed, 3-cable_angle, 4-cable_out //System.out.println("GSGS-" + String.valueOf(groupDelay)); //System.out.println("RTRT-" + S...
915a3c95-708f-41e4-a409-7199b2747d9b
2
public static String GetJsonToString(Statement statement,double lon,double lat,String city) { List<ParkClass> parkList = new ArrayList(); String resultString = null; String sql; String result = null; sql = "select * from Park where city = '"+city+"'"; try { ResultSet rs = statement.executeQuery(sql);...
1e7d1920-465e-473a-84d2-1c7cbc93d77b
9
private void logInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logInBtnActionPerformed try { String username = usernameTxt.getText(); String password = passTxt.getText(); ResultSet loginResults = null; S...
73f9ef4d-9e3c-4043-a4b3-d0352c3c7dc5
6
public static String hashRequest(String url, Map<String, String> query_arguments, ArrayList<String> indices) { StringBuilder completeQuery = new StringBuilder(url); completeQuery.append("?"); if (!indices.isEmpty() || (indices == null && query_arguments != null)) { ArrayList<String> actualIndices; if (in...
862bbe1d-980f-403f-9166-85097433d523
4
private void _log(int levelValue, PrintStream stream, Object object, Throwable throwable) { if (levelValue >= levels.getLevelValue(name)) { String msg; if (object instanceof Throwable && throwable == null) throwable = (Throwable) object; msg = object.toString(); ...
d9f6d3e2-d849-4b2a-a992-6d0dda78f7ee
8
private void registerjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registerjButtonActionPerformed // TODO add your handling code here: if(companyNamejTextField.getText().length() == 0 || cityjTextField.getText().length() == 0 || adrLine1jT...
da994e72-c93b-4e7d-afc9-1453650ac5c7
2
public String getFieldrefType(int index) { FieldrefInfo f = (FieldrefInfo)getItem(index); if (f == null) return null; else { NameAndTypeInfo n = (NameAndTypeInfo)getItem(f.nameAndTypeIndex); if(n == null) return null; else ...
dcc4fdd0-3f89-4e28-97a3-2077824d9fe8
7
private void drawSpine(int[][] currentBlockArray, String group, int paintRadius, int currentDirection, int x, int z, int minX, int maxX, int minZ, int maxZ) { if(x > minX && x < maxX && z > minZ && z < maxZ) { if(paintRadius != 0 && gound[x] > z + paintRadius + 10) { int directionOff...
cb81e75e-7156-4a8d-9833-2984b1c77a7e
4
static void move() { if (isForced) { if (!Moves.isLegal(theMove)) { System.out.println("Go home! You're drunk"); } else if (Moves.isInTurn()) { System.out.println("move " + theMove); } } else { //theMove = Moves.computeMove(...
cacb8e6e-b8d1-406a-8910-a0965b8d085b
7
public static void delete(File file) throws IOException { if(file.isDirectory()){ System.out.println("Deleting directory " + file.getAbsolutePath()); //directory is empty, then delete it if(file.list().length==0){ if (file.delete()) ...
531445bb-2726-466b-b1ca-7373fe62144f
6
@Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (columnIndex < 0 || columnIndex >= COL_NAMES.length || rowIndex < 0 || rowIndex >= propNames.length) { return; } if (columnIndex == 0) { return; } if (columnIndex == 1) { props.put(propNames[rowIndex], aValue);...
3c04aa52-889a-4f31-8141-63abd4670179
0
public void setFacebookRsvpUrl(String facebookRsvpUrl) { this.facebookRsvpUrl = facebookRsvpUrl; }
36a30dd2-7c29-450d-b37a-71f2f5a31a0f
0
public static void main(String[] args) { new Sandwich(); }
e777b9b1-116a-41c9-bc34-10ab82b9384f
9
public void process(Context c, Sentence s) { Intervals clauses = new Intervals(); int low = Integer.MAX_VALUE; int high = Integer.MIN_VALUE; boolean hasVerb = false; for (Peek3Iterator<Interval> it = peek3(s.get(Features.PHRASES)); it.hasNext();) { Interval phrase = it.next(); low = Math.min(phrase.low(...
96fc9bc8-6ac4-4bd0-ab54-ebe3e1174da9
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TailContents<?> other = TailContents.class.cast(obj); if (contents == null) { if (other.contents != null) return false; } else if (!cont...
2947ffd6-e465-44ae-bad5-61d8e2d3fbca
1
@Override public PacketSyncPacket getSyncPacket() { List<Class<? extends APacket>> clazzList = new ArrayList<>(PList); return new PacketSyncPacket(clazzList); }
65070613-3076-44ef-9485-ba80603e608d
7
@Override public void run() { clientChannel = new SecureServerChannel(socket); // try { // out = new PrintWriter(socket.getOutputStream()); // in = new BufferedReader(new InputStreamReader(socket.getInputStream())); // } catch (IOException e) { // logger.error("Failed to bind input or output stream to ...
8ca8687b-d9d5-4585-a010-42a7f718009f
6
public static String extractArtistFrom(String filePath) /* * The extractArtistFrom method checks the ID3 version of the mp3 file and * extracts the artist's name from the MP3 file. */ { String artistName = null; try { Mp3File mp3File = new Mp3File(filePath); if (mp3File.hasId3v2Tag()) { ...
6bb1a9b6-a2ea-4893-8e22-5e94c6b2228b
7
private void init() throws LWJGLException { Log.setPrintToStdout(true); if (args.length == 0) { System.out.println("Args: folder/model.obj\n" + "SpriteGen operates in .spritegen folder.\n" + "There is a folder \".spritegen/models\", which contains subfolders with your models.\n" + "\n" + "S...
fc5c0418-aeae-4d1b-9164-2b3e6ef482a6
3
public void formHotelList(SessionRequestContent request) throws ServletLogicException { Criteria criteria = new Criteria(); criteria.addParam(DAO_ID_CITY, request.getAttribute(JSP_ID_CITY)); User user = (User) request.getSessionAttribute(JSP_USER); if (user != null) { criteri...
360defc4-04fc-402a-8cbd-bf1e4b2263e9
3
public boolean isAccepted() { Iterator it = myConfigurations.iterator(); while (it.hasNext()) { FSAConfiguration configuration = (FSAConfiguration) it.next(); State currentState = configuration.getCurrentState(); if (configuration.getUnprocessedInput().equals("") && myAutomaton.isFinalState(currentSta...
592f63d7-4ba3-4ff1-b360-772567d112e0
6
public Object call(int objectid, int methodid, Object[] args) throws RemoteException { boolean result; Object rvalue; String errmsg; try { /* This method establishes a raw tcp connection for sending * a POST message. Thus the object cannot communica...
815446ae-8f00-41ba-ad71-6dfb60cd23bb
1
@Override public int uniqueWordsCount() { Set<String> uniqueWords = new HashSet<String>(); for(String entry : internalStorage) { uniqueWords.add(entry); } return uniqueWords.size(); }
0b64d2dd-8248-48c7-8949-e4a7224b9b1e
3
public static boolean buscarBinarioNumero(float dato) { int inicio = 0; int fin = vector1.length - 1; int actual; while (inicio <= fin) { actual = (inicio + fin) / 2; if (vector1[actual].getNumeroDeTarjeta() == dato) return true; else if (vector1[actual].getNumeroDeTarjeta() < ...
2a3c1519-344a-4052-921e-814b577a97e9
2
public Boolean eachTeamHasOnePlayer(String matchName){ for(String teamName: TEAM_NAMES){ if(getNumberOfTeamPlayers(teamName, matchName) < 1){ return false; } } return true; }
9451327f-16c5-4f31-bbd5-403edde2af63
0
public Tool getTool() {return tool;}
c17eb684-e73d-4f40-9aa9-685b3238651d
1
public void BatimentToFarm(List<Batiment> batiments){ for(Batiment batiment:batiments){ batiment.setFarm(this); } this.batiments=batiments; }
e91e3ff0-4879-4224-be8a-0a7155d8cc8f
1
public Post save(Post post) { try { entityManager.beginTransaction(); dao.save(post); entityManager.commit(); } catch (Exception e) { e.printStackTrace(); entityManager.rollBack(); } return post; }
ff34a67e-3434-4bb0-b4da-a96e8b338ebe
5
private FileSystem() throws IOException { if (image.createNewFile()) { byte[] rootBytes = Descriptor.getRoot().toBytes(); FileOutputStream fos = new FileOutputStream(image); fos.write(rootBytes); fos.write(new byte[blockOffset - Descriptor.size]); fos....
ca6ab21a-178e-4b92-8d01-edfe1a277f2d
8
@Override public void deserialize(Buffer buf) { subAreaId = buf.readShort(); if (subAreaId < 0) throw new RuntimeException("Forbidden value on subAreaId = " + subAreaId + ", it doesn't respect the following condition : subAreaId < 0"); mapId = buf.readInt(); if (mapId < 0...
6fd5dc44-7125-421d-afd3-32557ebff4ec
1
public static void main(String[] args) { Simulador s = null; int turnos = 0; try { turnos = Integer.parseInt(args[1]); } catch(Exception e) { e.printStackTrace(); } s = new Simulador(); s.Faz_Tudo(args[0], turnos); }
d9e201fc-26d3-43dc-b689-91438fd5178a
0
public Date getDatetime() { return datetime; }
2e48b9b3-c4db-4923-9012-1ac04bc73e83
4
@Override public void actionPerformed(ActionEvent ae) { try { String op = ae.getActionCommand(); switch(op){ case "Assinar": this.assinar(); s.dispose(); JOptionPane.showMessageDialog(null, "Arqu...
cdf8b010-aacc-4e7b-a627-37aeac9daa86
9
public void addToPollingScheme(String objectName, String pollingScheme) { String objectPath; Document doc; if (browseFolder.isRootFolder()) { objectPath = browseFolder.getPath() + objectName; } else { objectPath = browseFolder.getPath() + "/" + objectName; ...
71582ea8-5b54-4c5d-9048-d8d83d0f07d8
2
public boolean kolmeSamaa(){ for(int i=0; i<3; i++){ if(nopat[i].getValue()==nopat[i+2].getValue()){ return true; } } return false; }
578f5c06-77d1-496e-9e29-e00f5d5739b8
7
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == btnViewAppointmentCalendar) { //GOTO view appointment calendar ViewAppointmentCalendarPanel vacp = new ViewAppointmentCalendarPanel(parent, username); parent.getContentPane().add(vacp); CardLayout cl = (CardLayout) parent.ge...
2ec12039-451b-41eb-91cf-3b4bacd7464e
2
public synchronized T take() { while (first == null) { try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } T taken = first.val; first = first.next; return taken; }
fea41606-4a76-417c-9f10-202285540e94
8
public void reloadMenus() { // Load in blacklisted and whitelisted commands from config commandBlacklist.clear(); commandWhitelist.clear(); for (String commandName : getConfig().getStringList("blacklist-commands")) { if (commandName.startsWith("/")) { commandN...
d1f9d1c7-c1c2-498b-8094-bfbeafc092dd
7
public static Cons combineAxiomLists(Cons oldaxioms, Stella_Object newaxioms) { if (oldaxioms == null) { oldaxioms = Stella.NIL; } if (newaxioms == null) { newaxioms = Stella.NIL; } { Cons normalizednewaxioms = Stella.NIL; if (Stella_Object.safePrimaryType(newaxioms) == Logic.SGT_...
40690ad8-e411-4d41-bfd5-c0ea016928ef
3
public boolean equals(final Object value) { if (value == this) { return true; } else if (value instanceof BasicValue) { if (type == null) { return ((BasicValue) value).type == null; } else { return type.equals(((BasicValue) value).type)...
c33a5962-6262-4ea6-9a4f-34cc2027b4e7
7
public static void setup() { Plugin test = Bukkit.getServer().getPluginManager().getPlugin("dynmap"); if (test == null || !test.isEnabled()) return; api = (DynmapAPI)test; // make sure DynMap version is new enough to include circular markers try { Class.forName("org.dynmap.markers.CircleMarker"); ...
f235cf7a-b86a-4500-b23d-e6e2e913ba95
0
public void setTotalSize(long totalSize) { this.totalSize = totalSize; }
4c2a7249-5e37-4bc5-ad95-467a979f3b63
9
public void pshs() { int t=IMMBYTE(); if(( t&0x80 )!=0) { PUSHWORD(m6809.pc); m6809_ICount[0]-= 2; } if(( t&0x40 )!=0) { PUSHWORD(m6809.u); m6809_ICount[0]-= 2; } if(( t&0x20 )!=0) { PUSHWORD(m6809.y); m6809_ICount[0]-= 2; } if(( t&0x10 )!=0) { PUSHWORD(m6809.x); m6809_ICount[0]-= 2;...
a82e2468-4de9-4440-923f-cc67bf6bffe1
7
* @param colony The <code>Colony</code> to capture. * @param random A pseudo-random number source. * @param cs The <code>ChangeSet</code> to update. */ private void csCaptureColony(Unit attacker, Colony colony, Random random, ChangeSet cs) { Game game = attack...
0b7e3616-ae19-4e9b-9171-f3f679fe488d
8
private static int ProblemTwentyThree() { int answer = 0; ArrayList<Integer> listOfAbundants= new ArrayList<Integer>(); ArrayList<Integer> listOfSumOfAllAbundants= new ArrayList<Integer>(); //make an arraylist of all abundant numbers between 1 and 28123 inclusive for (int i = 1; i < 28124; i++){ if (isA...
2e04af05-f94a-456f-9fad-67039ac52dd1
5
public void initialplayer() { int nb_players = 0; while(true){ try { System.out.println("How many players want to play ?"); sc = new Scanner (System.in); nb_players = Integer.parseInt(sc.nextLine()); if (nb_players < 1 || nb_players > 20) throw new NumberFormatException(); break; } catch(N...
76ab7163-be4a-4b76-98f3-2c579471d44a
0
public List findBySno(Object sno) { return findByProperty(SNO, sno); }
104f8804-e96c-4a5b-b938-3473138d86d1
4
public void appendBlock(StructuredBlock block, int length) { SlotSet succIn = new SlotSet(); SlotSet succKill = new SlotSet(); VariableSet succGen = new VariableSet(); block.fillInGenSet(succIn, succKill); succGen.addAll(succKill); if (this.block == null) { this.block = block; lastModified = block; ...
2f3ff53f-1bdc-4a93-a09b-977ca0f603f0
9
static private Material getType(String str) { // By ID try { Material mat = Material.getMaterial(Integer.parseInt(str)); if (mat != null && mat.isBlock()) return mat; } catch (Exception ex) {} // By Name Material[] types = getTypes(); for (int i = 0; i < types.length; i++) { if (types[i].name()....
93aecd0f-212e-46aa-93a9-10628b5fbad6
1
public void addQuizRating(double rating) { raterNumber++; totalRating += rating; try { String statement = new String("UPDATE " + DBTable + " SET " + "raternumber=raternumber+1, rating=rating+?" + " WHERE qid=?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setDou...
aad5bbc3-ebe6-4470-a1e1-7a585c82f7b4
1
public void addLineNumberEntry(final Label label, final int lineNumber) { if (this.isDeleted) { final String s = "Cannot change a field once it has been marked " + "for deletion"; throw new IllegalStateException(s); } lineNumbers.add(new LineNumberEntry(label, lineNumber)); this.setDirty(true); }
d1cdd3c3-2806-471c-b4c6-2055daae03da
9
public ArrayList<ArrayList<String>> partition(String s) { // Note: The Solution object is instantiated only once and is reused by each test case. if(s==null || s.length()==0) return new ArrayList<ArrayList<String>>(); int n = s.length(); boolean[][] dp = new boolean[n][n]; ...
b21143e0-2709-42e7-86aa-aa815d989f35
0
public boolean inDiagonalPathWith(Field otherField) { return Math.abs(this.distanceBetweenRank(otherField)) == Math.abs(this.distanceBetweenFile(otherField)); }
69598d7e-9a5d-4a43-adea-b31b322cc75d
9
public float getOffencePower(FreeColGameObject attacker, FreeColGameObject defender) { float result = 0.0f; if (attacker == null) { throw new IllegalStateException("Null attacker"); } else if (combatIsAttackMeasurement(attacker, defender) ...
d8c85933-7d42-4557-9ca6-3dda52eae68b
0
public String getLabel() { return myLabel; }
99c3d3e5-6774-43a0-bc94-e31b8d95d487
6
public static File downloadFile(URL url, File output) { BufferedInputStream in = null; BufferedOutputStream bout = null; try { in = new BufferedInputStream(url.openStream()); FileOutputStream fos = new FileOutputStream(output); bout = new BufferedOutputStream(...
37c085fa-f12a-4759-a3df-5e048ec72728
2
public MapView getCommandMap() { MapView map = null; Short mapId = (short) getData().optInt(COMMAND_MAP_ID); if (mapId == null) { map = Bukkit.getServer().createMap(Bukkit.getServer().getWorlds().get(0)); getData().put(COMMAND_MAP_ID, map.getId()); } else { ...
95200233-eeac-462c-abd7-8040335130f8
7
private boolean isTheFirstInTheMiddleOfRemains(Point intersectionPoint, Point lensPoint1, Point lensPoint2) { return (lensPoint1.getX() <= intersectionPoint.getX() && intersectionPoint.getX() <= lensPoint2.getX() || lensPoint2.getX() <= intersectionPoint.getX() && intersectionPoint.getX() <= len...
08021bb6-a677-4042-b490-eb7ce393876e
3
public static void updateBorne(Borne borne) { PreparedStatement stat; try { stat = ConnexionDB.getConnection().prepareStatement("select * from borne where id_borne=?",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); stat.setInt(1, borne.getId_borne()); ...
d3df0c64-a7a0-4623-9edb-54f844e2b44a
0
@Override public void openChatView() { chatGui.setVisible(true); trayView.setChatGuiMinimizedToTray(false); }
327a83d6-3614-4d60-8fef-a43a2f8886d7
3
public void debugMouse(Graphics g) { if (Constants.DEBUG_MOUSE) { if (instance.mouseX != -1 && instance.mouseY != -1) { g.setColor(new Color(0, 255, 255)); int x = instance.mouseX; int y = instance.mouseY; g.drawLine(x, 0, x, instance.getCanvasHeight()); g.drawLine(0, y, instance.getCanvasWidth...
e80f29a1-587a-463c-add3-bb36c5a88793
6
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String action = request.getParameter("act"); if(action != null) { try { RequestContext context = new RequestContext(request); if(context.isAdmin()...
20345fce-ed27-4c0a-8f43-f38da99b5b6f
2
private void replaceContent(SVGOMTextElement text, SVGTSpanElement[] lines) { float fontSize = text.getSVGContext().getFontSize(); removeAllChildren(text); for (SVGTSpanElement line : lines) { line.setAttribute("x", text.getAttribute("x")); if(text.hasChildNodes()){ line.setAttribute("dy", fontSize+"px"...
9c6e0433-cbc5-4397-8ed8-a44ad124efdc
2
public void visitOuterClass(String owner, String name, String desc) { super.visitOuterClass(remapper.mapType(owner), name == null ? null : remapper.mapMethodName(owner, name, desc), desc == null ? null : remapper.mapMethodDesc(desc)); }
0470fce3-82b4-43b0-82ef-311bd1a03578
4
public FieldInfo findField(String name, String typeSig) { if ((status & FIELDS) == 0) loadInfo(FIELDS); for (int i = 0; i < fields.length; i++) if (fields[i].getName().equals(name) && fields[i].getType().equals(typeSig)) return fields[i]; return null; }
bf9e209f-c34d-4579-9133-01527fc71d22
8
private void pickWanderLocation(){ if(spawner == null) return; int sx = spawner.getX(); int sy = spawner.getY(); if(x == targetX && y == targetY){ targetX = 0; targetY = 0; moving = false; } int tries = 0; while(true){ tries++; if(tries >= 50) break; targetX = (x / 32) + random.nextInt...