method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3af2f5fd-1c26-4aed-9844-9d861b25181c
0
public void setEspTitle(String title) { this.espTitle.add(title); }
0d2df44a-ba30-4bdf-bd41-efea7dadfc42
4
private void painaAlas(int paikka) { int pieninLapsi; //Käydään läpi niin kauan kun ei olla puun lehtitasolla while (!onkoLehti(paikka)) { //Vasemmalla on aina pienempi lapsi pieninLapsi = vasenLapsi(paikka); // if ((pieninLapsi < koko) && (Taulu[pieninLap...
123e42d0-e085-4c10-b3f1-fa84b88d6541
7
@FXML public void updateQ(ActionEvent evt) { try { String q = qEd.getText(); String a = aEd.getText(); String o1 = o1Ed.getText(); String o2 = o2Ed.getText(); String o3 = o3Ed.getText(); String o4 = o4Ed.getText(); ...
003ad64c-d630-4572-a605-d4f49ff2cbf4
4
public void addInterface( Class<?> serviceInterface ) { final RemoteInterface remoteInterface = serviceInterface.getAnnotation( RemoteInterface.class ); final int interfaceId = remoteInterface.id(); entries = ensureIndex( entries, interfaceId ); final int methodMax = getMaxRemoteMe...
2baca5b8-3281-4311-8ed9-3418468df80c
0
public Game createGame() { Game newGame = gameGenerator.generate(); addGame(newGame); return newGame; }
ed2332e0-b568-4368-a717-a279993db887
9
public static String toHankakuCase(String str) { int f = str.length(); char[] chars = {0xFF9E, 0xFF9F}; StringBuilder buffer = new StringBuilder(); for(int i=0;i<f;i++) { char c = str.charAt(i); if(Z2H.containsKey(c)){ buffer.append(Z2H.get(c)); } else if(0x30AB <= c && c <= 0x30C9){ buffe...
20c775c2-6694-45f5-b65e-fab4041d8ea9
3
public void visitTree(final Tree tree) { if (to instanceof Stmt) { ((Stmt) to).setParent(tree); // The most common statement replacement is the last statement. // so search from the end of the statement list. final ListIterator iter = tree.stmts .listIterator(tree.stmts.size()); while (iter.hasP...
a7110284-3658-4f4c-9ed0-d95e15ed3c96
2
@Test public void testGetAllAvailableCaptures() { System.out.println("getAllAvailableCaptures"); Board board = new Board(8, 12); RuleManager instance = new RuleManager(); SetMultimap<Position, Position> expResult = HashMultimap.create(); SetMultimap<Position, Position> result...
882be5c2-0620-420a-a16e-70e95378a926
9
public static ArrayList<String> parseStringToArray(String txt, String sep, int mode) { String text = ""; txt = txt==null?"":txt; if(mode==1) { text = txt.toUpperCase(); } else { text = txt; } ArrayList<String> out = new A...
2e6b2474-5a9c-4ce1-8cca-bc13e7bf72eb
3
public Movie(final String dataLine) { final int startIndexYear = dataLine.indexOf('(') + 1; final int endIndexYear = Math.min(dataLine.indexOf(')', startIndexYear), startIndexYear + 4); final int startIndexActors = dataLine.indexOf('/'); this.title = dataLine.substring(0, startIndexYear ...
1db3011c-ed10-4440-a284-ab78e7d8cfd9
2
public void addGetMethod(Field field, Method method) { if(field == null) { throw new IllegalArgumentException("Field cannot be null"); } FieldStoreItem item = store.get(FieldStoreItem.createKey(field)); if(item != null) { item.setGetMethod(method); } else ...
8a1cf631-d729-4a76-8140-33309f349c7e
2
@Override protected Void doInBackground() throws Exception { try { controlUnit.activate(); } catch (NullPointerException e) { JOptionPane.showMessageDialog(null, "Assembly program logic error! Please ensure program logic is sound."); } catch (ClassCastException e) { JOptionPane.showMessage...
622dd141-8ccc-47b7-aca8-a59e1129a606
4
public void Extract(Object oo) throws IOException { //ID if(oo instanceof ClientHandeler){ ClientHandeler client = (ClientHandeler)oo; System.out.println(client.id + " Just Connected"); this.clients.add(client); } //IMAGEM else if(oo instanceof ImageDto){ ImageDto image = (ImageDto)oo; /...
723a86aa-0331-4312-89fc-c68b4c631edf
2
private void actionAdd(HttpServletRequest request, RequestData rd, Class clazz){ try{ Object obj; obj = helper.addElement(clazz, request.getParameterMap()); if (obj == null) request.setAttribute("error", "Не удалось добавить объект"); } catch (RuntimeExcep...
43699dcf-b6e3-405c-b5db-f3829ce7a8cf
6
private boolean r_other_endings() { int among_var; int v_1; int v_2; int v_3; // (, line 141 // setlimit, line 142 v_1 = limit - cursor; // tomark, line 142 if (cursor < I_...
4e37f00b-2c62-41bd-b90a-6f2040452ae4
5
public String whoHasLargestArmy() { // The current owner of the largest army keeps the largest army // in the event of a tie String defendingOwner = this.largestArmyOwner; int defendingOwnerSize = this.largestArmySize; String updatedLargestArmyPlayer = null; ...
4a7833f0-50ca-444c-baf9-bdf0f5527328
3
public void totalRun(HashSet<Long> completedUsers, TreeMap<Long, Long> parent, TreeMap<Long, Integer> local, TreeMap<Long, Integer> total) throws InterruptedException { for (Entry<Long, Integer> e : total.entrySet()) { if (!tr.containsKey(e.getKey())) tr.put(e.getKey(), new UserNode()); UserNode...
4a0d8950-6b79-4265-9abf-1680d8f09dc8
9
static int getCantidad(char[][] matG, char[][] matP){ int cant = 0; for (int i = 0; i < matG.length; i++) for (int j = 0; j < matG.length; j++) { boolean ws = true; for (int k = 0; k < matP.length && ws; k++) for (int h = 0; h < matP.length && ws; h++) ws = i+k<matG.length && j+h < matG.lengt...
1a498994-077a-4db9-a759-327018382a97
5
public static void execute(final Executable[] p_executables, final int p_threadCount) { final ExecutorService executorService; final Future<?>[] futures; Contract.checkNotEmpty(p_executables, "no executables given"); Contract.check(p_threadCount > 0, "invalid thread count given"); executorService = Executor...
5afc5504-c2d9-4791-bf1a-7c8a0dd778f3
7
private boolean isLegit(int col, int row, int currentPlayer) { return checkHorizontallyLeft2Right(col, row, currentPlayer) || checkHorizontallyRight2Left(col, row, currentPlayer) || checkVerticallyTop2Bottom(col, row, currentPlayer) || checkVerticallyBottom2Top(col, row, currentPlayer) || ...
44383b79-a735-406c-8da7-496e74b30cae
4
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed /* Muestra los datos de las ventas realizadas filtradas segun el rut del cliente que realizó la compra, * los datos son almacenados en un TableModel y mostrados en la tabla 2 de la clase administrado...
0a38053e-4f48-4a47-85e7-252cf888bdf9
5
@Override public boolean move(int row, int col) { //Vertical if (this.col == col && this.row != row) { this.row = row; return true; //Horizontal } else if (this.row == row && this.col != col) { this.col = col; return true; } else if (Math.abs(this.row - row) == Math.abs(this.col - col)) { t...
617a0642-a826-4826-a972-5c71159fb14b
7
private JSONWriter append(String s) throws JSONException { if (s == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write(','); ...
a5a3ddc2-9540-4b6b-b820-aa8f9b8bbf89
4
public ArrayList<String> getOfflineUsers(String userItself) { System.out.println("getOfflineUsers"); ArrayList<String> offlineUsers = new ArrayList(); File file = new File(userFilePath); if (file.exists()) { System.out.println("file exists"); try { ...
3c77185e-b6ba-4dbb-920b-4699ebbc6ca8
0
@SuppressWarnings("unchecked") @Override public <T> T getRequiredService(Class<T> serviceType) throws Exception { return (T) this.getRequiredService2(serviceType); }
7f46f71c-b17b-4be5-ba61-841b2f6ac33a
2
private List<Hex> getRandomChits(List<Hex> defaultHexes) { ArrayList<Hex> randomChits = new ArrayList<Hex>(defaultHexes); List<Integer> randomValues = ModelDefaults.getDefaultNumbers(); randomizeList(randomValues); int chitIndex = 0; for(Hex hex : randomChits) { if(hex.getResourceType() != null) { hex....
1dc6e3b4-bdb0-4ba4-a26c-474b0ae1de0d
5
@Override public Boolean isPolinomeRepresentationValid(String input) { if(input.isEmpty()) return false; String[] allow = {"-", "+", "x", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}; String aux; int error_detector = 0; for (int i = 0; i < input.length(); i++) { ...
d7158a09-8bce-4fc8-8bdf-bc2eb2adf356
3
@Override public void commitTransaction() throws SQLException { try { this.connection.commit(); } catch (SQLException e) { try { this.connection.rollback(); } catch (SQLException e2) { throw new DBException("error rolling back tra...
470f14ee-77b8-4f7e-8982-230ff6457445
1
public HbaseConfModel getHbaseConfModel() { HbaseConfModel hbaseConfModel = new HbaseConfModel(); JsonNode node = rootNode.get("HBase"); hbaseConfModel.setExecute(node.get("execute").getBooleanValue()); // resource JsonNode resouceNode = node.get("resource"); List<String> resouceArray = new ArrayList<Str...
04d42f58-a5a8-4efa-9ff9-1d8ad2e0f3aa
0
public void setPosition(Point position) { this.exactPostitionX = position.x; this.exactPostitionY = position.y; }
60fee18e-aa33-4c2b-a0ec-5a5f92a889ff
2
public StructuredBlock getNextBlock(StructuredBlock subBlock) { for (int i = 0; i < caseBlocks.length - 1; i++) { if (subBlock == caseBlocks[i]) { return caseBlocks[i + 1]; } } return getNextBlock(); }
16a70158-de1d-430a-88fc-a1d5bf63a2e6
4
public static MarioData load() { MarioData marioData = null; ObjectInputStream savedGame = null; File a; a = new File(System.getProperty("user.home") + "\\.Awesome Mario Remake\\MarioData.save"); try { if (!a.exists()) { a.crea...
9d794c38-2f4a-4622-a995-f2152fc87512
6
public int[][] spawnCaves(int[][] currentBlockArray, int caves, int minX, int maxX, int minZ, int maxZ) { ArrayList maxCaveSpots = new ArrayList(); for(int i = 0; i < caves*3; i++) { int iMax = getMaxZCaveSpot(); int[] caveSpot = null; if(iMax > -1) { ...
1f40e112-ea59-4de0-a05b-df29e5a5da52
5
private GSprite getSpriteForState(ButtonState buttonState) throws IllegalArgumentException { // Make sure the state is non-null. if (buttonState == null) { // The state is null. throw new IllegalArgumentException("state == null"); } // First, see what we've got. GSprite i = sprites.get(buttonState);...
6ce081d6-9e69-4ff5-b81d-13c797e255b9
0
public GUI(World w) { hexgrid = new HexGrid(this); hexgrid.createAndShowGUI(); }
24e817ff-1aa9-49bf-96eb-612fff60582a
9
public void map(Object key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); String[] segment = line.split("\t");// 原始数据为(实体编号+实体属性向量) // 读取实体属性向量 char[] entityFeature = segment[1].toCharArray(); if (entityFeature.length != EntityDriver.DIMENSION) { ...
11d247a1-a36a-4f78-b014-198ae012eb3d
2
private RegistrationNumber(char letterIdentifier, int numberIdentifier, String stringRepresentation){ Random randomLetterIdentifier = new Random(); this.letterIdentifier=(char)(randomLetterIdentifier.nextInt(26) + 'a'); if (Character.isDigit(letterIdentifier)) throw new IllegalArgumentException("That is not a...
13dafef7-cb88-420f-b63e-fc34e9cf9384
2
@Override public void addTextBack() { Element textBack = text.getOwnerDocument().createElement("path"); String d = "M"; for (Coordinate c : geometry.getCoordinates()) { if(d.length()>1){ d=d+" L"; } d = d + " " + c.x + "," + c.y; } textBack.setAttribute("d", d); textBack.setAttribute("style", ...
4f3fc7cf-dd19-4a58-bad0-b9b78e54a578
4
@SuppressWarnings("unchecked") public static final byte[] encode(Object o) throws BencodingException { if(o instanceof HashMap) return encodeDictionary((HashMap)o); else if(o instanceof ArrayList) return encodeList((ArrayList)o); else if(o instanceof Integer) ...
c43bbe78-3eb5-4d17-aae5-bb8974f52bc0
0
public int getManagerFirewallId() { return managerFirewallId; }
fe7dca61-a27f-4cb8-93fe-2cf5655593f2
5
public boolean isIn(String key, String value) { String ligne; String usr; String psw; try { while ((ligne = _br.readLine()) != null) { int a = 0; while (ligne.charAt(a) != '@') { a++; } usr =...
dde3b492-9849-45c1-995f-56509c1b4ac2
5
@Override public void mouseReleased(MouseEvent e) { // Called after a button is released mx = e.getX(); my = e.getY(); if(!main.hasAbilitySelected()) { if(e.getButton() == MouseEvent.BUTTON1) { // Left button released LinkedList<ClickableObject> selection = new LinkedList<ClickableObject>(); int x = ...
db88f27d-609d-40d8-aeb7-1f3c37376391
9
public Boolean executeStep(AbstractBuild build, SkytapGlobalVariables globalVars) { JenkinsLogger.defaultLogMessage("----------------------------------------"); JenkinsLogger.defaultLogMessage("Creating Template from Environment"); JenkinsLogger.defaultLogMessage("----------------------------------------"); ...
a38ba27a-1e08-4999-9d82-da38bdb54c50
7
public void run() { Scanner scn = new Scanner(System.in); int testCount = scn.nextInt(); // Loop through all test cases. for (int testItem = 1; testItem <= testCount; testItem++) { int numVertices = scn.nextInt(); int numEdges = scn.nextInt(); // create adjacency Matrix adjacen...
862f37c9-5638-4ac5-a096-7427b12d7209
3
public String getReplicaAddress() { if (slaveAddresses.isEmpty()) { return masterAddress; } else { // randomly give a slaveAdress back int size = slaveAddresses.size(); int item = new Random().nextInt(size); int i = 0; for (String obj : slaveAddresses) { if (i == item) { return obj; ...
c298257b-af57-415b-b310-8045e9d95e77
9
protected boolean acceptable(ContentHeaderMap contentHeaderMap) { if (allowedExtensions == null && allowedTypes == null) return true; if (allowedTypesSet != null && contentHeaderMap.getContentType() != null) { if (allowedTypesSet.contains(contentHeaderMap.getContentType())) { return true; } else { ...
64ef52fb-6544-49fe-af12-8bb284aa1eae
4
public boolean addCoffer(OfflinePlayer player,Chest chest){ if(player==null || chest==null) return false; if(isStore(chest)) return false; if(isCoffer(chest)) return false; coffers.put(chest, player); saveCoffers(); return true; }
725b7fdf-0c16-451c-b2a1-f75efc0ad3c6
0
@Test public void testProxy() { Person person = PersonImpl.personWithNameAndAge("test", 100); Person proxyPerson = ObjectProxy.newInstance(person, new ObjectProxy.Interceptor() { @Override public Object around(Object result) { System.out.println("Modifying 100...
0e090f0b-887c-4e5b-afab-083f4fd458f4
7
private void afficherFenMoreInfo(Match m) throws IOException, SQLException { //Affichage joueurs if (m != null) { PlayerDao pdao = DaoFactory.getPlayerDao(); Player p1 = pdao.selectPlayer(m.getIdP1()); Player p2 = pdao.selectPlayer(m.getIdP2()); moreInfo_l...
4d14b548-f720-452f-898f-aabea8379210
5
public void insertWord(int _internalId, int _dom, String _lemma, String _link, String _word, String _partOfSpeech, List<String> _properties,List<String> _propertiesValues, int _sentenceId){ try{ String generatedStatement = "INSERT INTO words (internalId, domid, lemma, link, word, partOfSpeech"; ...
290e709e-772b-4ba2-bbe3-1ac613f7ae3e
3
public void detectCollision() { for(int i=0; i<EntityManager.getEntityList().size(); ++i) { if(EntityManager.getEntityList().get(i) instanceof GameBaseEntity) { if(this.getGlobalBounds().intersection(EntityManager.getEntityList().get(i).getGlobalBounds()) != null) { ...
81ebbd4d-d15c-472d-a27c-f64ae667818a
5
private String createHashBase() throws IOException { if( !this.resource.isOpen() ) throw new IOException( "Cannot create an ETag from an un-opened resource!" ); StringBuffer buffer = new StringBuffer(); // Add the request path // (better than the inode number, I think) if( this.relativeURI != null ) { ...
5dc89c71-9448-4af3-b44f-02429da9b282
3
@Override public void close() throws SQLException { if(resultSet != null) { resultSet.close(); resultSet = null; } if(statement != null) { statement.close(); statement = null; } if(conn != null) { conn.close(); conn = null; } }
e14ba129-0cc9-4f1d-9ca3-79d20485e934
0
public void setBlogLabel(String blogLabel) { this.blogLabel = blogLabel; }
4c317298-ab2b-4686-9732-68fc5cc13604
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...
e05c4d28-e0ba-4734-a1c2-6868a098ab36
7
public YamlDataStorageImplementation(Decapitation plugin) throws IOException { this.plugin = plugin; this.configFile = new File(plugin.getDataFolder(), "bounties.yml"); if (!(configFile.exists() && !configFile.isDirectory())) { configFile.createNewFile(); } this.conf...
b0924d0f-f0e6-40dd-b16e-9d60fe0d9c22
2
public void setline(String line) { String prev = this.line; this.line = line; if(point > line.length()) point = line.length(); if(!prev.equals(line)) changed(); }
96ea0aaa-c763-4b21-9012-1e0beffbcbae
3
public static Opcode getByName(String name, Map<String, Integer> newNBOpcodes) { Opcode opcode = BY_NAME.get(name); if(opcode == null && newNBOpcodes != null) { Integer number = newNBOpcodes.get(name); if(number != null) { opcode = new Opcode(name, number<<4, Opco...
8f58b081-4958-49e9-9dd6-fb780fd30ba7
0
public void windowActivated(WindowEvent e) { System.out.println("Die Anwendung wurde aktiviert..."); }
5ebf2dd0-8e4e-4b51-9646-2534c3878225
8
public void invokeBusinessLogic( org.apache.axis2.context.MessageContext msgContext, org.apache.axis2.context.MessageContext newMsgContext) throws org.apache.axis2.AxisFault { try { // get the implementation class for the Web Service Object obj = getTheImplementationObject(msgContext); WSManag...
388f3061-d507-4db2-b0b6-13cb451f230b
8
public int lengthOfLastWord(String s) { if (s.length() == 0) { return 0; } int length = 0; boolean wordStart = false; int i = s.length() - 1; while (i >= 0) { if (s.charAt(i) != ' ' && wordStart == false) { length++; wordStart = true; } else if (wordStart == true && s.charAt(i) != ' ') { ...
ed9643a4-3e99-43ee-8033-09fa1e191f0f
2
public static void main(String[] args) { Map<String, Integer> map = new HashMap<String, Integer>(); for (String element : args) { map.put(element, (null == map.get(element) ? 1 : map.get(element) + 1)); } System.out.println(map); }
ee19600a-1d61-48c2-8ad3-3e5871f20f95
6
@Override public String toString() { final StringBuilder sb = new StringBuilder(); if (scheme_ != null) { sb.append(scheme_); sb.append(':'); } if (location_ != null) { sb.append("//"); sb.append(loc...
3859e617-5073-48d1-986f-1f55d5cd8055
6
public static String genServerStatus(String[] data) { if ((data[0] == null) && (data[1] == null) && (data[2] == null)) return "Server is offline"; if ((data[1] != null) && (data[2] != null)) { if (data[1].equals(data[2])) return "Server is full (Players: " + data[1] + " of " + data[2] + ")";...
eb1b59c6-9a6d-460d-b63f-e7242dc727cc
7
int decodevs(float[] a, int index, Buffer b, int step, int addmul) { int entry = decode(b); if (entry == -1) { return (-1); } switch (addmul) { case -1: for (int i = 0, o = 0; i < dim; i++, o += step) { a[index + o] = valuelist[...
0588542d-4f5c-47de-a651-28e7b71e86a6
7
@Override public boolean mutate(Mutation.Type type) { switch (type) { case COPY: case COPY_TREE: case CREATE_PARENT: case REMOVE: return false; case SWAP: return Mutation.swap2(rules); case REPLICATE: if (rules.isEmpty()) { return false; } Rule replicate = Utils.randomlySelect(rules); ...
59b6d428-dd38-44a6-9745-dcf0ee89b0bd
0
public FSAConfigurationIcon(Configuration configuration) { super(configuration); }
6fa744de-300a-4056-b51a-ba7c92ad9eec
1
public String toString(){ String str = element.toString(); if(program != null) str += ";" + program.toString(); return str; }
6efed814-4ec2-433d-8f2b-2157e9960d35
3
void TokenLexicalActions(Token matchedToken) { switch(jjmatchedKind) { case 20 : image.append(jjstrLiteralImages[20]); lengthOfMatch = jjstrLiteralImages[20].length(); nested.push(DEFAULT); SwitchTo(nested.peek()); break; case 21 : image.append(jjstrLiteralImag...
d0f2c486-80ec-4ee4-8d15-c375d50fac12
0
public String getValue() { return _value; }
c7d6db5b-cfee-420c-a5c0-9ee123c41ec0
5
public BookLanguage getBookLanguage(long id) { BookLanguage lng = null; Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATA...
bf2fded6-3364-4749-be6e-96fc00a81fc8
8
final public void DoStatement() throws ParseException { /*@bgen(jjtree) WhileStatement */ BSHWhileStatement jjtn000 = new BSHWhileStatement(JJTWHILESTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtreeOpenNodeScope(jjtn000); try { jj_consume_token(DO); Statement(); jj_...
3cabd6ff-146b-405c-b0bd-c7602243945f
7
public void save(final FilterDTO filter) throws DBException { class IdFiller extends PreparedStatementHandler { public IdFiller() { super(FilterDAO.this.mgr, ID_BYNAME_SQL); } @Override protected void handleResults(ResultSet rs) throws SQLException, DBException { // id or empty ...
d1ae2d39-fe66-4fc0-9f4d-9dc592121ccb
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...
4c06a2b9-3218-4bd5-a2d3-a934665c3e60
5
private void update_estimated_initial_distribution( int j, double[] bowl ) { // initialization if( 0 == j ) { assign_belief_of_initial_distribution(smoothed_distribution_count); } // Calculate the smoothed count if ( 0 == j ) { for ( int i = 0; i < pref.le...
51bd5459-f1d4-411f-b6ae-65b7fbd4305e
1
private int getPort() { int port = uri.getPort(); return port == -1 ? WebSocket.DEFAULT_PORT : port; }
d5bb49c7-b443-41e5-99b3-1e48cdb68d41
5
public void deleteNonAxisFields ( Field checkVeld , String direction ) { //System.out.println("Deleten niet-as velden..."); if (direction.equals("horizontal")) { for (int i = 0 ; i < remainingFields.size() ; i++) { Field v = remainingFields.get(i); if (checkVeld.getX() != v.getX()) { preferableField...
c4fa4f53-091c-4dc7-a026-331c2709b7df
5
@Override public ArrayList<Integer[]> selection(ArrayList<Integer[]> population, int size) { if (size > population.size()) { return population; } ArrayList<Integer[]> parents = new ArrayList<>(); Collections.shuffle(population); double[] grades = gradeEveryone(po...
30d7d9b2-eab8-4934-88ba-8d6e784d64f7
1
public void move(){ if(x < 0) x = 600; x -= 1; }
8b4e73e5-6b70-428a-bb2d-76b692094c15
3
@Override public int hashCode() { //autogenerated by netbeans for me //this is a really wierd hash int hash = 7; hash = 17 * hash + (this.value != null ? this.value.hashCode() : 0); hash = 17 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 17 * hash + (this.readonly ? 1 : 0); return hash;...
501ccb38-dc4a-4180-9e93-bcc4da121685
3
public boolean connection(String userName,String password) { boolean response=false; for(Member m : memberBean.getMembers() ) { if(m.getUsername().equals(userName)&&m.getPassword().equals(password)) { currentMember=m; response=true; } } return response; }
80232525-d958-405b-99f9-077a83d68cdb
3
public synchronized void actualiza(long tiempoTranscurrido) { if (cuadros.size() > 1) { tiempoDeAnimacion += tiempoTranscurrido; if (tiempoDeAnimacion >= duracionTotal) { tiempoDeAnimacion = tiempoDeAnimacion % duracionTotal; indiceCuadroActual = 0; ...
66c5bd42-3346-4cab-9cda-fd07044b3b97
4
@GET @Path("/feeds/{repoName}.atom") @Produces(MediaType.APPLICATION_ATOM_XML) public String getRepositoryFeed( @PathParam("repoName") String repoName, @Context HttpServletRequest request) { if (StringUtils.isEmpty(repoName)) { throw new WebApplicationExc...
bcdd49c6-f056-4ff0-ac93-099c461f9920
7
public ArrayList<Product> Build(){ FileReader fr= null; try{ fr = new FileReader("C:\\Users\\Canary\\Documents\\NetBeansProjects\\WebApplication1\\src\\java\\Files\\ListaProductos.txt"); BufferedReader bf = new BufferedReader(fr); String sCadena; String ve...
c762d77a-6c19-4023-be0b-bf1d78945eba
4
@Override public List<Scroll> selectPlays(GameState state) { List<Scroll> plays = new ArrayList<Scroll>(); List<Scroll> hand = new ArrayList<Scroll>(state.getHand()); Collections.sort(hand, new Comparator<Scroll>() { @Override public int compare(Scroll lhs, Scroll rhs) { //This fails for costs at th...
7e30948e-a662-4b7b-ab63-78d7b7a999eb
6
boolean testLookAhead(TokenID token) { Token afterNextSymbol = null; try { afterNextSymbol = scanner.yylex(); if (afterNextSymbol != null) { scanner.yypushback(afterNextSymbol.text().length()); } } catch (java.lang.Error e) { // will be thrown when next symbol is EOF // in this case null is a ...
e8e7a2fd-2b8d-440d-9eb1-91acf57e33e5
3
private boolean isValidPosition(Position newPos, int width, int height) { return newPos.xCoordinate >= 0 && newPos.yCoordinate >= 0 && newPos.xCoordinate < width && newPos.yCoordinate < height; }
203b21ad-fdb7-4a00-82d6-fbb52d1f5c65
8
@Override public <SM, TM, SR, TR> TR execute(final MapReduce<SM, TM, SR, TR> mapReduce, SM source) { final Collection<TM> slices = mapReduce.getMapper().map(source); TR result = null; if (slices != null && !slices.isEmpty()) { final List<Future<SR>> futures = Lists.newArrayList(); final CountDownLatch cou...
32dc7d62-b463-47c4-876c-5c5a4bf1ade4
4
protected void requestPlayerInput(Game game) { ElapsedCpuTimer ect = new ElapsedCpuTimer(CompetitionParameters.TIMER_TYPE); ect.setMaxTimeMillis(CompetitionParameters.ACTION_TIME); Types.ACTIONS action; if (game.no_players > 1) { action = this.player.act(game.getObservat...
c30169fe-b118-4798-b851-a15ce8929102
8
private void readEvalPrint() { buffer = new BufferedReader(new InputStreamReader(System.in)); String arguments[] = null; while (true) { System.err.print("> "); try { arguments = inputParse(buffer.readLine()); /** invokes the name corresponding to command requested **/ if (arguments[0].equals(...
a8d343f8-db99-41cb-9910-3b468e8d6673
8
public String lookup(int value, String type) { String result = null; Iterator it; System.out.println("TYPE:" + type); // this is where we look up rules defined in our two dimensional matrix, // sorted by contextual type (i.e., temperature) switch (type) { ...
999432f7-1bd8-4ac2-9908-1c2c84afbb1a
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RID other = (RID) obj; if (id != other.id) return false; return true; }
29dd5817-5ede-4fcd-b146-19e21f31c65e
0
public RODashboardData() { lastPacketTime = -1; lastUptime = -1; robotState = -1; lastFirmwareVer = -1; validRxPackets = 0; invalidRxPackets = 0; bundles = new ArrayList<String>(); }
4ed53dac-8c6f-49e7-8f98-eb5344f5dac2
0
void showIndicator(Label indicator) { clearIndicator(); hboxIndicator.getChildren().add(indicator); }
d9184f18-50a7-4672-8bc5-53b0c22c206a
0
public Grid createGrid() { // Random random = new Random(); // Grid gg = new Grid(30 + random.nextInt(20), 30 + random.nextInt(20), 0, 0, 3, 3); // CellIterator iterator = gg.getCellIterator(); // for (CellIterator ci = gg.getCellIterator(); ci.next();) { // ci.setAliveInNextGeneration(random.nextBoolean...
cc97f662-7acf-4dde-81ff-3b92c8613fd3
4
public void mouseReleased(MouseEvent e) { if (currentElement == null) return; else if (currentElement instanceof Spring) { Point2D.Double p= new Point2D.Double(0,0); MyWorldView.SPACE_INVERSE_TRANSFORM.transform(e.getPoint(),p); Spring spring = (Spring) currentElement; ...
308d7929-bf1a-4b09-8f6f-753ff14d3cd4
5
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void handleBlockBurn(BlockBurnEvent event) { if (!WorldManager.getInstance().isFireSpreadAllowed()) { if (Cuboid.getCuboid(event.getBlock().getLocation()) == null) { event.setCancelled(true); } else { Cub...
bcc7acec-82b5-4e2f-8b04-0feab2aa9fdc
3
void init_validation() { try { /* Run sharding (preprocessing) if the files do not exist yet */ sharder_validation = IO.createSharder(training + "e", 1); if (!new File(ChiFilenames.getFilenameIntervals(training + "e", nShards)).exists() || !new File(training + "e.matrixinfo").exists()) { ...
42d6ed8e-ae1a-4164-a9df-e3c3428ae556
0
public void setPlayerTwoWin() { currentState = States.PlayerTwoWin; }
095564cd-0d41-407f-bf49-6781e3c979f4
9
protected int diff_commonOverlap(String text1, String text2) { // Cache the text lengths to prevent multiple calls. int text1_length = text1.length(); int text2_length = text2.length(); // Eliminate the null case. if (text1_length == 0 || text2_length == 0) { return 0; } // Truncate th...