method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cb98df6f-632c-4a75-9058-9f36b3a8f915
5
static int extractVariableOrLiteral(SqlParams params, String str) { if (str != null) { if (str.startsWith(":") && str.length() > 1) { String fetchVariableName = extractVariableName(str); if (params.contains(fetchVariableName)) { return ((Number) params.get(fetchVariableName)).intValu...
e98efe3e-78a3-48a8-b90e-b830d0e9b6b0
1
public void visit_l2d(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 2; }
01f361b9-faee-46ec-b553-08c9b76e50cb
9
private ArrayList<Key> searchCandidateKeys(RelationSchema schema, ArrayList<Attribute> m, ArrayList<Key> candidateKeys, ArrayList<ArrayList<Attribute>> level) { ArrayList<ArrayList<Attribute>> nextLevel = new ArrayList<>(); ArrayList<Attribute> tempList; for (ArrayList<Attribute> attrList : level) { if (is...
833ab53e-85cb-4ff0-9f7b-541026f9ea8d
1
@Test public void WhenFailedPath01_ExpectHostWithPrefix001() throws UnknownHostException { // localhost: "000" // failed: "01" // resulted prefix: "001" RoutingTable routingTable = new RoutingTable(); Host localhost = new PGridHost("127.0.0.1", 3000); localhost.setHos...
89859f29-c25c-4aa9-901d-6384d1ecdce4
5
private void calculateLineFrequencies(){ double lowestFrequency = Fmath.minimum(this.frequencies); double highestFrequency = Fmath.maximum(this.frequencies); if(this.logOrLinear){ double logLow = Fmath.log10(lowestFrequency); double logHigh = Fmath.log10(highestFrequency)...
1d9a4f81-a9a6-4a67-b782-e0f8441d35b0
1
private void toAndroid_fastbootMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toAndroid_fastbootMenuActionPerformed try { adbController.getFastbootController().rebootDeviceFastboot(deviceManager.getSelectedFastbootDevice(), RebootTo.ANDROID); } catch (IOException | Nu...
051b831d-26c1-4572-9169-a975f7a84b60
1
private void addBackground(String path) { try { backgrounds.add(new Background(ImageIO.read(getClass().getResourceAsStream(path)), PlayerData.playerData.getBackground().contains(path), path)); } catch (IOException e) { e.printStackTrace(); } }
41dc989e-0fc8-456a-ad1f-0a98c9958847
0
public void setBreakpoint(int lineNumber) { sourceLines.get(lineNumber).setBreakpoint(); }
c3232fd2-f677-461e-bc7d-cdd1ffd70120
7
@Override public void input(float delta) { Vector2f centerPosition = new Vector2f(Window.getWidth()/2, Window.getHeight()/2); if(Input.getKey(unlockMouseKey)) { Input.setCursor(true); mouseLocked = false; } if(Input.getMouseDown(0)) { Input.setMousePosition(centerPosition); Input.setCursor(fa...
ddea3369-6ac5-49ce-922e-072804aee325
9
private Txo getAssociatedTxo() { Boundsheet bs = getSheet(); int idx = -1; if( bs != null ) {// shouldn't! idx = bs.getIndexOf( OBJ ); if( idx == -1 ) { return null; // should't! } while( idx < bs.getSheetRecs().size() ) { if( ((BiffRec) bs.getSheetRecs().get( idx )).getOpcode() ==...
e13f2927-a175-4519-9f54-7c5bb56c58b7
1
@Override public String toString() { int secs=this.getSeconds(); int mins=secs/60; secs=secs%60; return "FLAC[" + sampleRateHz + "Hz/" + numChannels + "ch/" + bitsPerSample + "bit/"+mins+":"+(secs<10?"0":"")+secs+"]"; }
015bf8db-e164-4364-b894-37038b4eccf4
1
public void removeTray(Tray tray) { if (this.trays.contains(tray)) { this.trays.remove(tray); tray.setProductType(null); } }
d19195af-6865-44dc-8325-32c02831fb58
4
public void run(){ boolean running = true; while (running){ String line = null; try { line = stream.readLine(); if (line == null) running = false; else { System.out.println(line); IRCMessage mesg = InputParser.parse(line); if (mesg.getResponse() != IRCCommand.NONE){ ...
a230c8db-5083-47db-a5a4-969f86a33d6d
4
public static Double extractLengthFrom(String filePath) /* * The extractLengthFrom method checks the length of the track * and returns a double that represents the length */ { double trackLength = 0.0; Mp3File mp3File; try { mp3File = new Mp3File(filePath); trackLength = mp3File.getLengthInSec...
d6338229-8079-48fc-9e09-cb6d59f54dcd
2
@Override public int partition(int[] array, int pivotIndex, int b, int e) { { int pivot = array[ pivotIndex ]; // swap pivot and last element array[pivotIndex] = array[e]; array[e] = pivot; // put every element lower than the pivot before this latter int swap; int newPosition = b; for...
2013991c-e476-4ed4-8552-d265b1a25401
1
public List<Monitor.Listeners.Listen> getListen() { if (listen == null) { listen = new ArrayList<Monitor.Listeners.Listen>(); } return this.listen; }
7237b3c3-4471-48a6-9c01-e6dfc8aeb76d
6
@Override public void Draw(Graphics2D g) { if(!show) return; String state = Game.get().display.gameState.getName(); g.setColor(Layout.OVERLAY_COLOR); g.fillRect(0, 0, 800, 150); g.setColor(Color.white); g.setFont(Layout.MAIN_FONT); g.drawString("FPS: " + Game.get().fps.getFPS(), 700, 22); ...
b82ddd2a-b829-4228-8858-c77558f1bc1c
8
public void insert(char[] origChars, int off, V value) { // precondition: origChars and this node share a common prefix // off is positioned at the first character that does not match this node's // prefix. // if there are no children, then add a new single child with all of the chars. if (children...
f5170a18-d068-491d-9e0c-38456020618d
8
public boolean equalsTo(WikiPage page) { if (!page.getTitle().equals(pageTitle)) { return false; } if (!page.getPageId().equals(pageId)) { return false; } if (!page.getPageText().equals(pageText)) { return false; } if (!page.get...
67fed400-1b3c-4811-8e04-db64d9638e02
2
public void mouseWheelMoved(MouseWheelEvent e) { if(e.getWheelRotation() < 0) //scrolled up { Main.world.changePerm(1); } else if(e.getWheelRotation() > 0) //scrolled down { Main.world.changePerm(-1); } }
0ae371ae-6314-4f5b-82ba-927066c2c608
0
public void remove() { tile.putBomb(null); owner.returnBomb(); }
62262597-c565-4647-8a62-e43f1de3f11b
9
private String getHTTPStatusHeader(int statuscode) { switch (statuscode) { case 200: return "HTTP/1.1 200 OK" + CRLF; case 301: return "HTTP/1.1 301 Moved Permanently" + CRLF; case 400: return "HTTP/1.1 400 Bad Request" + CRLF; case 403: return "HTTP/1.1 403 Permission Denied" + CRLF; c...
c6d26afe-357e-4e5e-8284-6f98c0465a2f
8
public static void run(String[] args) throws IOException, InterruptedException { Runtime rt = Runtime.getRuntime(); Process ps; boolean vMode = false; String ip = GetIP.run(); String[] newNode = {"["+ip+"]"," address "+ip," use_node_name yes"}; if(args[0].equalsIgnoreCase("-v")) { ...
ebb59eed-10c4-4627-8240-9eac3b3a773e
3
public void download() { // ファイル名はURL末尾 String folderCalenderPath = FileUtil.getFolderPathNameYearAndMonthSubDirectoryDay(); String path = FileUtil.createPath("media", folderCalenderPath); File file = new File(path); if (!file.exists()) { file.mkdirs(); } MediaUrlDao mediaUrlDao = new MediaUrlDao(); ...
8927e0e2-6eb5-4afb-bac3-68957f0a0781
4
public static void empty( File... paths ) throws IOException { IOException exception = null; for ( File eachPath : paths ) { if ( !eachPath.exists() ) { throw new FileNotFoundException( "File or directory do not exists " + eachPath ); } ...
5af8a239-8ead-432e-883f-5fb5528be022
7
private void beginServing() { if (m_ServletMap.size() > 0) { do { // System.out.println("========================="); // System.out.println("SERVER PULSE"); // System.out.println("========================="); for (int i = 0; i < SERVLET_TYPE.values().length; i++) { SERVLET_TYPE servletType = S...
9efb8505-af21-408b-9684-d7dbc164cc04
9
@Override public boolean fillInArea(XMLTag piece, Map<String,Object> defined, Area A, int direction) throws CMException { final String layoutType = findStringNow("layout",piece,defined); if((layoutType==null)||(layoutType.trim().length()==0)) throw new CMException("Unable to build area without defined layout")...
3c108f07-61e4-42b2-a83e-2d214d19f291
1
@Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()){ case "sendMessage": cc.handleInput(jMessage.getText()); jMessage.setText(""); } }
e596a67b-9778-4b14-ac78-1305b7b7a901
3
public void sendBroadcast(Serializable content) throws IOException { // create broadcast if necessary if (broadcastSocket == null) { broadcastSocket = new DatagramSocket(); broadcastSocket.setBroadcast(true); } // transform the object into a byte array // the message contains both the object and the ad...
4ac27a3d-737a-4977-a941-5bbdfafb13a6
9
private void checkShortArgResults(String argChars, String[] args, boolean shouldFail) { int errs = 0; log.info("** START NEW WAY ** " + argChars); GetOpt go2 = new GetOpt(argChars); Map<String,String> m = go2.parseArguments(args); if (m.size() == 0) { log.info("NO ARGS MATCHED"); } Iterator<Map.Entry<S...
bd0031aa-3802-4539-846a-c386331e4f49
9
private boolean isVowel(char c) { return (c == 'a') || (c == 'A') || (c == 'e') || (c == 'E') || (c == 'i') || (c == 'I') || (c == 'o') || (c == 'O') || (c == 'u') || (c == 'U'); }
e5e906fc-d73f-4194-9b30-c83e8dd45897
8
private void siirraRuudukkoa() { if (suunta.getXmuutos() != 0) { if (suunta.getXmuutos() < 0) { if (rajaaja.getSuurinX() > this.ruutuHallitsija.getRuudukonSuurinX() - 4) { this.ruutuHallitsija.siirraRuudukkoaXsuunnassa(1); } } else if (...
49b2bd88-80b6-45c9-b076-2a2bf9457c64
1
private double findMedianFitness() { //before calculate fitness for all organisms /*for (int i = 0; i < organisms.size(); i++) { organisms.get(i).countFitnessOut(); } //*/ sortByFitness(); double length = getOrganisms().size(); double median; ...
a7de41bc-3b88-420e-9d34-a5c415c1d6d0
0
public boolean isPaused() { return paused; }
dcc3ba8e-b5d9-4914-ab1f-d0f8bb2cf842
7
public synchronized DataInputStream getChunkDataInputStream(int x, int z) { if (outOfBounds(x, z)) { debugln("READ", x, z, "out of bounds"); return null; } try { int offset = getOffset(x, z); if (offset == 0) { // debugln("READ", x...
cb383a7b-caa6-4b7d-9634-9f36156f38d0
5
@EventHandler(priority = EventPriority.LOWEST) public void onPaintingPlace(PaintingPlaceEvent e) { if (Settings.world || WorldSettings.worlds.contains(e.getBlock().getWorld() .getName())) { if (Settings.paintz && !PermissionHandler.has(e.getPlayer(), PermissionNode.ALLOW_PAINTINGS)) { e....
9292b297-c53c-417d-9755-460d616212fc
7
private void generateDisplay() { switch(mode) { case INTRODUCTION: mContainer.add(new Introduction().getComponent(), BorderLayout.CENTER); break; case PIXELS: variableDisplay = new Pixels(); mContainer.add(variableDisplay.getContainer(), BorderLayout.CENTER); ((Pixels)variableDispl...
24183a44-89ef-4fb6-bda8-2c8fee77f1d0
8
protected void zumVorherigenBereich() { --_aktuellerBereich; _uiFragenErstellerWerkzeug.getWeiterButton().setEnabled(true); if(_aktuellerBereich <= 0) { _aktuellerBereich = 0; _uiFragenErstellerWerkzeug.getZurueckButton().setEnabled(false); } switch(_aktuellerBereich) { case 4: if(_hat...
351d46de-7bdf-4950-97eb-fcef086ab1ba
0
@Override public PermissionType getType() { return PermissionType.WORLD; }
dbf5adf1-5883-4c12-b8f4-06b26ae98cdc
7
public static Keyword tryManufactureSkolemProof(ControlFrame frame) { { Proposition proposition = frame.proposition; NamedDescription description = Logic.getDescription(((Surrogate)(proposition.operator))); Cons argumentvalues = Stella.NIL; if ((!Logic.testPropertyP(description, Logic.SGT_PL_KERN...
272ab070-67e9-4c0a-8584-a129a317a7fc
5
public ElGamal_Key(int k) { Random rand = new Random(); do { // p waehlen this.p = new BigInteger(k, 400, rand); // Generator g>1 erzeugen factors = factorize(p.subtract(BigInteger.valueOf(1))); } while(factors==null); // wiederholen falls factorize() zu lange dauert Boolean found; do { g =...
f1ad7d4c-a632-4b70-bc78-2efaee14f360
9
private void dfs(Node root) { if (root == null) return; if (root.left != null) dfs(root.left); if (root.right != null) dfs(root.right); if (root.right == null && root.left != null) { root.robValue = root.left.norobValue + root.val; root.norobValue = Math.max(root.left.robValue, root.left.norobVal...
39fc8651-8d73-4d4b-8819-d26f38500e6c
1
@Override public void addData(String segment, NepticalData data) throws DataDefinitionException { if(!fragments.contains(segment)){ fragments.add(segment); } this.data.put(segment, data); }
bcc98f08-c0ec-4c7f-a35c-25a6515b3a6f
1
public static void main(String[] args) throws InterruptedException { new Thread(new Runnable() { @Override public void run() { int i = 0; while (!done){ i++; } System.out.println("done!"); } }).start(); System.out.println("OS: " + System.getProper...
1352c7f8-8f3b-4b20-94ab-344a2151ba57
6
public void parse() { boolean success = false; // Keep trying if file not found while (!success) { System.out.print("Enter filename (or 000 to exit): "); this.file = in.nextLine(); if(file.trim().equals("000")) { System.out.println("Program Terminated"); System.exit(0); } try { /...
bd497cd0-e760-47d3-9859-56fa88068391
5
@Override public boolean execute(CommandSender sender, String[] args) { if(!(sender instanceof CommandSender) || (sender instanceof Player && !sender.isOp())) { sender.sendMessage("You don't have permission to perform this command"); } Collection<Member> members = memberManager.getAllMembers(); if(me...
ee6afd84-78c1-4845-abc8-adfcc025a836
3
public void drawAvailableActions(Graphics2D g) { BufferedImage bimg; final int offset = 2; final int size = 50; final int initPosx = 720; int posx = 720; int posy = 565; int i = 0; g.setColor(border); ImageObserver io = (img, infoflags, x, y, w...
07484696-9d38-4f63-92ad-34ff4a6d7d4a
5
public void mouseReleased(MouseEvent paramMouseEvent) { if (TextButton.this.Clickable) { if ((TextButton.this.NormalBackgroundColor != null) && (TextButton.this.MousePressedBackgroundColor != null) && (TextButton.this.getBackgroundColor() != TextButton.this.NormalBackgroundColor)) { if...
e9b389ca-e6e6-486e-a71a-a97be7cbd9c6
4
@Override public boolean login() throws LoginException { if (debug) { LOG.debug("login..."); } if (callbackHandler == null) { LOG.error("Error: no CallbackHandler available"); throw new LoginException("Error: no CallbackHandler availab...
689527d1-3ddf-4113-ad19-386af0f5391b
0
public String getPostalCode() { return addressCompany.getPostalCode(); }
b123d7e4-a7ce-4f5b-a3c3-3c2391b61a5c
8
private static String js_substring(Context cx, String target, Object[] args) { int length = target.length(); double start = ScriptRuntime.toInteger(args, 0); double end; if (start < 0) start = 0; else if (start > length) ...
0a08dd7b-bd64-48eb-97c2-b3c6f4177347
5
public boolean crearLink(String nombre, String usuario, String password, String host, String port, String serviceName) throws GlobalException, NoDataException, SQLException{ boolean exito = false; try { conectar(user, pass,ip,port,db); } catch(ClassNotFoundExceptio...
31d530c7-63bb-423f-b0ca-ed6a7d077912
4
private int read(int bytesToRead) throws IOException { int nBytesRead = 0; int nBytesTotalRead = 0; //check buffer size and adjust it if(inputBuffer.length < bytesToRead) inputBuffer = new byte[bytesToRead]; while (nBytesRead != -1 && bytesToRead > 0) { nBytes...
6397d746-5058-4de7-8f9c-243b394047de
8
public Instances generateExamples() throws Exception { Instances format = getDatasetFormat(); Instance example = null; if (format == null) throw new Exception("Dataset format not defined."); // generate examples for one cluster after another for (int cNum = 0; cNum < getClusters().length; c...
3e00bc82-0d00-46ae-9f1d-666967c37f7b
7
@Override public List<Funcao> Buscar(Funcao obj) { String consulta = "select f from Funcao f"; String filtro = ""; HashMap<String, Object> parametros = new HashMap<String, Object>(); if (obj != null) { if (obj.getIdFuncao()!= null) { ...
afd9bc5d-2cdd-4033-b3cd-bd85d64e720a
7
public boolean AsynConsume(String res) { boolean flag = false; if (res != null && !res.isEmpty()) { if (checkDepository(res)) { //ResourceItem output = new ResourceItem(res, 1);//产出1单位物品 ResourceFormula checkList = formulaMap.get(res);//取出该合成公式 ...
4ba908f8-843e-4e07-8530-2903642736f8
3
protected void applySelectedChanges() { boolean changed = false; for (int i = 0; i < changes.size(); i++) if (changeSelected.get(i)) { changes.get(i).apply(courseModel); changes.remove(i); changeSelected.remove(i); i--; changed = true; } if (changed) finishModification(); }
9d71eaf3-57f5-42b0-a31a-2a1a92b57fee
1
public PartitionManager(ADBController adbController, boolean debug, Logger logger, LangFileParser parser, String serialNumber, boolean cleanFlash) { this.setLocationRelativeTo(null); this.setIconImage(new ImageIcon(this.getClass().getResource("/eu/m4gkbeatz/androidtoolkit/resources/UniversalAndroidToolk...
094b06a3-57c0-4b15-b51f-f81d1cd059c0
2
@Override public void update(GameContainer gc, StateBasedGame sb, float delta) { for (Component component : components) { try { component.update(gc, sb, delta); } catch (SlickException e) { // TODO Auto-generated catch block e.printStac...
64179c12-ab69-4771-9ce7-7334e04f6983
9
public static void main(String args[] ) throws IOException{ if( args.length < 4 ){ System.err.println("Incorrect Args"); return; } overwrittenScripts = new ArrayList<String>(); if( args.length > 4 && args[4].equalsIgnoreCase("y")){ OVER_WRITE_SCRIPTS = true; } else OVER_WRITE_SCRIPTS = false; ...
f7e2c3c3-c824-486a-a79a-411975f541c5
6
private void deleteSingleChildNode(TreeNode node) { TreeNode newChild = null; if (node.hasLeftChild()) { newChild = node.leftChild; } else if (node.hasRightChild()) { newChild = node.rightChild; } if (node.isRightChild()) { node.parent.rightChild = newChild; if (this.prematureWiring) ...
df658412-09e6-43e6-ab3d-9c1b3f66c727
2
private void setPoints(TreeNode node, int depth, int thisDepth, int leaves, int[] sofar, Map nodeToPoint) { TreeNode[] children = Trees.children(node); float y = (float) (thisDepth + 1) / (float) (depth + 2); if (children.length == 0) { // It is a leaf! float x = (float) (sofar[0] + 1) / (float) (leaves ...
bfdc3510-8243-435b-871d-c3eb6d2b2781
9
private static void loadConfig(File file) { if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } try { if (!file.exists()) { file.createNewFile(); } YamlConfiguration config = new YamlConfiguration(); config.load(file); // ====================== if (!config.contains("ena...
6ef46bca-3efa-4c04-aa8f-33f3ae4ba749
2
public LightGrenadeGridFactory(Grid grid, FullGridFactory factory) { if (grid == null) throw new IllegalArgumentException("Grid can't be null!"); if (factory == null) throw new IllegalArgumentException("Factory can't be null!"); this.factory = factory; this.grid = grid; }
3972de4e-fc45-49f1-8270-9a857b6e7f1d
0
public MinkowskiDistEvaluator(double k2) { k = k2; }
bbe49b31-e9a2-4627-a99f-301dd1f78beb
6
public void complementPath(Thinlet thinlet, Object textfield, String text, int caret) { if (text.length() == caret) { int index = text.lastIndexOf(File.separatorChar); if (index == -1) { return; } String foldername = text.substring(0, index + 1); File folder = new File(foldername); String namestart = ...
80c6b0a1-277b-470e-a50d-43ab097595a4
3
public void setIntLit(TIntLit node) { if(this._intLit_ != null) { this._intLit_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); ...
494c41e5-baba-4f93-a7d4-8dc0cbcbb1de
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Bosses bosses = (Bosses) o; if (heroicKills != bosses.heroicKills) return false; if (id != bosses.id) return false; if (normalKills != ...
a5b85993-53b5-4b25-86ba-e5d0dec22098
6
private static void createDB(String dbName, String username, String password){ Connection conn = null; Statement stmt = null; String dbURL = "jdbc:mysql://localhost"; try{ //STEP 2: Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); //STEP 3: Open a connection System.o...
82861b8a-48d8-484f-924e-959e4aa0df05
5
public Object nextEntity(char ampersand) throws JSONException { StringBuffer sb = new StringBuffer(); for(;;) { char c = next(); if(Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if(c == ';') { break; } else { throw syntaxError("Missing ';' in XML ent...
f493ff10-7838-4a69-8cb9-572ce76407e0
2
public LocationServer() { try { socketS = new ServerSocket(6666); while(true) { clientSocket = new SocketManager(socketS.accept()); LocationService service = new LocationService(clientSocket); new Thread(service).start(); } } catch (IOException e) { e.printStackTrace(); } }
62dc227d-cca9-48c0-8c4b-78b634da549f
7
private void handle_dumplog() { FileInputStream fi; byte bytes[]; StringBuffer sb = new StringBuffer(); try { fi = new FileInputStream(disp.get_logfile()); } catch (FileNotFoundException e) { cliprint("No logfile found" + VT100.crlf); return; } cliprint("### BEGIN LOGFILE DUMP" + VT100.crlf); ...
2e746ea0-3292-440f-850d-4b254e0a8230
8
public static final String escape(String str) { StringBuilder sb = new StringBuilder(); sb.append(CHAR_DQUOTE); for (int i = 0, n = str.length(); i < n; ++i) { char ch = str.charAt(i); if (ch == CHAR_DQUOTE || ch == CHAR_BACKSLASH) { // || ch == '/') { sb.append(CHAR_BACKSLASH); sb.append(ch); } ...
97be0db4-5d6d-4145-9df2-d316c0baaef8
3
public static Date StringToDate(String data) { if (data == null || data.equals("")) { return null; } Date date = null; try { DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm"); date = (java.util.Date) formatter.parse(data); } catc...
cf899adf-b982-4c34-89fd-d30a0014f4fb
4
public void swapElement(Integer firstId, Integer secondId) { ElementInfo firstInfo = elementMap.get(firstId); ElementInfo secondInfo = elementMap.get(secondId); if (firstInfo != null && secondInfo != null) { //swap ids at Depth Manager. depthManager.getDepth(firstInfo.dep...
227795d3-f25e-420a-b75a-99d58f17574e
8
public void carregaProducoes() throws Exception{ try{ arquivo = new BufferedReader(new FileReader(pathFilename)); }catch (FileNotFoundException e) { // TODO: handle exception e.printStackTrace(); throw new FileNotFoundException(); } String linha =""; try{ while((linha=arquivo.readLine()) !=nu...
0019090a-613a-47f7-bea9-5eb9c270a8e3
0
public boolean isHiddenWithLayer() { return hiddenWithLayer; }
98b1e733-68b1-4df5-86cc-e6d34f3bc7fd
3
public int[] selection(int[] sortieren) { for (int i = 0; i < sortieren.length - 1; i++) { for (int j = i + 1; j < sortieren.length; j++) { if (sortieren[i] > sortieren[j]) { int temp = sortieren[i]; sortieren[i] = sortieren[j]; sortieren[j] = temp; } } } return sortieren; }
dedb60a1-cea4-4d71-9bea-88318d4f187a
1
void addSideNode(BitmapGraph.BitmapNode node) { if (!adjList.contains(node)) { adjList.add(node); } }
352f3084-4fa2-4f15-bf1a-c100aebb84c4
9
public void SampleMatches( AbstractApi api, double percentage, int numQuestionsAnswers ) { WordDistributions dist = new WordDistributions(); Hashtable<Integer,ArrayList<ClassElem>> bins = new Hashtable<Integer,ArrayList<ClassElem>>(); for( PackageElem pack : api.Packages ) { for( ClassElem klass : pack....
0eccc3ec-96a2-4295-9169-65d061b89c70
8
public static void main(String args[]) { try { if (args.length != 2) { System.err.println("usage: java ProcessorDemo <filename> <charset>"); System.exit(1); } BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), args[1])); String confPath = System.getPr...
97cad9dd-f25b-49fb-905b-7e2e78b28f5c
0
public void setPopProveedorId(Integer popProveedorId) { this.popProveedorId = popProveedorId; }
78ec47ec-55e9-4041-a778-f7f7f6e3a0d9
4
@Override public void handleCollision(Actor other) { if(other instanceof actor.ship.projectile.Projectile) { // Don't collide with our own bullets if(other.getParentId().equals(id)) return; //shield testing code actor.ship.projectile.Projectile...
a3b7cbc6-5a13-43e1-ab58-08abe600d43b
6
* @param itemSlot The itemSlot * @param newItemId The new item After Drinking * @param healType The type of poison it heals */ public void potionPoisonHeal(int itemId, int itemSlot, int newItemId, int healType) { c.attackTimer = c.getCombat().getAttackDelay(c.getItems().getItemName(c.playerEquipment[c.playerWe...
eccd6415-1d04-4d4d-85b5-89c279aea7cd
4
@Override public ConcurrentHashMap<TypeOfTravelClass, TravelClass> createTravelClass(List<TravelClass> travelClasses) throws UnsupportedOperationException { ConcurrentHashMap<TypeOfTravelClass, TravelClass> _travelClasses = new ConcurrentHashMap(5, 0.9f, 2); for(TravelClass _travelClass : t...
72c733a4-7f11-4348-8279-d06dcea88f3e
8
public boolean isPermutation(String s1, String s2){ if(s1.length()!=s2.length()){ return false; } Hashtable<Character , Integer> ht = new Hashtable<>(); for(int i=0;i<s1.length();i++){ char c = s1.charAt(i); if(ht.containsKey(c)){ int val = ht.get(c) +1; ht.put(c, val); }else{ ht.put(c,...
374c26a9-75d7-459e-bd7f-874309f0ad2b
0
@Test public void testFindNodes_empty() throws Exception { NodeList nodes = _xpath.findNodes("//li"); Assert.assertEquals(0, nodes.getLength()); }
55f171f2-742f-4ff0-bb3c-084920db7609
1
public final IconType getType() { if (type != null) return type; return null; }
58b0a569-8e92-499c-9162-b28557685751
0
@Override protected void doOperate2() { System.out.println("doOperate 2"); }
5ce454df-ed69-4106-b9bd-2a01dda3774f
5
@Override public void onUpdate(World apples) { if (!apples.inBounds(X, Y)||apples.checkCollision(X, Y)) { alive = false; //apples.explode(X, Y, 32, 8, 16); } for (Player p:apples.playerList) { if (maker!=p.ID&&p.checkCollision((int)X, (int)Y)) ...
b24f388e-7893-4032-8615-cad9de5b0d2b
3
public static boolean inField(int x, int y) { return !(x < 0 || x > size_x - 1 || y < 0 || y > size_y - 1); }
330369b1-b5b3-48fe-9a19-da262ef02d0d
8
public static int[] getNextPixel(int orientation_index) { // RSLV: find a mathematical expression for the switch statement? int[] dp = new int[2]; // [0]=dx, [1]=dy switch(orientation_index) { case 0: dp[0] = 1; dp[1] = 0; break; case 1: dp[0] = 1; dp[1] = 1; break; case 2: ...
b4b70337-e66b-44e9-88b8-be54b337298b
5
public void bounce(Direction d) { if (d == null) return; switch (d) { case UP: v_y = Math.abs(v_y); break; case DOWN: v_y = -Math.abs(v_y); break; case LEFT: v_x = Math.abs(v_x); break; case RIGHT: v_x = -Math.abs(v_x); break; } }
28bb9faa-0c2f-4823-b2ef-7930ff1309a3
6
public void veryHardShot() throws IOException { if (0 == stackSize) { int min = getMinLength(); target = new Point(rand(), rand()); numAttempts = 0; while (!testChoice(target, min)) { target = new Point(rand(), rand()); ...
9274ef38-8e5e-486e-a975-a93c8bfa5792
8
@Override public void addAgent() { Random rand = new Random(); int x,y; lab(environment); do { x = rand.nextInt(environment.taille_envi); y = rand.nextInt(environment.taille_envi); } while (environment.grille[x][y] != null); for (int j = -1; j < 2; j++) { for (int i = -1; i < 2; i++) { if (x +...
2d1e4110-a56a-42af-8447-9725a553e0b8
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); ArrayList<Integer> l = new ArrayList<Integer>(1100000); int n = 0; while ((line = in.readLine()) != null && line.le...
d2ecf906-29f3-4269-a993-26846836cf0c
4
private void drawText(Graphics2D g) { int collumn1 = FRAME_WIDTH / 3; int collumn2 = collumn1 + (int) g.getFontMetrics().getStringBounds("Total ", g).getWidth(); int collumn3 = collumn2 + (int) g.getFontMetrics().getStringBounds("999 ", g).getWidth(); int firstLineY = FRAME_HEIGHT / 3; ...
c0f2673e-231c-494f-b9c2-66febda29a60
8
@Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("Terminate Scouting")) { //Terminate Scouting Button was Pressed //Check if Good Quit or not if(uploadType.equals("Pit")) { if(MainPitUploadGUI.numConnected == numFinished) { //Nullify Communication Thr...
1e1189c9-1d78-46e0-9fec-9178aa575de0
2
public void stackOnePush(Object o){ if(array[0]==null){ array[0]=o; stack1Index = 0; } else{ stack1Index++; if(array[stack1Index]!=null){ shiftStackTwoUp(); } array[sta...
08941f00-86ad-4755-b911-538167fb34d5
1
public boolean equals(Object o) { return (o instanceof TreeElement) && fullName.equals(((TreeElement) o).fullName); }