method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
044bb694-7637-454e-8804-b6f80f934c3a
3
public boolean addEdge(Tile tile1, Tile tile2, String direction1, String direction2, Item key, boolean crossable) { Edge e; Direction dir1 = Direction.valueOf(direction1.toUpperCase()); Direction dir2; if(dir1 != null) { if(direction2.isEmpty()) dir2 = dir1.getOppositeDirection(); else dir2 = Direction...
acb4d157-9191-4550-9006-a2086442638b
4
private void calculateElements(double t) throws JPLEphemerisException { ephemeris.calculatePositionAndVelocity(t, JPLEphemeris.NEPTUNE, position, velocity); position.rotate(OBLIQUITY, Vector.X_AXIS); velocity.rotate(OBLIQUITY, Vector.X_AXIS); position.multiplyBy(AU); velocity.multiplyBy(AU*K); ...
0c444fd4-4b52-46f6-8bc8-7b0abc07c2ab
9
@Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (!(other instanceof Feature)) return false; Feature otherF = (Feature) other; boolean result = false; // Mu...
23a8af4e-0064-4fbb-a06e-205f80b64703
3
protected void train(double limiar) { double[] err = new double[w.length]; double t = 9999; /*while (t > limiar) {*/ for(int k = 0; k < 100000; k++) { t = 0; for(int i = 0; i < w.length; i ++) { err[i] = erro(i); w[i] = w[i] - (ETA*erro(i)); err[i] = err[i] - erro(i); } fo...
fe1466a0-941d-455e-b25f-7108960a3284
2
@Override public void copyTo(MapLayer other) { for (int y = bounds.y; y < bounds.y + bounds.height; y++) { for (int x = bounds.x; x < bounds.x + bounds.width; x++) { ((TileLayer) other).setTileAt(x, y, getTileAt(x, y)); } } }
360550e5-2e9d-4639-87cf-f879f7c8aa53
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RecordSelectorNode other = (RecordSelectorNode) obj; if (selector == null) { ...
3cae3ebe-a73f-4f89-b071-e0e7df490318
7
private int setQuarter(int quarter, String description) { if (quarter == 5) { this.overtime = true; if (description.contains("1st")) { return 1; } else if (description.contains("2nd")) { return 2; } else if (description.contains("3rd")) { return 3; } else if (descriptio...
88e79ccc-a05e-467e-9d68-4b2409d142d1
9
public void authenticate() throws ParseException, IOException { String string; Boolean exit = false; JSONObject json; // If not authenticated already, commence if (!authenticated) { try { // Keep reading outpu...
a933690a-b71f-48d0-aba4-0e0edeb3a5c6
5
public static void main(String[] args) { System.out.println("main start"); new Thread(new Runnable() { @Override public void run() { for (int i=0; i<100; i++) { System.out.println("thread:" + i); //这里本意是要程序停止的 if (i == 10) { System.exit(0); } try { Thread.sleep(200); ...
a4f7ecee-1918-4431-99c1-316a29d89347
7
public static String[] convertSingleConsoleCommand(String command) throws InvalidCommandException { logger.trace("Converting single console command for ProcessBuilder: " + command); List<String> preparedResult = new ArrayList<String>(); String tmp = null; for (String curren...
66592995-6fb2-4b85-8455-270bf4c0f2c1
1
public String getDirectory() { return (isAValidDirectory()) ? args[0] : Constants.DEFAULT_SERVER_DIRECTORY; }
618659b9-331e-47d6-ac6d-23deb030d851
6
@Override public void build(JSONObject json, FieldsMetadata metadata, IContext context) { // iterate on all the simple text Iterator<?> iter = json.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<?,?> entry = (Map.Entry<?,?>)iter.next(); // add the text to the report's context context.put(entr...
ba5e671b-1a9c-48fa-a1f6-ed2f8b6f3fab
6
public void takeTurn(int roll) { //calculate targets Board.calcTargets(currentPlayer.getLocation().y, currentPlayer.getLocation().x, roll); //take human turn if(currentPlayer == human) { this.setTurnDone(false); Board.setHumanTurn(true); Board.repaint(); } //take computer turn else { setTur...
996c0d5b-b153-4696-852d-be4e632f5d12
3
public static void main(String[] args){ //dirty log init org.apache.log4j.BasicConfigurator.configure(); Model model = ModelFactory.createDefaultModel(); File f = new File("rdf-model.xml"); FileReader fr; try { fr = new FileReader(f); model.read(fr, "http://imi.org/"); } catch (FileNotFoundExcept...
a4c95742-8853-4951-a9cb-d1703752f9ba
4
private void CalculateAttackSuccessButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CalculateAttackSuccessButtonActionPerformed PreparedStatement ps_update = null; Connection conn = null; try { if ((conn = JavaDBAccess.setConn()) != null) { System.out.println("Co...
b844b60e-9485-4f04-a654-96dd0ac6dc2a
8
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://download.oracle.c...
73cf84f8-33b0-4596-859b-6c71eda403e6
0
public void setKodPocztowy(String kodPocztowy) { this.kodPocztowy = kodPocztowy; }
e1aa2081-d180-4358-b90c-ba10ae541496
9
private void saveInfo(String name) { FileWriter baseSave = null; String eol = System.getProperty("line.separator"); try { baseSave = new FileWriter(name+".rcf"); //Build the file header baseSave.write("Base Controller Info;" + eol); //The Base Controller Name baseSave.write(">name:"+strName+";...
995a9278-c552-4f10-98bc-d4b3b82bbac7
1
protected void handleMousePressed(MouseEvent e) { synchronized (simulator) { if (simulator.isRunning()) { simulator.stop(); } else { simulator.start(); } } }
d8f9586f-7809-4c82-8839-f3a78f0cb49e
8
public static void printTree(MyTreeNode<Integer> root){ if(root == null) return; Stack<MyTreeNode<Integer>> stack = new Stack<>(); MyTreeNode<Integer> temp = root; stack.add(temp); MyTreeNode<Integer> head = null; while (!stack.isEmpty()) { temp = stack.peek(); if (temp.getRight() == head || tem...
1174f465-a84a-46dc-802e-3fee784bf603
3
@EventHandler public void Mondo(PlayerChangedWorldEvent event) { for(String s:Main.jl.dati()) { System.out.println(s); } String name = event.getPlayer().getName(); if(!Main.jl.leggi(name)) { if(event.getPlayer().getWorld() == Main.server.getWorld(Main.conf.mondo)) { Location lc = Main.sp.c...
7c1399a7-db3d-4633-9f8c-23274ec413ae
8
public double lru() { if(printAll) System.out.println("~~~~~ Least Recently Used ~~~~~"); int hits = 0; Page evictedPage; int prevPageRef = -1; int nextPage; for(int i=0;i<PAGE_REFERENCES;i++) { evictedPage = null; nextPage = nextReference(prevPageRef); prevPageRef = nextPage; fo...
d9e1dbeb-c678-4485-9362-fe097c0b5947
9
private void searchGoodWord(List<String> words) { if(words != null && !words.isEmpty()) { List<Keyword> keywordList = dictionary.getKeywordList(); int priority = -1; float distance = 1; int elementId = -1; int elementIdRegardingDistance = 0; for(int i = 0; i < words.size(); i++) { String[] p...
260c669d-496f-4100-ba47-d9dc9c910e44
4
public Question getNextQuestion() { if (nextQuestion == QueStatus.Q1_GAS_TYPE) return new Q1_GasType(gasSAXManager); else if (nextQuestion == QueStatus.Q2_ASK_BRAND) return new Q2_AskBrand(gasSAXManager); else if (nextQuestion == QueStatus.Q3_CHOOSE_BRANDS) return new Q3_ChooseBrands(gasSAXManager); ...
73b4f90b-c8eb-402c-a429-efb4f5bac648
0
@Override public String toString() { return "fleming.entity.Entradas[ idEntrada=" + idEntrada + " ]"; }
da856ba4-9564-4ae3-aab8-23f1b97cf2f3
3
private boolean jj_3R_16() { if (jj_3R_18()) return true; Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_19()) { jj_scanpos = xsp; break; } } return false; }
22305dcb-df91-421f-ae34-f27e3d0bd0b1
8
public void defaultFlipping(CharacterAction action) { switch (action) { case DEFAULT: break; case IDLE: break; case ATTACK: break; case MOVELEFT: currentAction.setFlip(true); break; ...
32192ad1-41c1-42f2-9383-e705c3ea7c52
5
@Override public void paint(Graphics g) { super.paint(g); Dimension koko = getSize(); int huippu = (int) koko.getHeight() - log.getRuudunKorkeus() * nelionKorkeus(); for (int i = 0; i < log.getRuudunKorkeus(); ++i) { for (int j = 0; j < log.getRuudunLeveys(); ++j) { ...
2852b20f-0008-4d37-b4eb-ed14e151d644
5
public void setVinculo(Vinculo vinculo){ this.vinculo = vinculo; if(vinculo != null){ this.lblMatriculaValor.setText(vinculo.getMatricula()); if(vinculo.getLinhaDePesquisa() != null){ this.lblLinhaDePesquisaValor.setText(vinculo.getLinhaDePesq...
f1080417-4f15-4ae8-b06f-149da81cd2fe
2
private void thresholdEdges() { for (int i = 0; i < picsize; i++) { data[i] = data[i] > 0 ? -1 : 0xff000000; } }
554c357f-7746-404f-8470-3f5a3be74cfe
8
public int getListOffset(RSyntaxTextArea textArea, TabExpander e, float x0, float x) { // If the coordinate in question is before this line's start, quit. if (x0 >= x) return offset; float currX = x0; // x-coordinate of current char. float nextX = x0; // x-coordinate of next char. float stableX =...
98dea368-66e1-4702-aca3-88fcadadc04c
1
public void Insert(TreeNode root,TreeNode node){ if(root == null){ root = node; } else{ insertRec(root,node); } }
9fe238ca-2c34-479f-9300-5cb3045861d3
7
public void mostrarDatosPantalla(String id, int nivel){ System.out.print("----"); System.out.print(id); System.out.println("----"); System.out.print("ExisteID: "); System.out.println(existeID(id, nivel)); System.out.print("Nivel: "); System.out.println(nivel); System.out.print("Clase: "); System.out.p...
87308d8b-06e8-4980-90d7-bbeeee17bdc0
7
public void move(int xa, int ya) { // this allows "sliding" on solid tile edges if(xa !=0 && ya != 0){ move(xa, 0); move(0, ya); return; } // movement handling if (ya < 0) dir = Direction.UP; if (ya > 0) dir = Direction.DOWN; if (xa < 0) dir = Direction.LEFT; if (xa > 0) dir = Direction.RIGHT; ...
21587834-efc4-4871-afb0-adf39af45651
0
public boolean isItemSent(Auction auction){ return auction.isItemSent(); }
1268069f-78b6-4f56-885f-d92d49e1682d
7
public Object nextContent() throws JSONException { char c; StringBuilder sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new St...
f327cb6a-760e-4503-a900-48e05a4b9335
5
public static Vector<Caddie> testCheckValideCaddie(Vector<Caddie> caddies, int formCaddie) throws ParseException, BDException{ Vector<Caddie> toDelete = new Vector<Caddie>(); // Vérification for(int i = 0 ; i< caddies.size() ; i++){ Caddie caddie = caddies.get(i); Date dNow = new Date( ); SimpleDateForm...
c91431ad-c088-4dca-bc5f-1fdf4ed943a6
3
public boolean hasDupDumb(String str) { for (int i = 0; i < str.length() - 1; i++) { for (int j = i + 1; j < str.length(); j++) { if (str.charAt(i) == str.charAt(j)) return true; } } return false; }
3edc64b9-d3b4-4d1a-88e7-0250892229e2
7
public void addBuilding(Building newBuilding, Point2D location) throws InvalidLocationException { if (!isInVillage(location) || !isInVillage(new Point2D.Double(location.getX()+newBuilding.getWidth()-1, location.getY()+newBuilding.getHeight()-1))) throw new InvalidLocationException(); for (int i = (int) locati...
f6715758-2afb-4c9c-8e97-a109fb805980
3
@EventHandler public void onPlayerDeath(final PlayerDeathEvent event) { final Player player = event.getEntity(); /*final removeEquipment removeEquipment = new removeEquipment();*/ StringBuilder flagPath = new StringBuilder(player.getName()); flagPath.append(".flag"); final FileConfiguration pFile = pCop...
1dc25348-8ae9-486b-b5e3-56c2b6b2ebea
3
public List<String> getStrings(String xpath) { List<String> list = new ArrayList<>(); try { XPathExpression expr = xPath.compile(xpath); Object result = expr.evaluate(document, XPathConstants.NODESET); if (result != null) { ...
c9937add-8c76-4d49-a05f-72111266b43c
3
@Override public String toString() { String s = "{ "; int aux = 0; for (int i = 0; i < listas.length; i++) { for (int j = 0; j < listas[i].size(); j++) { s += listas[i].get(j).toString() + ", "; if (++aux == 5) { s += "\n"; ...
917e05bf-ce32-485a-887e-a610e646c6f3
8
@Override public boolean doChanged(ObservableValue<? extends String> observable, String oldValue, String newValue) { int i = 0; try { i = Integer.parseInt(newValue); } catch(NumberFormatException nfe) { label.setText("Must be an integer"); return false; } if(!acceptNegative && i < 0) ...
e721436b-c7fe-44f7-8383-0c58a531f5ae
4
public void handleInput(Input input) { if (input.isKeyPressed(Input.KEY_S)) { if (currentWaveHasBeenCleared() || !wavesHaveBegun()) { if (!isFinalWave()) { startNextWave(); } } } }
1e03903c-41ab-4db7-a739-a170d6e7ce7e
9
public static int calcSoftTwo(Session aSession, Lecture aLecture) { int penalty = 0; Instructor anInstructor = aLecture.getInstructor(); if(anInstructor != null){ List<Lecture> coursesTaughtByInstructor = anInstructor.getInstructedLectures(); for(int i = 0; i < coursesTaughtByInstructor.size(); i++){ Se...
7bea9ac0-1ca3-4a3e-9416-03f2ad254b2f
6
public static void justifyText(String[] words, int maxLength) { int[] justifyCost = new int[words.length+1]; int[] justificationPoints = new int[words.length +1]; List<String> result = new ArrayList<>(); justifyCost[words.length] = 0; for(int i = words.length-1; i >= 0; i--) { ...
6d498b18-1bd3-4b61-b1f6-49c7e3a3b374
4
private static void sortResults(Map results) { // TODO Auto-generated method stub TreeSet sortedResults = new TreeSet( new Comparator(){ @Override public int compare(Object o1, Object o2) { // TODO Auto-generated method stub User user1 = (User)o1; User user2 = (User)o2; /*如果com...
abd87eba-9369-41d6-a326-8dc5c9ec33af
4
public void teleport(Player player, int playerNumber) { if (playerNumber == 1) { if (getSpawnLocation1() == null) { player.sendMessage("Location not set yet."); return; } player.teleport(getSpawnLocation1()); } else if (playerNumber == ...
7c749294-2a19-46a9-841d-3227fa07da5a
7
public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) { if (item instanceof ToolItem) { ToolItem tool = (ToolItem) item; if (tool.type == ToolType.shovel) { if (player.payStamina(4 - tool.level)) { level.setTile(xt, yt, Tile.dirt, 0); Sound.monsterHurt.play(...
4c715130-b5dd-4a07-a509-3097cb640c30
6
public void paintComponent(Graphics g) { super.paintComponent(g); if(count<7 && count>0) { g.setColor(Color.YELLOW); g.fillRect(1,200,200,20); g.fillRect(250,200,200,20); g.fillRect(500,200,200,20); g.fillRect(750,200,200,20); g.fillRect(1,450,200,20); g.fillRect(250,450,200,20); g.fillR...
7f9f3127-0297-4c11-be87-86f1a708c3b2
0
public static void main(String[] args) { Set<Integer> linkedHashSet = new LinkedHashSet<Integer>(); linkedHashSet.add(1); linkedHashSet.add(2); linkedHashSet.add(0); linkedHashSet.add(4); linkedHashSet.add(8); linkedHashSet.add(6); System.out.println("lin...
1e324b36-9102-4f5f-84bb-6e0212192420
9
public static Polygon interpolate(Polygon p, int points) { if (points < 1) return p; Polygon ret = new Polygon(); ret.setClosed(p.closed()); for (int i = 0; i < p.getPointCount(); i++) { float[] point = p.getPoint(i), pointNext = i < p.getPointCount()-1 ? p.getPoint(i+1) : (p.closed() ? p.getPo...
f726a483-ae1e-4f66-80ba-d346dbff17ad
8
private void installListeners() { button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String folderPath = MainWindow.this.getTextField().getText(); File file = new File(folderPath); ...
329004b9-6db7-4f0c-b2b1-7740416bfc92
3
private void cancelBuild(){ if (placeHolder != null){ //cancels the building of a tower removeObject(placeHolder); placeHolder = null; place = false; removeObject (r); r = null; } else if (selectedTower != null){ /...
bc0a8694-3263-4faa-aeb9-8c27a06cdd27
4
@Override public Receiver createReceiver(byte code, KadServer server) { switch (code) { case ConnectMessage.CODE: return new ConnectReceiver(server, this.localNode); case ContentLookupMessage.CODE: return new ContentLookupReceiver(server, t...
41506de4-363f-4574-aa7b-c93a9b141298
0
@Override public int compareTo(Vertex o) { return this.distance - o.getDistance(); }
1e79e975-a847-42d3-a181-f13807647ab9
3
public void endGame() { blackFood = 0; redFood = 0; for (int[] i : world.getAnthillCells()) { if (world.getCell(i).anthill.equalsIgnoreCase("black")) { blackFood += world.getCell(i).getFood(); } else if (world.getCell(i).anthill.equalsIgnoreCase("red")) { ...
9628884c-ed79-41fd-a21e-e8ff839291bc
5
@Override public Object getPage(int pageNum, int width, int height) throws NoSuchPageException { if (pageNum < 1 || pageNum > pdffile.getNumPages()) throw new NoSuchPageException(); PDFPage page = pdffile.getPage(pageNum); int sourceWidth = (int) page.getBBox().getWidth(); int sourceHei...
41029214-e4bb-4682-9d82-81a500231217
9
private void skipPastAnyPrefixJunk(InputStream in) { if (!in.markSupported()) return; try { final int scanLength = 2048; final String scanFor = "%PDF-1."; int scanForIndex = 0; boolean scanForWhiteSpace = false; in.mark(scanLength);...
9353c63a-0522-42aa-a28f-95a573c9e970
4
public boolean canSummon(Familiar familiar) { return familiar != null && points() >= familiar.requiredPoints() && (!summoned() || timeLeft() <= 150) && !ctx.backpack.select().id(familiar.pouchId()).isEmpty(); }
8821607e-1924-4c64-8752-dfa764e6cd9c
1
protected boolean getFlipY (Node contNode) throws ParseException { logger.entering(getClass().getName(), "getFlipY", contNode); boolean flipY = false; String strValue = getProcessingInstructionValue(contNode, "flip-y"); if (strValue != null) flipY = strValue.equalsIgnoreCase("true"); ...
003cab6b-6319-412d-9680-5061c9ce2541
4
private void parsePidstatMetrics(String wholeMetricsText, List<JvmModel> list) { JvmModel cjm = list.get(list.size() - 1); String[] lines = wholeMetricsText.split("\\n"); int RSS = 0; for (String line : lines) { if (line.length() == 0 || line.charAt(0) == '#') continue; String parameters[] = lin...
12fd850f-4e9d-40ff-99e3-038be5e27c40
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && ...
fd649071-b88f-4d8d-bf13-d61d2de6aa3d
3
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); Connection conn; Statement stmt; ResultSet rs; HttpSession hs=request.getSession(true); hs.setAttribute("...
3a5888bb-73e5-4691-be74-385205e7ea24
7
static final void method1428(byte byte0, int i) { if (byte0 != -41) { return; } if (!Class99.aBoolean1680) { i = -1; } if (~i == ~Class105.anInt1733) { return; } if (i != -1) { Class116 class116 = Class142_Sub8_Sub31...
52b62522-0ce5-4d25-ab96-62f9d45246e7
3
public void run(){ while(keepRunning){ synchronized(syncObject){ if(wait){ try { syncObject.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } }
5a2f5509-4475-49e4-892f-ad6be72d2ada
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 fe...
d1c6fe19-2698-48e7-b604-6a5460b18326
5
public static void loadAllFusions() { int c; File[] files = PluginVars.dirCards.listFiles(); List<File> fusion_configs = new ArrayList<File>(); List<String> set_names = new ArrayList<String>(); for(File f : files) { if(!f.getName().substring(0,4).equalsIgnoreCase("fus_")) continue; fusion_configs.add(f)...
f08bf2d5-8071-49ff-8c90-bfd7c10de360
5
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_SPACE && !getMidair()) { setDY(-4 * Board.getInstance().getGravity()); setMidair(true); } if (key == KeyEvent.VK_LEFT) { setDX(-2); } if (key == KeyEvent.VK_RIGHT) { setDX(2)...
a793c028-dbca-4b6f-9171-b90fa4cb550b
9
public void init() throws IOException { ServerSocketChannel channel = ServerSocketChannel.open(); //Creates an unbound ServerSocketChannel System.out.println("Server Launched!"); //Bind the channel to an address. The channel starts listening to incoming connections channel.bind(new InetSocketAddress(host, po...
5bc2fa50-4c01-44c1-9a92-51e43e8e4e84
5
public static int minimumTotal(List<List<Integer>> triangle) { if (null == triangle) { return 0; } else if (1 == triangle.size()) { return triangle.get(0).get(0); } int[] minlen = new int[triangle.size()]; for (int level = triangle.size() - 1; level >= 0; level--) { for (int i...
e90ce23e-7401-48a4-80a8-d0fa1ad7bfd9
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...
4e80d6a5-9f74-4ccf-838d-5c4ba0f03914
4
public Manacher(String s) { this.s = s.toCharArray(); t = preprocess(); p = new int[t.length]; int center = 0, right = 0; for (int i = 1; i < t.length - 1; i++) { int mirror = 2 * center - i; if (right > i) p[i] = Math.min(right - i, p[mirror]); // attempt to expand palindrome centere...
f2be345d-d0bd-4fb7-9fed-4e215d1a2414
8
public static double getDet(double[][] A){ if(A.length != A[0].length) return Double.NaN; double det = 0; int cofact = 0; if(A.length == 1) return A[0][0]; for(int i = 0; i<A.length; i++){ double[][] T = new double[A.length-1][A.length-1]; for(int j = 1; j<A.length; j++){ for(int k = 0; k<A.le...
2a1bc1bd-bb44-4a62-a13a-cea76b560afe
4
public JSONWriter key(String s) throws JSONException { if (s == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { if (this.comma) { this.writer.write(','); } stack[top - 1].put...
63c820c2-af76-47bf-a822-d9a9f2a618a4
4
public static void check_intersect(double Hy, double Hxl, double Hxr, double Vx, double Vyt, double Vyb) { if (Hy < Vyt && Hy > Vyb && Vx > Hxl && Vx < Hxr) { //if the y-value of the horizontal component is within the range of the y-values of the vertical //component and the x-values of the vertical componen...
ffdf39bf-d37c-43c9-9586-6d9ac360e673
5
public Image contrast(Image im, int width, int height, int contrast) { int pix[] = JIPTUtilities.getPixelArray(im); int new_pix[] = new int[width*height]; int mean_luminance = 0; mean_luminance = getMeanLuminance(pix); for(int i = 0; i < pix.length; i++) { ...
8643025c-6a1d-476f-8b60-68678b39e51f
8
protected Dimension doLayout(Container target) { // Pass 1 - get preferred sizes minw = minh = 0; curComps = target.getComponents(); for (int i = 0; i<curComps.length; i++) { Component tc = curComps[i]; Dimension d = tc.getPreferredSize(); minw = Math.max(minw, d.width); minh = Math.max(minh, d.hei...
2795e062-9ce3-4bd2-b327-bcc38454de8d
8
private void initialize(String fileName) throws IOException { BufferedReader br = new BufferedReader(new FileReader(fileName)); String nextLine; while ((nextLine = br.readLine()) != null) { if (nextLine.trim().equals("DESTINATIONS")) { while (!(nextLine = br.readLine().trim()) .equals("END_D...
ab904eb0-311f-405d-84ad-637aa59098ec
3
@WebMethod(operationName = "ReadCountry") public ArrayList<Country> ReadCountry(@WebParam(name = "cnt_id") String cnt_id) { Country cnt = new Country(); ArrayList<Country> cnts = new ArrayList<Country>(); ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>(); ...
2a251345-d0e0-45d4-b05c-681671ea9a8a
4
private void generateChests() { int chestWidth = 34; int chestHeight = 23; int[] chestLevels = {2, 2, 3, 3, 4, 5}; for (int level = 0; level < chestLevels.length; level++) { for (int count = 0; count < chestLevels[level]; count++) { boolean chestPlaced = fals...
e3e000dc-1151-499a-8ecd-6bd376c87371
0
public int read() throws IOException { //init(); isInited = true; return internalIn.read(); }
74b04d0a-907c-4525-ad6d-90e203553d35
8
protected void cellResized(Object cell) { mxGraph graph = getGraph(); mxGraphView view = graph.getView(); mxIGraphModel model = graph.getModel(); mxCellState state = view.getState(cell); mxCellState pstate = view.getState(model.getParent(cell)); if (state != null && pstate != null) { Object[] cells ...
4e2f1b3c-90a7-4b23-869b-b2ca57e9e5af
8
@Override public void iterate(){ matcount += 1; if(matcount >= mat){matcount = 0; calculate(); } if(ages){ if(active){ if(age == 0){age = 1;} else{age += 1;}}else{ age = 0;} if(fades){ if( age >= fade){ purgeState(); age = 0;}} if( age > 1023){ age = 1023; }state = agify(age);} else{if(acti...
7cf84985-a826-475b-8322-4ccc94db2f45
9
public boolean commandProcessing(String userInput) /* processes user commands */ { boolean successfulMove = false; if(userInput.startsWith("clear")) { clear(); } else if(userInput.startsWith("go")) { successfulMove = go(userInput); } ...
b1c72dd7-6cf0-4458-ab47-b38286a039d0
1
public MFEVersionCommand(CommandParameter par) { if(par == null) throw new NullPointerException("MFEVersionCommand has a null CommandParameter"); this.par= par; }
77024a5c-815f-4ea2-8285-27cdd5122913
8
public static void menu() { while(true) { print("**********************\n"); print("* SPN Demo *\n"); print("**********************\n"); print("* 1 - Create *\n"); print("* 2 - List *\n"); print("* 3 ...
01ca95af-dc62-42f9-ba40-b080a39629c7
2
public void checkConsistent() { super.checkConsistent(); StructuredBlock sb = outer; while (sb != continuesBlock) { if (sb == null) throw new RuntimeException("Inconsistency"); sb = sb.outer; } }
d386553b-f2b8-4e7c-bf05-48bc1b13d57e
0
public Being bear() { dynamicStats.get(StatType.D_EATEN).addToValue(-30.0); int newClassID = WorldPhysics.nextID(); return new CellCreature(new Point3(pos), constStats.mutateClone(), childDynamicStats.clone(), newClassID); }
8f9165b5-7ce5-4e06-9146-45411a83cf68
0
public Nan() { super("Nan", 29780, 600, 9001, 500, as); as.setSkill(0, "Logic", 10000, 50, "Nan uses the power of logic to smite his enemy."); as.setSkill(1, "Righteous Fury", 25000, 100, "Nan unleashes righteous fury."); as.setSkill(2, "Lance Of Longinus", 90001, 150, "Nan sends the holy Lance of Longinus at ...
3ae83ba3-26ae-4f23-8e38-0fb68b70315f
7
public void removeSecondaryEdge(ComparableNode source, ComparableNode target) throws MaltChainedException { if (source == null || target == null || source.getBelongsToGraph() != this || target.getBelongsToGraph() != this) { throw new SyntaxGraphException("Head or dependent node is missing."); } else if (!target....
b6e8d7c0-52ec-498b-96db-3d9675db6900
6
public void saveTracks(String folderToSave) { File folder = new File(folderToSave); boolean success = folder.mkdirs(); System.out.println("created folder: " + folder.getAbsolutePath() + " " + (success ? "created" : "")); MyDownloadExecutor executor = new MyDownloadExecutor(nThreads); ...
00e12a49-178d-448b-8ea0-b1c4fee658e1
6
public static void start() { running = true; Runnable runnable = new Runnable() {@Override public void run() { long lastMillis = System.currentTimeMillis(); long deltaLastMillis = System.currentTimeMillis(); while (running) { long newMillis = System.currentTimeMillis(); long sleep = 15 - (newMill...
a09c71f6-980e-4652-800c-3021a59de182
2
public int tLineCount(){ int tCount = 0; if(statement.toString()!=null) tCount = statement.tLineCount(); if(statements.toString()!=null){ tCount += statements.tLineCount(); } return tCount; }
eb968a32-ca77-46c0-bcc4-8c5fe12baa8a
0
public void setIntelligence(double intelligence) { this.intelligence = intelligence; }
d7ded1b3-c4d2-4378-a76c-dde3d866fcd9
5
public List<List<Gate>> getGates() { List<List<Gate>> layersOfGates = new ArrayList<List<Gate>>(); boolean firstLine = true; try { BufferedReader fbr = new BufferedReader(new InputStreamReader( new FileInputStream(circuitFile), Charset.defaultCharset())); String line; //hack to skip first line L...
9f721a51-59c3-4122-a500-2dbe1e8b4519
6
public void clicked(String sender) { if (sender == "hud") { for (int i = 0; i < HUD.qSlots.length; i++) { HUD.qSlots[i].selected = false; } selected = true; Player.selectedWeapon = this.weapon; } if (sender == "pane") { for (int i = 0; i < SpellSelectGUI.spells.size(); i++) { SpellSelectGUI...
1cd99494-73d1-430e-9b72-f0143bd47e28
2
public Option getOption(String ID) { for (Option o: options) { if (o.getID().equals(ID)) { return o; } } return null; }
80d215df-e3cc-49b5-ad3a-4b59edaec60d
5
private boolean setupSQL() { if (config.getSQLValue().equalsIgnoreCase("MySQL")) { dataop = new MySQLOptions(config.getHostname(), config.getPort(), config.getDatabase(), config.getUsername(), config.getPassword()); } else if (config.getSQLValue().equalsIgnoreCase("SQLite")) { dataop = new SQLiteOptions(new...
d34c8fbb-1734-48c7-a497-4028cca5920d
8
@SuppressWarnings("static-access") public boolean doIt(int width, int height, int frameRate, List<String> inFiles, MediaLocator outML, String type) { this.fRate = frameRate; ImageDataSource ids = new ImageDataSource(width, height, ...