method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a39364cb-2711-40d8-b292-6706d3eda98a
4
public void flipCard(int row, int col){ if (prevSelectedCardRow == -1 && prevSelectedCardCol == -1){ prevSelectedCardRow = row; prevSelectedCardCol = col; cards[row][col].setShowing(true); updateButtons(); } else if ( prevSelectedCardRow !...
c089d6a2-cf6c-4b7a-9522-d22f0a2d5e58
7
public Set<Contact> xmlToSet() { Set<Contact> allContacts = new HashSet<Contact>(); try{ XMLInputFactory inputFactory = XMLInputFactory.newInstance(); InputStream in = new FileInputStream("contacts.xml"); XMLEventReader eventReader = inputFactory.createXMLEventReader(in); // Read the XML document...
d4396bce-700f-4578-aa80-8668348d8be2
3
private void setHighScore() { FileWriter output = null; try { File f = new File(saveDataPath, fileName); output = new FileWriter(f); BufferedWriter writer = new BufferedWriter(output); writer.write("" + highScore + "\n"); if (elapsedMS >= fastestMS && won) { writer.write("" + elapsedMS); } els...
f3704a3a-1463-488a-a4cc-a9954414b712
7
public void run() { logger.info("JMemProxy is running on port " + this.port); try { channel.socket().bind(new InetSocketAddress(port)); //or InetSocketAddress(host, port) channel.register(JMemProxyFrontend.selector, SelectionKey.OP_ACCEPT); while (true) { int count = JMemProxyFrontend.selector.select()...
67bb32ba-b548-4290-9043-492e28afe5c2
5
public final void gameOver() { // XXX hmm. we should check out these conditions if ( inGameState("GameOver") || (!inGameState("InGame") && !inGameState("LifeLost")) ) return; // System.err.println( "Warning: gameOver() called from other state" // +" than InGame or LifeLost." ); //} clearKey(key_continue...
27c1934e-4e85-48cb-a7e4-6348893a6bd3
7
public static Iris[] getAllIris() { Iris[] pf = null; String csvFile = IrisFactory.class.getResource("/Resource/iris.csv").getPath(); BufferedReader br = null; String cvsSplitBy = ","; try { br = new BufferedReader(new FileReader(csvFile)); StringBuffer fileb = new StringBuffer(); while (br.re...
db1ff576-81bf-4809-b696-3b2ace408076
0
public void setPassword(String password) { this.password = password; }
6e1eface-e0ae-488d-927d-4713159da2eb
1
@Override public boolean hasNext() { if(parser.getElement() == null) findNextElement(); return foundNext; }
fcb9288b-d636-40c5-9802-a5dbaa22759b
3
public void buildSideWalks(int prevSize, int newSize) { int [] dx = {0, 1, 0, -1}; int [] dy = {-1, 0, 1, 0}; int x0 = (getSideLength(newSize)-1)/2, y0 = (getSideLength(newSize)-1)/2; for (int d = 0; d < 4; ++d, x0 += dx[d%4], y0 += dy[d%4]) { for (int i = (int)(Math.max(1-prevSize, 0) + (Math.max(prevSi...
df2a1848-dfab-4c07-ae70-7e04e1343dfd
6
public void execute() { Set<InternalNode<N, E>> closed = new HashSet<InternalNode<N, E>>(); BasicPredGraph<N, E> startPG = new BasicPredGraph<N, E>(this.origin, 0.0f); minQueue.add(startPG, Float.POSITIVE_INFINITY); while (!minQueue.isEmpty()) { PredGraph<N, E> pu = minQueue....
b9cc93f3-bbec-4828-a8e1-bc784fdd3611
4
@Override public void processKeyReleased(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_LEFT){ player.setLeft(false); mountains.setVector(0,0); } if(e.getKeyCode() == KeyEvent.VK_RIGHT){ player.setRight(false); mountains.setVector(0,0); } ...
f69e0792-dcd8-4fc9-bf68-1e57f2cc25b8
8
@SuppressWarnings("rawtypes") public synchronized void run() throws Exception { logger.info("Dependency injection run started..."); if (initialized) { logger.info("Dependency injection already performed. This run will be skipped."); return; } // Find classes ...
f45f5468-ea2d-48a9-ae72-f9608a191634
0
public void clear() { items.clear(); repaint(); }
30490099-3681-47a6-941d-7898284f7562
3
public void run(){ while(true){ myLocation = getPosition(myPaddle,myLocation); yourLocation = getPosition(yourPaddle,yourLocation); ballLocation = getPosition(gameBall, ballLocation); this.repaint(); try { Thread.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } if...
4acbd8d0-22c1-409a-b573-f16e6db031e2
1
@Test(expected = DuplicateInstanceException.class) public void TestCreateDuplicateStudent() throws DuplicateInstanceException { Student student = null; try { student = familyService.findStudent(0); } catch (InstanceNotFoundException e) { e.printStackTrace(); } familyService.createStudent(student); ...
033d95dc-fd32-4075-a7dc-5124110c687f
3
public Progress(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "max": max = Max.parse(this, v); break; case "value": value = Value.parse(this, v); break; ...
240ff1c2-26a4-4e10-9901-39850eb8bd8a
9
protected static void do_action_table( PrintWriter out, parse_action_table act_tab, boolean compact_reduces) throws internal_error { parse_action_row row; parse_action act; int red; long start_time = System.currentTimeMillis(); /* c...
b8beb696-56a1-4ea7-a1b8-0b5e5d6b8976
6
private void hybrid(int ch, int gr) { GrInfo gi = si.ch[ch].gr[gr]; for (int sb18 = 0; sb18 < 576; sb18 += 18) { int bt = (gi.windowSwitching && gi.mixedBlock && (sb18 < 36)) ? 0 : gi.blockType; double[] tsOut = out1d; double[] r = rawout; for (int cc = 0;...
753a0cb3-de84-4904-bad7-07bc9ab63862
6
public static void minimumCoin(int sum) { int[] minNumberOfCoin = new int[sum+1]; //assign the minimum value for all the sums to be infinite for(int i =0; i<=sum;i++){ minNumberOfCoin[i] = Integer.MAX_VALUE; } //for zero sum you need zero coins minNumberOfCo...
7d3ccf96-5764-4ba9-98f3-123fcbf00eda
3
public void setLogLevel(final String name) { Level level; try { level = Level.parse(name); } catch (final Exception e) { level = CustomPlugin.DEFAULT_LOG; this.getLogger().warning("Log level defaulted to " + level.getName() + "; Unrecognized java.util.logging.Level: " + name + ";...
c72b3b63-7420-4582-9d67-61234282a95a
8
public ArrayList<String> getOverlaps(course c){ boolean[] cDays = c.getDaysOfWeek(); ArrayList<String> overlaps = new ArrayList<String>(); for(int i=0;i<5;i++){ if(this.daysOfWeek[i] == true && cDays[i] == true){ switch(i){ case 0: overlaps.add("M"); break; case 1: overlaps.add("T");...
8fd48851-5281-4db6-8804-d528e97bce4a
0
@Test public void containsReturnsTrueWhenElementInArray() { a.insert(v); assertTrue(a.contains(v)); }
17768086-59e5-4b89-bb74-27cc991bf9a4
2
@Override public String toString() { return start + "-" + end // + ((id != null) && (id.length() > 0) ? " '" + id + "'" : ""); }
f3eeb014-2e48-46ad-922c-1e1d40d5e47a
9
public void execute() { try { this.generateWrapperBaseClass(); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } System.out.println("Objects: " + this.objects); for (int i = 0; i < this.sObjects().length; i++) { if( ...
23f6661c-bb93-49ce-a393-0c54d5782314
4
private void normalSolve() { Log.log("NormalSolve <Start>"); mFinishedSolvers.clear(); if ( !mNumbers.isEmpty()) { for (int id : mNumbers.keySet()) new TileSolver(id).start(); while (mFinishedSolvers.size() < mNumberId + 1) try { Thread.sleep(1); } catch (InterruptedException e) ...
967f776a-551b-4dcf-86b7-65ad170042e5
0
public ChainVestBodyArmor() { this.name = Constants.CHAIN_VEST_BODY_ARMOR; this.defenseScore = 10; this.money = 300; }
8ab434fb-92e7-4e5d-af8c-6a91ca3c2ce3
9
public void executeCalculate() { LOG.debug("START_METHOD executeCalculate()."); if ( isSetData ) { LOG.info("Processor executing calculation."); Operations operation = getOperation(); if ( operation == OPERATION_C ) { calculator.reset(); } else { String strNumber = request...
61626c05-2a3e-4aa0-abc5-00aca95b42ee
7
private void startMonitor(){ try{ // Create a new selector Selector selector = Selector.open(); // Create a new non-blocking server socket channel ServerSocketChannel serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); InetSocketAddress isa = new InetSocketA...
c69a3b2b-eee8-42e3-bd31-3369dcc0c7ed
4
public Boolean downFantasma(int n){ Query q2; switch(n){ case 0: q2 = new Query("downBlinky"); return q2.hasSolution(); case 1: q2 = new Query("downClyde"); return q2.hasSolution(); case 2: ...
619488ba-4a37-46ef-b00f-b41615e6bff1
7
public void SampleHighAndLow(List<ClassDocumentation> docs, int threads ) { Collections.sort(docs, new Comparator<ClassDocumentation>(){ @Override public int compare(ClassDocumentation a, ClassDocumentation b) { return a.getValidatedThreads().size() - b.getValidatedThreads().size(); } }); int...
57456c6e-5d4b-471a-834b-db536a722686
7
public void run () { try { // handle authentication process. if (version == 0 && useAuth) { // Access Authenticator instance //Authenticator auth = Authenticator.getInstance(); // authenticate (to) server //userCred = auth.authenticate (comm, false, null); if (userCred == null) throw ne...
98d49bd5-cb4d-46ce-a67c-9ac1f999854e
8
public static long toAmount(String price) { if(price.charAt(0) == '$') price = price.substring(1); index = price.indexOf("."); if(index == -1) price = price + "00"; else if(index == price.length()-1) price = price.substring(0,price.length()-1) + "00"; else if(index == 0 && price.length() == 2)...
7611675c-4aa3-4562-bb7d-23217ed5eba9
0
public HueChangeHandler(boolean polygon, boolean add) { this.polygon = polygon; this.add = add; }
1da1077b-26db-4a33-98fb-1ce2f3667c28
5
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
0b65245b-4f0a-41e0-861d-0596cc00052c
9
public static final void bytesToInts(int[] dst, int dst_offset, byte[] src, int src_offset, int length) { if ((src == null) || (dst == null) || ((src_offset + length) > src.length) || ((dst_offset + length) > (dst.length * 4)) || ((dst_offset % 4) != 0) || ((length % 4) != 0)) { croak("bytesToInts pa...
f82bb002-5fc8-4d76-91fb-1132825a02bc
2
public void print(int n) { if (n > 0) { for (int i = 0; i < n; i++) System.out.print(" "); } System.out.print(name + " "); }
c7691e51-449a-40c8-adc0-debdbf2bb91a
7
public long count(int[] kind, int[] found, int K){ int[] quantity = new int[N+1]; for(int i=0; i<kind.length; i++) quantity[kind[i]]++; long[][] C = new long[N+1][N+1]; for(int i=0; i<=N; i++){ C[i][i] = 1; for(int j=0; j<i; j++) C[i][j] = C[i-1][j]*i/(i-j); ...
aa16b916-63a0-4a02-abfa-fa573add6b8d
6
private boolean suPoliaDobre() { boolean poliaSuDobre = true; VerifikatorVstupov verifikatorVstupov = new VerifikatorVstupov(); if (!verifikatorVstupov.jeNeprazdny(txtOkruh)) { verifikatorVstupov.hlaskaPrazdnyAleboDlhyString(this, txtOkruh, 30); return false; } el...
cda533bb-9484-417e-b1fc-49b5e5bdc4c5
7
public void init(final Map attributes) throws SaslException { if (state != -1) { throw new IllegalMechanismStateException("init()"); } if (properties == null) { properties = new HashMap(); } else { properties.clear(); } if (attributes != null) { p...
5262d503-476c-4d97-bcd9-bdf43df1b963
1
public static byte[] safeUnion(byte[] Q, byte[] R) { byte q = (byte)Math.round((Math.log(Q.length)/LOG_2)); byte r = (byte)Math.round((Math.log(R.length)/LOG_2)); byte minp = (byte)Math.min(q, r); byte[] S = safeFold(Q, minp); byte[] T = safeFold(R, minp); for(int i = 0; i < S.length; i++) { ...
6e8a708d-0f21-4d16-9f0e-14c02d4f3a2c
8
private String addMargin(Margin margin) { if (margin == null) { return ""; } StringBuilder style = new StringBuilder(); if (margin.getTop() == margin.getLeft() && margin.getTop() == margin.getBottom() && margin.getTop() == margin.getRight()) { style.append("margin:"); style.append(margin.getTo...
ecd2a4e2-ce05-44b0-9472-970e761e7eac
3
private static void fw_write(String msg, String file) { //System.out.print(msg); FileWriter fwriter = null; try { fwriter = new FileWriter(file, true); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Unwanted err...
1790333d-0ac8-46f3-a5f0-b053bdf5850d
0
public int getSteps() { return this.StepCounter; }
c5cfe558-3557-4562-9aed-1f624a35af26
3
public void mainAction() { ship s = getShipToRecieveAction(); ship f = getShipToPerformAction(); //this is the ship that has all the hardpoints. //When the ship is recieved from this function, say if player1 has basicShip, does it return it as a basicship? for(hardpoint h: f.returnHa...
b2969aa9-e3b5-4761-ac06-b37e747ca4b0
2
public void setValue(Object pRowObject, Object pValue) { try { pValue = mFormat == null ? pValue : mFormat.parseObject(String .valueOf(pValue)); mSetter.invoke(pRowObject, new Object[]{pValue}); } catch (Exception e) { e.printStackTrace(); ...
1d618b4e-f1d9-423e-9215-31bb7d3f209f
2
private void showFinalScore() { CardLayout cl = (CardLayout) (getParent().getLayout()); cl.show(getParent(), FINAL_SCORE_PANEL); for(Component p: this.getParent().getComponents()){ if (p instanceof FinalScorePanel){ ((FinalScorePanel) (p)).showInputFrame(); ...
df2a32e2-cf8b-444d-890d-88cd909b5e08
0
public static void InitiationChamber() { currentRoomName = "Initiation Chamber"; currentRoom = 8; RoomDescription = "The steel doors are heavy so you charge into it and they burst open, slamming in to the wall it is " + "hinged to. The room is cold and bright. There is a velvet rope across the front of the d...
83a47532-2b55-405f-9661-b24b1da72ea8
8
@Override protected void doCycle() { readFrame(); if (state == MasterNodeState.idle) idle(); if (state == MasterNodeState.useToken) useToken(); if (state == MasterNodeState.waitForReply) waitForReply(); if (state == MasterNodeState.done...
ab997def-c658-4730-98ff-364a197ecf4d
7
@EventHandler(priority = EventPriority.NORMAL) public void onOfferAccepted(OfferAcceptedEvent event) { // debug message if (plugin.verbose) { EmeraldMarket.getBukkitLogger().info("OfferAccepted event called."); } // we need to inform the first party and give them the loot // this can only be done when the...
e44e7663-0868-449a-b5ac-77f433b9a9af
1
public static void removeBlock(Block b) { if (!custom.contains(b)) return; custom.remove(b); }
7f9e016e-95a1-45ea-be9a-dc6c73fd5480
7
@Override public void run() { try { //serverApp.setVisible(true); //@ MS // Configure the listener/sender BufferedReader in = new BufferedReader(new InputStreamReader(incoming.getInputStream())); PrintWriter out = new PrintWriter(incoming.getOutputSt...
e957ab0c-6c49-4c06-a630-accd572b7fdc
4
public void tick() { wasDown = isDown; boolean state = false; if (!nextState.isEmpty()) state = nextState.removeFirst(); if (state) isDown = state; else if (isDown && !state) isDown = false; }
0d655361-fe31-4d91-b211-36c5e5140ec6
4
public String row(int i) throws Exception { int lh = this.left.height(); int rh = this.right.height(); int h = Math.max(lh, rh); // Sanity check if ((i < 0) || (i >= h)) { throw new Exception("Invalid row " + i); } // if the row is invalid String result; if (i < l...
b3561605-dc65-486c-8579-7b1eff50c16a
8
@Override public final LinkedPointer addEffect(AbstractEffect<Double> e) { if (e == null) throw new NullPointerException("The effect is null."); if (!e.affectTo().equals(type)) throw new NullPointerException("The effect cannot affect this property."); lock(); ...
a1bcc458-4e5b-4769-9257-361ebf0d0f17
5
public GameObjectDefinition getChildDefinition() { int child = -1; if (varBitId != -1) { VarBit varBit = VarBit.cache[varBitId]; int configId = varBit.configId; int lsb = varBit.leastSignificantBit; int msb = varBit.mostSignificantBit; int bit = Client.BITFIELD_MAX_VALUE[msb - lsb]; child = client...
73a4400d-fe44-4a8b-9c93-105aa3a076c8
7
public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { if (root == null) { return null; } if (root == q || root == p) { return root; } boolean isLeftQ = isIn(root.left, p); boolean isLeftP = isIn(root.left, q); if (isLeftP && isLeftQ) { return lowestCommonAncestor(root.le...
0c266e4f-91cc-4480-86da-5b45cf440a04
0
@Before public void setUp() { maker = new SimulatedCoffeeMaker(); }
ed427c1d-2b80-4770-9b03-280de36670df
2
public ImageComponent(String imageUrl) { super(); URL url; try { url = new URL(imageUrl); } catch (MalformedURLException e) { e.printStackTrace(); return; } try { image = ImageIO.read(url); System.out.println("...
0c073a22-56e7-4e32-b4c0-5fddd384197f
0
@Test public void verifyClassAnnotationsFound() { assert this.foundClassAnnotation; }
3b6a66d5-8f7d-409f-b5cc-8102e632549a
8
@Override public int hashCode() { int hash = 0; hash += (a == null ? 0 : a.hashCode()); hash += (b == null ? 0 : b.hashCode()); hash += (c == null ? 0 : c.hashCode()); hash += (d == null ? 0 : d.hashCode()); hash += (e == null ? 0 : e.hashCode()); hash += (f == null ? 0 : f.hashCode()); hash += (g == n...
5e90af55-30ea-4d9c-932e-5a0d36a2d7c2
0
public SignatureMethodType createSignatureMethodType() { return new SignatureMethodType(); }
7338b50b-715c-4d43-a7b0-aec439269798
7
public static void resumePrevious(){ //get path of previous presentation from config String temp = Config.loadPreviousPresentation(); if (null != temp){ path = temp.replace('\\', '/'); if (null != path){ if (path.substring(0, 7).equals("http://")){ if(Debug.safetyNet) System.out.println("retreiving...
7e6c591a-20d4-4cdc-b3e7-7fb742c4d6a2
2
public void bet(int bet) { if (player.getCash() >= bet && rules.isValidBet(bet)) { newRound(); player.setCash(player.getCash() - bet); player.setBet(bet); status = "player bet " + bet; } else { status = "player unable to bet"; } ...
8742c961-827f-4673-b161-dc0e7932bb6b
3
@Override public void itemStateChanged(ItemEvent e){ int pos = 0,i; for(i = 0; i < gramListP1.getItemCount(); i++) if(gramListP1.getItem(i).equals("Rules:")){ pos = i; break; } //System.out.println(new Integer(pos).toString()); ...
9cca6825-5c15-4803-ba82-d58f99f0571c
9
* @param b * @param layouts * @param dependOn * @param p * @param shared * @param position * @return */ private boolean trySamplePositions(LayoutBox[] boxes,LayoutBox b,LayoutInfo[] layouts,int[] dependOn,int p,LinkedHashMap<LayoutInfo.NodeLayout, LayoutInfo.NodeLayout> shared,Rel...
4fb0ff71-659a-4739-8bf3-0d714920aab4
0
public void resetDrawOutput() { _drawOutput = null; }
68606c5c-f145-4142-b53f-96ea3a0e834b
4
public void decreaseKey(Fibonaccinode x, int k) { if (k > x.value) { throw new IllegalArgumentException("You gave a bigger value!"); } x.value = k; Fibonaccinode y = x.parent; if ((y != null) && (x.value < y.value)) { //Leikkaus cut(x, y); ...
ea826ccf-6770-435f-9fcd-1e710095bb43
2
@Override public int doAfterBody() throws JspTagException { if (rows-- > 1) { try { pageContext.getOut().write("</td></tr><tr><td>"); } catch (IOException e) { throw new JspTagException(e.getMessage()); } return EVAL_BODY_AGAIN;...
8502a1a9-1fa2-4821-870f-559a4f059503
5
public static boolean arrayEquals(Object a, Object b) { if (a == b) return true; int numLongs = Array.getLength(a); if (numLongs != Array.getLength(b) || !a.getClass().equals(b.getClass())) return false; int baseOffset = $.arrayBaseOffset(a.getClass()); int scaleOffset = $.arrayIndexScale(a.getClass());...
b09a41f9-b492-4621-a848-010ffa3e35d9
8
@Test public void testIsPlayerInGame() { // Richiamo l'helper per aggiungere due utenti ("abc" e "abd") e avere testingToken e testingToken2. aggiungiDueUtenti(); // Aggiungo tutti gli utenti come nel test testDoAccessoPartita // Li creo, li loggo, creo le razze e li faccio accedere alla partita sin quando ho ...
6f858418-a795-40d3-9bbd-84553b5c0b75
1
public void updateContents() { for(UIContent content : Contents) { content.updateContent(); } }
91388c77-ec94-4b74-8b60-8740451089fd
4
private boolean setupVault() { if (!config.getVault()) return false; try { RegisteredServiceProvider<Economy> ep = server.getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); RegisteredServiceProvider<Permission> pe = server.getServicesManager().getRegistration(net.milkbowl.vault...
749fc696-1ec1-4bec-b2d9-ff938d88621a
5
private void handleCollisions(Collection<Snake> snakes) { for (Snake snake : snakes) { boolean headCollision = id != snake.id && snake.getHead().equals(head); boolean tailCollision = snake.getTail().contains(head); if (headCollision || tailCollision) { kill();...
f33982ee-3060-4b75-bedb-2d6e7e0ea76e
5
@Nullable private Machine checkDequeueItem(@NotNull Task<Result> task) { if(dequeueWatchPlugins.isEmpty()) { if(machines.isEmpty()) { return null; } else { return machines.get(0); } } else { for (Machine machine : machines) { for (DequeueWatch dequeueWatchPlugin : dequeueWatchPlugins) { ...
00860acd-c566-49a8-939a-4484b5d1d9ac
0
public static String byteToString(byte[] data) { return new String(data); }
66432b25-598f-415b-b84b-621f818ebf5e
2
public Blink(Room room, Entity parent, float x, float y, float tx, float ty, float dx, float dy) { super("Assassin Blink", room, parent, x, y, tx, ty, dx, dy, 2.5f, Color.gray); if(collide(SOLID, tx, ty) == null) { float finalX, finalY; do { finalX = tx + (16 * ((new Random()).nextInt(3) - 1)); finalY...
8f6ed016-d4d3-4072-9988-356e7fc7edb3
6
public void mean_read(String path) throws IOException { FileInputStream is = null; DataInputStream dis = null; try{ is = new FileInputStream(path); dis = new DataInputStream(new BufferedInputStream(is)); senones = (int)dis.readFloat(); gaussian = (int)dis.readFloat(); mean = new float[senones][g...
389cdf30-8332-4e08-a9c4-b83e893764ad
1
public static void main(String[] args) { System.out.println("Starting"); try { sanityCheck(); } catch (Exception e) { e.printStackTrace(); System.out.println("Finished abnormally"); System.exit(-1); } System.out.println("Finished"); System.exit(0); }
881bfa0a-5acd-41b0-b8f7-cb13fef21671
4
public static Map<String, String> getUrlParameters(String url) { Map<String, String> params = new HashMap<String, String>(); String[] urlParts = url.split("\\?"); if (urlParts.length > 1) { url = urlParts[1]; } for (String param : url.split("&")) { try { String pair[] = param.split("="); Str...
e12d26d2-510c-459c-899b-603d45ea4c7c
8
public static void cd(String[] operand) { String nonCanonical = ""; // Deal with Files that start with '/' if (operand[1].startsWith("/")) { if (new File(operand[1]).exists()) { nonCanonical = operand[1]; try { currentDir = new File(nonCanonical).getCanonicalPath(); } catch (IOException e) { ...
4232ba6e-ed87-4df9-accf-fab8048a4fb5
9
private static String generateUpdateSql(String content, String tableName, String primaryKey, List<String> columnList){ StringBuilder sb = new StringBuilder(); sb.append("UPDATE ").append(tableName).append(" SET\n"); for(int i=0;i<columnList.size();i++){ String col = columnList.get(i); String field = StringU...
3dd759a5-ad11-47c6-b05d-4f2631d300f0
2
public CPOptionsPanel() { Box vb = Box.createVerticalBox(); vb.setBorder(BorderFactory.createEmptyBorder(80, 5, 5, 5)); cbInverse = new JCheckBox(CPMainGUI.language.getString("palette_inverse")); cbInverse.setAlignmentX(Component.LEFT_ALIGNMENT); cbInverse.addActionListener( new AbstractAction() ...
6f1b4294-c884-4344-97e6-fb934980c4c0
8
@Override public StatusType getInput(Object object) { //was called getCommand before implementing interfaces StatusType status = StatusType.PLAYING; do { try { this.display(); //displays the display method from this class //get the input command entered b...
1049e1e7-369c-4b40-807b-2b1d323e18a8
7
public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); // Make sure we are responding to the right event. if (propertyName.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { File selection = (File)e.getNewValue(); Strin...
d8f4e696-51fb-436f-8a8a-7e7d0e99da45
9
public static boolean getBoolean(String key, boolean def) { if (key == null) { throw new NullPointerException("key"); } String value = props.getProperty(key); if (value == null) { return def; } value = value.trim().toLowerCase(); if (value.length() == 0) { return true; } if (value.equals("...
35bf0c22-af5a-40f3-9e5d-b649dee5dd05
5
public void generateNextKeySet() { cryptVar2 += ++cryptVar3; for(int i = 0; i < 256; i++) { int j = cryptArray[i]; if((i & 3) == 0) cryptVar1 ^= cryptVar1 << 13; else if((i & 3) == 1) cryptVar1 ^= cryptVar1 >>> 6...
f22f9e36-f663-4f2b-87d3-3f020c4dd5cf
4
public static List<AstronomicalObject> findUninhabited(StarSystem stm) { List<AstronomicalObject> returnedObjects = new ArrayList<AstronomicalObject>(); List<AstronomicalObject> elements = stm.getElementsAsList(); for (AstronomicalObject element : elements) { if (!(element instanceo...
0897d1ad-4c3f-46ed-be97-986737900d9b
5
@Override public void removeSelectionPath(TreePath p) { if (p.getPathCount() == 2 || p.getPathCount() == 3) { removeChildSelectionPath(p); } if (p.getPathCount() == 3 || p.getPathCount() == 4) { removeParentSelectionPath(p); } if (p.getPathCount() == 4) { gui.imageBrowser.removeDate((ImgDate) p.get...
3f961e8f-07db-45d1-b623-97cd8a726dfd
4
public Boolean setGame(Game g) { boolean test = false; if (test || m_test) { System.out.println("FileManager :: setGame() BEGIN"); } m_game = g; setGridObj(); if (test || m_test) { System.out.println("FileManager :: setGame() END"); } return true; }
935818fa-1788-49d7-8aad-066eca3d4f2e
6
public boolean nextCell(int x, int y) { int nextX = x; int nextY = y; int[] toCheck = {1,2,3,4,5,6,7,8,9}; Random r = new Random(); int tmp = 0; int current = 0; int top = toCheck.length; for(int i=top-1;i>0;i--) { current = r.nextInt(i); tmp = toCheck[current]; toCheck[current]...
926e8c25-482e-4d9d-9264-093c3a413ce2
2
public JTable_Table(String[][] matrix) { m_table = new JTable(matrix[0].length, matrix.length); TableModel model = m_table.getModel(); for (int i = 0; i < matrix.length; ++i) { for (int j = 0; j < matrix[i].length; ++j) { model.setValueAt(matrix[i][j], j, i); ...
125a967d-915a-4e06-a38c-d9378f52c7f8
0
public void setMdpSgbd(String mdpSgbd) { this.mdpSgbd = mdpSgbd; }
34bd1d0c-bb7b-4b25-ba7e-4322906a20b8
8
public void handleMessageFromServer(Object obj) { if ( obj instanceof Updater) { Updater update = (Updater) obj; String command = update.getCommandMessage(); if ( command != "") try { serverCommandMessage(command); } catch (IOException e) { clientUI.d...
d3f6627a-328c-4fee-8083-6ea25d15f12c
9
public void showPayment(String from, String to, double amount) { Player paymentFrom = iConomy.getBukkitServer().getPlayer(from); Player paymentTo = iConomy.getBukkitServer().getPlayer(to); if (paymentFrom != null) { from = paymentFrom.getName(); } if (paymentTo != null) { t...
b84d52a4-5921-42eb-9008-2b9e71cca16e
0
public static int toInt(byte[] byte_array) { return ((byte_array[0] & 0xFF) << 24) + ((byte_array[1] & 0xFF) << 16) + ((byte_array[2] & 0xFF) << 8) + (byte_array[3] & 0xFF); }
dcf51b1e-b076-4e5d-b60f-0b6f2000a85f
4
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed if (txtNome.getText().equals("") || txtEmail.getText().equals("")) { JOptionPane.showMessageDialog(null, "Não foi possivel Atualizar o cadastro \n Preencha todos os campos...
2780f485-b268-451f-8fcc-274d9c20a734
1
public void closeSocket() throws InterruptedException { try{ recieveTCP.setTerminer(true); t1.join(); socket.close(); } catch(Exception e){ e.printStackTrace(); JOptionPane.showMessageDialog(null, "Erreur de deconnection", "Erreur", JOptionPane.ERROR_MESSAGE); } }
b8432565-9bbb-42f2-99a4-b2d807d1cbd5
9
private String[] lineSpliter(String line) { if (line == null || line.length() == 0) return new String[0]; line = line.replaceAll("\"\"", ""); Pattern pattern = Pattern.compile(REPLACE_PATTERN); Matcher matcher = pattern.matcher(line); List<Integer> spliterRepPosList = new ArrayList<Integer>(); Str...
fbbe0298-3875-42f3-8650-179393a5ddc1
5
private static void testTable() throws FileNotFoundException, ExecutionException, UnsupportedEncodingException { new File("db_test").delete(); BufferManager bufferManager = new BufferManager("db_test"); Collection<Attribute> attributes = new ArrayList<>(); attributes.add(new Attribute("T...
bdea3eb9-9dea-47e6-993e-5f9d0edb21d8
9
public String getPrintedPermissions(){ StringBuilder result = new StringBuilder(); result.append(isUserRead() ? "r" : "-"); result.append(isUserWrite() ? "w" : "-"); result.append(isUserExecute()? "x" : "-"); result.append(isGroupRead() ? "r" : "-"); result.append(isGroup...