method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f101eb18-520b-4507-9b57-0d183198689d
0
public List<CheckResultMessage> getMessageList() { return messageList; }
70c70105-eb25-4fdb-a666-5054ac486af1
5
private void generateCheck() { int cc = this.cornerCount; float radius = (float)Math.min(this.getPixelHeight(), this.getFO().getPixelHeight())/2.0f; float s = radius <= 10?Settings.get(SetKeys.GUI_CMP_BORDER_SIZE, Integer.class)/2:Settings.get(SetKeys.GUI_CMP_BORDER_SIZE, Integer.class); float alpha = U...
b658670a-09d7-4b77-a637-daf4a1eb49a6
6
public String largestNumber1(int[] nums) { String[] numbers = new String[nums.length]; for(int i = 0; i < nums.length; i++) { numbers[i] = String.valueOf(nums[i]); } Arrays.sort(numbers, new Comparator<String>() { public int compare(String o1, String o2) { String s1 = o2 + o1; String s2 = o1 + o2;...
431b07e6-eac4-476f-942b-9f71bfc740ec
3
protected ConfigurationSerializable deserializeViaCtor(Constructor<? extends ConfigurationSerializable> ctor, Map<String, Object> args) { try { return ctor.newInstance(args); } catch (Throwable ex) { Logger.getLogger(ConfigurationSerialization.class.getName()).log( ...
12ff0aab-000e-4dbd-b8d8-877e221df831
9
public int[][] getHandicap() { for (int i = 0; i < 20; i++) { for (int j = 0; j < 10; j++) { gameWorld[i][j] = 0; } } if (toggleHandicap) { switch (handicap) { case EASY: for (int i = 21; i > 19; i--) { ...
2b2eef15-5866-4ee1-a0b5-7243e7d56f4c
4
private int placeFinder(int ID, ArrayList<MatchObject> count) { int size = (count.size()-1); if (size == 0) { return 0; } else { try { for (int c = 0; c <= size; c++) { if ((count.get(...
39d8721e-09fe-474e-8707-018646ac87a4
7
@Override public void keyTyped(KeyEvent arg0) { switch (arg0.getKeyChar()) { case 'n': // next pressed System.out.println("Playing next move"); this.playNextMove(); break; case '+': System.out.println("Zooming in"); this.zoomIn(); this.refreshDisplay();; break; case '-': System.out.p...
7557ec94-9a79-4830-9176-b4ff2c5e6169
7
static public void main(String args[]) { Ellipsoid earth = new Ellipsoid(6378.137, 1.0 / 298.257222101); double lata, longa, latb, longb, ds; Double d; if (args.length < 4) { System.err .println("Usage: java TestEllipsoid longa lata longb latb [ds]"); System.exit(1); } d = new Double(args[0]);...
f73803a6-bc8d-4345-a9c3-8d16b7c6bc5e
8
public void setGenre(String genres) { genres = genres.substring(genres.indexOf("=") + 2); StringTokenizer st = new StringTokenizer(genres, ","); this.genres = new LinkedList<Genre>(); while (st.hasMoreTokens()) { try { String genre = st.nextToken(); ...
1a619d06-7e8a-48e3-8145-f7fddbe2c024
9
private int traverse(int[][] grid, int row, int col, int totalCol) { int loc = row * totalCol + col; Integer cachedSum = cache.get(loc); if (cachedSum != null) { return cachedSum; } else { int cell = grid[row][col]; if (row == grid.length - 1 && col ...
b05ea8db-9934-44b8-88b4-0553a0f39017
0
public String dostepnyFilm(){ Film filmDostepny = osobaWypFilm.getRowData(); ow.dostepnyFilm(pokazOsobe, filmDostepny); return null; }
9e2d73db-860c-4fc5-8911-59a8d79ef659
1
@Override public void keyPressed(KeyEvent key) { if (key.getKeyCode() == KeyEvent.VK_ENTER) save(); }
df3b63a6-1cee-4f56-a245-f02d3f9df396
6
public void MapSetup(int width, int height) { //Scale integrity if (width<minsize) {width=minsize;}if (width>maxsize) {width=maxsize;} if (height<minsize) {height=minsize;}if (height>maxsize) {height=maxsize;} this.width=width; this.height=height; map = new terrain.Base[height][width]; //TODO: Current way...
51b54a3a-7f6a-43be-b230-11b20702f8d7
8
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: String print = Printing_Frame.getText(); String color = Color_Frame.getText(); String black = Black_Frame.getText(); String disc = ...
e9b91d3d-0f9e-452a-92ec-92f081165384
8
@Test public void testConstructNimMatrix_7Sticks() { int numberOfSticks = 7; int matrixSize = numberOfSticks + 1; NimVertex[][] expectedMatrix = new NimVertex[matrixSize][matrixSize]; expectedMatrix[7][6] = new NimVertex(7,6); expectedMatrix[6][2] = new NimVertex(6,2); expectedMatrix[5][4] = new NimVert...
9e14b8c7-e19c-4ef9-8c03-c69e517be30f
6
@Override public double getCost(mxCellState state) { //assumed future parameters if (state == null || state.getView() == null || state.getView().getGraph() == null) { return 1.0; } mxGraph graph = state.getView().getGraph(); Object cell = state.getCell(); Double edgeWeight = null; if(graph.g...
ed7be55d-aee7-4b73-8c42-7875117f7c0f
1
public Hand[] serveHand(int cardAmmount) { int tempCardID = 0; Card tempCard = new Card(); Hand[] hand = new Hand[1]; for (int i = cardAmmount; i < cardAmmount + 1; i++) { String suit = suits[deck[count] / 13]; String rank = ranks[deck[count] % 13]; log.debug("Card number " + deck[i] + ": " + rank + " ...
e3d2964b-abdb-4ad9-816a-06811ec584d6
3
@Test public void insertingScoresMaintainOrder() { Random r = new Random(); for (int i = 0; i < 100; i++) high.insertScore("randomScore", r.nextInt(1000), false); int prev = Integer.MAX_VALUE; boolean isinorder = true; for (int i = 0; i < 100; i++) { ...
61ed0a25-5124-4326-9098-8a815d0de5af
7
public V put(K newKey, V newValue) { if (newKey == null) return null; int index = hashFunction(newKey); if (mTable[index] != null) { // table bucket contains at least one entry already Node currentNode = mTable[index]; // check if key is already mapped while (true) { if (currentNode.mKey...
0fac2ad2-9cfe-4d1e-9d59-cb96cfdbb7da
1
private long hash(String key, int M) { long h = 0; for (int j = 0; j < M; j++) h = (R * h + key.charAt(j)) % Q; return h; }
32f0795a-1daf-4cd0-a497-9085ad0306e9
7
private void decl_var() throws StopException, SyntaxError{ token = lexer.get_token(); /* get type */ keyword type = token.key; var_type value; do { /* process comma-separated list */ var_type i = new var_type(); i.v_type = type; i.value = 0; /* init to 0 should remove this*/ token = lexer.get_token...
bbc52781-2728-4a34-b613-a7bb11667df4
3
public boolean dbSchemaCreated() { boolean created = true; for (int i = 0; i < tables.length; i++) { try { PreparedStatement pSt = con .prepareStatement("SELECT count(*) FROM information_schema.system_tables WHERE table_scheme = 'public' AND table_name = ?"); pSt.setString(1, tables[i]); Result...
974366d5-9a39-438d-8750-fdfa695179c3
0
public AutomatonPane getParent() { return parent; }
1516d679-df77-4aca-a532-ed810b1abd7c
8
public void run() { try { if (this.jmDNSImpl.getState() == DNSState.ANNOUNCED) { if (count++ < 3 && !info.hasData()) { long now = System.currentTimeMillis(); DNSOutgoing out = new DNSOutgoing(DNSConstants...
a7c5f3ab-68c5-4564-b96f-86b40c811362
7
public static Stella_Object accessExplanationInfoSlotValue(ExplanationInfo self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Logic.SYM_STELLA_LABEL) { if (setvalueP) { self.label = ((StringWrapper)(value)).wrapperValue; } else { value = StringWrapper....
98e92dfb-865e-4564-b1cf-98d3881abff3
9
@Override public void menu(User u) throws MenuExitException{ String menuString = "Configure Notify Action:\r\n"; menuString += "(01) Configure name \r\n"; menuString += "(02) Configure prereq setting\r\n"; menuString += "(03) Configure range \r\n"; menuString += "(04) Configure success action \r\n"; men...
dc707a5c-71b0-44d5-86c3-f183d1fb4c6b
7
private double[][][] formErrors(final double[][][] newErrors) { int maxLayer = Integer.MIN_VALUE; for (final int[] line : myMask) { for (final int value : line) { if (value > maxLayer) { maxLayer = value; } } } ...
889bf7fb-d26e-44fc-bb7a-9940867f08e1
8
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if(affected instanceof MOB) { if((msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||msg.amISource(invoker)) &&(msg.sourceMinor()==CMMsg.TYP_QUIT)) { unInvoke(); ...
9648f61f-3276-4991-a829-9dc7275e8ae4
6
private static int partition(Comparable[] a, int lo, int hi) { // ɨָ int i = lo, j = hi + 1; // Ĭϰa[lo]ΪзԪ Comparable v = a[lo]; while (true) { // ˿ʼɨ裬ֱҵһڵԪ while (less(a[++i], v)) { if (i == hi) { break; } } // ڴҶ˿ʼɨ裬ֱҸһСڵԪ while (less(v, a[--j])) { if (j == lo) { break...
76716bb5-b00b-4c8f-b2d1-1d15886c8246
5
String getExitMessage(String groupName, String playerName) { if(groupName.equalsIgnoreCase("New")){ return null; }else if(groupName.equalsIgnoreCase("Member")){ return ChatColor.GRAY + playerName + " left!"; }else if(groupName.equalsIgnoreCase("VIP")){ return ChatColor.DARK_AQUA + playerName + ", l...
b3440eba-ca5a-4705-ae09-8ccdd7221c39
1
public boolean isFree() { int state = alGetSourcei(source, AL_SOURCE_STATE); return state != AL_PLAYING && state != AL_PAUSED; }
92308d87-a685-42c2-960e-92af4cb8f63f
8
public void run() { while(true) { try { msgIN = (ChatMessage) sInput.readObject(); //on récupére le message du réseau if (msgIN.getType() == ChatMessage.MESSAGE || msgIN.getType() == ChatMessage.MP || msgIN.getType() == ChatMessage.LOGOUT){ //si on lit un message ou un MP display...
26ccf047-540d-4b15-8720-7390401f1344
6
public void store(K key, V value) { int hash = key.hashCode(); int index = indexOf(key, hash); if (table[index] == null) { // bucket is empty -> the key does not exist -> create a new Entry Entry<K, V> newEntry = new Entry<K, V>(key, value, hash, null); ...
1361e827-6901-4ae5-9bd9-c46deb36d236
8
public static void main(String[] args) { final String NOMPAYS_BIDON = "Pays Bidon (sera enlevé)"; //ArrayList<String> alNomPays = new ArrayList<String>(); List<String> alNomPays = new ArrayList<String>(); // http://fr.wikipedia.org/wiki/Liste_des_pays_et_territoires_par_superficie alNomPays.add("Canada"); ...
5e8815bf-8bdd-4534-8311-cb494f0a1cb8
5
@Override public Sentence_tree find_common_node(Sentence_tree keyword_tree){ Sentence_tree temp1 = this; LinkedList<Sentence_tree> tree_list1 = new LinkedList<Sentence_tree>(); Sentence_tree temp2 = keyword_tree; LinkedList<Sentence_tree> tree_list2 = new LinkedList<Sentence_tree>(); while(temp1 != null){ ...
922918bc-500c-498b-938d-920b92779f4a
3
private void btExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirActionPerformed int linhaSelecionada = -1; linhaSelecionada = tabela.getSelectedRow(); if(linhaSelecionada >= 0){ int i = -1; i = (JOptionPane.showConfirmDialog(null, "Tem ce...
33aa8af3-f3ee-41a7-9135-cd649736ff5b
6
private void exibirListaBlocos() { System.out.println("LISTA DE BLOCOS"); for (int i = 0; i < listaDeBlocos.size(); i++) { System.out.println(listaDeBlocos.get(i)); } for (int j = 0; j < listaVariveisRegistro.size(); j++) { System.out.println(listaVariveisRegistro...
b662a862-1386-4eaa-83f6-90e55f92f68f
2
public Capitulo buscarCapitulo(int numCapitulo){ Capitulo solucion = null; for (Capitulo capi : capitulos) if (capi.obtenerNumeroCapitulo() == numCapitulo) solucion = capi; return solucion; }
64b8c14a-75e2-4db1-948a-a790d9ac0ad4
1
public void ARPStorm(byte[] targetIP) { //Generates a storm of poison ARPs boolean kill = true; //A kill control variable while(kill == true) { //While kill is true ARPPacket p = this.ARPGen(targetIP); //Generate a new ARP packet targeted at the targetIP parameter inject.inject(p); //Injects the poison ...
751d3638-24b3-4be7-a76e-9e50971b1faf
8
public void validateChangePasswordView(ChangePasswordBean changePasswordBean, ValidationContext context) { MessageContext messageContext = context.getMessageContext(); String oldPassword = changePasswordBean.getOldPassword(); String newPassword = changePasswordBean.getNewPassword(); String confirmNewPassw...
1b45cd80-824f-47fa-aeea-b6b7aad67e66
2
public static Color getColorParameter(String key) throws CorruptConfigurationEntryException { key = key.toLowerCase(); if(!parameters.containsKey(key)) { throw new CorruptConfigurationEntryException("Missing entry in the configuration file: An entry for the key '" + key + "' is missing."); } String col...
614edc8e-6eaf-40f3-8f3e-1bfffb44f296
9
public void pushHand() { Platform.runLater(new Runnable() { @Override public void run() { switch (state) { case SUPER_FREE: break; case FREE: break; case ON_SUN: ...
a60065bf-f28c-4aec-a1d1-a8c2390d1aa0
6
public void formatCombo_actionPerformed(ActionEvent e) { int selectedIndex = formatCombo.getSelectedIndex(); switch (selectedIndex) { case HackController.DECIMAL_FORMAT: if (!decMenuItem.isSelected()) decMenuItem.setSelected(true); break; ...
af1b0562-3f81-43a6-857e-bbe41abebd78
2
public static void main(String[] args) { try { reading(); } catch (JAXBException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
74392827-28cb-4128-a7a1-968204770fc2
4
protected void gameOver() { for (KeyListener listener : getKeyListeners()) removeKeyListener(listener); for (MouseListener listener : getMouseListeners()) removeMouseListener(listener); new GameOverMouseListener(this); JLabel label = new JLabel("<html>You finished in # minutes!<br>Do you want to try ano...
f5b94e53-f01b-468d-a1c9-497db207850d
4
public int minPathSum(int[][] grid) { int m = grid.length; int n = grid[0].length; int[][] sum = new int[m][n]; sum[0][0]=grid[0][0]; for (int i=1;i<m ;i++) { sum[i][0] =sum[i-1][0]+grid[i][0]; } for (int i=0;i<n ;i++ ) { sum[0][i] = sum[0]...
61fcdc5b-cb59-4307-b5ff-9c6b07c97d49
9
public void checkCollisions(int nextX, int nextY, RPG rpg, boolean setDir) { if(setDir) { //set the direction based on x and y change (x takes precedence) if(nextX - this.boundingBox.x > 0) { dir = "right"; } else if(nextX - this.boundingBox.x < 0)...
61011fff-90d9-4754-a25d-3d14332a43f1
7
public void addValidColor(char c){ if(validColors.contains(c)) return; //don't want to add it again for(Clique clique : cliques) for(Cell cell : clique.getCells()) if(cell.getColor() == c) return; //illegal if another Cell in a related Clique already has it assigned //can just add it if the list is empt...
2d992571-0744-4589-b8ba-c5c70c73dc4d
0
@Override public int compareTo(Chromosome o) { int w = this.getFitness().compareTo(o.getFitness()); return w; }
261461bf-ec9a-48bc-ba66-89a5756185be
1
public void addEdges(Edge[] edges) { for (Edge edge : edges) { addEdge(edge); } }
4956503d-1e87-477c-b154-130349b85c33
1
public void tick() { //map.tick(); gui.tick(); paths.tick(); for(int i = 0; i < unitList.size(); i++) { unitList.get(i).tick(); } render(); }
8af402af-a03a-4f3e-9a28-03ead954145f
1
@Override public void setY(double y){ for (KentallaOlija osa : osat){ osa.setY(y); } }
e96f373e-081f-4e09-b175-bbaccf1acae0
1
public void makeOpAssign(int operatorIndex) { setOperatorIndex(operatorIndex); if (subExpressions[1] instanceof NopOperator) subExpressions[1].type = Type.tUnknown; opAssign = true; }
8ee3f39b-5001-4f18-9e49-222856c7ee9b
1
public void printNodes() { for (Node n : nodeMap.values()) { System.out.println(n); } }
d19f37d5-e6b4-4564-bb4f-3d2f731787df
3
public void addButton(List<officeNode> _Office){ List<officeNode> offices = _Office; //количество блоков p=offices.size()/5; FirstPagePanel = new JPanel[p+1]; for(int i =0 ; i <= p;i++){ FirstPagePanel[i] = new JPanel(); FirstPagePanel[i].setLayout(new GridLayout(5, 1)); } int...
35658186-8ed1-4579-aeca-f0e33bed7ba9
5
@SuppressWarnings("deprecation") @EventHandler public void onTeamChatEvent(AsyncPlayerChatEvent event){ if(functions.isPlayerInTC(event.getPlayer())){ if(!(teamchat.isEmpty())){ if(!(event.getMessage().startsWith(lang.TeamChatSpecialChar()))){ for(Player p : Bukkit.getServer().getOnlinePlayers()){ ...
a2b41063-3de6-4c99-9f03-a1c3a98072c9
0
public int getEndStop() { return this._endStop; }
9e846199-2733-429d-af1a-39c07f129fc0
2
private Bullet getFreeBullet() { for (int i=0; i<MAX_BULLETS; i++) { if (!bullets[i].getVisibility()) { return bullets[i]; } } return null; }
284ce385-ad38-4b6e-9bf5-0ef88ca69e19
4
protected OggStreamPacket createNext(OggPacket packet) { if (type == OggStreamIdentifier.OGG_VORBIS) { return VorbisPacketFactory.create(packet); } else if (type == OggStreamIdentifier.SPEEX_AUDIO) { return SpeexPacketFactory.create(packet); } else if (type == OggStreamId...
bfb6456d-ca77-4880-a34b-e9aadbe816dd
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> alread...
eba76fca-c5ee-46d0-8054-8f5ce658dc6d
9
private void randomizeBackground(Background background) { int j = 256; for(int k = 0; k < anIntArray1190.length; k++) anIntArray1190[k] = 0; for(int l = 0; l < 5000; l++) { int i1 = (int)(Math.random() * 128D * (double)j); anIntArray1190[i1] = (int)(Math.random() * 256D); } for(int j1 = 0; j1 < ...
a1c3ffbb-c17d-4572-af7c-50cb841b609e
7
private Boolean setSwitch() { /** * 如果是判断节点,则根据条件设置Switch的值 */ // 测试版本 if ( this.NodeStyle == IFNODE || this.NodeStyle == WHILENODE ) { if ( this.getCommandStyle( this.NodeData ) == this.SSH_COMMAND ) { String conditionCommand = this.NodeData + " &>/dev/null;echo $?"; Str...
3aca529b-2b94-41aa-8915-a763a2bc8cfd
5
private void drawPauseMenu() { GL11.glPushMatrix(); float bar = pauseTimer / 125.0f + 0.1f; GL11.glTranslatef(Game.SCREEN_WIDTH / 2.0f * bar, Game.SCREEN_HEIGHT / 2.0f * bar, 0.0f); GL11.glScaled((125.0f - pauseTimer) / 125.0f + 0.01f, (125.0f - pauseTimer) / 125.0f + 0.01f, 1.0f); boxTexture.draw(310.0f, 100...
83a5d2bb-aa3f-411a-b6bc-7d79a559b071
7
private String findRoomXMPPName(String room_name) { for ( Room room : super.getRooms() ) { //TODO I don't think it can find rooms unless its the correct case, so //no reason to convert to lowercase here if ( room.getTrueName().equals(room_name) || room.getXMPPName().equals(room_name) ) { return roo...
fe5b2b1a-51cf-498d-83ca-281e67e7515d
5
@Override public ReservationReplyMessage reservationRequest(int clientID, int theaterID, int seatReservation) throws RemoteException { if(seatReservation < 0) return new ReservationReplyMessage(theaterID, null, false); //Creates a communication channel between this and the DBServer CommunicationControll...
1fb3be30-cd3c-46f5-97ab-52136b583573
8
@Override public boolean equals(Object object) { if (object == null) { return false; } if (getClass() != object.getClass()) { return false; } Movie movie = (Movie) object; if (this.title == null || !this.title.equals(movie.getTitle())) { ...
94f77df6-909f-4773-921e-7eeec456c145
7
public Map<String, List<TestcaseStep>> readTestcases(Map<String, Map<String, String>> testSuiteInfo ) { EnvironmentVariables ev = EnvironmentVariables.getInstance(); //TestcaseID StepID Keyword ApplicationID FieldName TestData CheckPoint Map<String, List<TestcaseStep>> testCaseInfo = new LinkedHashMap<String, Lis...
035bb52e-fc54-4fcd-b7e4-d0149453c525
8
public static void main(String[] args) { boolean valor=false; do{ try{ System.out.print("Introduce un DNI (12345678?)=> "); String input=stdin.readLine(); valor=Dni.correct(input.toUpperCase()); }catch(NullPointerException e){ System.out.println(e+" No se ha introducido ningun caracter por...
cab39422-2289-45d1-a7f2-50f77d073854
9
public static void main(String[] args) throws Exception { // logging Layout layout = new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN); Logger.getLogger("com.k42b3.quantum").addAppender(new WriterAppender(layout, System.out)); // options Options options = new Options(); options.addOption("p", "por...
cbef14e6-f01f-4ac6-a669-34dd65b896df
5
@Override public boolean equals(Object object) { if (!(object instanceof Project)) { return false; } Project other = (Project) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } ...
220bc36e-06fd-4445-8497-4a31e1374c87
4
@Override public void updateCart(UserModel user, int productId, int quantity) throws WebshopAppException { if (isValidUser(user, "UPDATE_CART") && isPositiveQuantity(quantity, "UPDATE_CART")) { try (Connection conn = getConnection()) { deleteProductFromShoppingCart(conn, user, productId); if (q...
27f4ab87-74ba-403a-916c-913d5f81abe4
6
@Override public String getDescription(Hero hero) { int time = SkillConfigManager.getUseSetting(hero, this, "ReadiedTime", 1, false); String base = String.format("Place a trip mine, armed after %s seconds.", time/1000); StringBuilder description = new StringBuilder( base )...
db68995f-9c37-4c10-a592-0b7e601b4ec8
3
public final Configuration getParentConfig() { Configuration parentConfig = null; if(this.parent != null) { if(this.parent.getParent() != null) { if(this.parent.getParent() instanceof Configuration) { parentConfig = (Configuration)this.parent.getParent(); } } } return parentConfig; }
fb633141-b3b1-4ebb-868d-c6ab4d06c81c
8
private void checkPanic(Body b) { if (b.isDead()) { return; } int minDistance; // 蜈ィ繧�▲縺上j縺ォ蟇セ縺励※繝√ぉ繝�け for (Body p:bodyList) { // 閾ェ蛻�酔螢ォ縺ョ繝√ぉ繝�け縺ッ辟。諢丞袖縺ェ縺ョ縺ァ繧ケ繧ュ繝�� if (p == b) { continue; } // 逶ク謇九→縺ョ髢薙↓螢√′縺ゅl縺ー繧ケ繧ュ繝�� if (acrossBarrier(b.getX(), b.getY(), p.getX(), p.getY(), MAP_BOD...
383a4c8a-95f3-43b0-a9d0-bdcef86493b4
5
@Override public void run() { currentThread = Thread.currentThread(); for (; ; ) { if (currentThread.isInterrupted()) { System.out.println("Finished transfer thread"); return; } try { Response response = commandTasks...
ff922d70-5a9f-46a0-b24a-0a16f78c37fc
1
public void run() throws IOException { FileReader fr = new FileReader("src/main/resources/part1/wk1/IntegerArray.txt"); try (BufferedReader br = new BufferedReader(fr)) { String line; List<Integer> list = new ArrayList<>(); while ((line = br.readLine()) != null) ...
c9d99e9b-d828-4372-a27d-8655edaa4718
9
static boolean meet(char a[], char b[], char num[]) { // a *** b ** num // vaild numbers int a_int, b_int; a_int = Integer.parseInt(new String(a)); b_int = Integer.parseInt(new String(b)); // System.out.println(num); // System.out.println(new String(a) + " " + new String(b)); if (a_int * b_i...
9a243382-0aa7-4528-b112-675c61882b90
1
@Test public void ensureCoreBudgetItemWithNoMonetaryValueThrowsException() { List<CoreBudgetItem> coreBudgetItemList = new ArrayList<CoreBudgetItem>(); coreBudgetItemList.add(new CoreBudgetItem("Test Description", null)); when(budgetFormData.getCoreBudgetItemsList()).thenReturn(coreBudgetI...
a9c1f270-151b-49e0-85c7-63d7aa69833e
5
@SuppressWarnings("rawtypes") public static SingleColumnComparator createDateComparator(NumberName numberName, final Locale locale, boolean ascending, String defaultString) throws Exception { final String type="date"; if (ascending) { if (defaultString.equals("")) { return new Single...
e1533de0-33a0-460f-9f3b-ced15573548c
3
private static boolean canExploreFurther(Board board, Player player, int depth){ boolean res = true; if(board.CheckGameComplete() || board.CheckGameDraw(player)){ res = false; } if(depth == MAX_DEPTH){ res = false; } return res; }
2588169b-22d4-4dd9-bf31-7585331bc69b
5
public void testTextToTerm1() { String text = "fred(B,p(A))"; Term t = Util.textToTerm(text); assertTrue("Util.textToTerm() converts \"fred(B,p(A))\" to a corresponding Term", t.hasFunctor("fred", 2) && t.arg(1).isVariable() && t.arg(1).name().equals("B") && t.arg(2).hasFunctor("p", 1) && t.arg(2).arg(1).isVa...
507cd21b-901a-43b6-b904-955e0404fd08
4
private String getJsonString(String url, String... params ) { try { //Inject parameters into URL. url = String.format(url, params); url = url.replaceAll("\\s",""); // connecting to restAPI HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestMethod("GET"); c...
effaf6b7-30a7-4079-9bff-4e4f9d97bf1d
0
public void disable() { setEnabled(false); }
cea2f834-3fdb-4262-8cce-371f7183d06d
1
public void dump(FileOutputStream out) throws Exception { out.write(packet_tag & 0xff); out.write(packet_length & 0xff); out.write(version & 0xff); for (int i : key_id) out.write(i & 0xff); out.write(PKA_id & 0xff); encr_key.dump(out); }
c88de0e0-793c-474d-b304-d52d9a3d6c14
5
@Override public List<Bounty> getUnclaimedBounties(String issuer) throws DataStorageException { List<Bounty> bounties = new ArrayList<Bounty>(); Set<String> keys = this.config.getConfigurationSection("bounties").getKeys(false); for (String key : keys) { try { int...
c35db640-5992-435b-b923-69cd783eff1d
8
public void ujKorKezdes(){ kez1.removeAll(); kez2.removeAll(); osztoPanel.removeAll(); osztoErtek.setText(""); jatekosErtek1.setText(""); jatekosErtek2.setText(""); szetvalasztas.setEnabled(false); revalidate(); repaint(); kor = new Kor(); kor.korKezdes(); for(Kartya kartya : kor.ge...
b1826460-b19c-4762-9792-44e57f4639f6
5
public int hgetbits(int N) { totbit += N; int val = 0; int pos = buf_byte_idx; if (pos+N < BUFSIZE) { while (N-- > 0) { val <<= 1; val |= ((buf[pos++]!=0) ? 1 : 0); } } else { while (N-- > 0) { val <<= 1; val |= ((buf[pos]!=0) ? 1 : 0); pos = (pos+1) & BU...
353fdf34-5599-490c-ba6b-894cfab7dd7e
8
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for (String linea; (linea = in.readLine())!=null; ) { StringTokenizer st = new StringTokenizer(linea); int n = Integer.parseInt(st.nextT...
776f5c35-61e2-439f-bbfe-71ffe797fcb8
7
private static boolean isClickable(int column){ PachydermUnit[] boardArray = earBoard.getBoardArray(); int unitType = boardArray[column].getType(); int leftUnitType = -1; int rightUnitType = -1; if(column != 0){ leftUnitType = boardArray[column-1].getType(); } if(column != earBoard.getBoardSize()-1){ ...
c1e6e0cd-3162-41a9-88bb-e3f8786a606b
8
public static void main(String[] args) { //首先创建自定义的executor MyExecutors myExecutors = new MyExecutors(5, 10, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); //保存线程的执行结果 ArrayList<Future<String>> futures = new ArrayList<>(); //开启10个线程 for (int i = 0; i < 10;...
2c851e04-1446-4406-ad41-f8d7b175c4e3
7
public boolean isSolved() { for (int i = 0; i < NUM_OF_COLUMNS; i++) { // get the color at (0, i) Color currentColor = grid[0][i]; if (!currentColor.equals(Color.BLACK)) { // start from position (1, i) for (int j = 1; j < getNumRows(); j++) { if (!grid[j][i].equals(Color.BLACK) && !grid...
fe43f388-4a50-4dac-adf0-79d080358931
8
public static Keyword aritySpecialist(ControlFrame frame, Keyword lastmove) { { Proposition proposition = frame.proposition; Stella_Object relationArg = (proposition.arguments.theArray)[0]; Stella_Object relationArgValue = Logic.argumentBoundTo(relationArg); Stella_Object arityArg = (proposition.a...
4409506f-b944-4753-b3f7-ab12ca343b27
1
public static MultiAnswerQuestion getQuestionByQuestionID(int questionID) { try { String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, questionID); ResultSet rs = stmt.executeQuery(); r...
ce0768cd-fa78-48e1-b39a-b98a3c62bf0c
5
public void load(){ try { BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("data/personal.txt"), "Shift_JIS")); ArrayList<String> array = new ArrayList<String>(); ArrayList<Integer> array_i = new ArrayList<Integer>(); String l...
e5dcfdd5-2c67-406c-bcce-49c853e23272
3
private final ObjectId getRemoteHead(final Git gitSession) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { if (!this.USE_SSH.getValue()) { final String refS = "refs/heads/" + this.BRANCH.value(); final FetchCommand fetch = gitSession .fetch() ...
8d590cee-79db-4f01-ba0c-e675787617cc
1
private static boolean doubleIsInteger(double d) { if((int)d == d) { return true; } return false; }
fb674a12-63a2-4d8e-9d26-67dadbfe220e
7
private void updatePasswordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updatePasswordButtonActionPerformed // If fields are empty if (passwordText.getText().equals("") || confirmPasswordText.getText().equals("")) { JOptionPane.showMessageDialog(n...
acdad1f6-21bf-4473-b052-e14b60453b86
0
public PostGeneral(String username){ this.username = username; timestamp = System.currentTimeMillis(); }
ad5c8c33-361c-4cb8-8aee-d8a5c926a4ed
4
public void printIntoFile(String info, String fileName) throws IOException{ File newFile = new File(root + separator + fileName + ".txt"); if(!newFile.exists()){ newFile.createNewFile(); } String str = readFromFile(fileName).toString(); OutputStream out = null; try { out = new BufferedOutputStream(new...
861eba26-26a7-4234-98cf-498b05a524dc
0
Ex3() { System.out.println("E()"); }