method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5ebeecad-1945-49f1-bd13-e800d20cd3ed
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); BigDecimal a, b; String[] w; do { line = in.readLine(); if (line == null || line.length() == 0) break; ...
b8f6c088-4902-480c-b77c-3558e77da712
0
public void msgMenu() { System.out.println("0.Sair"); System.out.println("1. Criar uma nova conta"); System.out.println("2. Depositar na conta"); System.out.println("3. Sacar da conta"); System.out.println("4. Consultar o saldo"); System.out.println("5. Cadastrar clie...
fee27116-dc7c-4b7a-8551-eb852c2b39be
9
@DELETE @Path("delete/personne/{id}") public String deleteById(@PathParam("id") String arg0) { System.out.println("bien appelé "); EntityManager manager = SingletonManager.getManager(); EntityTransaction t = manager.getTransaction(); t.begin(); String res = "nok"; try { Personne p = manager.find(Pers...
48f3bf23-20d6-4689-b9a8-4229a1bca855
6
@Override public void drawCell(Outline outline, Graphics gc, Rectangle bounds, Row row, Column column, boolean selected, boolean active) { if (row != null) { StdImage image = getIcon(row, column, selected, active); if (image != null) { int x = bounds.x; int y = bounds.y; if (mHAlignment != SwingC...
2fc438b7-9dd0-4831-b04d-77e5edca300d
1
public JPanel getPWResetBtnChangesMenu() { if (!isInitialized()) { IllegalStateException e = new IllegalStateException("Call init first!"); throw e; } return this.pwResetBtnPanel; }
3d3b097a-a92e-4d7f-84fb-bb262d550fe2
4
public Token determineToken(String st) { Token tok = new Token(); tok.setValue(st); if (st.equals("(")) { tok.setType(Token.TokenType.L_PAREN); } else if (st.equals(")")) { tok.setType(Token.TokenType.R_PAREN); } else if (Character.isDigit(st.ch...
295b6181-e228-4ab4-9997-3d96f425ea30
0
public FrameAddArraysData getDataWindow(){ return dataWindow; }
107a1b47-f39b-4e23-b58a-67fac816b0f9
4
public static <T> T getTrackObjectAt(World world, int x, int y, int z, Class<T> type) { TileEntity tile = world.getTileEntity(x, y, z); if (tile == null) return null; if (type.isInstance(tile)) return (T) tile; if (tile instanceof ITrackTile) { ITrackI...
8cf68bd3-de95-4ae8-a54c-e30731ce8438
1
public void signOut() throws SocketTimeoutException { try { clientSocket.Escribir("SALIR\n"); serverAnswer = clientSocket.Leer(); } catch (IOException e) { throw new SocketTimeoutException(); } System.out.println(serverAnswer); }
a805fed4-b3b8-4d9a-b75e-72d8869fd0be
8
public void setRecursiveNotDirty() { super.setRecursiveNotDirty(); this.isAltitudeModeDirty = false; if(this.location!=null && this.location.isDirty()) { this.location.setRecursiveNotDirty(); } if(this.orientation!=null && this.orientation.isDirty()) ...
5426358c-15ce-4d6f-ada7-4534e13ca36d
8
public BufferedImage thresholdTransform(BufferedImage image,double threshold, int grayValue){ if(image == null){ return null; } int width = image.getWidth(); int height = image.getHeight(); //calculate color as RGB integer int color = (grayValue << 16) | (grayValue << 8) | grayValue; ...
60b961aa-b3c0-4451-a7c4-7c8340f84086
5
@Override public void onStop() { try { String user = Base64.encode(Environment.getDisplayName()); String timerun = Base64.encode(Long.toString((System.currentTimeMillis() - startTime))); String profits = Base64.encode(Integer.toString(profit)); String killed = Base64.encode(Integer.toString(killCount)); ...
a5e46d80-3305-43c0-b74c-e3a407d53c25
2
@Override public void execute() { Map<String, Ban> bans = plugin.getController().getBans(); Player receiver = getReceiver(); // prepare values HashMap<String, String> values = new HashMap<String, String>(2); values.put("{amount}", String.valueOf(bans.size())); // pu...
a09babb8-a3a5-4b3e-95c8-e77cb7bc3825
6
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (email != null ? email.hashCode() : 0); result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (surname != null ? surname.hashCode() : 0); result...
3b4d54de-ba47-423d-87d0-83f0cc74de78
4
public MyCoastLines() { String[][] coastLineArray = getCoastLineArray(); utmPoints = new MyUTMPoint[coastLineArray.length][]; for(int i = 0; i < coastLineArray.length; i++) { utmPoints[i] = new MyUTMPoint[coastLineArray[i].length]; for(int j = 0; j < utmPoints[i].length ; j++) { if(coastLineArray[i][j] ...
f9737b25-1eec-42c0-b5c6-1a504946245e
0
public ConsoleListener(TotalPermissions p) { plugin = p; }
606f4581-0db5-464a-88de-e3bd6be8c2ff
0
public String getSaleid() { return this.saleid; }
b64b3232-c028-4431-8be6-85136f6a0bb0
4
public static String getClean(String sport) { if(sport!=null) { List<Sport> sports = getAllSport(); for(Sport sp : sports) { if(sp.name!=null && sp.name.compareTo(sport)==0) return sp.getCleanName(); } } return null; }
8171689c-b4f3-48b6-8a7f-b98a2f0362ba
3
public void saveConfig() { if (config == null || configFile == null) return; try { config.save(configFile); } catch (IOException ex) { plugin.getLogger().log(Level.SEVERE, "Could not save data to " + configFile, ex); } }
76e071c8-ea1f-4f27-ac9f-8fe922393876
3
public static void main( String[] args ) throws java.io.FileNotFoundException, IOException { try{ String testFile; if( args.length != 0 ){ testFile = args[0]; } else{ testFile = "klein-programs\\tests02-parser\\08-print.kln"; } SemanticAnalyzer analyzer; S...
60f26fb9-8df9-4c74-8826-2d34e0ac23ec
0
public List findByAuther(Object auther) { return findByProperty(AUTHER, auther); }
772decc8-feb8-44a2-80ad-75725e86c5f6
6
private void statementDecl() { next(); // To check for all of the types // if we've got modifiers, always do it... // Other conditions: ident + [] or ident + ident if (_token == TK_IDENT && (_defining || _nexttoken == TK_BRACKETS || _nexttoken == TK_IDENT)) { // if ((_defining || _token == TK_IDENT) && (_next...
d75b45c2-1ae0-4334-a528-6ea9f2f0d5cd
8
private Nodo seleccion() { ArrayList<Nodo> lis; Nodo tem = new Nodo("if", Nodo.tipoToken.PalabraReservada); if (aux.getTipo()==Nodo.tipoToken.ParentesisIzquierdo) { aux=(Tokens2)tok.next(); } else { error("Se esperaba ("); } Nodo temR = new Nodo("C...
0ddc1f21-1072-4aa1-808f-de202c5813c6
0
public void setIcon() { this.setIcon(this.imgIcon); }
b66d0c61-f67c-40b3-97b3-1c4a08997db3
2
@Override public void run() { if (binary) { // Sanity check if (lineFilter != null) throw new RuntimeException("Cannot apply line filter to binary output."); runBinGobbler(); } else { runLineGobbler(); } }
e0a2fdf7-7384-43bc-a752-6f1afad50dc9
7
public void update () { String path = null; try { path = new File(LaunchFrame.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getCanonicalPath(); path = URLDecoder.decode(path, "UTF-8"); Logger.logDebug("Launcher Install path: " + path);//we need ...
4c37fa21-8394-4769-88d8-9be024218ed2
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Couleur other = (Couleur) obj; if (this.id != other.id) { return false; } if ...
d54f0880-7695-4a1b-aee0-a061f43f8593
5
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (taskId >= 0) { return true; } // Begin hitting the se...
1e567519-fd3b-4af9-9cf5-164f0dc1a1d0
5
private void createCScore() throws YouFailException{ //C: (4*examScore + 13.2) of all wESubjects and oESubject //13.2 int tempScore = 0; for(Subject thisWESubject:wESubjects){ tempScore += 4 * thisWESubject.abinote; tempScore += thisWESubject.semesters[3].mark; ...
3f0fe130-1964-403d-a703-c469ea692f1b
7
public String toString() { if (m_Instances == null) { return "Bayesian logistic regression: No model built yet."; } StringBuffer buf = new StringBuffer(); String text = ""; switch (HyperparameterSelection) { case 1: text = "Norm-Based Hyperparameter Selection: "; break; ...
a4922547-649a-4c46-a97a-12e108ac1a9c
6
private void activarServiciosDeProveedor(LinkedList<Servicio> servicio) { //Como estamos usando Singleton, entonces los cambios que se hagan aquí se conservarán: VtnAgrega_oModificaProveedor vtnModificaProveedor = VtnAgrega_oModificaProveedor.getInstanciaVtnAgregaoModificaProveedor(); for (Serv...
7015d290-7102-40d1-8d10-07a95170c6bb
3
public void resetData(double[] x, double[] y){ this.nPoints = this.nPointsOriginal; if(x.length!=y.length)throw new IllegalArgumentException("Arrays x and y are of different length"); if(this.nPoints!=x.length)throw new IllegalArgumentException("Original array length not matched by new array ...
199ede93-1eca-4ceb-873f-74e92f95fb0c
1
public static void main(String[] args) throws Exception { String str = "hello world wolcome nihao hehe"; char[] buffer = new char[str.length()]; str.getChars(0, str.length(), buffer, 0); FileWriter f = new FileWriter("FileWriteOutFile.txt"); for(int i=0; i < buffer.length;i ++) { f.write(bu...
01b9c8cd-a2a0-4afb-99f7-000bc4d50741
0
public FactoryOfPlaysForCpuForPiece (Position position, Player cpu,int largestCapture){ loadPlays(position,cpu,largestCapture); }
b0ae8a3f-0e96-4966-b1b0-2a200a5f689b
6
public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<Integer> m=new ArrayList<Integer>(); Scanner in=new Scanner(System.in); int sum=0; int n=in.nextInt(); long mint=in.nextLong(); for(int i=0;i<mint;i++){ m.add(in.nextInt()); } ...
c43d402e-2988-438f-b73e-bd0e2a723307
9
public void paintComponent (Graphics g) { super.paintComponent(g); g.setColor(Color.BLACK); x1 = (int)(CONSTANT_A*X_DIM);//determining the location to draw the outline of the calendar y1 = (int)(CONSTANT_B*Y_DIM); boxWidth = (int)(CONSTANT_C*X_DIM);//determining the dimensions of the box int boxHeight ...
2805efed-7644-4d4c-996e-f2eaafc2a1c6
2
public void deleteService(String id) { long tempid = Long.parseLong(id); Query q = em.createQuery("SELECT t from ServiceEntity t"); for (Object o : q.getResultList()) { ServiceEntity p = (ServiceEntity) o; if (p.getId() == tempid) { p.setRooms(null); ...
669ac26e-4335-42ac-8fbe-d64b03266f59
4
public static List<Point> getPointsOnLine (LineEquation line) { List<Point> ps = new ArrayList<Point>(); // x = ay + b if (line.isX()) { double y1 = line.getStart().y; double y2 = line.getEnd().y; if (line.getStart().y > line.getEnd().y) { y1 = line.getEnd().y; y2 = line.getS...
c66d9e45-3d56-4920-a67e-27dac9d7eb29
5
@Override public synchronized void start() { if (D) Log.d(TAG, "start"); // Cancel any thread attempting to make a connection for (ConnectThread ct : connectionAttempts.values()) ct.cancel(); connectionAttempts.clear(); // Cancel any thread currently running a connection ...
5facb388-c916-4aa8-b621-e078e49abbbe
3
@Override public void run() { while (true) { if (pool != null) { writer.println(System.currentTimeMillis() + "," + waitingJobs.size() + "," + runningJobs.size() + "," + pool.inUseVMCount() + "," + pool.availableVMCount()); writer.flush(); } try { Thread.sleep(1000); } catch (Inter...
1965a79f-0493-4f32-a2ad-b171b29f769e
2
public void debugPrint(){ System.out.println("Sentences:"); Iterator<String[]> it = sentences.iterator(); while(it.hasNext()){ String[] sentence = it.next(); for(int i = 0; i < sentence.length; i++){ System.out.print(sentence[i]); System.out.print(" "); } System.out.println(); } }
29234503-e19a-41a5-affa-7689fd149cf5
6
public void permutations(int[] num){ if(list.size() == length){ result.add(new ArrayList<Integer>(list)); return; } for(int i = 0; i< length;i++){ if(flag[i]) continue; if(i > 0 && num[i] == num[i-1] && !flag[i-1]) c...
29d9bc13-070e-4028-baff-a81420dee7d0
3
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, ...
04de680a-94e1-41be-9828-8bffe1349fc8
0
public boolean leave() { return false; }
e2a4037d-5a02-46f3-94f7-4f12ddcdc0a9
6
void initInputFrame(final ClassWriter cw, final int access, final Type[] args, final int maxLocals) { inputLocals = new int[maxLocals]; inputStack = new int[0]; int i = 0; if ((access & Opcodes.ACC_STATIC) == 0) { if ((access & MethodWriter.ACC_CONSTRUCTOR) == 0) { inputLocals[i++] = OBJECT | cw.addTy...
1d8df555-49ae-4648-8d47-afde79171e67
4
public static long kadane(long[] comp) { long sum = 0, max = 0; int startRow = 0; for (int i = 0; i < m.length; i++) { sum += comp[i]; if (sum != 0) { sum = 0; startRow = i + 1; } else if (max < i - startRow + 1) max = i - startRow + 1; max = Math.max(max, comp[i] == 0 ? 1 : 0); } retu...
7b1b7551-75a0-40a6-899c-17451a6c12c0
7
@SuppressWarnings("deprecation") @EventHandler public void onPlayerInteractBlock(PlayerInteractEvent event) { if(event.getPlayer().hasPermission("skeptermod.useitem.godsword") || (event.getPlayer().isOp())) { if(event.getPlayer().getItemInHand().getTypeId() == Material.IRON_SWORD.getId() && event.getPlayer()....
e5006c10-1234-403a-9601-e2b740fe5743
7
public void scaleDown(){ switch (polygonPaint) { case 0: line.ScaleDown(); repaint(); break; case 1: curv.ScaleDown(); repai...
97ca9d3c-2a85-4ac6-904a-c68f80be3201
1
public void visit_arraylength(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
1e3d32aa-ca41-47c0-9d7a-be57da0e443e
5
public boolean equals(Object o) { if (!(o instanceof CompressedGameBoard)) return false; CompressedGameBoard b = (CompressedGameBoard) o; return b.fst2c == fst2c && b.snd2c == snd2c && b.trd2c == trd2c && b.lst2c == lst2c && b.flags == flags; }
72ec6e63-bb74-43db-92cd-19d0e9f7f190
9
protected void addFollowerDependent(PhysicalAgent P, PairList<PhysicalAgent,String> list, String parent) { if(P==null) return; if(list.contains(P)) return; if((P instanceof MOB) &&((!((MOB)P).isMonster())||(((MOB)P).isPossessing()))) return; CMLib.catalog().updateCatalogIntegrity(P); final String ...
de31b083-c0a6-481b-a075-ff672296984c
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
db71d4c5-3e7e-49e7-b219-a2e24d86ba27
8
public void copie(HDD dirSource, HDD dirDest) { // on copie chaque fichier de source dans dest // s'il existe dans dest, on teste la date de modification de fichier // afin de copier uniquement les fichiers mofifiés String nomficSRC; String nomficDST; File folder=new File(dirSource.getPath()); File[] fil...
9ba24807-e78d-42f5-9644-03160f868989
4
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); Cookie[] cookies = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (cookie.getN...
e7b25460-3a99-4449-a4bd-b335f9a02a9d
2
private OpenResult openKey(String key, Integer accessType) { if (METHOD_OPEN_KEY == null) { METHOD_OPEN_KEY = getMethod(mRoot.getClass(), "WindowsRegOpenKey", int.class, byte[].class, int.class); } try { return new OpenResult((int[]) METHOD_OPEN_KEY.invoke(mRoot, new Object[] { mRootKey, toCstr(key), access...
321b66dc-0dd2-4403-aa88-683f037cda24
1
protected void carregaTabelaTelefones(List<Telefone> lista){ this.modeloTabelaTelefone = new DefaultTableModel(); this.modeloTabelaTelefone.addColumn("DDD"); this.modeloTabelaTelefone.addColumn("Numero"); for(Telefone t : lista){ Vector v = new Vector(); ...
80125255-4d85-4f4e-9f68-aeeac593bc74
0
public PrimitiveUndoableCommentChange(Node node, int oldState, int newState) { this.node = node; this.oldState = oldState; this.newState = newState; }
45773dc6-e8eb-4492-bb99-27db27555a33
4
public Node removeDup(Node head) { if (head == null) { return null; } Node p = head; while (p.next != null) { Node q = p; while (q.next != null) { if (p.data == q.next.data) { deleteNextNode(q); } q = q.next; } p = p.next; } return head; }
63af8895-6c68-41a8-9bb0-a6afc097bbd8
7
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed /** It can happen that the field is already filled in. So, there are 3 options: * 1.- Empty * 2.- Absolute Path * 3.- Relative path to the genfit_sas home: jgui_examples/cur...
92d5671f-15e2-470e-b7a8-3cb90125495b
1
@Override public BufferedImage getObject(String name, Map<String, String> data) { // If a cache of this object already exists, return it if (cache.containsKey(name)) { return cache.get(name); } // Load the image if there is no cache of it BufferedImage loadedImage = FileManager.loadImage(data.get("fileLo...
3ded2b6b-e626-4432-a2fb-c9b04fd8402a
4
void initLabyrinthe(){ ArrayList<Arete> liste; int j; boolean flag; sommets.add(aretes.get(0).s1); for(int i=1;i<DIM*DIM;i++){ liste = selectAretes(); j=0; flag = false; while (!flag){ if (!sommets.contains(liste.get(j).s1)){ sommets.add(liste.get(j).s1); flag = true; } else ...
22e033e4-cfda-4a7b-bcb8-3f18890dcccf
7
public static void getRatios(Unsigned m, Unsigned n, Unsigned t, File fout, Unsigned xOver) { BigInt.setRandSeed(1231538606138l); int pairs = m.intValue(); double[] ratios = new double[t.intValue()]; for(int j = 1; j <= t.intValue(); j++) { // generate m pairs of BigInts of length n*t ...
a750b64c-f336-487a-af2d-bc96140fb747
0
public WaitingForOpponentDialog(Game game) { this.game = game; this.setLayout(new BorderLayout()); this.setModal(false); this.setLocationRelativeTo(this.game.window.board); this.setUndecorated(true); this.setAlwaysOnTop(true); this.setModal(true); this.label.setBorder(BorderFactory.createEmptyBo...
3e9f8a89-3b3f-4d85-a8e5-2a45541618b5
8
public boolean renderPistonExtension(Block par1Block, int par2, int par3, int par4, boolean par5) { int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); int var7 = BlockPistonExtension.getDirectionMeta(var6); float var8 = par1Block.getBlockBrightness(this.blockAccess, par2, par3, ...
b733e070-461f-4b8b-a137-754d055ffb98
6
private static EnumOS getOs() { String s = System.getProperty("os.name").toLowerCase(); if (s.contains("win")) { return EnumOS.windows; } if (s.contains("mac")) { return EnumOS.macos; } if (s.contains("solaris")) { return EnumOS.solaris; } if (s.contains("sunos")) { return EnumOS.solaris...
c1ee4c3d-02f1-4858-b760-1d9fb6c2352d
6
public AstarSP(EdgeWeightedDigraph G, int s, int t) { for (DirectedEdge e : G.edges()) { if (e.weight() < 0) throw new IllegalArgumentException("edge " + e + " has negative weight"); } distTo = new double[G.V()]; edgeTo = new DirectedEdge[G.V()]; x = ...
204a3b14-3a47-47ba-ad41-6f877977b4e7
6
public Vector getRayIntersection(Edge ray) { double closestDistance = Double.MAX_VALUE; Vector closest = null; double distance; List<Vector> intersections; Polygon polygon = new Polygon(new Vector(0, 0), new Vector(Tile.SIZE, 0), new Vector(Tile.SIZE, Tile.SIZE), new Vector(0, Tile.SIZE)); for(int i = 0; i ...
bc67ecfb-f512-4106-82cc-446da7cb0638
2
@Override public void run(){ while(true){ if (messageQueue.size() > 0){ pullStack(); } } }
99617c20-9c37-4066-b634-54ed7d00d420
8
private TextLayout zoomTextLayout(TextLayout layout) { TextLayout zoomed = new TextLayout(Display.getCurrent()); zoomed.setText(layout.getText()); int zoomWidth = -1; if (layout.getWidth() != -1) zoomWidth = ((int) (layout.getWidth() * zoom)); if (zoomWidth < -1 || zoomWidth == 0) return null; zoo...
486329a5-0bb7-403b-b1e4-543349d240bb
5
@Override public void keyTyped(KeyEvent e) { if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) { return; } char c = e.getKeyChar(); if (c == KeyEvent.VK_BACK_SPACE) { return; } // TODO: This statement used to check \\v and \\t as well, but it was causing ...
6c0f2b57-3fc4-487c-967a-78d18794ef98
1
public void laheta(Palaute p) throws DAOPoikkeus { try { PalauteDAO dao = new PalauteDAO(); dao.tallennaPalaute(p); } catch (DAOPoikkeus e) { } }
cdf76bb9-f0e3-4d0e-a011-6bccb4f97af9
6
public static File selectFileFromDialog(Component parent, String startPath, boolean showAllFiles) { if (startPath == null || parent == null) { throw new IllegalArgumentException("The arguments may not be null."); } LookAndFeel originalLookAndFeel = UIManager.getLookAndFeel(); ...
5071a533-4f7d-427b-a614-998dcd653c2f
2
@Override public Connection getConnection() throws DatabaseManagerException { DataSource dataSource = getDbSource(); if(dataSource == null) { throw new DatabaseManagerException("<connection> No Datasource. Cannot get a connection."); } try { return dataSource.getConnection(); } catch (SQLException e) ...
09bfd68a-a28d-4128-88d0-6c34be45e447
5
@Override protected Void doInBackground() throws Exception { List<ScriptInfo> locals = new ArrayList<ScriptInfo>(); ScriptClassLoader.loadLocal(locals, new File(Configuration.COMPILED_DIR)); for (ScriptInfo si : locals) { firePropertyChange("script", null, si); } final List<ScriptInfo> defi...
4487bdfb-053a-4652-afa2-b50877db5a14
1
public String getDriver() { if ( this.driver == null ) return ""; return driver; }
f8c34b6b-86b9-4f16-bda2-300545623ffa
8
private void calculateG(AStarNode checkNode) { int parentX = checkNode.getParent().getxCoord(); int parentY = checkNode.getParent().getyCoord(); int xCoord = checkNode.getxCoord(); int yCoord = checkNode.getyCoord(); if ((yCoord - 1 == parentY && xCoord == parentX) || (yCoord + 1 == parentY && xCoord == ...
6e93eafa-c66d-40b7-9bef-6ee8ae89413f
8
private void assertShallowTraceMatches(final Task<?> task, final Trace trace) { assertEquals(task.getName(), trace.getName()); assertEquals(ResultType.fromTask(task), trace.getResultType()); assertEquals(task.getShallowTrace().getStartNanos(), trace.getStartNanos()); // If the task has not been start...
2644fb78-b9f7-48b8-9ab5-ecdd31f81b5d
1
public String toString() { StringBuilder sb = new StringBuilder(); for (Card card : this) { sb.append(card.toString()); } return sb.toString(); }
28829c77-5a79-4b42-94c0-bf1f19720094
0
public void setTicketStatus(String ticketStatus) { this.ticketStatus = ticketStatus; }
720bb863-d145-4d89-b2ad-cc5d63dd3592
8
@Override public boolean onCommand(CommandSender cs, Command cmd, String s, String[] args) { if (cmd.getName().equalsIgnoreCase("ircmessage")) { if (!cs.hasPermission("royalirc.ircmessage")) { RUtils.dispNoPerms(cs); return true; } if (args...
3eaf4ed5-0295-4330-b15a-ba62cc2cfc97
4
@Override public IMatrix add(IMatrix other) { //ako nisu jednake dimenzije, vrati iznimku if (this.getColsCount() != other.getColsCount() || this.getRowsCount() != other.getRowsCount()) { throw new IncompatibleOperandException( "Matrices have not same dimensions."); } for (int row = 0; row < this....
0386f9a2-7994-4fbc-a9d5-77fe350b944b
4
public void getResultDP(int[][] mat) { int n = mat.length; int k = 1 << n; int[][] f = new int[n + 1][1 << n]; for (int i = 0; i < n; ++i) { for (int b = 0; b < (1 << n); ++b) { for (int j = 0; j < n; ++j) { int kk = (b >> j); ...
39b0638f-d2db-4bbf-8c3e-465df1aef5cc
8
@Override public void update(int delta) { super.update(delta); setMoving(false); if (Engine.isInputDown(Controls.MOVE_UP) && getCollidingEntity(Globals.DIRECTION_UP) == null) { moveY(true); } else if (Engin...
37a192f2-6b39-426a-9743-59f0470f4bce
7
public static String getNameFromId(int figureId) { String figureName = null; switch (figureId) { case Figure.FIGURE_ID_I: figureName = "FigureI"; break; case Figure.FIGURE_ID_T: figureName = "FigureT"; break; case Figure.FIGURE_ID_O: figureName = "FigureO"; break; case Figure.FIGURE_...
ed6b5c3f-67cc-4660-be66-749eefa10d23
3
@Override public boolean _equals(DbData other) { List<DbRow> rows1 = this.getRow(); List<DbRow> rows2 = other.getRow(); if (rows1.size() != rows2.size()) { return false; } for (int i = 0, len = rows1.size(); i < len; ++i) { if (!rows1.get(i).equals...
0acd4cad-c277-4206-b2af-9c6f4ce8d95c
8
public void pan(int direction) { GCThread.increaseGCFlag(5); switch(direction) { case 1: double newUpperLeftY = upperLeftY+(utmHeight*0.1); if(newUpperLeftY >= 6412239) newUpperLeftY = 6412239; zoom(upperLeftX, newUpperLeftY, utmWidth, utmHeight, false, 0, 0, 0, 0); break; case 2: double n...
4ecca2f1-c281-4557-8a20-2c47581543e7
2
public User[] loadUsers(ChatChannel channel){ User[] users = null; try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); String url = "jdbc:derby:" + DBName; Connection connection = DriverManager.getConnection(url); Statement statement = connection.createStatement(); String sqlStatement = ...
e132caf5-b919-4ed5-92a1-d203e123f47b
0
public String getOwnerName(){ return human.getName(); }
79f4b6b3-7f8a-48ef-ad07-de5d70b50ebb
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(myHost instanceof MOB)) return super.okMessage(myHost,msg); final MOB myChar=(MOB)myHost; if(!super.okMessage(myChar, msg)) return false; if((msg.amITarget(myChar)) &&(msg.targetMinor()==CMMsg.TYP_DAMAGE) &&(msg....
495c5669-059a-43c5-abc5-a98ff6662f9c
3
public void onAnswerSideChanged(AnswerSide answerSide) { if (answerSide == null) { removeSelection(); return; } switch (answerSide) { case LEFT: selectSingleScorePanel(AnswerSide.LEFT); break; ca...
bbb1bb5c-1408-416e-b07f-3f22d32670e7
6
private static int getRemoteVersion() { URL url = null; try { url = new URL(SERVER_URL + "version.txt"); } catch (MalformedURLException e2) { e2.printStackTrace(); } try { URLConnection urlConnection = url.openConnection(); urlConnection.setAllowUserInteraction(false); InputStream urlStream = ...
1e9cee28-5ad3-4eda-b1fd-f20526be78bf
6
private Constructor filterConstructorsUnsafe(Constructor[] constructors, Class[] parameterTypes) { outside2: for(Constructor c : constructors) { if(parameterTypes != null) { Class[] p = c.getParameterTypes(); if(p.length != parameterTypes.l...
70b45d5e-8133-4265-a3e7-2c8f2d34c73b
0
public void print(final String txt) { log(txt); }
25253688-5835-4899-bb76-1d86e6d7388a
4
@Override public void mouseDragged(MouseEvent e) { //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. if (e.getSource().equals(EditingPane)) { long hereIAm = System.currentTimeMillis(); ...
5c394ace-f3ed-4cf9-90ff-4a11daad0fb3
0
public Tileset getTileset() { return tileset; }
257d9fd5-bae1-4fdb-a027-25927592d3bd
5
@Override public void render() { glEnable(GL_BLEND); if (texture != null) { RenderAssistant.bindTexture(texture); if (!stackTexture) RenderAssistant.renderRect(x, y, width, height); else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_...
727928a1-ca83-4417-9455-75b2169372d4
1
public void scalarDivide(double Denominator) { for (Entry<Integer, Double> entry : this.getVector().entrySet()) { entry.setValue(entry.getValue()/Denominator); } }
79ffbb66-db0e-4d36-a7ef-530ba28f7e7c
0
@RequestMapping("/comprar/{producto}") public ModelAndView comprar(@PathVariable String producto) { Stock stock = Stock.getInstance(); Integer availableStock = stock.obtenerStockDisponible(producto); ModelMap model = new ModelMap(); model.put("producto", producto); model.put("stock", availableStock)...
7f139d35-3785-405f-9c20-044cb6d53a66
7
private void getUserInformation(){ if(userId!=null){ try { ResultSet userInfo = dataBaseConnector.getUserInformation(userId); userInfo.next(); scores = userInfo.getInt("scores"); money = userInfo.getInt("money");...
f77d2696-ef38-4d62-be92-678cae2f45b3
9
public MapEditor() { //set frame properties setTitle("Map Editor"); setSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); setBackground(Color.gray); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// Close when closed.For reals. //set the content of the frame try{ File file=new File("purdue-...