method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0e4db545-214f-45e6-9eb0-50d74a9bb974
4
public Object next() { if(this.selection.size() == 0 || this.weight.size() == 0 || this.weightsum.size() == 0) return null; Integer j = r.nextInt(this.weightsum.get(this.weightsum.size()-1)); Integer i; for(i = 0; j > this.weightsum.get(i); i++); return this.selection.get(i); }
97b5e769-9910-4b09-992e-91586c0cbf6c
3
public static void benchmarkByteLargeArrayInANewThread() { System.out.println("Benchmarking ByteLargeArray in a new thread."); final long length = (long) Math.pow(2, 32); long start = System.nanoTime(); final ByteLargeArray array = new ByteLargeArray(length); System.out.print...
fc8189b0-caad-4c72-8e25-71078ff03fec
2
public byte[] toByteArray(){ try{ ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = null; out = new ObjectOutputStream(bos); out.writeObject(this); byte[] yourBytes = bos.toByteArray(); try{ bos.close(); out.close(); }catch(Exception e){System.out.println("A M...
5701109c-b729-47b6-9604-4325d3f38ed7
8
static int[] f(int N){ int a=(int)sqrt(N); if(abs(a-sqrt(N))<1e-10)return new int[]{a%2==0?a:1,a%2==0?1:a}; if(a%2==0)return new int[]{N-a*a<=a+1?a+1:(a+1)*(a+1)-N+1,N-a*a<=a+1?N-a*a:a+1}; return new int[]{N-a*a<=a+1?N-a*a:a+1,N-a*a<=a+1?a+1:(a+1)*(a+1)-N+1}; }
690b9ffa-a33c-4d51-a6bd-1c2aec40edb9
6
* @param password Character-array containing the password * @return true if the login-data is correct, false otherwise */ private boolean checkLogIn(String accountname, char[] password) { if (accountname.equals(_adminName) & new String(password).equals(_adminPass)) { adminLogin(); ...
0103bcd0-9a86-432f-a81c-855c7ab6e3a5
8
@Override public boolean onCommand(CommandSender sender, Command cmd, String arg2, String[] args) { if (args.length < 1) { // No args, display list sender.sendMessage(ChatColor.YELLOW + "Muted players:"); String plrs = ""; for (String plr : plugin.mutedplrs.keySet()) { plrs += plr + ", "; } ...
e07226b8-b672-41e5-9efe-2ac71f212aa2
2
public void omniRandSet(){ rover = head; while(rover != null){ int a = 0; while(a < 25){ rover.randlist[a] = randlist[a]; a++; } rover = rover.next; } }
8cd7bea3-79be-476c-b419-76f92482afd6
3
private static void readDataFile(String fname) { Scanner inFile; File readIn=new File(fname); try { inFile = new Scanner(readIn); int i=0; while(inFile.hasNextLine()){ inFile.nextLine(); i++;//just counting number of lines in file } sequences=new String[i]; i=0; inFile.close(); in...
0c594c14-6dea-4647-aed7-c8d55ab34184
5
public static int maxDepth(TreeNode root) { if (root == null) return 0; Queue<TreeNode> currentLevel = new LinkedList<TreeNode>(); currentLevel.add(root); int count = 0; while (!currentLevel.isEmpty()) { Queue<TreeNode> nextLevel = new LinkedList<TreeNode>(); while (!currentLevel.isEmpty()) { Tre...
2f66631a-4e3f-4f08-a500-b34bdd74dd4e
8
static int process(String line) { int cases = Integer.parseInt(line.trim()); int[][] data = { {21, 0}, {20, 1}, {21, 2}, {21, 3}, {22, 4}, {22, 5}, {23, 6}, {22, 7}, {24, 8}, {24, 9}, {23, 10}, {23, 11} }; String[] sign= {"Aquarius", "Pisces", "Aries", "Taurus", ...
c89f5a2d-cc63-4015-8c35-8c23151b1299
7
public ArrayList<Proveedores> obtenerProveedores(String Identificacion , String nombreIn) { String selection[] = {"Identificacion", "nombre","ID"}; String selection_type[] = {"varchar", "varchar","int"}; String table = "Proveedores"; boolean nombreVacio = !nombreIn.equals(""); b...
6b82329e-6c94-46cf-b672-acbb44c0c214
6
public boolean pickAndExecuteAnAction() { if(!paused) { // if(orderFood) { // OrderFoodThatIsLow(); // return true; // } // for(Food f : foods.values()) // if(f.state == FoodState.Rejected) { // OrderRejectedFood(f); // return true; // } synchronized(orders) { for(Order o : orders) ...
af9836f3-a88f-4b31-9c05-1eb80f852449
1
static public void add(String name, GameState gs) { if (!states.containsKey(name)) { states.put(name,gs); } }
e0e5191b-6832-4773-b47a-41f7a19fc834
4
@Test public void testContainsOnlyAdd() { ArrayList<String> operations = new ArrayList<String>(); ArrayList<Integer> vals = new ArrayList<Integer>(); // Add a bunch of values for (int i = 0; i < 100; i++) { int rand = random.nextInt(200); vals.add(rand); operations.add(...
64187248-2178-4cbd-a082-202cee7beae5
8
public static void main(String[] args) { Scanner entrada = new Scanner(System.in); int contador = 10; int seccion; int asiento; boolean[] asientos = new boolean[10]; for(int i=0;i<10;i++) asientos[i] = false; do{ System.out.printf("\nBienvenido al sistema de reservaciones.\n"); System.out.p...
2a94dfda-4770-4e46-8394-d842c8d80fff
2
public void rotate(int[][] matrix) { int n = matrix.length; int tmp; for (int i = 0; i < n / 2; i++) { for (int j = i; j < n - i - 1; j++) { tmp = matrix[i][j]; matrix[i][j] = matrix[n - j - 1][i]; matrix[n - j - 1][i] = matrix[n - i - ...
1bc6d79a-fdd7-4b2e-8d72-8731167aab85
2
@EventHandler public void onPostLogin(PostLoginEvent event) { if (!IRC.sock.isConnected()) return; ProxiedPlayer p = event.getPlayer(); Util.sendUserConnect(p); Util.incrementUid(); String chan = BungeeRelay.getConfig().getString("server.channel"); if (!chan.isEmpty()...
eebb104f-4b11-41b5-a949-0cba5725fa70
3
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(super.toString()); buffer.append('\n'); /** print variables. */ buffer.append("V: "); String[] variables = getVariables(); for (int v = 0; v < variables.length; v++) { buffer.append(variables[v]); buffer.append(" "); ...
29b2250a-0d22-4d19-9501-40092c3ea1f5
9
public static boolean isValid(Position start, Position temp, ChessBoard board) { Coin c = board.getCoinAt(start); int tem = (c.getColor() == CoinColor.WHITE) ? 1 : -1; if (c instanceof Pawn && ((Pawn) c).readyForPromote()) { if (start.getFile() == temp.getFile()) { re...
db15a9b6-1252-466e-b942-4c4666066811
6
private void sendAsFixedLength(OutputStream outputStream, PrintWriter pw) throws IOException { int pending = data != null ? data.available() : 0; // This is to support partial sends, see serveFile() pw.print("Content-Length: "+pending+"\r\n"); pw.print("\r\n"); pw.flush(...
187bf637-c921-491e-ac82-b4311abb6ee2
8
public void run() { Socket socket=null; ObjectOutputStream toClient; MazewarPacket packetToClient; MazewarPacket headPacketFromQueue; try{ synchronized(ClientList){ ClientList.wait(); } //System.out.println("Sending STR to..."); synchronized(ClientList){ for(int i=0;i<ClientList.size();...
43ccfb57-b579-43a5-b3e8-35c99c802ad1
9
@Override public boolean suspendAccount(String pAdminUsername, String pAdminPassword, String pIPAddress, String pUsernameToSuspend) { if(!pAdminUsername.equals("Admin")) { aLog.info("Error Suspending Account : Incorrect Administrator Username"); return false; } if(!pAdminPassword.equals("Admin")) { ...
d8ed5acc-2fa3-4497-a40a-3490a93d87dd
3
public void visitInitStmt(final InitStmt stmt) { final LocalExpr[] targets = stmt.targets(); for (int i = 0; i < targets.length; i++) { if (targets[i] == previous) { if (i > 0) { check(targets[i - 1]); } else { break; } } } }
abc37182-cde0-4b74-8616-7d8d5b4ebc46
3
public static void filter() { splitString = ConfigFileReader.text.split("I:"); for (int i = 1; i < 141; ++i) { //splitString[i] = splitString[i].replaceAll( "[^\\d]", "" ); splitString[i] = splitString[i].replaceFirst(".*?(?=[a-z]?=)", ""); splitString[i] = splitString[i].replace("=", ""); splitS...
b4296bf4-4604-4035-974d-f243ebb8a330
9
public Solution dumbCrossover(Solution s1, Solution s2) { int numLectures = environment.getLectureList().size(); int numFixed = environment.getFixedAssignments().size(); // Determine which solution is better Solution better, worse; if (s1.getPenalty() < s2.getPenalty()) { better = s1; worse = s2; ...
fad8aa2d-440a-4974-bade-664e7bbd2e6b
8
public void putAll( Map<? extends Short, ? extends Float> map ) { Iterator<? extends Entry<? extends Short,? extends Float>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Short,? extends Float> e = it.next(); this.put( e.getKey...
41957dc5-3a93-49b9-9586-0b7e3c523e13
8
public List<NewsItem> getPage(int page){ String baseURL = "https://www.kettering.edu"; List<NewsItem> newsPage = new ArrayList<NewsItem>(); if(page < 2) return newsPage; try{ DefaultHttpClient client = new DefaultHttpClient(); HttpGet newsGet = new HttpGet("https://www.kettering.edu/news/c...
6df76a3f-251c-4402-8f7b-dcb852e8e896
0
public hasChosenItemsState(GameMachine gumballMachine) { this.gumballMachine = gumballMachine; }
47908029-1daf-475c-ba67-127cb71a5376
4
public static void main(String[] args) { try { System.out.println("[开始执行]"); logger.info("[开始执行]"); initBloomFilter(); ReadConfig readConfig = new ReadConfig(); List<?> configList = readConfig.readConfig(); GetData getData = new GetData(); ...
416a3e8e-941a-4c1b-99cc-c434e91c7f31
9
private void printToFiles(){ try { BufferedWriter writer = new BufferedWriter(new FileWriter(("Data/TagTableData/tagFrequencies.txt"))); BufferedWriter writer2 = new BufferedWriter(new FileWriter("Data/TagTableData/wordTagFrequencies.txt")); BufferedWriter writer3 = new BufferedWriter(new FileWriter("Data/Ta...
c6c74bb0-329b-4c7e-9108-9e422c0ac9b2
9
public static void main(String[] args) { String a = "aaa"; Class<?> processor = null; Object obj = null; try { processor = Class.forName("common.reflection.LineDistributorExample"); Method method = processor.getMethod("distribute", String.class); obj = method.invoke(processor.newInstance(), a); } cat...
eee0f0f3-b395-45f8-9e92-13e9d8ec480d
7
private static List<Element> merge(List<Element> left, List<Element> right) { List<Element> merged = new ArrayList<Element>(); int temp; while (left.size() > 0 || right.size() > 0) { if (left.size() > 0 && right.size() > 0) { // Update Comparison when if condition is...
a3171d25-f4a9-45c8-b2c4-6b58cdf36c50
9
private static Date cvtDate(String s, String fmt) { Date d = null; Calendar cal = null; int year = 0; int month = 0; int day = 0; // Organize logic for faster decisions, so most common // things up front... if(fmt == null || fmt.equals("YYYY-MM-DD")) { year = Utils.buildNumber(s, 0, 4); month =...
efa49fd3-874d-439e-a13a-708202eb83e7
0
private static void createAndSendInitialMessageToAllBots(Match m, IBomber[] bombers) throws IOException { // Lets give initial details to bombers: String initialMessage = "BEGIN MSG\n" + "map width: " + m.getMapWidth() + "\n" + "map height: " + m.getMapHeight() + "\n" ...
8ec5cd71-ad02-445f-a958-e0d3a4606b11
1
public double[] getY(double[] result, double x) { double v = Math.sqrt((r + x - a) * (r - x + a)); if (result == null) { result = new double[2]; } result[0] = v + b; result[1] = v - b; return result; }
58da5233-62b4-4052-9eae-42ef2ffb2b5d
1
public void moveToEnd(Board board, Direction dir) { while (tryMove(board, dir)); }
7ba411f5-3ece-4a52-8f98-a7f7b8b65b9f
3
public void checkDeclaration(Set declareSet) { if (initInstr instanceof StoreInstruction && (((StoreInstruction) initInstr).getLValue() instanceof LocalStoreOperator)) { StoreInstruction storeOp = (StoreInstruction) initInstr; LocalInfo local = ((LocalStoreOperator) storeOp.getLValue()) .getLocalInfo()...
c3ebfb32-e3a5-45c1-958a-bc357661acdf
1
private void testEmptyCycListAdd() { UnsupportedOperationException x = null; try { CycList.EMPTY_CYC_LIST.add(4); } catch (UnsupportedOperationException e) { x = e; } assertNotNull(x); }
4ae3d0e8-cde1-43b3-88be-3744f2808506
4
@Deprecated public void setLocation(Location location) { if(location == null) throw new IllegalArgumentException("Null location sent to setLocation"); if(dead) return; if(this.location != null) { heading = this.location.getDirectionToLocation(location); this.location = location; } else { th...
3d5e3c0e-97d9-404f-b5ce-86efc4dd224d
4
private boolean read() { try { final URLConnection conn = this.url.openConnection(); conn.setConnectTimeout(5000); if (this.apiKey != null) { conn.addRequestProperty("X-API-Key", this.apiKey); } conn.addRequestProperty("User-Agent", Up...
4d09427f-bc61-45b9-be9f-3b770e9c1d17
5
public void setLayout(int pos){ switch(pos){ case 0: labels[INDEX_ZERO] = projectile; labels[INDEX_ONE] = pendulum; labels[INDEX_TWO] = thirdChoice; labels[INDEX_THREE] = back; temporaryButtonSet = mechanicsButtonSet; break; case 1: ...
bae212aa-f835-4cc8-b81e-a9e565e6e60c
9
static CharTrie ahoCorasickBuild(String[] pats) { CharTrie root = new CharTrie(); for (int i = 0; i < pats.length; i++) { CharTrie cur = root; for (int j = 0; j < pats[i].length(); j++) { char c = pats[i].charAt(j); if (cur.children[c] == null) cur...
ec80a962-8518-4326-9806-8243a866866f
5
public void run() { ServerSocket serversocket = null; Socket s; InputStreamReader input; BufferedReader b; String message = null; boolean done = false; try { serversocket = new ServerSocket(process.getPort(), 1); serversocket.setSoTimeout(0); } catch (IOException e) { String msg = String....
cfbf5549-1364-45fc-a5d7-b946d27affbc
8
public Box getAdjacentBox(Direction d, Box b) { Pair<Integer> position = getBoxPosition(b); int w = position.getFirst(); int h = position.getSecond(); switch (d) { case North: if (h + 1 < height) { return chart[w][h+1]; } else { return null; } case South: if (h - 1 >= 0) { retu...
ce7ff9b4-a5f4-44c2-b50c-c546ec1392a7
7
public static void main(String[] args) { // Create a variable for the connection string. String connectionUrl = "jdbc:sqlserver://localhost:1433;" + "databaseName=AdventureWorks;integratedSecurity=true;"; // Declare the JDBC objects. Connection con = null; Stateme...
d24cf9f0-01f3-40bb-88cf-1ec04d5b0676
6
public RPChromosomeRegion getExtremes(RPChromosomeRegion testRegion) { RPChromosomeRegion newRegion = new RPChromosomeRegion(this); // update node bounds if (testRegion.startChromID < newRegion.startChromID || (testRegion.startChromID == newRegion.startChromID && ...
972daf0b-7479-41b6-b1f9-41ebb115a19f
5
public String strStr(String haystack, String needle) { if (needle.isEmpty()) return haystack; if (haystack.isEmpty()) return null; int m = 0; // the beginning of the current match in haystack int i = 0; // the position of the current character in needle int[] T = kmpTable(needle); while (m + i < hay...
ddbec188-7ecb-4612-847a-f4c467771a95
4
public static void main(String[] args) { Scanner input = new Scanner(System.in); boolean left = true; while (input.hasNext()) { String line = input.nextLine(); for (int i = 0; i < line.length(); ++i) { char c = line.charAt(i); if (c == '\"') { if (left) { System.out.print("``"); le...
c4110183-9df1-4754-b618-d90e304b61b7
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TradingData other = (TradingData) obj; if (planets == null) { if (other.planets != null) return false; } else if (!planets.equals(other....
f1b988b4-a103-45a4-8357-950b99fdc710
3
public static void removeConnectedClient(String btN) { for(int i = 0;i<=5;i++) { if(clientsTable.getModel().getValueAt(i, 0) != null) { if(clientsTable.getModel().getValueAt(i, 0).toString().equals(btN)) { //Clear Device clientsTable.getModel().setValueAt(null, i, 0); clientsTable.getM...
c5fb6653-e9ed-45ff-93c3-e547c64e75d6
2
public void popularCB() { ArrayList<String> Departamentos = new ArrayList<>(); DepartamentoBO depBO = new DepartamentoBO(); try { Departamentos = depBO.CMBDepartamento(usuarioLogado.getDepartamento().getCodigo()); } catch (SQLException ex) { JOptionPane.showMessa...
a21208c9-7687-4b59-a9bd-b6d087eff5ad
7
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } JenkinsServer that = (JenkinsServer) o; if (name != null ? !name.equals(that.name) : that.name != null)...
570f0ea8-4619-4531-b3fc-f43b64147752
6
public static void main(String[] args){ _port = initParser(args); try { try { _server = new ServerTCP(_port); } catch (SocketException e) { System.err.println(Errors.SOCKET_PROBLEM); System.exit(-1); } catch (IOException e) { System.err.println(Errors.IO_PROBLEM); System.exit(...
7c00d346-6871-4cad-b83b-c6b3b8f83f43
6
public Rectangle getEditorBounds(mxCellState state, double scale) { mxIGraphModel model = state.getView().getGraph().getModel(); Rectangle bounds = null; if (useLabelBounds(state)) { bounds = state.getLabelBounds().getRectangle(); bounds.height += 10; } else { bounds = state.getRectangle(); }...
5e9c707e-eae6-40e4-90c5-3d201ec9d3e4
9
public static String decrypt(String hash){ // The hash for the password that was generated by the encryption program String rands = ""; // Houses the concatenated random values from the encryption program Str...
dfa40331-4a19-4fb1-9280-ca9351bdce22
4
@SuppressWarnings({ "unchecked", "rawtypes" }) public final void prune() { onl = new ArrayList[this.m]; for (int i=0; i<this.m; i++) { onl[i] = new ArrayList<Entry<K,V>>(1); } cam = new Hashtable<K,Entry<K,V>>(); for (int i=0; i<off.length; i++) { for (Entry<K,V> e : off[i]) { final HashCounter hc = new...
2c8f5282-d592-4502-ae04-d84556033044
6
public void firstArrayOrdering() { // set whichOrder in order to sort the RefereeClass array // by match allocations RefereeClass.setWhichOrder("matches"); Arrays.sort(refereeProgram.getrefereeClassArray()); // create new array arrayFirstOrdering = new RefereeClass[refereeProgram.getelementsInArray()]; ...
5a8954b2-47a7-4eaf-886b-5ca2f01fedb2
9
private void algorithmLine(int max, int min) { // Let's use the other algorithm to approximate the tiles that we need to check. algorithmWrap(max, min); // After calling the above function, the approximation is stored in this.result // These variables are explained when they are first set. // They are decl...
326d83f6-ae7c-4a64-a3da-006d6f4519c9
4
public static int getAbilityPower(AbilityType type) { //How much the ability deals/heals/etc switch (type) { case abil_tar_heal: break; case abil_aim_fire: return 10; case abil_dir_cleave: break; case abil_inv_mele...
e51c5184-2e55-49f0-b0c8-b74d6afaca0e
2
public static Account unchecked_narrow (org.omg.CORBA.Object obj) { if (obj == null) return null; else if (obj instanceof Account) return (Account)obj; else { org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); _AccountStub stub...
8723d080-3fad-4b5c-b92c-80edd62bca2d
9
public boolean addDialog(DialogCategory category, Dialog dialog){ if(editor.controller.dialogs.containsKey(dialog.id)){ String[] buttons = {"Overwrite", "Increment", "Cancel"}; int result = JOptionPane.showOptionDialog(this, dialog + "\nDialog found with the same id", "Conflict warning", JOptionPane.WARNING_MES...
5f87219a-f376-49d0-8e50-69d8aadab14c
1
public void addPropertyChangeListener(PropertyChangeListener listener) { this.rosterChangeSupport.addPropertyChangeListener(listener); for (Roster r: rosters) { r.addPropertyChangeListener(this); } }
6c94de28-1c9e-4700-8ad9-6020fb513c52
9
private boolean iscontainsDuplicate(int[] nums, int i, int j) { int length = j - i + 1; if (length == 1) return false; if (length == 2 && nums[i] == nums[j]) return true; if (length == 2 && nums[i] != nums[j]) return false; int mid = (i + j) / 2; HashSet<Integer> set = new HashSet<>(); for (int k...
18abf80d-2262-4f59-9f00-18b6261492f0
9
protected void onChannelOpen(Message msg) throws IOException { String type = msg.readString(); int remoteid = (int) msg.readInt(); // #ifdef DEBUG if(log.isDebugEnabled()) log.debug("Open channel '" + type + "' [" + remoteid + "]"); // #endif int remotepacket...
937e38cc-8d63-441d-97eb-3b4e03e4cc65
8
public void CheckFile(String temp, String GlobalName){ String line; int noLine = 0; int flag = 0; GlobalCont = 0; ReadFile(); //######### SET FIRST CONTLOC TO 0000 ########## /*Formatter fmt = new Formatter(); fmt.format("%04d",GlobalCont); String fmtPass = fmt.toString(); //System.out....
137a5522-065a-41e9-8ec9-5569fad5f8ec
6
public int compareTo(MACPacket p) { int seconds = 0; int pSeconds = 0; int milliSeconds = 0; int pMilliSeconds = 0; int microSeconds = 0; int pMicroSeconds = 0; for(int i = 0 ; i < this.seconds.length ; i++){ seconds += (this.seconds[i] << ((this.seconds.length-1-i)*8)) & 0xFF; } for(int i = 0 ...
dd945e2e-0694-4b6d-9b90-e7bf2761a259
2
public void setRemoveSurroundingSpaces(String tagList) { if(tagList != null && tagList.length() == 0) { tagList = null; } this.removeSurroundingSpaces = tagList; }
c73ffd6f-2c0d-4d11-b5f7-d38f23d8354b
2
@Override public void run() { try { while (true) { mServer.send(new ConduitMessage(mClientInput)); } } catch (Exception exception) { // An exception here can be ignored, as its just the connection // going away, which we deal with later. } shutdown(); }
c9b2d024-fe01-411f-90aa-e47ad0be2f43
6
public static EquipmentType getEquipmentType(ItemStack is) { if (ArrayUtils.contains(mats.get(EquipmentType.HELM), is.getType())) return EquipmentType.HELM; else if (ArrayUtils.contains(mats.get(EquipmentType.CHESTPLATE), is.getType())) return EquipmentType.CHESTPLATE; else if (ArrayUtils.contai...
a652f057-3380-47e0-b228-1a0d9f7c2452
6
private boolean isCode(String sourceString) { if (sourceString.isEmpty()) { return false; } else if (sourceString.contains("{") && !sourceString.contains("}")) { braceCount++; return true; } else if (sourceString.contains("}") && !sourceString.contains("{")) {...
8b82b78a-d667-43f6-b53f-d6c49b15d7f8
9
protected void updatePersonnel(int numUpdates) { if (numUpdates % REFRESH_INTERVAL == 0) { final Base base = employs.base() ; // // Clear out the office for anyone dead- for (Actor a : workers ) if (a.destroyed()) setWorker(a, false) ; for (Actor a : residents) if (a.destroyed()) set...
d1d32aab-9c36-42c9-bb7d-42d566233655
5
public Block(int blockID) { if(blockID == World.AIR || blockID == World.STONE || blockID == World.DIRT || blockID == World.WOOD || blockID == World.LEAF) { this.blockID = blockID; } else { blockID = World.INVALID; } }
d4f2c0df-60e3-45a3-9813-29c641692cc7
2
public SignalStructure(Class<?>[] params, List<Slot> arrayList, Class<?> returnParam) { this.invokerParameters = params; this.registeredListeners = arrayList; this.returnParam = returnParam; }
69433f24-5e19-41f2-a964-79528c5b2e72
2
public Production[] getProductionsToAddToGrammar(Grammar grammar, Set lambdaSet) { ArrayList list = new ArrayList(); Production[] productions = grammar.getProductions(); for (int k = 0; k < productions.length; k++) { Production[] prods = getProductionsToAddForProduction( productions[k], lambdaSet); ...
84873fb9-cb20-46e2-9d0e-4f802a9f2d75
0
@Override public void endSetup(Attributes atts) {}
302292ce-32eb-4cc4-bbb8-b5e89e4453e4
8
private void refill() throws IOException { final int token = in.readByte() & 0xFF; final boolean minEquals0 = (token & MIN_VALUE_EQUALS_0) != 0; final int bitsPerValue = token >>> BPV_SHIFT; if (bitsPerValue > 64) { throw new IOException("Corrupted"); } final long minValue = minEquals0 ? 0...
453cea1b-7e0a-4806-9e98-c16c5283616a
7
private void drawPaths(Graphics g) { for (VortexSpace space : vortexes) { double[] location = space.getLocation(); ArrayList<Integer> neighbors = space.getNeighbors(); ArrayList<Integer> paths = space.getPaths(); for (int i=0; i<neighbors.size(); i++) { int corridor = paths.get(i); g.setColor(new ...
57b9ca0b-518f-42a9-80e0-912373039bb2
2
public boolean setJumpheight(int jumpheight) { if (jumpheight > 0 && jumpheight < 4) { this.jumpheight = jumpheight; return true; } else { return false; } }
ef685972-e828-4c03-bb07-5519f52e0fd2
7
static void set_ordinals_in_plausible_commit_order(Map<String, Set<String>> graph, OrdinalMapper ordinals) { // Make a list of all parent to child edges. // Each edge represents the constraint "the ordinal of this parent is less // than th...
0bafcb78-7cf8-4a4f-9a24-35b4576981e4
4
/* */ @EventHandler(priority=EventPriority.HIGHEST) /* */ public void onFoodLevelChange(FoodLevelChangeEvent event) /* */ { /* 252 */ if ((event.getEntity() instanceof Player)) /* */ { /* 254 */ Player player = (Player)event.getEntity(); /* */ /* 256 */ if (!event.isCancel...
4b6b3d32-cf1a-4d5a-8635-e60cc70b901c
8
@Override public boolean keyup(KeyEvent ev) { if (ev.getKeyCode() == KeyEvent.VK_UP) APXUtils.wPressed = false; if (ev.getKeyCode() == KeyEvent.VK_LEFT) APXUtils.aPressed = false; if (ev.getKeyCode() == KeyEvent.VK_DOWN) APXUtils.sPressed = false; ...
7be89cd4-302f-434d-9132-b7e5a48191cb
7
@Override public void mouseDragged (MouseEvent e) { if (alg.isProcess()) { return; } int i = getRowByMouseX(e.getX()); int j = getColumnByMouseY(e.getY()); if (e.getModifiersEx() == MouseEvent.BUTTON1_DOWN_MASK) { if (draggedCell != null) { ...
74df93a3-fc92-4d05-8850-2cc14752c4e9
2
public double rawAverageCorrelationCoefficients(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients(); return this.rawMeanRhoWithoutTotals; }
95dc77e9-b310-415f-9934-c003435cd273
6
public String addUser() throws Exception { DBConnection dbcon = new DBConnection(); Connection con = dbcon.connect(); String check = "failure"; String result=null; String query="SELECT COUNT(username) FROM users WHERE username='"+username+"';"; PreparedStatement ...
5bde05b1-be4d-4e32-8d5e-836c6da37667
2
public void imprimirTable(JTable table) { for (int i = 0; i < table.getRowCount(); i++) { for (int j = 1; j < table.getColumnCount(); j++) { System.out.print(table.getValueAt(i, j) + " "); } System.out.println(""); } }
b00da76e-5957-4de6-b183-389e71f47f2c
1
@Override public void logicUpdate(GameTime gameTime) { // Call any 'startUps' required updateGameQueue(gameTime); for (IHudItem item : hudItemQueue) { item.logicUpdate(gameTime); } }
d2035223-959c-477a-b009-da5b9678fa82
2
boolean contains(int[] arr, int x) { for (int i : arr) if (x == i) return true; return false; }
0af1f1e9-6048-4673-adc7-cf997e9b3c5e
5
@Override public Object getValueAt(int rowIndex, int columnIndex) { Customer customer = customers.get(rowIndex); switch (columnIndex) { case 0: return customer.getId(); case 1: return customer.getFirstname(); case 2: ...
57325617-e9d6-4110-a162-0cf38ac3e5a5
2
public void loadImage(String key, String path) { File sourceImage = new File(path); Image image = null; try { image = ImageIO.read(sourceImage); } catch (IOException e) { e.printStackTrace(); } if(image != null) { loadedImages.put(key, image); } }
5af95385-b681-42ff-b8e1-0819a10d98d3
3
public void updateFinderBounds(Rectangle bounds, boolean repaint) { if (bounds != null && !bounds.equals(finderBounds)) { Rectangle old = new Rectangle(finderBounds); finderBounds = bounds; // LATER: Fix repaint region to be smaller if (repaint) { old = old.union(finderBounds); old.grow(3, ...
66ff229b-b650-409c-af30-43a90bf7184e
0
public MusicLoudness getMusicLoudness() { return musicLoudness; }
1368e5c8-a9b4-4d6e-9ba1-060fcd1f5993
0
@Override public void setRank(int newRank) { rank = newRank; }
0f20a4b3-4046-4921-9ef7-c26f089a6cdf
5
private JSONObject getModel(String format){ JSONObject models = null, model = null; ArrayList<String> keyList = new ArrayList<String>(); try{ models = new JSONObject(getModelFileData()); if(format.equals("random") || format.length() <= 0){ Iterator<?> keys = models.keys(); while(keys.hasNext()){ ...
db26ea91-3bc9-40dd-a0b9-75836a9eb25c
9
public boolean input(Instance instance) { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } Instances outputFormat = outputFormatPeek(); double[] vals = new double[outpu...
9225087b-3346-4538-9edc-2dab7a1223f2
2
public void sendMessage(Message message) { try{ writer.writeObject(message); writer.flush(); } catch(NullPointerException e) { ServerHelper.log(LogType.ERROR, "Kein Outputstream für " + ip + ":" + port + " vorhanden"); } catch(IOExc...
5ae4a02e-977e-4e27-a16f-1c917fb0c0db
0
public String showList(){ List<Problem> list = problemDAO.findPage(page, size); problemList = new ProblemList(); problemList.setList(list); return SUCCESS; }
8a3ddb1f-2fe0-456f-8e70-03b6bedef429
3
public void checkReady() { if ((points==0) && (ground != null) && (name != null)) { status = "Nomad"; } }
d54094aa-2ef0-441d-9fe3-62dcd767c231
3
@Override public boolean onMouseDown(int mX, int mY, int button) { if(super.onMouseDown(mX, mY, button)) { return true; } for(ResearchItemButton rib : itemSlots) { if(rib.onMouseDown(mX, mY, button)) { researchDone = true; return true; ...
6b9fbc88-d9c0-4970-91ef-9dab7de10b24
2
public void run() { try { // populate warehouse with goodies populateWarehouse(); System.out.println("==========================="); System.out.println("= Sales System ="); System.out.println("==========================="); printUsage(); BufferedReader in = new BufferedReader(new Inpu...
984fc934-b8e2-473b-99d0-7442f2b5e2ee
0
@Override public String toString() { return name; }