method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f8534ba4-485a-406c-9828-e6f183706f30
7
public String fixMessageString(String message, String loc) { if(message==null) return null; int x=message.indexOf("<DAMAGE>"); if(x<0) x=message.indexOf("<DAMAGES>"); if(x<0) return message; int y=Integer.MAX_VALUE; int which=-1; for(int i=0;i<TRANSLATE.length;i++) { final int y1=message.in...
4a84e189-c9d0-4bfd-bb62-349331d7ebdf
7
public String SelectTarget(){ Scanner targetin = new Scanner(System.in); String s; int i = 0; do{ if(i>0){ System.out.println("Ulangi pilihan role"); } System.out.println("...
236f4efc-5f13-40e2-85a2-97187379e48e
5
public void save() { card.setName(name.getText()); if(!powerType.getSelectedItem().equals("Power Type")) card.setPowerType((String)powerType.getSelectedItem()); if(!tier.getSelectedItem().equals("Tier")) card.setTier((String)tier.getSelectedItem()); if(!actionType.getSelectedItem().equals("Action Type")) card....
604bddf6-0968-4201-94a2-6bb26141162a
0
@Test public void testGetFoodCells() { System.out.println("getFoodCells"); World instance = new World(); instance.generateRandomContestWorld(); List expResult = new ArrayList<>(); List result = instance.getFoodCells(); assertEquals(expResult, result); }
effca091-46f5-4e79-bd5a-a3cb905a951e
0
public String getTytul() { return tytul; }
d01c409d-95f6-4cde-9053-2bedab7c475e
2
public double interpolate(double xx1, double xx2){ this.xx1 = xx1; this.xx2 = xx2; double[] yTempm = new double[this.nPoints]; for (int i=0;i<this.nPoints;i++){ yTempm[i]=this.csn[i].interpolate(xx2); } this.csm.resetData(x1,yTempm); this.interpolatedValue = thi...
304e4135-f7fd-490c-ad1c-a1079d4a1e88
7
@Override public int choosePivot(int[] array) { int firstIndex = 0; int middleIndex = getMiddleIndex(array); int lastIndex = array.length - 1; int first = array[0]; int middle = array[middleIndex]; int last = array[array.length - 1]; if (first < middle && first < last) { if (middle < last) { ret...
8f0318dc-1c1c-47b5-aaf8-1eae76e95669
9
private boolean checkMoveableQueue() { Moveable[] moveableQueue = GameObjectManager.getInstance().getMoveableQueue(); if(moveableQueue.length<= 0) return false; for(Moveable moveable : moveableQueue) { System.out.println(" collisionCandidates :"+moveable.getCollisionObjects().size()); List<SCollisi...
5df80020-e751-45db-97a5-027fa3c738f9
0
public void setProperty(boolean prop) {this.prop = prop;}
0a1f488a-b8de-4fbb-8479-5dfb45ba72d3
3
private boolean canMoveTwo() { //if a white pawn's y location is 1, or a black pawn's y location is 6, it can do a double move return myLocation.y==1&&isWhite||myLocation.y==6&&!isWhite; } // public String toString() // { // return "P"+getColor(); // }
ecbf6472-e7cb-41dd-964a-a878aa7e4bc8
3
public String inCar(String carID) { String msg=""; if(isFull()) { msg = "对不起,停车场已满!"; return msg; } if(carID.equals("")){ msg = "请输入你停的车的车牌号!"; return msg; } if(contain(new Ticket(carID))) { msg = "你要停的车已经停在我们的停车场里了!"; return msg; } Ticket ticket = in(new Car(carID)); msg= "OK,请记住...
f71745c1-9691-4f3c-9609-e82cbd957201
8
public boolean calculateMowersTask(int numOfMowers) { this.mowerTasks.clear(); int totalBlocks = this.getBlockCount(); if (numOfMowers != 0 && totalBlocks != 0) { if (totalBlocks < numOfMowers) { //we decide to let other mower idle as there is insufficient job for(int i=0;i<totalBlocks;i++) { ...
98ec7a2a-dbc5-41a7-8af8-cb156e6ad1d5
6
public static void stackCompare(BufferedImage img, boolean[][] checkedPixels, boolean[][] goodPixels, int baseColor, int x, int y) { // Bounds check if(x < 0 || x >= 8 || y < 0 || y >= 8) { return; } // If this has already been checked, then don't care if(checkedPixels[x][y]) { return; } // We are abou...
390c7549-a125-4ae6-b482-36b53447e99a
3
private void saveProperties(Properties properties) { OutputStream output = null; try { output = new FileOutputStream(getAppPropertiesFileName()); properties.store(output, "put comments here"); } catch (IOException io) { io.printStackTrace(); } f...
62b71725-9998-4535-85f5-6d39b86598d3
5
private void setSPA_Austin(String cityShopXML){ URL url=null; if (url_status){ try { url = new URL (urlStr + cityShopXML); ((GasDecisionProcess)decisionProcess).reset(url, cityShopXML); austinSearchPanel.appendText(">> Received the business XML file from the remote URL... \n" + ...
ca922716-4d22-4384-94bb-bfbe306c7f6b
3
public static String grayscale(final String file) throws ImageFormatException { if ((file == null) || !file.matches(".*\\.jpe?g")) { throw new IllegalArgumentException("file must be a picture."); } String[] fileWOext = file.split("\\.jpe?g"); Picture thisPic = new Picture(file); for (Pixel pixel : thisP...
4862725d-dc8a-4014-ba53-de991505f4ec
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...
09cf7a0b-fcba-476b-b2ee-3610479d8b16
1
private void _setDistance(int index) { index = index%_distances.length; if(index < 0) { index += _distances.length; } _currIndex = index; SmartDashboard.putString("Distance", _distances[index].getValue()); }
42c258b6-767c-46b4-ba8a-975dbde0d140
5
public void moveLines(int indexRows[], int direction){ if(indexRows.length <= 0) return; int firstIndex = indexRows[0]; int lastIndex = indexRows[indexRows.length-1]; if(direction == UP){ if(firstIndex == 0) return; rows.add(lastIndex, rows.remove(firstIndex-1))...
bb3064a1-4aba-4edd-b8ca-03514577abcc
2
public static void main(String[] args) { // for RandomForest System.out.println("for RandomForest"); String[] dataPaths = new String[]{"breast-cancer.data", "segment.data"}; for (String path : dataPaths) { DataSet dataset = new DataSet(path); // conduct 10-cv ...
d2862343-e43b-43d0-882c-1e6e28ecb022
6
public void update() { time++; int xa = 0; int ya = 0; Block b = blocks.get(0); if (input.keys[KeyEvent.VK_UP]) ya--; if (input.keys[KeyEvent.VK_DOWN]) ya++; if (input.keys[KeyEvent.VK_LEFT]) xa--; if (input.keys[KeyEvent.VK_RIGHT]) xa++; b.move(xa, ya, blocks); for (int i = 0; i < blocks.size(); i...
1ea59137-0093-4284-9f93-8e38b74c8746
2
@Override public URL getResource(final String string) { final File file = new File(this.dir, string); if (file.exists()) { try { return file.toURI().toURL(); } catch (MalformedURLException ex) {} } return null; ...
f92d87c4-676e-48dd-a64b-f9e8a2044d48
1
public void fpsSetter(){ try { Thread.sleep(fps / 1000); } catch (Exception e){ e.printStackTrace(); } }
77e16b06-20e4-4f7a-b321-a4214a075846
3
@Override public String toString() { return "IkszorObject " + "[encodedValue=" + encodedValue + "[" + (encodedValue != null ? encodedValue.length() : "null")+"]" + ", symmetricKey=" + symmetricKey + "[" + (symmetricKey != null ? symmetricKey.length() : "null")+"]" + ", decodedValue=" + decodedValue + "["...
2b0ab5fe-c69f-4880-9521-cda709549912
1
public Frame last() { if(i == 0) return(hist[hist.length - 1]); return(hist[i - 1]); }
b483f4ae-903f-4adf-818a-9151ef01fcb3
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String customername = request.getParameter("customername"); Strin...
55bcb87f-e3e7-4787-8c12-6a43c3e322bb
8
final public void ConditionalOrExpression() throws ParseException { Token t=null; ConditionalAndExpression(); label_7: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BOOL_OR: case BOOL_ORX: ; break; default: break label_7; } switch (...
6893f7ff-8318-4094-94f9-53c4da347a85
1
@Override public void update(long deltaMs) { super.update(deltaMs); if(!locsUpdated) { updateWeaponLocs(deltaMs); } }
5628ab9e-6971-45ea-8190-13f460ecac7c
8
public String validateDeviceInVehicle(long deviceid, long vehicleId) { String actionResult = ""; try { m_Connection = getDbConnection().getConnection(); m_Statement = m_Connection.createStatement(); m_ResultSet = m_Statement.executeQuery("select deviceid from vehicle ...
4b3f50d7-7198-4302-9278-bda5cdc03eb6
6
public static Board readBoard(Class<?extends Game> gameClass, BufferedReader in) throws IOException { HashMap<Location, Tile> tiles = null; String firstLine = in.readLine(); Scanner sin = new Scanner(firstLine); String validationStr = sin.next(); if(!validationStr.equals("MAP")) throw new IllegalArgumentEx...
5616701f-5371-45e6-ab1a-ec1123433888
8
public void run() { final byte[] buffer = new byte[4096]; try { short idle = 0; while (true) { final int bytesRead = m_in.read(buffer, 0, buffer.length); if (bytesRead == -1) { break; } if (bytesRead == 0) { idle++; } else { m_out.write(buffer, 0, bytesRead); idle = 0;...
1c2f4be3-08a0-4795-87aa-15cf3d4f82a0
2
public DebugWindow(){ win=Boolean.valueOf(GosLink2.prps("window")); if (win==true){ String imagePath = "smokin.png"; InputStream imgStream = DebugWindow.class.getResourceAsStream(imagePath); try{BufferedImage myImg = ImageIO.read(imgStream); setIconImage(myImg); }catch (Exception e){e.printStackTrace...
6fcb3ab9-db88-4c13-95f0-959fa17bd3e1
4
public static void main(String[] args) { Program program = new Program((new TestInput()).getCorrectInput()); Controller controller = new Controller(); Model model = new Model(controller); File file = model.programToFile(program, "test.cecil"); try { String s; BufferedReader reader = new BufferedReade...
7a05b294-5153-4066-8f38-538e286fa9c8
5
@Override public Pessoa inserir(IEntidade entidade) throws SQLException { if (entidade instanceof Pessoa) { Pessoa pessoa = (Pessoa) entidade; String sql = "insert into pessoa (id_pessoa, nome, sexo, data_nascimento)"; sql += " values (?,?,?,?)"; Connection ...
af1fb596-59ad-40be-93f6-ab1ad915f222
6
public void animalCoolDown(){ if(!plugin.getAnimalData().contains("AnimalCoolDown")){ plugin.getAnimalData().set("AnimalCoolDown", "test"); plugin.saveAnimalData(); } Player[] p = Bukkit.getOnlinePlayers(); for(Player player : p){ if(plugin.getAnimalData().contains("Farmer." + player.getUniqueId...
1429680e-7f4c-4a3a-bc55-72b900c5d41f
2
public Vector<Person> selectDataFromTable(String tableName) { Vector<Person> personVector = new Vector<Person>(); ResultSet seeDeadPeopleResults; String selectQuery = "SELECT person_name, person_birth_date, person_death_date, person_age," + " person_is_married, person_has_children FROM '" + tableName + "...
28d76373-7a20-4943-ac10-f9ba90587e1a
2
public static final boolean isVisualBasic(String fileName) { for (String file : VISUAL_BASIC) { if (file.equals(fileName)) { return true; } } return false; }
e2c1de62-f4bb-4e44-a73c-9807cf0e2d87
5
private void setupSubjects(List<SubjectType> subjects) throws ParsingException { // make sure that there is at least one Subject if (subjects.size() == 0) throw new ParsingException("Request must a contain subject"); // now go through the subject attributes for (SubjectType subject : subjects) { Strin...
b24d90c6-03b0-4aae-89b7-7c2d33f24950
5
private Command createBreakpointCommand() throws ControllerException, ScriptException { input.advance(); String[] args = readArgs(2); // count args int count; for (count = 0; count < args.length && args[count] != null; count++); if (count < 2) scriptErr...
75fbbfa8-86e1-4b8f-9ef3-3742636fd19e
1
public Serializable fromDOM(Document document) { RegularPumpingLemma pl = (RegularPumpingLemma)PumpingLemmaFactory.createPumpingLemma (TYPE, document.getElementsByTagName(LEMMA_NAME).item(0).getTextContent()); //Decode m, w, & i. pl.setM(Integer.parseInt(docume...
620874cf-e756-4eea-b39d-78bf8f66d381
1
private String removeScript(String content) { String buf = ""; int idx = 0; int aStart = 0; int aEnd = -9; while (content.indexOf("<script", idx) != -1) { aStart = content.indexOf("<script", idx); buf += content.substring(aEnd+9, aStart); aEnd = content.indexOf("</script>", aStart); idx = aEnd;...
6c1a40e3-aed9-42f5-a2b9-973d73825c4a
1
private void continueConnectingAt( int x, int y ){ if( connection == null ){ return; } connectAt( x, y, true ); }
5104bafa-3509-4020-a4d7-82efd1c4bf66
6
public void update() { if (anim < 40) anim++; else anim = 0; if (checkattack) { checkattack = false; checkattack(this); } if (hit) { if (anim2 < 40) anim2++; else { anim2 = 0; hit = false; OverHead = ""; } } if (reset) { delay --; if (delay == 0){ level.scree...
b1c32590-bb18-46b9-a308-520addec9e8a
9
public void testMap(Map<Object,Object> map){ Object[] keys=new Object[itemCount]; Object[] values=new Object[itemCount]; for(int i=0;i<itemCount;i++){ keys[i]=Double.valueOf(i); values[i]=Double.valueOf(random.nextDouble()); } map.clear(); assertTrue(map.isEmpty()); for(int i=0;i<itemCount;i++...
39276838-c820-42c8-a4af-d531250e3a9d
9
public void actionPerformed(ActionEvent e) { if(e.getSource() instanceof JTextField) { String data = inputField.getText(); //Check whether input is double if (isDouble(data)) { //Push parsed value onto doubleStack this.input = Double.parseDouble(data); this.doubleStack.push(input); ...
7c41b90e-3f65-4b31-9e2b-e941b10d7385
5
@Override public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException { int progress = 0; int index = 0; try{ int result; do { result = collection.get(index).print(graphics, pageFormat, pageIndex); index++; } while (result==NO_SUCH_PAGE); ...
bd376818-71ff-4319-940e-032f37957adf
9
public void saveItemKits() { File dataFile = this.getDataFile(); if (dataFile == null) { this.log("Error with data file. Nothing will be saved!"); return; } String settingStr = ""; boolean useSeparator = false; itemKitProperties.clear(); for (String s : itemKitPresets.keySet()) { ItemStack[] c...
3d3c7f14-9333-4249-a204-75354a6da21a
9
@Test public void testAddBook() { Set<StockBook> booksToAdd = new HashSet<StockBook>(); Integer testISBN = 100; booksToAdd.add(new ImmutableStockBook(testISBN, "*@#&)%rdrrdjtIHH%^#)$&N 37874\n \t", "eurgqo 89274267^&#@&$%@&%$( \t", (float) 100, 5, 0, 0, 0, false)); List<StockBook> listBooks = null...
4cd643d5-f6cd-4e4b-abe6-9a26c703c78b
1
public Builder startsCount(int receivedStartsCount) { if (receivedStartsCount < 0) { this.averageStartsCount = -receivedStartsCount; return this; } this.averageStartsCount = receivedStartsCount; return this; }
8f14c590-7e5f-44fd-8d80-19b0ea8c654f
4
public void registerObject(Model<?> obj) { if (!objects.containsKey(obj.getClass())) objects.put(obj.getClass(), new HashMap<Long, SoftReference<Model<?>>>()); objects.get(obj.getClass()).put(obj.id, new SoftReference<Model<?>>(obj)); }
2a92b85a-1ff8-46d2-bcad-b87dce8522f5
3
@Test public void insertHandlesHeadCorrectly() { l.insert(a); for (int i = 1; i < 10; i++) { l.insert(new Vertex(i)); } int i = 0; Vertex test = l.max(); while (test != null) { test = l.pred(test); i++; if (i > 300) { ...
0eac3e77-4310-4c7b-b002-2989ed1b362a
4
private void readtRNS() throws IOException { switch (colorType) { case COLOR_GREYSCALE: checkChunkLength(2); transPixel = new byte[2]; readChunk(transPixel, 0, 2); break; case COLOR_TRUECOLOR: checkChunkLength(6); transPixel...
aad6f2c2-1740-4b41-9ee2-61f29423e4de
0
public int getType() {return this.type;}
c0f31a82-861e-4556-bb5a-9613d6ec132e
7
public void export(Command command) throws RepositoryException { try { String exportPath = command.getParams()[1]; File canonicalExportFile = new File(exportPath).getCanonicalFile(); if (canonicalExportFile.getPath().contains(location.getPath())) throw new RepositoryException( "It is not allowed to...
9ba52150-fcca-4213-80c0-5c44a350ef53
4
static private void validateDirectory ( File aDirectory ) throws FileNotFoundException { if (aDirectory == null) { throw new IllegalArgumentException("Directory should not be null."); } if (!aDirectory.exists()) { throw new FileNotFoundException("Directory does not exist: " + aDirec...
be7081ba-d58f-4cd5-9904-8eb58f53b6c1
4
public ParsedNet findInput(int neuronLine, ArrayList<String> file) { ParsedNet parsedNet = new ParsedNet(); ArrayList<Integer> neuronInputs = new ArrayList<Integer>(); boolean foundFullStop = false; int loopForFullStop = neuronLine; do { currentLine = file.get(loopForFullStop); Pattern pattern = Patter...
46c41f3e-8c75-4a6d-b92d-89d1a0d08d4c
9
@Override public void paintComponent(Graphics g_panel) { BufferedImage bimage = new BufferedImage(320, 240, BufferedImage.TYPE_INT_BGR); Graphics g = bimage.getGraphics(); if (image != null) g.drawImage(image, 0, 0, this); else g.drawImage(new ImageIcon("./res/nosignal.png").getImage(), 0, 0, ...
b991ee50-ad83-4953-a4dd-dad9b2851119
7
public void mouseClicked(MouseEvent e) { super.mouseClicked(e); // 左クリックの場合 if (SwingUtilities.isLeftMouseButton(e)) { JTable tbl = (JTable)e.getSource(); if (e.getClickCount() == 2 && !tbl.equals(queryFileTable)) { showRecordPage(tbl); } else if (e.getClickCount() == 1) { ...
21df6740-881c-467d-ab46-3ebd4319ae3f
8
public Matrix solve(Matrix B) { if (B.getRowDimension() != n) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } if (!isspd) { throw new RuntimeException("Matrix is not symmetric positive definite."); } // Copy right hand side. double[][] X = B.getArrayCopy...
61bd77b8-089e-4fdc-8632-a2b1599c8473
8
private String getSingleLineOfChildren(List<? extends BaseToken> children) { StringBuilder result = new StringBuilder(); Iterator<? extends BaseToken> childrenIt = children.iterator(); boolean isFirst = true; while (childrenIt.hasNext()) { Object child = childrenIt.next(); ...
438d529d-aec1-41f1-aff5-963adcc1b55a
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...
fc2ba2c6-c263-4caa-b619-f5e93a3a1602
4
public static int getHighestID() { File[] files = InvShopGlobal.shopsFolder.listFiles(new ShopFilter(null,null,null)); int high = 0; for(int i=0;i<files.length;i++) { String[] data = files[i].getName().split("."); if(data.length!=2) { continue; } try { int n = Integer.parseInt(data[0]); if...
6a5af961-a069-42ec-a42c-412cbad65f16
5
private static String checkPath(String pathToCheck, String extention) { String[] tokens = null; StringBuilder retval = new StringBuilder(); // ako primljena eksenzija ima tocku na pocetku ona se brise if (extention.substring(0, 1).equals(".")) { extention = extention.substring(1); } // ako je primljena...
696a8de9-f6c0-4f94-90c3-d9faf381a5f3
4
private static void readIn(){ try{ reader = new BufferedReader(new FileReader("MegaDictionary.txt")); new Scanner(reader); } catch(FileNotFoundException e){ System.err.println("File Could Not Be Found"); return; } try{ String word = reader.readLine(); while(word != null){ if(goodWord(wor...
bd23720c-7b61-4e6b-944c-8d264ce939e1
0
@Override public byte[] getSchedule() { return new byte[]{}; }
c40dc959-3ac8-4fa4-b9de-7052ce8d6a27
0
public String getSeqID() { return seqID; }
4f38dadd-1b81-411b-a741-ad9599fd29a0
3
public Stack<Integer> getStack(int stackNo) { switch (stackNo) { case 1: return stack1; case 2: return stack2; case 3: return stack3; default: return null; } }
fd22bb45-19ba-4258-91da-32beb26edf23
2
private static Boolean runStatementBatch(List<String> statements) { try { getConnection(); Statement stmt = con.createStatement(); con.setAutoCommit(false); for (String statement :statements) { stmt.addBatch(statement); ...
bebbc308-feaa-47e3-8548-9b5f086d6bbd
9
private void loadExtDict(){ //加载扩展词典配置 List<String> extDictFiles = cfg.getExtDictionarys(); if(extDictFiles != null){ InputStream is = null; for(String extDictName : extDictFiles){ //读取扩展词典文件 System.out.println("加载扩展词典:" + extDictName); is = this.getClass().getClassLoader().getResourceAsStream(...
9bfbfb64-4a29-4049-a555-8afe58622971
4
public List<BiReservations> ObtenirReservations(String username){ List<BiReservations> reservations = null; try{ // Trouve les réservations du membre session.beginTransaction(); Query req = session.createQuery("FROM BiReservations res WHERE res.biMem...
88ead2f8-7faf-445a-80fa-ccdc60a19e57
5
protected PingResult pingUp() { for (int i = this.posY; i >= 0 ; i--) { if (i == enemyPosY && this.posX == enemyPosX) { return new PingResult(this.posY - i - 1, true); } else if (BattleBotsGUI.instance.obstacles[this.posX][i]) { return new Pin...
72ac730c-f12f-4315-b054-6b86a58f07b1
7
public void printContainerList(){ System.out.println("Printing containers "+"\n"); if (listOfContainers.isEmpty()){ System.out.println("-- Container list empty --"); } for (BaseTableContainerGroup a : listOfContainers) { if(a.table instanceof TablePane){ System.out.println("Attribute Level hi...
f73a5a33-dc39-4e0f-8d69-ef20e9139822
9
public void update( Goban goban, Point stonePoint ) { // Examine the stone on the goban at the given point. // Point point = (Point)stonePoint; Stone placed = getGoban().getStone( point ); int captures = 0; // Toggle white's turn. //TODO what is this doing setWhiteToPlay( !placed....
ad706485-d7c3-4cdc-9852-6c6b09d27423
7
public static String format( final Collection<? extends Map.Entry<String, String>> parameters, final String encoding) { final StringBuilder result = new StringBuilder(); for (final Map.Entry<String, String> parameter : parameters) { String value = parameter.getValue() == null ? null : String .value...
783e711b-6c80-4138-979c-07e82465cd59
7
public void run() { synchronized(_queue) { while(true) { while((_state != ClientSenderInterface.START_SENDING || _queue.isEmpty()) && _running) { try { _queue.wait(2000); } catch(InterruptedException ignored) { } } if(!_running) return; try { _...
a2b8736e-a006-4bae-9daf-704e58b86319
2
public static ArrayList<String> showName() { ArrayList<String> products = new ArrayList<String>(); Database db = dbconnect(); try { db.prepare("SELECT name FROM product ORDER BY PID"); ResultSet rs = db.executeQuery(); while(rs.next()) { products.add(rs.getString(rs.g...
fbb0b13b-889f-4d2e-b727-c0e7451c7a6a
9
private static boolean findDefPoints(OptFunctionNode fn, Node n, int[] varTypes) { boolean result = false; Node child = n.getFirstChild(); switch (n.getType()) { default : while (child != null) { result |= findDef...
fb653e5c-2a6e-4dfb-9fe0-4365eb7ca60e
0
public static void main(String[] args) { EvenChecker.test(new MutexEvenGenerator()); }
23a6f52d-3fc5-42d2-b307-ae99f48a7987
7
@EventHandler public void onPlayerCommandPreprocessEvent(PlayerCommandPreprocessEvent event) { if(event.getMessage().equalsIgnoreCase("/lvl") || event.getMessage().equalsIgnoreCase("/hero level") || event.getMessage().equalsIgnoreCase("/level")) { Player player = event.getPlayer(); Hero hero = plugin.getHer...
b16b4aec-c181-45f6-9d18-5d5e74bebede
7
private static HashMap<String, Object> ajouter_dresseur(Scanner entree, boolean modif){ int choix = 0; String nom = "",actions = ""; System.out.println("Veuillez entrer le nom de la carte : "); if(modif)System.out.println("Laisser vide pour ne pas modifier l'ancien "); nom = Menu.redemander_saisie(e...
d6513c51-167b-44de-be20-bf393e7aa4fb
2
@Override public boolean removeLockByTransactions(Set<String> transactions) { boolean thereturn = false; for (String transaction : transactions) thereturn = this.removeLockByTransaction(transaction) || thereturn; return thereturn; }
1d8c4e1b-689a-4306-b629-606c764bfbbf
1
public void setRelative(boolean relative) { this.relative = relative; if (relative) { centerMouse(); } }
25a0417b-b465-40d7-a72a-6db8e14c9f2c
2
NewsResult(JSONObject jsonObject) { this.Title = (String)jsonObject.get("title"); this.Abstract = (String)jsonObject.get("abstract"); this.URL = (String)jsonObject.get("url"); this.Source = (String)jsonObject.get("source"); this.SourceURL = (String)jsonObject.get("sourceurl"); this.Language = (String)jsonOb...
4c1e2f5a-0be4-4e2e-870e-57d7a6256abe
6
public static void main(String[] args) { File f = new File("files/numeros.txt"); BufferedReader Buffer = null; String Linea = null; try { Buffer = new BufferedReader(new InputStreamReader( new FileInputStream(f))); while ((Linea = Buffer.readLine()) != null) { System.out.println(Linea); try{ ...
d0dcca84-5b60-45c5-a72d-926dc9047c15
7
private StringBuilder generateSource() throws Exception { if (control != null) { if (control.indexOf('.') == -1) { throw new IllegalArgumentException( "Not a valid control reference (object.field): '" + control + "'"); } } StringBuilder b = new StringBuilder(); b.append("import java.uti...
26f0acfa-4ca2-4c88-a5b2-e269553f4869
7
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // Set Current Book // Requires two elements - the first is stored and when the second is hit, // the text is processed and then the key is entered into the books map. // The two e...
d7cc4f55-3611-4448-9459-d05f4d064dd2
8
private void moveWeek(int numberToMove) { if (DEBUG) log("Beginning moveWeek(int numberToMove) method"); if (DEBUG) log("1. Clone today"); if (DEBUG) log(" Current date: " + date(currentCalendar)); Calendar temp = (Calendar)currentCalendar.clone(); if (DEBUG) log("2. Add " + numberTo...
e7f3ea31-e037-4d53-868b-248316a6f94a
1
public boolean equals( Object o ) { if ( ! ( o instanceof Vertex ) ) { throw new ClassCastException(); } return this.label.equals( ( ( Vertex<E> ) o ).getLabel() ); }
e94bbf2c-3474-479a-b775-4aee76133a71
7
protected double objectiveFunction(double[] x){ double nll = 0; // -LogLikelihood for(int i=0; i<m_Classes.length; i++){ // ith bag int nI = m_Data[i][0].length; // numInstances in ith bag double bag = 0.0; // NLL of pos bag for(int j=0; j<nI; j++){ double ins=0.0; ...
9ffbc309-b8ad-4ef5-bdcb-b8f12652ee78
0
public CheckResultMessage check28(int day) { return checkReport.check28(day); }
8904406f-c2fc-42a9-aec4-f3d283c4ee98
7
public List<List<Integer>> subsets(int[] S) { if(S==null) return new ArrayList<List<Integer>>(); int len = S.length; int total = 1<<len; Arrays.sort(S); List<List<Integer>> rt = new ArrayList<List<Integer>>(total); HashMap<Integer, myvalue> hm = new HashMap<Integer, Solution.myvalue>(); for(int i=0;i...
6a4cb6a9-9892-405a-9159-954e4d685023
5
public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { int w1 = src.getWidth(); int h1 = src.getHeight(); int chan1 = src.getNumBands(); int w2 = dstIn.getWidth(); int h2 = dstIn.getHeight(); int chan2 = dstIn.getNumBands(); int minw = Math.min(w1, w2); in...
530570a3-8c24-41df-a2ed-23d2b4a48bf6
8
public void MedianMaintanance() { int maxLowHalf = 0; // then this heap is null int minHighHalf = 10001; // when this heap is null int curElement = 0; for (int i = 0; i < this.arrayLen; i++) { // insert i; curElement = originalArray[i]; if (lowHalf.peek() != null) maxLowHalf = lowHalf.peek(); i...
9e1d3c0b-9f88-4934-9640-f73a23dc8194
6
public MainFrame(Model model, ClientOperator clientOperator) { this.model = model; //Components - Statusbar statusBarPanel = new StatusBarPanel(model); //Components - MainPanels mainPanel = new JPanel(new BorderLayout()); gamePanel = new GamePanel(model, clientOperator); mortgagePanel = new MortgagePane...
7fdd2f6f-6639-4d38-b9cd-5a7484baacaf
2
public boolean Salvar(UsuarioSistema obj) throws ErroValidacaoException, Exception{ try{ PessoaDAO dao = new PessoaDAO(); Pessoa tempPessoa = new Pessoa(); tempPessoa.setCpf(obj.getCpf()); tempPessoa.setDataNascimento(obj.getDataNasciment...
d807497e-d16a-4259-901f-5da1fa845feb
1
@Override public Collection<? extends GrantedAuthority> getAuthorities() { return new ArrayList<>(); }
aef62a79-e7ee-4535-ada5-ed905a23a169
8
protected double ProbS(int u, int j) { if (!userItemRanks.containsRow(u)) { userItemRanks.clear(); SparseVector uv = trainMatrix.row(u); List<Integer> items = Lists.toList(uv.getIndex()); // distribute resources to users, including user u Map<Integer, Double> userResources = new HashMap<>(); for...
dde821d6-1d94-4955-9766-3a6af0d7dd99
9
public String skipPast(String to) throws TXMLException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; String content = ""; /* * First fill the circle buffer with as many characters as are in the * to string. If we reach an ear...
06ea213f-7ad1-49ab-b345-46db9f02ec1e
4
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); new LayoutExample(shell); shell.setText(getResourceString("window.title")); shell.addShellListener (new ShellAdapter () { public void shellClosed(Shel...
1d0bb7f2-ede4-4306-8a08-4e3966daf5e1
6
@Override public Membre find(int id) { Membre found = null; PreparedStatement pst = null; ResultSet rs = null; try { pst=this.connect().prepareStatement("select * from Membre where id= ?"); pst.setInt(1, id); rs=pst.executeQuery()...