method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
732ad089-6f7d-4bf7-969e-ccf8c57f50bf
2
public Head getHeadByName(String name){ for(Head u : allHeads){ if(u.getName() == name){ return u; } } return null; }
34ec175f-28e8-40d8-a08b-c31a6554eb58
8
private void regenerateContent() { StringBuilder sb = new StringBuilder(); switch(view) { case NOTES: { List<Note> notes = mon.getNotes(); content = ""; for(Note n : notes) { sb.append...
2724c097-7457-49fc-92a5-9655bdf37b05
9
public Queue<String> dobleAgenteXMLUnit (){ try { path = new File(".").getCanonicalPath(); FileInputStream file = new FileInputStream(new File(path + "/xml/papabicho.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); ...
5acda8ea-0b64-4840-8506-411a900e513e
1
protected void processWindowEvent( WindowEvent event ) { if (event.getID() == WindowEvent.WINDOW_CLOSING) { actionCancel(); } super.processWindowEvent(event); }
6c253ebf-4bfe-49e2-9fc7-618d1e66734b
3
private void lexicalAnalysis(String sourceCode) { lexer = new EsperLexer(new ANTLRStringStream(sourceCode)); lexerSuccess = (lexerErrors = lexer.getNumberOfSyntaxErrors()) <= 0; //Print output if (flagLexerOutput) { System.out.println("Lexer output: "); Token token; EsperLexer tokensOut = new EsperL...
462b4111-a223-4b7b-a364-2037d3b20b84
1
public static MultipleChoiceQuestion getQuestionByQuestionID(int questionID) { try { String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, questionID); ResultSet rs = stmt.executeQuery(); ...
375eb57d-ab37-4b76-968f-e947654c9305
5
public void reservedItem() { int tjek = 0; for (int i = 0; i < orderlistWithDate.size(); i++) { for (int j = 0; j < orderlistWithDate.get(i).getItemlist().size(); j++) { for (int k = 0; k < itemlistReserved.size(); k++) { ...
65609140-f36b-49d0-a1f9-eb6111c2b166
1
@Test public void add_test() { try{ double [][]mat1= {{1.0,2.0}, {3.0,1.0}}; double [][]mat2= {{2.0,1.0}, {1.0,3.0}}; double [][]result = Matrix.add(mat1, mat2); double exp[][]={{3.0,3.0}, {4.0,4.0}}; Assert.assertEquals(result, exp); } catch (Exception e) { // TODO Auto-generated catch block ...
27a088e5-9cfd-450c-9926-efafd9e549ea
9
public List<TravelDataBean> getBoardCommentaryList(int idx) throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; List<TravelDataBean> commList = null; String sql = ""; TravelDataBean comm = null; try{ conn = getConnection(); sql = "select * from travelcomme...
6654c9b7-7d63-40c2-a332-ee87f5212612
7
private long locateIP(byte[] ip) { long m = 0; int r; // 比较第一个ip项 readIP(ipBegin, b4); r = compareIP(ip, b4); if (r == 0) return ipBegin; else if (r < 0) return -1; // 开始二分搜索 for (long i = ipBegin, j = ipEnd; i < j; ) { m = getMiddleOff...
342be706-3f98-4e8d-a8b9-a50184155a54
0
public long getCrc32() { return crc32.getValue(); }
9d8f80c1-22fd-42ac-b963-5496de1f76e1
4
public static Side toSide( EndPointPosition position ){ switch( position ){ case LEFT: return Side.WEST; case RIGHT: return Side.EAST; case TOP: return Side.NORTH; case BOTTOM: return Side.SOUTH; default: throw new IllegalArgumentException(); } }
b9db25cc-1b61-4998-89c9-e07d07904290
2
private void calculateEnabledState(JoeTree tree) { if (tree.getComponentFocus() == OutlineLayoutManager.ICON) { setEnabled(true); } else { if (tree.getCursorPosition() == tree.getCursorMarkPosition()) { setEnabled(false); } else { setEnabled(true); } } }
71d629c5-6d98-4a6d-95b5-47d47182285d
6
public boolean func_48135_b(EntityAnimal par1EntityAnimal) { if (par1EntityAnimal == this) { return false; } else if (!this.isTamed()) { return false; } else if (!(par1EntityAnimal instanceof EntityWolf)) { return fa...
97d9523f-9824-4434-b164-dc440c2435cd
1
public BreakBlock(BreakableBlock breaksBlock, boolean needsLabel) { this.breaksBlock = (StructuredBlock) breaksBlock; breaksBlock.setBreaked(); if (needsLabel) label = breaksBlock.getLabel(); else label = null; }
8e2b29a7-3ad6-426e-a0a1-a5e48d533d85
9
public void checkOldGoals() { LinkedList<Formula> temp = new LinkedList<Formula>(); Formula f; while(!proven && !incompleteGoals.isEmpty()) { f = incompleteGoals.poll(); Boolean clear = false; for(Goal g : f.possibleGoals) { if(inKnowledge(g.directGoals)) { clear = true; try { Dedu...
51729c3e-2ce6-4573-9e4c-e9d00f7a67d9
6
public void paste(String destinationPath) { System.out.println("Paste requested to : " + destinationPath); File destination = new File(destinationPath); if (!destination.isDirectory()) {return;} //If it is a new paste, we restart the queue stats if (!busy) { this.queueTotalSize = 0; this.queueCurr...
b5852f6a-f70c-475a-952e-23d2328bb22e
0
protected void onUserList(String channel, User[] users) {}
66dedcfe-8a09-45ec-8cb0-1c164596b704
3
public void depthFirstTraversal() { boolean[] visited; visited = new boolean[gSize]; for (int index = 0; index < gSize; index++) visited[index] = false; for (int index = 0; index < gSize; index++) if (!visited[index]) dft...
8e782711-ec80-4f11-af7f-9ead289130fb
0
protected final static Logger getLogger() { return LoggerFactory.getLogger(ConfigManager.class); }
cbb0ec56-8d3b-4c75-bf73-c46af752ab55
4
@Override public boolean activate() { return (!Bank.isOpen() && !validate(Constants.WAITFOR_WIDGET) && !Widgets.get(13, 0).isOnScreen() && Inventory.contains(Settings.itemOneID) && Settings.usingHerb ); }
593204aa-fcf5-4c15-8e25-3b49b1ebac37
9
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if((msg.amITarget(this) ||((msg.tool()==this)&&(msg.target() instanceof Container))) &&((getPackageFlagsBitmap()&PACKAGE_FLAG_TO_ITEMS_PROGRAMMATICALLY)==0) &&((msg.targetMinor()==CMMsg.TYP_GET)||(msg.targetMinor()==CMMsg.TYP_DRO...
57317e26-fe33-4d83-b2b8-2ad9af176b37
2
public Metrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = new File(CONFIG_FILE); configuration = YamlConfiguratio...
a8e20a47-4d4c-402e-8be1-919c56a136b3
6
private void resize() { size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight(); width = getSkinnable().getWidth(); height = getSkinnable().getHeight(); if (getSkinnable().isKeepAspect()) { if (aspectRatio * wi...
fdfe6f34-d83c-4b99-936c-33f463d2ac62
1
public void visit_i2c(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
15b84ac9-72f1-4930-9d79-0d21e7a49bdd
7
public static void OBRADI_odnosni_izraz(boolean staviNaStog){ String linija = mParser.ParsirajNovuLiniju(); int trenLabela = mBrojacLabela++; if (linija.equals("<aditivni_izraz>")){ OBRADI_aditivni_izraz(staviNaStog); return; } if (linija.equals("<odnosni_izraz>")){ OBRADI_odnosni_izraz(true);...
f398ec9d-4ca4-46f6-a100-9aed1a5a94ba
2
public DiscreteUniform(int low, int high) throws ParameterException { if (low < 1 || high <= low) { throw new ParameterException("DiscreteUniform parameters a in N, b > a."); } else { this.low = low; this.high = high; unif = new ContinuousUniform(low, high + 1); } }
96a20c9a-5861-4a12-92a1-b3cd6014bc76
7
public boolean ComboBad( int col, int row, int val ) { // check the row for (int n = 0; n < 9; n++ ) { if ( _board[row][n] == val ) { System.out.println("Oops, there is already a " + val + " in row " + converter( row ) ); System.out.println("Try again!"); pause( 1 ); return true; } } // check t...
9b6fc0da-9a0a-4fbc-a69d-576792f954ae
9
private boolean checkTimer(String currentWeapon){ if (currentWeapon.equals("MachineGun")){ if (machineTimer < 0){ machineTimer = 10; return true; } else {return false;} } else if (currentWeapon.equals("Pistol")){ return true; }else if (currentWeapon.equals("Crowbar")){ ...
8658156e-b686-444b-9a99-fefc5c9e3379
6
public static void main(String[] args) { double[] a = new double[6]; int[] m = new int[6]; int s=0; obrobka.test(args, a); // for (int i = 0; i < 6; i++){ int x = (int) a[i]; double y = a[i] - x; if (y!=0){ s++;// , ; ...
993d1064-2db3-4145-b49c-6152c259fdfc
6
static void merge(int[] leftArray, int[] rightArray, int[] newArray) { int i = 0, j = 0, k = 0; int leftLength = leftArray.length; int rightLength = rightArray.length; // Compare left and right and put the smaller value in the new array while(i < leftLength && j < rightLength) { if(leftArray[...
b8286fa6-0bd2-444f-953c-a902fef2c247
4
@Override public void addRow(IRow row) { Sheet sheet = wb.getSheet(row.getSheetName()); if (sheet == null) { sheet = wb.createSheet(row.getSheetName()); } final int lastRow = sheet.getLastRowNum(); Row r = sheet.getRow(lastRow); if (r == null) { ...
4e741a38-8f6d-4921-8fae-e8cac4983447
3
private void go(){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); HashMap<Integer, HashMap<Integer, Integer>> g = new HashMap<Integer, HashMap<Integer, Integer>>(); int[] dist = new int[n+1]; for(int i=1;i<=n;i++){ dist[i]=Integer.MAX_VALUE; g.put(i, new Hash...
0b58a292-e3f2-48ca-aeb6-30bf4cd6a555
9
public MakingOffer makeOffer(Offer offer, PlayerPtrVector allPlayers, News news) { // called by CheckBuying() of own team, or by GUI if (offer.getPlayer().getContracts().getNextContr().getTeam() != null || offer.getBuyer().equals(offer.getPlayer().getContracts().getCurrContr() .getTeam())) { // has ...
d941efa0-33ab-45c1-a66a-946aac1b761f
5
private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed // TODO add your handling code here: liceu.Administrator admin = new liceu.Administrator(usernameElev.getText(), parolaElev.getText(),ncElev.getText(),cnpElev.getText(),"Elev",(String)clasaE...
670597aa-3cd9-49d9-b9e7-b28285c55cd3
4
public void toXML(){ try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document out = docBuilder.newDocument(); Element rootElem = out.createElement("bill"); out.appendChild(rootElem); for (Device dev...
7e5579a1-4a7a-44c0-80eb-5a0453ed231a
5
public static void main(String[] args) throws FileNotFoundException { String masterName = "masterServer"; String masterAdd = args[0]; int masterPort = new Integer(args[1]); String dir = args[2]; File metaData = new File("metaData.txt"); File repServers = new File("repServers.txt"); TreeMap<String, Replica...
2fb2f7fb-459f-463b-9552-a122869a45b8
7
public static String timeIntervalToString(long millis) { StringBuffer sb = new StringBuffer(); if (millis < 10 * Constants.SECOND) { sb.append(millis); sb.append("ms"); } else { boolean force = false; String stop = null; for (int ix = 0...
df19d458-1590-445d-ab43-b9c3c8737a10
7
public Object showEduFwContent() { String cmd = "show;eduframework"; ArrayList<String> list = null; String[][] content = null; try { NetService client = initNetService(); client.sendCommand(cmd); list = client.receiveList(); client.shutDownConnection(); content = new String[list.size()][]; if ...
66751a59-ab20-4829-8be4-57678d50300c
8
public void createPlanetsPanel() { planetsPanel.setLayout(new GridLayout(2, 2)); JPanel OU = new JPanel(); // OU Start OU.setLayout(new BoxLayout(OU, BoxLayout.Y_AXIS)); JLabel OUPic = new JLabel(new ImageIcon("Icons/OU2.png")); OUPic.setAlignmentX(CENTER_ALIGNMENT); OU.add(OUPic); JLabel OUTitleLabel = ...
923031ff-ec4a-406a-88de-0706a09e7692
0
public int getZ(){ return zPos; }
a9ba333d-537d-40c5-8463-6b317e8691e5
9
public static int getSpace(int i){ switch (i) { case 1: return space[0][0]; case 2: return space[0][1]; case 3: return space[0][2]; case 4: return space[1][0]; case 5: return space[1][1]; case 6: return space[1][2]; case 7: return space[2][0]; ...
488b77a4-2526-4ae0-9300-d879a361d4dc
5
public void writeToAdjacencyList(ArrayList<Node> network, String file){ try { BufferedWriter out = new BufferedWriter(new FileWriter(file)); out.write("#Number of nodes:\n" + network.size() + "\n"); out.write("#Node degrees:\n"); for(int i=0;i<network.siz...
8b66c7f6-80af-4b86-9426-d18237ebc2d8
0
public Level(String ID, String level){ this.ID = ID; path = level; loadLevel(level); }
085607ed-8ef2-4ff7-a8a2-70754d235a69
2
public void inserir(long pesquisaId, ArrayList<InstituicaoCooperadora> instituicoesCoopreadoras) throws Exception { String sql = "INSERT INTO Pesquisainstituicoes_cooperadoras(id1, id2) VALUES(?, ?)"; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql); for (Instit...
b7085b20-92d5-4692-9c14-140880f22df9
4
public static void main(String[] args) { try { int test = 0; int rowsA = 10; int colsA = 10; int rowsB = colsA; int colsB = rowsA; String fileNameOfMatrixA = "A" + rowsA + "x" + colsA + ".txt"; String fileNameOfMatrixB = "B" + ...
5e755e52-4b2f-4928-bcb3-0fd01dcccd8f
1
public String getLabelState() { if (state == DECONNECTED) return "Déconnecté"; return "Connecté"; }
a1ae5ed3-e304-4731-adfd-13dd9e55fc86
3
public void shuffle() { //System.out.println("Shuffling"); cardsInDeck=cards.clone(); PlayingCard[] cardsNotInPlay=new PlayingCard[cardsInDeck.length]; int cardsOutofPlay=0; for (PlayingCard c: cards) { if(c.placeInDeck()) { cardsNotInPlay[cardsOutofPlay++]=c; } } cardsInDeck=new PlayingCa...
6142c290-8469-4d97-8bdf-1a35d9ec737f
7
public static String textForFirstTag(Element element, String tag) { if (!element.hasChildNodes()) return ""; // Should never happen if we are passed a valid Element // node NodeList tagList = element.getChildNodes(); int tagCount = tagList.getLength(); if (0 == tagCount) // No tags return ""; fo...
91b2d5da-99ed-42fc-8dbf-adeb19f49fed
6
public void stateChanged(ChangeEvent c) { JSlider s = (JSlider) c.getSource(); if (s == speed) { Game.gamedata.set_bpm(speed.getValue()); speedL.setText("Speed: " + speed.getValue() + " bpm"); } else if (s == diff) { Game.gamedata.set_difficulty(diff.getValue()); if (diff.getValue() <= 1) { System...
7b34005c-c332-40f4-b7f0-e6ae8a61269e
1
public Triple initFile(String fileName, String lang){ com.hp.hpl.jena.graph.Node s = NodeFactory.createURI("http://bla.example.com"); com.hp.hpl.jena.graph.Node p = NodeFactory.createURI("http://bla.example.com/#a"); com.hp.hpl.jena.graph.Node o = NodeFactory.createLiteral(String.valueOf(Math.random()*100)); Tr...
8bd1b085-aff2-4278-8886-7d15dce944e7
4
private boolean requestCredentialsAndAuthenticate(Callback[] callbacks) throws LoginException { boolean authenticated = false; try { callbackHandler.handle(callbacks); username = ((NameCallback) callbacks[0]).getName(); password = loadPassword((PasswordC...
0309e0ea-fb9b-4929-a483-7f19de5f9ebc
3
@Override public Object getParent(Object element) { if (element instanceof IFile) { IFile file = (IFile) element; return file.getProject(); } else if (element instanceof String) { String task = (String) element; return this.taskToFileMap.get(task); } else if (element instanceof AliasTask) { AliasT...
01464612-1002-4ebc-9b78-631f0fc4a13f
8
private void checkRight(TetrominoMoveSelector moves, Tetromino tetromino, int x, int y) { //Si on est pas entrain de sortir de l'écran if(x + tetromino.getWidth() >= width || y == -1){ moves.removeTranslateRight(); }else { //Block nommé pour sortir de la boucle imbriquée...
5e55c300-d1dc-4b2a-9791-d8da771b8dce
9
public static void setLongBE(final byte[] array, final int index, final long value, final int size) { switch (size) { case 0: return; case 1: Bytes.setInt1(array, index, (int)value); break; case 2: Bytes.setInt2BE(array, index, (int)value); break; case 3: Bytes.setInt3BE(array, index...
fcb6ab56-886b-43d9-bea4-2295bbcf3420
9
@Override public int hashCode() { int result = creationTime != null ? creationTime.hashCode() : 0; result = 31 * result + (groupName != null ? groupName.hashCode() : 0); result = 31 * result + (lastAccessTime != null ? lastAccessTime.hashCode() : 0); result = 31 * result + (lastModifiedTime != null ? ...
07cce814-02ca-4e3d-9e9a-fc393eda1aeb
8
public void build(String type, Tile location) { if (mana.hasEnough(costs.get(type)) && location.getConstruct()==null && (!updater.getGameState().equals("win") && !updater.getGameState().equals("lose"))) { Construct construct = null; if(type.equals("tower") && location.getType().equals("FieldTile")) {...
de5808c7-7628-4522-80f2-f8f315b4f178
8
@Override public boolean keyDown(int keycode) { while (keyNotDown) { if (MOVE_KEYS.containsKey(keycode)) { final Direction dir = MOVE_KEYS.get(keycode); if (dir.getXis().equals("HORIZONTAL")) { player.setXD(dir.getSpeed()); } else if (dir.getXis().equals("VERTICAL")) { player.setYD(dir.getSp...
7a821d8f-31bb-40b1-95c7-4bf24ebe5c9d
7
static final boolean method2203(byte i) { int i_1_ = 11 % ((12 - i) / 53); anInt4802++; try { return Class348_Sub42_Sub8_Sub2.parseIncomingPacket(true); } catch (java.io.IOException ioexception) { Class272.method2049(106); return true; } catch (Exception exception) { String string = ("T2 - " ...
8edaaaa0-6af5-48d2-98cc-a3f4f61f4fa1
4
public Direction directionContaining(Point p){ if(backWall.contains(p)) return forwardDir; if(backDirRect.contains(p)) return backDir; if(rightWall.contains(p)) return forwardDir.getRightDirection(); if(leftWall.contains(p)) return forwardDir.getLeftDirection(); return null; }
bf59c46e-d74c-429f-82f5-a02bf6cce221
4
private static int getuid(String s) { try { File file = new File(s + "uid.dat"); if (!file.exists() || file.length() < 4L) { DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(s + "uid.dat")); dataoutputstream.writeInt((int) (Math.random() * 99999999D)); dataoutputstream.c...
91dd81f9-616e-459c-a9fb-9d5aa2164663
7
public void insertTrainer(Trainer trainer){ //insert entry int id = insertNamedEntity(trainer, "TRAINER"); //map its characteristics // this.insertIntoTableAllValues( // "entity_caracteristic", // id, // 9,//PASSWORD // ...
6ca94f99-fcdb-42d8-86d2-8118d562dc41
8
private boolean reachBlockerByMaxGeneric(keyMap key, int maxReach,int max,int option) { if(mapReachBlockerByMaxDate.size() >= intMaxMapSize){ mapReachBlockerByMaxDate.clear(); } if (mapReachBlockerByMaxDate.containsKey(key)) { long elapsedTime = 0; switch (opt...
4cd80858-8471-4ffb-8aa3-9e7855045117
3
public void updateProfile( Profile p ) { ArrayList<AchievementRecord> newAchRecs = new ArrayList<AchievementRecord>(); newAchRecs.addAll( p.getAchievements() ); for ( Map.Entry<Achievement, JCheckBox> entry : generalAchBoxes.entrySet() ) { String achId = entry.getKey().getId(); JCheckBox box = entry.getVal...
7437b8cd-0d15-4d6f-882b-1c06e957c74f
9
boolean isReferenceAttributeTypeDifferent(ConfigurationObjectReference configurationObjectReference, ReferenceAttributeType referenceAttributeType) { if(_configurationImport.getConfigurationData(referenceAttributeType, getAttributeGroup("atg.objektReferenzAttributTypEigenschaften")) == null) { return true; } // ...
78ab53ba-c7e0-4d08-b481-74fc7b711d32
2
public static double getRate(String c1, String c2){ Connection conn = DBase.dbConnection(); PreparedStatement dbpst; double dr =0; try{ String query = "Select Rate FROM "+c1+ " where CountryCode = ?"; dbpst=conn.prepareStatement(query); dbpst.setString(1,...
2f699a4f-b573-4bd7-9fd9-4055edfbd73e
1
public void testWithFieldAdded3() { DateTime test = new DateTime(2004, 6, 9, 0, 0, 0, 0); try { test.withFieldAdded(null, 6); fail(); } catch (IllegalArgumentException ex) {} }
3419f156-2861-4a95-a1f5-40a24d07e0eb
7
@Override public Query rewrite(IndexReader reader) throws IOException { if(!termLongEnough) { // can only match if it's exact return new TermQuery(term); } int maxSize = BooleanQuery.getMaxClauseCount(); PriorityQueue<ScoreTerm> stQueue = new PriorityQueue<ScoreTerm>(); FilteredTermEnum en...
b252158c-2c02-4075-9e8b-f337e1015852
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JuliaAlgorithm other = (JuliaAlgorithm) obj; if (base == null) { if (othe...
13eb3823-e509-439c-a505-12ae6d29f8f2
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...
9bb5ab9f-f8e1-4fee-a3c1-2bc9f407128a
6
public static void main (String args[]) { AppartamentoClass casa1 = new AppartamentoClass(); AppartamentoClass casa2 = new AppartamentoClass(); String casa1_name = new String(); String casa2_name = new String(); casa1_name = "Casa 1"; casa2_name = "Casa 2"; // Popolo Casa 1 casa1.leggiInput(...
df037c67-2141-4cc8-8229-53c36a373314
5
private byte[] pdf() { // Make Nonce 16 bytes by prepending zeroes. done (see init()) // one AES invocation is enough for more than one PDF invocation // number of index bits needed = 1 // Extract index bits and zero low bits of Nonce BigInteger Nonce = new BigInteger(1, nonce); in...
db6c0afb-990d-47e8-a4bf-a3e454dec543
3
private Object sql(Method method, Object[] args, Sql annotation) throws Exception { Connection c = connector.connect(); try { try { PreparedStatement st = statement(args, annotation, c); Class ret = method.getReturnType(); if (ret != Void.TYPE)...
3a046ff0-4e0f-47b3-af41-224f0c21e748
1
public void close() throws BitstreamException { try { source.close(); } catch (IOException ex) { throw newBitstreamException(STREAM_ERROR, ex); } }
871ef025-db86-44f3-916a-13942b5ffd1b
1
public int exprHashCode() { if (value != null) { return 10 + value.hashCode(); } return 10; }
ee47731d-30a5-451b-8d27-111d6e6e9e50
7
void parseDoctypedecl() throws java.lang.Exception { char c; String doctypeName, ids[]; // Read the document type name. requireWhitespace(); doctypeName = readNmtoken(true); // Read the ExternalIDs. skipWhitespace(); ids = readExternalIds(false); ...
7f1db35f-51d5-4823-b82c-e3650cbfe7dd
2
@Override public String valueToString(Object value) throws ParseException { LengthValue length = (LengthValue) value; if (mBlankOnZero && length.getValue() == 0) { return ""; //$NON-NLS-1$ } return length.toString(); }
c67c7a28-f1ee-429f-9a4e-f2c656e4adcc
2
private boolean createIndex(Connection connection) throws SQLException { if (connection == null) { throw new SQLException("You must establish a connection before creating the indexes"); } Statement stmt = null; try { Run.addProcessStatus("Creating the database indexes"); String [] inde...
c723ee46-8490-481d-8a99-f0b6ea319808
8
public void renderProjectile(int xp, int yp, Projectile p) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < p.getSpriteSize(); y++) { int ya = y + yp; for (int x = 0; x < p.getSpriteSize(); x++) { int xa = x + xp; if(xa < -p.getSpriteSize() || xa >= width || ya < 0 || ya >= height) break; ...
ac4393a3-bfa9-4833-89f1-78fd0eb833e5
2
private String findName(String response, String elementTag, String elementType) throws Exception{ Document doc = RestClient.stringToXmlDocument(response); NodeList list = doc.getElementsByTagName(elementTag); for(int i=0; i < list.getLength();i++){ if(list.item(i).getAttributes().getNamedItem(Constants.TYP...
df0d67fb-a283-4386-aacb-f9b25d98af6d
3
private static void validarCNPJ(String digits) throws ValidacaoException { try { boolean isvalid = false; if (Long.parseLong(digits) % 10 == 0) { isvalid = somaPonderadaCNPJ(digits) % 11 < 2; } else { isvalid = somaPonderadaCNPJ(digits) % 11 ==...
7bd5e7c9-a6eb-4ef8-b638-d011d38c8d1a
2
private void parseMethodNameAndParameters() { methodName = method.getName(); for(Class<?> parameterClass: method.getParameterTypes()) { parameterTypes.add(parameterClass.getSimpleName()); } }
cd6dbf95-b858-4d36-9f52-69923f566b85
8
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (averageGroundLevel < 0) { averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox); if (averageGroundLevel < 0) { ...
4829450f-3383-431c-b91e-fe6c0f2ab138
7
private void createDNAOutput(){ U.p("Max memory used during this run was: " + Driver.getMaxMem() + " GB"); //Create a header for the output file annoHeader = "##Modified by annotationAlignmenttool on: " + sdf.format(Calendar.getInstance().getTime()) + "\n" + "##Modified from original to fit: " + DNAFile.substr...
0f5c1c9a-d7d4-491f-a275-a36deaba6920
6
protected void parseFeatures() { // Empty? if (featuresStr.length() <= 0) return; String type = null; String value = ""; StringBuilder values = new StringBuilder(); int lineNum = 0; for (String line : featuresStr.toString().split("\n")) { lineNum++; // Feature start if (isNewFeature(line)) { ...
af3840e1-40c3-4adf-997f-2b6cc466ce95
1
public static void main(String[] args) { try { int res; res = ToolRunner .run(new Configuration(), new WrokBench(), args); System.exit(res); } catch (Exception e) { e.printStackTrace(); } }
d9148293-1cf2-4491-a6a6-0f67e101b23e
2
public void add(int newx, int newy, int newz) { if (_level == null) return; if (_level.getTile(newx, newy, newz).getVisableBlock() == this.getVisableBlock()) return; _level.setTile(this, newx, newy, newz, _server); Player.GlobalBlockChange((short)newx, (short)newy, (short)newz, this, _level, _server, fals...
c5420600-d81f-465e-89c1-21a2f2d5d486
0
public UDPChat() throws SocketException { new InterfaceSelector(this); new IncomingListener(this); }
533d9355-485a-4607-ba8f-3fccb1a977e2
5
public static void main(String[] args) { System.out.print("Enter ten numbers: "); Scanner scanner = new Scanner(System.in); int[] numbers = new int[10]; int distinctNumberCounter = 0; for (int i = 0; i < numbers.length; i++) { int number = scanner.nextInt(); int arrayIndex = 0; for (arrayIndex = 0; a...
f461e7c3-261d-49f6-93fd-53c0c671299d
8
@SuppressWarnings({ "unchecked", "rawtypes" }) private static final Object[] decodeDictionary(byte[] bencoded_bytes, int offset) throws BencodingException { HashMap map = new HashMap(); ++offset; ByteBuffer info_hash_bytes = null; while(bencoded_bytes[offset] != (byte)'e') {...
77571580-ec51-45e8-a028-feff43ba42cd
4
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel3 = new javax.swing.JPanel(); jLabel8 = new javax.swing.JLabel(); jFTFTelefone = new javax.swing.JFormattedTextField(); ...
16c1a2a2-05e3-43f6-bca0-cc4b4e1bc0e2
7
public void endLog() { end = "\t<end date=\"" + getLogDate() + "\" time=\"" + getLogTime() + "\" />\n"; logfilename = "log/log_" + formatDateTime("dd-MM-yyyy_HH-mm") + ".xml"; try { JFileChooser fc = new JFileChooser("log/"); fc.setFileFilter(new XMLFileFilter()); fc.setSelectedFile(new File(logfilename)...
51212e3a-9ef1-4073-bafb-29a227f220cc
3
public void majFen(ArrayList<Message> message){ if (message.size() > 0){ for(Message tmp:message){ //System.out.println (tmp); jTextArea3.setText(jTextArea3.getText()+tmp.toString()); } try { chat.nettoyerMessage(this.getPseudo(...
a648696f-e413-47af-a198-e45ba224533a
9
public void act() { if(Greenfoot.mousePressed(this)) { startX = getX(); startY = getY(); } //Enables the checker to respond to mouse drags //Only moves the checker to diagonal posisitons if(Greenfoot.mouseDragged(this)) { MouseInfo mous...
39f9380b-ad46-41d2-a4df-1591bcc04ea3
3
@Override public String execute() throws Exception { try { Map session = ActionContext.getContext().getSession(); session.put("User", null); session.clear(); myDao.getDbsession().close(); addActionMessage("Successfully Logged Out."); re...
f44d359f-1256-412a-a803-8547c0fe9296
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...
5a6d5c5c-5388-426d-a230-08aa68684569
5
private void loadEmployeeDateFromFile(String staffRepository) { InputStream is = getInputStreamForFile(staffRepository); XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance(); try { XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(is); while (xmlEventReader.hasNext())...
3fdafe36-77a8-4891-870a-bf59196e2712
5
public int[] diceThrown() { switch (turn % 5) { case 1 : return new int[] { 2, 3 }; case 2 : return new int[] { 4, 4 }; case 3 : return new int[] { 3, 6 }; case 4 : return new int[] { 6, 1 }; case 0 : return new int[] { 5, 3 }; default : ...
77a00b0e-768b-4917-b60d-00534ecc1010
5
protected boolean siirraVaakasuunnassa(int napinKorkeus, int napinLeveys, int suunta) { if ((suunta == 1 && napinLeveys + 1 >= getLeveys()) || (suunta == -1 && napinLeveys - 1 < 0) ) { return false; } if (getLauta()[napinKorkeus][napinLeveys + suunta].getTunniste() == -1) { ...
aa30379a-46c1-49f1-9f1f-c03e152adf66
3
private void init(){ Random rand = new Random(System.currentTimeMillis()); for (int x = 0; x < Standards.CHUNK_SIZE; x++){ for (int y = 0; y < Standards.CHUNK_SIZE; y++){ int tileX = (chunkX * Standards.CHUNK_SIZE) + x; int tileY = (chunkY * Standards.CHUNK_SIZE) + y; contents[x][y] = new Tile(2,...