method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8dddfbd8-5939-42d1-be25-3794687653e6
7
private boolean mpChecker(LinkedList<String>left,LinkedList<String>middle, LinkedList<String>consequent) { /* * assume (a=>b) * assume ((a=>b)=>(b=>c)) * mp 1 2 (b=>c) * * */ LinkedList<String> fullExpression; LinkedList<String> predicate; if (left.size() > middle.size()) { fullExpres...
a4457bb7-8ed6-4f31-9603-4d3f86e7b331
4
public boolean isLeftDiverse(Node node) { if (node.leaves.size() == 0 || node.leaves.get(0) == 1) { return true; } char temp = input.charAt(node.leaves.get(0) - 2); for (int i = 1; i < node.leaves.size(); i++) { if (temp != input.charAt(node.leaves.get(i) - 2)) { // Sy...
b86a3871-ecf9-45d0-858d-5b117f0e444c
1
public static Item getItemTester(String name){ // get item Item item = ItemStorageInventory.create().getItemfromStorage(name); if(item != null) System.out.println("you just get "+ item + " from item list \n"); else System.out.println("getting "+ item + " failed\n"); return item; }
4f1e44ea-a8e1-4342-ae1d-e566e97743e2
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
e4d1146d-732c-445a-a132-1847cec6d71a
5
private static void doDir(File f, ClassLoader cl) { final String name = f.getPath(); System.out.println("SourceUtils.doDir(): " + name); if (!f.exists()) { throw new IllegalStateException(name + " does not exist"); } if (f.isFile()) { final String className = f.getPath().substring(1+startPath.length());...
1995b3bb-e9b9-47aa-8889-5cdb07b85418
1
public int getWidth() { Window window = device.getFullScreenWindow(); if (window != null) { return window.getWidth(); } else { return 0; } }
6c8c4ce7-3e7a-44f7-8cb4-7362e3185c20
0
public void mouseReleased(MouseEvent e) { }
2c666473-9ba1-4286-b7ef-bb88169722db
8
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("setImagePath")) { JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter1 = new FileNameExtensionFilter("Image files", "png", "jpeg", "jpg", "bmp"); chooser.addChoosableFileFilter(filter1); ...
fc796354-d86b-491e-8cda-e2f21a5bf0fc
6
public void actionPerformed(ActionEvent evt) { JButton bouton = (JButton) evt.getSource() ; String texte = bouton.getText() ; if (texte.equals(BTN_RETOUR)) modelePanneau.setChoix(MENU_PRINCIPAL); if (texte.equals(BTN_FACILE)) { difficulteChoisi = DIFF_FACILE; Facade.getInstance(new Jeu(new Config...
ce217d1d-4858-4979-8d50-bed932ac6e00
4
public boolean validateInput() { int i = 0, j = 0; for(i = 0; i < 9; i++) { for(j = 0; j < 9; j++) { try { if(Integer.parseInt(entries[i][j].getText()) < 1) { return false; } } catch (NumberFormatException e) ...
b93a3545-e451-4075-aa14-6c4a57452a52
5
public void Refresh(CellVariable[][] cells) throws ContradictionException { System.out.println("begin refresh"); solver.clear(); solver.read(model); System.out.println("model read"); for(int x = 0; x < sudokuSize; x++) { for(int y = 0; y < sudokuSize; y++) { if(cells[x][y].current != -1 && !cells...
cbd388e2-91b6-4791-969b-577221d923d7
1
public int getPages(int intRegsPerPag, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception { int pages; try { oMysql.conexion(enumTipoConexion); pages = oMysql.getPages("backlog", intRegsPerPag, alFilter, hmOrder); oMysql.desconexion(); ...
5109baec-850b-4758-93b1-44a27dbd93a5
6
private void compileArgumentsList() throws ParseException, IOException { //empty arguments list if ((tokenizer.tokenType() == Tokenizer.SYMBOL) && (tokenizer.symbol() == ')')) { return; } do { // <data-type> Type type = compileDataType(); // <argument-name> if (tokenizer.tokenType() !=...
cf010c0b-20e3-41a2-9542-df726c14074d
6
public N getHigherNode(T payLoad) { N p = m_root; while (p != null) { int cmp = compare(payLoad, p.getPayload()); if (cmp < 0) { if (p.getLeft() != null) p = p.getLeft(); else return p; } else { if (p.getRight() != null) ...
9b4c0b6d-c6b5-47ab-bb2e-8204f533f991
2
public static JSONObject toJSONObject(String string) throws JSONException { JSONObject jo = new JSONObject(); XMLTokener x = new XMLTokener(string); while (x.more() && x.skipPast("<")) { parse(x, jo, null); } return jo; }
d413ab94-7662-4cf0-b65a-929d55d4a02b
2
@Override public void doRound(Game game){ Iterator<Player> it = game.getPlayerList().iterator(); Player player1 = it.next(); Player player2 = it.next(); int roll1 = player1.doRoll(); int roll2 = player2.doRoll(); if(roll1>roll2){ roll1=roll2-2; ...
acea31ab-f3ae-4f12-9ce0-ceadfc9529e4
9
private boolean lataaPelaaja() { String[] pelaajat = PelaajatIO.haeLadattavatPelaajat(); if (pelaajat == null || pelaajat.length == 0) { System.out.println("Ei ladattavia pelaajia."); return false; } System.out.println("\nLadattavat pelaajat:"); for (Strin...
4c674c2d-8a70-4c76-bb24-4b37a257bc81
0
@Override public void initialize(URL url, ResourceBundle rb) { udpflood = new UDPFlood(); }
a83dcee4-b314-445a-85bc-5193913ba1f4
8
public void setLocation(Location newLocation) { // If either the add or remove involves a colony, call the // colony-specific routine... Colony oldColony = (location instanceof WorkLocation) ? this.getColony() : null; Colony newColony = (newLocation instanceof WorkLocation) ...
b7c347a7-a0b5-4c68-9ae4-1701b2356c58
2
public static int unsignedShort (byte[] byteArray, int selector, int byteOrdering) { // byteOrdering tells how bytes are stored // selector should always point to lowest byte position of range // local vars int a = 0 ; // case out on the storage scheme switch (byteOrdering) { case HI_TO_LO: /...
242a40f2-25ab-4349-95f0-133eda536ea6
1
private void calculateNextRandomDirection() { int newDirection = randomGenerator.nextInt(4); while (!isAValidDirection(newDirection)) { newDirection = (newDirection + 1) % 4; } setDirection(newDirection); }
776e8167-0c95-4cda-b8b8-a8375002cecb
7
private void eliminarTarea(String titulo) { int indice; switch (jCBEstado.getSelectedIndex()) { case 1: indice = buscarTarea(this.proyectos.get(index).getProximo(), titulo); if (indice != -1) { this.proyectos.get(index).getProximo().remove(...
aa22f7df-ef77-40e1-93da-f10c29b548c1
1
public void nextMove() { if (exitDelay > 0) { exitDelay--; return; } progress(PIXELS); nextPhotogram(); }
573b1911-c742-456d-b6b2-66270af3e27b
1
private Set<SootClass> collectAllInterfaces(SootClass sootClass) { Set<SootClass> interfaces = new HashSet<SootClass>(sootClass.getInterfaces()); for (SootClass i : sootClass.getInterfaces()) interfaces.addAll(collectAllInterfaces(i)); return interfaces; }
56f953ce-c192-404c-bf62-dbfb03774a03
4
private static byte[] parseBase64Binary(String str) { // strict parser, must have length divisble by 4 if (str.length() % 4 != 0) { throw new IllegalArgumentException("Invalid Base64 string"); } // base64Str has 65 characters, with '=' at the end which is masked away ...
1d534d0d-dfe0-4b10-b8be-3cc6f89e0754
9
public void createIndexArff(String in, ArrayList<Integer> years) { String result = ""; int instances = 0; result += "@RELATION " + in + "\r\n"; result += "@ATTRIBUTE day NUMERIC " + "\r\n"; result += "@ATTRIBUTE djia NUMERIC " + "\r\n"; result += "@ATTRIBUTE nasdaq NUMER...
290cadb4-be8f-462a-9eca-f057a0d76321
7
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filterop...
e4b07bc2-8c75-48de-8084-a95cfe9047ac
1
private void getStayHotelCollection(AbstractDao dao, List<Direction> directions) throws DaoException { for (Direction dir : directions) { Criteria crit = new Criteria(); crit.addParam(DAO_ID_DIRECTION, dir.getIdDirection()); List<DirectionStayHotel> stays = dao.findDirectionS...
f368d15d-24fc-4029-80ee-34fe8871cc23
3
public ReturnObject get(int i) { ReturnObjectImpl returnValue = new ReturnObjectImpl(); if (i < 0 || i >= size()) { returnValue.value = ErrorMessage.INDEX_OUT_OF_BOUNDS; return returnValue; } if (nextElement.index == i) { returnValue.value = nextElement.value; return returnValue; } else { retu...
a1715c68-d682-4da0-97ea-0ba639e3ebd6
2
protected String runProgramGetResp (List<String> args) throws IOException, InterruptedException { logger.entering(getClass().getName(), "runProgramGetResp", args); String response = ""; ProcessBuilder procBuilder = new ProcessBuilder(args); Process proc = procBuilder...
2fe931c8-a936-4ace-b7e7-30a6f1f040d3
1
@Override public void performAction() { if(!started) { performActionStartup(); } else { unit.addX(pathSegment.getDir().x); unit.addY(pathSegment.getDir().y); } }
5f56e843-6e78-465f-9e4e-d9cea74790b9
7
public void generateUpdatedEntries() { _modifiedEntries.clear(); HashSet<String> newEntries = new HashSet<String>(); for (int i = 0; i < 5; i++) { OrderEntry orderEntry = null; int action = _random.nextInt(100); if (_orderEntries.size() == 0 || ...
9d1b273e-08c6-4377-999f-e2eae9c20add
3
public boolean isLambdaTransition(Transition transition) { PDATransition trans = (PDATransition) transition; String input = trans.getInputToRead(); String toPop = trans.getStringToPop(); String toPush = trans.getStringToPush(); if (input.equals(LAMBDA) && toPop.equals(LAMBDA) && toPush.equals(LAMBDA)) ...
69ce30d0-d3f1-42de-b64e-88c03dfe336f
3
public long overlap(Interval interval) { long millis = 0; for (Interval i : this) { Interval match = interval.overlap(i); if (match != null && match.toDurationMillis() > 0) { millis += match.toDurationMillis(); } } return millis; ...
afa507ed-d3cf-4b8c-bf25-25a2c6eb691b
9
protected boolean generateNext(){ int[] actors = getActors(); // if not yet initialized do it if (actors == null){ actors = new int[ actorLength ]; actors[actorLength - 1] = 1; setActors(actors); return true; } // move onto the next scenario, which is greater than the previous by 1 else{ i...
750f4e9b-02c9-481d-ae37-8cf6d60ee1b8
6
private String replaceHexWithNames(String line) { int indexOfhash = line.indexOf("#"); if (line.length() >= 7 && indexOfhash != -1 && indexOfhash + 7 <= line.length()) { String colorHex = line.substring(indexOfhash + 1, indexOfhash + 7); int endOfHex = -1; if (colorHex.matches("[a-fA-F0-9][a-fA-F0-9][a-fA...
a9d5c556-cfcf-4e64-8577-26fccd869c2f
0
public int size() { return size; }
4a9df8c8-103d-4492-a6f8-f39bcf97fb0d
4
public byte[] decompress(HuffmanTree tree, int uncompressedLength, Byte[] byteArray) { System.out.println("Decompressing Byte[]."); System.out.println("Compressed Message ByteCount: " + byteArray.length); // For each byte, // Get each byte's value from the huffman tree. // Compose the new values. List<B...
2d3e0df5-1921-41d6-944e-83c8fa853cf8
7
static final Class348_Sub41 method2661(int i, int i_0_, int i_1_, boolean bool, int i_2_) { if (i_2_ != 2) method2661(31, -43, 32, true, -110); anInt4189++; Class348_Sub41 class348_sub41 = new Class348_Sub41(); ((Class348_Sub41) class348_sub41).anInt7050 = i; ((Class348_Sub41) class348_sub41).anInt705...
87e960fd-4108-439d-8a84-14e124391cf6
2
public static File createTestTempFileOrDir(File parent, String name, boolean dir) throws IOException { File f = new File(parent, name); f.deleteOnExit(); if (dir && !f.mkdirs()) { throw new IOException("디렉토리를 생성할 수 없습니다: " + f); } return f; }
1a5db293-a9e2-42ad-9824-e859ef65c945
0
@RequestMapping(value = "/room-event-picture-list/{roomEventId}", method = RequestMethod.GET) @ResponseBody public CreativeMaterialListResponse roomEventPictureList( @PathVariable(value = "roomEventId") final String roomEventIdStr ) { return typedCreativeMaterialList(roomEventIdStr, Crea...
93ccbf17-692d-4ae0-a372-b026ed892300
4
public Vector<Move> commuteNextMove ( ) { final Vector<Move> moves = new Vector<Move> ( ) ; /* * Go through each square on the board and if it is blank get the words from * it by going though each word in the dictionary and getting the up and * down words from it. */ for ( int i = 0 ; i ...
c262f876-2d77-4cc4-80e4-c294f682a08d
1
@Override public void updateLong() { super.updateLong(); if (inventory.getUsedSlots() == 0) { isDirty = true; } }
1ff84fb0-48d8-43cb-9211-12712c62b080
1
public static Dimension extractDimension(String buffer) { int[] values = extractIntegers(buffer); if (values.length == 2) { return new Dimension(values[0], values[1]); } return null; }
e3916e9e-3c7e-4010-9859-92aff3968017
8
public StringBuffer showWhoShort(MOB who, int[] colWidths) { final StringBuffer msg=new StringBuffer(""); msg.append("["); if(!CMSecurity.isDisabled(CMSecurity.DisFlag.RACES)) { if(who.charStats().getCurrentClass().raceless()) msg.append(CMStrings.padRight(" ",colWidths[0])+" "); else msg.append(...
36a12ebb-4d90-40a5-bb99-56deb41cd1f6
8
public int getPageNumber(PDFObject page) throws IOException { if (page.getType() == PDFObject.ARRAY) { page = page.getAt(0); } // now we've got a page. Make sure. PDFObject typeObj = page.getDictRef("Type"); if (typeObj == null || !typeObj.getStringValue().equals("P...
e0a88e92-6400-4d86-96fc-72992e115dce
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; LinhaVenda other = (LinhaVenda) obj; if (id != other.id) return false; return true; }
8c0ad96d-dfa2-4c0d-a516-05219daaf75f
0
public final T getInTestLinkListener() { return inTestLinkListener; }
be8c39f9-8bc2-4f35-a2d6-c7fe80f31c70
7
protected void _upload( BlobInfo bi, String tag ) throws ServerError, IOException { if( bi instanceof FileInfo ) { transferTracker.sendingFile( ((FileInfo)bi).getPath() ); } InputStream is = bi.openInputStream(); try { URL url = urlFor(bi.getUrn()); if( inducePutErrors ) { throw new ServerEr...
2a10d750-ca12-467f-bf95-67614ea1d278
9
public static void main(String[] args) { if (args.length != 2) { System.out.println("Usage: CopyFile source target"); return; } String sourceName = args[0]; String targetName = args[1]; FileReader sourceFile = null; FileWriter targetFile = null; Scanner source = null; try { sourceFi...
4aa50adf-d049-46f7-b5f6-0b2704a40041
9
public void send(final byte[] frame, final boolean waitForCon) throws KNXPortClosedException, KNXAckTimeoutException, InterruptedException { final boolean group = (frame[3] & 0x80) == 0x80; KNXAddress dst = null; if (group) { dst = new GroupAddress(new byte[] { frame[6], frame[7] }); addresses.add(dst); ...
3c23e507-a68c-4421-b6f3-b6f4ffec8e2d
3
public static String removeStart(String str, String remove) { if (isEmpty(str) || isEmpty(remove)) { return str; } if (str.startsWith(remove)) { return str.substring(remove.length()); } return str; }
43b00fd2-1e90-4fa8-9212-30b1968ebb5d
4
public <A extends Appendable> A appendTo(A appendable, Iterator<?> parts) { try { if (parts.hasNext()) { appendable.append(toString(parts.next())); while (parts.hasNext()) { appendable.append(separator); appendable.append(toStri...
80cf7dc5-45c5-4fbd-b26a-8e4cc0d86638
1
@Override public void render(Art art, Level level) { if (!collected) { frame++; frame %= (4 * 6); art.drawTile(art.spriteSheet, getX(), getY(), 13 + frame / 6, 8); } }
c8582631-f196-4de4-ae9c-85c045e176a5
2
private void thresholdEdges() { for (int i = 0; i < picsize; i++) { data[i] = data[i] > 0 ? -1 : 0xff000000; } }
03288c36-2ba6-499f-9b9e-3b80bf998f06
6
private void generateInitialRooms() { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { // create north walls rooms[i][j] = new Room(i, j); if (i == 0) { rooms[i][j].north = new Wall(rooms[i][j]); ...
11ecb680-607b-4e80-b055-e5caf79057c8
4
public void handleImmediateReservation(ARObject obj, int senderID, int sendTag) { // check whether the requested PE is sufficient to handle or not if (obj.getNumPE() > super.totalPE_) { super.replyCreateReservation(senderID, sendTag, NOT...
cc8bafdd-d74b-4a61-986e-a8d55e23f9fa
3
private void moveOnY(Vector<Integer> ans, int xDis, int yDis){ if (yDis >= 0){ ans.add(0); if (xDis >= 0){ ans.add(1); ans.add(2); ans.add(3); } else { ans.add(3); ans.add(2); ans.add(1); } } else { ans.add(2); if (xDis >= 0){ ans.add(1); ans.add(0); ans.ad...
1cefe32e-644e-42dd-8332-8fb4a714f2ce
5
public Date getLetzteZahlung() { if (letztezahlung == null) { Date d = null; for (Rechnung r : rechnungCollection) { if (r.getEingang() != null) { if (d == null) { d = r.getEingang(); } else { ...
215fc6ee-6cb3-40ce-b84b-6e941f7b6945
9
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[57]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 0; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
c710fe35-38de-4555-87cb-e24b678c3ea0
3
@SuppressWarnings("unchecked") public ListTag<? extends Tag> getList(String name) { if (!tags.containsKey(name)) return new ListTag<Tag>(name); return (ListTag<? extends Tag>) tags.get(name); }
428755af-bd98-425d-8373-93237929c7d4
2
public static boolean controlDirectory(Path p) { return ((p != null) && Files.exists(p, LinkOption.NOFOLLOW_LINKS) && Files.isDirectory(p, LinkOption.NOFOLLOW_LINKS)); }
bbe6b5f2-43bf-407d-ba50-04ce3d06f562
8
public static void calc(int[] input, int pivot) { int index = -1; int countl = 0; int countr = 0; for (int i = 0; i < input.length; i++) { if (input[i] == pivot) { index = i; } } HashSet<Integer> hs = new HashSet<Integer>(); int j = 0; int k = index + 1; while (j < index) { if (input[j] ...
7ff4f3b6-e466-4eae-b896-dbcc5966dded
9
public void frechetProbabilityPlot(){ this.lastMethod = 7; // Check for suffient data points this.frechetNumberOfParameters = 3; if(this.numberOfDataPoints<4)throw new IllegalArgumentException("There must be at least four data points - preferably considerably more"); ...
c6fc0d97-ab36-481f-8c8e-e8244d0d17bb
5
public Object getField(Reference ref, Object obj) throws InterpreterException { if (isWhite(ref)) return super.getField(ref, obj); FieldIdentifier fi = (FieldIdentifier) Main.getClassBundle() .getIdentifier(ref); if (fi != null && !fi.isNotConstant()) { Object result = fi.getConstant(); if (curren...
c50d3071-9332-4e65-a32d-5b261abfbdf7
2
@Override public double distribute(TVC newCon) { Random r = new Random(); Firewall[] firewalls = environment.getFirewalls(); // forget about all links and redistribute connections from scratch for (TVC c : environment.getConnectionsSortedUp()) { int managerFirewallId = r.nextBoolean() ? c.getFir...
fb1d9f21-6443-412d-88b1-f6e75e97ef6e
6
private void checkStatusActive(Integer adresse, Integer value) { if(adresse == 0x03 || adresse == 0x83){ String logstring = "[Aktive Beeinträchtigung des Statusregisters]: "; //CARRY if( (value & 0x01) == 0x01){ //Carrybit manuell gesetzt status.setBit(bits.C); PIC_Logger.logger.info(logstrin...
4aeebe28-e4e5-43a2-8dfe-99c2d9f931b3
2
public void render(int x , int y , int startX , int startY , Graphics g) { if(preMode) { diary.draw(); } else { if(music.playing() == false) music.loop(); map.render(0, 0 , startX + x , startY + y , 100 , 100); g.drawString(" " + (float)((timer - elapsedTime) / 1000), 350 , 25); } }
4ae61d70-951c-4a7c-a5cb-1a03f507b641
2
public void add(Object o) throws PropertyException { if (o instanceof Event) addEvent((Event)o); else if (o instanceof Note) addNote((Note)o); else throw new PropertyException("Unable to add object of type " + o.getClass().getName() + " to a Family"); }
864413c7-f5a1-421f-a1c3-9442e5079031
1
private int choiceLeft() { if (round == 0) return nplayers - getIndex()- npassed+1; else return nplayers - npassed+2; }
37994fa8-52df-42c8-a865-ec7822078095
9
public int filterRow(byte[] currRow, byte[] prevRow, byte[][] scratchRows, int bytesPerRow, int bytesPerPixel) { int[] filterBadness = new int[5]; for (int i = 0; i < 5; i++) { filterBadness[i...
f9e73699-f1c7-4e37-ac56-fb5c7a37f20a
5
private boolean checkUpRight(int _row, int _column, int _player) { boolean keepGoing = true; int nbAligned = 0; while (keepGoing == true && nbAligned < nbToAlign) { if (_row - nbAligned < 0 || _column + nbAligned >= column) { keepGoing = false; } else if (gameGrid[_row - nbAligned][_colum...
ff2a1c5b-def9-4673-8561-12bcccbcf22d
6
private int checkDiagonal(byte[][] arr, int startIndex, int mark) { int countOfEmptyField = 0; int countOfBusyField = 0; int emptyIndex = -1; int j; for (int i = 0; i < arr.length; i++) { if (startIndex == 0) { j = i; } else { ...
02f12989-058e-4a65-9696-0d006b0edd97
1
public synchronized void InsertArticle(String name, String author, String years, String url, String introduction) { String insert_article = "INSERT INTO zhangyu_sca.article (name, author, years , url , introduction) values ( '" + name + "','" + author + "' , '" + years + "','" + url + "','" + introduction + "' ...
15840a7c-d414-4aab-9049-231fccd02e6b
8
public static boolean checkDungeonBounds(RoomReference reference, Room[][] map, Room room) { if (reference.getX() == 0 && room.hasWestDoor()) return false; if (reference.getX() == map.length - 1 && room.hasEastDoor()) return false; if (reference.getY() == 0 && room.hasSouthDoor()) return false; if (...
21a86dc0-3fd1-48cb-b273-75d4e27878d4
9
@Override public void init(String[] players, int fieldWidth, int fieldHeight) throws IllegalArgumentException, WrongArgumentException { if(players == null || players.length < 2 || fieldWidth < 5 || fieldHeight < 5 || fieldWidth > 15 || fieldHeight > 15){ throw new IllegalArgumentException("check input arguments: ...
181d230c-21dc-4f20-8165-733f24c34b9e
2
public TreeNode buildTree(int[] inorder, int[] postorder) { if(inorder.length == 0 && postorder.length == 0) return null; TreeNode node = buildTreeRec(inorder, postorder, 0, inorder.length-1, 0, postorder.length-1); return node; }
e104ee8d-5b01-4119-ab55-76db075d7d32
8
public void onKeyPressed(KeyEvent e) { switch (e.getKeyCode()) { case VK_UP: case VK_W: directions.add(Direction.UP); break; case VK_DOWN: case VK_S: directions.add(Direction.DOWN); break; case VK_RIGHT: case VK_D: directions.add(Direction.RIGHT); break; case VK_LEFT: case VK_A: ...
c4b00c0e-5963-40a1-b909-ea5d1aa9c750
2
@Override public NepticalData getData() { Location location = getLocation(); DataModule moduleContext = NSpaceManager.getSpace(location.context()); List<NepticalData> data = moduleContext.getDataAt(location.fragment()); if (data.isEmpty()) { return NepticalData.NULL_DATA; } if (location instanceof C...
f55f3d80-8483-44a8-a20f-fa0dad5a3de0
6
private void startNextSong() { EIError.debugMsg("startNextSong"); if(playList != null && !stopping) { if(currentSongIndex < playList.size()) { lastSong = playList.get(currentSongIndex); } else { lastSong = null; } GameSong g...
9c261710-a10b-4e80-95bb-762b74dbd31e
1
public void deletePlayerFromPlayers(String userName){ try { cs = con.prepareCall("{call DELETE_PLAYER_FROM_PLAYER(?)}"); cs.setString(1, userName); cs.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
517cc1a3-bd05-4080-bca9-5dfcc582abbe
2
public void forward(String ip, String message) { if (active) { Iterator<Service> it = services.iterator(); Service service; while (it.hasNext()) { service = it.next(); service.pushMessage(ip, message); } } }
51d2e441-58f4-4d90-874e-c253198dcd58
1
@Override public int hashCode() { int result = personId; result = 31 * result + (accountNumber != null ? accountNumber.hashCode() : 0); return result; }
9dfa9537-b19a-4dcc-9603-c1cfea7754e4
5
@Override public List<Integer> sort(List<Integer> list) { // checking input parameter for null if (list == null) { throw new IllegalArgumentException("ArrayList not specified!"); } int i, j, increment, temp, arraySize = list.size(); // moving forward through ar...
c79d398f-a880-4a5d-86cc-24c4ebab2c08
7
public Vector<String> findPath() throws ActorNotFoundException, EmptyQueueException { //Check that the actor to start from exists. if(actors.containsKey(startingNode)){ q.enqueue(actors.get(startingNode)); actors.get(startingNode).setVisited(true); } else { throw new ActorNotFoundException("There is n...
8da86cf3-45aa-485f-bbf3-1dd708be8a38
9
public int saveOrder(ArrayList<Order> order, Connection con) throws SQLException { int rowsInserted = 0; int tal = 0; String SQLString1 = "insert into ordre values(?,?,?)"; String SQLString2 = "insert into ordreDetails values(?,?,?,?,?)"; String SQLString3 = "select ordreseq.nex...
5d660bd9-d759-4664-9384-f878c184468f
6
public List<GeoIPv4Adress> parse(File file) throws IOException, XMLStreamException { FileInputStream in = new FileInputStream(file); XMLEventReader eventReader = factory.createXMLEventReader(in); while(eventReader.hasNext()) { XMLEvent xmlEvent = eventReader.nextEvent(); switch(xmlEvent.ge...
36510752-95fe-43e5-b9d8-105b1046b370
0
private String parseHTML(int dId) { String result = ""; _logger.debug("Filetype = HTML"); MySqlDatabaseHelper databaseHelper = new MySqlDatabaseHelper(); result = (new SourceLoader().loadURL(databaseHelper.loadDocumentURL(dId))); return result; }
1c21d6d1-c282-4066-876c-1d2fb94ad920
0
@Override public int hashCode() { return (username.hashCode() << 5) - 1; }
efe878f2-971f-481f-a73e-3d18e29aa03e
9
private void renderSprite(double xDiff, double yDiff, double zDiff, int tex, int color) { double xc = (xDiff - x) * 2 - rotXZSin * 0.2; double zc = (zDiff - z) * 2 - rotXZCos * 0.2; double yc = (yDiff - y) * 2 - rotYSin * 5; double zz = zc * rotXZCos + xc * rotXZSin; if(zz < 0.1){ return; } do...
54787f34-4a02-4a9d-95b7-f78592fb2834
9
public static void printMatrixInSpiral(int [][] input) { int leftTop = 0; int rightTop = input[0].length; int leftBottom = -1; int rightBottom = input.length; int i=0; int j=0; int count =0; while(count<input.length * input[0].length){ while(true){ ...
70600688-15d7-4b59-80b1-459a840ec6e9
4
public void grabTexture(int var1, boolean var2) { int var3; if((var3 = this.getSlot(var1)) >= 0) { this.selected = var3; } else { if(var2 && var1 > 0 && SessionData.allowedBlocks.contains(Block.blocks[var1])) { this.replaceSlot(Block.blocks[var1]); } } ...
5af84432-a4ab-4cae-8d6c-1c9cbcb505b2
3
static Element getElementByTagNameNR(Element e, String tagName) { Node child = e.getFirstChild(); while (child != null) { if (child instanceof Element && child.getNodeName().equals(tagName)) return (Element) child; child = child.getNextSibling(); } return null; }
bccd69ce-c127-46e2-8107-a4577e9e5124
4
final public boolean replaceChild(Construct child, Construct newCon) { List<Construct> childConstructs = new LinkedList<Construct>(); getAllChildConstructs(childConstructs, child); // Do the construct replacement here, if the replacement // is successful, then we need to cleanup all editors related // to c...
d2be3d9a-b13a-4b2d-8dd5-e306e12a8761
7
protected void readImage() { ix = readShort(); // (sub)image position & size iy = readShort(); iw = readShort(); ih = readShort(); int packed = read(); lctFlag = (packed & 0x80) != 0; // 1 - local color table flag interlace = (packed & 0x40) != 0; // 2 - interlace flag // 3 - s...
08902ace-0fc7-4b34-9dc6-9ffd2a3f9fbf
9
public AddNewChunkDialog(KlangEditor parent, Chunk curChunk) { super(parent); this.setModalityType(ModalityType.APPLICATION_MODAL); this.setResizable(false); this.setTitle(KlangConstants.KLANGEDITOR_ADDNEWCHUNKDIALOG_TITLE); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); pnlContent = ne...
a44d233f-d404-4f8e-93e2-df09126d4429
1
public ScaledQuantity(double value, Unit unit) { super(value, unit); if(!Temperature.class.isInstance(unit)) { throw new RuntimeException("Cannot create ArithmeticQuantity with unit " + unit); } }
ef92e190-98cf-48fc-962e-18460bd89327
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (obj.getClass() == this.getClass()) { Matrix m = (Matrix) obj; for (int i = 0; i < m.rows; i++) { for (int j = 0; j < m.columns; j++) { if (this.getElement(j, i) != m.get...
6266130e-fa9e-4aef-9201-3570697e7d49
7
public void loadModels() { ModelList.SortedListModel dataModel = ((ModelList.SortedListModel) m_ModelList.getModel()); int directoryCount = 0; int modelCount = 0; dataModel.clear(); File directory = m_Library.getWorkingDirectory(); File subDirectories[] = directory.listFiles(...
3ba0fd0b-9525-4123-bd4c-5f8313c0368a
8
@Test public void testGetDescriptionSecondPhone() { Map<String, Object> descriptionSecondPhone = new HashMap<String, Object>(); descriptionSecondPhone.put("name", "Cink Five"); descriptionSecondPhone.put("brandName", "Wiko"); descriptionSecondPhone.put("screenSize", 5); descriptionSecondPhone.put("screenType...