method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d418061b-c983-434d-b07e-6e343084ecb3
9
private int decideNextBlockColor(ThreesBlock nowBlock,int whiteCount,int blueCount,int redCount,int maxNumber) { int nowNumber = -1; if(nowBlock != null){ nowNumber = nowBlock.getNumber(); } int[] weights = {5, 5, 5}; //weights for white, blue and red, default for equals. ...
4874c9b0-a2a0-4e2b-882d-d9f9155c0d44
9
final void subTree( final PhylogenyNode node ) { if ( getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) { JOptionPane.showMessageDialog( this, "Cannot get a sub/super tree in unrooted display", "Atte...
0177006e-1bf9-44be-8bc0-7275bd37a3d1
6
public final DccChat dccSendChatRequest(String nick, int timeout) { DccChat chat = null; try { ServerSocket ss = null; int[] ports = getDccPorts(); if (ports == null) { // Use any free port. ss = new ServerSocket(0); ...
546b78fd-6901-468d-bfea-6f06352a9aea
8
public static MiniCompound getEmipiricalFormula(Element[] elements, double[] percents) { //divide each percentage by the atomic weight of each corresponding element double lowest = 1000; for(int i = 0; i < percents.length; i++) { percents[i] /= elements[i].getMass(); if(percents[i] < lowest) lowest =...
dfed9f64-52c2-40b4-b84f-013db0499698
2
public static FareClassFacilityEnumeration fromValue(String v) { for (FareClassFacilityEnumeration c: FareClassFacilityEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
f532741e-3590-4c0a-9e1b-142179a15ee7
1
public void setNumOfRows(int numOfRows){ if (numOfRows <= MAX_ROWS) { this.numOfRows = numOfRows; }else { this.numOfRows = MAX_ROWS; } }
644de085-f3b3-4d9c-8bd9-4cc110dcdd3f
8
@Override public int attack(NPC npc, Entity target) { final NPCCombatDefinitions defs = npc.getCombatDefinitions(); int distanceX = target.getX() - npc.getX(); int distanceY = target.getY() - npc.getY(); boolean distant = false; int size = npc.getSize(); Familiar familiar = (Familiar) npc; boolean usingS...
60efd64d-fc49-4b82-b4b1-35639cecfc33
5
private boolean versionCheck(String title) { if (this.type != UpdateType.NO_VERSION_CHECK) { final String version = this.plugin.getDescription().getVersion(); if (title.split(" v").length == 2) { final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the newest file's version number if...
ca603aaa-9a01-48ac-9601-94fd8dab4201
3
private boolean jj_3R_20() { if (jj_3R_22()) return true; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_23()) { jj_scanpos = xsp; break; } } return false; }
e820c0a4-6d21-4042-bd21-46a5fbf5d64d
3
private static boolean login(){ if (users.size() > 0){ Prints.printWithColor("YELLOW","Usuario: "); String user = rd.next(); Usuarios buscar = searchUser(user); if (buscar != null){ Prints.printWithColor("YELLOW","Contraseña: "); St...
35561f19-91b1-4bb4-b1f1-eea32e323909
9
public static void APUtil(int u, boolean[][] edge, boolean[] visited, int[] disc, int[] low, int[] parent, boolean[] ap, int time) { int children = 0; visited[u]=true; time++; disc[u]=low[u]=time; int v=0; for(v=0;v<edge[u].length;v++) { if(edge[u][v]) { if(!visited[v]) { children++; ...
58a689ff-942a-4477-86de-28a985eb728d
3
public String getCyclopeptideSequence() { String cyclopeptideSequence = ""; List<String> highscore = new ArrayList(); List<List<Object>> leaderboard = new ArrayList(); this.stringPeptideList.add(""); while (!this.stringPeptideList.isEmpty()) { highscore = copy(this.st...
6cc474d9-d19e-4aba-a7cc-df7023fcc3ca
4
public void exportAsHTML() throws IOException{ out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\">"); out.write("<head><title>iXport iPhone SMS</title>"); out.write("<style type=\"text...
2fde258d-8949-437c-8059-8b32886bd9a1
0
public Double getHeight() { return height; }
e5a5c458-e5c2-47ab-b07a-2d4d8fbefaf5
7
private void doListen() { // listening port and create connection while(isActive()) { try { Socket socket = listener.accept(); if (socket != null) { // create connection ISocketServerConnection sc = new SocketServerConnection(socket, getNextIdConnection()); ...
6bae8954-9e1d-4aed-b313-01b939dc3428
2
public void mouseDragged(MouseEvent e){ if(dragging){ e.getComponent().setBounds(new Rectangle(startBounds.x+e.getLocationOnScreen().x-startPoint.x, startBounds.y+e.getLocationOnScreen().y-startPoint.y, startBounds.width, startBounds.height)); if(e.getComponent() instanceof JC...
3050a2ed-9bdd-4001-a11a-bb33b0875b34
1
public Key max() { if (isEmpty()) throw new java.util.NoSuchElementException(); return pq[1]; }
3400896c-ef77-43f6-b693-4f607f4e3eca
6
public void processDirectory(String path) throws Exception { ReccorridoBicisFileParser parser = new ReccorridoBicisFileParser(); File directory = new File(path); if (directory.exists()){ File[] files = directory.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].getName().contains(".zip...
ec94541f-fe9a-4042-8ef9-3b0f3ec5007f
4
public static <T> Json asArray(JsonObjectConverter<T> converter, T... objects) { final Json json = Json.newArray(); if (objects == null || objects.length == 0) { return json; } Iterator<T> iterator = Arrays.asList(objects).iterator(); while (iterator.ha...
dca10ffd-5d4e-4adb-90c2-1787a4971c57
6
private double calculateMass() { double mass = 0; Group c_terminal = this.peptide.getCTerminalGroup(); Group n_terminal = this.peptide.getNTerminalGroup(); List<AminoAcid> acidList = this.peptide.getAminoAcids(); for (AminoAcid acid : acidList) { mass += acid.getMono...
82e0c77e-b323-4335-b93a-ef31ea358358
6
private void search(int i,int target,int[] cand, ArrayList<Integer> tmp,ArrayList<ArrayList<Integer>> rst) { if (cand[i] > target) return; if (cand[i] == target) { ArrayList<Integer> element = new ArrayList<Integer>(); element.addAll(tmp); element.add(cand[i]); rst.add(element); return; } i...
0384d053-de87-40fd-9cc6-74f1fedabd34
7
public static void main(String args[]) throws Exception { boolean shortOutputs = MainCodeGen.shortOutputs; PseuCoParser parser = null; if (args.length >= 1) { if (!shortOutputs) { System.out.println("file: " + args[0...
86268699-c614-4e1d-a721-e4ff180aa026
9
private void testAbstractMethods(ByteMatcher matcher) { // test methods from abstract superclass assertEquals("length is one", 1, matcher.length()); assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0)); try { matcher.getMatcherForPositio...
2f4ef829-b97f-4829-ad7e-fb5843add60f
8
private void addEdgeToARG(Node child, List<ARGNode> argNodes, List<Edge> edges, int rangeMin, int rangeMax) throws FileParseException { if (child.getNodeName().equalsIgnoreCase(XML_EDGE)) { String sourceID = getAttributeForNode(child, XML_SOURCE); String targetID = getAttributeForNode(child, XML_TARGET); Str...
2b9c1564-e027-44b8-a171-44ca17aefd25
6
private boolean isBSTValid() { if (isNil()) { return true; } else { if (hasLeftChild() && getKey() < getLeftChild().getKey()) { return false; } else if (hasRightChild() && getKey() > getRightChild().getKe...
fd51281c-ceed-44a1-a1bd-74b43b58b2e6
1
public void setMatchLoaded(int gameID, int userID, boolean matchLoaded) { gameIDtoGame.get(gameID).setMatchLoaded(userID, matchLoaded); ArrayList<Integer> runningGames = userIDtoRunningGameID.get(userID); if(runningGames == null){ runningGames = new ArrayList<>(); } runningGames.add(gameID); userIDtoRunn...
1c5c2ad4-3c14-4033-9dca-484b13d4a0b5
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SalesHeader other = (SalesHeader) obj; if (idOrder == null) { if (other.idOrder != null) return false; } else if (!idOrder.equals(other....
c19cf32f-562c-4846-b2fb-6192eb6f041d
7
public void setOptions(String[] options) throws Exception { // Other options String minNumString = Utils.getOption('M', options); if (minNumString.length() != 0) { m_minNumObj = Integer.parseInt(minNumString); } else { m_minNumObj = 2; } m_binarySplits = Utils.getFlag('B', options)...
1edc11ea-fd76-465a-98f7-63181af73d98
3
public String[] equipmentDataParser (String equipment) { /* Need to break out into another class and clean up the return*/ StringBuilder itemName = new StringBuilder(); String[] parts = new String[2]; String[] parsedEquipmentData = equipment.split("[ ]+"); for (int i = 0; i < parsedEquipmentData.length...
0b1a9cf6-898e-4232-afa3-05a3af076556
9
private void connectAt( int x, int y, boolean constructing ){ ConnectionableCapability nextTargetItem = getTargetCapability( x, y ); ConnectionArray nextTargetArray = null; if( nextTargetItem != null ){ ConnectionFlavor flavor = factory.getFlavor(); nextTargetArray = nextTargetItem.getTargetArray( x, y, fla...
b36ec9b1-25ed-4fda-9930-930f7746f066
1
public long getTotalElapsedTime() { long elapsed; if (running) { elapsed = (System.currentTimeMillis() - startTime); elapsed +=totalTime; } else { elapsed = totalTime; } return elapsed; }
9989f12d-e338-41d9-a147-88b065958217
2
private static void myprinti(IntSeq i) { IntSeqIt ii = new IntSeqIt(i); while( ii.hasNext() ) { try { System.out.print(ii.next() + " "); } catch (UsingIteratorPastEndException e) { System.out.println("myprinti oops! caught UsingIteratorPastEndExcepti...
01db9771-573c-40a0-bac7-d3924ce2dd18
9
void run(){ Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); int M = sc.nextInt(); int[] c = new int[n]; int[][] p = new int[n][3]; for(int i=0;i<n;i++){ sc.nextLine();sc.nextLine(); c[i] = sc.nextInt(); for(int j=0;j<3;j++)p[i][j] = sc.nextInt(); } in...
12a0ce03-c7d6-426c-bb6a-fa0079905b4d
5
@Test(expected = DAIllegalArgumentException.class) public void testInfixToPostfix13() throws DAIllegalArgumentException, DAIndexOutOfBoundsException, ShouldNotBeHereException, BadNextValueException, UnmatchingParenthesisException { try { infix.addLast("+"); infix.addLast("hello"); QueueInterface<Strin...
fc1c6928-e246-4471-8610-8f24c147f8df
1
public Object deserialize(YAML yamlAnnotation, Object containingObject, Method setterMethod, Field field, String yamlFieldName, Object yamlFieldValue) { if ("MODIFYME".equals(yamlFieldValue)) { return "MODIFIED"; } else { return yamlFieldValue; } }
d871d31f-2039-490c-af1d-fb457ce09539
6
public void testDiverseDocs() throws IOException { RAMDirectory dir = new RAMDirectory(); IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED); writer.setRAMBufferSizeMB(0.5); Random rand = newRandom(); for(int i=0;i<3;i++) { ...
4df830ec-ed7e-4b4c-acfc-5e5ed364d8a9
1
private void setFailedOrIgnoredForFailureOrAssumptionFailure(Failure failure, TestState testState) { setCurrentFailure(failure); final Xpp3Dom testCase = getCurrentTestCase(); testCase.addChild(createResult(testState)); final String message = failure.getMessage(); final Xpp3Dom n...
497050e1-73c9-49f5-b25a-3f7aeefbee83
4
public static void main(String[] args) { System.out.println(">WELCOME TO BLACKJACK, WHAT IS YOU NAME?:"); playerName = stringInput.nextLine(); playerName = playerName.toUpperCase(); try { System.out .println(">GENERATING RANDOM BANK TO PLAY WITH $(50 - 2000)..."); TimeUnit.MILLISECONDS.sleep(500); ...
eb700336-27ff-4121-aad3-13f82da02d22
0
public GregorianCalendar getDate(){ return date; }
b52045b3-f8ca-4789-b7e0-705f0d6fe595
8
public JSItem[] getItems(String... itemmasks) { ArrayList<JSItem> items = new ArrayList<JSItem>(); for (Widget i = wdg().child; i != null; i = i.next) { if (i instanceof Item) { Item buf = (Item) i; if (itemmasks.length > 0 && itemmasks[0].equals("")) ...
b1cb138a-8567-4a8c-979a-191f40cabfb1
5
@Override public synchronized void run() { // For commits jsContext = new StoppableContext(); jsContext.setGeneratingDebug(true); jsContext.setGeneratingSource(true); synchronized (scriptThreads) { scriptThreads.put(scriptInfo.scrUniq, this); } try { jsScope = jsContext.initStandardObjects(); lo...
fa5b21fd-069d-49eb-8e5a-165f88a2f4cc
7
public void sendPacket(int size){ // Print error messages if needed if(this.nic==null) System.err.println("The computer you are sending from does not have a NIC!"); if(trace) System.out.println("(Computer) Trace: sending packet from computer"); int bitsRemaining = size; boolean firstCell = true; ...
adc4ff66-8694-40a1-9944-480a6b2f7e20
3
public Waypoint getClosestWaypoint(Vector2 pos) { if (waypoints.size() > 0) { Waypoint start = waypoints.get(0); double min = pos.getDistance(start.drawX(), start.drawY()); for (Waypoint w : waypoints) { double tmp = pos.getDistance(w.drawX(), w.drawY()); if (tmp < min) { start = w; ...
78d01421-8dd5-48fc-8bbd-ce41ab9b669b
3
public static Units getUnitForName(String unitNameRequested) { Units unit = null; try { Statement s1 = conn.createStatement(); ResultSet rs = s1 .executeQuery("Exec getUnitData @unitName = '" + unitNameRequested + "'"); if (rs != null) { while (rs.next()) { String unitName = rs.getString...
e9a2ff3e-9bb7-4878-b3cf-b8e79484a797
6
private String whereDoIGo(String urlParameter, HttpServletRequest request){ // URL string to be returned String urlResult; // Check if parameter is null, ie, was not supplied if(urlParameter == null){ urlParameter = DirectorEnums.NO_VALUE.name(); // Assign name of enum to String. } // Convert p...
3b18a279-df97-4bd5-870f-7f8b41b97c3a
2
public static ChoiceCode fromString(String choiceCode) { for(ChoiceCode choice: values()) if(choice.name().equals(choiceCode)) return choice; return null; }
7b853af2-a4c0-4e57-b2eb-fed79e1aa005
0
public void setCantidad(Integer cantidad) { this.cantidad = cantidad; }
37255f54-1340-4e7e-a081-869501ba1e89
1
public void moveDownAndPlace(Board board) { if (!tryMove(board, Direction.DOWN)) { board.placeTetromino(); } }
3c44842f-1155-489e-b767-d8f13441ff92
3
static boolean validateType(String type) { boolean typeValidate = false; if (type.equalsIgnoreCase(Constants.RAW_ITEM) || type.equalsIgnoreCase(Constants.MANUFACTURED_ITEM) || type.equalsIgnoreCase(Constants.IMPORTED_ITEM)) { typeValidate = true; } else { System.out .println("incorrect Produc...
2b3ee888-a194-4a7d-9be1-13033ebe5e51
7
public final boolean equals(Object var1) { if(!(var1 instanceof MCHashEntry)) { return false; } else { MCHashEntry var2 = (MCHashEntry)var1; Integer var3 = Integer.valueOf(this.getHash()); Integer var4 = Integer.valueOf(var2.getHash()); if(var3 == var4 || var3 !=...
abef0227-b9b7-4060-a369-691034f28c7c
2
public void sendData(byte[] data) { try { datagram = new DatagramPacket(data, data.length, inetSocket); udpSocket.send(datagram); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace()...
a6267c55-db82-4ad5-9a94-88e5744c288e
2
public MapItem getMapItem(Point location){ for (MapItem item : this.getItems()){ if (item.getLocation().equals(location)){ System.out.println("number 1"); return item; } } return null; }
dee20ba9-3474-491d-962a-e72a49663feb
6
@Override public Document loadDocument(String path) { Document document = DocumentImp.getDocument(); try { FileReader fr = new FileReader(path); BufferedReader reader = new BufferedReader(fr); document.clear(); String line; while((line = reader.readLine())!=null && !line.startsWith("*")) ...
8399bb42-1d28-40e6-8cf4-6a55f63e830e
3
private static Position getPosition(String s) { Position ret = null; if ((s != null) && !s.equals("")) { try { ret = Position.valueOf(s.trim().toUpperCase()); } catch (IllegalArgumentException e) { ret = null; } } retu...
350275f6-24ff-4edc-bf8b-49f075f7f7ee
2
public Link shorterConnection(DijkstraNode node){//returns Link with less price between two nodes.Validates by the adjacence nodes. //checks th links of the param node and returns the weightless link of the node. List<Link> links_of_node=node.getData().getLinks(); Link link=null; int les...
d6bcc2bc-a3af-4a1f-aeba-ce4bd1a2053d
4
public boolean openArena() { if (this.bossspawn == null || this.playerspawn == null || this.ready == null || this.deathspawn == null) { plugin.sendtoserver(": " + this.arenaname + " δȫ!"); return false; } arenastate = ArenaState.STAT_OPEN; plugin.sendtoserver(" " + this.arenaname); return true; }
55522f76-d1e7-4266-9711-cde1a926b641
1
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: if (this.preparate()) { datacompiler = se.ReadXml(cbxFile.getSelectedItem().toString()); int[][] tableData = this.convert(datacompi...
05fd1b26-8753-4f33-8c94-45091ed5d44a
2
public int compare(Renderable r1, Renderable r2) { return (r1.getRenderPriority() > r2.getRenderPriority() ? -1 : (r1.getRenderPriority() == r2.getRenderPriority() ? 0 : 1)); }
c5a45e0e-ff6d-4f60-9d4f-dc7b84a5a3ad
9
private void btnInsertarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnInsertarActionPerformed String codigo,codigoM,codigoS,codigoE,codigoC,clave,estado; int dia,mes,año,costMovimiento,rpta; double saldo; GregorianCalendar fecha; codigo = txtCodigo.getText...
1b14d6c0-ecef-46b6-a7c4-a9b8f4697f26
4
void parseDHT(int marker) throws IOException { byte[] bytes = new byte[2]; mIs.read(bytes); int num = i16(bytes)-2; bytes = new byte[num]; mIs.read(bytes); if (verbose > 5) { System.out.print("DHT Data:"); for (int i...
8fc78fb8-d644-40a4-955c-336adfeff0b6
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://down...
e17a728d-67cb-4d9e-9770-dbbbed9a94c9
7
protected void initLevel3Tree( double cx, double cy, WorldUpdateBuilder ub ) { switch( rand.nextInt(4) ) { case( 0 ): // ring! double rad = 1024+rand.nextDouble()*2048; double cir = rad * 2 * Math.PI; int count = (int)(cir / 1500)+1; for( int i=0; i<count; ++i ) { addLevel3Cluster( cx+rad*Math.co...
efb19154-42fd-4999-afc0-97a09ba9443f
4
public static void setBounds(int x1, int x2, int y1, int y2) { if (x1 < 0) x1 = 0; if (y1 < 0) y1 = 0; if (x2 > width) x2 = width; if (y2 > height) y2 = height; startX = x1; startY = y1; endX = x2; endY = y2; centerX = endX; centerY = endX / 2; anInt1387 = endY / 2; }
da0b9d5e-b64b-494b-9709-f42a6b44c3a0
4
public String moveMessage() { if (selectedMessages2.length == 0) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "You have not selected messages to move")); return null; } if (selectedMessages2[0].getFolder() == endFolder.getId()) { FacesC...
5dc7cc8f-5871-4f9f-99d5-cd92ca0cbfdc
8
private void filter(KDTreeCell cell, ArrayList<FCECenter> candidates) { try { ArrayList<FCECenter> input = new ArrayList<>(); input.addAll(candidates); if (cell.isLeafNode() && !cell.isEmpty()) { Collections.sort(input, new CenterDistanceComparator(cell.getPoi...
43db063b-7e8a-40a3-a2df-bff4cd4f5e6e
4
@EventHandler(priority = EventPriority.LOWEST) public void tagMob(CreatureSpawnEvent e) { if (ExpListener.tagged == null) { tagged = new ArrayList<Entity>(); } /* * Fixed a arraylist bug sortof If both were off the mobs were tagged * but werent removed on death because if settings are false they dont ...
3b67583b-aed9-4d43-ad63-1b90e7f26a36
2
private static void printCnt() throws IOException { FileWriter writer = new FileWriter(new File("tweets-per-minute" + System.currentTimeMillis() + ".txt")); int prev = 0; int minutes = 1; while (true) { try { Thread.sleep(60000); System.out.println("Minute: " + minutes + ", Tweets: " + (Twe...
8e879a30-39a9-473b-8b03-be15777b3ee4
3
public static void main(String[] args) { File f = new File("E:\\JavaWorkSpace\\PsvdProject\\bmp\\00005.bmp"); if (f == null) { System.out.println("f==null"); } else { System.out.println(f); } try{ BufferedImage bi = ImageIO.read(f); ...
6609d76b-577d-408f-a4b9-844f3e254b7f
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://down...
130a4cf0-04c7-4c34-8242-18d4ff92c930
1
public String deconversionASCII(ArrayList<Integer> chaine) { String mot = ""; for(int i : chaine) { mot += tableAscii.get(i) +""; } return mot; }
3b12b378-c653-4b02-9ca7-b167a91b3c84
8
public List<StudentCatBean> fetchStudentCatMapping(String userid){ List<StudentCatBean> catMap = new ArrayList<StudentCatBean>(); ResultSet rs=null; Connection con=null; PreparedStatement ps=null; try{ String sql="SELECT cat.CATEGORY_NAME,map.s_cat_id,map.c_id,map.s_id,p.userId " + "FROM CATEGORY c...
b6e63aa8-ff8b-4769-85d0-070ef4359631
1
public void dropRiver(River river, javax.swing.TransferHandler.DropLocation dropLocation) { TripComponent tc = tripList.getSelectedValue(); if (tc == null) { tc = new TripComponent (MainWindow.tripDB.add ( targetDay.getTime() )); tripListModel.addElement (tc); } tc.getTrip().setRiver(river); updateGroup...
007047e2-c1e4-4fdd-a943-9661137d5de6
7
private int playFirstThrow(Player player, PlayerFrameHistory frame) { int score = -1; do { System.out.print("How much did you score, " + player.getName() + "? (Type 'exit' to interrupt the game)"); String input = scanner.nextLine(); if (input.equalsIgnoreCase("exit"))...
0c547b17-e80f-4f22-a274-9ffda772ec22
8
public final static void viewAllChar(SeekableLittleEndianAccessor slea, MapleClient c) { try { PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT world, id FROM characters WHERE accountid = ?"); ps.setInt(1, c.getAccID()); int charsNum = 0; ...
de54704f-ce96-4592-acd1-65408110b57a
7
public static ArrayList<Class> parseSchedule(String input) throws NoSuchElementException { ArrayList<Class> schedule = new ArrayList<Class>(); String[] classes = input.split(newline); for (String s : classes) { Class b = new Class(); Scanner scanner = new Scanner(s); if (!scanner.hasNextInt()) ...
9c9c1a9d-c9f3-4da1-9eb3-504f8061e551
2
public static HashMap<String,String> convertStringToHashMapFormat(String data) { try { HashMap<String,String> listData = new HashMap<>(); String[] tmp = data.split(";"); for(String s : tmp) { String[] t = s.split("~"); ...
a0c9b149-5338-4b8c-984c-e739de0db4b0
1
@Override public void readFromSave(DataTag tag) { super.readFromSave(tag); burnTime = tag.readInt("burntime"); setLit(tag.readInt("isLit") == 0 ? false : true); }
095d6b7d-d3ae-45a6-acd3-31ac62ddea6b
6
@Override public void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2 = (Graphics2D) g.create(); int cWidth = icon.getIconWidth() / 2; int cHeight = icon.getIconHeight() / 2; int xAdjustment = (icon.getIconWidth() % 2) == 0 ? 0 : -1; int yAdjustment = (icon.getIconHeight() % 2) == 0 ? 0 : -...
35ff8dd2-0efd-45b2-bf04-ef340c2282fd
9
public Matrix solve (Matrix B) { if (B.getRowDimension() != m) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } if (!this.isNonsingular()) { throw new RuntimeException("Matrix is singular."); } // Copy right hand side with pivoting int n...
d21f3d77-efe1-4cd0-a362-80cd3b646238
2
public void setElevator(Room elevator, Tile tileInElevator) { if(elevator != null) { this.elevator = elevator; if(player == null) player = new Player("Babak", 10, 2, 1, tileInElevator); } }
fdd9c57e-e969-470d-b0e5-d14eece9c85f
9
private void field_nro_clienteFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_nro_clienteFocusLost // TODO add your handling code here: habilitarConfirmar1(); boolean es_componente=false; if (evt.getOppositeComponent()!= field_punto_venta){ //voy a preguntar...
94422119-0ac4-42dc-a617-b5b6c2866d84
3
public void shareCapture() { try { HttpClient httpclient = new DefaultHttpClient(); HttpPost post = new HttpPost("http://imgshr.com/upload/send"); File file = File.createTempFile("scrcapt_", "_imgshr.png"); ImageIO.write(this.makeImage(), "png", file); MultipartEntity entity = new MultipartEnt...
7c2dd329-ff06-4e66-b803-2a956ad9a904
0
public SimulateNoClosureAction(Automaton automaton, Environment environment) { super(automaton, environment); putValue(NAME, "Step by State..."); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_R, MAIN_MENU_MASK + InputEvent.SHIFT_MASK)); }
4e348ff2-131f-499e-b5bd-21c540726c3b
2
public static String capitalizeFirstLetterOnly(String string){ char[] stringArray = string.toCharArray(); if(stringArray.length == 0){ return "-1"; } stringArray[0] = Character.toUpperCase(stringArray[0]); for (int x = 1;x <= stringArray.length - 1; x++){ stringArray[x] = Character.toLowerCase(string...
ea8993d0-6dd9-4308-9da2-0511f67c6f00
4
public boolean hasWon() { for (List<Card> pile : acePiles) { if (pile.size() != 12) { return false; } } for (List<Card> pile : kingPiles) { if (pile.size() != 13) { return false; } } return true; ...
303c2c72-9dd4-4a73-b038-ce0da442dea6
7
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); boolean divisible = false; if (m > 1 && k == 1) divisible = true; for (int j = 2; j <= Math.sqrt(m); j++) { ...
e5ea22e8-8cf4-4543-aab6-6062971a4030
8
public boolean simplifyStackVarsStatement(Statement stat, HashSet<Integer> setReorderedIfs, SSAConstructorSparseEx ssa, StructClass cl) { boolean res = false; if (stat.getExprents() == null) { boolean processClass14 = DecompilerContext.getOption(IFernflowerPreferences.DECOMPILE_CLASS_1_4); while...
04db4047-4fc8-49fd-81b7-3615fe4865b5
5
public void writeTypes(Collection<Object> types) { // A big ol' case statement in a for loop -- what's polymorphism mean, // again? // I really wish I could extend the base classes! for (Object type : types) { if (null == type) { continue; } // if the array at i is a type of array write a [ // ...
a1c7bf54-c62e-4318-b3f6-a33fb578d8b1
9
public static String jsonify(ICommandResult<IType> commandResult, HashMap<String, String> map) { if (commandResult==null || commandResult.getSize()==0) return("{}"); String [] columnsNames = commandResult.getArrayList().get(0).getColumNames(); StringBuilder result = new StringBuilder(); if (commandResult...
e533e9fd-2d50-4327-8744-8684e907797b
1
public Long getMaxRowID(String userName) { Object chatRoomMessagesMaxRowID; EntityManager em = PersistenceManager.createEntityManager(); try { chatRoomMessagesMaxRowID = em .createNamedQuery("Openchatroomsmessage.GetMaxRowId") .setParameter("u", userName) .getSingleResult(); } finally { em....
788e3e45-a270-4cbd-b516-a0e35fcb952f
6
public Element handle(FreeColServer server, Connection connection) { ServerPlayer serverPlayer = server.getPlayer(connection); Game game = server.getGame(); String errors = ""; for (TradeRoute tradeRoute : tradeRoutes) { if (tradeRoute.getId() == null || !hasPrefix(tradeRout...
db504108-ea80-4893-8bb9-e84f07a221fe
8
public static String extractLivingRoom(String sourceText) { String[] lines = sourceText.split("\n"); String result = ""; String[] rooms ; for (int i = 0; i < lines.length; i++) { // if ((lines[i].contains("Main F. ") || lines[i].contains("Below ") || lines[i].contains("Bsmt ")) && !lines[i].contains("Bsm...
32b4ed2d-8626-4b2c-98fa-878d1e409bd0
0
public TruncateHelper setBreakWordLongerThan(int breakWordLongerThan) { this._breakWordLongerThan = breakWordLongerThan; return this; }
4a20f626-572b-4685-8f82-fb5234fc5f21
4
public void solve() { Scanner in = new Scanner(System.in); int n = in.nextInt(); Prime p = new Prime(n); List<int[]> list = new ArrayList<int[]>(); for (int i = 3; i + 2 <= n; i += 2) { if (p.isPrime(i) && p.isPrime(i + 2)) { list.add(new int[]{2, i}); } } System.out.prin...
27ed5471-450b-43d8-a585-6a6f9b4bb4b1
9
public static int countDayInMonth(long month) { Date d = new Date(month); int monthIndex = d.getMonth(); int year = d.getYear(); switch(monthIndex) { case 0: case 2: case 4: case 6: case 7: case 9: case 11: return 31; case 1: return isLeapYear(year)?29:28; default: return 30; } }
827bc30f-261d-4e5e-b9d1-14b2580421d7
8
public JFileChooserTF(String[] textLabels, int[] inputMinValues, int[] inputMaxValues, int[] inputDefaultValues){ super(); if(textLabels ==null || inputMinValues==null || inputMaxValues==null || inputDefaultValues==null || textLabels.length!=inputMaxValues.length || textLabels.length!=inputMinValues.length||textLa...
59ca3f43-95f3-4c68-ae06-611e081f37f1
9
static boolean isWhitePiece(int i, int j) { if ((i < 0) || (j < 0)) { return true; } if ((i > 11) || (j > 11)) { return true; } return (board[i][j] == 'P') || (board[i][j] == 'T') || (board[i][j] == 'N') || (...
b546ace3-0a17-46dc-9be2-be7689bb2729
2
private void saveFile(String strFilePath, byte[] fileData) { try { FileOutputStream fos = new FileOutputStream(strFilePath); fos.write(fileData); fos.close(); } catch (FileNotFoundException ex) { System.out.println("FileNotFoundException : " + ex); } catch (IOException ioe) { System.out.println("IO...
ffb1c324-7df0-4b54-a3da-90333fc50a80
8
public Player(Socket inSocket, DuskEngine inEngine) { try { QUE_MSG = new FifoQueue(); SendThread st = new SendThread(this); THR_SEND = new Thread(st); THR_SEND.start(); bytObjType = (byte)0; Type = 0; Game = inEngine; ID = Game.getID(); SCK_CONN = inSocket; SCK_CONN.setSoTimeout(600000)...
62c8acd1-6c63-48fb-b474-c8a8837f79b5
5
@Test public void testMessageQueueSetTimeoutDisconnectEx() { LOGGER.log(Level.INFO, "----- STARTING TEST testMessageQueueSetTimeoutDisconnectEx -----"); boolean exception_other = false; String hash = ""; try { server1.setUseMessageQueues(true); } catch (TimeoutExc...