method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e6be8560-1ead-40dd-8a04-3856d4090029
9
static final void method1267(GraphicsToolkit graphicstoolkit, int i, int i_78_, int i_79_, int i_80_, int i_81_, int i_82_, boolean bool, boolean bool_83_) { CacheNode_Sub18.aGraphicsToolkit9607 = graphicstoolkit; Class22.anInt427 = i; Class188_Sub2.aBoolean6868 = Class22.anInt427 > 1 && CacheNode_Sub18.aGraphics...
57516f98-7cdc-48a8-b636-29b5de5dbf96
3
public void setTileImages(Image[] paramArrayOfImage) { this.TileImages = paramArrayOfImage; MediaTracker localMediaTracker = new MediaTracker(this); for (int i = 0; i < paramArrayOfImage.length; i++) localMediaTracker.addImage(paramArrayOfImage[i], 0); try { localMediaTracker.waitForAll(); } ...
106887e5-a8c4-4d6c-b4a4-643a63155842
8
@Override public byte[] receiveBytes() { try { p.writeBytes(new byte[] { '*','r' } ); if (!readUntil((byte)'*',600) || !readUntil((byte)'r',600)) return null; byte[] oneByte = p.readBytes(1, scaleTimeout(50)); if (oneByte.length != 1) return null; int length = (0xFF&(int)(oneByte[0])); leng...
8bf7de4b-0bdd-4f52-b69c-5ba8950ceb5d
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; UserAndWeight other = (UserAndWeight) obj; if (user == null) { if (other.user != null) return false; } else if (!user.equals(other.user)...
e30608a5-accc-4e17-a05f-30a765efc4a9
9
protected boolean closed(Area A) { if(A==null) return false; for(final Room.VariationCode code : Room.VariationCode.values()) { if(closedV.contains(code.toString())) switch(code.c) { case 'W': if(A.getClimateObj().weatherType(null)==code.num) return true; break; case 'C': ...
0bd1f6a3-692d-4bbc-845a-b8d11047052f
3
protected static void startReceiveMessage(InputStream in){ while(true){ try{ byte[] temBuffer = new byte[1024]; int count = in.read(temBuffer); while(count > 0){ String msg = new String(temBuffer,"utf-8"); log.info("the count is:\r\n" + count + "\r\nthe message receive: \r\n" + msg); t...
fa3aa132-a669-48a0-9e5c-511eebcb50b4
1
private static void addImgPath(List<ResourceVO> list, Path img) { if (img != null) { int num = Integer.parseInt(img.getFileName().toString().split("\\.")[0]); list.add(new ResourceVO(img, ResourceType.BITMAP, num)); } }
ebd5b4fe-3be3-4ee6-8af7-c151f08def69
0
public void setFirstName(String firstName) { this.firstName = firstName; }
3c6aa6f2-ca35-472c-9c49-5abad3a95412
1
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); if (qName.equals(mNodeName)) { verifyNodeBasics(attributes); verifyNode(attributes); ...
9ff3122d-9efd-4e9c-a850-88f3a89aeefd
0
public void setJournalId(Integer journalId) { this.journalId = journalId; }
bb881a61-7234-43cc-9ffb-67796d0dd21b
6
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 ...
da33c660-f5e8-460a-b734-06032edbd76f
5
public void playGame() { System.out.println("Please enter the boardSize you will be needing. It should be atleast 3 "); int boardSize; while (true) { try{ boardSize = Integer.parseInt(scanner.nextLine()); if(boardSize<3){ System.out.pri...
1d23c515-eacf-489d-84db-5f51de13bfe7
1
@Override public void startOutline () { // initialize the current node to the root node of the outline this.currentNode = tree.getRootNode(); // clear out any existing children. while (currentNode.numOfChildren() > 0) { currentNode.removeChild(currentNode.getLastChild()); } // end while // set the...
03587271-29fe-4523-b881-8d9741689e15
3
public static boolean writePropertiesFile(String ipAddress, String user, String password, String filepath, String filename, String includeDate){ Properties prop = new Properties(); OutputStream output = null; try { output = new FileOutputStream("Auto-DDWRT-Backup.properties"); // set th...
d16a3493-cd5d-461e-8919-5634d75b47ec
8
void stopTest() { log("Shutting down...."); if (m_responseQ != null) { if (m_responseQ != null) { log("Deactivating responseQ..."); m_responseQ.deactivate(); m_responseQ = null; } if (m_responseM...
5050c605-fd6a-4c54-9212-36190470b0ca
0
public String getAddress() { return address; }
5f23111c-b105-48c8-a5a1-dba4fb3e3750
2
public void run () { m_running = true; while (m_running) { synchronized(this) { executeQuieries(); } try { Thread.sleep(m_updateTime * 1000); } catch (InterruptedException e) { e.printStackTrace(); } } synchronized(this) { executeQuieries(); } }
a023ce82-b282-4457-bf7f-d901a4e0ad72
0
@Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub }
7208770d-f09e-425d-843e-d990b6ae8af2
2
@Override public String toString() { StringBuilder hex = new StringBuilder(); for(byte b : value) { String hexDigits = Integer.toHexString(b).toUpperCase(); if(hexDigits.length() == 1) { hex.append("0"); } hex.append(hexDigits).append(" "); } return "TAG_Byte_Array: " + hex.toString(); }
63ab1748-a8b0-4deb-a8e6-2060edc65f0a
5
public void update() { // update position getNextPosition(); checkTileMapCollision(); setPosition(xtemp, ytemp); // if it hits a wall, go other direction if(right && dx == 0) { right = false; left = true; facingRight = false; } else if(left && dx == 0) { right = true; left = fals...
4e299817-846f-4f35-849b-ef8cde2f4932
9
private Selector parseSelector() { Pair<List<SimpleSelector>, PseudoElementSelector> simpleSelectors = parseSimpleSelectors(); CompoundSelector compoundSelector = CompoundSelector.of(simpleSelectors.first); PseudoElementSelector pseudoElement = simpleSelectors.second; while (pseudoElemen...
56ac1404-1740-497d-883e-e423c6e20e45
7
public ListNode swapPairs(ListNode head) { if(head == null) return null; if(head.next == null) return head; ListNode result = head.next; ListNode p1 = head; ListNode p2 = head.next; while(p1 !=null && p2!=null){ ...
0b16c17e-6e37-4041-9ec9-e30b7a1695f5
4
private void drawMaze(Graphics g) { for (int y = 0; y < maze.getMazeRawData().length; y++) { MazeField[] mazeRow = maze.getMazeRawData()[y]; for (int x = 0; x < mazeRow.length; x++) { MazeField mazeField = mazeRow[x]; g.setColor((mazeField.toString().equals("E") ? Color.WHITE : Color.BLACK)); ...
3251a705-2292-4b3c-93ed-2fd8a127a646
5
@Override protected void setReaction(Message message) { try { String result; String messageText = message.text.trim(); switch(reactionId) { case 1: { String movieSearch = messageText.substring(messageText.indexOf(" ") +1); ...
5188593a-a35e-43fc-accc-2a57d78beec0
8
public void getRules(){ try { String messageFromServer = null; out.println(PLAYER_NAME_PREFIX+";"+me.getName()); while(me.getSymbol() == null || boardSize == 0 || winningSymNr == 0){ messageFromServer = getMessageFromServer(); if(messageFromServ...
3908fb07-04f3-4f39-a722-3a4ae1f1b817
2
public File getFile() { Object gotValue=getValue(); if(gotValue==null) return null; if(!gotValue.getClass().isAssignableFrom(File.class)) { throw new ClassCastException("don't know how to convert " +gotValue.getClass().getName()+" to File"); } ...
6c251c00-686a-4afd-9467-4cd38dc81ba6
8
public void draw(Graphics graphics, FontDAO fontDAO, ImageDAO imageDAO, TextDAO textDAO, ApplicationState applicationState, Metronome metronome) throws Exception { graphics.setColor(0x00000000); graphics.fillRect(0, 0,width(), height()); switch (applicationState.getState()) { ...
d597e91e-96ca-4d70-bc58-ea1b90affaa6
5
public void run() { double sign = _negated ? -1 : 1; double newSpeed = _controller.get() + sign*_rate * _period; if(Math.abs(newSpeed) < 0.15 && ((sign*_rate < 0) != (newSpeed < 0))) { _controller.set(0); } else if (newSpeed < _minSpeed) { ...
0cd2e03c-243b-4668-a9e5-3f1c55de4961
0
@Override public synchronized void mark(int readlimit) { this.mark = readlimit; }
aa9c1ddc-caad-46cd-8140-bb209365f1f9
0
public void setStudentId(int studentId) { this.studentId = studentId; }
e66226ac-6f03-4c9a-8cc6-295b44513842
9
private void insertComplete () { String completeString = "<Transform translation='0.0 0.0 0.0' rotation='0.0 0.0 0.0 0.0'>\n\t\t<Shape>\n\t\t\t<Box"; if (headerBlock.nameSelect.isSelected()) { if ((!headerBlock.objectName.getText().equals("")) && (!xSize.getText().equals("")) && (!ySize.getT...
9c886bec-ea3a-4be9-8d9b-b84c682b3d70
1
private void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (rootFilter != null) { rootFilter.doFilter(request, response); } RequestHelpe...
05c48032-21e6-4de1-aa41-4935d233e1fc
7
@Override public NodeVisitor child(String ns, String name) { if (name == null || name.isEmpty()) { System.err.println("Encountered a null or empty node name " + "in file " + layoutFile + ", skipping node..."); return null; } // Check for inclusions String tn...
87d6f89d-3938-41ce-81a8-768821bb042e
0
public String getRNC() { return RNC; }
d868cc7f-a5a5-479e-a44b-1d16d27f9fa2
0
public void addRule(String source, String dest, String kind, Integer seqNum, Boolean duplicate, String action) { this.rules.add(new Rule(source, dest, kind, seqNum, duplicate, action)); }
fd70f2c6-a34d-44ae-8002-f687801ce025
2
public void setDateLength(long len) { if (len < HAS_EXTEND_DATA) { this.payloadLen = (byte) len; this.payloadLenExtended = 0; this.payloadLenExtendedContinued = 0; } else if (len < 1 * Short.MAX_VALUE * 2) {// UNSIGNED this.payloadLen = HAS_EXTEND_DATA; this.payloadLenExtended = (short) len; this....
3f3b6269-6312-4efd-a4ef-fde7986ff430
8
public static List<DomElement> findAllDirectChildrenAndSelect(String html, String selector){ Matcher matcher = allTagFindPattern.matcher(html); int sequenceIndex = 0; Vector<Tag> tags = new Vector<Tag>(); while(matcher.find(sequenceIndex)){ Tag tag = new Tag(); tag.setTag(matcher.group(0)); tag.setTagN...
7737753f-7543-4a82-af81-869bbcd1c7b0
2
public void buildToolbar(){ final JMenuBar menubar = new JMenuBar(); JMenu display_menu = new JMenu("Display Options"); final JCheckBoxMenuItem view = new JCheckBoxMenuItem("Show Critter views"); view.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent arg0) { ...
75d0b385-914a-4b83-aa7a-893903084e57
0
@Override public boolean isDefault() { return defaultGroup; }
9be6572b-7691-4778-9d15-6b5b5b3f21fb
3
@Override public float getCusto() { // TODO Auto-generated method stub float cus; switch (marca) { case AMD: cus = 300; break; case INTEL: if(gab.getDescricao().contains("Intel")) cus = 288; else cus = 360; break; default: cus = 0; break; } return cus + gab.getCusto(); }
e07e4b1a-31b7-4310-9ff9-21707c2ede1e
6
public void forceByteCaching() { if (isCachingEnabled && !isCached) { try { // Create a writable file channel if (tempFile == null) { createTempFile(); } // create output stream in needed if (fileOutp...
3f285b30-7599-4c2b-9171-ebac84a3930f
8
public void draw() { background(0); this.frame.setTitle("Beijing Bus"); this.frame.setIconImage(icon); map.draw(); if (loadCnt > 0) { fill(255); rect(0, 0, width, height); shape(busLogo, width / 2 - width / 16f, height / 2 - 1.225f * width / 16, width / 8f, 1.225f * width / 8); loadCnt--;...
b0320e6d-d2b8-4b3d-8568-3d243fc828ce
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target=mob.location(); if(target==null) return false; if(target.fetchEffect(ID())!=null) { mob.tell(L("This place is already a blessed hearth.")); return false; } if(...
6ad22bb8-f32d-47b9-b96a-03a27a2878dc
0
public void setRequestMethod(Method requestMethod) { this.requestMethod = requestMethod; }
60d1d11c-de2d-4463-8f23-7212d3b9b6be
1
public void addEmails(String emails) { if (this.emails == null) { this.emails = new ArrayList<String>(); this.emails.add(emails); } else { this.emails.add(emails); } }
848e9aa5-004f-466b-9162-c445055f85d5
6
public void LinkInCognitiveGraph(){ //0.找到激活强度最高和次高的节点的激活级别,分别记为high和low //1.找到激活状态最高的节点,构建一个和它相同的GraphNode //2.找到激活状态次高的节点,将刚刚完成的GraphNote连接到它的队尾 //3.构建一个和激活状态次高的节点相同的节点,连接它到激活状态最高的节点的后面 //0 int low=GetCurrentSecondHighActivatedNodeAL(); int high=GetCurrentMostHighActivatedNodeAL(); int GraphSize=C...
dabdbe33-74f1-422b-9790-9d11e02500e7
7
private void setBaseEncoding(String baseencoding) { if (baseencoding == null) { encodingName = "none"; return; } else if (baseencoding.equals("StandardEncoding")) { encodingName = "StandardEncoding"; encoding = Encoding.getStandard(); } else if (ba...
3e9dc8c5-db76-4208-9d7d-eb3a2eb2c64d
8
@SuppressWarnings("unused") private void create() { //créé un villageois /** if(this.compteur > (this.env.getLongueur() * this.env.getLargeur()) && this.compteur > 100) //la limite du compteur dépend de la taille du terrain, min 100 this.perdu = true; Tu veux faire perdre le forum s'il ne trouve pas de ressource? ...
6010781d-c8e2-46de-a129-7dd191e187de
2
public boolean executeDBScripts(File file, Statement stmt) throws IOException,SQLException { boolean isScriptExecuted = false; try { BufferedReader in = new BufferedReader(new FileReader(file)); String str; StringBuffer sb = new StringBuffer(); while ((str = in.readLine()) != null) { sb.append(str +...
969d8473-6ddd-4f73-b8c7-354bbc5cd826
6
public static GsAlbum[] parseAlbums(String data,Gs parent) { Pattern re=Pattern.compile("\\{result:\\[(.*)\\}"); Matcher m=re.matcher(data); GsAlbum[] res=new GsAlbum[1]; if(!m.find()) { res[0]=null; return res; } String realData=m.group(1); int size=0; int pos=0; for(;;) { int start=realD...
cd3d7bf3-3eb6-4914-9d96-d5efacc1a3a3
8
public static void checkAccuracyRealFFT_1D() { System.out.println("Checking accuracy of 1D real FFT..."); for (int i = 0; i < sizes1D.length; i++) { DoubleFFT_1D fft = new DoubleFFT_1D(sizes1D[i]); double err = 0.0; double[] a = new double[sizes1D[i]]; IOU...
8cc23e4e-fe43-4e80-9289-870e9f8683a9
9
@Override public boolean importData(TransferHandler.TransferSupport info) { GlobalLogger.getLogger().logp(Level.INFO, this.getClass().getName(), "importData", "importData called."); if (!info.isDrop()) { return false; } // We need to get the drop location DropLocation dl = info.getDropLocation();...
709e0c6f-1a1a-485c-a2ba-1c79299acf7e
0
void up(int velocity) { }
27f7117c-0aac-49da-b85a-4d847f4965c9
4
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { dx = -1; } if (key == KeyEvent.VK_RIGHT) { dx = 1; } if (key == KeyEvent.VK_UP) { dy = -1; } if (key == KeyEvent.VK_DOWN)...
407a65b1-91e3-43c5-bab8-1ca02b7eddbb
8
private boolean checkGuestForDoubleBooking(ArrayList<Booking> oldBookingList, Booking newBooking) { boolean doubleBooking = false; Date newCheckInDate = newBooking.getCheckInDate(); Date newCheckOutDate = newBooking.getCheckOutDate(); int i = 0; while (doubleBooking == false && o...
a93cefd0-0815-4880-bc5d-746415139e1c
3
private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okActionPerformed boolean t = false; try { service.startClient(); t = true; }catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(this, "connex...
80436a2c-f6a3-4b03-9962-5f42e589055e
2
private void sort() { // skip sorting nonunique attributes if(this.sorted || !this.getProperty().getIsUniqueAttribute()) return; Collections.sort(this.results); this.sorted=true; }
302302d4-aaff-452a-8c8d-013fbca36754
6
public double rank(Deck deck) { // long startTime = System.currentTimeMillis(); // int count = 0; int wins = 0; int ties = 0; int losses = 0; for (int i = 0; i < deck.size(); ++i) { for (int j = i + 1; j < deck.size(); ++j) { for (int k = j + 1; k < deck.size(); ++k) { for (int l = k + 1; l < deck...
0763f436-5b72-4fca-982b-af777a9efda4
3
@Override public void deleteMedType(MedTypeDTO medType) throws SQLException { Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.delete(medType); session.getTransaction().commit(...
30b2e3c0-dd12-4294-b184-7ed3ae47648c
3
public EncryptableObject decrypt(Key key) throws Exception{ String Algrithem; if(key instanceof PrivateKey){Algrithem = "RSA";} else{Algrithem = "AES";} if(encrypted == null) {System.out.println("NULL");return null;} Cipher decrypt = Cipher.getInstance(Algrithem); decrypt.init(Cipher.DECRYPT_MODE, key); ...
22a2bd86-3e15-4cbb-a41d-4af9f91c13b6
9
private static final String escape(final String rawText) { // defer initialization of a StringBuffer until we know we need one StringBuffer buffer = null; for (int i = 0; i < rawText.length(); i++) { char c = rawText.charAt(i); switch (c) { case CommandManager.PARAMETER_START_CHAR: case CommandMana...
9096ae3a-4832-4c9b-9698-5808d19f5f9a
0
public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext( "context/aopContext.xml"); Service1 service = ctx.getBean(Service1.class); service.doIt("hoge"); }
1a5771c3-c4a6-40b3-82dc-cc4ff256e0a4
1
private void renderInfos(){ if(!renderInfos)return; Font.render("FPS: " + Game.FPS, x + Game.SCREEN_WIDTH - 80, y + Game.SCREEN_HEIGHT - 15); Font.render("BGM: " + Options.BGVolume, x + Game.SCREEN_WIDTH - 80, y + Game.SCREEN_HEIGHT - 45); Font.render("FXM: " + Options.FXVolume, x + Game.SCREEN_WIDTH - 80, y...
f6e44956-a4d5-4eab-9e33-bb9bca2af41a
6
@MCCommand(cmds = { "list" }, usage = PORT_LIST) public boolean portList(Player p) { Collection<PlayerPort> ports = pc.getPlayerPortals(p); if (ports == null || ports.isEmpty()) { return sendMessage(p, "&eNo portals were found"); } HashMap<World, List<PlayerPort>> wmap = new HashMap<World, List<PlayerPor...
20f322be-dc3b-4c62-ad24-d74a557b125e
6
public void adjustmentValueChanged (AdjustmentEvent e) { if (e.getSource() == Vertical) { switch (e.getAdjustmentType()) { case AdjustmentEvent.UNIT_INCREMENT: TD.verticalUp(); break; case AdjustmentEvent.UNIT_DECREMENT: TD.verticalDown(); break; case AdjustmentEvent.BLOCK_INC...
3f014008-8178-41ae-97b1-f9bea71c37a2
8
public MimeConverter(CWConfig config) { converters = new Hashtable<MIMEType,Class<? extends HTTPOutputConverter>>(); requestStats = new Hashtable<Class<? extends HTTPOutputConverter>, RequestStats>(); for(final String mimeTypeName : config.getFileConverts().keySet()) { final MIMEType mimeType=MIMEType.All.g...
ffba47e1-fc65-452d-a4f5-8ae407740d7f
6
private ArrayList<Integer> generateActions(LongBoard state) { ArrayList<Integer> result = new ArrayList<Integer>(); int middle = x/2; //TODO choose random when x is even if (state.isPlayable(middle)) { result.add(middle); } for (int i=1; i <= x/2; i++) { ...
f3b4b116-1abe-423d-b493-28999cd66611
2
private int parseAnswer(String line) { int questionAnswer = Integer.parseInt(line); if ((questionAnswer < 1) || (questionAnswer > 16)) { throw new IllegalArgumentException(); } return questionAnswer; }
8693994d-d5dc-4a78-aa37-de831e6506ca
3
public void activePlayerDoAction(Action actionToDo) throws InvalidActionException { if (actionToDo == null) throw new IllegalArgumentException("Action can't be null!"); actionToDo.doAction(getActivePlayer()); if (actionToDo instanceof EndTurnAction) activePlayerEndTurn(); else if (getActivePlayer().g...
8cc3ab74-ffc6-47bf-b33c-0b8423628545
3
public static void print(TreeNode root) { if (null != root) { System.out.println(root.val + "[" + (null == root.left ? "null" : root.left.val) + "," + (null == root.right ? "null" : root.right.val) + "]"); print(root.left); print(root.right); } }
b6eb2792-62ad-4bbc-8d3a-da19db4f4da4
9
@Override public void actionPerformed(ActionEvent a) { if (a.getActionCommand().equals("close")) { System.exit(0); } else if (automaton == null) { setError("Es ist noch keine Simulation ausgewählt."); return; } else if (a.getActionCommand().equals("step")) { simulator.step(); } else if (a.g...
f3b0825b-c34a-4942-8bbd-bd7b7dc91e63
4
private boolean isClear(int direction) { Coordinate c = getWallCoordinate(direction); switch (direction) { case Display.NORTH: case Display.SOUTH: return !WorldBackend.getCurrent() .checkWall(c.x, c.y, Display.HORIZONTAL); case Display.EAST: case Display.WEST: default: return !Wor...
5aa0f061-3588-4f2b-9cd5-9fea9f7f568f
6
private static long memusagerss() { long rss = -1; try { Reader fr = new FileReader("/proc/self/status"); LineNumberReader lnr = new LineNumberReader(fr); String line; while ((line = lnr.readLine()) != null) { int idx = line.indexOf(':'); if (idx < 0) continue; St...
b68936a8-c55a-432e-8795-da147594fd52
9
public T openForRead() { Transaction me = Transaction.getLocal(); switch (me.getStatus()) { case ACTIVE: Locator locator = this.locator.get(); if (me == locator.owner) { return locator.current; } Locator newLocator = new Locator(me)...
adacc4ec-cc81-4282-b095-f930e1615644
1
public ImportanceTest() { Data d; try { d = Reader.getDataFromFile(new File("files/restaurant.arff")); System.out.println("Importance function:"); System.out.println("B(0.99) = " + Importance.B(0.99)); System.out.println("Gain(Patrons) = " + Importance.importance("Pat", d.getExamples(), d.ge...
9c9d0e2e-6b10-4d7a-89cf-a23338fcee71
1
protected void sendContentLengthHeaderIfNotAlreadyPresent(PrintWriter pw, Map<String, String> header, int size) { if (!headerAlreadySent(header, "content-length")) { pw.print("Content-Length: "+ size +"\r\n"); } }
83959d7a-8325-4c6d-9eef-07c80cd6da19
4
public static boolean performLogin(String uname, String pword) { //Set username and password if (uname != null) AccountName = uname; if (pword != null) Password = pword; //Initialize request and result objects YggdrasilRequest request = new YggdrasilRequest(Acco...
01910c59-94d5-4f0b-aeee-43be05533903
5
@Override public Vector2D calculateGravity(double elapsedTime) { LinkedList<Sprite>sprites = parent.getParent().parent.getMap().getSprites(); Vector2D force = new Vector2D(0,0); for(int i = 0; i < sprites.size(); i++){ // Add all sprites that are planets if(sprites.get(i) instanceof Planet){ Planet p = (P...
64f60456-a543-40c9-bc58-05a2062fff07
6
public static String lihtneSundmus() { String tekst = ""; if (Math.random() < lihtsaSundmuseVoimalus) { int sundmus = random(0, lihtsadSundmused.length - 1); tekst = lihtsadSundmused[sundmus][0]; String tyyp = lihtsadSundmused[sundmus][1]; int arv = Integer.parseInt(lihtsadSundmused[sundmus][2]); arv...
9e6d8eda-c636-4f20-85fe-61aa3b5ca864
1
private static String getStringFromDocument(Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); ...
7d6d03ed-5358-41f1-bd2d-9c4ae20d8c77
3
private void updatePurchasableCards() { for(Component component : purchasable.getComponents()) { if(component instanceof PurchasableCardPanel) { if(((PurchasableCardPanel) component).getData().isInMortgage()) { ((PurchasableCardPanel) component) .setBorder(BorderFactory.createLineBorder(new Color(2...
1ed29c90-b375-4163-ba05-1a5aab620cca
6
void telecharger(String ip, int port, String key, boolean [] masque) throws UnknownServiceException, CharConversionException { int i = 0 , max; String reponse = "", question = ""; List<String[]> reponse_partielle; boolean bool; Fichier file = (Fichier)_hash.get(key); while (i < masque.length) { reponse = ...
14ee96d1-2db7-4d77-9d2f-f8e0e770cb3a
8
public static void getBids(PlayerModel playerModel[], PlayerDecider player[], int dealerIndex, int redScore, int blueScore, MellowServerMiddleMan middleMan) { int prevBids[] = new int[4]; int currentPreviousBid[]; int currentBid; int indexPlayerAction; int numChances = 0; for(int i=0; i<4; i+...
1c8cb3a6-e2f8-4fc0-9c85-b7ecd58d6592
2
public static void cadastrarEvento() { Evento evento = new Evento(); Secao secao = new Secao(); EventoService eventoservice = new EventoServiceImpl(); SecaoService secaoservice = new SecaoServiceImpl(); IngressoService ingressoservice = new IngressoServiceImpl(); ...
c99db66c-f134-46d1-9324-7b262e0dd8ba
3
public static double points_for_enemy(int fieldID, int ID) { if (BrickGame.bricks.size() == 1) { return 0; } double points = 0; for (int i = 0; i < BrickGame.bricks.size(); i++) { if (i != ID) { points = points + BrickGame.bricks.get(ID).distance_from_enemy * getManhattanDistance(listFie...
edc2c40b-7a61-490b-be02-46a6dcf47100
8
private void btnNewFolderActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnNewFolderActionPerformed {//GEN-HEADEREND:event_btnNewFolderActionPerformed String thename = JOptionPane.showInputDialog(this, "Enter the name of the new folder:", "WiiExplorer", JOptionPane.QUESTION_MESSAGE); ...
4533e759-4f5d-40c5-8fc9-4708e4aae1fe
5
@Override public void run() { InetAddress ia = null; try { ia = InetAddress.getByName("localhost"); } catch (UnknownHostException e2) { e2.printStackTrace(); } try (DatagramSocket dSocket = new DatagramSocket();) { try { String command = "Date:"; byte buffer[] = null; buffer = command....
8484cf28-aade-406e-b54a-e1fc40b8d600
4
private void results() { if (p1.getHP() < 0) { p1.setHP(0); } if (p2.getHP() < 0) { p2.setHP(0); } game.updateP1(getPlayerStats(p1) + getPlayerSkills(p1)); game.updateP2(getPlayerStats(p2) + getPlayerSkills(p2)); game.removeSkills(); if (p1.isAlive()) { states.setPlayerOneWin...
9f07103e-ef42-46f6-9ccb-dec790e6cdc9
5
private void addListeners() { reciever.addListener("/input", new OSCListener() { @Override public void acceptMessage(Date time, OSCMessage message) { System.out.println((String)message.getArguments()[0]); } }); reciever.addListener("/gridinput", new OSCListener() { @Override public void acceptM...
bf41a03c-8bac-4be4-84de-c7302a206213
0
public static void main(String[] args) { new GUI(); }
f31a17ba-b132-405b-b3ab-8a925b6892bc
0
public void remove(int n) { this.filled-=elements.get(n).getValue(); this.elements.remove(n); }
a606b384-ed2f-49b5-a02c-6494e546876f
1
public AnnotationVisitor visitParameterAnnotation( int parameter, String desc, boolean visible) { AnnotationVisitor av = mv.visitParameterAnnotation(parameter, remapper.mapDesc(desc), visible); return av == null ? av : new RemappingAnnotationAd...
ac77a245-91ac-4489-a424-d4036bc61adc
3
static public String toHanyuPinyinString(String str, HanyuPinyinOutputFormat outputFormat, String seperater) throws BadHanyuPinyinOutputFormatCombination { StringBuffer resultPinyinStrBuf = new StringBuffer(); for (int i = 0; i < str.length(); i++) { Str...
44d4ef38-0e8b-4b6c-aa6e-959351ca1dfd
5
public void generateHelper(List<String> result, String s, int left, int right) { if (left > right) { return; } if (left == 0 && right == 0) { result.add(s); return; } if (left > 0) { generateHelper(result, s + "(", left - 1, right...
a432ec6d-5e2f-4d82-b968-664ef30f34a1
2
public void increasePrice(int percentage) { List<Product> products = productDao.getProductList(); if (products != null) { for (Product product : products) { double newPrice = product.getPrice().doubleValue() * (100 + percentage) / 100; product.setPrice(newPrice); productDao.saveProd...
2fbf2a6c-492c-47e7-ab16-0ed74c839bcd
1
public void write(char[] b, int off, int len) throws IOException { if (!initialized) { area.setText(""); initialized = true; } // /#ifdef AWT10 // / area.appendText(new String(b, off, len)); // /#else area.append(new String(b, off, len)); // /#endif }
f39a28b0-024e-496a-a025-4b34d1454a3c
1
@Override public void run() { while(countDown-- > 0) { System.out.print(status()); Thread.yield(); } }
5f5d52b9-ab33-4024-aa7a-7813b8cc8991
6
public static ArrayList <IngredientData> loadData() { File load = new File("resources/files/IngredientData/"); Gson loader = new Gson(); ArrayList <IngredientData> res = new ArrayList <IngredientData>(); for (File f : load.listFiles()) { BufferedReader br = null; try { br = new BufferedReader(new FileReader(...
b6d1f2d8-97c7-46d5-984a-907dedaf4edc
5
@EventHandler public void closeTable(PlayerMoveEvent e) { Player p = e.getPlayer(); String name = p.getName(); if (Casino.plugin.getDataHandler().getUserList().contains(name)) for (BlackjackTable t : Casino.plugin.getDataHandler().getTableList()) { if ((!t.getInUse()) || (!t.getUser().equals(name)...
b71d1ad7-9de0-40dc-bcfc-e15e514240b0
7
public static void main(String[] args){ System.out.println(0xFFFF); System.out.println(0_345_345); System.out.println(0B1111_1111_1101); int[][] arr = new int[4][4]; for(int i = 0; i<arr.length; i++) for(int j = 0; j<arr[i].length; j++) arr[i][j]= (i!=...