method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ecaf98c3-85b6-439b-bc73-51dbe1950e4e
4
protected void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String table; try { List<Category> categories = (List<Category>)CategoryDAO.list(); req.setAttribute("categories", categories); String rows = req.getParameter("rows"); String cat = req.getParame...
e980aa60-090f-4748-81ba-bcd4e6db36ac
5
private void buildWalls() { Random random = new Random(); int procentWalls = random.nextInt(21); while(grid.getWallCoverage() < procentWalls && (procentWalls - grid.getWallCoverage()) > 2){ int directionInt = random.nextInt(2); int randomLength = 1; int randomX = 0; int randomY = 0; Direction di...
00f03fe7-8af7-4703-b3a1-673b8382b86d
8
public static String getCarta(int n){ int valor = (n%13)+2; String res = ""; switch(valor){ case 11: res = "Jack";break; case 12: res = "Queen";break; case 13: res = "King";break; case 14: res = "Ace";break; default: res = valor+"";break; } valor = n/13; switch(valor){ case 0: res += " of...
e978e690-818e-4dda-a7f6-00207162e228
8
static public Element getSelectedElement(){ Element e = new Element(); for (int i = 0; i < Globals.computerList.size(); i++) { if (Globals.computerList.get(i).isSelected() == Boolean.TRUE){ e.ID = Globals.computerList.get(i).getID...
c23b9061-12bf-44b2-bef6-5abd0942b9ea
1
protected boolean canChange(int value){ Controller c = gui.getController(); if (centerCause(c.getX1(), c.getX2(), c.getY1(), c.getY2(), value, c.getR2())){ return true; } else{ showCenterWarning(); return false; } }
1b675203-56bc-428d-bed3-8c7b74fa3475
3
public int maxPathSum3(treeNode root) { if(root == null) return 0; if(root.leftLeaf == null && root.rightLeaf == null) return root.value; PathMaxPair rootPair = maxPathPair(root); return rootPair.getMaxPathNoRoot(); }
99d905ab-37e4-4bbd-894f-35715090c720
1
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
44661579-da38-4380-9b31-8aab7501b3e0
1
public void testPrint_writerMethods() throws Exception { Period p = new Period(1, 2, 3, 4, 5, 6, 7, 8); CharArrayWriter out = new CharArrayWriter(); f.printTo(out, p); assertEquals("P1Y2M3W4DT5H6M7.008S", out.toString()); out = new CharArrayWriter(); try { ...
9e8a40b8-d498-4af4-8821-35af0dc25d9a
8
public Expression3 summand() throws ParsingException { Expression3 left = multiplier(true); while (true) { if (tryConsume("*")) { Expression3 multiplier = multiplier(true); if (multiplier == null) throw new IncorrectPositionException(source...
14218ab1-fb26-4fce-a628-13718847c299
2
@Override public Set<Account> getAccounts(User owner) { Set<Account> accounts = new HashSet<Account>(); PreparedStatement pStmt = null; ResultSet rs = null; try { pStmt = conn.prepareStatement("SELECT * FROM ACCOUNT WHERE user_login = ? ORDER BY id;"); pStmt.setString(1, owner.getLogin()); rs ...
9cd39edc-2b06-4a72-9e62-3aac789b1a8b
8
public void getDiagonals() { super.height = 0; anInt1650 = 0; trimHeight = 0; anInt1646 = 0xf423f; anInt1647 = 0xfff0bdc1; anInt1648 = 0xfffe7961; anInt1649 = 0x1869f; for (int j = 0; j < vertexCount; j++) { int k = xVertex[j]; int l = yVertex[j]; int i1 = zVertex[j]; if (k < anInt1646) { ...
a07ece3e-48eb-4134-9918-fa36ccf55914
0
public String getAccessToken_secret() { return accessToken_secret; }
6c9a46da-ae80-4b5c-9100-ea6aa6d61527
0
public Serializable getObject() { return getGrammar(UnboundGrammar.class); }
6cc79a7c-ed42-4324-942b-c0a9ba3245b1
2
private static final byte[] encodeInteger(Integer integer) { int num_digits = 1; int int_val = integer.intValue(); while((int_val /= 10) > 0) ++num_digits; int_val = integer.intValue(); byte[] bencoded_integer = new byte[num_digits+2]; bencoded_integer[0] ...
06ae16a3-b431-4af7-b8cd-92dc5407289d
2
private static synchronized long pop() throws IOException { String id = null; // check unfinished first if (!unfinished_queue.isEmpty()) return unfinished_queue.poll(); id = queueReader.readLine(); if (id == null) return -1; return new Long(id); }
e8043935-2212-45ed-8be6-d7a2d754c934
8
protected static RequestType requestToRequestType(Request req) { if(req instanceof GetOrCreateRequest) return RequestType.GET_OR_CREATE; if(req instanceof DeleteRequest) return RequestType.DELETE; if(req instanceof AddAndGetRequest) return RequestType.ADD_AND_GET; if(req ...
5c298ce2-c8e7-4591-8069-c1f3cf5b23b4
2
public static String hashPseudoPassword(String pseudo, String password) { String concat = pseudo + password; MessageDigest md = null; try{ md = MessageDigest.getInstance(hashAlgo); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } md.update( concat.getBytes() ); byte...
9f26ff29-113c-460e-889a-cbce9c27780a
0
public FocusTraversalOnArray(Component components[]) { m_Components = components; }
3b099f7f-1a2d-4502-bb50-108abb382eb6
0
public static void main(String[] args) { Cartoon x = new Cartoon(); }
83f2de82-481f-436a-ba48-a842ee8f7f5f
4
public boolean checkpermissions(Player player, String action) { try { if (player.isOp()) { return true; } if (player.hasPermission(action) || player.hasPermission(action.toLowerCase())) { return true; } else { sendErrorMessage(player, action); return false; } } catch (Exception e) { ...
e397cb80-ce7e-4687-9534-99444b3e3cf2
6
public static void main(String[] args) { Scanner sc = new Scanner(System.in); Random rnd = new Random(); int n = sc.nextInt(); char[] suits = {'♣', '♦', '♥', '♠' }; for (int i = 0; i < n; i++) { for (int j = 0; j < 5; j++) { int face = 2 + rnd.nextInt(13); char suit = suits[rnd.nextInt(4)]; ...
5df4aeb7-f283-45e0-a8c4-b261958083d9
7
private 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 != m_...
e8a8f55c-8104-4856-bd38-083d7541b54a
5
public static String changeCase(String s) { byte b[] = s.getBytes(); for (int i = 0; i < b.length; i++) { if ((b[i] >= 65) && (b[i] <= 90)) { b[i] = (byte) (b[i] + 32); } else if ((b[i] >= 97) && (b[i] <= 122)) { b[i] = (byte) (b[i] - 32); } } s = new String(b); return s; }
f54a7e1a-4362-46d6-b15d-5cd93ed0bbaf
7
private SinglePatch getNextPatch() throws IOException, PatchException { SinglePatch patch = new SinglePatch(); for (;;) { String line = readPatchLine(); if (line == null) return null; if (line.startsWith("Index:")) { patch.targetPath = lin...
76f28aa5-9653-4dda-9292-0fe1f447bee7
4
public GridPanel(final Grid grid, final Controller controller, final Player player, final Globals gv) { setLayout(new GridLayout(gv.getRowSize(), gv.getColSize(), 2, 2)); setBorder(BorderFactory.createLoweredBevelBorder()); BlockPanel[] block = new BlockPanel[gv.getMaxTurns()]; ...
072a3fc8-5829-42ce-8007-c20d6d493b6e
4
@Override public void actionPerformed(ActionEvent e) { OptionPanel.instance().showAllBtns(); if (e.getSource() == btnVideo) { MainPanel.instance().showVideos(); MainFrame.CURRENT_PAGE = "video"; OptionPanel.instance().jbtnEdit.setVisible(false); } else if (e.getSource() == btnWords) { MainPanel.insta...
2629471b-da2c-481f-a81d-8c93d2a0c9f9
7
public synchronized void actionPerformed(ActionEvent e) { if (e.getSource() == bouton){ ModifSrid.setNewProjection(saisie1.getText()); ConnexionBaseDonnees.setProjection(saisie1.getText()); } System.out.println("Modification SRID"); Connection con = null; try{ Class.forName("org.postgresql.Driv...
267e4dbf-4618-4736-88be-ae5a6f186de0
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...
5e6f0474-4847-4b00-b2c7-787136777cf6
1
public boolean getResult() { int help = random.nextInt(100); if (help < this.chance) { this.answer = true; } return answer; }
c013ef8b-f3ae-4380-bc92-609d5ef1cf56
1
@Override public void reset() { for (JButton button : mMap.keySet()) { setAccelerator(button, mMap.get(button).getOriginalAccelerator()); button.invalidate(); } mPanel.setSize(mPanel.getPreferredSize()); }
ff5d167b-d095-4220-aa86-6aea74960c0f
1
@Override public boolean register(Game g, Rack r) { super.register(g, r); return model_mimic.register(g, r) && g.rack_size == rack_size; }
9791eb25-3eb2-4986-955f-27d4330af2f5
6
public final TLParser.functionDecl_return functionDecl() throws RecognitionException { TLParser.functionDecl_return retval = new TLParser.functionDecl_return(); retval.start = input.LT(1); Object root_0 = null; Token Def75=null; Token Identifier76=null; Token char_liter...
36dceb56-1915-4907-893a-bdfd85c58630
1
public synchronized void adicionar() { try { new AreaConhecimentoView(this); } catch (Exception e) { } }
dd888614-4648-44f6-bddf-dc9f4afd5910
6
public void csRemoveEquipment(Settlement settlement, Collection<EquipmentType> remove, int amount, Random random, ChangeSet cs) { ServerPlayer serverPlayer = (ServerPlayer) getOwner(); for (EquipmentType e : remove) { int a ...
6da6a2ed-ae9e-4d45-8f7a-eae9c7a74add
4
public List<String> getAdj (int idx) { List<String> adjs = new ArrayList<String>(); List<TermPos> phrase = phrases.get(idx); int i = 0; for (; i < phrase.size() && !phrase.get(i).pos.startsWith("NN"); i++); if (i == phrases.size()) { return adjs; } i -= 1; for (; i > 0; i--) { adjs.add(phrase.ge...
6cb6954e-5064-4d22-98f0-c521aecc022d
9
public long learnParametersWithMoments(Object[] observations) { long start = System.currentTimeMillis(); int i, bin; int[] observationLengths = new int[observations.length]; double[] variances = new double[partition.length]; Arrays.fill(partition, 0.0); Arrays.fill(observationLengths, 0); Arrays.fill(v...
919bd1d9-00f7-4d2e-9f0b-ee7ac9c241b8
3
private static boolean isThereACommonRoad(ArrayList<Road> roadList1, ArrayList<Road> roadList2) { for (int i = 0; i < roadList1.size(); i++) { for (int j = 0; j < roadList2.size(); j++) { if (roadList1.get(i).equals(roadList2.get(j))) return true; } } return false; }
edebae34-8c92-4be6-a402-99ad23c41d30
6
public void renderTileEntitySignAt(TileEntitySign var1, double var2, double var4, double var6, float var8) { Block var9 = var1.getBlockType(); GL11.glPushMatrix(); float var10 = 0.6666667F; float var12; if(var9 == Block.signPost) { GL11.glTranslatef((float)var2 + 0.5F, (float)var4...
379ccd06-d9eb-4742-8e36-a5831aa84c9a
9
private static ArrayList<Long> progression(long[] cards, long dif, boolean isprog) { int N = cards.length; ArrayList<Long> res = new ArrayList<Long>(); for (int i = 1; i < N; i++) { long cmp = cards[i] - cards[i-1] - dif; //println(cards[i-1] + " " + cards[i] + " " + dif...
985d911c-c078-434e-86b4-d3c7f703a9b9
1
protected String processContents(String contents) { StringBuffer buf = new StringBuffer(); // Split it into lines StringSplitter splitter = new StringSplitter(contents, getLineEnding()); // Trim each line while (splitter.hasMoreElements()) { String line = (String) splitter.nextElement(); buf.appen...
071059a6-a9d5-42ed-bcbe-48f4aa6d8dde
3
public static void main(String[] args) { Link link = Link.getDefaultInstance(); link.addConnectionListener(new ConnectionListener() { public void disconnected(DisconnectionEvent e) { System.out.println("Board disconnected"); } public void connected(ConnectionEvent e) { System.out.println...
3d0ad5b2-11b6-42be-a359-4fd9f8cf702f
4
private void btnValidateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnValidateActionPerformed String expression = JOptionPane.showInputDialog(this, "Write an expression to validate.", "Input Expression", JOptionPane.INFORMATION_MESSAGE); if(expression == null || express...
dac6376a-8d68-422c-b749-61aaec55d11b
8
static int dp(int cur, int mask) { if (dp[mask][cur] > 0) return dp[mask][cur]; if (mask == 0) return 0; int count = 0; for (int i = 0; i <= cur; i++) if ((mask & (1 << i)) > 0) count++; int best = Integer.MAX_VALUE; int newmask = mask & ~(1 <<...
d4ca5eb4-5b21-4f93-b0c3-13d2b6cf4f6c
9
@Override public int[] selectCardValuesToThrow(int[] scoreCard) { int[] output = new int[5];//cards that will be discarded if (scoreCard[0] == 45) { // poker detected - swap extra card if it's below value of 10 if (scoreCard[2] < 10) output[0] = scoreCard[2]; } else if (scoreCard[0] >= 33) { // s...
eeff1ef1-9daa-437c-aa8f-44306276b649
2
public void testHasIntersection() { System.out.println("** testHasIntersection **"); ArrayList a = new ArrayList(); ArrayList b = new ArrayList(); assertTrue(!OcCollectionUtils.hasIntersection(a, b)); a.add("a"); assertTrue(!OcCollectionUtils.hasIntersection(a, b)); b.add("a"); assertTru...
f725aaec-4d5d-4794-8e75-778199c4eadf
4
public void readFile(String fileName) { try { String tmpStr = "", x = "", y = ""; BufferedReader buf = new BufferedReader(new FileReader(fileName)); this.mazeSize = buf.readLine(); // Reads first line to obtain maze size while((tmpStr = buf.readLine()) != null) { // Remove whitespace and brackets ...
73d1c8cd-651d-4db0-b3b5-9522faaaabf7
8
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) { if (par7 == 0) { --par5; } if (par7 == 1) { ++par5; } if (par7 == 2) { --p...
359e0523-3a40-44b5-bab4-f086ed6aecf9
9
@Override protected TripleCollection generateRdf(HttpRequestEntity entity) throws IOException { final String queryString = entity.getRequest().getQueryString(); final String data = IOUtils.toString(entity.getData(), "UTF-8"); final TripleCollection result = new SimpleMGraph(); final ...
73b0cc8d-4b1c-4f21-9da8-7efaa441bd19
2
public void printToLog(String s) { if (s == null) { s = "null"; } try { fileOut.write(s.getBytes(), 0, s.length()); } catch (IOException e) { e.printStackTrace(); } }
9b58b80c-74df-46b9-8fd9-5bcadf78109a
2
public static void main(String[] args) { int x = 1; switch (x) { // int y;\ case 1: int a; System.out.println(0); break; case 2: { int b; System.err.println(1); break; ...
120715c5-3256-4b3d-a79f-d86fd203f550
8
public static void main( String... arguments ) { try { String dna; // Retrieve the DNA dna from ... if( arguments.length == 1 ) { // ... the command line arguments. dna = arguments[0]; } else { InputStream input = null; try { if( arguments.length == 0 ) { ...
a7ccd218-2e4e-4e25-ac4a-c49868eabeb1
0
public void processLine(String line){ // does the real processing work System.out.println(line); }
04957728-471b-47eb-b3e8-996f57ff7f01
0
@Override public void setPropertyDefault(String key, Object default_value) { this.default_values.put(key, default_value); }
0199456b-b46a-49bb-a8f5-4b8e5ad86533
0
@Override protected void onStart() { frame = new UpdateFrame(); MineOS.getDesktop().addFrame(frame, Resources.getImageIcon("webframe.png"), this, "Менеджер обновлений"); }
22f81dd6-7324-42f2-b9db-5fbc8c861bec
7
public void pickUpDiscard() { if (discard.size() < 7) { players[turn].send(PacketCreator.draw7(null, null)); return; } int numCards = 0; int rank = discard.get(discard.size() - 1).getRank(); for (Card c : players[turn].getHand()) { if (c.getRank() == rank) { numCards++; } if (numCards == 2)...
f22679e1-c59b-4a65-af60-8e3e7fda997c
2
public static void main (String args[]){ Thread t1 = new Thread(new Runnable() { @Override public void run() { producer(); } }); Thread t2 = new Thread(new Runnable() { @Override public void run() { consumer(); } }); t1.start(); t2.start(); try { ...
2670ac89-e1da-4ea8-be87-957ad4d52d00
7
public boolean checkWinnersHand(User gameUser, ArrayList<User> userHands, User winner, RSAService rsaServ) throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException{ Hand uHand = winner.getUsersHand();...
2d8c6dbb-dea9-4a59-803a-55706d64e84f
4
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == chooserDirectoryButton) { fileChooser.showDialog(this, null); directory = fileChooser.getSelectedFile(); if (directory != null) { chosendirectory.setText(directory.toString() + File.separator + log_file_name); } } e...
11281fd0-0c45-48b7-be25-c9f7855bca5d
5
public void setPlayerTurn(Game.PlayerTurn PlayerTurn, boolean isAI){ if(PlayerTurn == Game.PlayerTurn.PLAYER1){ getBarPlayer1().setBackground(Color.GRAY); BufferedImage Piece = new BufferedImage (OVALSIZE, OVALSIZE, BufferedImage.TYPE_3BYTE_BGR); Graphics2D g2 = Piece.createGraphics(); if(m_...
d3ee07ed-ee3f-418d-b46d-4060c29c9297
6
public void edit(Bitacora bitacora) throws NonexistentEntityException, RollbackFailureException, Exception { EntityManager em = null; try { utx.begin(); em = getEntityManager(); bitacora = em.merge(bitacora); utx.commit(); } catch (Exception ex) { ...
a5c82df4-557e-4d37-9e42-224ca3dc931c
0
public int getTreeSize(int index) { return treeSize[index]; }
97107d7c-c140-4669-88b7-9233a0d6187e
9
public static void main(String[] args) { try { Factory f = new Factory(); // Authentication auth = Factory.createAuthentication(); // String pw = auth.getHashForPassword("test"); // Authentication auth = f.createAuthentication(); // auth.addUser("client", "client"); // auth.addUser("trainer", "tr...
fea75964-c1b1-4e5a-9147-ab4b34946c6b
1
public Stub(ByteReader br, int sz, int sgn) throws IOException { int len = sz - 8; sign = sgn; data = new byte[len]; for (int i=0; i<len; i++) data[i] = (byte)br.read(); }
8154a261-7e3a-4ff9-8f3b-531654d3399e
3
public boolean simulateInput(String input) { myConfigurations.clear(); Configuration[] initialConfigs = getInitialConfigurations(input); myConfigurations.addAll(Arrays.asList(initialConfigs)); while(!myConfigurations.isEmpty()) { if(isAccepted()) ...
3e2e7956-f1e1-4a02-8ed5-20b6d5fba68f
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Ability A=mob.fetchEffect(ID()); if(A!=null) A.unInvoke(); final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,g...
59269e37-bea2-4dcc-9a60-dd595e93f4bb
7
public static void sortByShell(int[] array){ LinkedList<Integer> H_list=Series.getH_ShellList(array.length); int h=H_list.pop(); while(h>1){ for(int i=1;i<array.length;i+=(h+1)){ int current =array[i]; int j=i-1; while(j>=0&&array[j]>cu...
60edd97c-a033-43ff-9002-bda76808ed5a
1
public boolean removeSaveFormat(String formatName) { int index = indexOfName(formatName, saverNames); if (index >= 0) { saverNames.remove(index); savers.remove(index); // Also remove it from the list of formats stored in the preferences Preferences.FILE_FORMATS_SAVE.remove(index); return true...
45d2c48b-63fb-4668-a523-360d83157b3d
9
public void actionPerformed(ActionEvent e) { if(licenseIn.getText().equals("") || firstNameIn.getText().equals("") || lastNameIn.getText().equals("") || dobIn.getText().equals("") || workPhoneIn.getText().equals("") || roomNoIn.getText().equals("") || homeAddressIn.getText().equals("") || availabilityIn.getTex...
d7f67d77-c518-4077-b0a7-d730d24cd876
4
public void mouseClicked(MouseEvent e) { currentPixelPosition = e.getX(); if(currentPixelPosition==0) { playBeforeButton.setEnabled(false); playAfterButton.setEnabled(true); } else if(currentPixelPosition < sampleWidth) { playBeforeButton.setEnabled(true); playAfte...
f60806cc-fed3-44f1-b4be-aede8742ff69
8
public void run() { //Our code can run in this thread while(true) { for (int i = 0 ; i < 4 ; i++) { c.handleCollisionWith(box[i]) ; } if (c.hasCollidedWith(FLOOR)) c.bounceOff(FLOOR); if ( c.hasCollidedWith(goal) ) { points += 100.0/goal.r; int rx = ra...
f29ea5a3-9d34-4460-aaa1-1a4b8b88e6f8
5
public void dumpSource(TabbedPrintWriter writer) throws java.io.IOException { if (predecessors.size() != 0) { writer.untab(); writer.println(getLabel() + ":"); writer.tab(); } if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_INOUT) != 0) { writer.println("in: " + in); } block.dumpSource(w...
63fe97bc-5db5-4e51-83a9-755cf8a07a1f
7
public MonarchPanel(FreeColClient freeColClient, GUI gui, MonarchAction action, StringTemplate template) { super(freeColClient, gui); String messageId = "model.monarch.action." + action.toString(); String yesId = messageId + ".yes"; String noId = messageId + ".no...
6564d0c5-4152-43dc-866b-84153e1f2f45
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((!super.okMessage(myHost,msg)) ||(affected==null) ||(!(affected instanceof Item))) { unInvoke(); return false; } if(msg.amITarget(affected)) switch(msg.targetMinor()) { case CMMsg.TYP_GET: case CMMsg.TYP...
6fbea212-2ef1-484c-8104-d7ac0854bc98
0
public CheeseSandwich() { this.setName("CheeseSandwich"); this.setPrice(new BigDecimal(30)); }
a3465150-14ec-4151-b712-ec651fbe755b
6
public void sortBySoul() { Collections.sort( images, new Comparator<Card>() { public int compare(Card a, Card b) { if (a instanceof Climax || a instanceof Event) { //climaxes should sort to be after all level cards if (b instanceof Climax || b instanceof Event) { ...
5cec051f-0170-45c2-8602-513924e16bfc
2
private void AddProgram(String text, int type) { int shader = glCreateShader(type); if (shader == 0) { System.err.println("Shader Creation failed: Invalid memory location when adding the shader."); System.exit(-1); } glShaderSource(shader, text); glCompileShader(shader); if (glGetShaderi(s...
799527db-17fe-4b0a-a20f-c9934ac4bec3
1
public void setStart(boolean start) { this.start = start; if(this.start) this.g = 0; }
a1c56256-60b9-429e-bbea-4837298eec24
4
public void loadState(Session s) throws Exception { final int hID = s.loadInt() ; homeworld = hID == -1 ? null : (System) Background.ALL_BACKGROUNDS[hID] ; for (int n = s.loadInt() ; n-- > 0 ;) { partners.add((System) Background.ALL_BACKGROUNDS[s.loadInt()]) ; } for (int i = NUM_J ; ...
77d8478e-ff21-43d1-ba92-96bbcf10e1ef
0
public FileNameExtensionFilter(String description, String... formats){ myDescription = description; myAcceptedFormats = formats; }
407555cf-ddd6-46d0-a384-88d7b701c85d
4
@Test(groups = { "Character-Sorting", "Fast Sort" }) public void testMergeSortChar() { Reporter.log("[ ** Merge Sort ** ]"); try { testSortCharacters = new MergeSort<>( fastShuffledArrayChar.clone()); Reporter.log("1. Unsorted Random Array\n"); timeKeeper = System.currentTimeMillis(); testSort...
9f222525-89a2-4d32-bcaa-337389b61942
8
private void jbCreationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCreationActionPerformed try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (ClassNotFoundException ex) { JOptionPane.showMessageDialog(this,"Driver non trouvé " +...
656dc270-f5fd-4c05-9033-eb21cc0d7855
8
static boolean checkMETAINFFolder(IProject project) throws CoreException { IPath outputLocation = getOutputLocation(project); IFolder binFolder = ResourcesPlugin.getWorkspace().getRoot().getFolder(outputLocation); if (!binFolder.exists()) { if (DEBUG) { debug("Creatin...
c64c5dc2-1058-414f-b2e9-4691bcd42a8a
1
@Override public void onMessageNotDelivered(int messageId, int resendMessageId, int clientId, String message) { System.out.println("Message not delivered to client " + clientId + ": \"" + message + "\" Resending..."); try { server.resend(clientId, resendMessageId, message); } catch (CouldNotSendPacketExceptio...
aa1579b4-f0a3-403e-9e0b-8cb6d18c2878
5
@Override public Format setOutputFormat(Format output) { if (output == null || matches(output, outputFormats) == null) { return null; } RGBFormat incoming = (RGBFormat) output; Dimension size = incoming.getSize(); int maxDataLength = incoming.getMax...
1897c690-3eef-4426-ae74-30a206a1fd52
1
private boolean setupEconomy() { RegisteredServiceProvider<Economy> economyProvider = getServer() .getServicesManager().getRegistration( net.milkbowl.vault.economy.Economy.class); if (economyProvider != null) { economy = economyProvider.getProvider(); } return (economy != null); }
92eb275a-0f06-4671-aeb1-92dc25ca21d3
5
private static List<String> extractPath(UnaryRule unaryRule, Map<UnaryRule, String> intermediateStates) { List<String> path = new ArrayList<String>(); path.add(unaryRule.getParent()); String intermediateState = intermediateStates.get(unaryRule); if (intermediateState != null) { List<Stri...
5569c754-65f6-468d-b94d-8159073d317c
5
private int med3(List<T> x, int a, int b, int c) { return (comparator.compare(x.get(a), x.get(b)) < 0 ? (comparator.compare(x.get(b), x.get(c)) < 0 ? b : comparator.compare(x.get(a), x.get(c)) < 0 ? c : a) : (comparator.compare(x.get(b), x.get(c)) > 0 ? b : comparator...
15b41be0-fb11-458d-ad25-2c464eb3ff33
8
@Test public void complicatedTest() throws Exception { ArrayList<Integer> result = new ArrayList<Integer>(); for (int i = 1; i <= 20; i++) { heap.enqueue(i); } for (int i = 1; i <= 20; i++) { //heap should be 1 ... 20 assertEquals(i, heap.dequeue()); }...
af221675-04b8-42f6-abe8-e3800f9cc9d6
2
@Override public T poll() { T result = null; if (firstItem != null) { result = (T) firstItem.value; if (firstItem.getNextItem() != null) { firstItem = firstItem.getNextItem(); } } return result; }
4683812d-0b8c-41da-b8d9-b407165da8c3
5
public static <E> void _saveArray(String tableName, long id, Collection<E> aValue) throws SQLException { List<E> ori = new ArrayList<E>(); _findArray(tableName, id, ori); List<E> toRemove = new ArrayList<E>(ori); List<E> toAdd = new ArrayList<E>(aValue); toRemove.removeAll(aValue); toAdd.removeAll(ori); ...
4f9d12c9-9ebe-439b-835f-22a0d9f3026d
3
@Override public void onCombatTick(int x, int y, Game game) { List<Entity> neighbors = ((SinglePlayerGame) game) .getSquareNeighbors(x, y, 1); for (Entity neighbor : neighbors) { if (neighbor.id == EntityType.archer.id) { ((MortalEntity) neighbor).damage(3...
5e34a9ad-9442-417c-8c35-6ba7f7a80317
4
@After public void tearDown() throws Exception { if (comDao.find(11) != null) { comDao.delete(11); } if (adhDao.find(333) != null) { adhDao.delete(333); } if (adhDao.find(222) != null) { adhDao.delete(222); } if (adhDao.find(555) != null) { adhDao.delete(555); } }
b4ea1367-422e-41c4-9c36-cd7519f3e11b
3
private String listingToString(AbstractComponent component) throws BookException { StringBuilder sb = new StringBuilder(); try { Iterator<AbstractComponent> iterator = component.getIterator(); while (iterator.hasNext()) { AbstractComponent c = iterator.next(); if (c.getType() == EComponentType.CODE...
17d00c68-9321-45db-bbd8-b726044f0944
3
public static void runClient() { Socket socket = new Socket(); try { System.out.printf("connecting to server...\n"); socket.connect(new InetSocketAddress("localhost", 1234)); System.out.printf("server connected...\n"); InputStream in = socket.getInputStream(); byte[] buff = new byte[1024]; ...
5b229f65-bfe7-4def-8fd9-e2851994d6e7
5
public void move(GameContainer gameContainer/*,ScreenArray screenArray*/,Input input,int delta) { if(input.isKeyDown(Input.KEY_RIGHT)) { xcoords += speed*delta; moveVector.x--; }else if(input.isKeyDown(Input.KEY_LEFT)) { xcoords -= spe...
eb03940d-338b-4a31-bdcf-48e2ad924017
6
private void BuildShelter() { valid = false; while(!valid) { Dialog.message("Possible Actions: BUILD, LEAVE"); choice = Input.getStringInput(sc); if (choice.equalsIgnoreCase("BUILD")) { if(sticks >= 6 && logs >= 2 && vines >= 1...
761ffe54-f1e8-4092-97ac-661c3f6fa027
1
@Override public Integer get(Object key){ return containsKey((T)key) ? super.get(key) : 0; }
5921f371-6463-4149-bb25-935b062707e8
7
private void onSaveClicked() { ArrayList<ArrayList<String>> code = getProgramCode(); JFileChooser fileChooser = new JFileChooser(){ /** * Serial version UID to stop the warning. */ private static final long serialVersionUID = 1L; @Override public void approveSelection(){ File f = getSelecte...
ced4b3f3-13a3-4038-8d5d-afac4f282f7f
0
public void setDeviceInfo(DeviceInfoType value) { this.deviceInfo = value; }
1050b22f-d5e3-4111-83ca-a8a035f2717d
7
public static String getBacklink(String name) throws IOException { String correctName = name; Pattern p_s = Pattern .compile("^(.*?)(_?(シリーズ)?の登場(人物|キャラクター)?(.*)|シリーズ|_\\(.*\\))$"); String namelist = WakeBackends.namelist; if (namelist.split(name.split("[ __]")[0] + ",").length == 2) { if (namelist.split...