method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fa4c2dfc-9f55-4c37-a092-1fe217ff4614
8
public static void determineWinners() { System.out.printf("%s has %d points.\n", dealer.getName(), dealer.getHand().getPoints()); for (Player p : playerList) { for (int i = p.getNumberOfHands() - 1; i >= 0; i--) { System.out.printf("%s has %d points for hand%d.\n", p.getName(), p.getHand(i).getPoints(), i...
03dee46e-4eee-4089-8591-0c23d17b470e
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...
fb4c44f3-dbd8-4e1f-b4be-180f354bea81
1
public static boolean getKeyDown(int keyCode) { return getKey(keyCode) && !lastKeys[keyCode]; }
a59ee6cd-c4c0-408a-9917-a35ba32e2f8c
3
public void load(String file) { // when we load a new file, stop playback of other file. stop(); // Don't try all this if the sequencer is not open. if ( !sequencer.isOpen() ) { System.err.println("Cannot load a midiFile. The sequencer is not open."); ...
d4d9d9a7-7909-48f2-82bc-bb7238a58880
9
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() instanceof Timer){ int s = rand.nextInt(aliens.size()); if (s%3 ==0 && s%5 ==0){ fireAlien(s); } if(!reverse) { for (int i = 0; i < aliens.size(); i++) { ...
a2ebc476-71a4-4220-9148-9968806f1b93
0
public String getAge() { return age; }
89bf5b1a-f472-4a49-9cc6-4f106dba1d5c
2
private boolean collision(Rectangle future, Rectangle[] walls){ for(int i = 0; i< walls.length; i++){ if(future.intersects(walls[i])){ return true; } } return false; }
6ab92966-108b-4996-88de-ef4a500268a1
8
public void setAppletContext(String htmlName, URL documentBase, URL codeBase, String appletProxyOrCommandOptions) { this.htmlName = htmlName; isApplet = (documentBase != null); String str = appletProxyOrCommandOptions; if (!isApplet) { // not an applet -- used to pass along command line options if (str.in...
ddea9674-7c6b-4de8-9b59-d3a9e68521c3
2
public static final Rectangle inset(int amount, Rectangle bounds) { bounds.x += amount; bounds.y += amount; bounds.width -= amount * 2; bounds.height -= amount * 2; if (bounds.width < 0) { bounds.width = 0; } if (bounds.height < 0) { bounds.height = 0; } return bounds; }
ae1b33ca-0792-4525-9efc-43b4998cf152
4
private void ConnectionButtonClicked(MouseEvent evt) { if(Settings.activatePremium){ if(!UsernameField.getText().trim().equals("")){ if(!passwordField.getPassword().toString().trim().equals("")){ login(UsernameField.getText().trim(), new String(passwordField.getPassword())); ...
1cc7c346-26f0-4406-a216-fb28f0cbd457
2
public static JSONObject toJSONObject(String string) throws JSONException { JSONObject o = new JSONObject(); HTTPTokener x = new HTTPTokener(string); String t; t = x.nextToken(); if (t.toUpperCase().startsWith("HTTP")) { // Response o.put("HTTP-Versi...
2d838d77-ab9c-4f79-8de3-0cb076c439f2
9
@Override public synchronized int readBit() throws BitStreamException { int res = this.delegate.readBit(); this.current <<= 1; this.current |= res; this.out.print((res & 1) == 1 ? "1" : "0"); this.lineIndex++; if (this.mark == true) this.out.pr...
62325f30-af84-4b77-93a6-7115a9b37447
5
private boolean calculateWindowSize() { boolean sizeIsOkay = true; int outsideFrameWidth = this.getWidth(); int outsideFrameHeight = this.getHeight(); if (outsideFrameWidth < MIN_WINDOW_WIDTH) { outsideFrameWidth = MIN_WINDOW_WIDTH; sizeIsOkay = false; } if (outsideFrameHeigh...
66f4e614-187c-4fdc-a13d-017aa744a3e2
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof SampleAttribute)) { return false; } SampleAttribute other = (SampleAttribute) object; if ((this.sampleAttribute...
1fbb7d98-6664-4bd4-a71e-480d3b803fa4
3
public boolean accept(File dir, String name) { boolean isAcceptable = false; for (int i = 0; i < m_extensionList.size(); i++) { String ext = m_extensionList.get(i); if (!ext.startsWith(".")) ext = "." + ext; isAcceptable = name.endsWith(ext); if (isAcceptable) break; ...
2cb7488e-beeb-4b91-a441-883c8441150a
1
@Override public void setNull(int intId, String strTabla, String strCampo) throws Exception { Statement oStatement; try { oStatement = (Statement) oConexionMySQL.createStatement(); String strSQL = "UPDATE " + strTabla + " SET " + strCampo + " = null WHERE id = " + Integer.toS...
7546e220-a8b7-4228-b956-6b3fa1ed3950
1
public GUIViewPanel(Grid initGame){ super(); game = initGame; dx = 50; dy = 50; try { floor = ImageIO.read(getClass().getResource("/WumpusImages/Ground.png")); blood = ImageIO.read(getClass().getResource("/WumpusImages/Blood.png")); goop = ImageIO.read(getClass().getResource("/WumpusImages/Goop.png")...
50219596-ff2e-49db-bd45-a093c419aab3
5
public static void bstTest() { for (int i = 0; i < 100; i++) { BST tree = new BST(); Make make = new Make(); ArrayList<Integer> list = make.list(); for (int n = 0; n < list.size(); n++) { tree.insert(list.get(n)); if (n % 10 == 0)...
1d61a008-6b4c-4600-8425-38d513ca8786
0
public ConvertCFGLL(GrammarEnvironment environment) { super("Convert CFG to PDA (LL)", null); this.environment = environment; }
28c9bbf3-ae42-451f-9137-dd6f7a3e1f82
8
@Override public void itemStateChanged(ItemEvent e) { if (textEntryField == null) { // We we're unable to find a JTextField component that was a decendant of this // JFileChooser so we need to abort. return; } String filename = textEntryField.getText(); if (filename == null || filename.equals(""...
fce93198-4cc3-4427-ad28-d484d5b2db95
0
public String getName() { return this.name; }
e4a6325f-d31a-437e-923a-951214c2f30f
2
public static void send() { while (true) { Socket socket = null; byte[] readInput = new byte[80]; DatagramPacket packett = null; byte[] m = null; byte[] input = null; try { input = new byte[80]; packett = new Da...
e0dcb795-7117-42f3-b66d-da1ebe9dfb0c
5
public void finish(UQuest plugin, Player player, boolean showText){ Quester quester = plugin.getQuestInteraction().getQuester(player); int id = quester.getQuestID(); //For the event to know which quest id the player had //set them to having no active quest quester.setQuestID(-1); //set them to having no qu...
3b80a536-946c-4ace-8a9a-0e2c8098f63b
5
public static int diferencaMatriz(int[][] matriz){ int[][] original = {{1, 2, 3},{4, 5, 6},{7, 8, 0}}; int dif = 0; int a; int b; int N = 3; for (a=0; a<3; a++){ for(b=0; b<3; b++){ if (original[a][b] != matriz[a][...
385f51e7-1ce0-4368-9a31-5012344e0bf5
9
public Causa eliminacionImputadoPorTeclado(){ @SuppressWarnings("resource") Scanner scanner = new Scanner (System.in); String texto; int expediente; Long dni; Causa causa = new Causa(); try { System.out.println("Eliminar Imputado de Causa"); System.out.println("--------------------------"); whil...
9a6dd504-acf0-479d-8bb2-ff7611216f99
8
private String getFormatedChange(String change) { StringBuilder sb = new StringBuilder("<font color=\""); final String typePattern = "[{].+[}]"; Pattern pattern = Pattern.compile(typePattern); Matcher matcher = pattern.matcher(change); List<String> matchList = new ArrayList<>(); while(matcher.find()) ma...
f4ec8b1a-8891-42bd-af21-02503022f6a3
0
public void setId(Long id) { this.id = id; }
7662869a-7ef7-4fee-a058-183ebf265293
7
public int[][] resetMatrix() { for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[0].length; j++) { if (matrix[i][j] == 0) { row[i] = true; col[j] = true; } } } for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[0].le...
9b108eaf-7010-4ab1-93f7-e1255b9ea286
8
public String handleCommand(String stp) { if(stp.toLowerCase().startsWith("tenable")){ if(enabled){ enabled = false; return "Commands Disabled."; }else{ enabled = true; return "Commands Enabled."; } } if(enabled){ //cannot be a switch case, it wont recognise .startsWith, which me...
19865d11-b2aa-4ce8-a156-3f20ab1abb48
0
public int length() { return this.myArrayList.size(); }
d2e5d85c-cbca-46d4-aaea-98a068449449
9
@Override public void run() { ServerSocket socket; boolean isRefreshRequest = false; System.out.println("Webserver starting up on port "+ SERVER_PORT); System.out.println("(press ctrl-c to exit)"); try { // create the main server socket socket = new ServerSocket(SERVER_PORT); } catch (Exception e)...
1ca15ed3-8f5b-451b-857e-680c023d8589
8
@Override public IStatementObject deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject obj = json.getAsJsonObject(); Class<?> klass = null; try { if (obj.has(OBJECT_TYPE)) { String objectType = obj.get(OBJECT_TYPE).getAsJsonPrimitiv...
21454fde-3d73-43d1-8c0e-a74e8ad0d61e
8
public void giveItems() { Client o = (Client) Server.playerHandler.players[c.tradeWith]; if(o == null) { return; } try{ for(GameItem item : o.getTradeAndDuel().offeredItems){ if (item.id > 0) { c.getItems().addItem(item.id, item.amount); } } c.getPA().removeAllWindows(); c.tr...
d88995c3-dc86-4376-9a2b-b0ecf6398b3a
2
public DirectScrollPanelArea checkAndConvertToArea(Point where) { DirectScrollPanelArea area; if (mContentBounds.contains(where)) { area = DirectScrollPanelArea.CONTENT; } else { if (mHeaderBounds.contains(where)) { area = DirectScrollPanelArea.HEADER; } else { area = DirectScrollPanelArea.NONE; ...
8ffc5d41-2f60-4c40-93c9-e1e160be20ff
7
@SuppressWarnings("serial") private void vali() throws NoSuchAlgorithmException, IOException { List<String> list = new ArrayList<String>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmmss"); final String token = mainForm.getInputToken().getText(); final String timestamp = sdf.format(new Date(...
94ea5f16-c446-431a-bc16-bd37f93c2c7a
9
private void stopAllMunitions() { for (EnemyLauncher el : enemyLauncherArr) { try { if (el.getCurrentMissile() != null) { el.getCurrentMissile().join(); } el.stopRunning(); el.interrupt(); el.join(); } catch (InterruptedException e) { e.printStackTrace(); } } for (Launc...
cd3b629b-5476-4ae8-b515-380fbed1cea2
5
public void userCraft(long id, String recipeId) { User user = getUser(id); Recipe recipe = getRecipe(recipeId); List<ItemTemplate> ingredients = recipe.getIngredients(); List<String> ingrNames = new ArrayList<String>(); for (ItemTemplate item : ingredients) { ingrNam...
303d99f4-4b06-4518-b2ef-3280a028e2d3
2
public void testGetFieldType() throws Throwable { MockPartial mock = new MockPartial(); assertEquals(DateTimeFieldType.year(), mock.getFieldType(0)); assertEquals(DateTimeFieldType.monthOfYear(), mock.getFieldType(1)); try { mock.getFieldType(-1); fail();...
1f115b5c-6257-4c24-87a6-2ccfef55c896
9
public List<Contact> getContact(Contact c) { List<Contact> list = new ArrayList<Contact>(); for(Contact contact : plateforme) { if(!c.getNom().isEmpty()) { if(c.getNom().equalsIgnoreCase(contact.getNom())) list.add(contact); } if(!c.getPrenom().isEmpty()) { if(c.getPrenom().equalsIgnor...
232e42e8-fb40-423a-83e2-ae885fb4065a
7
public void parsedAimAvailable(AimParseEvent event) { AimParser aimParser = (AimParser)event.getSource(); String tumorID = aimParser.getTumorID(); String tumorName = aimParser.getTumorName(); Tumor tumor = new Tumor(tumorID, tumorName); String raterID = aimParser.getRaterID(); String raterNam...
76e39081-8542-40b8-9a7a-19e24e3490b0
2
public void fullReset(){ int i; gold = 0; for(i = 0; i < backpack.length; i++){ backpack[i] = null; } for(i = 0; i < equipment.length; i++){ equipment[i] = null; } }
fe833bc0-304d-4ac8-bca2-2a5edc6f5a1b
4
private void waitForConnection() { // retrieve the local Bluetooth device object LocalDevice local = null; StreamConnectionNotifier notifier; StreamConnection connection = null; // setup the server to listen for connection try { local = LocalDevice.getLocalDevice(); local.setDiscoverable(Discove...
8730cf99-ea44-4a12-8094-fd857e12b819
0
public void setDateEmbauche(String dateEmbauche) { this.dateEmbauche = dateEmbauche; }
aeb12791-a94e-4056-a20f-518de1597d5e
6
@Transactional @RequestMapping(value = {"/app/saveIssue"}, method = RequestMethod.POST) public ModelAndView saveIssue(HttpServletRequest request, @RequestParam(required = false) Long id, @RequestParam String title, ...
0c2c1d53-50ca-46f1-9c80-8726df3950d2
1
private void preserveRemainingInboundData() { if (mInboundData.hasRemaining()) { mUnderflowData = ByteBuffer.allocate(mInboundData.remaining()); mUnderflowData.put(mInboundData); mUnderflowData.flip(); } }
7e7db99f-2042-4ca9-ba4c-bd4969f068be
8
private void handlePublicQueue() { HospitalPart hp = HospitalPart.PUBLIC; Sector sec = sectors.get(hp); LinkedBlockingDeque<Patient> q = doc_queues.get(hp); if (sec.hasBusyDoc()) { int[] tmp = sec.getFinishTimes(); for (int i = 0; i < sec.getDocCount(); i++) { if (tmp[i] == clock) { Patient p =...
db485f4e-42f0-4bf0-a530-08355617a45c
5
public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("Number of strings to follow:"); int numberOfStringsToFollow = s.nextInt(); s.nextLine(); String[] strings = new String[numberOfStringsToFollow]; int maxStringLength = 0; for...
c023e2fd-1fe9-446d-9cbe-511c4d6bff41
3
public int inCityDefenseBonus(Hero hero) { if (buildings.contains(CastleBuilding.CASTLE)) { return 12; } else if (buildings.contains(CastleBuilding.CITADEL)) { return 8; } else if (buildings.contains(CastleBuilding.FORT)) { return 4; } return 0; }
7f7003f8-2d8d-4720-8551-a523886dd926
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof DatasetAttribute)) { return false; } DatasetAttribute other = (DatasetAttribute) object; if ((this.datasetAttri...
5b1d3543-7881-4478-8876-69721bb2705e
9
static public CTTrajectory<Double> cutTrajectory(CTTrajectory<Double> trj, double cutPercentage) //? TODO test throws IllegalArgumentException { if( trj == null) throw new IllegalArgumentException("Error: null trajectory"); if( trj.getTransitionsNumber() == 0) throw new IllegalArgumentException("Error: em...
53f2c7a5-8bc7-41a9-beee-b3784da613e8
4
private void initGUI() { int position; this.setLayout( new BorderLayout() ); this.setOpaque( false ); // attributes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ panelInven = new JPanel( new GridLayout( 4, 10 ) ); panelInven.setBorder( GUI.setupAreaBorder( "Inventory" ) ); ...
1790e6fe-de9a-4637-9d88-d27bfea002c2
6
@Override public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { metronome.update(container, delta); player.update(container, delta); if (metronome.isNewBeat()) { processBeat(container); } prompts.update(container, delta); for (GameObject o : gameObj...
529ea09b-8926-4c39-9800-dd3f86615acf
4
private boolean isBorderBiomes(Tile tile, Point[] surrPoints) { boolean out = false; for (Point p : surrPoints) { Tile t = MyzoGEN.getOutput().getTile(p); if (t != null && t.tile != tile.tile && Tiles.getPrecedence(t.tile) > Tiles.getPrecedence(tile.tile)) { out = true; break; } } return out; ...
66e0101c-0ef8-4245-b0e1-c6aceef2d07b
9
public Instance(String[] args) throws FatalError, IOException { // configure plans PlanBoeseBeute.initiate(); PlanBoeseKrieg.initiate(); PlanBoeseRespekt.initiate(); PlanAngriff.initiate(); // reset config new Config(); // reset user new User(); this.parseArguments(args); if (this.modus.equal...
448b6664-8e1c-4db3-a3ff-29e8df188715
4
public static char[] build_keyed_alphabet(String k) { char[] result=new char[26]; String k_u=k.toUpperCase(); boolean[] filled=new boolean[26]; int pos=0; for(int i=0;i<k_u.length();i++) { char cur_c=k_u.charAt(i); int char_pos=cur_c-'A'; if(filled[char_pos]) { continue; } result[pos]...
42d1aae6-cc61-4382-8090-4f4caff0f15e
2
public void lengthReturn() { if (length != FRAME_HEIGHT / 5) { duration++; if (duration == 1000) { length = FRAME_HEIGHT / 5; duration = 0; } } }
99cf03e6-acd3-407d-9cae-dea67a9d326e
3
protected static byte[] getCertificateBytes() { if (certificateBytes == null) { InputStream certifacteStream = getCertificateStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[4096]; try { int bytesRead = 0; while ((bytesRea...
f1a5fac0-e1ab-4883-a7ad-03bce9893e3e
9
void select_imagesource(String direction) { if (this.image_file != null) { File file = null; File folder = image_file.getParentFile(); File[] listOfFiles = folder.listFiles(); HashMap<String, File> imageFiles = new HashMap<String, File>(); for (int i = 0; i < listOfFiles.length; i++) { file = list...
f25d9c46-fac2-4322-9589-4afe18b5fe35
8
public void reduce(Text key, Iterator<Text> values, OutputCollector<Text, Text> output, Reporter reporter) throws IOException { List<String> incidents = new ArrayList<String>(); //compile the individual incident dates into a list while (values.hasNext()) { incidents.add(values.next().toString()); } i...
3250d020-e8e1-40ab-bbab-16baf8de7217
4
private void addSong() //tilføjer en sang { clear(); System.out.println("Add Song:"); System.out.println(); try { Scanner sc = new Scanner(System.in, "ISO-8859-1"); System.out.print("Title: "); String title = sc.nextLine(); ...
7bfaef7f-21db-4773-bd6f-62aab0be3e0e
8
public static void main(String[] args) throws IOException { // System.out.println( // Thread.currentThread().getContextClassLoader().getResource("")); // System.out.println(FileUtil.class.getClassLoader().getResource("")); // System.out.println(ClassLoader.getSystemResource("")); // ...
ae20a944-dee2-4049-a949-58766689f5a0
3
protected String InferLangFromCookie(HttpServletRequest httpRequest) { // Try to locate a cookie that states the user's language preference. // Calling applications should use this name when setting the cookie. // Cookie name: "language-preference" // Permissible values: "fr" or "en" t...
900ebcfd-c8d0-460c-8e59-2d0bcae85ed2
2
public DisplayObject addChildAt(DisplayObject child, int index) { DisplayObjectImpl impl = ((ContainerImpl) overlay).addChildAt(child.getOverlay(), index); if (impl != null) { children.add(index, child); } return (impl != null ? child : null); }
c6c9faf9-c3b3-4cdb-af90-ccffcb86a440
7
@Override public void start(ExecutorTask executorTask) { if(ImageManager.imagesFinder.getRandomFilename(WaterMarkModel.isJpgTreatment(),WaterMarkModel.isPngTreatment(),WaterMarkModel.isGifTreatment()) == null){ return; } Rectangle panelRect=ArtiMarkFrame.panelWatermarkVie...
3bccbe6d-dd70-4cf6-8dc1-acac1f432b0f
7
public double mageDefTest() { double defenceBonus = c.playerBonus[8] == 0 ? 1 : c.playerBonus[8]; if(defenceBonus < 50)//1 defenceBonus = 50;//1 double defenceCalc = defenceBonus * c.playerLevel[1]; if (c.prayerActive[0]) defenceCalc *= 1.05; else if (c.prayerActive[3]) ...
c8351b97-ddf6-400b-8af9-f60257b7d65e
2
public void testPropertySetMonth() { YearMonth test = new YearMonth(1972, 6); YearMonth copy = test.monthOfYear().setCopy(12); check(test, 1972, 6); check(copy, 1972, 12); try { test.monthOfYear().setCopy(13); fail(); } catch (IllegalArgum...
9e68dfcf-dec3-4a6e-b6fa-2ebab144f4f9
6
public byte[] scanForSpeech(byte[] dataBuffer) { ByteArrayOutputStream speechData = new ByteArrayOutputStream(); boolean isSpeech = false; int tailIndex = 0; for (int headIndex = 9; headIndex < dataBuffer.length; headIndex= headIndex+10) { // process this segment byte[] currentBuffer = Arrays.copyOfRange(...
8a346ea2-b83f-42c1-b05f-a760b21f1964
8
String[] countWords(String sentence, int returnWordCount) { // check input parameter if (sentence == null || sentence.isEmpty()) { System.out.println("Sentence not defined"); return null; } // check input parameter if (returnWordCount <= 0) { System.out.println("Return Words must be greater tha...
a3d32cef-c3fd-45e9-98d8-8cd6a77225ee
1
public static List<Throwable> getVerificationFailures() { List<Throwable> verificationFailures = verificationFailuresMap.get(Reporter.getCurrentTestResult()); return verificationFailures == null ? new ArrayList<Throwable>() : verificationFailures; }
597fc33d-1eb3-458d-b0df-f7844cc99903
2
public double calculatePlatformAndOtherConsuptionsW(SoftwareSystem system) { double consumption = 0; for (HardwareSetAlternative hardwareSetAlternative : system.getHardwareSystem().getHardwareSetAlternatives()) if (system.getActuallyUsedHardwareSets().contains(hardwareSetAlternative.getHardwareSet())) { doub...
cfebb306-8560-48c8-81bd-a2fb21427012
4
public void send(Object oo){ try { if(this.running){ out.writeObject(oo); out.flush(); } } catch (IOException e) { e.printStackTrace(); } }
6ad10a81-b083-4320-b1b0-8a1ec3b562fe
1
public List<Class<? extends Peuple>> getPeuplesPris() { return peuplesPris; }
06e6ba23-ee67-45ef-9851-e793413fb4b9
0
public TurnOff(){ super(Color.OFF); }
f06951a5-ad1d-47d3-922d-3012578c6b7d
5
private boolean connectWithServer() { //Hacemos una comprobacion rápida de la ip. JLabel label = autConnectPane.isVisible() ? autInfo : connInfo; label.setText("Comprobando..."); if (URI.isWellFormedAddress(serverIP.getText())) { try { //Comprobamos que la di...
101ebd37-e5ed-431d-9e6f-b0278cad011d
0
public static void main(String args[]) { String encryptedPassword = encrypt("user"); System.out.println("The encrypted password for user is - " + encryptedPassword); }
431eb390-fccb-4e6d-9ae8-bea3bb9ad3e9
0
public FromIterator(Iterable<T> source, Selector<T, Iterable<T2>> selector) { this._source = source.iterator(); this._selector = selector; }
8a1d80d1-07b7-4ee1-be54-1a8db897a8b4
4
public void create(Args args) throws IOException { //根据autoCodeConfig中的配置,调用coder生成代码 AutoCodeConfig config = AutoCodeConfig.loadConfig(args); if(args.getOptions() == null || args.getOptions().size() <= 0){ throw new RuntimeException("options is empty"); } if(args.g...
d54108c7-3c69-4711-96eb-48b128206ea8
8
private void VM_Parse(Element vms) { vect_vms = new ArrayList(); ArrayList<String> atts = new ArrayList<>(Arrays.asList("mips","cpu","ram", "bw", "size", "vmm")); List liste_vm = vms.getChildren(); int nb_vm = liste_vm.size(); System.out.println("There is"+ nb_vm + " VM(s)" )...
098aa5fc-18fe-4174-b685-8d46246ef724
1
public void testDateConverter() { System.out.println("** testDateConverter **"); final int year = 2008; final int dayOfMonth = 22; final int hour = 7; final int minute = 3; final CycNaut cycDate = new CycNaut(DateConverter.MINUTE_FN, minute, new CycNaut(DateConverter.HOUR_FN, hour, ...
4a6fa31d-9cce-4dc4-b47d-d51cbb56b709
2
public void volcarDatos(ArrayList<Usuarios> libros){ DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); while(model.getRowCount()>0)model.removeRow(0); for(Usuarios u : libros){ Object[] fila = { u.getCodigo(), u.getNombre(), ...
d0899f40-c17d-42d8-ad75-5a609b93a524
9
public int DondeJugar() { if (MesaIsNull()) { return 1; } else { if ((Mesa.getAux().info.C1 == Ftemp.C1 || Mesa.getAux().info.C1 == Ftemp.C2) && (Mesa.getAux().info.C2 == Ftemp.C1 || Mesa.getAux().info.C2 == Ftemp.C2)) { return 0; } else { ...
7d3b4319-d2c9-4f38-8562-fb4ea8a4de6a
7
public void clearKeys(Class c) { if (modelManager.frame == null) return; Atom[] atoms = modelManager.frame.atoms; for (int i = 0; i < modelManager.frame.atomCount; i++) { if (SiteAnnotation.class == c) atoms[i].annotationKey = false; else if (InteractionCenter.class == c) atoms[i].interactionKey ...
38be9a5c-8d04-4a9e-876e-c699c1d35f4c
0
public void setColor(String color) { this.color = color; }
0ae6abb1-0299-425b-ae6b-abd74988207c
2
public void deal() { if (deck.getDeck().size() >= 4) { deck.deal(player); deck.deal(dealer); dealer.getHand().get(0).flip(); dealer.refreshImage(); info.update(deck); dealButton.setEnabled(false); hitButton.setEnabled(true); standButton.setEnabled(true); if (player.getMoney() >= bet) do...
fe4e6ea3-7371-41e8-9494-6e1fc1b4b5bf
8
static public String openOrder( int orderId, Contract contract, Order order, OrderState orderState) { String msg = "open order: orderId=" + orderId + " action=" + order.m_action + " quantity=" + order.m_totalQuantity + " symbol=" + contract.m_symbol + " exchange=" + contract.m_ex...
5a4fb5ef-89f4-4beb-81bb-25dc67c0fdff
9
boolean formula(){ char ch = get(); if(ch=='('){ boolean f1 = formula(); ch = get(); if(ch=='*'){ boolean f2 = formula(); get(); return f1&&f2; } else if(ch=='+'){ boolean f2 = formula(); get(); return f1||f2; } else{ get(); boolean f2 = formula(); get(); ...
1b715d60-cf39-472e-8d24-935add8d64bf
9
public Location getAdjacentLocation(int direction) { // reduce mod 360 and round to closest multiple of 45 int adjustedDirection = (direction + HALF_RIGHT / 2) % FULL_CIRCLE; if (adjustedDirection < 0) adjustedDirection += FULL_CIRCLE; adjustedDirection = (adjustedDirection / HALF_RIGHT) * HALF_RIGHT; int...
424b036c-fa93-4736-8797-ef18d7e26de6
6
public boolean trainCanMove() { if (train.size() == 0) return true; else { int totalWeight = 0; for (int i = 0; i < train.size(); i++) { switch (train.get(i).getClass().getSimpleName()) { case LOCOMOTIVE: totalWeight += ((Locomotive) train.get(i)).getGrossWeight(); break; case PASSEN...
01c81393-8eab-4f5d-82a6-f6c6cda90fb0
4
private static File[] createFileArray(BufferedReader bReader, PrintStream out) { try { java.util.List list = new java.util.ArrayList(); java.lang.String line = null; while ((line = bReader.readLine()) != null) { try { // kde seems to append a 0 char to the end of the reader if (ZERO_CHAR_STR...
0d2dfa2a-2f95-4c3a-bb06-774626b0c2e6
2
public TreeNode sortedArrayToBSTRec(int[] num, int s, int e){ if(s > e) return null; if(s == e) { return new TreeNode(num[s]); } int mid = (s+e) >> 1; TreeNode t1 = sortedArrayToBSTRec(num, s, mid - 1); TreeNode t2 = sortedArrayToBSTRec(num, mid + 1, e); ...
7486c2bd-25e3-4a99-99b2-40f8488f5867
1
public static Battlefield create(){ if(battleField == null ){ battleField = new Battlefield(); } return battleField; }
1f27ca6a-5f39-492c-a49d-84bc2656089b
2
public static void cartesianToPolar(Graph graph, ArrayList vertices) { double theta, r; Point2D cartesian; for (int i=0; i<vertices.size(); i++) { cartesian = graph.pointForVertex(vertices.get(i)); if (cartesian.getY() != 0) theta = Math.atan(cartesian.getY() / cartesian.getX()); else theta = Mat...
9a238096-0c00-44f5-a4d5-9e7e6f2173d9
9
@Override public long readVLong() { byte b = bytes[pos++]; if (b >= 0) return b; long i = b & 0x7FL; b = bytes[pos++]; i |= (b & 0x7FL) << 7; if (b >= 0) return i; b = bytes[pos++]; i |= (b & 0x7FL) << 14; if (b >= 0) return i; b = bytes[pos++]; i |= (b & 0x7FL) << 21; ...
1d13b1cc-9771-450e-97cb-8ae7190fd03e
3
public DisplayMode findFirstCompatibleMode( DisplayMode modes[]) { DisplayMode goodModes[] = device.getDisplayModes(); for (int i = 0; i < modes.length; i++) { for (int j = 0; j < goodModes.length; j++) { if (displayModesMatch(modes[i], goodModes[j])) { ...
cf2f6103-7cca-4edd-a0a2-a3188aceb8e3
2
public static int getMax(int intArr[], int len){ int max = intArr[0]; for (int i=1; i<len; i++){ if (intArr[i]>max) max = intArr[i]; } return max; }
1b1edc10-8d0a-43f4-bbba-35040fb4f5af
3
public void actionPerformed( ActionEvent evento ) { String comando = evento.getActionCommand( ); if( BOTON_INICIAR.equals( comando ) ) { ventanaPrincipal.iniciar( ); } else if( BOTON_STEP.equals( comando ) ) { ventanaPrincipal.avanzar...
946b9663-92df-46b6-97f0-060ac235425c
1
public void delete() throws SQLException { if(this.isNew()) { return; } PreparedStatement statement = connect.prepareStatement(" delete from `" + tableName + "` where `id` = " + id ); statement.executeUpdate(); this.id = 0; }
8a9cd2cd-ea82-4873-8fad-b89b78c8d765
3
private double[] initProbability() { double[] prob = new double[langlist.size()]; if (priorMap != null) { for(int i=0;i<prob.length;++i) prob[i] = priorMap[i]; } else { for(int i=0;i<prob.length;++i) prob[i] = 1.0 / langlist.size(); } return prob; }
99fa3fa3-8064-4984-b19f-17e27f624831
5
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof LightNode)) { return false; } LightNode other = (LightNode) obj; if (!color.equals(other.color)) { return false; } if (Float.floatToIntBits(i...
6bf7baef-4f8e-492c-a84d-53995cc9c29d
0
@Test public void determineHighestFlush_ifFourOfSameSuit_returnNull() { assertNull(getAllFlushCards(fourFlushWithStraight())); }