method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b056da88-e0b9-4aa1-9e50-e57ee6f588a2
9
public static void dumpToken(PrintStream str, int lineno, Symbol s) { str.print("#" + lineno + " " + tokenToString(s)); String val = null; switch (s.sym) { case TokenConstants.BOOL_CONST: str.print(" " + s.value); break; case TokenConstants.INT_CONST: val = ((AbstractSymbol)s.value).getString(); ...
89853281-7329-4143-8469-1d75b74a56f5
3
public Location getLocation() { if (location == null && deferredLocation != null){ String[] locationPeices = deferredLocation.split(split); String worldName = locationPeices[0]; int x = Integer.parseInt(locationPeices[1]); int y = Integer.parseInt(locationPeices[2]); int z = Integer.parseIn...
a831bcf1-4d13-49cf-8714-76bb10654026
6
private int[][] ClusterThreadHandler(AbstractGraph<BCNode,BCEdge> minSpanningTree, int rounds, int threadCount){ int[][] output = new int[_nMatrix.length][_nMatrix.length]; //set these -- get value from somewhere int threadReps = rounds / threadCount ; ArrayList<Thread> threads = new ArrayList<Thread>()...
4b33f71a-d094-4e2f-a0ab-e01dac5ea265
8
protected boolean scheduleGridlet(SSGridlet sgl) { int reqPE = sgl.getNumPE(); int queueId = sgl.getPartitionID(); EasyBackFillingPartition partition = getPartition(queueId); // if partition has a pivot already, then check whether the job appears // before in the queue after reordering. If it ...
84ca93d6-e59f-47c7-a913-f753a4c22087
4
boolean checkAdvancedGraphics() { if (advanceGraphicsInit) return advanceGraphics; advanceGraphicsInit = true; Display display = parent.getDisplay(); try { Path path = new Path(display); path.dispose(); } catch (SWTException e) { Shell shell = display.getActiveShell(), newShell = null; if (shell == null) s...
b40b6ef5-f88f-4315-b6a4-f8bc88d44e13
4
private boolean jj_3R_46() { Token xsp; xsp = jj_scanpos; if (jj_3R_54()) { jj_scanpos = xsp; if (jj_3R_55()) { jj_scanpos = xsp; if (jj_3R_56()) { jj_scanpos = xsp; if (jj_3R_57()) return true; } } } return false; }
5aac15af-4a12-44c2-be56-de86b77fd8d7
6
@Override public boolean equals(Object o) { if(o == null) return false; if(this == o) return true; if(!(o instanceof StuecklistenPositionDTO)) return false; StuecklistenPositionDTO p = (StuecklistenPositionDTO)o; if(!p.getBauteil().equ...
64332d65-0fe8-4a33-93e3-c7281c1b234c
9
@Override public boolean forward(SliceByteArray input, SliceByteArray output) { if ((!SliceByteArray.isValid(input)) || (!SliceByteArray.isValid(output))) return false; if (input.array == output.array) return false; final int blockSize = input.length; if (output....
a136e6ce-e897-4ce2-a0fe-774431c2e17c
3
public boolean banned(String host) { try { BufferedReader in = new BufferedReader(new FileReader("data/bannedusers.dat")); String data = null; while ((data = in.readLine()) != null) { if (host.equalsIgnoreCase(data)) { return true; } } } catch (IOException e) { System.out.p...
bfaada00-6dc9-4474-b915-bd80d643884d
5
private void outputLoginPage(HttpServletResponse response, LoginForm form, List<String> errors) throws IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html>"); generateHead(out); out.println("<body>"); out.println("<h2>Login & Re...
fb65f878-83bc-4fd6-aad8-40553c105910
3
public void finalizeRemoval() { if(!this.isRemoving) return; this.isRemoving = false; try { UserRemovalFinalized notification = new UserRemovalFinalized(this); User admin = User.findOneAdmin(); if(admin != null) Notification.add(admin.getId(), notification); this.delete(); } catch (SQLExceptio...
a1fd8c75-6307-470a-b6ea-8a00648c02fa
9
public List<Argument> parseArguments(String[] args) throws InvalidArgumentException { List<Argument> parsedArgs = new LinkedList<Argument>(); for (int i = 0; i < args.length; i++) { String opt = args[i]; if (opt.length() == 0) continue; if (opt.charAt(0) =...
162263bc-62d7-4672-80c8-cd02ae2c67b4
6
public static int loadImages() { _images = new HashMap<String, BufferedImage>(); int failureCount = 0; Field[] fields; int modifiers; Object value; String imageName; fields = ImageLib.class.getDeclaredFields(); for (Field field : fields) { ...
de4d6299-d21f-4125-8afe-ba70eafa3fe5
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(); ...
91cc5842-610a-4640-8fa5-fc149fc3f891
9
public static List<Class<?>> getInterfacesIncludeSuperClass(final Class<?> clazz) { List<Class<?>> types=new ArrayList<Class<?>>(); for (Class<?> superClass = clazz; superClass != Object.class; superClass = superClass.getSuperclass()) { for(Class<?> intf: superClass.getInterfaces()){ if (!types.contains(...
d3b2b393-b8ef-44f2-a3e9-fc5cbbe10366
9
private boolean losiParametri(ServletOutputStream out) { // Osnovna provjera parametara if ((this.logickiIzraz == null) || this.logickiIzraz.equals("") || (this.notacijaLogIzraza == null) || this.notacijaLogIzraza.equals("") || (this.tipCrtaca == null) || this.tipCrtaca.equals("")) { generirajS...
c105607d-e935-4f63-97ee-0606781260e0
1
public int reserveConstant(Object c) { if (c instanceof String) { return putIndexed(STRING, c, -1, 0); } else { return putConstant(c); } }
fb9bc23f-dd41-4690-9ff8-71067701673b
3
public static CVRGAuthenticator returnAuthenticator(AuthenticationMethod method, String[] args){ switch(method){ case USERPASS: //Arguments are (username, password) return new UserPassAuthenticator(args[0], args[1]); case OPENID: //Arguments are (identifier, return URL) return new OpenIdAuthenticat...
5aa35f41-173e-4f26-9cbb-0b31dccaeded
8
private void calculate(double[] x) { value = 0.0; double[][] derivative = new double[labelIndex.size()][x.length/labelIndex.size()]; double[][] weights = to2D(x); for (Datum datum : data) { double[] scores = new double[labelIndex.size()]; for (Object feature : datum.features) { int...
a0432686-3343-4c65-87ec-235f0d28e3ae
3
private void getObstacles(String line, BufferedReader br) /* * Read multiple coordinate lines until the line contains a #: <x1>-<y1> * (x2>-<y2> ..... .... # */ { boolean reachedEnd = getObstaclesLine(line); try { while (!reachedEnd) { line = br.readLine(); if (line == null) { System.out.pri...
2b5b8e38-3557-4569-9807-2ab3a4e83722
1
private void populate(Inventory inventory, Set<Matcher> matchers) { inventory.clear(); for (Matcher matcher : matchers) { inventory.addItem(matcher.getItemStack()); } }
4c157bcb-cdbc-410f-a04a-14086f759cac
2
public void render(Graphics2D g){ if(beginningAnimation){ g.drawImage(beginningImage,x,y,null); }else if(combineAnimation){ g.drawImage(combineImage,(int)(x+WIDTH/2-scaleCombine*WIDTH/2) ,(int)(y+HEIGHT/2-scaleCombine*HEIGHT/2),null); }else{ g.drawImage(tileImage,x,y,null); } }
e928b48c-0698-4028-8162-a8e6c1170a94
6
public void refresh() { for (int iteration = 0; iteration < subpanes.size(); iteration++) { final Pane pane = subpanes.get(iteration); pane.refresh(); for (int x = 0; x < pane.width; x++) { for (int y = 0; y < pane.height; y++) { if (x + pane.offsetX < width && y + pane.offsetY < height && pane.buf...
35eca3ce-25f4-414b-ac38-bce6020b087c
6
void masukan(){ System.out.println(" Saldo pertama = "+saldo); do { System.out.println("\n1. Menabung"); System.out.println("2. Tarik Tunai"); System.out.println("3. Cek Saldo"); System.out.println("4. Exit"); System.out.print(" Masukan Pilihan : "); pil =...
5b3c43e5-692b-48a4-8786-c2cce284af29
2
public static void addProcessStatus(String text) { for (AbstractScreen screen : screenRef) { if (screen.isVisible()) { screen.updateStatus(text); break; } } }
19fa3241-9896-45dc-ac9a-d94223aa8c9a
1
@Override public void action() { if(log.isLoggable(Logger.WARNING)) log.log(Logger.WARNING, "action"); // dfd = new DFAgentDescription(); // description = new ServiceDescription(); // description.setName("Wumpus' Wumpus-Game"); // description.setType("wumpus-game"); // dfd.addServices(description);...
aaa19e3d-bf4d-475a-ac9f-a7f7db801286
3
private HashMap<String,HashSet<ArrayList<String>>> copyTable(HashMap<String,HashSet<ArrayList<String>>> m){ HashMap<String,HashSet<ArrayList<String>>> res = new HashMap<String,HashSet<ArrayList<String>>>(); Set<String> keySet = m.keySet(); for(String key:keySet){ String new_key = new...
31a7abaa-bf0f-45e9-b05f-c33a99b7a37b
9
public void undoMove(PGNMove move) { if (move.isQueenSideCastle()) { switch (move.getColor()) { case Color.WHITE: move("d1", "a1"); move("c1", "e1"); break; case Color.BLACK: move("d8", "a8"); move("c8", "e8"); break; } } else if (move.isKi...
f6c0219f-b4d8-45df-b985-87ce45271b17
3
public Book searchBook(String title, String author) { Book found; for(int i = 0; i < books.size(); i++) { found = books.get(i); /*if(found.equals(title, author)) return found;*/ if(found.getAuthor().equals(author) && found.getTitle().equals(title)) return found; } return null; }
f49c3384-fee0-4e42-8f77-67784af18f1c
6
private double grad(int hash, double x, double y, double z) { // CONVERT LO 4 BITS OF HASH CODE INTO 12 GRADIENT DIRECTIONS. int h = hash & 15; double u = h < 8 ? x : y; double v = h < 4 ? y : h == 12 || h == 14 ? x : z; return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? v : -v); }
f9595cbf-9b6c-4b0f-a7c6-d55f0a21b36a
8
public synchronized T execute() { try { session = HibernateSessionFactory.getSession(); T returnValue = null; if ( session != null ) { session.setFlushMode(FlushMode.MANUAL); cr...
00448ef2-5c4a-4c00-a6fb-133bc2f72c7a
3
private boolean _jspx_meth_c_import_0(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // c:import org.apache.taglibs.standard.tag.rt.core.ImportTag _jspx_th_c_import_0 = (org.apache.taglibs.standard....
8ae50333-7214-442b-96c4-7519a49ea736
6
static Map<Character, Cell> scanMap (final char[][] map, final Set<Cell> lambdas) { lambdas.clear(); final Map<Character, Cell> items = new HashMap<>(); for (int row = 0; row < map.length; row++) { for (int col = 0; col < map[row].length; col++) { switch (map[row][col]) { ...
b394387a-68c4-4d0b-9fe5-a45923d25871
0
public int getBoardHeight() { return this.h; }
8d643737-ed27-407d-a74b-5fca12bfadf6
1
public static String generateSalt() { SecureRandom random = null; try { random = SecureRandom.getInstance("SHA1PRNG"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } // Salt generation 64 bits long byte[] bSalt = new byte[8]; random.nextBytes(bSalt); // Digest computation return b...
44e6636d-d60d-4f8c-9b78-76debbae159d
1
private void printCommands(Player playerSender){ if(playerSender.hasPermission("sl")){ String pluginVersion = plugin.getDescription().getVersion(); String pluginName = plugin.getDescription().getName(); playerSender.sendMessage(ChatColor.YELLOW + "|---------- " + pluginName + " v" + pluginVersion + " ...
b52ad39c-22d7-4668-b522-c1bc6d2b7559
3
private void parseFile(final File f, final FilesParsed filesParsed) { try { CSVReader reader = new CSVReader(new FileReader(f), ';'); try { System.out.print("parse: " + f + "\n"); String[] values = reader.readNext(); while (values != null) { Customer customer = handleCashInLine(values, filesPar...
1b9aa55a-628c-4ffb-8535-282d1cfd5ad5
2
@Override protected Money parseDataType(final CycNaut naut) throws ParseException { final Currency currency = lookupCurrency(naut.getFunctor()); if (currency == null) { throwParseException(naut, this.getClass().getName() + " does not recognize " + naut.getFunctor() + " as a currency."); } else if (n...
c3349477-4506-4313-87b2-3ffcd94f207e
0
@Override public AbstractPlay getBest() { return mkRandom(); }
0d369cc2-640c-4665-9eae-aa8c45f005f7
8
private int choseX(int counter) { switch (counter) { case 0: return -1; case 1: return 0; case 2: return 1; case 3: return -1; case 4: return 1; case 5: return -1; case 6: return 0; case 7: return 1; } return 0; }
02792a6f-1eea-4872-98c8-14bdb780dd1d
8
public static boolean userExists(String userName) { if(conn == null) getConnection(); boolean userFound = false; PreparedStatement stmt = null; ResultSet rs = null; try { stmt = conn.prepareStatement("Select * from usuarios WHERE username = ?"); stmt.setString(1, userName); ...
6e7b2a15-b48f-4275-932a-f7a4efc085e0
0
public File encode(Serializable structure, File file, Map parameters) { return file; }
72daea7a-4488-40f2-9d5a-ea7af68a3daf
2
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { String newDesc = remapper.mapMethodDesc(desc); MethodVisitor mv = super.visitMethod(access, remapper.mapMethodName( className, name, desc), newDesc, remapper.mapSignature( signature, false), ...
8c3ae4bc-8b78-4a0a-9aa8-7171706ac0b4
1
public JSONArray optJSONArray(String key) { Object o = this.opt(key); return o instanceof JSONArray ? (JSONArray)o : null; }
e5158bbd-7e85-4e58-a039-ff986dd6e242
3
@Test public void testAwaitAsyncExecutionFail() { SyncProcess proc = TestUtil.executionSuccessSyncProcess(); IProcessComponent<Void> busyComp = new BusyComponent(TestUtil.executionFailComponent(true)); IProcessComponent<?> asyncComp = new AsyncComponent<Void>(busyComp); proc.add(asyncComp); try { p...
c19eaebe-7b6d-4986-9ed3-40e37b5d0ea8
1
public void visit_putfield(final Instruction inst) { final Type type = ((MemberRef) inst.operand()).nameAndType().type(); stackHeight -= type.stackHeight() + 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
7015d6cb-4146-4255-94a1-db2c60e55044
1
public boolean isBlank() { return this.userid.equals("Blank") && this.name.equals("Blank"); }
db14a859-369f-443d-a956-c51e006f5add
7
@Override public void process(FileSource file) { // TODO Auto-generated method stub byte[] pop = file.pop(44); //Keep same header, will modify the sample rate later setNewSamples(pop); byte[] headerWav = Arrays.copyOfRange(pop, 8, 12); int wave = byteArrayToInt(headerWav); byte[] headerAudioFormat ...
5d5f69fb-9613-41fd-bdb8-c491943aeb68
7
private static HashMap<String, HashMap<Integer, double[]>> getCountMap() throws Exception { HashMap<String, GffParser> gffMap = FindGeneForMappedSequence.getGeneFileMap(); // the outer key is the gff file name // the inner key is the sampleID // the float[] is the number of covered nucleotides Hash...
cc5f3f81-c6b8-4726-95af-a793820e6992
2
@Override public void run() { state.update(this); System.out.println("CURRENT STATE IS: " + state.getStatus()); if (clientModel != null && clientModel.getServerModel() != null) { System.out.println("Current turn is: " + clientModel.getServerModel().getTurnTracker().getCurrentTurn()); } pollCycleCount++; ...
be5705a1-0cb0-4007-9af5-382bfbb5d51c
9
public FilenameFilter builderFile() { return new FilenameFilter() { private String[] exts = { ".class", ".png" }; public boolean accept(File dir, String name) { File f = new File(dir, name); if (dir == root) { if (f.toString().indexOf("_ignore") != -1) return false; if (f.isDir...
e29b4958-6d3f-4ebc-a987-0064f917cf2f
9
public int compareTo( Object obj ) { if( obj == null ) { return( 1 ); } else if( obj instanceof GenKbPhoneByUPhoneNumberIdxKey ) { GenKbPhoneByUPhoneNumberIdxKey rhs = (GenKbPhoneByUPhoneNumberIdxKey)obj; if( getRequiredContactId() < rhs.getRequiredContactId() ) { return( -1 ); } else if( getRe...
d517243d-add6-4b48-b5bd-277a4481094f
0
@Test public void findHandFromCardSet_whenThreeTensAndThreeTwosExist_returnsFullHouseTensOverTwos() { Hand hand = findHandFromCardSet(tensFullWithThreeTwos()); assertEquals(HandRank.FullHouse, hand.handRank); assertEquals(Rank.Ten, hand.ranks.get(0)); assertEquals(Rank.Two, hand.ranks.get(1)); }
abc0ab63-907d-4d1a-91ce-ade4630079c2
2
public static Service SelectServiceById(int id) throws SQLException { String query = null; Service service = new Service(); ResultSet resultat; try { query = "SELECT * from SERVICE where ID_SERVICE=? "; PreparedStatement pStatement = ConnectionBDD.getInstance()....
c9aca1bf-7d52-40f4-85bb-0a173924b0bb
2
public void imprimeProfessoresEDisciplinas() { System.out.println("Professores Cadastrados: "); for (Professor p : this.professores) { System.out.println(p.toString()); } System.out.println("Disciplinas Cadastradas: "); for (Disciplina d : this.disciplina) { System.out.println(d.toString()); } }
9fe12dc7-9b6f-4f1e-a610-7c2c0bdbfe62
2
public void accept_event () { SocketChannel fd = null ; try { fd = accept (); Utils.tune_tcp_socket (fd); Utils.tune_tcp_keepalives (fd, options.tcp_keepalive, options.tcp_keepalive_cnt, options.tcp_keepalive_idle, options.tcp_keepalive_intvl); } ...
de59789b-681d-4cb9-8d92-338a400b5837
1
public boolean isNotifyViewRefresh() { if(frame == null) buildGUI(); return notifyViewRefresh.isSelected(); }
a018e122-6b48-4426-abaf-837535399ead
1
private void messageBoxKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_messageBoxKeyPressed if (evt.getKeyCode() == VK_ENTER) { message = messageBox.getText(); messageBox.setText(""); evt.consume(); } }//GEN-LAST:event_messageBoxKeyPressed
765bcf8f-95b2-4756-9599-71aea8b63581
8
public void setAutomato(Automato automato) { nomeText.setText(automato.getNome()); List<String> colunas = new ArrayList<String>(); List<List<Object>> itens = new ArrayList<List<Object>>(); for (Estado estado : automato.getEstados()) { for (Transicao transicao : estado.getTransicoes()) { if (!colunas.con...
d711bf15-075c-4ec9-b914-9e3d9bcc7565
5
@Override protected void updateItem(T item, boolean empty) { super.updateItem(item, empty); if (empty) { setText(null); setGraphic(null); } else if (item instanceof Node) { setText(null); Node currentNode = getGraphic(); Node newNode = (Node) item; if (currentNode == null || !currentNode.equal...
f413a2c0-c8c2-49c4-8730-6650b93d1e86
5
public static boolean hasUniqueObject(Collection<?> collection) { if (isEmpty(collection)) { return false; } boolean hasCandidate = false; Object candidate = null; for (Object elem : collection) { if (!hasCandidate) { hasCandidate = true; candidate...
e2ffea18-ee3a-41ad-8c3d-784fc2a39af8
9
public void actionPerformed(ActionEvent ae) { try { if (ae.getSource() == this.tmrRefreshJTable) { if (this.processInterrupt_RefreshJTable) { this.processInterrupt_RefreshJTable = false; refreshJTable(); validate(); this.jtblProcessList.valid...
6fc68bd5-ff0c-41a3-b875-58470b130f34
8
public String toString() { StringBuffer sb = new StringBuffer("<class>" + getClass().getName() + "</class>\n"); sb.append("<model>" + modelID + "</model>\n"); sb.append("<type>" + elementID + "</type>\n"); if (uid != null) sb.append("<uid>" + uid + "</uid>\n"); if (getTitle() != null) sb.append("<title>...
1e26b4e6-66f6-44d2-9fa1-919b63565566
1
private void rebuild(PrintService service, PrintRequestAttributeSet set) { removeAll(); mService = service; createPrinterCombo(); rebuildSelf(set); revalidate(); Window window = WindowUtils.getWindowForComponent(this); if (window != null) { window.setSize(window.getPreferredSize()); GraphicsUtilitie...
b5e39f8c-6e11-435b-b046-6240800ef24c
0
public void setSocketServerConnection(ISocketServerConnection socketServerConnection) { this.socketServerConnection = socketServerConnection; }
5dc9983a-63a7-41cc-8323-02af4cb650bd
3
private static boolean writeBarePlanFile(Plan planEntity, String planFileFullName, String outputDirectory){ // Write the plan JAXB to a file try { JAXBContext context = JAXBContext.newInstance("com.hesham.maven.virgo.jaxb.plan"); Marshaller marshaller = context.createMarshaller(); marshaller.setProperty("...
e255f1c1-01b6-4524-9748-7e4bda079edd
3
public synchronized Product addProduct(Product product) { if (product != null) { try { listProduct.put(product); logger.info("Product: " + product.getName() + " Code: " + product.getCode() + " ,successfully added!"); } catch (InterruptedException e) { e.getMessage(); } catch (NullPointerExc...
cde0ea0d-97fa-4220-ac3a-11c2f5b853f9
1
public void visitRetStmt(final RetStmt stmt) { final Set targets = new HashSet(); final Iterator iter = stmt.sub().paths().iterator(); while (iter.hasNext()) { final Block[] path = (Block[]) iter.next(); targets.add(path[1]); } targets.addAll(stmt.catchTargets()); verifyTargets(stmt.block(), targe...
004080d7-ff42-4deb-8391-ace7792b02bb
2
private void unloadDrivers(){ for(int i = 0; i < this.drivers.size(); ++i){ Driver driver = this.drivers.get(i); try { DriverManager.deregisterDriver(driver); System.out.println("撤销JDBC驱动程序 " + driver.getClass().getName() + "的注册"); } catch (SQLException e) { System.out.println("无法撤销下列JDBC驱动程序...
01bb28da-012c-47fb-97df-4f5689cba647
1
public Transition modifyTransition(Transition transition, TableModel model) { String label = (String) model.getValueAt(0, 0); String output = (String) model.getValueAt(0, 1); MealyTransition t = (MealyTransition) transition; try { return new MealyTransition(t.get...
a7faff09-43d8-4dd8-a0f4-4622c32e6e79
8
public SchedulingPattern(String pattern) throws InvalidPatternException { this.asString = pattern; StringTokenizer st1 = new StringTokenizer(pattern, "|"); if (st1.countTokens() < 1) { throw new InvalidPatternException("invalid pattern: \"" + pattern + "\""); } while (st1.hasMoreTokens()) { String local...
68a4eafb-4972-4300-bbca-c6709593bc69
6
public static Class<?> load(String name) { if(loaderList == null) { return null; } String error = ""; boolean found = false; for(URLClassLoader loader : loaderList) { try { Class<?> cls = loader.loadClass(name); found = true; return cls; } catch (ClassNotFoundException e) { StringWr...
11287d63-dcca-4ccc-8c9b-569ee25dd767
0
public static void main(String[] args) { new GUI(); }
3a6c520a-120a-4bf8-a8e8-1199de0b3196
6
public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception { HashMap<String, HashMap<String, Integer>> map = new HashMap<String, HashMap<String,Integer>>(); BufferedReader reader = filePath.toLowerCase().endsWith("gz") ? new BufferedReader(new InputStreamReader( ...
aebaa5c3-c8f7-44e3-9e12-6117746c60d5
3
private boolean isWithinDims(Vector v) { return v.x > position.x && v.x < (position.x+dims.width) && v.y > position.y && v.y < (position.y + dims.height); }
1e9cede0-55f9-4138-a966-916038d48aa6
1
public void delleteProduct(Product product) { try { beginTransaction(); session.delete(product); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } finally { closeSesion(); } }
b7e779cc-2315-4050-a658-85313d2b1a82
8
public void show(View view) { this.view = view; JFrame annotationWindow = new JFrame("Data Annotations"); JLabel annotationHeading = new JLabel(); annotationHeading.setFont(new Font("Monospaced", Font.PLAIN, 20)); annotationHeading.setBorder(new EmptyBorder(5, 5, 0, 5)); annotations = new AnnotationPanel(a...
2883e030-23a7-4010-8166-bae2cf71059f
3
private void sort(List<Card> crds){ Card temp; for (int i = crds.size()-1; i >0 ; i--) { for (int j = 0; j<i; j++) { if(crds.get(j).getRankID()>crds.get(j+1).getRankID()){ temp=crds.get(i); crds.remove(i); crds.add(i, crds.get(j)); crds.remove(j); crds.add(j, temp); temp=null; ...
94b0da40-5438-4b9f-b055-8f7de7b8f6d1
6
public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Input A B C"); int a = Integer.valueOf(in.next()); int b = Integer.valueOf(in.next()); int c = Integer.valueOf(in.next()); double Root1 = (-b + Math.sqrt(Math.pow(b, 2) - 4 * a * c)) / 2 * a; double Root2 = ...
2faf2841-7c44-4bf8-9c29-6bdffdbb81ae
1
public PacketManager(Server instance) { this.server = instance; try { serverSocket = new ServerSocket(this.server.Port); } catch (IOException e) { e.printStackTrace(); } }
97e3c79e-27cb-495a-8bc3-0c4d3406a098
7
public TerritoryBsc WelComeMessage(Player player){ int ID = player.GetPosition(); switch(this.Display){ case START: case HOSPITAL: return new Hospital(ID); case PROP: return new ToolsHouse(ID); case GIFT: return new GiftHouse(ID); case MAGGIC: return new MagicHouse(ID); case PRITISION: re...
6f722c93-1e41-442f-b73e-eea24c201fc8
3
public ArrayList<Field> getLegalMoves(Board board, Field currentField) { ArrayList<Field> legalFields = new ArrayList<Field>(); for (Field field : board.fields) { if (this.canMove(board, currentField, field) || this.canAttack(board, currentField, field)) { legalFields.add(field); } } ...
fb4d8334-0364-4f05-95c1-f62ebc23fe10
2
private void createBoardImage(){ Graphics2D g = (Graphics2D) gameBoard.getGraphics(); g.setColor(Color.lightGray); g.fillRect(0, 0, BOARD_WIDTH, BOARD_HEIGHT); g.setColor(Color.WHITE); for(int row = 0; row < ROWS; row++){ for(int col = 0; col < COLS; col++){ int x = SPACING + SPACING * col + Tile.WIDTH...
a2b2fe23-3b18-44dd-8951-08395d1c688d
4
private TreeNode rotateRight(TreeNode rotatingNode) { TreeNode rotatedTreeRootNode = rotatingNode.left; rotatedTreeRootNode.parent = rotatingNode.parent; rotatingNode.left = rotatedTreeRootNode.right; if (rotatingNode.left != null) { rotatingNode.left.parent = rotatingNode...
9b3b143a-b87e-4d24-9fe0-0d1f6db561e0
5
@GET @Produces( { "application/json", "application/xml" }) @Path("/experiences/{username}") @Transactional public Experiences GetSharedExperiences(@PathParam("username") String username) { Experiences exps = getExperiences(username); Experiences sharedExps = new Experiences(); User user = getUser(username);...
aafff533-4ed3-404d-b644-2a2b67180374
6
private String sendCmdOut(String key, String data) throws TimeoutException { ClientInfo ci = new ClientInfo(); ci.setClientKey(key); PooledBlockingClient pbc = null; try { pbc = blockingClientPool.getBlockingClient(ci); if (pbc == null) { throw new TimeoutException("cmo: we do not have any client[pb...
a7433f5e-92de-4a93-a0cd-69df349e212a
1
@Override public void update( float delta ) { super.update( delta ); if ( !getVelocity().equals( Vector3f.NULL ) ) { getTransform().translate( getVelocity() ); //getTransform().lookAt( getTransform().getPos().add( getVelocity() ), new Vector3f( 0, 1, 0 ).rotate( new Quaternion( getVelocity().normalized(),...
64b35e9f-d37f-4382-8db4-585b9849b741
7
public void addMapping(Field field, String csvField) throws ClassValidationException { if (fieldToCSVMapping.containsKey(field)) { logger.log(Level.WARNING, "Field: " + field + " already existing in mapping - is it duplicated? Ignoring"); return; } if (csvToFieldMapping.containsKey(csvField)) { logger.l...
2bd5f1f5-bfd2-4def-adc6-d427c75e5b4f
7
public void onValueChange(ValueChangeEvent<String> event) { String token = event.getValue(); if (token != null) { Presenter presenter = null; if (token.equals("list")) { IOCBeanDef<ContactsPresenter> bean = manager.lookupBean(ContactsPresenter.class); if (bean != null) { p...
476f2a02-9fae-493b-9812-0ae3f8477a3f
5
public int getEventType() { int event_list_code = (list_id_old != 0 ? LIST_DELETED : 0) + (list_id_new != 0 ? LIST_CREATED : 0); int event_item_code = (item_id_old != 0 ? ITEM_DELETED : 0) + (item_id_new != 0 ? ITEM_CREATED : 0); // Si les 2 list id sont égaux, on les ignore if (list_id_old - list_id_new == 0...
8932746f-cfd3-4faa-baf4-b4a2eadcd885
8
public static boolean batch( WebSocketImpl ws, ByteChannel sockchannel ) throws IOException { ByteBuffer buffer = ws.outQueue.peek(); WrappedByteChannel c = null; if( buffer == null ) { if( sockchannel instanceof WrappedByteChannel ) { c = (WrappedByteChannel) sockchannel; if( c.isNeedWrite() ) { ...
4f204fee-a27b-488b-9d5a-aa2719a73a21
3
@SuppressWarnings("unchecked") public T perform(T object) throws UpdateException { DatabaseUpdater updater = new DatabaseUpdater(); try { object = (T) this.merge(updater, object, null); } catch (DBException e) { updater.rollback(); throw new DBException("update rolled back", e); } catch (UpdateExcept...
d007213d-2cb4-482c-8a49-c3c896083114
2
public static Product getByNumber(final String token, final Long number) { JSONArray fetchByNumber = null; try { fetchByNumber = fetchByNumber(token, "products", number); } catch (IOException e) { e.printStackTrace(); } List<Product> formatOutputs = formatOutputs(fetchByNumber); if (formatOutputs.size...
0f842161-20e7-4819-a6fd-8e371c10a9be
2
public int getUser_ingame_point() { int user_ingame_point = 0; List<ParisModel> parisNotFinish = DataStore.getAllTeamParisByUser(user_id, false); if(parisNotFinish!=null) { for(ParisModel paris : parisNotFinish) { user_ingame_point += paris.getBet(); } } return user_ingame_point; }
4ca03482-54cd-4a83-85a7-a7f45c952d1c
0
Xpp3Dom getResults() { return results; }
6f305d07-05e2-4641-b47e-2af7abbe7252
5
public void paint1(Graphics g) { if (!gameover){ // si no estan puestas las instrucciones... // despliega todo normal if (!bInstrucciones){ g.drawImage(background, 0, 0, this); if (balon.getAnimacion() != null) { g...
3899a743-f141-4469-9ff3-7752f425d853
4
public void update(){ System.out.println("Sto aggiornando view della damiera..."); damiera.update_UI(); utente.update_UI(); computer.update_UI(); //Aggiorno effettivamente la damiera f.repaint(); if(mod.getStatoFine()!=0){ if(mod.getStatoFine()==1){ JOptionPane.showMessageDialog(null, "PARTITA F...
e3e9951f-19b3-4db0-b726-438b3c225c5b
4
public static List<Integer> RunMergeSort(List<Integer> list) { List<List<Integer>> merges = new ArrayList<List<Integer>>(); for (int i : list) { merges.add(Arrays.asList(i)); } while (merges.size() > 1) { List<List<Integer>> newMerges = new ArrayList<List<Integer>>(); for (int i = 0; i < merges.size();...
f2a4f328-2b79-40a6-b864-75b69e1b224d
1
private void inicializarPalabras(){ int num = (int) (Math.random() * diccionario.getTamanio()); palabraActual = diccionario.getPalabra(num).split(""); palabraActualObjeto = diccionario.getPalabraObjeto(num); for(int i=1; i<palabraActual.length; i++){ palabraRespuesta.add("_"); } tamanioPalabra = palabraA...
19f417e4-aee6-4000-bb63-0ce5f713c5cb
3
private boolean checkPosition(int x, int y) { return (x >= 0) && (x < width) && (y >= 0) && (x < height); }