method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5c4607dc-232a-4528-b480-e8da96cf6ece
6
private static void repl(Environment env, TurtleGraphics t) { System.out.println(version); System.out.println("type 'exit' to quit."); System.out.println(); Scanner in = new Scanner(System.in); while(true) { System.out.print(">"); try { String line = in.nextLine(); if ("exit".equals(line)) { br...
d3736860-5232-4d67-808a-c783c527e4c9
2
public static String compress (String str) { char pre = str.charAt( 0 ); int count = 1; char cur = ' '; StringBuffer sb = new StringBuffer(); for (int i = 1; i < str.length(); ++i ) { cur = str.charAt(i) ; if ( cur == pre ) { ++count; }else { sb.append( pre ); sb.ap...
aea4011b-14ec-4b77-bc0c-ce1d7d97ed57
1
public Guid readLegacyGuid() throws IOException { Guid guid = CycObjectFactory.makeGuid((String) readObject()); if (trace == API_TRACE_DETAILED) { debugNote("readLegacyGuid: " + guid); } return guid; }
69066250-aa2c-4b25-a797-d709a8a0c366
9
private void writeColorzz(int col, String dest) { try { OutputStream out = new BufferedOutputStream(new FileOutputStream(dest), 8096); int i = 0; int i2 = 0; int step = 0; int ii = 0; while (i2 < biHeight) { out.write(image.getVal(i, i2, col)); i...
7840aec5-35da-463f-b23b-1ca2ea2827d8
6
public static Object getProperty(Object obj, String propertyName) { if (obj == null) return null; try { BeanInfo info = Introspector.getBeanInfo(obj.getClass()); PropertyDescriptor[] descriptors = info.getPropertyDescriptors(); for (int i = 0; ...
93b9117e-32b2-4ef8-bce0-ba365f5f749d
9
private boolean r_t_plural() { int among_var; int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; // (, line 160 // setlimit, line 161 v_1 = limit - cursor; ...
316925d8-db3f-44b0-becf-05cae704a731
4
public static void selectionSort (int[] array) { for (int barrier = 0; barrier < array.length - 1; barrier++) { int elem = array[barrier]; //обращению к элементу масива медленнее, чем к локальной перменной. не нужно делать проверок на границы массива int aIndex = barrier+1; ...
623331ca-498a-41bd-8ff1-1b4f81bf671b
8
@Override public void run () { byte buffer[] = new byte[4096]; String logBuffer = ""; int newLineIndex; int nullIndex; try { while (is.read(buffer) > 0) { logBuffer += new String(buffer).replace("\r\n", "\n"); nullIndex = logBuffer....
9bbe35e5-a018-4143-a1d5-76bacaf840bb
4
public UsuariHex carregaUsuari( String nom, String contrasenya, TipusJugadors tipus_jugador ) throws IllegalArgumentException, FileNotFoundException, IOException, ClassNotFoundException, NullPointerException { if ( !UsuariHexGstr.getInstancia().existeixElement( getIdentificadorUnic( nom ) ) ) { thr...
fec2d02b-ee9e-4973-b15d-7f96635122ef
8
private int closeSpecifications(List<SpecificationDocument> specificationDocuments, boolean checkForEdited) { int closedSpecifications = 0; isClosingDocument = true; boolean canceled = false; Iterator<SpecificationDocument> iterator = specificationDocuments.iterator(); wh...
1aa1f6c3-1542-436f-ac84-89be8acbb16a
2
int findNl(int next, int last) { for (int i = next; i < last; i++) { if (buffer[i] == '\n') return i; } return -1; }
3fa73a92-06e9-4c06-adc2-ffb242ffa8ab
0
public EventsBean getEventbean() { return eventbean; }
4435bc7e-7b7d-4598-847c-b39fca0b6b0e
2
private Browser(Manufacturer manufacturer, Browser parent, int versionId, String name, String[] aliases, String[] exclude, BrowserType browserType, RenderingEngine renderingEngine, String versionRegexString) { this.id = (short) ( ( manufacturer.getId() << 8) + (byte) versionId); this.name = name; this.parent = p...
0cd38a4f-808a-4d08-a289-f66172944746
8
double[] MSDFromList(My3DData data3d, int l, boolean do3D) { double MSDs[] =new double[(int) Math.sqrt(NumMarkers(l)+1)]; double MSDNums[] =new double[(int) Math.sqrt(NumMarkers(l)+1)]; APoint point,point2; double SumDist2; int adT; // deltaTime but in unit steps for (int i=0;i<NumMarkers(l);i++) { for...
dda65cac-377d-4c88-a0ff-ca532ab13f7c
6
@Override public double read() { time += 1.0 / 44100; if (!running) { amplitude = (amplitude>0 ?(amplitude - (level) / (release * 44100)) : 0); } else if (time <= attack) { amplitude += peek / (attack * 44100); } else if (time > attack && time <= attack + decay) { amplitude += (level - peek) / (decay ...
bc594474-0e65-4619-afa2-522c03dc3eb3
5
public int argOfInterestOfZ(MessageContent z) { // we look for the argmax if (debug>=3) { String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName(); String dclass = Thread.currentThread().getStackTrace()[2].getClassName(); System.out.print...
f50ec239-8531-4208-b574-bd6a8552594b
0
public RegExMultiReplacementFileContentsHandler(String[] regexes, String lineEnding) { super(lineEnding); setRegExes(regexes); }
c76747a0-0d28-4fbc-b9c3-7753d076e7ea
7
@SuppressWarnings("unchecked") private int reloadRegisteredItems(){ int i = 0; Validator validator = new Validator(); for (String itemName : registeredItems){ if (validator.verifyRegisteredItem(instance, items, recipes, itemName)){ CustomID customId = new CustomID(items.getString(Util.concatStrings(Consta...
a35dea56-0f19-4454-9eac-633211826955
1
private void drawRestOfJPanelDisplay(Graphics g) { int numberLeftInPack = cardStack.size(); if (numberLeftInPack > 0) { aFaceDownCard.drawCard(g, this); drawNumberInsideCardArea(g, aFaceDownCard); } drawGameInformation(g); }
403a402b-b271-4ce7-bb61-8f797d59275c
0
@Override public void setIdleTimeout(long idleTimeout) { this.idleTimeout = idleTimeout; }
79bce53c-0170-419c-a5c8-212eb2fb56ed
7
@Override public void act(Table table) { StringBuffer message = new StringBuffer(); message.append(table.tableRepresentation()); message.append("\n\nWhat would you like to do? Please input \"h\" for Hit or \"s\" for Stand..."); // get input from user String input; do { input = (String) BlackjackGame.ge...
98b92d01-c2ef-4f1d-8e42-a9e4df1a1033
3
@Override public boolean equals(Object o) { if (o == this) { return true; } else if (o instanceof SQLQuery) { SQLQuery oo = (SQLQuery)o; return oo.builder.equals(this.builder) && oo.parameters.equals(this.parameters); } else { return false; } }
c979ef07-c417-4abe-8c57-a38a52615ed2
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...
20d0c541-f085-4929-838c-25f475081b86
8
public List<Integer> addCycle(int leftX, int leftY, int rightX, int rightY, int[][] matrix) { List<Integer> result = new LinkedList<Integer>(); if (leftX == rightX && leftY == rightY) { result.add(matrix[leftX][leftY]); return result; } for (int i = leftY; i <= rightY; i++) { result.add(matrix[left...
b48e4cfd-4d10-4241-a207-444f08f98371
3
public Tilbakemelding opprettBruker(PreparedStatement setning, ResultSet res, Connection forbindelse, String brukernavn, String passord) { Tilbakemelding returverdi = Tilbakemelding.nyBrukerIkkeOk; try { getBrukerData(); setning = forbindelse.prepareStatement("select brukernavn f...
dbb0dbac-cf1d-48f7-9f2b-1850bd4e0c83
1
public void setBtn_Std_Fontsize(int fontsize) { if (fontsize <= 0) { this.buttonStdFontSize = UIFontInits.STDBUTTON.getSize(); } else { this.buttonStdFontSize = fontsize; } somethingChanged(); }
c2b50658-5477-4085-b3a8-2bafc13e53c7
5
public void keepOnlyDuplexes() { for (int i = 0; i < parent.tracks.size(); i++) { for (int j = 0; j < parent.tracks.get(i).matches.length; j++) { if (parent.tracks.get(i).matches[j] != 0) { Track target = getTrackById(j); if (target == null) { parent.tracks.get(i).setMatch(j, 0); } else if...
fed3602f-f9e1-401d-84e6-84aecaf3b79e
7
private void add(Automaton newOne, Automaton other) { AutomatonDrawer d1 = new AutomatonDrawer(newOne), d2 = new AutomatonDrawer( other); Rectangle2D bounds1 = d1.getBounds(), bounds2 = d2.getBounds(); if (bounds1 == null) bounds1 = new Rectangle2D.Float(); if (bounds2 == null) bounds2 = new Rectangle...
ee53a1cd-d137-436f-a1e2-2eb521eb08c4
3
private void fill() { switch (difficulty) { case "E": readBoards(1); break; case "M": readBoards(2); break; case "H": readBoards(3); break; // case "A": // ...
a68908c1-f75d-4a09-8d41-b28d2d581323
2
public CompoundGenerator(QuestionGenerator... generators) { if (generators == null || generators.length == 0) { throw new IllegalArgumentException("No generators."); } Collections.addAll(this.generators, generators); }
1d4fa42c-b62c-4090-9c20-e2848e905a16
3
protected void populate(Annotation[] annotations, String className) { if (annotations == null) return; Set<String> classAnnotations = classIndex.get(className); for (Annotation ann : annotations) { Set<String> classes = annotationIndex.get(ann.getTypeName()); if (classes == ...
24a28b99-10d6-4927-908a-bf7d1dec746e
1
private void carregaFormasPagamento(){ FormasPagamentoDAO dao = new FormasPagamentoDAO(); listaFromasPagamento = dao.ListarTodos(); cbxTipoPagamento.removeAllItems(); for(FormasPagamento f : listaFromasPagamento){ cbxTipoPagamento.addItem(f); } ...
df61888b-4568-4771-8fa5-28f2c97e9434
8
public String getRecommendListForAdamicAdar() { String recommend = ""; try { Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager.getConnection("jdbc:mysql://localhost/NETWORK_TEST?" + "user=root&password=root"); connect.setAutoCommit(false); statement = connect.createStatemen...
fcca3883-5a81-4ddb-933a-c51c438e5210
6
public static void printGist(int[] arr) { int[][] res = toPrintable(arr); int maxDigits = maxDigits(arr); for (int i = 0; i < res.length; i++) { for (int j = 0; j < res[i].length; j++) switch (res[i][j]) { case WALL: wall();...
1f2f8e94-c7b4-4587-b21f-cf974c7b335f
0
protected Farm() {}
3dbfdb3b-f902-4a9a-9001-7191d2ad654a
8
public static void main(String[] args) { Connection conn = null; PreparedStatement ps = null; ResultSet reSet = null; /* 开源数据连接池 */ // BasicDataSource dataSource = new BasicDataSource(); // dataSource.setDriverClassName("com.mysql.jdbc.Driver"); // dataSource.setUrl("jdbc:mysql://localhost/test"); // d...
f7b4896d-4444-4707-892f-bbcfac36b56b
5
public static String get(String propertyName) { if (prop == null || prop.getProperty(propertyName) == null) { try { loadProperties(propertyFilePath); } catch (IOException e) { try { propertyFilePath = ".." + File.separator + propertyFilePath; loadProperties(propertyFilePath); ...
8b9d02dc-11b9-4568-86cd-32f1eba8495f
9
@Override public void run() { boolean shutdown = false; try (Socket socket = this.socket) { Request request = getRequest(); WebResponse response = new WebResponse(); if (request == null) { WebLogger.log("request = null"); response.setError(Response.STATUS_BAD_REQUEST, "request == null"); } else...
7647b32d-9852-42dc-aa05-27c629fd83fd
8
public void displayPoint(GeoPoint gp) throws IOException { double marginBuffer = 0.2; double sx = (Math.abs(gp.longitude - params.longMin) / (1 + marginBuffer) * windowFactor + pWidth * marginBuffer / 2); double sy = pHeight - (Math.abs(gp.latitude - params.latMin) / (1 + marginBuffer) * wi...
734ed7a5-8753-4bd9-b696-45ebafc61912
0
@Test public void test_removePawn(){ assertNotNull(board); board.removeAllPawns(); numberOfPawns=0; assertEquals(numberOfPawns, board.numberOfPawns()); Pawn pawn1 = new Pawn('l', 3,4, board); Pawn pawn2 = new Pawn('m', 2,3, board); board.addPawn(pawn1); ...
a11ec67d-8c26-4230-825a-d545ea46da71
2
@Override public void itemStateChanged(ItemEvent event) { if (event.getStateChange() == ItemEvent.SELECTED) { if (event.getItemSelectable().equals(supplierComboBox)) { fillUpProductComboBox(); refreshTab(productComboBox.getSelectedIndex()); } } }
a238ba6d-4b01-4eae-b0da-c0053d2b1a37
4
public void addBlockDestroyEffects(int var1, int var2, int var3, int var4, int var5) { if(var4 != 0) { Block var6 = Block.blocksList[var4]; byte var7 = 4; for(int var8 = 0; var8 < var7; ++var8) { for(int var9 = 0; var9 < var7; ++var9) { for(int var10 = 0; var...
c12beffb-8973-4654-a863-de7872ade594
5
public static void insertAdress(Adress a){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedS...
62237305-848e-4de7-b336-484ad74331dd
4
public PluginUpdate getUpdate(String userKey) { PluginUpdate update = null; try { userKey = userKey == null ? "" : userKey; String url = this.urlManager.getUpdate(Constants.APP_KEY, userKey, Utils.getPluginVersion().toString(true)); JSONObject jo = getJson(Methods.PO...
98e51aea-6be3-488c-b6b8-0d15dea66622
4
public static void main( String [ ] args ) { int numElements = 128; int numInSameSet = 16; DisjointSetsSlow ds = new DisjointSetsSlow( numElements ); int set1, set2; for( int k = 1; k < numInSameSet; k *= 2 ) { for( int j = 0; j + k < numElements; j += 2 * k ) { ...
7982cd80-2c28-4585-948e-9bc28ef74f3e
6
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equals...
c152924c-3cc5-45b1-911c-ff2dfc83f4dc
6
@EventHandler(priority = EventPriority.HIGHEST) public void onSignChange(SignChangeEvent event) { Block block = event.getBlock(); if(block.getState() instanceof Sign) { int line = CustomFunction.findKey(event.getLines()); if(line == -1) return; if(event.getLine(line).equalsIgnoreCase("["+ Conf...
cf942312-eb8c-4657-8e36-1b8e8ad80f21
2
public int getPortalAt(final Location check){ if(check.getBlock().equals(one.getBlock())) return 1; else if(check.getBlock().equals(one.getBlock())) return 2; return 0; }
f050e24a-f475-4462-ae63-527b0cfeb498
0
private OthelloBoardBinary(){}
43392687-e5ea-4804-a172-fdcaba5e4980
0
public String getTitle() { return title; }
b3a3c3ae-b279-48fa-9125-4cbf4876ced8
9
private void defineMonitor () { GraphicsDevice GDev = InfoLauncher.instance().getLocation().getGDev()[ InfoLauncher.instance().getLocation().getGDevice() ]; System.out.println( InfoLauncher.instance().getLocation().getGDevice() ); Dimension screenEnd = new Dimension( GDev.getDisplayMode().g...
7518e58e-fae9-4a00-9d73-3d0507e02ca7
9
@Override public void run() throws IOException { int in = 0; draw(); m_IO.flush(); do { // get next key in = m_IO.read(); switch (in) { case BasicTerminalIO.LEFT: case BasicTerminalIO.UP: if (!sel...
e6124ea1-f39c-4606-8c76-29cb3e4ab38e
8
public static void pprintLiteralWrapper(LiteralWrapper self, org.powerloom.PrintableStringWriter stream) { { Surrogate testValue000 = Stella_Object.safePrimaryType(self); if (Surrogate.subtypeOfBooleanP(testValue000)) { { BooleanWrapper self000 = ((BooleanWrapper)(self)); stream.print(self...
029c3f53-455e-44ab-a6b0-8cbcdf869e5c
8
private void configurePath() { // Configurar carpeta de usuario USER_HOME = System.getProperty("user.home"); //$NON-NLS-1$ // Configurar carpeta de aplicacion File appDir = new File(USER_HOME + "\\TH Solution\\"); //$NON-NLS-1$ if (!appDir.exists() || !appDir.isDirectory()) { boolean result = appDir.mk...
3304c59a-0d83-492e-b0b7-ca2ae362b803
3
public CtConstructor getConstructor(String desc) throws NotFoundException { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); while (cons != consTail) { cons = cons.next(); CtConstruc...
b7b5eb94-dce8-4e61-9f92-fdddd1c003e3
9
public String guardar (){ if("".equals(nombre) || "".equals(carrera) || "".equals(edad) || "".equals(correo) || "".equals(contraseña) || "".equals(carnet) || "".equals(año) || "".equals(telefono) || "".equals(direccion)){ FacesContext.getCurrentInstance().addMessage(null, new FacesMess...
735de8db-ebb7-48ad-bfe3-ef4ffae5b29f
3
public static HashMap<Integer, HashMap<Character, Integer>> initLanguagesMap( String[] frequencies) { HashMap<Integer, HashMap<Character, Integer>> mapOfLanguageFreq = new HashMap<Integer, HashMap<Character, Integer>>(); // Build correct amount of maps for (int i = 0; i < frequencies.length; i++) { mapOfL...
dc696631-e229-4676-b804-3388868a1e7c
6
private void set_agent(String agent, String type) { AgentEnum a = AgentEnum.valueOf(type); switch(a) { case DNSServer: DNSServer dnss = new DNSServer(agent, this.dns_table); this.agents.put(agent, dnss); break; case FTPClient: FTPClient ftpc = new FTPClient(agent); this.agents.put(agent...
bea53ab6-567b-458d-b7e3-297dac85bdb0
0
public double getTotal() { return total; }
ea443589-d496-43fa-a3b9-d672423a9129
8
public static boolean delete (Object bean) { String sql; PreparedStatement stmt=null; try{ if(bean instanceof Patient){ sql = "DELETE FROM patients WHERE pid = ?"; stmt = conn.prepareStatement(sql); return deletePatient((Patient)bean, stmt); } if(bean instanceof Employee){ sql = "DE...
dc1fc2f6-2352-456c-a29c-ff230b519b68
1
public void transform() { changed = true; while (changed) { changed = false; propagate(); } }
e4e46d48-e579-489b-8b1f-3c2cf9661b09
2
private boolean hasNetherPerms(Player playerToCheck) { boolean hasPermission = false; try { if(playerToCheck.hasPermission("modgod.nether")) { hasPermission = true; } } catch(Exception ex) { // player is probably n...
2f6eb928-66e3-4af7-88ac-163cba6ebb62
0
public ItemSetChooser(Grammar grammar, Component parent) { this.grammar = grammar; this.parent = parent; chooseTable = new GrammarTable(new ImmutableGrammarTableModel(grammar)); chooseTable.addMouseListener(GTListener); choiceTable = new GrammarTable(new ImmutableGrammarTableModel()); JScrollPane p = new JS...
18e5ad7a-05b8-4d25-b163-6d538cb6a3f2
6
public static void loadData(File file) throws FileNotFoundException{ if(!file.exists()) throw new FileNotFoundException("Could not find file."); YAMLFile data = new YAMLFile(true); data.Load(file); VirtualAudioCableManager.getManager().frame.getExField().setText( data.getString("exeFolder")); Vir...
b02d4f79-1dcb-4588-82c0-64e9176947db
3
public String getQuantity() { if (quantity==0) { return ""; } else if(quantity%1==0 || quantity == 1){ return ""+(int)quantity; } return String.valueOf(quantity); }
7cb397c2-7464-4751-825f-07419ff02556
6
private boolean isPlaceable(int col, int row) { if (row < 0 || row >= size) throw new IllegalArgumentException( "isPlaceable : row " + row + "parameter out of bounds, must be between 0 and " + size); if (col < 0 || col >= size) throw new IllegalArgumentException( "isPlaceable : col ...
9ed7f555-f181-462c-bfa2-4ef794eacfda
9
public List<Task> sort(final int colIndex, final boolean sortDown) { getTasks(); if(colIndex >= 0 && colIndex <= 6) { Collections.sort(tasks, new Comparator<Task>() { @Override public int compare(Task arg0, Task arg1) { int result = 0; if (colIndex == 1 || colIndex == 2 || co...
2dc3e44f-f1a2-43da-99ef-4cef9822b387
6
public static void main(String[]args){ Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int m = in.nextInt(); int c = in.nextInt(); TreeMap<Integer,TreeSet<Integer>> h = new TreeMap<>(); for (int i = 1 ; i <...
5326c52c-4452-4811-93d3-e249a333c709
1
private void render() { if (texture != null) { texture.bind(); } data.bind(); data.draw(GL11.GL_TRIANGLES, 0, idx); data.unbind(); renderCalls++; }
8a3e9f00-3bb6-4680-a01f-ca7c19990348
1
public void updateRangeListener(String resource, int rangeToAdd) { GameActor actor = actors.get(resource); if(actor == null) { createPrototype(resource); actor = actors.get(resource); } WeaponsComponent wc = (WeaponsComponent)actor.getComponent("WeaponsCo...
f5bb5cc5-bec5-4031-a0bf-0cbffb9c8aa0
4
public static Elements decoder(char s) throws PusherException { switch (s) { case 'x' : return WALL; case '*' : return BOX; case '&' : return GOAL; case '.' : return EMPTY; } throw new PusherException("no such element " + s); }
1938076b-2d5c-4a50-8f31-402ce093064d
0
private HibernateSessionFactory() { }
c20ee78e-8857-4843-82dd-4d1059954b8a
0
public edit() { this.requireLogin = true; this.addParamConstraint("id", ParamCons.INTEGER); this.addParamConstraint("name", true); this.addParamConstraint("capacity", ParamCons.INTEGER, true); this.addRtnCode(405, "permission denied"); this.addRtnCode(406, "venue not found"); this.addRtnCode(201, "alread...
bd1b6400-6b98-49cf-a3bf-b5a4b1ed9084
8
@Override public String toString() { String ret = null; switch(suit){ case CLUBS: ret = "C"; break; case DIAMONDS: ret = "D"; break; case HEARTS: ret = "H"; break; case SPADES: ret = "S"; break; default: //Do nothing. } switch(value){ case 14: ret += "A"; break; c...
3565d03f-a95f-42ff-b1b6-0553053369a1
7
private static void loadData(Library library) throws FileNotFoundException, IOException { BufferedReader in = new BufferedReader(new FileReader("data.csv")); while (in.ready()) { String line = in.readLine(); if (line.startsWith("#")) continue; String...
fca61d8a-79d7-45d2-a292-06fd69a69de6
6
public boolean comprobarEstado() { int numVivas = 0; // numero de vecinas vivas nuevoEstado = estado; for (int i = 0; i < numVecinas; i++) { if (vecina[i].estado) numVivas++; } if (estado) { if (numVivas < 2) // muerte por soledad...
e8ed818f-0520-4d30-a33b-2c484e59c35e
1
public void Initialize() { try { Class.forName(this.dbDriver); } catch (ClassNotFoundException ex) { System.out.println("Impossible d'initialiser le driver.\n" + ex.getMessage()); } }
0a1e6723-cb73-4ab1-ab6b-96e4142dafe8
1
public Button(JButton button) { this.button = button; button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (clickHandler != null) clickHandler.run(); } }); }
e7dd31be-0233-4fc0-b68c-1bbdcd15baad
3
public void findAndRandomizeSpawnpoints(Tile topTile){ Tile currentJTile = topTile; for(int j = 0; j < dimension; j++){ Tile currentKTile = currentJTile; for(int k = 0; k < dimension; k++){ if(currentKTile.tileType == TileType.SPAWN){ freeSpawnpoints.add(currentKTile); } currentKTile = currentKT...
efaa453d-91f7-4374-b2a7-ab15539ffe08
6
public long add(long millis, long value) { int year = iChronology.year().get(millis); int newYear = year + (int)TestGJChronology.div(value, 12); if (year < 0) { if (newYear >= 0) { newYear++; } } else { if (newYear <= 0) { ...
94a1489d-1db5-44d6-a6e8-d2247371185b
0
@RequestMapping(value = "/employee/skillset/{employeeId}", method = RequestMethod.GET) @ResponseBody public String getEmployeeSkillSet(@PathVariable String employeeId) throws JsonGenerationException, JsonMappingException, IOException { ObjectMapper objectMapper = new ObjectMapper(); ObjectNode objectNode = obj...
18721448-57d0-46e2-b206-1e39c3154dcc
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 = getConfigFile(); configuration = YamlConfiguration.load...
dc737f08-b5da-4e52-a3e2-3cb2af4129aa
5
public static void process(Configuration config) { String dirName = config.getInputdir(); MappingTable mt = new MappingTable(config.getMapfile(), config); logger.info("Processing files in " + dirName + "."); // Actually process all the files. Path path = Paths.get(dirName); FileProcessor fp = new FileProcessor(m...
6926ed1a-7114-42b0-8343-6ac107af92db
7
protected Area getParentArea() { if((parentArea!=null)&&(parentArea.get()!=null)) return parentArea.get(); final int x=Name().indexOf('_'); if(x<0) return null; if(!CMath.isNumber(Name().substring(0,x))) return null; final Area parentA = CMLib.map().getArea(Name().substring(x+1)); if((parentA==nul...
f1960f99-5db1-45c2-be1f-4d5f25041c50
0
public Exponential(int mean, Random rnd) { this.mean = mean; this.rnd = rnd; }
c89d2e7f-8d0d-41ca-897d-f658bea96096
8
public void testCheckMinIdleKeyedObjectPoolKeys() throws Exception { try { @SuppressWarnings("unchecked") final KeyedObjectPool<String, Object> pool = createProxy(KeyedObjectPool.class, (List<String>)null); PoolUtils.checkMinIdle(pool, (Collection<String>)null, 1, 1); ...
9a71ae18-1c4c-49a5-ae8a-c0150918ebe9
0
private String getNameTypeObj(String objName) { return objName.substring(nameGameWorld.length()); }
e1f44b27-104f-4958-a162-8eb4d30f36d9
8
public static Proposition findEquatingProposition(Stella_Object directobject, LogicObject indirectobject) { { Stella_Object indirectobjectvalue = Logic.valueOf(indirectobject); Stella_Object backlinkedindirectobject = indirectobjectvalue; if (!Stella_Object.isaP(backlinkedindirectobject, Logic.SGT_LOGI...
f3ebff86-af4c-48de-b606-797c3332bda0
0
public void initGame(World w, int matchNum, int total) { world = w; match = matchNum; totalMatches = total; setXYasVertex(false); //RECOMMENDED: leave this as FALSE. setHeight(HEXSIZE); //Either setHeight or setSize must be run to initialize the hex }
193a3aee-c250-4a31-9449-924c2e0b472c
1
public void testNullValuesToGetInstanceThrowsException() { try { UnsupportedDateTimeField.getInstance(null, null); assertTrue(false); } catch (IllegalArgumentException e) { assertTrue(true); } }
21ed4341-f29d-4c99-b004-bd520f58f584
6
public void run() { if(url != null) { // Obtain the results of the project's file feed if(readFeed()) { if(versionCheck(versionTitle)) { String fileLink = getFile(versionLink); ...
95ea8d15-81c8-40d5-8d05-2c7c714e1da0
7
public static double Levenshtein(String s, String t) { if (s.length() == 0) return t.length(); if (t.length() == 0) return s.length(); int matrix[][] = new int[s.length() + 1][t.length() + 1]; for (int i = 0; i <= s.length(); i++) matrix[i][0] = i; for (int i = 0; i <= t.length(); i++) matrix[0][i...
b677bd75-a039-4be1-85c7-f1b974088e9a
9
public static void main(String[] args) { System.out.printf("Veuillez entrez votre année de naissance : "); Scanner myScan = new Scanner(System.in); int anneeNaissance = myScan.nextInt(); int anneeCourante = Calendar.getInstance().get(Calendar.YEAR); int age = anneeCourante - anneeNaissance; if (anneeNaissa...
5893f1b2-b631-4eef-977c-5898f03ec73a
5
public final void tick() { step += 1; if (--timeUntilAddRandomGrass < 0) { timeUntilAddRandomGrass = 10; for (int i = 0; i < Parameter.REGROWTH_RATE.getValue(); ++i) { addRandomGrass(); } } for (final Entity e : entities) { ...
f7d6f37b-b420-4b83-ac07-bc04244faf2b
0
public void leaving(final String name, final Object o) { info(StringUtils.shortName(o.getClass()) + "-" + o.hashCode() + " leaving " + name + "()"); }
70cfa342-8325-4437-9464-b7d5ffc8bc2e
9
@Override public ClassMap readClassMap(SymbolSet ss, int fixed, boolean readNames) throws IOException { ClassMap ret = new ClassMap(); // load the names if necessary if(readNames) { String r = reader.readLine(); int numNames = Integer.parseInt(r); while(numNames-- != 0) ret.addClass(reader.readLine(...
4ce91d14-51b7-4f12-9357-a6212cc7c1d5
2
@Override public void keyReleased(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_F1) { System.out.println("F1 Key Released! Toggling Debug Grid!"); if(DRAW_DEBUG_GRID == false) { this.showDebugGrid(true); } else { this.showDebugGrid(false); } } }
1c83972c-f2a2-4d96-a255-f16f162ba929
6
public static void main(String[] args) { System.out.print("Zadej cislo: "); int sirka = VstupInt.ctiInt(); System.out.print("Zadej cislo: "); int delka = VstupInt.ctiInt(); for (int i = 0; i < delka; i++) { for (int j = 0; j < sirka; j++) { if ((i == 0) || (i == (delka -1))) ...
2959e6b9-7b7c-4d28-90eb-a78e9bad7039
9
public void populateUserList(ArrayList<User> users) { userListPanel.removeAll(); for (final User u : users) { ImageIcon avatar = new ImageIcon(ImageManager.getInstance().getImage("graphics/avatars/" + u.getAvatarFilename()).getImage().getScaledInstance(35, 35, Image.SCALE_DEFAULT)); ...
e3d7f6b7-0162-41b0-9423-b0a547681b1a
1
protected void fireReceiveMessage(final ISocketServerConnection ssc, IRemoteCallObjectMetaData meta, IRemoteCallObjectData data, final long connectionId) throws Exception { if (!meta.getExecCommand().equalsIgnoreCase(ISession.KEEPALIVE_MESSAGE)) { ssc.setLastAccessTime(new Date().getTime()...