method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f7813095-c317-46e9-a981-f7b0b7ff1ee3
6
@Override public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game) { VGDLSprite s = sprite1; if (itype != -1) { ArrayList<Integer> subtypes = game.getSubTypes(itype); for (Integer i : subtypes) { Iterator<VGDLSprite> spriteIt = game.getSprite...
19f06bd1-cd65-41b1-8611-722689e6d567
6
protected static Object deserialize(String json, String... packagePrefixes) throws APIException { try { JsonObject jo = parser.parse(json).getAsJsonObject(); JsonElement dataClassJE = jo.get("type"); if (dataClassJE == null) { throw new APIException( "The JSON object sent to the server does no...
68ddb94e-e1e1-4271-b9a9-37bb7ff9f5cf
0
public int getDay() { return day; }
879f5460-7f92-44f5-a248-9729c9371332
7
public void fight(Character hero, Monster creature, Scanner input) { int monsterHealth = creature.getHealth(); boolean run = false; while (monsterHealth > 0 && hero.getHealthCurrent() > 0 && run == false) { char action = action(input); if (action == 'a') { monsterHealth -= hero.attack(creature.getDefens...
8858cf18-0ab4-4904-b30b-0ab80f4c7640
7
static Updateable getUpdate(){ switch(currentState){ case CreateGameScreen: return myCreateGameScreen; case ExitGameDialog: return myExitGameDialog; case JoinGameScreen: return myJoinGameScreen; case MainMenu: return myMainMenu; case NetworkGameMenu: return myNetworkMenu; case NewGameMenu: ...
20e41e7d-9874-471c-abba-bf7856ec172a
2
public ConsoleManager(MaintenanceServer server) { this.server = server; for (Handler handler : logger.getHandlers()) { logger.removeHandler(handler); } logger.addHandler(new FancyConsoleHandler()); try { this.consoleReader = new ConsoleReader(); ...
c0e03dac-fad6-44e0-9184-5d3da32d50be
1
private void compute_pcm_samples15(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { float pcm_sample; final float dp[] = d16[i]; pcm_sample = (float)(((vp[15 ...
e2f67c29-779f-4f11-acd9-461978549e6b
3
public void sendSSH(IMessage message, boolean toVM) throws IOException, JSchException { JSch jsch = new JSch(); Session session; if (toVM) { session = jsch.getSession("root", receiver.getHostAddress(), 22); jsch.addIdentity("~/.ssh/id_dsa"); } else { session = jsch .getSession(DefaultNetworkVa...
d6e3cd34-8740-4a0e-a835-7eb3361f326f
0
public void delete(String name) { prototypes.remove(name); }
9d746515-2f39-4b86-a4bf-8fc4bc8ddf2f
0
public static int getStepToPredator() { return stepToPredator; }
5710a175-af6c-4180-9b7a-63c2d99f35b7
6
public static List<String> findRootTargets(Map<String, MakefileExecution> targetToExecution) { Map<String, List<String>> reversedMap = Maps.newHashMap(); for (Map.Entry<String, MakefileExecution> entry : targetToExecution.entrySet()) { String target = entry.getKey(); MakefileEx...
e23dd70b-7a08-435b-bece-5c3e57706641
3
public String[] getAlphabet(Automaton automaton) { ArrayList list = new ArrayList(); Transition[] transitions = automaton.getTransitions(); for (int k = 0; k < transitions.length; k++) { FSATransition transition = (FSATransition) transitions[k]; String label = transition.getLabel(); if (!label.equals("")...
b66c80c6-10cf-4ad5-a9ac-77de09376fb6
0
@Test public void combinationWithLength_shouldReturnCombOfMaxLengthK() { String word = "abc"; assertEquals("[[a], [b], [c], [a, b], [a, c], [b, c]]", combination.combination(word,2).toString()); assertEquals("[[a], [b], [c], [a, b], [a, c], [b, c], [a, b, c]]", ...
23496cbe-796c-4b37-8466-d90aded9eb2f
6
@AfterGroups({ "MaxHeapCharacters" }) @Test(groups = { "MinHeapCharacters" }) public void testMinHeapCharPushPop() { Reporter.log("[ ** MinHeap Character Push ** ]\n"); testQueueChar = new MinPriorityQueue<>(new Character[seed], true); try { Reporter.log("Insertion : \n"); timeKeeper = System.currentTi...
daed5172-4fea-4961-84d8-b1840ab41808
3
public void setSuperclass(String superclass) throws CannotCompileException { if (superclass == null) superclass = "java.lang.Object"; try { this.superClass = constPool.addClassInfo(superclass); ArrayList list = methods; int n = list.size(); fo...
187169e6-1eef-4b02-a827-71f251ead314
0
public void addVillager(Villager villager) { this.population.add(villager); updateSizeRank(); }
cc389c92-356c-44db-872d-90e4eb761938
4
public boolean Validate() { GeneratorAttri attri; GeneratorAttriGrp grp; int i; for (i = 0; i < this.attrislist.size(); i++) { attri = this.attrislist.get(i); if (!attri.Validate()) { return false; } } for (i = 0; i < this.childattrislist.size(); i++) { grp = this.childattrislist....
2c20e6db-5de6-468b-b1ab-083540e059d8
9
private static int longestCommonSubsequence(int i, int j, char[] seq1, char[] seq2) { char x = seq1[i]; char y = seq2[j]; int result = 0; Set<String> set = sequenceMatrix[i][j]; if (set == null) set = new HashSet<String>(); if (x == y) { if (i > 0 ...
9fa5ac2f-a104-4b85-871c-0f94178d254f
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...
fa690b83-a5d8-41e1-81ad-a11ea815488d
3
private void extractFile(int i) throws IOException { FileOutputStream output; FileInputStream input; byte[] stuffToWrite; String path = archiveFiles.getArchiveFiles().get(i).getFilePath(); long length = archiveFiles.getArchiveFiles().get(i).getLength(); long offset = arc...
f01b4408-35bc-4c08-88f2-7c146faff2f0
3
private static String pickMessage(GameState gameState) { switch (gameState) { case PLAYER_1_WON: return "Player 1 won!"; case PLAYER_2_WON: return "Player 2 won!"; case DRAW: return "Its a draw!"; default: return ""; } }
90faaa9a-67b4-427d-bb79-5227940a4555
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Chunk other = (Chunk) obj; if (lines == null) { if (other.lines != null) ...
769ae048-f859-43e6-b95f-58de9e098d5b
6
long adler32(long adler, byte[] buf, int index, int len){ if(buf == null){ return 1L; } long s1=adler&0xffff; long s2=(adler>>16)&0xffff; int k; while(len > 0) { k=len<NMAX?len:NMAX; len-=k; while(k>=16){ s1+=buf[index++]&0xff; s2+=s1; s1+=buf[index++]&0xff; s2+=s...
bdb4bc66-23bb-487c-a7cd-e16c2654e2e2
2
@Override public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append(super.toString()); buffer.append('['); boolean needComma = false; for (FlexCell cell : mChildren) { if (needComma) { buffer.append(", "); //$NON-NLS-1$ } else { needComma = true; } buffer.append...
888cdfde-19be-4618-a578-c4ee19b42046
0
private static Match createMatch(IBomber[] bombers, File mapFile) { return new Match(bombers, mapFile, POINTS_PER_TREASURE, POINTS_LOST_FOR_DYING, DYING_COOL_DOWN, BOMB_TIMER_DICE, BOMB_TIMER_SIDES, BOMB_FORCE, TURNS, TREASURE_CHANCE, PORT_NO); }
486e9a2b-b8d8-4eeb-8659-e9724c7a6492
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Benutzer)) return false; Benutzer other = (Benutzer) obj; if (benutzerkennung == null) { if (other.benutzerkennung != null) return false; } else if (!benutzerkennu...
727a496e-582d-431e-9f96-b01cc21d69a6
9
private boolean r_verb_suffix() { int among_var; int v_1; int v_2; int v_3; // setlimit, line 164 v_1 = limit - cursor; // tomark, line 164 if (cursor < I_pV) { ...
fac046bf-42dc-4d05-8ed2-d458de25ca11
7
public void draw(Object obj, Component comp, Graphics2D g2) { Color color; if (obj == null) color = null; else color = (Color) getProperty(obj, "color"); String imageSuffix = (String) getProperty(obj, "imageSuffix"); if (imageSuffix == null) ...
d50679b7-953a-49d4-92fd-f3dbd07cd51a
6
public int tileStrToID(String tilestr) { if (tilestr==null) return 0; switch (tilestr.length()) { case 0: return 0; case 1: return (int)tilestr.charAt(0); case 2: return (int)tilestr.charAt(0) + (int)tilestr.charAt(1)*256; case 3: return (int)tilestr.charAt(0) + (int)tile...
cb6b7c63-bfe9-4733-8a3b-28c6a7f5008c
3
private String correctTypeName(Type[] argumentTypes, int i) { String s = argumentTypes[i].getClassName(); // array notation needs cleanup. String braces = ""; while (s.endsWith("[]")) braces = braces + "["; s = s.substring(0, s.length() - ...
722e1ac2-6a06-4419-a47c-3b18e5c75d65
6
protected void processEvent(NextFilter nextFilter, IoSession session, EventType type, Object data) { if (type == EventType.RECEIVED) { nextFilter.messageReceived(session, data); } else if (type == EventType.SENT) { nextFilter.messageSent(session, data); } else...
a7a7a99d-0379-4895-8485-21df5cac2ac2
8
public static <E extends Comparable<E>> boolean searchSortedMatrix(E[][] matrix, E element) { if (matrix == null) return false; for (int i = 0; i < matrix.length; i++) { if (matrix[i] == null) return false; } int rowLength = matrix.length; int row = 0; int col = matrix[0].length - 1; // colu...
8798b93a-09e5-402b-87e8-3aefc1d97bc9
7
public void updateScore(char typeOfScoreUpgrade){ switch(typeOfScoreUpgrade){ case 'c': { // if you killed a boat with a cannon playerScore += 300; // update score score.setText("Score: " + playerScore); // update the score's display ...
f0bf75ec-1142-444a-9bcb-dfcb29659a53
0
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); txt1 = new javax.swing.JTextField(); btnConsultar = new javax.swing.JButton(); btnInsertar...
5622edc0-4789-47f9-9190-35680ff793c0
2
public void init() { if (getInitParameter(jaasInitParam) != null) { jaasConfigName = getInitParameter(jaasInitParam); } if (getInitParameter(loginPageInitParam) != null) { loginPage = getInitParameter(loginPageInitParam); } }
a066623c-090f-4462-aba3-d994a86f31cf
6
public int buscarMasCercano (double frecuenciaBuscada, double [] h2) { double maximo = 99999.0; double minimo = 99999.0; int mejorSolucionSuperior = 0; int mejorSolucionInferior = 0; for (int i = 0; i < h2.length; ++i) { double diferenciaSuperior = h2[i] - frecuenciaBuscada; if (diferenciaSuperior >=...
ed5286bb-76a2-48e2-b2ca-e31d23c5cc0f
4
private int test_constOverlapVariableLength(String organismName, int kmerUpperLength, boolean logOnlyLongestCommonSubstringLength) throws Exception { int kmerLength; int kmersOverlapLength; int graphDegree; int smallestKmerLengthToProduceCorrectResult = 0; boolean smallestSaved = false; int kmer...
633bcb9e-2356-4048-bc88-9bfdbcf49054
1
public void addItemName(int i, String in, int size) { if (item_names == null) { item_names = new String[size]; } item_names[i] = in; }
dbc3d98e-8f8c-46f1-8b51-919e19cd6dfb
6
public static Node[] findNodesOf(NodeList list, String tagName, boolean caseSensitive) { ArrayList<Node> result = new ArrayList<Node>(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if (node instanceof Element) { Element nodeAsElement = (Element) node; if ((caseSensitive && n...
9e6cb520-89ba-4bef-9786-7b5ae034ef06
9
public String converterSrcHextoDesHex(String src, int srcHex, int desHex) { if (srcHex == 0 || desHex == 0) { throw new RuntimeException("error hex, there has no zero hex."); } if (srcHex > HEX_MAX.length() || desHex > HEX_MAX.length()) { throw new RuntimeException("error hex, too big."); } if (src == ...
8ecc5fb9-effe-477e-9221-0d45e0f5fed3
1
void req(String nm) { synchronized (grids) { if (loading.contains(nm)) return; loading.add(nm); start(); } }
8905ed51-d914-43a1-95f8-d9ce8265fe89
3
public String getBesitz() { String besitz = new String(); if ( this.laendereien.size() == 0 ) { return "Kein Land vorhanden!"; } for ( Land land : this.laendereien ) { besitz = besitz + ( land.getGebaeude() == null ? "ohne" : land.getGebaeude() .getBezeichnung() ) + " "; }...
07fc0cc7-7235-4fe2-ae16-5e89a06fea1e
8
public boolean consultarDocumento(String archivo) { Connection con = null; Statement stat = null; ResultSet rs = null; try { con = DriverManager.getConnection("jdbc:sqlite:DBVocabulario.s3db"); stat = con.createStatement(); rs = stat.executeQuery("sele...
3e12038a-0213-4580-8ca2-f1d171bc006e
1
public void enableComponent(String comp) { Iterator<GameActor> it = actors.values().iterator(); while(it.hasNext()) { GameActor actor = it.next(); actor.enableComponent(comp); } actorManager.enableComponent(comp); }
540f174f-da83-474f-8370-0643a662a771
5
private void initReplacements(Grammar replacements) { Map reps = new HashMap(); Production[] p = replacements.getProductions(); for (int i = 0; i < p.length; i++) { String replace = p[i].getLHS(); ArrayList currentReplacements = null; if (!reps.containsKey(replace)) reps.put(replace, currentReplaceme...
6231884e-94d2-4562-aca0-34f6470990d8
5
public Region getClosestOwnedNeighborToOpponentBorder(BotState state) { List<Region> ownedNeighbors = this.getOwnedNeighbors(state); Region closestNeighbor = null; int minDistance = this.getDistanceToOpponentBorder(); for (Region ownedNeighbor : ownedNeighbors) { if (ownedNeighbor.getDistanceToOpponentBorder...
6e03693b-410f-4910-8d30-223fd163e121
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...
591b525f-14d4-440e-890c-3ec17172485d
0
public Configuration(State state, Configuration parent) { myCurrentState = state; this.parent = parent; }
3204a629-6ccb-4ebe-912e-4e69225883c2
3
public static void addIgnore(BSPlayer p, String ignore) throws SQLException{ if(PlayerManager.getSimilarPlayer(ignore)!=null){ ignore = PlayerManager.getSimilarPlayer(ignore).getName(); } if(PlayerManager.playerExists(ignore)){ if(!p.isIgnoring(ignore)){ p.addIgnore(ignore); SQLManager.standardQuery("IN...
00fa6fe6-7a6f-4900-bf15-7952458c7fed
8
private void Init(){ this.setLayout(null); skladnikiCombo = new SkladnikiComboBox() { public void Action(){ pos.add( ((Skladnik) skladnikiCombo.getSelectedItem()).id, DEFAULT_WEIGHT); BazaObject.saveLog.addUpdatePosilek( pos.id ); HIDE_FLAG=true; BudujTabele(); } }; pola = new JTextField[I...
831315d2-1770-46b1-ab4a-947d0ca0e79e
1
public boolean canShootAtThisFrame() { rateOfFireCounter += rateOfFirePerFrame; if (rateOfFireCounter >= 0) { rateOfFireCounter--; return true; } return false; }
906f24a6-8f5a-4745-8cf3-ed4af21ab445
2
public ArrayList<ArrayList<TaggedDataSequence>> selectData( List<String> groupNames, List<Integer> conditions) { // AT CERTAIN POINTS, IT SEEMS LIKE I SHOULD BE USING A LINKED, // RATHER THAN ARRAY-BASED, STRUCTURE? // Initialize two-dimensional array of tagged sequences: ArrayList<ArrayList<TaggedData...
4660c550-0c1e-409e-baef-2b694e85fac2
9
private void jj_add_error_token(int kind, int pos) { if (pos >= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; ...
8816f898-97b9-4dfc-9fcf-417ac668030b
9
@Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: System.out.println("Move up"); break; case KeyEvent.VK_DOWN: if(robot.isJumped() == false){ robot.setDucked(true); robot.setSpeedX...
ff3a05e8-d31a-4f2e-85d8-b34591cc5f26
6
static private void remplire(File fichier, Hashtable hash, int taillePieces){ String key = FileHashSum.sha1sum(fichier) ; Fichier element = new Fichier(fichier.getName(), key, fichier.length() , taillePieces) ; // *TODO* la clé n'est pas la bonne int taille; File fichierCache = new File("Download/."+fichier.getName...
403d4268-dfd1-4ea2-b963-16f813a58f10
8
private void placeNewGoodie(Point oldPosition) { if (oldPosition != null) { for (Point p : goodiePositions) { if (p.equals(oldPosition)) { goodiePositions.remove(p); break; } } } boolean posOK = false...
b5ad6b34-cba4-4cc5-8187-34ca3c188269
0
public CellCreature(Point3 p, Stats constStats, Stats dynamicStats, int inClassID){ classID = inClassID; pos = p; this.constStats = constStats; this.dynamicStats = dynamicStats; childDynamicStats = dynamicStats.clone(); obstacleType = ObstacleType.BEING; ai = new...
a589de72-f98f-4d5d-9aed-9e975b6a9e08
3
public static int countIncludedChar(CharSequence charseq, char searchedChar){ if(charseq == null){ System.out.println("�L��Ȓl���͂��Ă�������"); } String testedStr = charseq.toString(); int count = 0; for(int i=0; i<testedStr.length(); i++){ if(testedStr.charAt(i) == searchedChar){ count++; }...
34aad0cb-8858-455e-9471-6083b553a8a2
5
public void run() { boolean running = true; while(running) { try { log.debug("Waiting for status update"); Collection<String> deQueuedMessages = new ArrayList<String>(); if(queue.drainTo(deQueuedMessages) > 0) { for(String message : deQueuedMessages) { ...
24db9cb3-95b2-4612-bcca-0fca12239c75
9
protected static ReasonsMask processCRLD( X509CRL crl, DistributionPoint dp) throws AnnotatedException { IssuingDistributionPoint idp = null; try { idp = IssuingDistributionPoint.getInstance(CertPathValidatorUtilities.getExtensionValue(crl, ...
6d50721b-c433-40f6-a85d-c464c59d41ba
0
public Vector2f add(Vector2f vec2f) { this.x += vec2f.getX(); this.y += vec2f.getY(); return this; }
b987c89b-c4d5-4ccc-b3fd-a277e078b6dc
3
public boolean checkEquals(String str1, String str2) { if (str1 == null || str2 == null) { throw new NullPointerException("The strings must not be null"); } return sensitive ? str1.equals(str2) : str1.equalsIgnoreCase(str2); }
66bbb2d0-3732-4017-97c1-fc4808c0b901
1
public int hashCode() { if (hashCode == -1) { hashCode = (int)((mostSigBits >> 32) ^ mostSigBits ^ (leastSigBits >> 32) ^ leastSigBits); } return hashCode; }
6a80985d-d274-4338-8f3d-7fa0e9996922
5
@SubCommandHandler(name = "join", parent = "channel", permission = "multichat.channel.join") public void joinChannelEvent(Player player, String[] commandArgs) { if (commandArgs.length > 1 && !commandArgs[1].isEmpty()) { String channelName = ""; //Parse for channel name for(int I = 1; I < commandArgs.len...
b842dabe-cd32-490c-9ecf-bac24ad8d664
5
public String createBorrow(String idUSer, String idBook) { if(idUSer.equals("") || idBook.equals("")) { return "One ore more fields are empty"; } if(!IntegerUtil.isInteger(idUSer) || !IntegerUtil.isInteger(idBook)) { return "The field's value must be numeric"; } int idUserInt = Integer.parseInt...
a86db805-2c33-41fd-90d9-50d613bea625
1
@GET @Produces(MediaType.APPLICATION_JSON) public String getRepositories(@Context HttpServletRequest request) { RepositoryListVm repositoryList; try { repositoryList = dao.getRepos(getBaseUrl(request)); } catch (IOException e) { logger.log(Level.SEVERE, "F...
847798c7-98a6-40cd-a620-16518f7e4504
2
public void mouseEntered(MouseEvent e) { if (!enabled) return; entered = true; if (pressed) { setModal("pressed"); } else { setModal("entered"); } }
0ecc481f-bda0-428f-ad17-587c839bc61f
2
public static ArrayList<HashMap<Integer, ArrayList<Double>>> regionQuery( ArrayList<HashMap<Integer, ArrayList<Double>>> geneListCopy, ArrayList<Double> list, double eps){ ArrayList<HashMap<Integer, ArrayList<Double>>> result = new ArrayList<HashMap<Integer, ArrayList<Double>>>(); int size =...
ccf04304-53bc-4201-9437-89efe23a17f2
4
public void DisplayRecords(ResultSet rs) { try { rs.beforeFirst(); ResultSetMetaData metaData = rs.getMetaData(); while (rs.next()) { for (int idx = 1; idx <= metaData.getColumnCount(); idx++) { if (rs.getObject(idx) != null) { ...
df3cc22c-720b-425a-80d6-fabfaa968870
4
public static void main(String[] args) { String fichier = null; if (args.length > 1) { fichier = args[0]; try { mode = Integer.parseInt(args[1]); } catch (NumberFormatException e) { System.out.println("Mode invalide : mode par défaut = 0"); mode = 0; } } else if (args.length > 0) { fi...
639bf15a-c3a9-4311-9095-58de78494922
3
public Funcionario listById(int codigo) { Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; Funcionario f = new Funcionario(); try { con = ConnectionFactory.getConnection(); pstm = con.prepareStatement(LISTBYID); pstm....
a668d57c-49ce-414c-a61d-a21821715bbf
0
@Override public boolean hasNext() { return current < size; }
04305898-c497-4715-9905-c371cc92c7d3
8
private void saveDocument() { if (currentFile == null) saveAsDocument(); else SwingUtilities.invokeLater(new Runnable() { public void run() { OutputStream out = null; try ...
5cfcaf86-1c92-4954-b55c-589884ed2014
5
private void outputList(HttpServletResponse response,FavoriteForm form,List<String> messages,UserBean user) throws IOException { // Get the list of items to display at the end FavoriteBean[] favorite; try { favorite = hw8DAO.getUserFavorites(user.getId()); } catch (MyDAOExce...
ce2c21b1-d461-41e0-85c2-872fe88f0bfd
1
public E last() { if (size() == 0) { throw new RuntimeException("Last element not available"); } return this.get(this.size() - 1); }
a857bc0e-3d2d-40e5-b50e-76f081c71565
9
public void create(ItItemHasEmpleado itItemHasEmpleado) throws PreexistingEntityException, RollbackFailureException, Exception { if (itItemHasEmpleado.getItItemHasEmpleadoPK() == null) { itItemHasEmpleado.setItItemHasEmpleadoPK(new ItItemHasEmpleadoPK()); } itItemHasEmpleado.getItIte...
4a508d15-4c3a-489c-832f-fd7bf84bf26b
9
final public Diagram createSystem(UmlSource source) { final IteratorCounter it = source.iterator(); final String startLine = it.next(); if (StartUtils.isArobaseStartDiagram(startLine) == false) { throw new UnsupportedOperationException(); } if (source.isEmpty()) { return buildEmptyError(source); } ...
0d5fc040-640c-494b-8acb-89eb7d78915e
6
public static String prettyTime(long t){ StringBuffer sb = new StringBuffer(); if (t < 60) { // x sec sb.append(t).append(sec); return sb.toString(); } if (t < 3600) { // x min y sec sb.append(t/60).append(min).append(" "); t = t % 60; if (t > 0) { //if (t<10) sb.append("0"); sb.append(t)...
0d349510-7203-497f-a1f6-4c62c4d88bb0
8
public boolean areAnagramsCount(String a, String b) { if(a==null&&b==null) return false; else if (a== null||b==null) return false; else { int[] count = new int[256]; char[] ac = a.toCharArray(); for(char c:ac) { count[c]++; } char[] bc = b.toCharArray(); for(char c:bc){ c...
0428ea52-7dcb-40d6-8bc1-594c4f228352
8
@Override protected void writeChildren(XMLStreamWriter out) throws XMLStreamException { super.writeChildren(out); if (events != null) { for (Event event : events) { event.toXMLImpl(out); } } if (scopes != null) { for (Scope...
b0ba37ae-d868-4c53-b6f2-67450cdc673d
1
public String bytesToHex(byte[] raw) { int length = raw.length; char[] hex = new char[length * 2]; for(int i = 0; i < length; i++) { int value = (raw[i] + 256) % 256; int highIndex = value >> 4; int lowIndex = value ...
d3a17bda-cd21-416b-b76b-d55e02e963b9
4
private long getCPtrAddRefContactNym(ContactNym element) { // Whenever adding a reference to the list, I remove it first (if already there.) // That way we never store more than one reference per actual contained object. // for(int intIndex = 0; intIndex < elementList.size(); intIndex++) { Object theObject = ele...
182ec6eb-d430-4992-9f06-0348e6d73b5d
2
public void setSnameRaw(byte[] sname) { if (sname != null) { if (sname.length > this.sname.length) { throw new IllegalArgumentException("Sname is too long:" + sname.length + " max is:" + this.sname.length); } Arrays.fill(this.sname, (byte) 0); Syst...
218c8edc-0f2b-43c2-ab18-f7f4b463c874
8
public void setBoard() { int boardIter = shipSize; if (shipSize == 1) { boardIter = 3; } if (horizontal == false) { int yCoor = ship.getY(); while (boardIter > 0) { humanBoard[ship.getX()][yCoor] = shipSize; boardIter--; yCoor++; } } if (horizontal != false) { int xCoor = ship.g...
5374aee9-c660-49fd-9f2b-4f6e726d76e9
7
@Override public boolean equals(Object heroO){ Hero hero = (Hero)heroO; if (this.name.equals(hero.name) && this.clazz.equals(hero.clazz) && this.level.equals(hero.level) &&( (this.weaponPower == null && hero.weaponPower==null )|| this.weaponPower.equals(hero.w...
b194d485-d55b-41dc-9c8e-34e252dd5739
6
public PanelBoissons(PanelCommande c){ setLayout(new BoxLayout(this,BoxLayout.PAGE_AXIS)); setBackground(new Color(252,243,214)); commande = c; for(Categorie cat : Categorie.values()){ if(cat.isBoisson(cat)) { JPanel panel = new JPanel(); panel.setBackground(new Color(252,243,214)); panel.s...
bd742cfc-0dd0-4c26-96a0-b95bea1d6a69
6
private void MovieAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MovieAddButtonActionPerformed boolean startCapital; String updateDB; boolean isWordName = true; boolean isWordDesc = true; String movieName = MovieTitleATextField.getText(); Stri...
71ee7e9f-ecd8-4dd9-bf50-a9bd149f31c5
8
public String addTitleEps(String eps) throws IOException { if (text == null || text.size() == 0) { return eps; } final int idx = eps.indexOf("%%BoundingBox:"); if (idx == -1) { throw new IllegalArgumentException(); } final StringTokenizer st = new StringTokenizer(eps.substring(idx + "%%BoundingBox:"....
a01f1127-07d7-4d1b-84d5-f6d274e1dcaf
4
private static String fizzBuzz(int a, int b, int n) { String fb; fb = ""; for(int i = 1; i <= n; i++) { if(i % a == 0) { if(i % b == 0) { fb += "FB "; } else { fb += "F "; } } else if(i % b == 0) { fb += "B "; } else { fb += i + " "; } } ...
115a4e3c-243f-44d1-9bd5-bb4ee8c39c76
6
private void searchAboutTheGame(String str) { String tmp = null; aboutTheGame = null; keyFeatures = null; int start = str .indexOf("<div id=\"game_area_description\" class=\"game_area_description\">"); if (start >= 0) { tmp = str.substring(start); int end = tmp.indexOf("</div>"); if (end >= 0) { ...
0fa0fe5c-e38a-412a-97f0-cdeded8fb409
9
public static World read(BinBuffer binb) throws WorldException { String worldGenTag = binb.readJavaString(); for (WorldGen<? extends World> worldGen : WorldGen.worldGenList) { if (worldGen.tag.equals(worldGenTag)) { World world = new World(worldGen,(int)binb.readUInt(),(int)binb.readUInt(),false); w...
669651ff-ea35-4adb-8b5f-926a95301c21
9
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LocalReferenceImpl that = (LocalReferenceImpl) o; if (_expression != null ? !_expression.equals(that._expression) : that._expression != null) return false; ...
f4db6c6f-4597-4f43-bb63-d40b05e38621
9
private static void saveMeans() throws IOException { try (FileWriter w = new FileWriter("means.csv")) { for (ThreadForParametersSet thread : threads) { w.append(thread.fileName).append(";"); } w.append("\n"); for (int i = 0; i < MAX_ITERATIONS; i++...
48d4faca-9eda-42e1-9545-e3a435f7b7fe
0
@Test public void testGetColour() throws IOException { System.out.println("getColour"); AntBrain b = new AntBrain("cleverbrain1.brain"); Ant instance = new Ant(b,true,0); boolean expResult = true; boolean result = instance.getColour(); assertEquals(expResult,...
90395346-ac82-4234-92fd-e898e830cdb4
9
private void runTest() { Thread t = new Thread() { @Override public void run() { RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(10 * 1000).build(); HttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(requestCon...
6953b1c7-c9f1-4e83-b01b-ab437f85ccf7
7
*/ public String getOpenFileError() { String fullPathName = getFullPathName(); String fileName = getFileName(); Object clientFile = fileManager.waitForClientFileOrErrorMessage(); if (clientFile instanceof String || clientFile == null) { String errorMsg = (String) clientFile; setStatusFileNotLoaded(fullPa...
5929a48f-33b4-4420-a489-591a53f23422
7
public int getCount() throws SQLException { Connection c = null; PreparedStatement ps = null; ResultSet rs = null; try { c = dataSource.getConnection(); ps = c.prepareStatement("select count(*) from users"); rs = ps.executeQuery(); rs.next(); return rs.getInt(1); } catch (SQLException ...
00dd0551-9115-4f1d-812f-e08280081054
3
public void setCameraUser(CCamera camera, boolean pushOnServer) { if (cCameraUser != null && pushOnServer) remove(cCameraUser); cCameraUser = camera; if (pushOnServer) add(cCameraUser); }
de06b65b-aca3-43be-85be-10bbaa6a67b3
2
private static CommandLine getArgs(String[] args) { CommandLineParser clp = new BasicParser(); Options options = new Options(); options.addOption(new Option("P", "preview", false, "Show a pop up window of result")); options.addOption(new Option("S", "save", true, "Save image to file...
837e7c7e-d5fc-4b45-863c-0e39fb980222
5
public DecodeStream getSequence(boolean implicit) throws Asn1Exception { DecodeStream seqStream; // // There must be at least T and L fields available // if (residualLength < 2) throw new Asn1Exception("Attempt to read past end of stream"); // // Val...