method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e76d0e4d-3258-441f-98be-accedd7e3f21
5
@Override public void run() { facade.getListOfClient(listOfClient); try { listOfClientReturn = listOfClient.take(); } catch (InterruptedException e1) { e1.printStackTrace(); } if (listOfClientReturn != null) { for (Client client : listOfClientReturn) { if (client.getBirthday() == day &&...
25f38daf-1269-4d76-8f72-46199d961852
4
public int getFirstSetBitIndex() { int prefixLength = 0; for (byte b : this.keyBytes) { if (b == 0) { prefixLength += 8; } else { /* If the byte is not 0, we need to count how many MSBs are 0 */ ...
92d150bb-5b74-4ceb-b000-200f5cea42dd
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; State state = (State) o; if (firstEverMove != state.firstEverMove) return false; if (firstMoveOfSequence != state.firstMoveOfSequence) return f...
248051e7-1877-4377-b748-e0ac5d360bd2
3
@Override public Descriptor compile(SymbolTable symbolTable){ SymbolTable lokal = new SymbolTable(symbolTable); int label = getNextLabelNumber(); if(fparams != null){ fparams.compile(lokal); } if(declarations != null){ declarations.compile(lokal); } ProcDescriptor descr = new ProcDescri...
7164edbb-befa-4960-a6ed-61cdf4b68bc8
2
private void fireServerStoptEvent(ServerStopEvent evt) { Object[] listeners = serverStopListenerList.getListenerList(); for (int i=0; i<listeners.length; i+=2) { if (listeners[i]==ServerStopListener.class) { ((ServerStopListener)listeners[i+1]).OnServerStopEvent(evt); } } }
d87fc61e-a95d-4347-8193-f52b777bc601
5
public void paint(Graphics2D g2d){ //si no está muerto if(salud > 0){ Color color; if(salud < 10 && salud!=saludTotal) color = Color.CYAN; else if(salud < 5) color = Color.RED; else color = Color.GREEN; //pintamos la imagen y su salud ...
8e015251-6024-40b2-a7fc-22f2dfd36102
7
private void majListeInventaire(boolean dispo){ listeInventaireLot.clear(); String chaineDispo=""; if( dispo){ chaineDispo=" and lot.commande is null \n"; } else{ chaineDispo=""; ...
cfe42766-f6a9-41e4-b95e-69cb40265686
4
private Matcher ProcessRegex(String RegExpText, boolean CaseSensitiveOption, javax.swing.JTextArea SubjectStringText, javax.swing.table.DefaultTableModel ResultTableModel, String ProcessRegex) { Matcher existMatch = null; Pattern p = null; int i = 0; int existMatchStart = 0, existMatchEn...
15f0add2-e682-4b66-9ae3-089d3ea7e1e2
3
private static String convertDate(String date) { //Date: 2012-12-20 09:53:03.0 // YYYY-MM-DD HH:MM:SS.x // 0123-56-89 12:45:78 // HH:MM, MM/DD/YYYY // 12345, 56/89/0123 char[] cDate = date.toCharArray(); date = ""; if(cDate[11] !='0') date+= cDate[11]; ...
3d8dfcdf-a0f7-46d8-9eab-f6dbb78312d9
5
public void testFetch(){ try { props.load(new FileInputStream(propertiesFileName)); } catch (FileNotFoundException e) { log.info("Properties file " + propertiesFileName + " not found, using defaults."); } catch (IOException e1) { log.info("Error reading properties file " + propertiesFileName + ", using d...
24ccf547-c8cb-4b5a-9604-0ad384101ee7
7
public ReducerDataflowItem(String[] title, String[] values) { for(int i = 0; i < title.length; i++) { float v = Float.parseFloat(values[i]); if(title[i].equals("ShCompMB")) ShCompMB = v; else if(title[i].equals("ShRawMB")) ShRawMB = v; else if(title[i].equals("InRec")) InRec = v; else if(ti...
03b7ae37-8c18-43a9-a6ac-16812d73f1b5
4
private void selectWeapon(String w) { if(w.equalsIgnoreCase("SpermGun")) { weapon = new SpermGun(owner.getID()); } else if(w.equalsIgnoreCase("BurstRubberLauncher")) { weapon = new BurstRubberLauncher(owner.getID()); } else if(w.equalsIgnoreCase("RubberLau...
f5fd338d-8504-4660-8f02-a9d37d38688e
8
*/ public static void createSingleton(String[] args) { //modifications by Zerbetto 05-12-2007 String fileName = null; boolean showFileMenu = true; if ((args != null) && (args.length > 0)) { for (int i = 0; i < args.length; i++) { String arg = args[i]; if (arg.startsWith("file="...
c724097e-592c-4d51-8b96-ccb412d2547b
6
public static void main(String[] args) { Scanner input = new Scanner(System.in); String[] numbersAsStrig = input.nextLine().split("[ ]+"); int[] numbers = new int[numbersAsStrig.length]; for (int i = 0; i < numbersAsStrig.length; i++) { numbers[i] = Integer.parseInt(numbersAsStrig[i]); } int startMa...
b92a7bdc-e986-45f4-a642-dded7b7bda20
6
@EventHandler(priority=EventPriority.MONITOR) void onInventoryClick(InventoryClickEvent event) { if (event.getInventory().getTitle().equals(name)) { event.setCancelled(true); int slot = event.getRawSlot(); if(slot >= 0 && slot < size && optionNames[slot] != null) { ...
e6190006-5293-4adc-8edb-1cff9749686c
4
public static void cleanUpTable() { //Loop through every row in the table for(int k = 0;k<=5;k++) { if(clientsTable.getModel().getValueAt(k, 0) == null) { System.out.println("Found Null Value at: " + k); if(k != 5) { if(clientsTable.getModel().getValueAt(k+1, 0) != null) { Syst...
f709b67b-9af8-4f3a-b7a3-1e98f7b364d1
9
int insertKeyRehash(short val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look ...
11ad854b-814b-44cf-a97e-7fe9b81907ae
1
public TestPanel() { try { createMainPanel(); reloadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { GuiUtils.getUserTests(testIdComboBox, mainPanel, cloudPanel, userKeyTex...
23df4ad9-556e-4de5-b045-8feaf9b2bbc9
1
protected void setSystemProperties() { ConcurrentHashMap<String, String> systemProperties = configuration.filter("system"); Iterator it = systemProperties.entrySet().iterator(); while (it.hasNext()) { Map.Entry property = (Map.Entry) it.next(); String key = (String) prope...
0581552a-7d40-4651-9d06-6c6c34870172
7
public static void main(String[] args) throws IOException { ObjectInputStream in = null; // reads in the compressed file FileWriter out = null; // writes out the decompressed file // Check for the file names on the command line. if (args.length != 2) { System...
b99aa593-6787-4094-a9ad-2aa781927ce6
8
public static Color toColor(Object value) throws ConversionException { if (value instanceof Color) { return (Color)value; } else if (value instanceof String && !StringUtils.isBlank((String)value)) { String color = ((String)value).trim(); int[] comp...
439e57d4-6a44-4ef6-a820-fa9d42b54433
2
public int[] twoSum(int[] data, int target){ int[] result = new int[2]; HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); for(int i=0;i<data.length;i++){ if(map.containsKey(data[i])){ int index = map.get(data[i]); result[0] = index + 1; result[1] = i+1; } else { map....
47b9f3d7-782e-4002-b42e-5e35e199b7fa
6
public void playSound(int sound) { Debug.println("Sound.playSound()"); switch (sound) { case 0: if (!muted) { roll.setFramePosition(0); gutter.setFramePosition(0); clatter.setFramePosition(0); roll.start(); } break; case 1: if (!muted) { gutter.start(); } break...
6275c333-ec4d-4838-ae7b-3ce57889b7fe
5
public void getAllProducts(BlockingQueue<Transaction> debitCollection, BlockingQueue<Transaction> creditCollection, BlockingQueue<Transaction> deadLetterCollection) throws InterruptedException { Statement stmt = new SimpleStatement("Select * from " + tableNameProduct); stmt.setFetchSize(500); ResultSet result...
6e33e18d-d452-4fb3-bbc7-269dad43cad8
7
public String getAtomPropertySelection(byte property) { if (iAtom <= 0) return null; String s = ""; switch (property) { case Atom.UNMOVABLE: for (int i = 0; i < iAtom; i++) { if (!atom[i].isMovable()) s += i + " "; } break; case Atom.INVISIBLE: for (int i = 0; i < iAtom; i++) { if ...
fc8fe7c2-db4d-48f0-aa3b-7bfb61e4e1ae
9
public static void main(String[] args) throws Exception { String props="udp.xml"; boolean migrate_data=false; for(int i=0; i < args.length; i++) { if(args[i].equals("-props")) { props=args[++i]; continue; } if(args[i].equals("-...
2a7ec30f-0ad1-4f66-a691-adc67b5effa6
6
public static Class[] getClassesInPackage(JarFile jarFile, String packageName) throws ClassNotFoundException { notNull(jarFile, "JarFile jarFile"); notNull(packageName, "String packageName"); notEmpty(packageName, "String packageName"); ArrayList<Class<?>> classes = new ArrayList<Class<...
9dc7d407-8b34-42d3-b710-570023a3d01a
9
public int largestRectangleArea(int[] height) { if (height == null || height.length == 0) { return 0; } else if (height.length == 1) { return height[0]; } // use a stack to store min-heights, collapse when new height is smaller than stack[top] int[] minSta...
0f9cee82-e359-4330-86dd-00203fb1d9c8
3
public void setDash(float[] ary, float phase) { if (ary != null) { // make sure no pairs start with 0, since having no opaque // region doesn't make any sense. for (int i = 0; i < ary.length - 1; i += 2) { if (ary[i] == 0) { /* Give a very ...
7fa4d77e-0765-4f85-92ff-0e1b71715a55
6
private void recreateModelData(int tilesWide, int tilesHigh, int oam[], int objectTypes[], byte[][] newMask) { _tilesWide = tilesWide; _tilesHigh = tilesHigh; _oam = new int[oam.length]; System.arraycopy(oam,0,_oam,0,oam.length); _objectTypes = new int[objectTypes.length]; System.arraycopy(objectTypes,0,_ob...
1fc1f17f-e07f-47ec-9046-394bfe7afe4e
9
public boolean setBackString(String txt,boolean write) { // String[] s =txt.split("\\\\"); System.out.println("setBackString "+txt); int tmpasdu; int tmpiob; IECType tmptype; if (txt.startsWith("@")) {return setBackFile(txt);} isBackFile = false; lastErrorStr ="unknown"; txt =txt.replaceAll(" ","")...
e13f8f6e-fafd-4702-b981-5626350187eb
4
public boolean setActivationFunction(String actFunc,double[] actParam){ if(isValidActFunc(actFunc)){ this.activationFunction = actFunc; if(activationFunction.equals("sig")){ if(actParam.length>0){ if(actParam[0]>0){ this.activationParam = actParam; }else{ System.out.println("parameter need...
c7eb0ed4-bfab-4e9e-ad26-3120ae717287
4
public void moveForward(Position position) { Point point = position.getPoint(); if ("N".equals(position.getOrientation().getOrientationCode())) { point.setPosY(point.getPosY() + 1); } if ("E".equals(position.getOrientation().getOrientationCode())) { point.setPosX(point.getPosX() + 1); } if ("S".equal...
88e203e0-9293-4054-bcf2-2944c247f177
0
public byte[] getReserve() { return Reserve; }
4059c59c-312d-4e45-84e1-153162adda5a
9
public void running() { if (!file.exists()) { System.err.println("Wave file not found: " + file); return; } AudioInputStream audioInputStream = null; try { audioInputStream = AudioSystem.getAudioInputStream(file); } catch (UnsupportedAudioFil...
0432a3f3-20fb-4853-a62a-6f9ff403da12
5
public void jouerMondeDesTenebres(JFrame page) { int taille = lDieu.size(); String[] choixDieu = new String[taille - 1]; int i = 0; Iterator it = lDieu.iterator(); while (it.hasNext()) { Dieu deus = (Dieu) it.next(); if (!deus.getNom().equals(dieuActuel.g...
bf33769c-b034-44b7-b387-f55b9e9f7456
3
public void run(){ running = true; final int GAME_PORT = 4715; try { ServerSocket gameServerSocket = new ServerSocket(GAME_PORT); ServerDataBaseManager sDBM = new ServerDataBaseManager(); while(true){ if(running){ new GameServerExecutionThread(gameServerSocket.accept(), sDBM).start(); } }...
3c8c1a6a-3c89-428d-81ff-f670352ca549
8
public Polygon getseeingBox() { int tempX[] = null; int tempY[] = null; int temp = (int) (sightRange * 0.75); int temp2 = 10; int temp3 = (int) (sightRange * 0.250); Coordinate aC = getActualCenter(); int aCx = aC.getX(); int aCy = aC.getY(); switch(direction) { case 1: ...
b5acc58d-3449-4aa3-a86f-50dc021d0764
5
public boolean validate(Byte host, byte[] data, byte[] hmac) { try { MessageDigest digest = MessageDigest.getInstance("SHA-256"); byte[] checkHash = digest.digest(data); PublicKey pubKey = pubKeys.get(host); if(pubKey != null) { Cipher rsa; rsa = Cipher.getInstance("RSA/ECB/NoPad...
9a7fe0b2-62ff-45f9-aaff-0bab17b92573
4
public Cell getNextCell(Direction dir) { Cell head = this.getHead(); int i = head.getI(); int j = head.getJ(); switch (dir) { case UP: return new Cell(i,j-1); case LEFT: return new Cell(i-1,j); case DOWN: return new Cell(i,j+1); case RIGHT: return new Cell(i+1,j); default: retur...
5aa2a54e-a212-4963-809d-dd8b73e7d76d
0
@Override public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater(new doActions(e.getActionCommand())); }
3c49e567-fb5e-47ff-859e-b1e7757a131e
6
private static final int method2903 (int i, int i_61_, byte[] is, int[] is_62_, int i_63_, int i_64_, int i_65_, int i_66_, int i_67_, int i_68_, int i_69_, Class348_Sub16_Sub5 class348_sub16_sub5, int i_70_, int i_71_) { class348_sub16_sub5.anInt8970 -= class348_sub16_sub5.anInt8971 * i_64_; class348_sub16_sub5...
2ed345a1-bcf2-4381-a2c6-282d0f195d89
4
private void updateInvincibility() { if (invincibility > 0) invincibility--; else { for (Ship that : world.getShips()) { if (that != this && rect.intersects(that.getRect())) collideWithEnemy((EnemyShip) that); } } }
6301c3ee-7382-4001-b22f-5dc6692e4078
3
public Target(int x, int y, int z) { array = new int[x][y][z]; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[i].length; j++) { for (int k = 0; k < array[i][j].length; k++) { array[i][j][k] = 0; } } }...
0c96a800-3123-4821-9cf8-0a0aeac02087
5
private float[] mdct_kernel(float[] x, float[] w, int n, int n2, int n4, int n8){ // step 2 int xA=n4; int xB=0; int w2=n4; int A=n2; for(int i=0; i<n4;){ float x0=x[xA]-x[xB]; float x1; w[w2+i]=x[xA++]+x[xB++]; x1=x[xA]-x[xB]; A-=4; w[i++]=x0*trig[A...
c992fd56-46f7-4e28-92a2-264521f0fea9
5
@Override public void onTick() { super.onTick(); if (alpha >= Math.PI * 2) { content.get(0).setVisible(false); content.get(1).setVisible(true); } alpha += 0.05f; if (!update) { if (alpha >= Math.PI * 4 || Keyboard.isKeyDown(Keyboard.KEY_SPACE)) Game.currentGame.setScene(new SceneMainMenu()); } ...
c59fc59f-2bab-4e66-afa5-1c817e9a6f3d
8
@SuppressWarnings("unchecked") // FIXME in Java7 private void updateColonyBox() { if (!player.isEuropean()) return; // Remove all action listeners, so the update has no effect (except // updating the list). ActionListener[] listeners = colonyBox.getActionListene...
21773ea4-a4d6-4a0b-9cf6-058d3ee8cc29
1
private boolean jj_3_25() { if (jj_3R_42()) return true; return false; }
5aa883d7-76a3-4fe8-a4bf-d4946030016b
1
public static void preorderTreeWalk(Node node){ if(node != null){ System.out.print(node.key+" "); preorderTreeWalk(node.left); preorderTreeWalk(node.right); } }
30c00361-eea7-4066-9ebc-226dcf84e493
9
@Override public void saveImage() { BufferedImage image = new BufferedImage(800, 500, BufferedImage.TYPE_INT_RGB); Graphics g = image.getGraphics(); int r = 255; int g1 = 255; int b = 255; int col = (r << 16) | (g1 << 8) | b; //background for (int i = 0; i < 800; i++) for (int j = 0; j < 500; j+...
d5a0d1a1-31dd-4c5b-b149-db35c4d0de05
5
public static void loadLanguage(final String language) { if (languages.add(language)) { if (!isActiveLanguage(language)) return; try { for (final String part : PATTERN_UNDERSCORE.split(language)) { if (!languageAlternatives.containsKey(part)) languageAlternatives.put(part, new HashS...
da533184-78b0-4603-93ea-da15dee71e77
7
private static boolean match(Class<?>[] argTypes, Class<?>[] paraTypes) { if (paraTypes.length != argTypes.length) { return false; } for (int index = 0; index < paraTypes.length; index++) { if (argTypes[index] != null && !paraTypes[index].isAssignableF...
5260e020-85bb-4141-90a8-1d78f4e7a6e4
5
public static Board getPrev(Board currentBoard){ Board previousBoard = new Board(); if (history.size() == 0){ return currentBoard; } Object[][] deltaBoard = history.get(history.size() - 1); for (int y = 0;y < 8;y++){ for (int x = 0;x < 8;x++){ if (deltaBoard[y][x] instanceof Integer){ if (((Int...
17f4bdee-7c8b-4a1f-a8ad-7c057de380e9
1
public JMenuBar getMenuBar() { if (menuBar == null) { menuBar = new JMenuBar(); menuBar.add(getMnChat()); menuBar.add(getLbEstado()); } return menuBar; }
9eca72e3-e947-4f99-8c6a-5afecf65ffe2
4
@Override public void perform() throws IOException { BufferedReader reader = new BufferedReader(new FileReader("./data/params.txt")); String line; while((line = reader.readLine()) != null) { if(line.contains("'archive=gamepack")) { String[] regex = line.split("archive="); String gamePackURL = ...
25b7639e-23b4-4085-80ef-62d10c8b1432
7
public EntityImageClassHeader2(IEntity entity, ISkinParam skinParam, PortionShower portionShower) { super(entity, skinParam); final boolean italic = entity.getType() == EntityType.ABSTRACT_CLASS || entity.getType() == EntityType.INTERFACE; final HtmlColor color = getFontColor(FontParam.CLASS, getStereo()); ...
97b70a4b-aa67-46dd-ab58-a64e3eab82e6
7
public boolean equals(Object obj) { if (obj == this) { return true; } // now try to reject equality... if (!super.equals(obj)) { return false; } if (!(obj instanceof XYImageAnnotation)) { return false; } XYImageAnnotatio...
af9602d0-c9e6-48b9-a944-8614e2188856
2
public String saveUser() { if (user != null) { try { restClientBean.getUserResourceService().updateUser(user); } catch (Exception e) { e.printStackTrace(); } } return null; }
dcb4fb3c-d6b3-4db3-8e69-ca02e8d33a38
6
public static Object recuperarObjeto(File file) throws FileNotFoundException, IOException, ClassNotFoundException { Object obj = null; if (file == null) { throw new NullPointerException("Objeto FILE é Nulo."); } FileInputStream fileIn = null; ObjectInputStream objIn = null; try { fileIn = new Fi...
975fd34a-e2fd-4c4a-aa2c-6ed4eb9ff799
2
@Override public synchronized boolean init() { return (initFile(OnlineUsers.directory+OnlineUsers.flatfile) && initFile(OnlineUsers.directory+OnlineUsers.flatfileData) && initTemplateFile()); }
8cd33104-b10d-492d-89bb-8e047cf783bf
6
int getNumOpenSets(Space space) { int num = 0; if (isOpenForPiece(board[space.getX()], space.getPiece())) num++; if (isOpenForPiece(getColumn(space.getY()), space.getPiece())) num++; if (space.getID() % 2 == 0 && isOpenForPiece(getTopDownDiag(), space.getPiece())) num++; if (space.getID() % 3 == ...
f7f840cc-c2e7-4fae-8bb8-57320c19d48b
7
private void changeEditor(final String command) { final String type = command.replaceFirst("change editor to ", ""); if (this.tabbedPane.getSelectedComponent() == null) { return; } final ScrollPane pane = (ScrollPane) this.tabbedPane.getSelectedComponent(); if (pane.getEditorType().getName().equals(ty...
c9d1b42a-9ea0-4aae-a6d8-6d85a6b0652f
9
public final NTSParser.subsystem_annot_return subsystem_annot() throws RecognitionException { NTSParser.subsystem_annot_return retval = new NTSParser.subsystem_annot_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token IDN45=null; Token LPAR_C46=null; T...
501caf9b-ebc8-4246-a98d-1ad2320a6a36
2
public String toStringVcfLof() { StringBuilder sb = new StringBuilder(); for (Gene gene : genesLof) { if (sb.length() > 0) sb.append(','); // Separate by comma double perc = percentOfTranscriptsAffected(gene, transcriptsLof); VcfLof lofent = new VcfLof(gene, perc); sb.append(lofent.toString()); } ...
28201cc0-90f6-4dbf-bc38-ac6650656337
8
private void writeArray(JSONArray jsonarray) throws JSONException { // JSONzip has three encodings for arrays: // The array is empty (zipEmptyArray). // First value in the array is a string (zipArrayString). // First value in the array is not a string (zipArrayValue). boolean stringy = false; int leng...
c491f02d-53cb-4b1a-86d2-3fcc50ef3011
4
public void delete(ArrayList<Predicate> pl){ for(int i = 0; i < pl.size(); i++){ // for each predicate Predicate p = pl.get(i); boolean found = false; int j = 0; while(j < predList.size() && !found){ found = predList.get(j).equalsPredicate(p); j++; } if(found){ predList.remove(j-...
fe16173b-b19c-4fbd-b2a3-bf8b4550c480
8
private synchronized void generateBackgroundTraffic() { // get the next inter-arrival time for these junk packets long time = gen_.getNextPacketTime(); // get the sending pattern int pattern = gen_.getPattern(); // for initial start-up, get the list of all resources first ...
252a19cf-5936-42de-b21c-ee9685c16b5c
5
@Test public void testMessageQueueSetRunEx() { LOGGER.log(Level.INFO, "----- STARTING TEST testMessageQueueSetRunEx -----"); boolean exception_other = false; String hash = ""; try { server1.setUseMessageQueues(true); } catch (TimeoutException e) { exce...
283cf720-119d-48c5-9950-5ea1a2426d79
2
private void removeWumpus() { for (int x = 1; x <= 4; x++) { for (int y = 1; y <= 4; y++) { w[x][y] = w[x][y].replaceAll(WUMPUS, ""); w[x][y] = w[x][y].replaceAll(STENCH, ""); } } wumpusAlive = false; }
f922e83c-dbab-4b21-80f0-a6668249ef3b
0
public static double getAspectRatio(int width, int height) { return ((double) width / (double) height); }
332ec128-bf72-4d35-9db8-c2d031d9c85b
8
private void rotateRight(Node<T> currentNode, boolean changeRootOfSubtree) { if (currentNode.getParent() != null) { if (changeRootOfSubtree) { Node<T> oldRoot = currentNode; Node<T> newRoot = currentNode.getLeftChild(); newRoot.setParent(oldRoot.getPar...
9570b434-44f6-4559-b9f6-b9c05f9111bb
8
public int getCouponCount(String id) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; int cnt = 0; try { conn = getConnection(); pstmt = conn.prepareStatement("select count(*) from coupon where id=?"); pstmt.setString(1, id); rs = pstmt.executeQuery(); if (r...
c6c45f78-e5ef-49dd-9ccc-f689814a91ab
3
private static void test_isClear(TestCase t) { // Print the name of the function to the log pw.printf("\nTesting %s:\n", t.name); // Run each test for this test case int score = 0; for (int i = 0; i < t.tests.length; i += 3) { int bits = (Integer) t.tests[i]; boolean exp = (Boolean) t.tests[i + 1]; ...
02823519-a12a-4d1e-a5b3-4ad9461d5fdf
6
public void sincronizaClientesOLD(){ // TRAIGO TODOS LOS FUNCIONARIOS List<PosFuncionarios> funcionarios = facOracleDAO.getFuncionarios(); for (PosFuncionarios funcionario : funcionarios) { try { char c = funcionario.getFunEstado().toCharArray()[0]; lo...
22ae15d7-d5f8-4eb1-bdb1-46778fb6d3e0
3
@Override public boolean lockWrite(Long connectionId, String objectType, boolean raise) throws Exception { // check lock synchronized (writeLocks) { //aObjectType - [SAPM.SPM] String lockStart = objectType + lockSeparate; for (int i = 0; i < writeLocks.size(); i++) { String lockName = writ...
d3fa1a90-684e-485f-a0c3-2b556cfaf575
4
private void calculateTileOccupation() { if (Point2D.distance(tileX, tileY, path.peek().getX(), path.peek().getY()) < 0.9 && path.peek().getEnemy() == null) { path.peek().setEnemy(this); } if (Point2D.distance(tileX, tileY, previousTile.getX(), previousTile.getY()) > 0.9 && previousT...
5302e4bb-217e-4a0b-8b80-29f0a9366615
1
protected void paintComponent(Graphics g){ if (needDraw) g.drawImage(Resources.getImageIcon("bg.jpg").getImage(), 0, 0, null); }
8182d53a-057e-4a28-ac8e-5b4fb4d9eeea
5
public static void registerVTI ( Method method, String[] columnNames, String[] columnTypes, boolean readsSqlData ) throws Exception { String methodName = method.getName(); String sqlNa...
ddadbbb0-ca4a-4dde-8c0d-39bd187cbfab
0
public String getNumero() { return numero; }
49b1618a-316b-4ec9-9815-07e081890119
8
public RealLabelledData ortogonalProjection(LinProj p) { // Step one, calculating the transformation matrix: // TODO: this step should not be done here. double denom = 0; double[][] tmatrix = new double[p.w.length][p.w.length]; for (int i = 0; i < p.w.length; i++) { ...
3f41473d-8711-47e6-a1f6-c679d5372491
2
private boolean getNextObject() throws Exception { next = null; RecordReader<LongWritable, Text> recordReader = getRecordReader(); while (recordReader.nextKeyValue()) { String line = recordReader.getCurrentValue().toString(); if (!StringUtils.isBlank(l...
1386efc7-f5f0-42cd-bf22-65f0d91aa476
0
public int getFood() { return food; }
21b5e1f4-b940-4806-90c7-31e4d912345c
9
public static void main(String[] args){ int[] numbers= new int[28124]; for(int i= 1; i<numbers.length; i++){ if(abundant(i)){ numbers[i]= 1; } else{ numbers[i]= 0; } } int[] sums= new int[28124]; for(int i= 1; i<numbers.length; i++){ if(numbers[i]==1){ for(int j= i; j<numbers.length...
24bbad53-9451-43b2-97ac-5a767ad98054
4
private void ajouterButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_ajouterButtonActionPerformed if (nombreSpinner.getValue() instanceof Integer && entreeComboBox.getSelectedItem() instanceof VoieEnum && sortieComboBox.getSelectedItem() instanceof VoieEnum && getTopLevelAncestor(...
5aa7db41-628b-4f4c-a25d-2838e997847e
6
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("**************************").append("\n"); builder.append("operationName = ").append(operationName).append("\n"); if (this.dimensionLevelInfo.size() != 0) { builder.append("dimensionInfo = ").append(this.dimens...
bc96ca5b-205a-4db8-8fca-fc450087272e
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RedirectEntity that = (RedirectEntity) o; if (redirectCount != null ? !redirectCount.equals(that.redirectCount) : that.redirectCount != null) ...
dfb9f3a4-23c2-49bc-9603-f29295edb440
5
public static void main(String[] args) { try { Parser.hdfsCoreConf(); if (Hdfs.Core.DEBUG) { Parser.printConf(new ConfOpt[] {ConfOpt.HDFSCORE}); } } catch (Exception e) { e.printStackTrace(); System.err.println("The NameNode rountine cannot read configuration info.\n" + "Please confirm t...
fe78ef3b-73be-4b21-bb0a-930591266bb4
2
public void add(String sequence) { if ((sequence == null) || sequence.isEmpty()) { totalCount++; return; } // Count for this node char base = sequence.charAt(0); inc(base); AcgtTree node = getOrCreate(base); // Recurse into tree node.add(sequence.substring(1)); }
0eb02f92-b268-4890-bf57-ae56df117d82
1
private String readAll(InputStream in) throws IOException { StringBuilder ret = new StringBuilder(); // Read in each character until end-of-stream is detected int c; while ((c = in.read()) != -1) ret.append((char)c); return ret.toString(); }
8ba15321-da92-45d1-9262-79d1b8dcbe10
7
@Test public void testMultiThreads() { int pageSize = 1024 * 1024 * 32; mappedPageFactory = new MappedPageFactoryImpl(pageSize, testDir + "/test_multi_threads"); int threadNum = 100; int pageNumLimit = 50; Set<IMappedPage> pageSet = Collections.newSetFromMap(new ConcurrentHashMap<IMappedPage, Boolean>(...
041b983c-07da-423c-b3b9-d9c3a6c210ee
1
public LogNormal(double mu, double sigmaSquared) throws ParameterException { if (sigmaSquared <= 0) { throw new ParameterException("LogNormal parameters mu in R, sigmaSquared > 0."); } else { this.mu = mu; this.sigmaSquared = sigmaSquared; norm = new Normal(mu, sigmaSquared); } }
2b2eae64-04cb-482f-b5c7-0e47ce661105
5
public List<String> binaryTreePaths(TreeNode root) { final List<String> result = new ArrayList<>(); if (root == null) { return result; } String rootValue = String.valueOf(root.val); if (root.left == null && root.right == null) { result.add(rootValue); } final List<String> leftPaths = binaryTreePat...
c0f45b26-0b87-4191-ba3d-03de8fe3253e
5
@Override public void update(int tick) { if (startFrame == 0) startFrame = tick; if (dead) return; if ((tick - startFrame) > 0 && (tick - startFrame) % speed == 0) { if (frame * 192 >= image.getWidth(null)) dead = true; else frame++; } }
53395e2e-c284-4811-a74a-c9a106b5a13e
0
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureMethod") public JAXBElement<SignatureMethodType> createSignatureMethod(SignatureMethodType value) { return new JAXBElement<SignatureMethodType>(_SignatureMethod_QNAME, SignatureMethodType.class, null, value); }
47ae27b0-0f39-4a25-8033-3ab6477958e0
5
private void drawSplash(Graphics2D g){ if (loop.getState() != GameState.CIRCLE_MOVE && loop.getState() != GameState.CROSS_MOVE) g.fillRect(10, 10, 300, 50); g.setColor(new Color(255,0,0)); switch (loop.getState()) { case DRAW: g.drawChars("Viik!".toCharArray(), 0, 5, 10, 50); break; case CROSS_WIN: ...
c42f9e61-9e8a-4b5f-807f-6b957443fb7b
6
public void initialize() { ipcon = new IPConnection(); while(true) { try { // try to connect ipcon.connect(host, port); break; } catch(Exception e) { e.printStackTrace(); } try { Thread...
67d36247-7266-4bf1-bc94-be9c71429924
5
@Override public void actionPerformed(ActionEvent event) { if (event.getSource() == exitButton) { System.exit(0); } String theTime; // accept host name from the user... String host = hostInput.getText(); final int DAYTIME_PORT = 1300; try { // crate a socket object to connect to the // specif...
317cb33f-325c-4128-9ca5-9215bee3bcb5
2
@Override public int hashCode() { int result = (x != +0.0f ? Float.floatToIntBits(x) : 0); result = 31 * result + (y != +0.0f ? Float.floatToIntBits(y) : 0); return result; }
a04fda29-590a-4ff1-a152-fd2610c1a983
5
@Override public void fileWasnChoosed(int code) { this.setVisible(true); if (code == FILE_CHOOSER_CODE_SOURCE_FILE) { sourceFileField.setText("./"); } else if (code == FILE_CHOOSER_CODE_SOURCE_IMAGE) { sourceImageSelected("./"); } else if (code == FILE_CHOOSER...
d46985a7-e285-4b38-8bfd-eac940e6ab51
2
public String getMarker() { switch (mType) { case START_TAG: return getDepth() - 1 + COLON + getName(); case END_TAG: return getDepth() + COLON + getName(); default: return getDepth() + COLON + mStack.get(mStack.size() - 1); } }