method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c1b8eb9a-ef0e-4149-a5f6-aac1272c1851
1
public boolean isReleased() { if(isDisabled()) return false; return released; }
2e28c49e-03ac-4d9c-bc4c-ef3fb996e5d4
2
public static ArrayList<Question> getQuestionsByQuizID(int quizID) { ArrayList<Question> questionList = new ArrayList<Question>(); try { String statement = new String("SELECT * FROM " + DBTable + " WHERE quizid = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, qui...
8d5d1484-6885-408b-a12e-580683db8025
3
@Override public boolean equals(Object other) { if (other == null) return false; else if (other instanceof WeightedPoint) { WeightedPoint otherWp = (WeightedPoint)other; return (otherWp.row == row && otherWp.col == col); } return false;...
c6e43a73-44e2-4a9f-b1e6-2c7ee801f484
8
private void initializeNodes(int numInputs, int numOutputClasses){ //check to see if the hiddenlayers and hiddennodes have been initialized, and if not, //initialize them to default values nodesList = new ArrayList<List<PerceptronNode>>(); if(numHiddenLayers == -1){ numHiddenLayers = 2; } if(numHiddenNo...
8e028add-a51e-4341-bfbf-810b88747855
8
public void escalonar() { try { listaProcesso = arquivo.lerArquivo(); } catch (IOException ex) { Logger.getLogger(RoundRobin.class.getName()).log(Level.SEVERE, null, ex); } while (!fim) { for (int i = 0; i < listaProcesso.size(); i++) { ...
f7cc34a6-7621-4825-9ac2-809837f73831
8
public final File copy(final Directory destDirectory, final String newFileName) throws FileNotOnDiskException, DiskReadException { checkExists(); String destFileName = ""; if (destDirectory != null) destFileName += destDirectory.toString(); else destFileName += this.getParent(); if (newFileName != null) de...
7d28b045-3b0b-4d4e-81fb-50a92413952a
4
private void init() throws IOException { if (null == in) { throw new IOException("No InputStream"); } if (in.available() == 0) { throw new IOException("Empty InputStream"); } //checkMagicChar('B', "first"); //checkMagicChar('Z', "second"); ...
4be87bd7-2a78-4262-a4d6-c4352b77ad47
6
@Override public Result value(Function<Double, Double> function) { Result result = null; try { AcceleratorSingleStep<Double> richardson = new RichardsonExtrapolationReal(4.0); HashMap<Integer, Double> values = new HashMap<Integer, Double>(); double lowerBo...
5cdb2b37-4f82-4872-86b9-5ae8cb5c71d1
3
public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_W) { keyUp = false; } else if (e.getKeyCode() == KeyEvent.VK_A) { keyLeft = false; // } else if (e.getKeyCode() == KeyEvent.VK_S) { // keyDown = false; } else if (e.getKeyCode() == KeyEvent.VK_D) { keyRight = false; } }
54194475-c5f4-47bc-b674-20a592d27f2d
1
public void testSetIntoIntervalEx_Object_Chronology5() throws Exception { MutableInterval m = new MutableInterval(-1000L, 1000L); try { StringConverter.INSTANCE.setInto(m, "P1Y/P2Y", null); fail(); } catch (IllegalArgumentException ex) {} }
f9d93ad9-f9c6-4311-8eeb-b7fd100b0f6b
7
public void renderPlayer(EntityPlayer par1EntityPlayer, double par2, double par4, double par6, float par8, float par9) { ItemStack var10 = par1EntityPlayer.inventory.getCurrentItem(); this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = var10 ...
a31af184-030f-4a5d-a0ff-8f3e57a6527e
3
@Test public void testGetAllLocations() throws IOException { List<Location> remoteLocations = dexmaRestFacade.getAllLocations(); assertEquals(3,remoteLocations.size()); Iterator<Location> itRemote = remoteLocations.iterator(); while (itRemote.hasNext()) { Location loc = itRemote.next();...
949df235-a84f-4aef-8b3b-31ce7efd6c11
4
@Override public boolean deconnect(SlotInterface s) { OVLine l = getLine((OVNode) s); if (l != null) { lines_.remove(l); } if (isPolyvalent() && connections_.size() == 0) { setType(ValueType.VOID); } boolean flag = super.deconnect(s); ...
b41b1e15-f0cb-4f1a-a2c7-585abf39065b
5
private String scanFlowScalarSpaces () { StringBuilder chunks = new StringBuilder(); int length = 0; while (BLANK_T.indexOf(peek(length)) != -1) length++; String whitespaces = prefixForward(length); // forward(length); char ch = peek(); if (ch == '\0') throw new TokenizerException("While scanning a ...
4e6ad954-c9bd-4d30-9d52-6df5df777b18
1
@Test public void testExist() { List<String> list = new List<>(); list.addToEnd("test1"); list.addToEnd("test2"); list.addToEnd("test3"); for (String current : list) { assertTrue(list.exist(current)); } }
45cd7ca1-5715-47d1-9afb-98579b5afd0b
7
private boolean enabledModsDependencyCheck(boolean ignore) { String checkStr=""; boolean canLaunch=true; for(int i=selProfile.mods.size()-1; i>=0; i--) { String p = selProfile.mods.get(i); //String str = checkDependency(p); String str = checkDependency(util.getModDependency(p).replace("[","").replace("]"...
d0828213-b883-4ba3-a0be-38e2c4a88489
4
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InstantiationException e1) { // TODO Auto-generated catch block e1.printStackTr...
fcf4a57f-1ffb-48dd-9fa5-b42ae932ee55
0
public void resetText(){ this.text = new StringBuilder(""); }
3f8f0843-96a2-40d8-804f-a248f94a765c
9
private void load(InputStream is) throws IOException { Map<String, Set<Lemma>> lemmas = new HashMap<>(); Set<String> allPrefixes = new HashSet<>(); Set<String> allEndings = new HashSet<>(); BufferedReader reader = new BufferedReader(new InputStreamReader(is, UTF_8)); int sectionLength = parseInt(reader.read...
d926aa79-aff8-45e2-b98c-5aecc687feee
1
@EventHandler public void onPlayerMoveEvent(PlayerMoveEvent e) { Player p = e.getPlayer(); Location l = p.getLocation(); int lightlevel = p.getLocation().getBlock().getLightLevel(); if (lightlevel < 5) { p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Integ...
21098969-0d0f-4554-8dce-195e2c3ed78c
4
public void rotateRight() { switch (position.getDirection()) { case N: position.setDirection(Direction.E); break; case E: position.setDirection(Direction.S); break; case W: position.setDirection(Direction.N); break; case S: position.setDirection(Direction.W); break; } }
7de7ddea-31c8-4cd8-ad42-1f40573578c5
3
@Override public boolean isGameOver() { boolean gameOver = true; for (WarMachine w : warMachine) { if (!w.isVersenkt()) gameOver = false; } if (gameOver) { Regeln.setGameOver(); return true; } else return false; }
67b1f8ce-0484-4874-84be-25c9f668a1c8
8
@Override public List<AdminCol> getColUpdList(String tblNm) { log.debug("get column update list for table = " + tblNm); Connection conn = null; PreparedStatement statement = null; ResultSet rs = null; ArrayList<AdminCol> list = new ArrayList<AdminCol>(); StringBuilder sql = new StringBuilder(); sql.ap...
5bf0a692-c0d9-4507-8fbd-b6f2b812622e
6
private void threshold_parameter_set() { // choose different parameter setting // according to different bowlSize and number of players decreaseSpeed = decreaseSpeed; minimalShift = minimalShift; if(bowlSize < 20 ) { decreaseSpeed = 0.5; minimalSh...
6b1fd341-cfc1-4cba-b290-c0a50d0875e1
2
private void calcPrimitives(Camera camera) { for (MassAttractObject3D obj : world.getSystem()) { primitives.get(getNameTypeObj(obj.getName())).calcCoordinates(this, camera, obj); if(obj.equals(world.getSelectObject())) primitives.get("Select").calcCoordinates(this, camera...
d8ba2b3b-4b90-421f-b11a-d6ae063a0d35
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final Connection other = (Connection) obj; if (leftIcon == null) { if (other.leftIcon != null) return false; } else if (!leftIcon.equals...
b2d04aea-f14b-4a01-9211-f3f210efac8b
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); if (string...
620ab136-8ad3-4a92-aea6-83176c7b79dd
0
public void addModel(AbstractModel model) { registeredModels.add(model); model.addPropertyChangeListener(this); }
f2d046b0-b5f5-492e-9ba6-649437f9ba88
6
private void loadConfig(){ reloadConfig(); getConfig().options().copyDefaults(true); this.verbose = getConfig().getBoolean("verbose",false); verbose("Verbose mode! Spammy as hell!"); this.checkUpdates = getConfig().getBoolean("checkUpdates",true); if (checkUpdates){ ...
06465536-38c3-4c9e-aee1-2d17d31e784a
7
public void actionPerformed(ActionEvent ae) { // // Process the action command // // "create report" - Create the report // "done" - Done // try { switch (ae.getActionCommand()) { case "create report": Date startDat...
f8288064-bd79-4267-98f3-84c5afd97c58
2
public double[] rowSums(){ double[] sums = new double[this.numberOfRows]; for(int i=0; i<this.numberOfRows; i++){ sums[i] = 0.0; for(int j=0; j<this.numberOfColumns; j++){ sums[i] += this.matrix[i][j]; } } ...
8d3cb0cd-9c84-4ef9-85fe-b030c74ffe12
7
public static GenderRatio getRatio(int i) { switch (i) { case 8: return GenderRatio.ALWAYS_FEMALE; case 0: return GenderRatio.NEVER_FEMALE; case 1: return GenderRatio.FEMALE_18; case 4: return GenderRatio.HALF_FEMALE; case 6: return GenderRatio.FEMALE_34; case 2: return GenderRatio.FEMAL...
d2b8818a-8c0a-4a8e-b50e-9c7badffb1d2
2
public static boolean loadlinkDB() { ResultSet res; String lineText, URL; int cnt = 0; db.Query("CREATE TABLE IF NOT EXISTS `database` (signurl varchar(20), url varchar(164))"); res = db.QueryRes("SELECT * FROM `database`"); try { while(res.next()) { lineText = res.getString("signurl"); ...
0cfc5e1b-3bfd-45e3-a88e-1735240ee5c1
3
public void write(byte b) throws IOException { if (!(b == 0 || b == 1)) throw new IllegalArgumentException("Argument must be 0 or 1"); currentByte = (byte)(currentByte << 1 | b); // shift will implicitly convert byte to int!!! numBitsInCurrentByte++; if (numBitsInCurrentByte == 8) { output.write(currentB...
0bd5dba4-6a7c-4a5a-8e53-e077c8b6ec1b
3
public void saveConfig() { if (config == null || configFile == null) return; try { config.save(configFile); } catch (IOException ex) { plugin.getLogger().log(Level.SEVERE, "Could not save data to " + configFile, ex); } }
ea1ee931-2980-49a8-b35d-e4aabe3c1e17
7
public String print() { StringBuffer buffer = new StringBuffer(); for (Food food : foods) { FoodType foodType = food.getFoodType(); if (food.isDiscount()) { buffer.append("[X]"); } buffer.append("\t"); buffer.append(String.va...
17b60fb8-5d46-4859-bfed-3a0cfd0a5800
5
@Override public Color intensity(Intersection i) throws Exception { Color diffuse = i.getMaterial().getDiffuse(); double specular = i.getMaterial().getSpecularExponent(); if (diffuse.isBlack() && specular <= 0) { return Color.BLACK; } Vector a = location.sub(i.getIntersection()); Vector n = i.getNormal(...
219fc76f-a428-4903-85c4-88db2592580c
7
private int parseListItem(int start) { while (start<wikiLength && wikiChars[start]<=' ' && wikiChars[start]!='\n') start++; // skip spaces int end=parseItem(start, null, ContextType.LIST_ITEM); if ((listLevels[listLevel]=='>' || listLevels[listLevel]==':') && wikiText.substring(start, end).trim().length()==...
4cfd37e0-7e4e-4466-b956-4274b98edc10
4
public boolean scrollToCard(String ID) { for (Component c : table.getComponents()) { if ((c.getClass().equals(TCard.class) || c.getClass().equals(Token.class))) { final TCard card = (TCard) c; if (card.getID().equals(ID)) { SwingUtilities.invokeLat...
80babc7a-61e8-4550-8154-50636ccfd087
2
public boolean removeCensoredWord(String word) { if (censorWords == null) censorWords = Lists.newArrayList(); if (!censorWords.contains(word.toLowerCase())) return false; censorWords.remove(word.toLowerCase()); return true; }
3e1e4f83-3d8f-4436-ad0a-bd3818739631
5
public void decreaseKey(Node x, double k) { if (k > x.key) { throw new IllegalArgumentException( "decreaseKey() got larger key value"); } x.key = k; Node y = x.parent; if ((y != null) && (x.key < y.key)) { cut(x, y); cascadingCut(y); } if (min == null || x.key < min.key) { min =...
e49190ba-08fd-4272-999e-164014ab2a6f
1
public void addToConnectionDeque(ChannelHandlerContext ctx, String url) { //getting an instance of ChannelTrafficShapingHandler for bandwidth monitoring ChannelTrafficShapingHandler ch = (ChannelTrafficShapingHandler) ctx.channel().pipeline().get("shaping-handler"); ch.trafficCounter().stop(); ...
d568b893-e4de-476c-abbe-244ec360dd3b
7
private SitesInitializer() { Map<String, Transaction> readLockTable = new HashMap<String, Transaction>(); Map<String, Set<Transaction>> writeLockTable = new HashMap<String, Set<Transaction>>(); variableSitesMap = new HashMap<String,Set<Site>>(); lockManager = new LockManager(readLockTable, ...
02425ffe-c5d3-44cd-9e12-26e0e1539752
1
@Override public QueueSysResult result(int m){ QueueSysResult result = cachedResults.get(m); if (result == null) { result = calculate(m); } return result; }
26214c12-1393-4fd2-bd30-6e7021b84c72
8
public static Cons extractOptions(Cons tree, KeyValueList optionstable) { { Cons options = null; Cons tail = null; while ((!(tree.rest == Stella.NIL)) && (!Stella_Object.keywordP(tree.rest.value))) { tree = tree.rest; } if ((tree.rest == Stella.NIL) || (tree.rest...
dcf29332-1683-4d17-a58d-af66c2ff7b8d
2
private List<StatView> produceListOfViews(Stat[] stats) { for (Stat stat: stats) { if (stat != null) { list.add(new StatView(stat)); } } Collections.sort(list); return list; }
1f6d0954-ecc2-4cc7-9d18-8b38b148b5bd
1
public Avoperties(String fileName) { String propFileName = fileName; try(InputStream inputStream = new FileInputStream(propFileName)) { load(inputStream); } catch(IOException e) { System.err.println("Property file '" + propFileName + "' not found in the classpath"); e.printStackTrace(); } }
42bd7c9b-b754-45da-ad7a-6d41146323ea
9
protected boolean hasGotCollision(Position myFreeposition, List<Position> piecesPositions) { int x = myFreeposition.getX(); int y = myFreeposition.getY(); Position tmp = new Position(x - 1, y - 1); if (piecesPositions.contains(tmp)) { return true; } t...
e3925d4e-e0cd-4b11-b085-bc14a117b86b
1
@Override public List<City> findCities(Criteria criteria) throws DaoException { if (criteria.getParam(DAO_CITY_STATUS) == null) { criteria.addParam(DAO_CITY_STATUS, ACTIVE); } TypedQuery query = TypedQueryFactory.getInctance(QueryType.CITYQUERY); return query.load(criteri...
6ecf8031-f702-4805-996f-605457b3ccb0
1
private ArrayList<String> fillAggDetails(Aggregation a, Model model){ final String cont = a.getContainer().getIdentifier(); final String classe = a.getClass().getName() ; final String multCont = a.getContainer().getMultiplicity(); final ArrayList<Role> part = a.getParts(); final String multPart = a.getParts()...
f82663cb-9cde-49a5-957f-726e284361fd
5
private static void decentNumber(int n) { StringBuffer numbers = new StringBuffer(); int fiveCount = 0; int threeCount = 0; for (int i = 0; i < n; i++) { numbers.append(FIVE); fiveCount++; } if (fiveCount % 3 == 0) { System.out.println(numbers); } else { int length = numbers.length(); ...
73b61de5-e769-4277-ad4c-811363e729a6
0
public RemoteCallObjectData(Object data) { this.data = data; }
8fde0828-098e-4381-8967-85f8a957119a
7
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (arg1.length == 0) { ChatPlayer cp = plugin.getChatPlayer(sender.getName()); ChatChannel cc = plugin.getChannel(cp...
cd10ca03-d121-44e4-960c-909cb195207f
0
public JTextField getTxtCp() { return txtCp; }
d8c6c14e-19ce-4c17-861d-c9a0725b5fca
2
static final Opcode lookup(byte opcode) { for (Opcode one : values()) { if (opcode == one.mOpcode) { return one; } } return UNDEFINED; }
33d239b7-f5e7-4f96-be15-87b58fe16196
6
private String getMime(String extension) { String mime = ""; switch (extension) { case ".pdf": mime = "application/pdf"; break; case ".png": mime = "image/png"; case ".css": mime = "text/css"; break; case ".js": mime...
da2c87ea-9fdb-47a1-ab0f-00933e6287c7
9
private boolean smartMove(RobotController rc, Boolean takeTwo) throws GameActionException { Direction dir; if(takeTwo) { dir = Direction.values()[(int)(rndGen.nextFloat() * 8)]; } else { if(this.destination==null){ this.destination = this.enemyHQ; ...
f17ccc27-3aec-46fa-ae68-b2e3b12efde7
4
public boolean changeNickname(String device, String newNickname, PersistentDeviceModel model) { boolean isChanged = false; for (Device dev : model.getDevices()) { if (dev.getName().equals(newNickname) && !dev.getSerialNumber().equals(device)) { return false; } } if (devices.containsKey(devic...
201ae0f4-55b7-45e8-a584-f204f59c5600
3
public static void deserialize() { SerialBox e = null; try (FileInputStream fileIn = new FileInputStream("tmp/employee.ser"); ObjectInputStream in = new ObjectInputStream(fileIn)) { e = (SerialBox) in.readObject(); in.close(); fileIn.close(); }catch(IOException i) { i.printStackTrace(); retur...
12a64db5-3d41-4d8a-8065-99e94afe7db6
6
public synchronized List<DataNodeEntry> select(int replicaFactor) { Collection<DataNodeAbstract> dataNodeCollcetion = this.dataNodeTbl.values(); DataNodeAbstract[] dataNodeArray = dataNodeCollcetion.toArray(new DataNodeAbstract[0]); Arrays.sort(dataNodeArray); List<DataNodeEntry> entries = new ArrayList<D...
6b6b589b-4755-4e47-8ede-db03885bcd60
4
@Override public Tipo validarSemantica() throws Exception { Tipo izq,der; izq=izquierdo.validarSemantica(); der=derecho.validarSemantica(); if (izq instanceof TipoInt || der instanceof TipoFloat){ if (der instanceof TipoInt || der instanceof TipoFloat ){ r...
e0d7b6c0-15e2-4c6e-b847-d93220eec029
4
public void testOne() { TermVectorizer tv = new TermVectorizer(); for(String[] sentence: DOC_TERMS) { int dim = tv.startColumn(); for(String word: sentence) { tv.vectorizeTerm(word, dim); } } tv.truncateVectors(); Matrix vectorMat = tv.getMatrix(); assertEquals("Ve...
9b80fa63-a7dc-4e63-a6d8-4b0aa7063052
4
protected void doFunction(float[] inputs, int inputOffset, float[] outputs, int outputOffset) { // calculate the encoded values for each input float[] encoded = new float[getNumInputs()]; for (int i = 0; i < getNumInputs(); i++) { // encode -...
acb9efca-488d-461b-9306-d467aec3a6c3
7
private void paintDownBorder(Graphics g, int x, int y, int width, int height, Color color) { g.setColor(color); // Left Line if (!afterHighlighted || tabSpacing) g.drawLine(x, y, x, y + height - 1); // Right line if (highlighted || last || tabSpacing) g.drawLine(x + width...
ff5e4353-94e5-4ffe-94a1-de2a0f6ea720
2
public void enemyDestroyedListener(GameActor actor) { StatusComponent sc = (StatusComponent)actor.getComponent("StatusComponent"); InventoryComponent ic = (InventoryComponent)actor.getComponent("InventoryComponent"); if(ic != null) { inventory.addMoney(ic.getMoney()); } ...
334b17b3-1c8d-4286-b344-fb7e5e7537a2
0
public static void main(String[] args) { playGame(new CheckersFactory()); playGame(new ChessFactory()); }
f7875693-676f-48c3-8fbc-8abdbc011a07
9
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); if (action.equals( Constantes.OK )) { ok(); } else if (action.equals(Constantes.CANCEL)) { close(); } else if (action.equals(Constantes.RIGHT)) { ...
1fda246e-9b25-46e2-8601-37cace5118eb
6
public Color setTopAlternativeColor(String userName, String entryName, String attrName){ Color aColor = Color.GRAY; for(IndividualAttributeMaps a : chart.listOfAttributeMaps){ for(IndividualEntryMap e : chart.listOfEntryMaps.values()){ if(userName.equals(a.userName) && userName.equals(e.username)...
c874dfe2-052b-4fb1-a0b3-a55de3440b4a
3
public String printTable() { StringBuilder sb = new StringBuilder(); sb.append("Function name : "); sb.append(Name); sb.append("\r\n"); sb.append("count Type name array role\r\n"); int len = Symbols.size(); for(int i=0;i<len;i++){ SymbolEntry sym = Symbols.get(i); if(sym....
19544a07-86dc-4797-8dde-d146adb48812
7
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Address other = (Address) obj; if (!Objects.equals(this.city, other.city)) { return false; ...
6ab5932f-3748-42c2-9a6e-de7fcc0765fb
3
public void draw(Graphics g) { img.draw(g, ProjectMedusa.SCREEN_WIDTH/2, 0, ProjectMedusa.SCREEN_WIDTH/2, ProjectMedusa.SCREEN_HEIGHT, 0, 0); for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { if (inventory[h][w] != null) { inventory[h][w].draw(g, w, h, area, area); } } } ...
60489a9e-f191-42ec-b47a-1c4671c5c3eb
2
private void findIndexFile() { //loop files for (String index : this.server.getConfiguration().getIndexFiles()) { //create index file File indexFile = new File(this.resource, index); if (indexFile.exists()) { //use index file this.resource = indexFile; break; } } }
7b3c40d9-790d-42b2-95d5-700eb8f5affb
8
protected void alterneigh(int rad, int i, int b, int g, int r) { int j, k, lo, hi, a, m; int[] p; lo = i - rad; if (lo < -1) lo = -1; hi = i + rad; if (hi > netsize) hi = netsize; j = i + 1; ...
63dafd08-9cab-49a0-a67e-e1ae28b96802
7
private String getRowString(int y) { String s = ""; for (int x = 0; x < max_x; x++) { switch (board[x][y]) { case 0: s += " "; break; case 1: s += "O"; break; case 2: s += "X"; } if (x != max_x - 1) { s += " | "; } } ...
bbb273f3-6d7b-4222-9523-d0ffcc27c7b8
4
@Override public BMPImage apply(BMPImage image) { Filter grey = new Grey(); image = grey.apply(image); BMPImage filteredImage = new BMPImage(image); BMPImage.BMPColor[][] bitmap = image.getBitMap(); BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap(); for...
6a2c5da2-6673-467e-8741-18b6941fed7c
3
public void draw(Graphics2D g) { int half_block = (int) (block_size*0.5); for(int j = 0; j < grid[0].length; ++j) { for(int i = 0; i < grid.length; ++i) { if(grid[i][j].size() > 0) { Observation firstObs = grid[i][j]...
8589cc22-6ac4-44f0-8532-1115ba4ccdd8
3
public File createFormattedFile(String filename) throws IOException { File outfile = new File("outfile"); BufferedWriter writer = new BufferedWriter(new FileWriter(outfile)); String word = new String(); BufferedReader reader = new BufferedReader(new FileReader(new File(filename))); String line = reader.readLi...
3ec0eb30-f1ff-4c4a-8ae5-3f14516b6962
6
File addConditions(File file, File conditions) { // adds a conditions column to the Hb and HbO files // the conditions file contains lines of the form: // start stop condition // where start to stop is a range of rows in the Hb/HbO file where condition was in effect // on each line, start and stop must ...
186b251e-bace-4d67-aa3b-4fd9a458cb61
1
public void layoutNorth() { // create north, set properties north = new JPanel(); north.setLayout(new GridLayout(1, 2)); north.setBorder(new TitledBorder(new EtchedBorder(), "Choose match week")); north.setBackground(Color.LIGHT_GRAY); // create label for combo box, add to north JLabel weekNumberComboBo...
e335e2a3-a758-423c-b34a-330fc0d9402e
8
public int getSearchArticleCount(String search,String val, int area) throws Exception{ Connection conn = null; PreparedStatement pstmt = null; Statement stmt = null; ResultSet rs = null; int x = 0; try{ conn = getConnection(); String sql = "select count(*) from board where "+search+" like '%"+val+"%' ...
4f446769-87d4-455d-bdef-3cbd194defc4
0
public void setSpecified(byte[] value) { this.specified = value; }
260de2f5-17d5-435f-94f4-3df1bbd54be8
2
public long timestamp() { if (version() != 1) { throw new UnsupportedOperationException("Not a time-based UUID"); } long result = timestamp; if (result < 0) { result = (mostSigBits & 0x0000000000000FFFL) << 48; result |= ((mostSigBits >> 16) & 0xFFFFL) << 32; result |= mostSigBit...
4ff83a36-ae8a-4a4b-896e-fe3c49263371
8
public void connect(TreeLinkNode root) { while(root != null){ TreeLinkNode mostLeft = null; TreeLinkNode prevNode = null; for(; root != null; root = root.next){ if(mostLeft == null){ if(root.left != null) mostLeft = root.left; else mostLeft = root.right; } if(root.left ...
9c5bba43-64f3-4cc8-b4dc-5efa80111988
6
public void resetNumLocals() { if (localsTypes != null) { int nl = localsTypes.length; while (nl > 0 && localsTypes[nl - 1] == TypeTag.TOP) { if (nl > 1) { TypeData td = localsTypes[nl - 2]; if (td == TypeTag.LONG || td == TypeTag.D...
5ef8429c-80fc-476e-8384-c46f8cf67cdb
2
public void paint(Circle[] points, Graphics g) { for (int i = 0; i < this.Colors.size(); i++) { if (points[i] != null) { points[i].setColor(g, color[this.Colors.get(i)]); } } g.setColor(Color.black); }
934222eb-c14f-4632-852d-ee9f66238675
1
public void remove(ProfesorBean oProfesorBean) throws Exception { try { oMysql.conexion(enumTipoConexion); oMysql.removeOne(oProfesorBean.getId(), "profesor"); oMysql.desconexion(); } catch (Exception e) { throw new Exception("ProfesorDao.removeProfesor: E...
cd5dc60d-63de-4536-8387-0dd0b7d6fc08
6
private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged int value = jList1.getSelectedIndex(); int i = 0, bookcode = 0; try { String query = "SELECT bookcode FROM books order by bookcode;"; ResultSet rs = MyQueries....
555b5102-4b84-46f9-a9d6-9d5830e19cac
4
@Override public void run() { //LOG.log(Level.INFO, "New Thread spawned for client at port: {0}", clientPort); try { reader = new BufferedReader(new InputStreamReader(client.getInputStream())); String request = ""; while (!client.isClosed...
08bb3c02-379d-4560-aefe-d12acf4afbbc
5
public static void main(String[] args){ parser = new OptionParser(args); if (parser.containsOption("--noUIManager")) systemLook = false; if (systemLook){ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { ...
728cad12-921d-4c73-939a-bcbaf9e7e416
6
public void addPurchase(Purchase purchase){ if(purchase != null){ if(purchase.id != null){ addTank(purchase.id, purchase.id_tank, purchase.id_armor, purchase.id_engine, purchase.id_first_weapon, purchase.id_second_weapon); addArmor(purchase.id_armor); ...
7babe15a-5aa8-4afc-8c5b-f7383bd1a943
1
protected void registerSpringSecurityFilters(Environment environment){ // try to get spring's internal FilterChainProxy Object proxyObject = this.applicationContext.getBean(DEFAULT_FILTER_BEAN_NAME); if (null == proxyObject) { logger.info("No FilterChainProxy found in the spring co...
4f71619d-df6f-426d-8b39-dd5f475950fc
0
public void addFront(Object o) { synchronized(_queue) { _queue.insertElementAt(o, 0); _queue.notify(); } }
7f02beec-7e74-49b6-a565-1e202c61f692
3
private JPanel[] getNumPanel() { JPanel[] ps = new JPanel[oNum]; for (int k = 0; k < ps.length; k++) { JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.RIGHT)); panel.add(new JLabel((k + 1) + "-th num: ")); for (int i = numFlds[k].length - 1; i >= 0; i--) { panel.add(numFlds[k]...
22520de7-dac4-4c4f-9ef6-db9bbf979bd0
9
public void renderPlayer(double xPos, double yPos, float falseFall, Sprite sprite, boolean flip) { xPos -= cameraXCoord; yPos -= cameraYCoord; yPos += falseFall; for(int y = 0; y < sprite.getSizeY(); y++) { double yAbs = y + yPos; for(int x = 0; x < sprite.getSizeX(); x++) { double xAbs = x + xPos; ...
9eaae655-7b54-4527-b9b3-ff81e66d65ea
4
public static void copy(File src, File dest) throws IOException { if (src.isDirectory()) { // if directory not exists, create it if (!dest.exists()) { dest.mkdir(); System.out.println("Directory copied from " + src + " to " + dest); } // list all the directory contents String files[] ...
ec1692fb-8a41-4bb2-8676-752ab31037c8
5
@Test public void testEqualsAndHashCode() { final BinarySelectionTree tree = new BinarySelectionTree(); final List<TreeNode> nodes = new ArrayList<TreeNode>(); for (int i = 0; i < 100; ++i) { final Weightable element = new WeightDummy((i % 10) / 2.5); nodes.add(tree.insert(element)); } for (int i =...
51736870-9c55-4ff2-97b9-d7a693f9610f
4
static public void loadComponent(Element e, OVContainer father) { OVComponent c = parseElement(e, father); if (c != null) { father.addComponent(c); if ((c instanceof OVNodeComponent || c instanceof OVProceduralBlock) && father.getMode() == EditorMode.GUI) { c.setVisible(false); } } }
78262129-85e8-4738-92a2-df185289bd8b
1
public double getBias() { if(dendrites.containsKey(this)) return this._bias*dendrites.get(this); else return 0; }
430c2131-5396-4d10-b188-ed68cb8ba6b4
8
* @Post: None * @Return: An ArrayList of all points which lie between point and point2 */ static ArrayList<Point> getPointsBetween(Point point, Point point2) { // TODO Auto-generated method stub ArrayList<Point> answer= new ArrayList<Point>(); Point difference = Game.getDistance(point, point2); if(differen...
2b22e859-0dea-4006-ac5c-70e5420b2c08
4
public static Class<?>[] toClassArray(Collection<Class<?>> collection) { if (collection == null) { return null; } return collection.toArray(new Class<?>[collection.size()]); }