method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
bbb9c880-165e-484f-833b-d6d1ce4bc104
4
public void run() { String s; try { System.out.println(Server1.getCurrentTime() + "1::" +"Starting Status thread"); statusSocket = new ServerSocket(statusPort); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } while (true) { try { statusAcceptSocket = s...
49675ac5-e963-4f51-a47a-1a795e485ad4
7
MyX509TrustManager() throws java.security.GeneralSecurityException { TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX"); KeyStore ks = KeyStore.getInstance("JKS"); CertificateFactory cf = CertificateFactory.getInstance("X.509"); try { ks.load(null, null); F...
a2d70594-47e1-487b-8b75-016058448371
0
public void flushAllPages() throws HashOperationException, PageUnpinnedException, PagePinnedException, PageNotFoundException, BufMgrException, IOException { // send to the private method with the common coe for all flush methods PageId pageId = new PageId(INVALID_PAGE); ...
ab4ad4aa-831d-4f77-89f6-5b349f03cfbf
8
@Override public String toString() { int rowWidth = 3; String result = ""; while(result.length() < rowWidth){ result += " "; } for(String st:ids){ while(st.length() < rowWidth){ st += " "; } result += st...
90d521b5-3f75-4eca-894e-07a1d0cb066b
0
public int getS2() { return s2; }
74b9f53d-1211-4cae-ae84-b0755a9d287e
5
@Override public void moveCustomerToSellerQueue(int currentPhase, Queue lineQueue, ArrayList<TicketSeller> sellers) { Customer tmpCustomer; TicketSeller tmpSeller; if ( !lineQueue.isEmpty()){ for(int i = 0 ; i < Define.theNumberOfTicketSeller ; i++){ tmpSeller = sellers.get(i); ...
f0fec697-0874-427a-82ed-ec69660631e6
4
public void loadSheet(File file){ parent.dp.clearTiles(); //Vector<String> tempImgs = new Vector<ImageIcon>(); BufferedImage bufferedImage = null; try { bufferedImage = ImageIO.read(file); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(bufferedImage != nul...
041150ea-ce9a-4efc-9a38-db81f2df2a3a
7
int[] dostr(String s) { char[] ss = s.toCharArray(); int n = s.length() + 1; int[][] w = new int[n][n]; for (int i = 0; i < n; i++) { w[i][0] = i; } for (int at = 1; at <= s.length(); at++) { for (int j = 0; j < n; j++) { w[at][j] = w[at - 1][j] + 1; } int countB = 0; int countW = 0; f...
ca93f8d2-c445-4874-bb9f-ba85d548ff8c
4
public static byte[] decompress(byte[] data, int uncompressBufSize) { // mpd: new code byte [] inbuf = data; // input is first assigned to full data int rem = data.length; int count = 0; int off = 0; // Create an expandable byte array to hold the decompressed data ...
54ed8b14-6553-4255-8abb-a988e5755326
8
private void setAnchorPointForRectangularShape(byte i, float x, float y, float w, float h) { switch (i) { case AbstractRectangle.UPPER_LEFT: anchorPoint.setLocation(x + w, y + h); break; case AbstractRectangle.UPPER_RIGHT: anchorPoint.setLocation(x, y + h); break; case AbstractRectangle.LOWER_RIGHT:...
de18f7eb-9dd9-40c9-9b21-9da40ef9b7a2
5
public void hit(JGObject obj){ if(obj instanceof Bullet){ Bullet b = ((Bullet)obj); hurt(b.damage); b.remove(); flash(); // increase score if it was an enemy ship if(this.isDead() && this instanceof EnemyShip){ this.game.score += this.maxHealth*100; } }else if(obj instanceof Shi...
4c292f7e-c083-4766-88c5-024d7cb3c633
0
@Before public void setUp() { l = new AdjacencyList(); v = new Vertex(0); k = new Vertex(0); }
e4dac5d8-dd35-4254-bda7-edfdb86d89bc
1
public Client(Socket socket) { this.socket = socket; id = socket.getPort()+""; try { in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintWriter(new BufferedWriter(new OutputStreamWriter( socket.getOutputStream())), true); send("{action: user_registration, user_...
cebc1bc4-ee7e-4b0b-8323-03b5981c3527
7
public void actualizar() { if (sentido == Direccion.DERECHA) { desplHorizontal = VELOCIDAD_HORIZONTAL; } if (sentido == Direccion.IZQUIERDA) { desplHorizontal = -VELOCIDAD_HORIZONTAL; } if (sentidoCambiado) { desplVertical = VELOCIDAD_VERTIC...
02aee267-873e-46fb-ba4f-8d67e7bfa3f4
6
public static ArrayList<Template> loadTemplates() throws TemplateException { ArrayList<Template> results = new ArrayList<Template>(); String baseURL = "http://radreport.org/json/"; try { System.setProperty("java.net.useSystemProxies", "true"); // get JSON Obje...
0f404fa1-bb73-4b8a-b064-f6e330b28cf7
3
public static char seven(int r, int c, int f) { if (s4(r, c, f) || s5(r, c, f)) return '|'; else if (s6(r, c, f)) return '_'; return '.'; }
cfc1f205-43f4-423c-83bb-714e7ef5475c
3
public MainView() { initComponents(); tfResult.setContentType("text/html"); final Desktop desktop = Desktop.getDesktop(); tfResult.setEditable(false); tfResult.setOpaque(false); tfResult.addHyperlinkListener(new HyperlinkListener() { publi...
413a6f19-d387-4dcc-aae2-a9836e920de0
9
String getReplacement() { StringBuilder s = new StringBuilder(); if (replacement == null) { return getMatchReplacement(); } else { for (int i = 0; i < replacement.length(); i++) { char c = replacement.charAt(i); ...
7075b691-2394-4369-9e85-e3afed760830
0
public String getObservaciones() { return observaciones; }
4c9361b4-a224-49fd-8ec0-6bba8787a01d
4
public String[] readDomains() { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(filePath)); ArrayList<String> domainList = new ArrayList<>(); while (true) { String line = reader.readLine(); if (line == nul...
74a80d1d-282a-4ab5-bcec-d094b615d015
1
@Before public void init() { partidoPocosJugadores = new Partido(); for (int i = 0; i < 6; i++) { inscribir(partidoPocosJugadores, new Jugador()); } partidoOk = new Partido(); partido1 = new Partido(); sytek = new Jugador("sytek", 3d,Lists.newArrayList(5d,8d) ); chicho = new Jugador("chicho", 5d...
a35f7eae-be56-4c6c-9652-dd98b12a56d7
3
public SkiPass(int id, String type, Date activation, Date expiration) { if (activation == null || expiration == null) { throw new IllegalArgumentException("Activation or expiration time is null"); } if (activation.after(expiration)) { throw new IllegalArgumentException("A...
c6805e7e-6eba-4d94-937d-f4a48a1d8bdd
7
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String action = (String)req.getParameter("action"); if (action == null) action = ""; if (req.getSession().getAttribute("basket") == null) { req.getSession().setAttribute("basket", new Basket())...
4569b3e2-0e63-4f79-9780-9872d2314a9e
7
public Unit takeUnit(UnitType unitType) { if (unitType != UnitType.Terran_SCV) { return null; } Unit toGive = takeMineralsWorker(); if (toGive != null) { return toGive; } for (ResourceInfo resource : gasses) { for (Unit worker : resource.workers) { if (!worker.isCarryingGas() && !worker.isConst...
47606c38-9569-4d46-b8d9-7eaf4a8a7b81
3
@Override public void valueChanged(ListSelectionEvent event) { /* This listener updates the value of the textbox with the game host's name * when they are selected in the list. */ if (event.getSource() == gamesList && !event.getValueIsAdjusting()) { String nameOfGameHost = (String) gamesList.getSelectedValue...
a4dc43d6-4ce8-4951-98e4-381111c89eb3
8
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb = new JSONObject(); String userId = request.getParameter("userId"); try{ connection = new Mongo(); scheduleDB = connection.getDB("sched...
872ab5e5-5798-4f87-83f2-ef361f6e960d
7
public void testUserService() { Token t = new Token(TOKEN_USER_READ,"",""); //test resource owner User u = GoCoin.getUserService().getResourceOwner(t); System.out.println("[DEBUG]: Resource owner: "+u); boolean TEST_GET_USER = false; //test get user if (TEST_GET_USER) { u = GoCoi...
449b4118-acd1-4335-bede-39cf5829eedd
0
protected Automaton getAutomaton() { return getParent().getDrawer().getAutomaton(); }
83f04bc8-0dba-4078-8d72-0cede92c846d
1
public static void assertLngLatAlt(double expectedLongitue, double expectedLatitude, double expectedAltitude, LngLatAlt point) { assertEquals(expectedLongitue, point.getLongitude(), 0.00001); assertEquals(expectedLatitude, point.getLatitude(), 0.00001); if (Double.isNaN(expectedAltitude)) { assertFalse(poi...
9f09428a-bc54-443d-aa08-7653c5298504
1
public int Read (byte[] Data, int NumBytes) { int retcode = DDC_SUCCESS; try { file.read(Data,0,NumBytes); } catch (IOException ioe) { retcode = DDC_FILE_ERROR; } return retcode; }
4a333d33-891f-4826-82b1-56db1cbef786
6
protected void createSource2(boolean start) throws JavaLayerException { Throwable t = null; try { Line line = AudioSystem.getLine(getSourceLineInfo()); if (line instanceof SourceDataLine) { source = (SourceDataLine) line; //source.open(fmt, millise...
c93062ac-14be-49fd-bdf2-aa7494e3ff58
5
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Neuron)) return false; Neuron neuron = (Neuron) o; return posX == neuron.posX && posY == neuron.posY && edges.equals(neuron.edges) && name.equals(neuron.name); }
fa81fabb-e7ca-48b0-b143-73e2e7a4582d
9
private void doTestOffset(ZoneOffset offset, int hours, int minutes, int seconds) { assertEquals(offset.getTotalSeconds(), hours * 60 * 60 + minutes * 60 + seconds); final String id; if (hours == 0 && minutes == 0 && seconds == 0) { id = "Z"; } else { String str = (hours < 0 || minutes < 0 ...
672f85ae-376f-4ebc-97eb-057dc02e7f9e
2
public static String[] parseS3path(String str) throws IllegalArgumentException { String[] ret = {"",""}; String regex = "s3://([^/]+)/(.+)"; Pattern pattern = Pattern.compile(regex); Matcher m = pattern.matcher(str); if (m.find()){ ret[0] = m.group(1); r...
aa93b2c6-74c9-41ac-be60-9b67f8384144
4
private boolean checkForSolidEntities(final Vector2d copy, final Entity self) { boolean contains = false; for (Entity e : entities) { // Do not collide with yourself if (e == self) continue; if (e instanceof CollidableEntity) { Rectangle collisionBox = ((CollidableEntity) e).getCollisionBox(); ...
73c00247-d8c9-43a1-ba77-069790138f09
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Literal)) return false; Literal other = (Literal) obj; if (sign != other.sign) return false; if (variable == null) { if (other.variable != null) return false; ...
0be74674-66a8-4554-928b-cf0c2d277657
7
public static boolean handleStaircases(Player player, WorldObject object, int optionId) { String option = object.getDefinitions().getOption(optionId); if (option.equalsIgnoreCase("Climb-up")) { if (player.getPlane() == 3) return false; player.useStairs(-1, new WorldTile(player.getX(), player.getY(), ...
f5448acc-b6e9-4a7a-86f3-96a7f8358880
7
@Override public void mouseReleased(MouseEvent e) { if (_up != null) { int[] pos = setUpNearest(e); if (_up.getType() == BoardObject.type.SETTLEMENT) gameLogic.writeBuildSettlement(pos[0],pos[1]); else if (_up.getType() == BoardObject.type.CITY) gameLogic.writeBuildCity(pos[0]...
3ac68c8e-2d8e-4c9b-995c-fc40e5b9fc99
6
private boolean jj_3R_90() { Token xsp; xsp = jj_scanpos; if (jj_3_65()) { jj_scanpos = xsp; if (jj_3_66()) { jj_scanpos = xsp; if (jj_3_67()) { jj_scanpos = xsp; if (jj_3_68()) { jj_scanpos = xsp; if (jj_3_69()) { jj_scanpos = xsp; if (jj_3_70()) return true; } ...
823dafd3-bbf3-44dc-8048-d3a537148f56
0
public ResourceBundle getLanguageResourceBundle() { return languageResourceBundle; }
90d93163-9874-435f-a164-0d14360a6eac
5
private int helper(int n, int m, int[][] men) { if (n <= 0 || m <= 0) { return 0; } if (n == 1 && m == 1) { return 1; } if (men[n][m] != 0) { return men[n][m]; } else { men[n][m] = helper(n - 1, m, men) + helper(n, m - 1,...
14c1ba5a-60aa-4bc0-ad81-39ca1a98aea9
9
private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed if (lab_modo.getText().equals("Alta")){ if (camposCompletos()){ ocultar_Msj(); insertar(); menuDisponible(true); ...
7aa78bbd-ed6b-4303-83f0-9391e610ecd3
7
public AlienCavernWell(World world, long seed, int wellX, int wellZ) { super(world, seed, wellX, wellZ); mineralOdds = random.nextInt(5) + 1; mineralsPerLayer = random.nextInt(10); liquidLevel = random.nextInt(32) + 48; // spice it up xFactor = calcRandomRange(35, 55); yFactor = calcRandomRange(15, 35)...
6242b83a-885f-4b74-8a79-7692b289886f
2
public static String normalizeExtension(String extension) { if (extension == null) { return ""; //$NON-NLS-1$ } if (extension.startsWith(".")) { //$NON-NLS-1$ extension = extension.substring(1); } return extension; }
f8255c5b-b64a-4848-be3a-81907d1c5c31
7
public static String[] splitCSV(String inputString) { ArrayList<String> stringList = new ArrayList<String>(); String tempString; StringBuilder sb = new StringBuilder(); for (int i = 0; i < inputString.length(); i++) { if (inputString.charAt(i) == '"') { i++; ...
94cb677f-91ad-4ec7-9827-23f81a5f36e0
6
public String process(List<String> line, int L, int lineCount){ int diff= L-lineCount; String result = ""; if(line.size() == 1){ result = line.get(0); result = addSpace(result, diff); }else{ List<String> spaces = new ArrayList<String>(); for(int i=0; i<line.size()-1; i++){ spaces.add(" "); ...
a0374e25-4cbe-4fc7-a4fa-4419315ec492
5
public static void findLoop(long world) throws Exception { long[] previousVal = new long[100]; previousVal[0] = world; int iter = 1; boolean done = false; while (!done && iter < 100) { previousVal[iter] = nextGeneration(previousVal[iter-1]); for (int i=0;i<iter;i++) { ...
a8d8c2b3-d4c7-42d7-bcaf-a50bf7076198
8
@Override public int compareClock(Clock otherClock) { VectorClock otherVectorClock = (VectorClock)otherClock; boolean greater = true; boolean less = true; for (String tmpKey : this.clock.keySet()) { if (otherVectorClock.clock.containsKey(tmpKey)) { if (this.clock.get(tmpKey) > otherVectorClock.clock.get...
4dbb2750-4fa2-40c7-9563-f8876717c273
6
public String getCurrentWeatherCondition(DemonstratorMain main, String dbName, boolean randomWeather){ try { //time since last update of the weather condition long diffInMinutes = Duration.between(lastUpdateWeatherCondition, LocalDateTime.now(Clock.systemUTC())).toMinutes(); if (randomWeather){ Str...
ceb33620-0449-481e-ac6a-bbabbf793889
2
@Override public void run() { if((port >= 0) && (port <= 65535)) { listen(); } else { throw new RuntimeException("Port not in Range[0-65535]"); } }
eded336a-f2f4-4852-b918-9c981363932d
1
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed isCaps = !isCaps; pressSystemKey(KeyEvent.VK_CAPS_LOCK); releaseSystemKey(KeyEvent.VK_CAPS_LOCK); //System.out.println(isCaps); if( isCaps==true ){ jButton5.setBackground(Color.bla...
40ea825a-6ccb-4802-90b7-e8d30269f6b8
4
public JSONObject getJSON( ChartSeriesHandle[] series, WorkBookHandle wbh, Double[] minMax ) throws JSONException { JSONObject chartObjectJSON = new JSONObject(); // Type JSON chartObjectJSON.put( "type", getTypeJSON() ); // Series double yMax = 0.0; double yMin = 0.0; int nSeries = 0; JSONArray serie...
76faace7-2923-4f8a-a6d9-402f2ad6f7fa
0
@Override public void setEmail(String email) { super.setEmail(email); }
3b631ff6-528e-4684-8368-ed501888da89
2
static void printMatrix(int[][] m) { for (int[] l: m) { for (int i: l) { System.out.print(i); } System.out.print("\n"); } }
c4345c9e-ec67-4c09-ae68-c4b3f00aadab
0
public int getLabels() { return labelCount; } // Returns the number of labels in the label file
e609b2f9-7347-4126-a9f3-17002f8a349f
8
public void mouseEntered(MouseEvent e){ if(e.getX() < 1){xlocal = 0;} else{xlocal = e.getX()/viewer.magnify;} if(e.getY() < 1 ){ylocal = 0;} else{ ylocal = e.getY()/viewer.magnify;} if (xlocal > mainBrain.xsiz-1){xlocal = mainBrain.xsiz-1;} if (ylocal > mainBrain.ysiz-1){ylocal = mainBrain.ysiz-...
606bb124-b95f-47ea-9b76-283d27a87898
3
@Override public int addParticle(ParticleParameters parameterObject) { for(int i = 0; i < MAX_PARTICLES; i++) { float[] color = getCRule(cID_[i]).getColor(r_[i], g_[i], b_[i], a_[i], age_[i], null); double size = getSRule(sID_[i]).getSize(size_[i], age_[i], props_[i]); if(color[3] <= 0.0f || size <= 0) ...
1db14b1f-3970-4bcf-a023-4341f07aad0a
3
@Override public IllnessDTO getIllnessById(Long id) throws SQLException { Session session = null; IllnessDTO illness = null; try { session = HibernateUtil.getSessionFactory().openSession(); illness = (IllnessDTO) session.load(IllnessDTO.class, id); } catch (Ex...
34c3be2d-60f4-45e5-aded-22c5f16a5f61
0
public ConvertToAutomatonPane(RegularEnvironment environment) { this.environment = environment; JFrame frame = Universe.frameForEnvironment(environment); setLayout(new BorderLayout()); JPanel labels = new JPanel(new BorderLayout()); labels.add(mainLabel, BorderLayout.NORTH); labels.add(detailLabel, Border...
e0b99e70-4aae-41df-98c2-36ff94a78781
0
public void setListButtonEnabled(boolean b) { myShowAll.setEnabled(b); }
060a590c-8554-4e66-9516-717261705c75
6
public void run() { if(Random.nextInt(1, 4) == 2) { int i = Random.nextInt(1, 40); switch (i){ case 3: Camera.setAngle(Random.nextInt(0, 120)); break; case 15: Camera.setPitch(Random.nextInt(30, 70)); break; case 27: if(!Walking.isRunEnabled()) Walking.setRun(true)...
8e852825-795b-417c-8d47-91b343c1479c
8
/* */ public void damageCheck() { /* 37 */ Random r = new Random(); /* 38 */ for (int i = 0; i < Core.units.size(); i++) { /* 39 */ Unit u = (Unit)Core.units.get(i); /* */ /* 41 */ if (!this.hitUnits.contains(u)) { /* 42 */ if (u.collision.intersects(this.highDamage)) { /* 4...
4689cdd4-0795-41e9-a051-90577e8e2256
0
public SimulatorPane(Automaton automaton, AutomatonSimulator simulator, Configuration[] configurations, Environment env, boolean blockStep) { this.automaton = automaton; this.simulator = simulator; initView(configurations, env, blockStep); }
921e7617-ca5f-49f2-bb82-61571e62b380
6
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Question)) return false; Question question = (Question) o; if (answers != null ? !answers.equals(question.answers) : question.answers != null) return false; if (text != null ? !text.e...
e9678d4d-4818-4974-b634-2238f32ba16b
9
public static ArrayList<GameResult> parseGames(Document document, int summonerId) throws ParserException { final String dataGameId = "data-game-id"; Elements gameElements = document.getElementsByAttribute(dataGameId); SimpleDateFormat inputDateFormat = new SimpleDateFormat("MM/dd/yy hh:mmaa zzz"); SimpleDateFor...
14d5b0d6-9378-4633-8ee1-0d24d10cd820
7
private void parseHeaders() throws IOException { if(!headerRead) { headerRead = true; for (String header : readHeaders()) { if (header.startsWith("Content-Length:")) { contentLength = Integer.parseInt(header.substring("Content-Length:".length()).trim()...
0c2f746e-8791-4ed4-a6d8-ef3e4b5693fa
8
public static void loadLocFamilyCon() { int numLocs = 10000; HashMap<Integer,TreeMap<Integer,Integer>> locs = new HashMap<Integer,TreeMap<Integer,Integer>>(numLocs); try { Connection con = dbConnect(); PreparedStatement insert = con.prepareStatement( "INSERT INTO "+EpiSimUtil.llFamInterCountTbl+" (loca...
6cf9c9f8-9a2e-4265-8d2d-73fb1a09b12d
8
public Move02(InetAddress address, int port, String packetData) { //02|NAME;X;Y; String[] split = packetData.split(";"); if(split.length < 2){ System.err.println("Move Packet from Player does not Contain the right Syntax"); }else{ String name = split[0]; ...
93383700-b6be-4fe0-862a-7decd806f1ac
6
private static double sinpi(double x){ int res=48; if(sinmap==null){ sinmap=new double[res+1]; for(int i=0;i<=res;i++) sinmap[i]=Math.sin(Math.PI*i/res/2); } x-=2*Math.floor(x/2); int mul=1; if(x>=1){mul=-1;x-=1;} if(x>.5){x=1-x;} if(x>=.5) return mul; if(x<=0) return 0; x*=2*res; int y=(int...
ab8d845e-f69f-4ec6-8c65-abc4b02d9f55
4
@Override protected GffMarker readNext() { // Try to read a line try { while (ready()) { line = readLine(); if (line == null) return null; // End of file? // Parse line GffMarker seqChange = parse(line); if (seqChange != null) return seqChange; } } catch (IOException e) { throw new...
f2ecc974-bf2f-4212-a852-8db65e0820c9
0
public Grammar getAugmentedGrammar(){ return augmentedGrammar; }
dabbe112-4929-407e-a0c9-078ff951b1c0
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if(affected instanceof MOB) { if(msg.source()!=affected) return true; if(msg.source().location()==null) return true; final MOB mob=(MOB)affected; if(((msg.amITa...
818c9a27-645c-4cea-af27-58aac98e1731
0
public void clickChooseSkills(Scanner scanchoice, ArrayList<MainMenuHeroSlot> heroies) { System.out.println("You have already chosen items to use."); }
e92230da-654c-451d-9b1e-6a9894595b70
5
public Double simula() { /* Simula fino al numero di job richiesti. */ while (this.getTempiUscita().size() < this.getJobTotali()) { Event next = this.getCalendar().get_next(); this.setClock(this.getCalendar().get_next_time(next)); switch (next) { case...
7317b38c-7c69-4ff7-9f4a-4568e3b8ae2e
6
void toXml(PrintStream s) { try { s.println("\t<rra>"); s.print("\t\t<cf> "); s.print(type); s.println(" </cf>"); s.print("\t\t<pdp_per_row> "); s.print(pdpCount); s.print(" </pdp_per_row> <!-- "); s.print(db.header.pdpStep * pdpCount); s.println(" seconds -->"); s.print("\t\t<xff> "); ...
23000739-264f-4e44-97bf-fade590f3990
4
@Override public int neighbourhoodBest(int particle) { int best = 0; for(int i = 1; i < solutionFitness.size(); i++){ if(maximum){ if(solutionFitness.get(i) > solutionFitness.get(best)){ best = i; } }else{ if(solutionFitness.get(i) < solutionFitness.get(best)){ best = i; } } } ...
6acdea79-67cb-4e7b-bf48-ca4f7a58a31e
8
@Override public void update(final Observable observable, final Object data) { if (observable == Session.getSession().getHeart()) { Heart.Event event = null; Object eventData = null; if (data instanceof Heart.Event) { event = (Heart.Event) data; } else if (data instanceof Heart.EventData) { Heart...
ad6057cc-138f-4078-bd5b-7df7bc311e34
3
@Override public void run() { int count = 0; int cardinalCount = count%4; while(alive) try { Thread.sleep(field.rnd.nextInt(100)); count++; } catch (InterruptedException ex) {} if(field.shot(getNextPosition(cardinalCount))){ ...
6e3df6ae-a88f-47cc-8276-0cb4cd3c19c0
3
@Override public Object getValue() { if(!this.getNodeProperty().getDataType().isAssignableFrom(SequencePosition.class)) return null; Integer position; try { position= (Integer) this.getParent().queryBestResult(pPosition); } catch (NumberFormatException e) { posit...
970bd9a8-8ee1-45b5-9c4f-288f8a5efacb
2
public boolean canContain(ContainableSimWo conSimWo) { // System.out.println(getName() + " is finding out whether it can hold " + conSimWo.getName() + "."); boolean canContain = canItselfContain(conSimWo); if(canContain && getContainer() != null) //can itself and is contained in someth...
08107a0f-e4b2-406a-af3e-5512d53af0f6
2
static double[][] cofactor(double[][] A){ double[][] B = new double[A.length][A.length]; for(int i = 0; i < A.length; i++){ for(int j = 0; j < A.length; j++){ B[i][j] = Math.pow(-1,i+j)*det(minor(A,i,j)); } } return B; }
d2f1b849-a05b-44f3-8057-f363245efb29
3
public static void deleteschoolaward(Bean beanobj)throws Exception{ try{ String query1="select * from awardschool where schoolid='"+beanobj.getSchoolid()+"'"; String query = "delete from awardschool where schoolid='"+beanobj.getSchoolid()+"'"; con=DBConnection.getConnection(); pt=con.prepareStatement(q...
d22d24d8-ca68-4951-9578-e019910a0f44
8
public static void main(String[] args) throws IOException { long inicio = System.currentTimeMillis(); StringBuilder out = new StringBuilder(); BufferedReader in; File archivo = new File("entrada"); if (archivo.exists()) in = new BufferedReader(new FileReader(archivo)); else in = new BufferedReader(new...
ec8acb62-504c-4496-abb7-330deb6354cd
2
public static void main ( String[] args ) throws IOException, ClassNotFoundException { PosTagger posTagger = new PosTagger("/home/aditya/Downloads/stanford-postagger-2013-04-04/models/english-left3words-distsim.tagger"); File indirectory = new File("/home/aditya/Desktop/sampleroutput/"); // File...
670c5741-3219-4627-885f-7461e04a4bac
0
public Session getSession() { return HibernateSessionFactory.getSession(); }
ed8fba90-aad4-4e28-8000-02f5092998d5
4
protected void paintComponent(Graphics g) { super.paintComponent(g); if (pixels != null) { Rectangle bounds = g.getClipBounds(); for (int i = bounds.x; i < bounds.x + bounds.width; i++) { for (int j = bounds.y; j < bounds.y + bounds.height; j++) { try { g.setColor(pixels[i][j]); g.fillRec...
6e9acfbc-e883-40b8-b49f-e18d1bca6e08
8
protected void drawMapTiles(final Graphics g, final int zoom, Rectangle viewportBounds) { int size = getTileFactory().getTileSize(zoom); Dimension mapSize = getTileFactory().getMapSize(zoom); // calculate the "visible" viewport area in tiles int numWide = viewportBounds.width / size + 2...
bb95d8b6-0c13-445f-a914-184d7d16878b
3
public void clear() { for (DestructibleBrick _dBrick : _dBricks) { Buffer.deleteElement(_dBrick); } _dBricks.clear(); for (IndestructibleBrick _iBrick : _iBricks) { Buffer.deleteElement(_iBrick); } _iBricks.clear(); for (Ball _ball : _balls...
c422f957-27eb-42ef-868f-f4bdf1599877
0
private void submitGroupCreation() { driver.findElement(By.name("submit")).click(); }
9ce9e711-9d18-45ef-85c3-2a708038bfc7
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof OFPacketQueue)) return false; OFPacketQueue other = (OFPacketQueue) obj; if (length != other.length) ...
0e3af237-6bf6-41fa-8f6a-7665c5e6e7e0
1
@Test public void testEdges() { EdgeFinder edgeFinder = new EdgeFinder(); double[][] edges = edgeFinder.findEdges(testSmoothedGray); try { for(int i = 0; i < edges.length; ++i) { assertArrayEquals(testSmoothedGrayEdges[i], edges[i], 0.5); } } finally { System.out.println("Edges Expected:"); Sys...
d0743522-0892-4c50-9315-52acc8355546
0
private void jButtonChercherActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonChercherActionPerformed //Récupération de la méthode contrôleur 'chercher' ((CtrlVisiteurs)controleur).chercher(); }//GEN-LAST:event_jButtonChercherActionPerformed
ce0deb6b-592d-4f77-9fd4-cd8ba46b9573
7
public Object [][] getDatos(){ Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (colum_names.length>=0){ r_con.Connection(); String c...
0c73f0a9-ca6b-464b-b8ef-3da8563f1969
7
private void startAttack(final NPC npc, final Entity entity, boolean player, int attack) { switch (attack) { case 0: //Vengeance other - to be casted on one of the minions. if (entity.getTemporaryAttributtes().get("vengeance_activated") == Boolean.TRUE) { startAttack(npc, entity, player, new Random().nextInt...
f45abf11-ca0d-4b9a-ad4f-3f4f045b60f4
5
@Override public void replaceInterval(byte[] newFile, int start) { validateInterval(start, start + newFile.length); if (comp == CompressionType.None) parentFile.replaceInterval(newFile, start); else { byte[] data = parentFile.getContents(); if...
6bcac025-06c8-4d9d-be73-0335e2c1755b
4
public void init(int mode, byte[] key, byte[] iv) throws Exception{ byte[] tmp; if(key.length>bsize){ tmp=new byte[bsize]; System.arraycopy(key, 0, tmp, 0, tmp.length); key=tmp; } try{ cipher=javax.crypto.Cipher.getInstance("RC4"); SecretKeySpec _key = new SecretKeySpec(key...
885f47b0-0375-44f1-ab34-4103307a3e88
0
public MarkerArray(int tMaxMarkers) { maxMarkers=tMaxMarkers; }
8566e9fc-27f2-41f2-9958-095f3552f644
2
private static int fibNum(int position){ if (position == 1 || position == 2) return 1; return fibNum(position - 1) + fibNum(position - 2); }
aa324d65-7af6-4c87-a9d9-1e6b16368008
1
private static void addArrayToComboBox(Object[] array, JComboBox component) { for (int i = 0; i < array.length; i++) { component.addItem(array[i].toString()); } }
12a644d6-516a-4b83-befe-f0d2ade14d67
7
private void updateCarrierButtons() { unloadButton.setEnabled(false); fillButton.setEnabled(false); if (isEditable() && selectedUnitLabel != null) { Unit unit = selectedUnitLabel.getUnit(); if (unit != null && unit.isCarrier() && unit.hasCargo()) { unloadB...