method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e548ee4f-17c2-4a70-9742-4579f563e4fa
3
public void acquireFocus() { Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner(); Component content = getCurrentDockable(); while (focusOwner != null && focusOwner != content) { focusOwner = focusOwner.getParent(); } if (focusOwner == null) { EventQueue....
14606836-eb8f-4c38-b1ff-26b9069f629e
3
public static void printMap(Map<? extends Object, ? extends Object> m) { for (Object o : m.keySet()) { System.out.println(o.toString() + ": " + m.get(o).toString()); } }
031459a9-ab4e-4343-bef7-a7350b2b2fc0
3
public String preCreateTopic() { objectives = objModel.getAll(); boolean check = true; if (objectives.isEmpty()) { addFieldError("topic.objId", "Objective List is empty"); check = false; } if (check) { for (ObjectiveObj objectiveObj : objecti...
f4474cc9-f220-43e4-a590-c08a665a98eb
9
public void updatePosition() { if (xPos < xDestination) xPos+= 2; else if (xPos > xDestination) xPos-= 2; if (yPos < yDestination) yPos+= 2; else if (yPos > yDestination) yPos-= 2; if (xPos == xDestination && yPos == yDestination) { if (command==Command.GoToSeat) agent.msgAnimationFinishedGoT...
f7419094-5935-4d30-b78b-68d730af7fc3
2
public Game(Playmode playmode){ this.playmode = playmode; this.upcomingMatches = new PriorityQueue<>(); this.finishedMatches = new PriorityQueue<>(); this.runningMatch = null; this.alstLeftUser = new ArrayList<>(); ArrayList<User> alstUsers = new ArrayList<>(); for (Team team : playmode.getTeams()) { ...
6a1106c3-211e-4fd7-98a0-ec9eba0a0d32
7
public void Faz_Tudo(String arq, int max) { Leitor le; Celula[][] mapa_lido; int[][] mundo_int = null; int t = 0; le = new Leitor(); try { mundo_int = le.LerArquivo(arq); } catch(Exception e) { e.printStackTrace(); } l = le.Getl(); c = le.Getc(); mapa_lido = mIntTomCelula(mundo_int...
07d6433d-be9f-4665-a454-acc2c7a915db
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(Boolean.T...
5a286ab2-8e57-4bac-a0ef-425174f94b91
7
public boolean waitForMenuSelection(User user) { int menuOptionSelected = -1; Scanner reader = new Scanner(System.in); if(!TESTRUN){ menuOptionSelected = reader.nextInt(); menuOptionSelected --; } else{ Random random = new Random(); ...
4580ab2f-46b3-4c7a-9159-6094c53a04bc
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...
10f8f858-15f8-4cc0-b9d4-2db03371447b
9
public long parseLong( long bitMask, boolean signed ) throws IOException { int sign = 1; int c = nextNonWhitespace(); position(-1); if( c == '+' ) { // Unclear if whitespace is allowed here or not c = read(); } else if( c == '-' ) { ...
994697b3-2c5e-4c50-8a8e-2c3e1385d3e6
6
public void flatTire() { for (Police p : data.getLevel().getPolices()) { if (p.containsPoint(x + INTERSECTION_RADIUS, y + INTERSECTION_RADIUS)) { float oldVelocityX = p.getVx(); float oldVelocityY = p.getVy(); p.setVx(0); ...
097638ef-97e3-4a63-bf03-71a279779b68
2
@Override public void decreaseStock(int id, int amount) { int stock = findProductStock(id) - amount; String sql = "UPDATE product SET stock='" + stock + "' WHERE productid='" + id + "';"; Connection con = null; try { con = getConnection(); PreparedStatement statement = con.prepareStatement(sql...
7e78a7ea-a640-4c04-8050-6aa334ecb83c
0
public void setSeqID(String seqID) { this.seqID = seqID; }
6497180e-cce8-44ed-8c45-b4586d0ebd79
8
private void AlarmSet(int prevmode) { if (prevmode != MODE_ASET) { inputval = alarmtime; } if (bl && cursor < 5) { cursor++; } else if (br && cursor > 0) { cursor--; } else if (bu) { inputval = IncTime(inputval, cursor); } else if (bd) { if (GetDigit(inputval, cursor) > 0) { inputval = ...
4532dc5a-dc27-43e9-a6bd-45e0315e2e68
0
public Tempo diferencaEmTempo(Tempo t) { int dif = diferencaEmSegundos(t); int s = dif % 60; dif = dif / 60; int m = dif % 60; int h = dif / 60; return new Tempo(h, m, s); }
b1f9ef01-ca83-46a0-8a19-94b4cd522eb2
2
public int getValue(int place) { ListElement current = head; if (place <= count) { for (int i = 1; i < place; i++) { current = current.next; } return current.value; } else { return error; } }
6d6a1f94-04ae-4669-9d0f-6b626743ff25
5
public Tile getTileLayer(Layer layer, int x, int y) { int[] SelectedLayer = layer.tiles; if(x < 0 || y < 0 || x >= width || y >= height) return VoidTile; if(SelectedLayer[x + y * width] < TileIDS.size()) { return TileIDS.get(SelectedLayer[x + y * width]); } else { return EmptyTile; } }
b5a1519b-c113-4f0b-87e9-90eba3c705ab
4
private void hold() { if (holdUsed) { // TODO: Alert the user they can't switch again with perhaps a sound return; } game.fallTimer.stop(); if (holdBlock != null) { Block temp = gameBlock; gameBlock = holdBlock; holdBlock = temp; gameBlock.freeGrid(); holdBlock.insert(holdGrid...
edbce8b9-cd2f-43e0-b770-da4aae9c4791
3
@Override public void deserialize(Buffer buf) { messageId = buf.readShort(); if (messageId < 0) throw new RuntimeException("Forbidden value on messageId = " + messageId + ", it doesn't respect the following condition : messageId < 0"); int limit = buf.readUShort(); dialog...
e1eb9978-e604-4b73-bf67-8fd57ed714fa
1
public Object clone() { final Expr[] p = new Expr[params.length]; for (int i = 0; i < params.length; i++) { p[i] = (Expr) params[i].clone(); } return copyInto(new CallMethodExpr(kind, (Expr) receiver.clone(), p, method, type)); }
68f50187-bcd0-46d7-b758-526e44b64950
1
private void printBufferState() { for (int i = 0; i < buffer.length; ++i) { System.out.print(buffer[i] + " "); } System.out.println(); }
07513b30-cab0-4323-bd06-71999cb72986
7
public static double longestCommonSubsequence(ArrayList<Node> pageNodes1,ArrayList<Node> pageNodes2){ int[][] num=new int[pageNodes1.size()+1][pageNodes2.size()+1]; //Iterator it1=pageNodes1.iterator(); //Iterator it2=pageNodes2.iterator(); for(int i=1;i<=pageNodes1.size();i++){ for(int j=1;j<=pageNodes2.si...
991e6011-75a2-498a-877f-02f92e59b236
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
0fa0fe16-2b24-4c22-a119-bb69e1cdeed5
1
public String readLine(){ if (lines.size() > 0){ return lines.remove(0); } return null; }
eca74b86-d1f5-4649-9b61-ecafc7bdb522
3
public void reset()throws TableException{ String createString; java.sql.Statement stmt; try{ createString = "drop table " + CUSTOMER_TABLE_NAME + ";"; stmt = sqlConn.createStatement(); stmt.executeUpdate(createString); } catch (java...
467d05ff-372c-4b54-a722-c4fb06e916d3
0
@EventHandler public void serverInit(FMLServerStartedEvent event) { MCUtil.checkVersion(Side.SERVER); }
a41e01a2-eac5-4160-b79d-0e4ca8e66299
0
public JobSchedulerBuilder withJobGroup( String jobGroup ) { this.jobGroup = jobGroup; return this; }
7831ca63-c6f4-4100-890b-2da06e3896d0
9
public static void main(String[] args) { //start loc if (args.length > 0) { try { int startLocation = Integer.parseInt(args[0]); //check for loc if ( startLocation >= 0 && startLocation <= MAX_LOCALES) { currentLocale = startLocation...
fe494f10-029b-4bad-9dd9-e438f718f45a
1
public static void main(String[] args) { try { ObjectMapper objectMapper = new ObjectMapper(); Map<String,String> map = new HashMap<String,String>(); map.put("name", "sergii"); String json = objectMapper.writeValueAsString(map); System.out.printl...
01aab6ec-bdbd-49bd-a47d-77ac1acd7baf
4
private Meeting getSelectedData(){ selectedData = null; int[] selectedRow = table.getSelectedRows(); int[] selectedColumns = table.getSelectedColumns(); System.out.println(table.getSelectedColumn()); //Fix for exeption når man trykker på kollonne 0 if(table.getSelecte...
9f82db85-ee8d-4345-acc1-a58d58b6865c
7
private String readUTF(int index, final int utfLen, final char[] buf) { int endIndex = index + utfLen; byte[] b = this.b; int strLen = 0; int c; int st = 0; char cc = 0; while (index < endIndex) { c = b[index++]; ...
b78c6fb8-bc4b-479d-b3c6-84153150631f
5
void addAlmostSet( int offset, BitSet bs, BitSet missing, String frag ) { this.versions.or(bs); if ( this.offset == -1 ) this.offset = offset; this.state = SectionState.almost; for (int i = bs.nextSetBit(1); i>= 0; i = bs.nextSetBit(i+1)) { ...
2e735bb3-b63d-4b15-aa88-1ab347427743
2
private void push(JSONObject jo) throws JSONException { if (this.top >= maxdepth) { throw new JSONException("Nesting too deep."); } this.stack[this.top] = jo; this.mode = jo == null ? 'a' : 'k'; this.top += 1; }
ac2d4044-65e0-4dd7-858e-2f6a9c9087f6
1
public void startTargets(int square, int steps) { visitedMtx = new HashMap<Integer, Boolean>(); for(int i = 0; i < NUMBEROFSPACES; i++) { visitedMtx.put(i, false); } visitedMtx.put(square, true); calcTargets(square, steps); }
b73b0649-83f7-47a1-a5ad-002ddee992fb
1
public synchronized double[][] getICVectors( ) { if ( icVectors == null ) { // calculate independent component vectors and readd the mean icVectors = Matrix.mult(separatingMatrix, inVectors); } return(icVectors); }
05a9a7ca-6535-4e1d-a836-d3715dd16842
4
public boolean addUser(ClientDB client) { // TODO Auto-generated method stub if (checkSpace()) { if (checkDuplicate(client.getUserID())) { for (int i = 0; i < clientObj.length; i++) { if(clientObj[i]==null){ clientObj[i]=client; return true; } } } else{ return false; } ...
ad53b9ef-c162-4388-a205-9ef3ebc45959
0
private Temperature(int conversionFactor, String name) { super(conversionFactor, name); }
e5a67672-8cc6-4d05-8914-f1ca1ad898ed
8
public static void initializeFileInputStream(InputFileStream self) { if (!(self.filename != null)) { return; } { String filename = Stella.translateLogicalPathname(self.filename); { Keyword testValue000 = self.ifNotExistsAction; if ((testValue000 == Stella.KWD_ABORT) || (tes...
4b3733a3-67ff-433c-8106-77e8e0eedd01
3
@Override public double evaluate(int[][] board) { int x = -1, y = -1; int max = -1; int n = board.length; int m = board[0].length; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (board[i][j] > max) { max = board[...
af3ce475-2aae-4967-900e-474a19977ee0
8
public static boolean parseBoolean(CharSequence chars) { return (chars.length() == 4) && (chars.charAt(0) == 't' || chars.charAt(0) == 'T') && (chars.charAt(1) == 'r' || chars.charAt(1) == 'R') && (chars.charAt(2) == 'u' || chars.charAt(2) == 'U') && (chars.charAt...
ec8d9c37-bd22-4cf0-9e54-99e38783929d
9
private Input sIB_ProcessInput() { double valSum = 0.0; for (int i = 0; i < m_numInstances; i++) { valSum = 0.0; for (int v = 0; v < m_data.instance(i).numValues(); v++) { valSum += m_data.instance(i).valueSparse(v); } if (valSum <= 0) { if(m_verbose){ System.out.format("Instance %s...
5cbf5a3f-9698-4cb7-9424-7c97dedc183d
7
protected void syncSpi() throws BackingStoreException { if (isRemoved()) return; final File file = FilePreferencesFactory.getPreferencesFile(); if (!file.exists()) return; synchronized (file) { Properties p = new Properties(); try { p.load(new FileInputStream(file)); StringBuilder sb = new Str...
72df8155-0976-4476-a936-643a232d6c8a
5
private String getDescription() { String desc = "@MongoFind(value=[" + this.getParsedShell().getOriginalExpression() + "],batchSize=[" + batchSize + "]),@MongoMapper(" + beanMapper.getClass() + ")"; if (skipIndex != -1) { desc = ",@MongoSkip(" + skipIndex + ")"; } if (limitIndex != -1) { desc = ",@M...
a2797916-2773-430b-a608-773b81bb7bd3
6
public Long open() { Shell parent = getParent(); shell = new Shell(parent, SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL); shell.setText("Modeling time input"); shell.setLayout(new GridLayout(2, true)); Label label = new Label(shell, SWT.NULL); label.setText("Please enter new modeling time:")...
1d0adfe4-15d1-45c2-b638-dd83298eda68
2
private String readChars ( int ln ) { byte[] b = new byte[ln]; try { fidx.read(b); } catch (IOException e) { e.printStackTrace(); } String s = ""; for(int i=0;i<ln;i++) s+=(char)b[i]; return s; }
15ac07c0-8db3-4a7a-8bec-dcb12f95f4d8
5
public Map<Integer, Integer> getGeneSpans(String text) { Map<Integer, Integer> begin2end = new HashMap<Integer, Integer>(); Annotation document = new Annotation(text); pipeline.annotate(document); List<CoreMap> sentences = document.get(SentencesAnnotation.class); for (CoreMap sentence : sentences) {...
91a86c28-0624-414a-b20b-d2c4aba0c8e9
0
public BodypartSummaryPanel(BodyPart bodypart) { super(); this.bodypart = bodypart; }
02fc6727-0498-4b76-82cf-faf784fd10f2
8
private Authentication parseAuthentication(XmlPullParser parser) throws Exception { Authentication authentication = new Authentication(); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (p...
39c37040-0c51-4f40-8017-f676ebb8fe98
2
static Tex makesh(Resource res) { BufferedImage img = res.layer(Resource.imgc).img; Coord sz = Utils.imgsz(img); BufferedImage sh = new BufferedImage(sz.x, sz.y, BufferedImage.TYPE_INT_ARGB); for (int y = 0; y < sz.y; y++) { for (int x = 0; x < sz.x; x++) { long c = img.getRGB(x, y) & 0x00000000fffff...
a39b1850-6c69-47be-8d3a-b2f6e1eaeda9
1
public List<Entity> getEntities() { if (sim != null) return Collections.synchronizedList(Collections.unmodifiableList(sim.getWorld().getEntities())); else return new ArrayList<Entity>(); }
b5832e7a-7547-4854-9c09-761390aab7ec
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Position other = (Position) obj; if (orientation != other.orientation) return false; if (point == null) { if (other.point != null) re...
7711eab0-6b95-4d7c-badd-8b82eddf964b
0
public ReferenceList getReferenceList() { return referenceList; }
f6503e87-ed64-4aba-906a-7a969ccbe292
0
public void close() throws IOException { reader.close(); }
51775507-d44d-450b-ba73-3a2f658425c2
9
protected void checkErrors(String line, String caller) throws IOException, LoginException { // System.out.writeln(line); // empty response from server if (line.isEmpty()) // UnknownError...?? changed to IOException throw new IOException("Received empty response from serv...
e93510c6-3300-4f3d-839b-138a42c85d5d
9
@Override public boolean onCommand(CommandSender sender, Command command, String sabel, String[] args) { if (Utils.commandCheck(sender, command, "anima")) { Player player = (Player) sender; if (args.length == 0) { int animaBarSize = 130; int maxanima = MPlayer.getLevel(player) * 100; int maxsuban...
740c2ed5-65e7-4f13-b633-574e30bd8825
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Agenda)) { return false; } Agenda other = (Agenda) object; if ((this.agendaPK == null && other.agendaPK != null...
78b6dbc4-159e-4d92-8b66-234e53249452
5
private static void mergeMessageSetExtensionFromBytes( ByteString rawBytes, ExtensionRegistry.ExtensionInfo extension, ExtensionRegistryLite extensionRegistry, Message.Builder builder, FieldSet<FieldDescriptor> extensions) throws IOException { FieldDescriptor field = exten...
2a8d217d-9f7b-4873-8f55-f3d5931e0cb8
6
@Override public void processCas(CAS aCas) throws ResourceProcessException { // TODO Auto-generated method stub JCas jcas; try { jcas = aCas.getJCas(); } catch (CASException e) { throw new ResourceProcessException(e); } FSIterator<org.apache.uima.jcas.tcas.Annotation> it = jcas.ge...
4f466c14-91b0-4a86-ba5b-97061f02ce63
1
private int playerPieceTypeRemaining(HantoPlayerColor player, HantoPieceType pieceType) { if (player == HantoPlayerColor.BLUE) { return bluePiecesLeft.get(pieceType); } else { return redPiecesLeft.get(pieceType); } }
e35f4051-a7f7-4cfa-98c8-96cc71addf1f
1
public static void main(String[] args) { int N = 12; for (int i = 1; i <= N; i++) System.out.println(i + ": " + fib(i)); }
aded2745-5a1c-4770-b3a5-d5154f05f988
8
public double executaTorno() { double menorTempo = getTempoUniversal()+1; ordenaPeloTempoDeSaidaT(maquinaTorno); for(int i=maquinaTorno.size()-1 ; i>=0 && maquinaTorno.size()>0 && verificaMaquinaTorno(maquinaTorno) ; i--) //percorre a lista de maquina e verifica os status dos rolamentos { if(maquinaTo...
7c1beb13-e51f-43b6-88a1-5b625e2346a8
4
public void update() { growVillages(); chunksLock.readLock().lock(); try { for (Chunk c : chunks) { if (c.update() && !toDraw.contains(c)) { toDraw.add(c); } } } finally { chunksLock.readLock().unlock(); } ArrayList<Village> villages = getVillages(); for (Village v : villag...
a0a1f629-f198-4fb4-a24a-a88bedd38da5
6
private boolean findEntry() { Cursor waitCursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT); shell.setCursor(waitCursor); boolean matchCase = searchDialog.getMatchCase(); boolean matchWord = searchDialog.getMatchWord(); String searchString = searchDialog.getSearchString(); int column = searchDialog.ge...
95e414e7-f798-4ad6-ac9d-d3dfa3d38ed0
9
public boolean isAutarkic(IGroup g) { if (g.zgetGroupType() == GroupType.PACKAGE) { return false; } if (g.zgetGroupType() == GroupType.INNER_ACTIVITY) { return true; } if (g.zgetGroupType() == GroupType.CONCURRENT_ACTIVITY) { return true; } if (g.zgetGroupType() == GroupType.CONCURRENT_STATE) { ...
0e4228f9-c5ef-48bb-a492-3d6a2b91fd10
7
@EventHandler(priority=EventPriority.LOW, ignoreCancelled = true) final void onStructureGrow(StructureGrowEvent event){ if (panic){ event.setCancelled(true); return; } if (!monitorStructureGrowth) return; final List<Location> affected = new LinkedList<Location>(); for ( BlockState state : event.getBloc...
6810a3ca-34c1-4e24-b6fa-3a30290a4c86
9
public String toString() { // only ZeroR model? if (m_ZeroR != null) { StringBuffer buf = new StringBuffer(); buf.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n"); buf.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") + "\n\n"); buf.append("War...
4d4a1960-63d1-42f3-ba37-4c3bc0c9c4be
0
@Override public IAttemptClientConnect getAttemptClientConnect() { return attemptClientConnect; }
e3607f63-804b-4cc1-b835-866cfb659311
5
@Override public Date deserialize (JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { if (!(json instanceof JsonPrimitive)) { throw new JsonParseException("Date was not string: " + json); } if (type != Date.class) { throw new ...
c5946deb-3835-4274-a41e-fbbc80bcd2af
6
public static String base64Encode(byte[] src) { int unpadded = (src.length * 8 + 5) / 6; int padding = 4 - (unpadded % 4); int d = 0; int e = 3; long buffer = 0; if (padding == 4) padding = 0; char[] encoded = new char[unpadded + padding]; whi...
1a3506b2-0086-4e81-9d37-427717f5081c
6
public boolean getBoolean(int index) throws JSONException { Object object = this.get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean....
81d37b97-f765-45a1-ae02-1b5673e612d7
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = ""; response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); PrintWriter writer = response.getWriter(); String dbDriver = "org.postgresql.Driver"; ...
f201a490-eec0-4795-9f18-5f30a338f85f
5
private boolean getModinfoStringFromJAR(File jarfile) { StringBuilder builder = new StringBuilder(); String inputFile = "jar:file:/" + jarfile.getAbsolutePath() + "!/mcmod.info"; InputStream in = null; try { URL inputURL = new URL(inputFile); JarURLConnection conn = (JarURLConnection) inputURL.o...
368abe4d-964c-4caf-b58e-887c99898719
4
public boolean[][] createWallMap(TiledMap map) { if (map == null) return null; int layer = map.getLayerIndex("Tile Layer 3"); boolean[][] wallMap = new boolean[32][24]; for (int j=0; j<wallMap[0].length; ++j) for (int i=0; i<wallMap.length; ++i) if (map.getTileId(i, j, layer) != 0) wallMap[i][...
fcf201f4-d0e0-411a-8533-96b7403d19e8
3
public synchronized boolean setMaster(final CloudNode cloudNode) { Objects.requireNonNull(cloudNode, "The given cloud node must not be null."); final Lock lock = Holder.INSTANCE.getInstance().getLock("my-distributed-lock"); lock.lock(); try { final NodeRecord masterRecord =...
b9e35820-9dc1-48b6-a297-732c3c142a36
6
public void movement(VectorShape v) { v.setX(v.getX() + v.getVelX()); v.setY(v.getY() + v.getVelY()); if (v.getX() > this.width) { v.setX(0); } if (v.getX() < 0) { v.setX(width); } if (v.getY() > this.height) { v.setY(0); ...
9f2e0972-cb9c-4710-b7f2-44ce6d56599c
3
private void printGridletList(GridletList list, String name, boolean detail, double gridletLatencyTime[]) { int size = list.size(); Gridlet gridlet = null; String indent = " "; System.out.println(); System.out.println("============= OUTPU...
ae886b0d-2792-446a-8480-276850068e9e
6
static void Algoritmo(MatingPool Pool, int Repeticiones) { while(Repeticiones > 0) { ArrayList<Lista> NuevaPoblacion = new ArrayList<>(); NuevosCandidatos.clear(); System.out.println("\nNUEVOS CANDIDATOS BASADOS EN EL PORCENTAJE DE FITNES...
5090db8b-c54e-4aed-b8ad-de5b4d282f3b
7
public static <TElement, TCollection extends Collection<TElement>> TCollection addAllFlat(final TCollection target, final Iterable<? extends Iterable<? extends TElement>> sources) { if (target != null && sources != null) { for (Iterable<? extends TElement> source : sources) { for (TE...
ad4c8545-6d1d-46f0-a15b-8fb05415196c
1
@Override public double getExpectation() throws ExpectationException { if (nu > 2) { return (double) 1 / (nu - 2); } else { throw new ExpectationException("InverseChiSquared expectation nu > 2."); } }
96143ebc-0c39-4ae5-b12a-f0e1627b2593
3
public Network() throws Exception { port=6740; while(!portChosen){ if(checkPort(port))portChosen=true; else if(port<6750){port+=1;} } localAddress = (Inet4Address)Inet4Address.getLocalHost(); sender = new Sender(); receiver = new Receiver(po...
4f77fc90-2e7e-4968-932d-8a592016eab8
6
private boolean validate_otps(List<String> otps, NameCallback nameCb) throws LoginException { boolean validated = false; for (String otp : otps) { log.trace("Checking OTP {}", otp); VerificationResponse ykr; try { ykr = this.yc.verify(otp); } catch (YubicoVerificationException e) { log.warn("E...
23e14a0b-1804-4c20-8c32-4b300a89329b
6
@Override public int append(final NodeLike<Node<N, E>, E>[] out, final int pos) { if(pos == 0) { out[0] = this; return 1; } @SuppressWarnings("unchecked") final NodeLike<N, E>[] buffer = (NodeLike<N, E>[]) out; final NodeLike<Node<N, E>, E> left = out[pos - 1]; if(left instanceof ...
954add4f-b376-4c10-a6c9-1718b5814214
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=getTargetAnywhere(mob,commands,givenTarget,false,true,true); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final b...
a0633344-6752-4a9c-b681-aaaf6f892620
2
public Carte(){ map = new Element[LARGEUR_CARTE][HAUTEUR_CARTE]; // Génération de la map for(int x = 0; x < LARGEUR_CARTE; x++){ for(int y = 0; y < HAUTEUR_CARTE; y++){ map[x][y] = new Element(new Position(x, y),BackgroundEnum.plain); } } }
a0e83740-e09f-4541-bcc1-3e3b9cb450ba
3
protected void showPopup(MouseEvent event) { // Should we show a popup menu? if (event.isPopupTrigger()) { Point p = getView().transformFromAutomatonToView(event.getPoint()); if (lastClickedState != null && shouldShowStatePopup()) { stateMenu.show(lastClickedState, getView(), p); } else { emptyMenu...
4904b4d6-b320-4e53-acf3-d1a940747de4
4
public static final boolean isAngleWallParallel(double angle) { return Utils.isNear(angle, 0) || Utils.isNear(angle, HALF_PI) || Utils.isNear(angle, PI) || Utils.isNear(angle, ONE_HALF_PI) || Utils.isNear(angle, TWO_PI); }
1350ba39-363b-427e-a70e-b724d9ba3b3d
4
public void update(){ if(!ctrl.isRunning()){ start(); } checkEndConditions(); if(ctrl.isRunning()){ timer.addMillis((lastCount-ctrl.getEnemyShipCount())*500); lastCount=ctrl.getEnemyShipCount(); if(ctrl.getEnemyShipCount()==0){ ...
ab69d4ed-a8ad-4998-a7ad-bb55a0641e5a
2
public static Node getOtherNode(Edge edge, Node node) { for (Node n : edge.getAdjacent()) { if (!n.equals(node)) { return n; } } return null; }
2d5b3ff0-bfab-4af4-a36b-4d4c8f6de8ce
8
private void removePoints(int id) throws SQLException { /* * Gets the number of group matches where the team id is playing or has played. * The -1 is because the arraylist is not starting on 1 but 0, so 1 lower. */ int matches = matchmgr.showCountTeamGroup(id) - 1; ...
feed2431-3e64-44a1-aba3-e5f785a2caca
2
public void decrement(int by) { // if given value is negative, we have to increment if (by < 0) { decrement(Math.abs(by)); return; } // check if we would overflow int space_down = value - min; if (by > space_down) { // we simply use min value = min; } else { // no overflowing, this is easy...
f5011bf7-8e5b-4e24-a75a-20df2eaab170
8
public double centerControl() { if (getKingLocation(getPlayerToMove().toLowerCase())==null) return -10000000; if (getKingLocation(getPlayerToMove() == "W"? KrakenColor.BLACK_ITEM:KrakenColor.WHITE_ITEM)==null) return 10000000; int myPuntuation=0; String itemColor = playerToMove == W ? KrakenColor.WHITE_ITEM:Kra...
c4b6dad5-8115-4c4d-b6ca-cfd21a284f5a
0
public String getEmployeeName() { return employeeName; }
c0bbe643-1ba9-461a-b7b9-a659b20b87a5
4
private Random getInstanceOfRandom(long seed) throws InitializationError { String randomClass = System.getProperty("jcheck.random"); if (randomClass != null) { try { Class<?> random = Class.forName(randomClass); Constructor<?> randConst = random.getConstru...
c70e2b52-4d7f-474a-9350-2585425a1fe0
0
Template loadTemplate(String name, int[] array) { return new Template(name, loadArray(array)); }
a1016aac-ece0-4e7d-8f9e-1e37a5f84c77
9
@Override public Object getValueAt(int row, int col) { switch (col) { case COL_FULL_ACCT : return fullAccounts.get(row); case COL_TANK_NUM : return tankNums.get(row); case COL_SVC_NUM : return svcNums.get(row); case COL_NAME : return names.get(row); case COL_REF_NUM : retur...
3f4a45b0-2ff7-46d9-a538-04f390f34058
0
public void put(Object o) { stackList.add(o); }
2fd596aa-b0a9-4211-a5c7-24fb41086e51
5
private static HashMap<String, String> listTests(String dirPath, int level) { HashMap<String, String> listoffiles = new HashMap<String,String>(); try{ File dir = new File(dirPath); File[] firstLevelFiles = dir.listFiles(); if (firstLevelFiles != null && firstLevelFiles.length > 0) { ...
bd15c5e1-bbb0-40ce-a904-84d172b573c7
7
public void train(Pattern p) { // propagate; set activation Values this.propagate(p, false); // run over all Layers from the bottom to the top; Except the Input // Layer // Backpropagation for (int i = neurons.size() - 1; i > 0; i--) { for (int s = 0; s < neurons.get(i).size(); s++) { Neuron neuro...
8589764a-b3de-420f-903e-23a118f17165
1
public void showLine(int lineNumber) { for (int i = 0; i < fieldSize; i++) { showCell(i,lineNumber); } }
1cd410f9-618f-417f-8059-fef29c296446
9
public void mapTileDeckClicked() { if (((Window) getTopLevelAncestor()).getPlayer().isPlayersTurn()) { if (GameHandler.instance.getCurrentState() == GameState.tilePlacement) { if (GameHandler.instance.getMap().getTempTile() == null) { MapTile tile = GameHandler.instance.getTileDeck().getNextCard...