method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0d122674-6d57-43af-9379-aec860b0a0d1
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=profi...
21959d63-35ca-4924-900d-11c72682ca38
4
@Override public ResultSet query(String query) { Connection connection = null; Statement statement = null; ResultSet result = null; try { connection = this.open(); statement = connection.createStatement(); switch (this.getStatement(query)) { case SELECT: result = statement.executeQuery...
9c80f9ad-39c6-47ac-95ae-d0de16b78a79
4
void setClass(final String name, final Class<?> clazz) { if (!classes.containsKey(name)) { classes.put(name, clazz); if (ConfigurationSerializable.class.isAssignableFrom(clazz)) { Class<? extends ConfigurationSerializable> serializable = clazz.asSubclass(ConfigurationSer...
a6a261b8-747b-4631-8474-5f59a12c15d2
0
public void windowDeactivated(WindowEvent e) { // TODO Auto-generated method stub }
e94bb88a-a52b-4423-b70d-eba6233c2ded
9
public String genererCle() { long d=new Date().getTime(); long semiArithmetique=(long)(Math.random()*COEFF_ALEA1); long[] suite=new long[TAILLE_ENCODAGE]; long majorant; suite[0]=(long)(Math.random()*COEFF_ALEA1)+1; long[] suite2=new long[TAILLE_ENCODAGE]; for(int i=1;i<suite.length;i++) { suite[i]=2*s...
8514c410-ae15-45de-9b84-4482d9fda7b6
5
public int autoAttack(Unit enemy) { if(enemy != null && this.getHP() > 0 && enemy.getHP() > 0 && team != enemy.getTEAM() && inRange(enemy)) { int tDmg = Calculator.dmgAmt(atk + wepATK(), enemy.getDEF()); enemy.damage(tDmg); return 0; } return 1; ...
f8448d00-da1d-4c99-acb5-0ed2c68c7cf9
6
public static Map getNymOfferList(String serverID, String nymID) throws InterruptedException { Map nymOffersData = new HashMap(); // ---------------------------------------------------------- OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.GET_NYM_MARKET_OFFERS, serverID, nymID); ...
7cebe305-c6e4-463a-9bf5-3a58ec0372d8
1
public List<Double> getValue() { if (value == null) { value = new ArrayList<Double>(); } return this.value; }
b6952296-03ae-4b26-8164-cf7edcdb0ad9
1
public String moveCardOntoTopRowFromBoard(int toMoveTop, int boardIndexFrom, int boardIndexTo) { List<Card> from = board.get(boardIndexFrom); String result = moveCardOntoTopRow(from, boardIndexTo, toMoveTop); if (result.isEmpty()) { from.remove(from.size() - 1); } ret...
31cbf9b9-41d5-4b53-8fea-46f590dc6ab1
5
@Test public void testIdMessagingNoPush() { System.out.println("testIdMessagingNoPush"); try { assertTrue(c.registerToServer(GlobalConstants.IP_LOOPBACK)); } catch (Exception ex) { fail("Registration from client to server failed - " + ex); } final UU...
3afe7bfa-aa96-4fd2-8870-d2f7bd5f0cc2
6
public int compare(Driver d1, Driver d2) { Integer d1T = (new Time(d1.totalTime()).lesserThan(raceTime)) ? -1 : 0; //-1 om ingen totaltid, 0 annars Integer d2T = (new Time(d2.totalTime()).lesserThan(raceTime)) ? -1 : 0; //-1 om ingen totaltid, 0 annars int c1 = d1T.compareTo(d2T); if(c1 > 0) { retur...
725384fe-ca35-437e-85bb-ed206e63443c
0
@Test public void isDog() { // create a small dog Dog dog = DogFactory.getDog("small"); Assert.assertEquals("small", dog); // create a big dog dog = DogFactory.getDog("big"); Assert.assertEquals("big", dog); // create a working dog dog = DogFactory.getDog("working"); Asse...
8fe745c2-2a78-42ed-80df-a1805c620aa8
2
public String join(String separator) throws JSONException { int len = this.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < len; i += 1) { if (i > 0) { sb.append(separator); } sb.append(JSONObject.valueToString(this.myArrayL...
b04aeed0-dbc5-4240-99e5-ff0d035f2a0b
1
public void run(){ try { DList.dlModlist(MIFU.selectedModlist, MIFU.dlDir); //Runs the process of downloading the mods from the selected modlist } catch (InterruptedException | IOException e) { e.printStackTrace(); } }
2fa10aee-b2c8-4450-9ccf-b74b206259ba
1
@Override public void setProperty(String key, Object value) { PropertyFilterChain filter_chain = (PropertyFilterChain) filter_chains.get(key); if (filter_chain != null) { // TBD: have the chain throw an exception when no value should be set. this.current_values.put(key, filter_chain.applyFilters(this, value)...
e5ea1eea-05d7-49a4-b1c6-06950de82733
9
public String generateMessageString() { if (outputMessage == null || isChanged) { // Parameters StringBuilder content = new StringBuilder(2048); for (Map.Entry<String, String> e : this.parameters.entrySet()) { if (e.getValue() != null) content.append(e.getKey()).append('=') .append(urlEncodeU...
45142097-113a-4551-9c97-003cbbec4703
4
public int init() { if (lifecycleSupport == null) { return handleErrno(Errno.ENOTSUPP); } if (log != null && log.isDebugEnabled()) { log.debug("init: start filesystem"); } try { return handleErrno(lifecycleSupport.init()); } catch(Exc...
f913f014-e0b8-4263-8bb8-b2c0ac415cda
0
@Transactional public void deleteById(Integer id) { stepsDao.setDeletedById(id, true); }
2d747048-96b0-42d2-8e8b-931861991bd1
7
public static void main(String arv[]) throws IOException{ boolean continuer = true; String choix; Parametre param = new Parametre(); Scanner sc = new Scanner(System.in); do{ System.out.println("======= MasterMind ======= "); Syst...
10626c5b-149c-4de2-9b0c-0c47c6639a68
9
private void quicksort(int begin, int end, boolean coord) { int i = begin; int j = end; RoutingEntry middle; if (end > begin) { int index = (begin + end) / 2; middle = (RoutingEntry)vector.elementAt(index); while (i <= j) { while (i < end && compare(i, middle, coord) < 0) i++; while (j...
246c7f72-4f09-4d9d-bf1b-f77dc2183d60
7
public static void startParser(String StartPageUrl,String HomeURL, String date, String author, String message, boolean useParametersFile, String postsParamsInput, boolean useUrlsInFile, String urlsFileName, String delimiterOfPostsFile, String postsFileName, String discussionsFileName, String paramsfileName,Stri...
ca8678df-50b4-482c-b816-0fd05b23b97a
7
public HashSet<String> search(String text){ if(text.length()==0){ return null; } int N = text.length(); // input text length int skip = 0; HashSet<String> termsThatHit = new HashSet<String>(); // Start of Search int i = patternLength; for (int count = i; count > 0; count--) { int M = pattern[i - ...
793091d1-4f47-4dd4-98a2-0728eb2aaabb
1
final public CycConstant sentenceDenotingConstant(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException { CycConstant val = null; val = constant(false); eof(requireEOF); {if (true) return val;} throw new Error("Missing return statement in function"); }
10bd8d7d-8351-4dde-8b8e-5186fac7e67c
0
public Object get() { size--; return super.get(); }
b57fdc89-470f-4bc8-badb-26266a722ae9
0
public String getServerVersion() { return this.Version; }
56e11a0b-0bda-4f9b-929e-0e40a679d430
1
public static GameFrame getInstance() { if (instance == null) { instance = new GameFrame(); } return instance; }
67a5a7b5-e481-4a5c-bd55-ff42a48aab8e
9
public static Operation parseXSDFile(String fileName) { Operation operation = new Operation(); Map<String, SimpleTypeRestriction> tipuriSimple = new HashMap<>(); Map<String, ComplexTypeParameter> tipuriComplexe = new HashMap<>(); XSOMParser parser = new XSOMParser(); XSType type = null; XSContentType xsCon...
a2538e3a-5de4-4c7d-ab62-b7cb13953449
5
private void makeRoom(LayeredMap lmap, int x, int y, int w, int h, boolean withFeatures) { for(int j=y; j<y+h; j++) { for(int i=x; i<x+w; i++) { if(getRandomFromInterval(0, 100) < damagedFloorChance) { ...
b2dc4231-90d0-4fb6-b077-e05b0cecb848
2
@Override public void onEvent(Event event) { if (event instanceof ScannedRobotEvent) { onScannedRobot((ScannedRobotEvent) event); }else if (event instanceof HitWallEvent){ onHitWall((HitWallEvent) event); } }
f6254df4-0964-43f8-8f99-ca2434f0ecbe
3
public void mouseClicked(int button, int x, int y, int clickCount){ if(MenuManager.getMenuType()==0) MenuManager.MainClick(button, x, y); else if(MenuManager.getMenuType()==1){ try { MenuManager.LevelClick(button, x, y); } catch (SlickException e){e.printStackTrace();} } }
a8b77de4-2fd7-4e75-a0e7-3013fdc888cb
0
@Override protected void generateFrameData(ResizingByteBuffer bb) throws FileNotFoundException, IOException { // TODO: hey you! before implementing the frame generators, make this and ALL unimplemented frame generators throw UnsupportedOperationException. test thoroughly to ensure there aren't any unnecessary cal...
aca7dc7c-8205-448a-b6cf-01549dbeb935
3
public BigDecimal parse(String formula) { List<Token> tokens = tokenizer.tokenize(formula); checkBalance(tokens); while (tokens.size() > 1) { parseFrom(tokens, 0); } if (tokens.isEmpty()) { throw new ParseException("Empty formula"); } f...
5c03c0d9-7ff9-4c49-95ce-13804252e18d
6
@EventHandler public void onPlayerJoin(PlayerJoinEvent event) { Player p = event.getPlayer(); ChatColor RED = ChatColor.RED; ChatColor WHITE = ChatColor.WHITE; String uName = event.getPlayer().getName(); UUID uuid = event.getPlayer().getUniqueId(); Integer warnRemaining = plugin.getRemWarn(u...
7bb36760-e48f-4acd-b2e6-ae6b93572a15
9
public static Tip_LIzraz_Const_Niz PROVJERI_primarni_izraz(){ String linija = mParser.ParsirajNovuLiniju(); UniformniZnak uz = new UniformniZnak(linija); Tip_LIzraz_Const_Niz vrati = new Tip_LIzraz_Const_Niz(); mZadnjiPrimarniIzrazJe_NIZ_ZNAKOVA = false; if (uz.mNaziv.equals("IDN")){ ClanTabliceZnakova ...
6135d3cf-2853-4e18-9ea2-c20f70d75629
7
public boolean initialize() { _bSendItemRequest_ip = CommandLine.booleanVariable("openItemStreams"); _bSendPostAfterItemOpen_ip = CommandLine.booleanVariable("sendPostAfterItemOpen"); // item names String itemList = CommandLine.variable("itemName"); StringTokenizer st = new ...
6aa48f5c-2fab-4cea-808c-0ddb781daf2d
1
public JPanel getStandardBtnMenu() { if (!isInitialized()) { IllegalStateException e = new IllegalStateException("Call init first!"); throw e; } return this.stdBtn; }
c22c5d7a-d366-491e-bc34-faf7d78e7942
0
public void setInitialPoint(Point initialPoint) { this.initialPoint = initialPoint; }
7aeeb371-829e-4ba4-9710-040300e873c9
7
public void simulateOneStep() { step++; // Provide space for newborn actors. List<Actor> newActors = new ArrayList<Actor>(); // avoid being being interrupted try{ if (actors != null) { // Let all actors act. for(Iterator<Actor> it...
db5f06cf-09e2-4fa6-ae07-750cb439bfa8
9
private static void setFieldType(Class<?> type, PropertyDescriptor propertyDescriptor, FieldInfo fieldInfo) { if (type.isEnum()) { fieldInfo.setEntityType(FieldType.ENUM); fieldInfo.setEntity(type); return; } FieldType fieldType = getFieldType(type); if (fieldType == null) { if ...
b1053839-80cf-4258-82ad-d265546af4cf
1
@Override public void addRecord(Account account, Record record) { PreparedStatement pStmt = null; String DATE_FORMAT_NOW = "dd.MM.YYYY"; Date date = new Date(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_FORMAT_NOW); try { pStmt = conn.prepareStatement("INSERT INTO RECORD (id_...
9c252ce6-3c67-4d29-9970-615fc649cb76
9
public int trap(int[] A) { if (A.length < 2) { return 0; } int block = 0; int head = 0; int left = head; int tail = A.length - 1; int right = tail - 1; //move from head to tail, if A[head] <= A[head + 1], there is no block before head, star...
4c4b99bb-d0f4-4f05-a1e9-b3961aa706f0
7
public static void main(String[] args) throws IOException { try { Connection con = null; Statement st = null; ResultSet rs = null, rs3 = null; String url = "jdbc:postgresql://localhost/postgres"; String user = "postgres"; String password = "computer"; con = DriverManager.getConnection(url, user...
bf5170b3-a816-453f-a147-9b2c29c75ebe
2
@Override public void run() { if( player.isOnline() ) { if( plugin.keepNagging(player)) { player.sendMessage(ChatColor.AQUA + "**** You have a refund waiting! ****"); player.sendMessage(ChatColor.AQUA + "Type " + ChatColor.GOLD + "/refund help" + ChatColor.AQUA + " for more information" + ChatColor.R...
ffc84cf5-c74c-40bd-a084-2bf50d8fe301
1
public static Hand findHandFromCardSet(Set<Card> cardSet) { // Look for flush and straight possibilities first, for if they exist, it is impossible for other five card hands to // exist that beat either a straight, flush, or straight flush. Hand straightOrFlush = findHighestFlushOrStraight(cardSet); if (straig...
e6a2efd7-c189-4294-b64b-42c8d98f0301
5
@Override public void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException { if (req.getRequestURI().equals("/login")) { captchaContainer.add(req.getRequestedSessionId(), String.valueOf((int) M...
a0c63a5e-1025-4b90-8b23-eee1d9e32c75
7
private static void lisaaLomakkeeseen(Set<Kentta> kentat, boolean pakollinen, Viitetyyppi tyyppi, JPanel lomake) { GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(4, 4, 4, 4); //Kirjalla täytyy olla joko kirjoittaja tai editori, joten käydään tämä erikoistapaus ...
cec55a8c-1100-4bb0-86be-4149d8bac551
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
a42e2395-ffed-47ad-bf29-ac17dcbe6886
8
public ReservationListGUI() { //Get size of screen without taskbar screenSize = Toolkit.getDefaultToolkit().getScreenSize(); screenMax = Toolkit.getDefaultToolkit().getScreenInsets(reservationListDialog.getGraphicsConfiguration()); taskbarSize = screenMax.bottom; screenWidth = (int)screenSize.getWidth();...
0dbbe2f1-3a75-490c-a534-80a9f4e1eeb4
4
public void parseDocument2(Document document){ //get root element Element rootElement = document.getDocumentElement(); //traverse child elements NodeList nodes = rootElement.getChildNodes(); for (int i=0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node.getNodeType() == Node.ELEMENT_...
a3d6cc09-8651-42ec-8802-6e8c25685bf3
5
public void printStuff(){ try (PrintWriter writer1 = new PrintWriter(new FileWriter(file));){ for(int i=1; i<=map.size(); i++){ int[] tmp = new int[6]; tmp = getValue(i-1); if(tmp[0]==1){ writer1.print(tmp[0]+" "); } else if(tmp[0]==-1){ writer1.print("x "); } elementcounter++; i...
da11ec80-887a-4be6-8b8a-71bb56f43268
9
public Iterable<Key> kSmallest(int k){ if (k < 0 || k > N) return null; /* TODO: Implement kSmallest here... */ Queue<Key> kSmallestKeys = new Queue<Key>(); MaxHeap<Key> heap = new MaxHeap<Key>(k); int index = 0; int keyCount = 0; while (keyCount < k && index < M) { ...
1499bb61-42e3-4deb-bc13-5b0c18b5c160
4
static void readImages(String xfilename, String yfilename) { try { Scanner xscanner = new Scanner(new File(xfilename)); Scanner yscanner = new Scanner(new File(yfilename)); while (xscanner.hasNextLine()) { Image i = new Image(); String line = x...
60ca781d-050b-4a0a-b6d5-e167979aeb34
4
@Override public void onKeyRelease(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_W || e.getKeyCode() == KeyEvent.VK_S) { paddleLeft.stop(); paddleRight.stop(); } }
b25dd82e-a003-4bd4-b363-f26d7758bd78
7
public void playCard(int card, int resources[]) { // Correspondance entier-carte : 0 = chevalier ; 1 = monopole ; 2 = route ; 3 = decouverte. Player p1 = players[activePlayer]; switch (card) { case 0: fireMoveThief(activePlayer); // Notifie l'interface que le voleur doit etre deplace. p1.addArmy(); ...
5df3ed60-1575-438a-ae48-8d636c23a3b3
3
public Complex[] subtractMean_as_Complex() { Complex[] arrayminus = new Complex[length]; switch (type) { case 1: double meand = this.mean_as_double(); ArrayMaths amd = this.minus(meand); arrayminus = amd.getArray_as_Complex(); break; case 12: BigDecimal meanb = this.mean_as_BigDecimal(); Array...
19e4aaa7-8311-4749-bf21-d0b5f58411cc
2
public static Packet fabricatePacket(Message msg){ numPacketsOnTheFly++; if(freePackets.empty()) { Packet p = new Packet(msg); synchronized(issuedPackets) { issuedPackets.append(p); } return p; } else{ Packet rP = freePackets.pop(); if(rP.message != null) { Main.fatalError(Logging.getC...
5d1c40ec-4d3b-431c-8f49-396b16cee916
7
protected void compareDatasets(Instances data1, Instances data2) throws Exception { if (!(data2.numInstances() == data1.numInstances())) { throw new Exception("number of instances has changed"); } for (int i = 0; i < data2.numInstances(); i++) { Instance orig = data1.instance(i); ...
957a2be9-e34c-41db-b22b-3c29bcb62973
7
public void draw(){ if(drawable){ if(currentspriteexists()){//aka, if we have a sprite that exists, and we have not decided to draw bounds instead if(drawmode==2){//if we clip the image to within it's bounds mainscreen.screengraphics.drawImage(image.get(currentspritenumber).getimage(), (int)(x+spriteoffse...
6662f102-31c6-4fda-b61b-7af70a8cd1b1
3
public Message next() { if(packetIter != null) { activePacket = packetIter.next(); } else { if(activePacket == null) { activePacket = singlePacket; } else { activePacket = null; } } if(activePacket == null) { throw new IllegalStateException("Call to 'Inbox.next', even though hasNext() ret...
e9a8ad49-b47e-4c85-95fa-9c238763feb6
1
public void stop() { if (!running) return; running = false; }
f835b312-07e6-4b04-bb7f-6b954ce92e36
7
public static boolean isSubSampleDescription(String accession) { return SUBSAMPLE1_DESCRIPTION.getAccession().equals(accession) || SUBSAMPLE2_DESCRIPTION.getAccession().equals(accession) || SUBSAMPLE3_DESCRIPTION.getAccession().equals(accession) || SUBSAMPLE4_DES...
5406a90f-6d02-4fc8-8550-cd8da6d17239
5
public static void main(String[] argv) throws Exception { if (argv.length != 1) { System.err.println("usage: Glue2Pojo <json file>"); System.exit(1); } System.out.printf("reading file %s%n",argv[0]); byte[] doc = Files.readAllBytes(Paths.get(argv[0])); System.out.println("parsing"); ObjectMapper mappe...
99cac131-6e0c-4ddb-9ef8-b88e6b3b1fe0
9
public static void initGUI(int antalVeckor) { // Skapar en JFrame (fönstret) JFrame jFrame = new JFrame(); // Sätter layouen för fönstret jFrame.setLayout(new GridLayout(0, 1)); // Gör första raden JPanel jPanelForstaRad = new JPanel(); // Sätter layouten för första raden jPanelForstaRad.setLayout(...
6c940c77-4f26-4890-b205-72e75549b64d
4
private void createOutputImage() { int[] dimentionZero = {0, 0}; int[] dimention = {0, 0}; if (inputImageRelations.size() > 0) { dimention[0] = inputImageRelations.get(0).inputImage.getWidth(); dimention[1] = inputImageRelations.get(0).inputImage.getHeight(); ...
133e7b74-fb63-4e63-851c-0f482588cd7f
3
public String row(int i) throws Exception { int h = this.height(); // Sanity check if ((i < 0) || (i >= h)) { throw new Exception("Invalid row " + i); } // if the row is invalid String result; result = ""; //loop to make one line for (int k = 0; k < this.width; k+...
ff76a3bc-b97c-4178-ac3d-33626985e255
2
private int tokenForState(int state) { if (state < 0 || state >= TOKEN_STATE.length) return -1; return TOKEN_STATE[state]; }
67d0e2f4-8334-4b66-9f2f-1679930b8d2f
5
void onMouseDoubleClick (Event event) { if (!isFocusControl ()) setFocus (); int index = (event.y - getHeaderHeight ()) / itemHeight + topIndex; if (!(0 <= index && index < itemsCount)) return; /* not on an available item */ CTableItem selectedItem = items [index]; /* * If the two clicks of the double click ...
01d1b56c-80c0-4fa3-8d6a-dfbf965b5da8
6
public static String getHpBar(Character c){// A health bar is shown after every turn int stars = (int) ((c.getHp() * 1.0 / c.getBaseHp() * 100.0)/5); int pct = (int)((c.getHp() * 1.0) / c.getBaseHp() * 100.0); //System.out.println("c.getHp(): " + c.getHp()); //System.out.println("c.getBaseHp()" + c.getBaseHp())...
99577153-f3b7-48c6-b71c-f148baf1053a
7
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed Chofer ch; if(txtNombre.getText().trim().equals("")){ JOptionPane.showMessageDialog(rootPane, "Debe ingresar datos"); txtNombre.requestFocusInWind...
21336d52-cd2c-49f8-ba0a-d1f0b3e39019
5
private String translate(byte b1, byte b2, byte t) { if (t == SHIRE) return Shire.getName(b1, b2); else if (t == ORDERFEMALE || t == ORDERMALE) return Order.getName(b1, b2, t == ORDERFEMALE ? Misc.FEMALE : Misc.MALE); else return GobName.firstName(b1, b2, t == FEMALE ? Misc.FEMALE : Misc.MALE); }
259d0a28-dd39-4901-b7e9-373a131f426b
8
public String patch_addPadding(LinkedList<Patch> patches) { short paddingLength = this.Patch_Margin; String nullPadding = ""; for (short x = 1; x <= paddingLength; x++) { nullPadding += String.valueOf((char) x); } // Bump all the patches forward. for (Patch aPatch : patches) { aPatc...
67240b3e-6f58-4ef8-82c6-3201e169cf57
8
@Override public AdminTbl getTableForUrl(String urlNm) { log.debug("get table for url name = " + urlNm); Connection conn = null; PreparedStatement statement = null; ResultSet rs = null; AdminTbl tbl = new AdminTbl(); StringBuilder sql = new StringBuilder(); sql.append(" select tbl_nm, tbl_type, dspl_n...
64fde8fa-61f2-4525-85df-82b29538c3c5
4
public IMessage decrypter(IMessage crypte, String key) { long d=new Date().getTime(); char[] c=new char[crypte.taille()]; for(int i=0;i<crypte.taille();i++) { if(crypte.getChar(i)>=33 && crypte.getChar(i)<=126) { if(crypte.getChar(i)-33-47>=0){ c[i]=(char)((crypte.getChar(i)-47)); } else { ...
fc30dcfc-8920-4252-b3bf-92cb0244d173
3
@Override public Class getColumnClass(int column) { Class returnValue; if ((column >= 0) && (column < getColumnCount())) { if (getValueAt(0, column) == null) { return String.class; } returnValue = getValueAt(0, column).getClass(); } else { ...
18ef8134-4431-48ed-9157-322c2d7ea568
0
public static void main(String[] args) { System.out.println("-1234".matches("-?\\d+")); System.out.println("5678".matches("-?\\d+")); System.out.println("+911".matches("-?\\d+")); System.out.println("+911".matches("(-|\\+)?\\d+")); }
d83c76c5-0c78-46ef-af33-2b2c70201d86
0
private void maakEntiteiten() { EntityManagerFactory emf = Persistence.createEntityManagerFactory("2Ti4_Meulemans_Ben_project2014PU"); Lid lid = new Lid(); lid.setVoornaam("Ben"); lid.setFamilienaam("Meulemans"); lid.setEmail("9benm2@gmail.com"); lid.setLidnummer(384832);...
6426bdf7-3e06-4a40-806f-9e53e7bf39ef
9
public void render(int mouseX, int mouseY) { for (Button button : buttons) { if (!button.visible) { continue; } GL11.glBindTexture(GL11.GL_TEXTURE_2D, minecraft.textureManager.load(Textures.GUI)); GL11.glColor4f(1F, 1F, 1F, 1F); byte s...
f4434276-6cad-4c2e-84a1-a2d51ae58bc9
1
@Override public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException { List paramList1 = new ArrayList<>(); List paramList2 = new ArrayList<>(); StringBuilder sb = new StringBuilder(UPDATE_QUERY); String ...
1b4e5c67-5357-478f-a493-72e0eae6f5f3
7
private static String reformatTimezone(String str, int signIdx) { String str2 = str; if (signIdx >= 0 && signIdx + 5 < str.length() && Character.isDigit(str.charAt(signIdx + 1)) && Character.isDigit(str.charAt(signIdx + 2)) && str.charAt(signIdx + 3) == ':...
1d9792cd-1490-4312-8314-4cd24511728b
2
private double pOfV(ArrayList<ArrayList<String>> d, String value, int index) { double p; int count = 0; int total = d.size(); for (ArrayList<String> aD : d) { if (aD.get(index).equals(value)) { count++; } } p = DecimalCalculate.div(...
62ae2798-fea5-403d-af52-6462fd124e15
6
@Override public boolean equals( Object obj) { if ( this == obj) { return true; } if ( obj == null) { return false; } if ( getClass() != obj.getClass()) { return false; } Coin other = ( Coin) obj; if ( amt == null) {...
48afa81c-39c4-4ae7-82bb-53d08e8bf277
6
public void keyPressed(KeyEvent e) { int code = e.getKeyCode(); if (code == KeyEvent.VK_LEFT) { leftPressed = true; } else if (code == KeyEvent.VK_RIGHT) { rightPressed = true; } else if (code == KeyEvent.VK_UP) { upPressed = true; } else if (code == KeyEvent.VK_P){ if(isPaused){ isPause...
bcfb16ce-e4b2-4353-a884-d063858850ec
9
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int cas = 1; for (String line; (line=in.readLine())!=null; cas++ ) { int n = Integer.parseInt(line); if(n==0) break; int s = Intege...
1db24607-2da9-4480-bf07-d4c3f0b13973
0
public void setPosicion(String posicion) { this.posicion = posicion; }
370da667-d0d3-4ab3-a8f2-42b2c0f22ac6
6
public void insert( T item ) { current = parent = grand = header; nullNode.element = item; while( current.element.compareTo( item ) != 0 ) { great = grand; grand = parent; parent = current; current = item.compareTo( (T)current.elem...
f4547cf8-56d0-4f69-93f4-1649c992581d
0
public Pattern getWordPattern() { return _wordPattern; }
95e102ee-4b6d-4ef3-b095-422e212e5b75
4
public static void main(String s[] ) { int num2,count_prime=1,i; //clrscr(); num2 =1; //it will exclude all less then 50 while(count_prime!=50) { for(i=2;i<=num2;i++) { if (num2 % i==0) { break; } } if(num2==i) { System.out.println(count_prime+"x"+num2); count_prime++; } num2++; } }
db6a1e27-763b-4c96-94ad-7112247f357f
0
protected void setVSync(boolean _vsync) { this.vSync = _vsync; }
9f771594-c9bc-4611-ba58-0e5b7e78e60a
8
public static LinkedList<Integer> sumBackwards(LinkedList<Integer> a, LinkedList<Integer> b){ LinkedList<Integer> c = new LinkedList<Integer>(); Node<Integer> nc = new Node<Integer>(0); c.head = nc; Node<Integer> na = a.head; Node<Integer> nb = b.head; int va, vb, carry = 0; while(true){ if(na ==...
575d9916-5622-452f-8ee1-799b29fcd4c7
5
private String removeSpaces(String str){ String result = ""; for (int i = 0; i < str.length(); i++) { if (str.charAt(i) != ' ' || (str.charAt(i) == ' ' && i != str.length() - 1 && str.charAt(i+1) != ' ')) { result += str.charAt(i); } } ...
bff0485d-a06d-4ce7-90c3-51c952cfce3c
4
public static void main(String[] args) { try { ////////////////////////////////////////// // Step 1: Initialize the GridSim package. It should be called // before creating any entities. We can't run this example without // initializing GridSim first. W...
27bea2bd-e123-44c1-8864-ba0095803840
9
public static int schemaTypeRelationship(SchemaType s1, SchemaType s2) { if (s1.isSameType(s2)) { return SAME_TYPE; } if (s1 instanceof AnyType) { return SUBSUMES; } if (s2 instanceof AnyType) { return SUBSUMED_BY; } SchemaType ...
af8c9bf7-2059-4c98-b59e-2e5b129dc90e
7
public void accept(final ClassVisitor cv) { FieldVisitor fv = cv.visitField(access, name, desc, signature, value); if (fv == null) { return; } int i, n; n = visibleAnnotations == null ? 0 : visibleAnnotations.size(); for (i = 0; i < n; ++i) { Annot...
8834987c-4180-4cb1-a376-dad3e2516a85
6
private static void readFromXML(XMLStreamReader in) throws XMLStreamException { while (in.nextTag() != XMLStreamConstants.END_ELEMENT) { String tag = in.getLocalName(); if ("version".equals(tag)) { in.nextTag(); } else if ("generation".equals(tag)) { ...
07857031-9b29-4284-8023-f2596c29e631
3
private Set<Class<?>> getRestResourceClasses() { Set<Class<?>> resources = new java.util.HashSet<Class<?>>(); resources.add(it.univpm.idstid.openstack.network.proxy.resources.NetworkRestInterface.class); resources.add(it.univpm.idstid.openstack.network.proxy.resources.SubnetRestInterface.class); resources.add(i...
3ddd2a41-f0e5-4c0c-926f-6d8895cc96c2
5
public void fixate() { Wire first = this.getStartPiece(); Wire last = this.getEndPiece(); Board startboard = this.circuit.getBoardAt(first.getStartX(), first.getStartY()); Board endboard = this.circuit.getBoardAt(last.getEndX(), last.getEndY()); Node startnode = startboard.getNodeAt(first.getStartX() - star...
fda9985d-0b97-49d3-8533-6342db21e615
0
public K getKey() { return key; }
915255f9-47bb-44ec-a5b8-d33b5619c4a3
1
public void Disconnect() { try { this.dbConnection.close(); } catch (SQLException ex) { System.out.println("Une erreur a été rencontrée lors de la fermeture de la connexion.\n" + ex.getMessage()); } }
529169d7-7d62-4989-b2ce-e0d721ce9b1d
7
private void initOutputToRegisters() { // It seems like we can take in account last opNOPs bit // to check if there is a specific destination. ORNode dst_ctrl[] = new ORNode[3]; for (int i = 0; i < dst_ctrl.length; i++) { dst_ctrl[i] = new ORNode(); dst_ctrl[i].connectSrc(opNOPs[BITNESS-1], 0, 0) ...
108771fe-ac0c-4927-b2f0-6baeac017c63
2
public OkPage(final String url, final String content) { if ((url == null) || (url.trim().length() == 0)) { throw new IllegalArgumentException("url cannot be null"); } this.url = url; this.content = content; }