method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f293f1db-1af7-4cc1-ba38-ea541188b574
9
public void findClearFoodSpace(int n, int count, int recursive, int length) { while (!foodSpaceClear) { if (recursive < 4) { for(int i = 0; i < length; i++) { if (getCell(randRow+count,(i+randCol)-1).getIsEmpty()) { n++; } } for(int j = 0; j < length; j++) { if (getCell(randRow-cou...
ebea9a7f-154f-4823-9ee0-e43026373a0a
3
public void addEffect(Player player) { // Cancel if the player is not applicable if (player.hasPermission("hunger.nohunger") || !plugin.getConfig().getBoolean("global-settings.hunger")) setCancelled(true); // Iterate through all valid potion effects and add any that are applicable. for (String effect : plu...
d0971a2a-6c05-4fc0-ac0f-762e93c540f4
4
@Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o == null ) { return false; } if ( !(o instanceof Course) ) { return false; } final Course other = (Course) ...
6856b817-de84-492a-84b0-cc38243fd2d4
2
@Override public boolean isOpen() { for (Synthesizer s : theSynths) if (!s.isOpen()) return false; return true; }
24b5fdb2-b1d4-4bbc-926f-e5538a96db4d
1
private JLabel getJLabel1() { if (jLabel1 == null) { jLabel1 = new JLabel(); jLabel1.setText("Your Sql Error!"); jLabel1.setForeground(Color.red); } return jLabel1; }
8cbd8850-33f6-4301-8c75-a72a2188cfb4
5
public ParametricCommand getSubcommand(String value) { if (!this.hasExpressionSubcommands) return subcommands.get(value.toLowerCase()); else for (String key : subcommands.keySet()) { if ((key.charAt(0) == '^' && value.matches(key.substring(1))) || value.equalsIgn...
111f0b94-9431-4ed0-bb6d-5571a58e9aff
3
public Display findDisplayFor(Class cl) { // Go up through the class hierarchy for obj and see // if there is a display for its class or superclasses. if (cl == Object.class) { return defaultDisplay; } Display display = map.get(cl); if (display != null) { ...
ea3e126e-7f41-46c6-a4b8-459aa015efda
8
@Override protected boolean validate(JComponent input) { if (!(input instanceof JFormattedTextField)) { return true; } JFormattedTextField field = JFormattedTextField.class.cast(input); AbstractFormatter formatter = field.getFormatter(); if (formatter == null) { return true; } String text = field...
df36e5f7-a8e5-462d-a7d8-c7ac9f073e84
3
private int testaaPisteYAkselilla(int nopeus) { // Testattavan vaakarivin vasen laita on hahmon vasen laita Piste testattavaPiste = new Piste(this.getX() - 12, this.getY()); // Sisäkkäisten looppien keskeyttämistä varten boolean loytyiEste = false; // Iteraattori int y...
04d29437-423e-493e-bfce-2f2378361314
9
public void actionPerformed(ActionEvent event) { if(event.getActionCommand().equals("Add")) { String name = userField.getText().trim(); if (name.equals("") || name.equals("Enter User Name")) JOptionPane.showMessageDialog(null, "Invalid User Name"); else { String key = randomKeyGenerator(); ...
24eb6b26-d9b4-415d-9636-7b0bb4321050
9
static int computeMove() throws IOException { Engine.actualColor = Engine.color; // Setam culoarea engineului pentru evaluare if ("black".equals(Engine.color)) { if (Database.blackOpening.isEmpty()) { ArrayList move = Engine.alfaBeta(Integer.MIN_VALUE, Integer.MAX_VA...
836544e8-ac19-4648-89fd-dfdbb074b981
8
public static int deleteOlderThan(java.io.File dirh, long min_age, java.io.FileFilter filter, boolean recursive) throws java.io.IOException { if (!dirh.exists()) return 0; java.io.File files[] = dirh.listFiles(filter); int dirsize = (files == null ? 0 : files.length); int cnt = 0; for (int idx = 0; idx !=...
0df018f9-e3b3-4aff-b073-39df952f0b43
8
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Exam)) return false; Exam exam = (Exam) o; if (name != null ? !name.equals(exam.name) : exam.name != null) return false; if (questions != null ? !questions.equals(exam.questions) : ex...
a492816b-8e32-4dab-9236-9fdfd69a683e
0
public void setSendTime(long sendTime) { this.sendTime = sendTime; }
acae2615-c5f4-45b2-a944-ee0b774d494f
0
private SandwichFactory() { }
d76d5cbf-c8e4-4f47-92d9-ca9e34710797
0
public void update(Observable o, Object arg) { // TODO Auto-generated method stub }
fc10d928-72c9-4954-8478-965ecf83f7f3
2
@Override public void setChoix(String c, String p) { if(p.equals(player1)) { this.choise1 = c; } else if (p.equals(player2)) { this.choise2 = c; } }
e1f0205b-4061-4948-b613-f316dbb0f4d4
5
private final String getChunk(String s, int slength, int marker) { StringBuilder chunk = new StringBuilder(); char c = s.charAt(marker); chunk.append(c); marker++; if (isDigit(c)) { while (marker < slength) { c = s.charAt(marker...
1a116be2-6432-4e3e-b896-3c2c8665d324
8
public static void main(String[] args) { int limit = 1000000; TreeSet<Integer> primes = primeSieve(limit); int stash = 0; int currentCount = 0; for (int s : primes) { int start = 0; int count = 0; for (int p : primes) { if (s ...
d88d9e9f-9cc2-4c17-9c01-6a1de9255dac
5
private int findID(String str) { switch(str) { case "blue": return 1; case "red": return 2; case "green": return 3; case "yellow": return 4; case "black": return 5; default: return -1; } }
455e2b79-0aa4-4999-b98d-63207d9c1d56
6
@Override public Object getValueAt(int rowIndex, int columnIndex) { switch(columnIndex){ case 0 : return list.get(rowIndex).getNim(); case 1 : return list.get(rowIndex).getKodepinjam(); case 2 : return list.get(rowIndex).getTanggalPinjam(); case 3 : return list.get(rowI...
6667cabb-1b35-4202-a19a-d2630e2c5313
1
public String attack(Characters enemy) { int damage = roll(attack); String message = name + " hits " + enemy.getName() + " for " + damage + " damage."; enemy.receiveDamage(damage); if (enemy.getHP() <= 0) { enemy.die(); } return message; }
a24a9a60-e1c3-492e-a9e0-219df72b6937
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Catalogue other = (Catalogue) obj; if (myGenres == null) { if (other.myGe...
40202f85-f741-4676-a577-77a1ea4c6916
6
@Override public void handle(Token v) throws ScriptError { switch( v.type ) { case BAREWORD: case SINGLE_QUOTED_STRING: Word w = words.get(v.text); if( w == null ) { Matcher m; if( (m = DECIMAL.matcher(v.text)).matches() ) { vm.push(Short.parseShort(v.text)); } else if( (m = HEX.matcher(v.tex...
50eca3c5-38b9-4090-94ac-21d1d3eadbe5
3
public void DoDoubling() { Scanner in = new Scanner(System.in); String input = in.nextLine(); int length = input.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; i++) { sb.append(input.charAt(i)); if (isAlphabet(input.charAt(i))) { sb.append(input.charAt(i)); }...
f6b8be23-f288-41e6-a711-02089203f3ef
3
public static synchronized DataInputStream openurl(String s) throws IOException { for (Signlink.urlreq = s; Signlink.urlreq != null;) { try { Thread.sleep(50L); } catch (Exception exception) { } } if (Signlink.urlstream == null) { throw new IOException("could not open: " + s); } else { return...
73dc2736-eda1-4b41-8544-df92e0e38891
6
private String getHexObjCode(ArrayList<String> binaryArray) { String hexObjCode = ""; int minAdrUnit = data.getMinAdrUnit(); int noOfHexCharacters = (minAdrUnit / 8) * 2; if (data.getEndian().equals("big")) { for (String str : binaryArray) { String hex = binaryToHex(str); while (hex.length() < noOf...
509bd71e-c031-496e-99e9-62779c9ec95f
0
public boolean getShoot(){ return shoot; }
5aa2c0f9-9cb1-48ad-aa53-5563c0669b97
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=prof...
be5fa809-0397-4592-b767-2c3604de63e0
3
public static int[] sort(int [] a){ int [] dest; int len=0; int j=0; int temp=0; int cur=0; len=a.length; for(int i=1;i<len;i++){ cur=a[i]; j=i-1; while(j>=0){ if(a[j]>cur){ temp=a[j+1]; a[j+1]=a[j]; a[j]=temp; } j--; } } return a; }
4c6ca96d-4a59-49e8-bbdc-8cdd97cf1492
0
public void addRoom() { rooms.add(roomEntity); }
83c7ebf9-5f25-4380-8362-7a7cceb46f50
1
public static int[] toIntArray(Integer[] data) { int[] result = new int[data.length]; for (int i =0; i<data.length; i++){ result[i] = data[i].intValue(); } return result; }
9459fe0b-ac89-4b23-bcfc-f1cd25d8ab63
2
private void doubleToBD(){ this.responsesBD = new BigDecimal[this.nGroups][]; for(int i=0; i<this.nGroups; i++){ this.responsesBD[i] = new BigDecimal[this.nResponsesPerGroup[i]]; for(int j=0; j<this.nResponsesPerGroup[i]; j++){ this.responsesBD[i][j] = new B...
af7accdf-806d-4773-87b3-9af5bbd089ea
4
public DoubleNode deleteNode(DoubleNode node){ DoubleNode store=null; if(listHead==null){ return null; } else if(listHead.equals(node)){ store=listHead; listHead=listHead.getNextNode(); listHead.setPreviousNode(null); } Doub...
04578cae-8187-45c7-b62b-4f80b63ddbbd
4
public boolean nextMove(int row, int col) { //Returns true for a valid and successful move boolean result = false; int r = game.getBoard().board_row; int c = game.getBoard().board_col; for(int i = 0 ; i < r; i++) { for(int j = 0; j < c; j++) { Coords ...
0f6af0cf-9e99-4c27-b8a3-d499fe23de9b
9
public int maximalRectangle3(char[][] matrix) { if (matrix == null || matrix.length == 0 || matrix[0].length == 0) return 0; int max = 0; int row = matrix.length; int col = matrix[0].length; int i, j; int[] height = new int[col]; ...
66ca9411-6d67-4490-ad17-f39ef6e026ac
7
public boolean isComplexIDOfMiddle() { return (truthTable[0] == false) && (truthTable[1] == false) && (truthTable[2] == true) && (truthTable[3] == true) && (truthTable[4] == false) && (truthTable[5] == false) && (truthTable[6] == true) && (truthTable[7] == true); }
d594b17e-5e19-4900-a321-2dda8cb04d99
0
private float calcDistance(final String timeStringView) { float distance = 0F; float u = VALUE_VELOCITY_INIT; float a = VALUE_ACCELERATION_INIT; int t = Integer.valueOf(timeStringView); distance = u*1000/3600*t+((a*t*t)/2); return distance; }
c198f89e-eb8f-449a-8cf3-730f8a3792da
1
private void updateGroupIndex () { for (int i = 0; i < tripListModel.getSize(); i++) { tripListModel.get(i).getTrip().setGroupNumber(i+1); } }
a6f45e78-d342-48f9-85d5-b3a254eda28d
6
public JSONObject getURLSTag() { try { Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,USER,PASS); stmt=conn.createStatement(); json=new JSONObject(); String SQL="select * from images LIMIT 15"; rs=stmt.executeQuery(SQL); ...
ea436197-e04f-4af2-a624-1ecb520dacd1
5
private Type typeDecl(boolean global) throws Exception { if(scan.sym == Token.var) { scan.next(); return new VarType(global, globals); } else if (scan.sym == Token.array) { scan.next(); if(scan.sym == Token.opensquare) { ArrayList<Integ...
8ed65472-04eb-4cb6-be75-b6bf11c0df9e
0
public String getName() { return Name; }
27bbbbfe-6854-4c79-93d0-0e9684195222
2
public final boolean check_parity(byte[] key) { for (int i=0; i < DES_KEY_SZ; i++) { if (key[i] != odd_parity[key[i]&0xff]) return(false); } return(true); }
a95bb392-e4c3-4f55-8360-4b7c025b48b6
3
public void loadSlots() { Integer i = 0; this.slots = new HashMap<String, SlotMachine>(); if(plugin.configData.slots.isConfigurationSection("slots")) { Set<String> slots = plugin.configData.slots.getConfigurationSection("slots").getKeys(false); if(!slots.isEmpty()) { for(String name : slots) { l...
4fb8fef4-6b7e-40ba-909a-3919459543a6
1
public void populateTableForTeacher(Teacher teacher) { ArrayList<Field> teacherFields = teacher.getFields(); Object[][] data = new Object[teacherFields.size()][1]; for (int i = 0; i < teacherFields.size(); i++) { data[i][0] = teacherFields.get(i).toString(); } ((FieldTableModel)table.getModel()).loadDat...
6a01612e-56a5-43ac-8ad7-799ec27c1efb
0
public Panel getPanel() { return panel; }
114f9583-9da7-4ef9-a77c-2a6e1dfcca97
8
private Method method(String name, Class<?>... argTypes) { try { if (null == argTypes || argTypes.length == 0) { return clazz.getMethod(name); } for (Method method : clazz.getMethods()) { if (!method.getName().equals(name)) { continue; } Class<?>[] paramsTypes = method.getParameterTy...
90e0c189-e22c-4b78-b40b-5cd491f26297
8
public static void main(String args[]) { /*Logger log = Logger.getLogger(StartUp.class.getPackage().getName()); log.setLevel(Level.ALL); ConsoleHandler handler = new ConsoleHandler(); handler.setLevel(Level.ALL); handler.setFormatter(new SimpleFormatter()); log.addHandler(handler);*/ if (args.lengt...
ce48cbb4-dbc1-42f8-8ff2-2f888fca03fc
6
public void inserir(String chave, String valor) { Nodo novoNodo = new Nodo(chave.hashCode(), valor); if (raiz == null) { novoNodo.black = true; raiz = novoNodo; raiz.altura = 0; raiz.pai = null; raiz.direita = null; raiz.esquerda = null; System.out.println("Indice: " + String.valueOf(novoNod...
3d514f2d-47bd-4e4c-bbb2-b2f1e5c14faa
2
public Instrumenter(SootMethod m, Map<Local, Set<Unit>> map) { // TODO Auto-generated constructor stub method = m; ins_map = map; // factory_already_created = new HashSet<String>(); getUtilClasses(); for(Map.Entry<Local, Set<Unit>> entry: ins_map.entrySet()){ Local l = entry.getKey(); SootClass c = ...
69149050-0e99-46d4-8b51-46b106f3a6b7
2
private void checkPseudo(String psd) throws Exception { if ( psd != null && psd.length() < 3 ) { throw new Exception( "Le pseudo doit contenir au moins 3 caractères et aucun caractère spécial." ); } }
5221d48a-c048-40f0-a425-c6f4505461c6
2
public static void main(String[] args) { // Filling Arrays int[] oneThroughTen = new int[10]; for (int i = 0; i < oneThroughTen.length; i++) { oneThroughTen[i] = i + 1; } System.out.println(Arrays.toString(oneThroughTen)); // Delering Elements String[] names = { "John", "Mary", "Nancy", "B...
4a02aa42-0139-424d-a8ff-17646d75252c
7
private final void step6() { j = k; if (b[k] == 'e') { int a = m(); if (a > 1 || a == 1 && !cvc(k-1)) k--; } if (b[k] == 'l' && doublec(k) && m() > 1) k--; }
4d40b3a8-1a28-462f-9970-c21c19f87df9
8
public boolean pickedUp(){ if (player.getX() == getX() && player.getY() == getY() && !inInventory){ player.addItemToInventory(this); textShown = true; player.setTextIsShown(textShown); switch (property){ case "CPU": pickupText = "You picked up the 64-bit " + property + "!"; break; case "HDD": pi...
3225266c-2355-4de3-be57-3a2b3d41f6e6
9
private short processReadBinary(APDU apdu, short le, boolean protectedApdu) { if (hasMutualAuthenticationKeys() && (!protectedApdu || !hasMutuallyAuthenticated())) { ISOException.throwIt(SW_SECURITY_STATUS_NOT_SATISFIED); } byte[] buffer = apdu.getBuffer(); byte p1 = buffer[...
660abb1e-e970-4a47-bb8c-a54e1d94a73d
5
public static <GItem> boolean appendAll(final Collection<GItem> collection, final Iterator<? extends GItem> iterator) throws NullPointerException { if (collection == null) throw new NullPointerException("collection = null"); if (iterator == null) throw new NullPointerException("iterator = null"); boolean modified...
946e67d3-6ae1-4c36-9134-da70ff146f19
5
public void addPopUp(ActionListener listener) { //Define the popup popup = new JPopupMenu(); menuItem = new JMenuItem("Insert animation"); menuItem.addActionListener(listener); menuItem.setActionCommand("insert animation"); popup.add(menuItem); menuIte...
a6415b08-d795-4537-a7d0-752189c24365
6
@Override public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException { if (text != null) { StringBuilder builder = new StringBuilder(text); for (int i = builder.length() - 1; i >= 0; i--) { int cp = builder.code...
1567c03e-5041-4a11-82c6-2f3842c4f071
4
private String symmetricConcat(String a1, String a2) { String s1, s2; if(a1.length() <= a2.length()) { s1 = a1; s2 = a2; } else { s1 = a2; s2 = a1; } for(int i = 0; i < s1.length(); i++) { if(s1.charAt(i) < s2.charAt(i)) { return s1+s2; } else if(s1.charAt(i) > s2.charAt(i)) { retur...
ff0a2b95-398f-4468-9c18-280a9cd282b5
6
@EventHandler public void ZombieHeal(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Zombie.Heal.Dodge...
e776d6cc-ff45-42c9-aa94-e525d04194c5
0
public JSplitPane getjSplitPane1() { return jSplitPane1; }
17593184-982e-4232-844b-ca908da69921
5
public static Vector<Map<Integer,Double>> readDB(File file) throws IOException { BufferedReader in = new BufferedReader(new FileReader(file)); Map<Integer,Integer> uid2raw = new HashMap<Integer,Integer>(); Vector<Map<Integer,Double>> rawData = new Vector<Map<Integer,Double>>(); int prevUid = -1; int...
1f36542f-494a-4d0d-9e1f-996cfaa8961f
7
public static void main(String[] args) { Connection conn = null; Statement stmt = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger"); conn.setAutoCommit(false); stmt = conn.createStatement(); ...
d13eeb43-dfec-46a0-aaf1-5bd69747b2d5
0
public void setAccountStatus(String accountStatus) { this.accountStatus = accountStatus; }
1ce428d3-65f7-416e-9028-ceb7924b335a
3
private int getIndexFromData(ListModel<? extends T> model, T data) { for (int i = 0; i < model.getSize(); i++) { if (model.getElementAt(i) == data) { return i; } } return -1; ...
3485542b-f756-427d-9e3f-30ebf0db9d15
2
public UrlWrapper resolve(String url) throws MalformedURLException { String fullUrl; if (url.startsWith("//")) { fullUrl = "http:" + url; } else if (url.startsWith("/")) { fullUrl = baseUrl + url; } else { fullUrl = url; } LOG.debug(for...
92114611-568c-410f-a1bd-48a020d0cf06
9
public void onEntityDamage(EntityDamageEvent event) { Entity entity = event.getEntity(); if(entity instanceof Player){ Player player = (Player) entity; if(event.getCause().equals(DamageCause.ENTITY_ATTACK)) { if (entity.getLastDamageCause() instanceof EntityDamageByEntityEvent) { ...
82f29b01-3a87-4577-89f4-20bcfeb721a8
7
public double outputValue(boolean calculate) { if (Double.isNaN(m_unitValue) && calculate) { if (m_input) { if (m_currentInstance.isMissing(m_link)) { m_unitValue = 0; } else { m_unitValue = m_currentInstance.value(m_link); } } else { //node is an output. m_unitValue = 0...
ef871898-7ca6-4738-82a0-7852dad3e590
9
public void addSetpiece(Set<Setpiece> allObjects) { List<Setpiece> list = new ArrayList<Setpiece>(allObjects); Setpiece temp = null; for(int a = 0; a < allObjects.size(); a++) { temp = list.get(a); int x = r.nextInt(world.length*102); int y = r.nextInt(world.length*102); int length = temp...
72546123-73bf-4fac-9cfc-a602ea01d7d8
3
public static String format(byte[] data) { StringBuilder result = new StringBuilder(); int n = 0; for (byte b : data) { if (n % 16 == 0) { result.append(String.format("%05X: ", n)); } result.append(String.format("%02X ", b)); n++; if (n % 16 == 0) { result.append("\n"); } } result.ap...
b5488e9d-e693-413f-8a62-fab62e49c40b
7
private static Point translator(String s) { //Метод для перевода строки в double и интерпретации пользовательского выбора String[] a = s.split(" "); //Разделение строки double[] a1 = new double[a.length]; try { for(int i=0; i<a.length; i++){ //Перевод в double ...
7829de9a-4c8d-461e-ac55-65dc5a19f6c1
5
private static String getColorName(int selection) { switch (selection) { case RED: return "RED"; case WHITE: return "WHITE"; case YELLOW: return "YELLOW"; case GREEN: return "GREEN"; case ...
e28043f3-6be1-4c7a-884b-beebf9f206ca
4
private void closeConnection() { logger.finer("Closing connection to server"); synchronized(CONNECTION_LOCK) { if(receivePacketThread != null) receivePacketThread.stopReceiving(); if(timeoutThread != null) timeoutThread.stopTimeout(); if(pingThread != null) pingThread.stopPinging(); if(socke...
cf6fa819-1979-414b-9a45-5737282251c1
7
public boolean digest(byte data) { if (count < 0) { throw new IllegalArgumentException("ZMessage is complete, and cannot digest more data"); } else if (count == 0) { this.length = data; this.txOptions = null; if (length > 3) { this.payload ...
a83737a3-628f-49e1-9151-ade41cf7db7a
9
private boolean isNewFeatureRecursive(HashSet<BoardPosition> searched, HashSet<BoardPosition> toSearch) { // Take a position from the toSearch map. Iterator<BoardPosition> toSearchIterator = toSearch.iterator(); BoardPosition boardPosition; if (toSearchIterator.hasNext()) { boardPosition = toSearchItera...
5601e74a-41bc-4392-ac9e-7e39e9f74d39
9
private boolean doDepthSearch(SimulationBrick simBrick) { boolean flawFound = false; // ignore already finished bricks (and those with delay) if (finished.contains(simBrick) || (simBrick.getBrick().hasDelay() && checkForZeroDelay)) { return false; } ...
0d53c7c7-945e-41fb-afa6-050a8b0fc75c
0
public void setActiveUserId(long id) { this.set("activeUserId", id); }
f4b5351d-f337-4ba3-a8a1-a3bc59aba2e2
3
private static String getReplacement(String type) { switch (type) { case "bold": return "<strong>$1</strong>"; case "italic": return "<em>$1</em>"; case "quote": return "<font color=\"green\">$1</font>\n"; } ...
e9349f5d-cd95-45de-b1f0-6ac9d1e5556c
1
private void updateGUI(){ int [] data = new int [11]; for(int i = 0; i<11; i++) data[i] = this.doc_queues.get(HospitalPart.values()[i]).size(); this.plotter.setData(data); }
800f17a9-4c07-495b-a459-5d9418bff1a3
8
public void printSolution(ArrayList<Node> closedNodes, ArrayList<Node> deadEndList) { // Closed nodes will use "X" symbol for (Node closed : closedNodes) { this.maze[closed.getX()][closed.getY()] = "X"; } System.out.println(); System.out.println("--- Solution path ---"); for (int x = 0; x < size.getX(); ...
d297c6f9-a92d-4ece-bb90-95a58dc6a4ad
7
public void loadAlphabets(String filename) { try { File f = new File(filename); Scanner s = new Scanner(f); String line = null; List<String> dot_mat_alpha = new ArrayList<String>(); if (s.hasNext()) characters = s.nextLine(); int i = 0; while (s.hasNext() && (line = s.nextLine()) != null ...
2919a8a8-2d23-40b1-87fc-5808b8db9865
4
public void extendX(int startX, int eindX, int startY, int eindY){ //extend de rij op startX tot op eindX, in de range van startY tot eindY for(int y = startY; y <= eindY; y++){ if(this.contains(new Positie(startX, y))){ int startLoopX = startX; int eindLoopX = eindX;...
28180db6-d375-40af-9d70-1f257b7952a8
4
public void draw(Graphics g, Player p){ int s = p.getCurrentSec()-1; if(p.getCurrentCity() == 1){ if(p.getInside()){ c1i.draw(g, p.getCurrentBuilding()); }else{ for(int i = 0; i < 1200; i++){ if(i < 1200){ g.drawImage( city1[s][i].getImage(), city1Blocks[i].x, city1Blocks[i].y, null...
d31b68e2-d9a1-49b5-b61a-54d98397973e
9
private Result pTypeQualifier(final int yyStart) throws IOException { Result yyResult; Node yyValue; ParseError yyError = ParseError.DUMMY; // Alternative 1. yyResult = pKeyword(yyStart); if (yyResult.hasValue("volatile")) { final String v$g$1 = "volatile"; yyValue = GNo...
84bd7825-5ac2-4e44-a9f0-bd0acbed662c
5
public void preorderV(TreeNode root){ if(root!=null){ LI.add( root.val ); LT.add( new GotLR(root.left!=null?true:false, root.right!=null?true:false) ); if(root.left!=null){ preorderV(root.left); } if(root.right!=null){ preorde...
8f9593e4-6139-4b9e-b570-3616187bd24a
4
public static boolean varObjectExists(int objectX, int objectY, int objectHeight) { for (VariableObject vo : varObjects) { if(vo.getHeight() != objectHeight) continue; if(vo.getX() == objectX && vo.getY() == objectY) return true; } return false; }
87f6d332-a6d2-4b15-ad4f-2e8cc85b5902
7
private void checkInvariants(IndexWriter writer) throws IOException { _TestUtil.syncConcurrentMerges(writer); int maxBufferedDocs = writer.getMaxBufferedDocs(); int mergeFactor = writer.getMergeFactor(); int maxMergeDocs = writer.getMaxMergeDocs(); int ramSegmentCount = writer.getNumBufferedDocumen...
0206e12c-3ece-4ca4-9ecf-3400a2248086
3
@Override public void ParseIn(Connection Main, Server Environment) { Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom); if (Room == null || !Room.CheckRights(Main.Data, true) || Room.MoodlightData == null) { return; } Room.MoodlightData.Enab...
10961c33-977b-4a20-8361-387f20376f1a
5
boolean isPartiallyShadowed(final double low, final double high) { for(Interval interval : list) { if((interval.low < low && interval.high > low) || (interval.low < high && interval.high > high)) { return true; } } return false; }
e7a89e2b-253f-43e6-83bd-95c315bbd456
4
@Transactional public void onApplicationEvent(ContextRefreshedEvent event) { if ( installDefaultAdminUser && defaultAdminUsername != null && defaultAdminPassword != null ) { User admin = userService.findByUsername("admin"); if (admin == null) { admin = new User(); admin.setUsername(def...
eaef08e8-a82f-4bfa-a22a-a11a2717c08b
9
private boolean checkSameTileMove(TileCell currentCell, TileCell targetCell) { boolean a = currentCell.isBuilding() && !currentCell.isDoor() && targetCell.isRoad(); boolean b = currentCell.isRoad() && targetCell.isBuilding() && !targetCell.isDoor(); boolean c = !targetCell.isRoad(); boolean d = GameHandler.ins...
723b0141-5a99-4b40-9ef3-fe6121a6f633
1
private ApplicationFrame createApplicationFrame(){ return new ApplicationFrame(new ActionListenerFactory() { @Override public ActionListener createActionListener(final String action) { return new ActionListener(){ @Override public...
394ae597-939a-4e9f-8c26-34369dad5b79
4
private static boolean containsOnlyDigits(String str) { if (str == null || str.length() == 0) return false; for (int i = 0; i < str.length(); i++) if (!Character.isDigit(str.charAt(i))) return false; return true; }
568abfa8-64fb-429a-8e62-54a5b868fb96
2
void float_mat(float[][] matric){ for(int i=0;i<cnt;++i) { for(int j=0;j<cnt;++j) { matric[i][j] =1; } } }
e5c166a8-665c-4d17-93f3-065154db6833
4
public static Collection<BigInteger> factorize(BigInteger n) { Collection<BigInteger> factors = new ArrayList<>(); factors.add(BigInteger.ONE); BigInteger test = BigInteger.valueOf(2); boolean resume = true; do { switch (test.multiply(test).compareTo(n)) { case 0: factors.add(test); break; ...
1606ae23-bdaf-40a7-90f7-5b8466ad7dbe
5
private void parsePhotoResponse(String jsonResponse, String queryText, List<FlickrPhoto> tempList) { JSONParser jsonparser = new JSONParser(); try { JSONObject response = (JSONObject) jsonparser.parse(jsonResponse); JSONObject responsePhotos = (JSONObject) response.get("photos"); int page = Integer.par...
c4bd930b-4ce4-47cd-8a70-6b632e683f1e
9
public static long maxPandigitalPrime() { long maxPandigitalPrime = 0, startPos = 0, digitsSum = 3; boolean foundPrime = false; //Find the first pandigital not divisible by 3 for(int i = 9; i > 0 && digitsSum % 3 == 0; i--) { digitsSum = 0; for(int j = 1; j <= i; ...
fc7bf615-e860-43ba-bd79-0e7469df5985
9
@Override protected void inicialitzaPanellPeu() { Object[][] elements_de_control_jugadors = PresentacioCtrl.getInstancia().getElementsDeControlJugadors(); boolean es_partida_ia = ( ( TipusJugadors ) elements_de_control_jugadors[0][0] ) != TipusJugadors.JUGADOR && ( ( TipusJugadors ) elem...
7a57b62d-f0f9-4126-b2dc-fb864120799b
1
public static boolean WriteSuffix(String hostname, String suffix) { Suffixes.add(hostname + " " + suffix); try { BufferedWriter writer = new BufferedWriter(new FileWriter(SuffixesFile, true)); writer.write(hostname + " " + suffix + "\r\n"); writer.close();...
cc316455-044f-4ae2-ad95-7714228055b3
7
public MediaEditor() { super("Video Player"); mediaPlayerComponent = new EmbeddedMediaPlayerComponent(); // setContentPane(screen); setLocation(250,150); setSize(1150, 730); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); panel = new JPanel(); panel.setLayout(new BorderLayout()); ...