method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b48a9463-1eed-4270-a342-8a44469ea963
9
public void paintComponent(Graphics g) { g.setColor(Color.black); g.fillRect(0, 0, getHeight(), getWidth()); g.setColor(Color.white); int[][] joints = moc.joints; if (joints != null) { try { for (int skelIndex = 1; skelIndex <= 2; skelIndex++) { ...
65539ff2-f275-40d5-ac92-d3b89a293445
3
private static void writeTableAssignmentByStudent(String fileName) { int thisGrade, prevGrade; EasyWriter tableByStudent = new EasyWriter(fileName + "_byStudent.txt"); // "table_assignment_by_student.txt"); if (tableByStudent.bad()) { System.err .println("Error creating table_assignment_by_student.txt\n")...
8ca3c948-c329-4a99-bbdb-fc6e7037ce36
5
protected boolean isAnImage(String path) { Logger.getLogger(AbstractImageHandler.class.getName()).entering(AbstractImageHandler.class.getName(), "isAnImage", path); if (path.toLowerCase().endsWith(".jpg") || path.toLowerCase().endsWith(".jpeg") || path.toLowerCase().endsWith(".gif") || path.toLowerCase(...
b319cb11-2819-4475-88bd-a6cf70cdb73c
0
public String getCalle() { return Address.getCalle(); }
50683dca-451f-44c1-88fe-6bc90a88712c
5
public boolean isChangingState(StateBasedGame sbg) { //System.out.println("epdert"); if(!isChangingState){ if(menuClutter.getAnimation().getFrame() != 0){ int i = menuClutter.getAnimation().getFrame(); menuClutter.getAnimation().update((long) -Game.getDelta()); if(menuClutter.getAnimation().getFrame(...
e9b6a677-9c08-44bb-93b3-be684cf5f052
1
public void AddPosition(Position p){ if (!this.trail.contains(p)){ trail.add(p); } }
ed336f2d-f3c8-4fa4-9e46-e5d347bb0aaa
4
public static float[][][] getJoinCenter(float[][][] p, float[][] c, int cluster) { float temp = 0; float tmp = 0; float belong = 0; for (int i = 0; i < p.length; i++) { if ((int) p[i][0][0] == cluster) { temp = Calculate.getDistance(p[i], c[0]); belong = c[0][0]; for (int j = 1; j < c.length;...
43e28634-5d39-4f63-a6bf-7c5ae429b18f
1
public String getProjectName() { // The projectName is the name of the zip file. if (projectPath.contains(File.separator)) { return projectPath.substring(projectPath.lastIndexOf(File.separator) + 1, projectPath.lastIndexOf(".")); } else { return projectPath; } }
6a9d933a-8aa8-4ac3-82fe-6c5cb633d3ec
5
private ArrayList<Creature>getPossibleTargets(){ ArrayList<Creature>possibleTargets = new ArrayList<Creature>(); TileMap map = ((Ship)parent).getParent().parent.getMap(); LinkedList sprites = map.getSprites(); for(int i = 0; i < sprites.size(); i++){ if(distanceBetween((Creature) sprites.get(i), this.parent)...
80b3cb50-a481-482c-83a6-5a291ffcc548
9
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { if ( (request.getPa...
093374fc-a6a0-4d0c-bc4f-4a4c9444cfab
4
public static Scorecard readRoundFromFile(File filename) { JSONObject json = new JSONObject(); try { LOGGER.log(Level.INFO, "Reading round JSON from file '" + filename + "'"); json = (JSONObject) new JSONParser().parse(new FileReader(filename)); } catch (FileNotFoundException e) { e.printStackTrace(); } c...
0e9a6809-0f0c-4e99-81ea-2ff071b58baf
4
void prune(ConstPool cp) { LinkedList newAttributes = new LinkedList(); AttributeInfo invisibleAnnotations = getAttribute(AnnotationsAttribute.invisibleTag); if (invisibleAnnotations != null) { invisibleAnnotations = invisibleAnnotations.copy(cp, null); newAtt...
e1fada38-3eb3-4a2c-ad43-89362e87d2fe
3
public void loadLegendConfigFile() throws FileNotFoundException, BadConfigFormatException { //Declare FileReader, Scanner, and local variables inputFileReader = new FileReader(legendFile); reader = new Scanner(inputFileReader); String entry; int numEntries = 0, currentRow = 0; //count the number of li...
7f925f6c-7f94-4531-85be-7b7333b992e3
5
public static boolean wasKeyPressed(char c) { try { if (!keypCheckInitiated) { keypCheckInitiated = true; keypLastUpdate = System.currentTimeMillis(); } if (keypLastUpdate + TIMEOUT < System.currentTimeMillis()) { app.keysPressed.clear(); } Character n = new Cha...
e3bdb8bc-110f-402a-8d4b-a2f893cc5b5a
6
public Card handleSuggestion(String person, String room, String weapon, Player accusingPerson) { // get the index of the player making the guess int index = 0; for (Player playa : players) { if (playa.equals(accusingPerson)) { break; } else { index++; } } // check the 2nd half of the list, of...
80bf9c93-573d-496d-ae53-1b0ef632103a
6
@Override public void paint(Graphics g2) { super.paint(g2); Graphics2D g = (Graphics2D) g2; // Draws info sheet g.drawString("Distance X to Zone #2: ai (1 ≤ i ≤ m).", 20, 500); g.drawString("Distance Zone #2 to Zone #3: bij (1 ≤ i ≤ m, 1 ≤ j ≤ n)", 20, 520); g.drawString("Distance Zon...
ee4ec68c-49e0-4ed4-b7ce-32452d3bf048
0
public void setWidth (int width) { this.width = width; radius = (width/2) - 10; setSize(width + 12, height + 102); canvas.setSize(width,height); doLayout(); }
ccdb1b9a-f8ff-4b48-b7ad-3b489ad6add9
7
public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof Annotation == false) return false; Annotation other = (Annotation) obj; if (getTypeName().equals(other.getTypeName()) == false) return false; ...
b63836d9-2a73-4bd9-a287-4f7c37c58424
6
public static void main(String[] args) { long it = 600851475143l; int n = ((int)Math.sqrt(it)) + 1; boolean isprime[] = new boolean[n+1]; Arrays.fill(isprime, true); isprime[2] = true; isprime[3] = true; for (int i = 4; i < n; i += 2) isprime[i] = false; f...
07f6328d-29f6-4db2-863e-63d1f698dcd3
5
double rate(Board board) { int w=board.getWidth(), blocksAboveHoles = 0; for(int x=0; x<w; x++) { int blocksAboveHoleThisColumn = 0; boolean hitHoleYet = false; for(int i=board.getColumnHeight(x)-1; i>=0; i--) { if(!board.getGrid(x,i)) hitHoleYet = true; blocksAbov...
304abe4b-3a5c-4ba8-837b-bb110dcd164e
0
public String getText() { return text; }
3fd2cbd6-ce72-4af3-b4a7-84b0f9271f65
3
public boolean allNodesAssignedToDominantClusterInNeighbourhood(){ boolean result = true; NodeIterator graphNodesIterator = this.LPAClusteringEngine.getGraph().getNodes().iterator(); while (graphNodesIterator.hasNext() && result && !this.LPAClusteringEngine.getIsCancelled()){ ...
264786b2-3d59-43b0-b908-483648e10b75
4
private void processEvent(Sim_event ev) { if (ev == null) { return; } switch (ev.get_tag()) { case GridSimTags.SCHEDULER_ENQUE: this.enque(ev); break; case INTERNAL_DEQUEUE: this.internalDequeue(ev)...
3e79e9e1-18e3-482d-be14-451c4f5976e2
9
public void AddUpdateAppLicenseData(String appName, HashMap licCount){ // Locate where to write, if you find a cell with the same name on the app that this one the update, if not, as you get an empty cell create it // For copying cells use copyRow() capable of copying full rows // A new app can be copied from the...
88b94fbc-5c55-457c-8391-59990869b62f
4
@Override public Result<Long> authenticate(String username, String password) { UsersDAO dao = new UsersDAO(getDBConnection()); try { if (!checkLoginPassword(username, password)) return new Result<>(-1L, ExceptionMessages.EMPTY_DATA); UserDataSet user = dao.getUser(username); ...
35230e23-1556-498f-90ed-1fb426acfb10
1
public static void main(String[] args) throws IOException { encodeCustom encoder = new encodeCustom(); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]))); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(args[1]))); int c; while...
e83da74b-8e67-4498-93b6-73bbff776198
8
public void run() { try { int port = uri.getPort(); if (port == -1) { port = 80; } // The WebSocket constructor expects a SocketChannel that is // non-blocking, and has a Selector attached to it. SocketChannel client = Sock...
f1047808-e27a-4c7f-865a-2f8229727254
7
public JavaConsole() { // create all components and add them frame = new JFrame("Java Console"); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = new Dimension((int) (screenSize.width / 2), (int) (screenSize.height / 2)); int x = (int)...
084540b1-8842-4b4e-bce4-e1f983c0c19d
6
public org.omg.CORBA.portable.OutputStream _invoke (String $method, org.omg.CORBA.portable.InputStream in, org.omg.CORBA.portable.ResponseHandler $rh) { org.omg.CORBA.portable.OutputStream out = null; java.lang.Integer __method = (java.lang.Integ...
99d56169-5cbe-4e63-976e-28b20c72275e
1
public boolean InsertarTrata(Trata p){ if (p!=null) { cx.Insertar(p); return true; }else { return false; } }
eaf46846-febb-4007-9b05-6cd7c084223c
8
private void insert(int key, int clueKey, int ndj, VertexPulse v ) { int pos = posCalculator(key, baseAproxBucket.getKey()); if(highLevelBuckets[pos] != null){ highLevelBuckets[pos].insertVertexDist(v); }else{ AproxBucket theNewBucket = new AproxBucket(v, key,Delta ); highLevelBuckets[pos] = theNewBuck...
5a010d0e-42df-4cfd-ad2d-811c849dc13c
7
public void afterHotSwap(Class<?> clazz) { List<Class<?>> myClasses = getPageClasses(); for (Class<?> myClazz : myClasses) { if (clazz.isAssignableFrom(myClazz)) { try { ApplicationFactory.updateClassMetaInfo(this, clazz); } catch (InstantiationException e) { e.printSta...
19758ac7-1bfe-450a-abcc-8d0f5c26cdce
2
public static boolean updateProposal(Proposal p) { if (MongoHelper.query("{id:" + p.getId() + "}", Proposal.class, "proposals").iterator().hasNext()) { if (MongoHelper.save(p, "proposals")) { return true; } } return false; }
aba2b1f4-f39f-4d4c-819d-30e46bac4207
0
@Override public final int getBits() { return getCounterwidth()*filter.length; }
57b1080d-9a61-4a1d-8dc8-58b857708770
0
public long getNumSamples() { return numSamples; }
617a0a36-464a-4285-bdd6-56862b001069
2
public void add(Object o) throws PropertyException { if (o instanceof Date) setDate((Date)o); else if (o instanceof Place) setPlace((Place)o); else throw new PropertyException("Unable to add object of type " + o.getClass().getName() + " to an Event"); }
fc17656d-a71b-4da9-b73a-bcaceb6fc29f
9
@Override public void draw(Graphics2D g) { if (!data.death && !data.WIN) { g.setColor(Color.BLACK); //Draw the maze g.drawImage(data.levels[curLevel].back, 0, 0, null); //Draw the powers up for (int i = 0; i < data.powers.size(); ++i) { ...
d87b117a-20ad-4eac-b2e9-e88f8eeed2cb
0
public void setOsoba(Osoba osoba) { nazwiskoTextField.setText(osoba.getNazwisko()); imieTextField.setText(osoba.getImie()); kodPocztowyTextField.setText(osoba.getKodPocztowy()); miastoTextField.setText(osoba.getMiasto()); ulicaTextField.setText(osoba.getUlica()); telefonTextField.setText(osoba.getTelefon())...
f9bb4ad5-198e-4b33-83ef-127d9de32d20
5
@Override protected void process(int bits[]) { for ( int i = 0 ; i < bits.length ; i++ ) { int bit = bits[i]; int j = i * SignalPlot.DIVISIONS; int k = ( i + 1 ) * SignalPlot.DIVISIONS; int m = SignalPlot.DIVISIONS / 2; for...
497433ad-be05-4202-ae2a-a1753ef1b0a6
4
@Override public void processCas(CAS aCAS) throws ResourceProcessException { JCas jcas = null; try { jcas = aCAS.getJCas(); } catch (CASException e) { throw new ResourceProcessException(e); } String sentenceId = ""; FSIterator<TOP> sentenceIterator = jcas.getJFSIndexRepository().g...
8082b828-60be-4fb1-9128-b53a60957204
5
public int[] mapColumnsToProperties(ResultSetMetaData rsmd, PropertyDescriptor[] props) throws SQLException { int cols = rsmd.getColumnCount(); int[] columnToProperty = new int[cols + 1]; Arrays.fill(columnToProperty, -1); for (int col = 1; col <= cols; col++) { // Try to get user specified column name f...
6e9e8c72-cd99-4cc6-be43-046932ab59e9
2
private static int existsIn(Variable variable, List<Variable> existingVariables) { int cpt = 0; for (Variable existing : existingVariables) { if (existing.equals(variable)) { return cpt; } cpt++; } return -1; }
cc8d2eb0-561e-4970-a2fb-280f09abc895
2
public void KeyDown(int key, char c) { if(key == Input.KEY_M) { game.enterState(BirdMinigame.BIRD_MINIGAME_STATE_ID, new FadeOutTransition(), new FadeInTransition()); } else if(key == Input.KEY_N) { ((BattleState)game.getState(BattleState.BATTLE_STATE_ID)).setBattle(new Battle(PokemonManager.getPokemonById(1...
20942f85-58e0-4be6-8642-1ae051d6641a
7
protected static Number toNumber(BigDecimal bd){ String s = bd.toString(); int dot = s.indexOf('.'), e = s.indexOf('E', dot+1); //change e to the end if there is no exponent if(e == -1) e = s.length(); //change dot to e if there is no dot if(dot == -1) dot = e; String integer = s.substring(bd.signum() == ...
853455ef-703c-4c2f-a224-518ed88359d7
6
@Override public Object[] crossover(List<Individual> parents){ for (Individual parent: parents){ if (!(parent instanceof Individual)){ try{ throw new Exception("Parent incorrect class?"); }catch(Exception e){ e.printStackTra...
ca15e208-b321-4dab-97b7-00990c9875a9
2
public void alimentaTabela(String SQL){ ArrayList dados = new ArrayList(); String [] Colunas = new String[]{"ID","Nome","CPF","RG","CNH","Cat","Contato","Parent","Telefone","Tel2","TeleContato"}; conecta.executaSQL(SQL); try { conecta.rs....
3e3a12de-ebb2-41c6-964c-c5554fbbdf3a
0
public HallEventType(final String name) { super(name); }
cb8a2362-0383-4193-bbf1-4f709a338a14
6
private static List<File> getAllSamples() throws Exception { List<File> list = new ArrayList<File>(); File topDir =new File(ConfigReader.getMbqcDir() + File.separator +"bioinformatics_distribution"); for(String s : topDir.list()) { File labDir =new File(topDir.getAbsolutePath() + File.separator + s); ...
8e0dc2a3-3379-4de0-973c-ed0c9511c824
9
public void paint( Graphics g ) { super.paint(g); int i; //Draw Line while dragging if ( mode==1 && dragging == true) { temporaryDragLine.drawMe(g); } //Draw Line for (i=0; i<lineCount; i++) { lines[i].drawMe(g); } //Draw Boxes for ( i=0; i<boxCount; i++ ) { boxes[i].drawMe...
dc846b8f-eb48-4f0a-98c2-9943e78a3e5f
1
static Constructor[] getDeclaredConstructors(final Class clazz) { if (System.getSecurityManager() == null) return clazz.getDeclaredConstructors(); else { return (Constructor[]) AccessController .doPrivileged(new PrivilegedAction() { pub...
c7b89aac-9b72-41a7-b3d0-7fbbaab0967c
8
public void scann(String text) { clean(); int pos = 0; int line = 1; main: while (pos < text.length()) { for (String ign : ignore) { Pattern p = Pattern.compile(Pattern.quote(ign)); Matcher matcher = p.matcher(text.substring(pos)); if (matcher.lookingAt()) { if (isNewline(ign)) line++; ...
23761a57-af15-424d-83e9-77e1d857779c
9
public void actionPerformed(ActionEvent e) { if ("newmaps".equals(e.getActionCommand())) { if (game != null) closeGame(); newMapSamples(); } else if ("newgens".equals(e.getActionCommand())) { List<GeneratorIndividual<T>> individuals = gaPop.getIndividuals(); for (int index = 0; index < individuals.s...
075fc8f8-7ad8-4a30-95c9-6b930badebfa
1
public void visitChildren(final TreeVisitor visitor) { if (tree != null) { tree.visit(visitor); } }
47a0a9b4-b174-4ada-b27e-cc04bd089497
9
public void combineUnaryInput() { /***** Take care of left *****/ if (left instanceof LvalExpression && ((LvalExpression) left).hasUnaryInput()) { if (((LvalExpression) left).unaryInputIsNotResult()) { // input is result of Not gate - combine in to this gate op = ((PrimitiveOperator) op).negLeft()...
12677d2c-c2e8-4f0c-9cca-efdaf6c8edeb
2
protected void checkCache(PermissionType type, String name) throws DataLoadFailedException { if (cache.get(type) == null || cache.get(type).get(name.toLowerCase()) == null) { load(type, name); } }
e7a055c9-7718-436b-a54c-d83f2c7059f1
4
private static <T extends Comparable<? super T>> void insertionSort( T [ ] a, int left, int right ) { for( int p = left + 1; p <= right; p++ ) { T tmp = a[ p ]; int j; for( j = p; j > left && tmp.compareTo( a[ j - 1 ] ) < 0; j-- ) a[ j ] = a[ ...
d3743d0e-20b3-463a-b093-d7c37195b41a
4
@Override public boolean equals( Object o ) { if (o instanceof NPuzzleHash) { NPuzzleHash h = (NPuzzleHash)o; for (int y = 0; y < board.length; y++) { for (int x = 0; x < board[y].length; x++) { if (board[y][x] != h.board[y][x]) { return false; } } } return true; ...
a7e35ec0-ef26-430b-8a19-1d520eafa1df
6
public 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://download.or...
9417216f-aad8-44cb-8c11-d2603373ed6a
5
public void evolveMove(Player player) { if (moving) { Move move = player.getMove(); boolean timerEnded = move.updateTimer(); if(timerEnded) { Direction dir = move.getDir(); player.setOnSquare(dir); move.nextStep(); ...
7c15a05f-bd5d-48ba-986d-b4924f506e05
3
@Deprecated public static EnumWoodType getFromCompound(NBTTagCompound compound) { if (compound != null) { int typeOrdinal = compound.getInteger("WoodType"); if (typeOrdinal >= 0 && typeOrdinal < VALUES.length) { return VALUES[typeOrdinal]; } } return EnumWoodType.LARCH; }
230ced6a-2605-43b3-88eb-acd3f79c7b5a
7
private JPanel buildTop() { JPanel panel = new JPanel(); panel.setLayout(gl); JLabel reportLabel = new JLabel("Music Action Folder:"); gc.gridx = 0; gc.gridy = 0; gl.setConstraints(reportLabel, gc); panel.add(reportLabel); reportFolder = new JTextField("C:\\report\\",60); gc.gridx =...
423e9976-184a-4c82-a772-bd92fa8aa157
3
private void checkAndCreate() { //checks validity of q20/txt file if(checkReader.hasNextLine()) { String firstLine = checkReader.nextLine(); if(firstLine.equals("Q:") || firstLine.equals("A:")) { //if first line is not Q or A, file is not valid checkReader.close(); head = create(null, head); //if file ...
bc921c4f-f4dd-4e09-8621-1a7a5d3aa7d2
3
private void recalcsz() { sz = invSqSizeSubOne.mul(isz).add(new Coord(1, 1)); if ((trash != null) && (trash.visible)) { trash.c = sz.sub(0, invSqSize.y); hsz = sz.add(16, 0); if (needshift()) {// small inventory, button should be shifted // (Finery forge, oven, crucible) trash.c.x += 18; hs...
e0f15488-e9e0-4bb4-be2d-9a60e668f1f3
6
public void SimpleRunSameSideLinks(String dataFile, String outputFile){ globalLinkCounter = 0; L = new LinkSet(); if(localconditions == null) { localconditions = new String[0]; } MatchData M = new MatchData(dataFile); Match m; int c = 0; ...
606ea5dd-d962-4901-b72f-280b7a07e318
7
public boolean allLeaved() { if (!team.isEmpty()) for (BuchBuch b : team) if (! b.isDead()) return false; for (BuchBuch b : leavers) if (b.getX() > -62) return false; for (BuchBuch b : deads) if (b.getX() > -62) return false; return true; }
49278571-e761-474f-bf81-3b9de56f479a
5
public static Map<String, Object> getBelongsTo(Object obj) throws Exception { Map<String, Object> attrs = new HashMap<String, Object>(); for (Field field : obj.getClass().getDeclaredFields()) { Class<?> fieldType = field.getType(); String fieldName = field.getName(); Annotation[] annotations = field.getDec...
08cde7d4-f007-485e-be81-b515d0602abb
2
public rankInfo getRank(int followers){ for (int i = (rankList.size() - 1); i >= 0; i--) { if (followers >= rankList.get(i).followers) return rankList.get(i); } return null; }
0a06c0ef-6dfd-416a-982a-8957999a3f26
8
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int c = 1; String s; while(sc.hasNext()){ s = sc.nextLine(); if(s.equals("#")){ break; } else{ if(s.equalsIgnoreCase("hola")){ ...
615ad44e-e018-4d93-aee6-d164dd3f70dc
8
public void printTable(){ String wLine = ""; wLine += "State: Input:"; System.out.print("State: Input:"); //17 Characters for(String i : inputs){ System.out.print(" | " + i + " "); //13 Characters wLine += " | " + i + " "; } System.out.println(); wLine+="\n"; for(Token s...
3c79937b-ac77-47fc-96ba-404e693f45ad
4
public boolean checkForWin() { if(checkForWinVertical() || checkForWinHorizontal() || checkForWinDiagonal()) { return true; } if (ActionCounters.getCounter() >= 9) { isWin = true; isLose = true; gameOver = true; return true; } return false; }
8b086692-6bc4-4ef4-a0e8-95f1cb72cfeb
0
public void runCommand() { }
31040e9b-7766-4b0a-bdc9-4b993b441d51
9
public static void main(String[] args) { if (READ_FROM_STDIN == 1) { java.util.Scanner sc = new java.util.Scanner(System.in); n = sc.nextInt(); s = sc.nextInt(); sc.close(); } if (s % 2 != 0) { System.out.println(0); ...
963b2c9d-3314-4590-9e95-b6f01c036665
3
private void launch(){ if (targetedMob.getTargetHp() >= 0){ if (type.equals("pierce")) {//piercing strike basicAttack = new Laser(speed, power,1,element,targetedMob,elementString); } else if (type.equals("artillery")) { ...
498f780e-cf2d-4ee9-a727-4dd21a8f4118
9
@Async public synchronized void process() { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = null; try { parser = factory.newSAXParser(); } catch (ParserConfigurationException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (SAXException e1) { ...
63a9b550-1e4e-4644-a334-d7d9411bf8c5
0
public T get(int i) { return objArr[i]; }
551c9a34-9c76-4f84-a36f-29b3552a1f1e
9
@Override public void paintComponent(Graphics g) { super.paintComponent(g); if(grid != null) { for (int x = 0; x < grid.length; x++) { if (grid[0] != null) { for (int y = 0; y < grid[0].length; y++) { double inverseProb = 1 - grid[...
037f568c-ebb2-4c0d-a5ed-d3dd0568defe
6
public static double pt(double t,double df) { // ALGORITHM AS 3 APPL. STATIST. (1968) VOL.17, P.189 // Computes P(T<t) double a,b,idf,im2,ioe,s,c,ks,fk,k; double g1=0.3183098862;// =1/pi; if(df<1) throw new IllegalArgumentException("Illegal argument df for pt(t,df)."); idf=df; ...
cce78f73-76dd-4eec-96ea-d5be52a3e42a
1
public String getStyle(String key) { if(styles!=null) return styles.get(key); return null; }
8a523f69-6888-4900-affb-6b60aed3c494
1
@Test public void delUser(){ Connection conn = null; Statement statement = null; try{ conn = JDBCUtils.getConnection(); statement = conn.createStatement(); statement.executeUpdate("DELETE FROM table_user where name = 'Lucy'"); }catch (Exception e) { e.printStackTrace(); }finally{ ...
829da4c1-9336-4c0d-8528-fee55ce4f58c
0
public final void sendInvite(String nick, String channel) { this.sendRawLine("INVITE " + nick + " :" + channel); }
ab389d58-3008-4c88-b3c3-f9331bdb8916
2
public void run() { while(!isInterrupted()) { try { byte[] b = new byte[128]; InputStream input; // Datenstrom zum Lesen verwenden input = client.getInputStream(); // Ankommende Daten lesen input.read(b); String msg = new String(b).trim() + "\n"; // Den Clients antworten &...
11d5cad3-0a0b-4cc7-a4bd-d43588d86b76
4
public void rozlacz() { try { if(out !=null) out.close(); if(in!=null) in.close(); if(sock!=null) sock.close(); //serv.close(); czyRozlaczono = true; } catch (IOException e) {System.out.println("Błąd RozlPolacz: "+e.getMessage...
18062749-1cd2-4e32-a1c5-1c35a3a8a411
3
public ReturnObject get(int i) { ReturnObjectImpl output = new ReturnObjectImpl(); if (size() == 0) { output.value = ErrorMessage.EMPTY_STRUCTURE; return output; } if (i < 0 || i >= size()) { output.value = ErrorMessage.INDEX_OUT_OF_BOUNDS; return output; } output.value = array[i]; return ...
e046a34b-06b7-49bd-a70e-6a318f14ef02
4
public int maxSubArray(int[] A) { // IMPORTANT: Please reset any member data you declared, as // the same Solution instance will be reused for each test case. int carry = 0; int[] DP = new int[A.length]; for (int i = 0; i < A.length; ++i) { DP[i] = carry + A[i]; if (carry + A[i] < 0) { carry = 0; ...
6da0528b-a344-4f41-99d4-db4c39a1c91c
4
public boolean hasReachedEnd(Traffic traffic){ if(traffic.yStartingPos == 3 || traffic.yStartingPos == 1){ if(trafficRectangle.x > FrogsterConstants.JPANEL_SIZE){ return true; }else{ return false; } }else{ if(trafficRectangle.x + trafficRectangle.width < 0){ return true; }else{ return...
9af8747c-5da8-489c-97f1-bccbf8b698ec
5
private void jTextField3KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField3KeyPressed // TODO add your handling code here: if(evt.getKeyCode()==10){ if(modo.equals("Baja")){ if(jTextField3.getText().equals("")) JOptionPane.showMessageDia...
ae7f592b-a577-4e64-b236-9d2898a6e5c2
2
public void addQuizDecision(String title,int quizId,ArrayList<String> imageList, ArrayList<Boolean> imageInventoryList,ArrayList<String> soundList, ArrayList<Boolean> soundInventoryList, int narration, String paragraphList, String preNote, String postNote, int points, String date,ArrayList<String> goToList,...
ae8f24eb-777d-49da-a00b-f9ae770514a6
5
private final void checkSliderPosition(int sliderIndex) { TButton slider = sliders.get(sliderIndex); if (isVertical) { if (slider.getYD() < y - (slider.image.getHeight() / 2)) slider.setY(y - (slider.image.getHeight() / 2)); else if (slider.getYD() > y + height - (slider.image.getHeig...
31dd8500-0595-4c90-bd15-36761f7cd5fe
7
public Integer insert(IdUnicoBeans producto) throws DAOException { PreparedStatement pst = null; ResultSet generatedKeys = null; try { pst = con.prepareStatement(sql.getString("INSERT_IDUNICA"), Statement.RETURN_GENERATED_KEYS); pst.setInt(1, producto.getIdUnico()); pst.setInt(2, producto.ge...
08991b35-b5b9-4fc5-aac6-5a9cc05c9540
4
private void endSpeak(){ speaking = false; speakText = null; music.fadeIn(Game.musicVolume); if (currentScript != null){ if(currentScript.peek() != null) if(currentScript.peek().toLowerCase().equals("choice") && displayText.isEmpty()) currentScript.readNext(); } }
dfe3bdfa-21c0-4cdd-9781-3c73e3e6657e
2
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) { return; } Node node = textArea.n...
840b05a4-4274-416d-b74a-fbd3b8795881
1
public Decryption(String m, String k) { char[] c = fill(k); int[] i = fill1(c); int[] s = split(m); int[] n = Unscramble(s, i); if (!k.equals(null)) { r = Reconstruct(n); } }
567c0f50-e065-4dcf-a697-9cfb09803140
7
@Override public Command planNextMove(Info info) { uhel++; List<InfoDetail> enemies = new ArrayList<InfoDetail>(); enemies=info.getEnemies(); for(InfoDetail enemy : enemies) { //System.out.println("x0 : "+info.getX()); //System.out.println("y0 : "+info.getY())...
14a5de07-4225-405f-98b5-70d5cfa786fa
8
public BinarySearchDistribution(double[] weights) { //compute sum try { double sum = 0.0; for (int i = 0; i < weights.length; i++) { if (weights[i] < 0) { throw new IllegalArgumentException("All Weights Must be non-negative :: " + weights[i]); } sum += weights[i]; } //build cummulati...
cb01a0bc-b2bc-4e27-a434-cf580abe5bb0
6
private void redispatchMouseEvent(MouseEvent e, boolean repaint) { Point glassPanePoint = e.getPoint(); Container container = contentPane; Point containerPoint = SwingUtilities.convertPoint(drawPanel, glassPanePoint, contentPane); if (containerPoint.y < 0) { // we're not in the content pane // if (...
8b20307f-2587-4f52-b35e-7deefb0ed242
0
@Override public void addObserver(Observer o) { super.addObserver(o); }
96a80a9b-dcda-47fe-a5fb-cb9d8eabd199
2
public static Object dequeue() { if (outStack.isEmpty()) { flipStack(); } if (!outStack.isEmpty()) return outStack.pop(); else return null; }
037bd875-4164-4158-abd4-4cf3eb8c9861
1
@Override protected boolean isAttackPlacesForPositionNotHarmingToAnotherFigures(int position, char[] boardElements, int dimension) { return isPerpendicularAttackPlacementNotHarming(position, dimension, boardElements) && isDiagonalAttackPlacementNotHarming(position, boardElements, dimension); ...
e9ae419b-a658-4153-ad47-36eeb583d7ea
7
private svm_problem readProblem(InputStreamReader isr) throws MaltChainedException { final svm_problem problem = new svm_problem(); final svm_parameter param = getLibSvmParameters(); final FeatureList featureList = new FeatureList(); try { final BufferedReader fp = new BufferedReader(isr); problem.l =...
6df80d2a-ed1a-46a7-bc62-39f1b458df2b
3
public static String getMysteryString(String token) { String str=token.toLowerCase(); if (token.equals(str)) { return MYSTERYLC; } else { if (token.matches("^\\p{IsUpper}+")) { return MYSTERYUC; } if (token.matches("^\\p{IsUpper}\\p{IsLower}+")) { return MYSTERYUC1ST; } ret...