method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ac0d671d-2a39-4196-8bc8-9494fa945924
0
@Override protected void setColoredExes() { coloredEx = LineGenerator.DDA(begin, end); center = coloredEx.get(coloredEx.size()/2); }
c792ff5c-ba75-4ff5-b1d3-f7796a382ab6
4
@Override public void handleCommand(CreateGameMatchCommand command) { if (command == null) { throw new IllegalArgumentException("Command can't be null."); } Player player = domainRepository.loadOneBy(Player.class, new PlayerNameSpecification(command.getPlayerName())); UUID playerId; if (player...
7d829b73-cb9d-46a4-9d11-125488e0dfe4
7
public JoinNetworkGame(Window owner, GeneralAttribute ga, StartWindows sw) { super(owner, ModalityType.APPLICATION_MODAL); this.generalAttribute = ga; this.startWindow = sw; generalAttribute.addObserver(this); getContentPane().setBackground(Color.LIGHT_GRAY); getContentPane().setCursor( Cursor.getPrede...
8a0a36b0-64a2-42d3-843b-7219aae8d688
1
public static <K,V> List<V> map2ListKeyAsc(Map<K, V> source) { List<V> result = new ArrayList<V>(); Set<K> sortedKeys = new TreeSet<K>(source.keySet()); for(K key:sortedKeys) { result.add(source.get(key)); } return result; }
5274b934-010f-4a5b-a747-781b2876538c
2
public Level getLevel(int id) { Level level = null; try { PreparedStatement ps = con.prepareStatement("SELECT * FROM level WHERE id=?"); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); if(rs.next()) { level = getLevelFromRS(rs); } ps.close(); } catch (SQLException e) { // T...
c589f5b4-e089-49f9-85e1-7c6bf8156219
6
private boolean isMultiplyOverflow(IDecimal other) { if (CHECK_OVERFLOW && base != 0) { if (base > 0 && MAX_VALUE.base / base < other.getBase()) { return true; } if (base < 0 && MAX_VALUE.base / base > other.getBase()) { return true; } } return false; }
556a9cf3-cce0-40ee-8e60-ca576b3d3ee6
2
public static String[] parseLine(String s) throws IOException { if (s == null) { throw new IllegalArgumentException("Null argument not allowed."); } // uh,jh: make sure that parseLine("").length == 0 if (s.length() == 0) { return EMPTY_STRING_ARRAY; } ...
cef7e7a5-4710-4b94-afae-3e388a88502d
1
@Override public String execute(SessionRequestContent request) throws ServletLogicException { String page = ConfigurationManager.getProperty("path.page.createorder"); try { createCurrOrder(request); Order currOrder = (Order) request.getSessionAttribute(JSP_CURRENT_ORDER); ...
95d6137d-d06a-41dc-b750-5a43013b5ab5
4
public List<Evidence> getSelfCounterEvidenceList() { List<Evidence> evidenceList = new ArrayList<Evidence>(); Element evidenceE; Evidence evidence; ClaimDao claimDao = new ClaimDao(fileName); Claim claim = null; List<Claim> selfCounterclaimList = claimDao.getSelfCounterClaimList(); for (Iterator i = root....
9b65f159-264d-4b77-8986-800f2f3261f2
7
public BufferedImage makeTitle(int id, int x, int y, TextFont textFont, String align, int angdeg, boolean airType, int maxLength){ String title = rss.getTitle(id); if(!airType){ int subStringLoc = 0; if(title.endsWith(" - TV")){subStringLoc = 5;} else if(title.endsWith(" - Movie")){subStringLoc = 8;} el...
1a564176-a97e-4672-ad9c-74995dfa0886
4
private void bumpStaff() { Platform.runLater(new Runnable() { @Override public void run() { scrollbar.adjustValue(scrollbar.getValue() + skipAmount); if (scrollbar.getMax() <= scrollbar.getValue() && endOfFile) { scrollbar.setMax(scrol...
02aad432-f39e-401b-b319-62eec50052aa
0
@Override public void windowClosed(WindowEvent arg0) { messanger.close(); dispose(); }
65a18dd6-4f2c-40ee-94bd-085e73daf2ec
1
public static boolean isFilenameValid(final String file) { File f = new File(file); try { f.getCanonicalPath(); return true; } catch (IOException e) { return false; } }
5ed276cf-07b3-489e-8142-badedfd7a4ad
6
public void setEditValue(int n, EditInfo ei) { if (n == 0) { text = ei.textf.getText(); split(); } if (n == 1) { size = (int) ei.value; } if (n == 3) { if (ei.checkbox.getState()) { flags |= FLAG_BAR; } e...
d1a2912c-b421-47d0-847c-247bdb27892d
3
private void setItemPanels( JPanel panel, int slots, Iterator<InventoryItemObject> inventoryItemListObjectsIter ) { InventoryItemObject inventoryItemObject; int position; ItemObject itemObject; ItemPanel itemPanel; position = 0;...
634c6bf4-761c-451c-b053-dac7f4c04535
6
public void explode(){ if(rank>1){ int amount = 0; if(type ==1){ amount = 3; } if(type ==2){ amount = 3; } if(type ==3){ amount = 4; } for (int i = 0;i<amount;i++){ Enemy e = new Enemy(getType(),getRank() -1); e.setSlow(slow); e.x = this.x; e.y = this....
ca9739a5-2383-4869-9533-f5c0d42083e7
9
private void checkStuck(Point tileX, Creature c) { float offsetX = map.getOffsetX(); float X = c.getX(); float DX = c.getDX(); int width = c.getWidth(); int tilePixelX = renderer.tilesToPixels(tileX.x); if (c instanceof Player) { if (DX > 0 && (Math.round(X +...
d64ec076-d4db-4696-972b-e096d757b892
3
public void run() { if (Util.interactWithObject("Climb-up", 62678)) { int time = 0; while (!climberMode.validate() && time <= 4000) { time += 50; Time.sleep(50); } } }
85bfde5e-5e4d-4290-883b-8fa09b1bb64f
1
public static IPokemon createNewInstance(String classname) { System.out.println("Trying to retrieve pokemon " + classname); PyObject theClass = ScriptManager.getInterpreter().get(classname); PyObject theInstance = theClass.__call__(); IPokemon t = (IPokemon)theInstance.__tojava__(IPokemon.class); t.initialize...
b4a479e5-8ece-442d-a62e-e2e51777f663
0
public void setScreenX(int screenX) { this.screenX = screenX; }
2ec8b5a1-81d4-4a17-ae5b-ea2fb93a9a82
2
public void doBuyerLogoutActions() { List<String> services = user.getUserServiceList(); HashMap<String, String> usersStatusList; for (String service : services) { //all users that provide a service usersStatusList = user.getMatchingUsers().get(service); //drop all offer requests if (!usersStatusList...
01c7caea-688e-4dba-89d5-2f42a223dc02
7
@Override public T deserialize(JsonParser jp, DeserializationContext dc) throws IOException, JsonProcessingException { try { T obj = deserializeClass.newInstance(); while (true) { JsonToken token = jp.nextValue(); if (token.equals(JsonToken.END_OBJECT...
cc6c2780-3053-47c4-a677-2277e070a02b
5
int getTexture(BufferedImage bi) { try { GL11.glGenTextures(RenderEngine.intbuf); final int id = RenderEngine.intbuf.get(0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, id); final int format = bi.getColorModel().hasAlpha() ? GL11.GL_RGBA : GL11.GL_RGB; ByteBuffer texData; WritableRaster raster; ...
d43c7ea7-e204-4e2b-a3e0-30d1dfc17c56
5
public final int hgetbits(int N) { totbit += N; val=0; if (buf_byte_idx + N < BUFSIZE) { while (N-- > 0) { val <<= 1; val |= ((buf[buf_byte_idx++] == 0) ? 0 : 1); } } else { while (N-- > 0) { val <<= 1; ...
bdf61bfa-1e98-4a89-ac5a-ad433aac4322
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Cluding other = (Cluding) obj; if (content == null) { if (other.content != null) return false; } else if (!content.equals(other.content)...
7160bc48-15d1-462f-98f1-1360971e458c
5
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((credential == null) ? 0 : credential.hashCode()); result = prime * result + ((expireDate == null) ? 0 : expireDate.hashCode()); result = prime * result + ((startDate == null) ? 0 : startDate.hashCo...
e67fb089-95b2-4527-89a1-b42052b57c8d
5
public void checkZone(Player p){ for (int i = 0; i < markers.size(); i++){ AreaMarker marks = markers.get(i); int tileX = marks.getTileX(); int tileY = marks.getTileY(); int pX = p.getTileX(); int pY = p.getTileY(); int distanceX = Math.abs(pX - tileX); int distanceY = Math.abs(pY - tileY); if...
90d0d468-167d-400f-bb35-48b70b6a9823
7
public void maxHeapify(int i){ if(i>=contents.length) return; int left=left(i); int right=right(i); if(left==-1) return; if(right==-1){ if(contents[i]<contents[left]){ swap(i,left); } return; } if(contents[i]>=contents[left] && contents[i]>=contents[right]) return; if(contents[left]<c...
09675ae1-f2b4-4028-b093-f703551eb4d1
0
@Override public void modifiedStateChanged(DocumentEvent e) { calculateEnabledState(e.getDocument()); }
59718d9a-b0f0-4e83-a533-827f92153b0e
4
public static void main(String[] args) { Graph G = null; try { G = new Graph(new In(args[0])); } catch (Exception e) { System.out.println(e); System.exit(1); } int s = Integer.parseInt(args[1]); ISearch search = new Search(G, s); for (int v = 0; v < G.V(); v++) if (search.marked(v)) ...
61359e11-1369-48fa-8bd6-ed3d0b9d47c7
4
public MenuVict () { super(); try { setImg(ImageIO.read(new File("img/background/menu.jpg"))); } catch (IOException e) { e.printStackTrace(); } _title.setBounds(295, 25, 185, 50); _title.setFont(new Font("Arial", Font.BOLD, 45)); add(_title); _highScore.setSize(200, 45); _highScore.setFont(...
9560fbeb-fc0b-489c-82a8-c2f432f033a9
2
@Test public void next_2Threads10Numbers_NoDuplicatesAndMissingVal() { ExecutorService es = Executors.newFixedThreadPool(2); ConcGeomProgression cgp = new ConcGeomProgression(); GeomProber.setCounter(10); for (int i = 0; i < 2; ++i) { es.submit(new GeomP...
e49219c3-151d-4cff-9d02-a2c609067039
3
public static String MD5(String str) { MessageDigest md = null; try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } md.update(str.getBytes()); byte[] byteData = md.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < by...
6467ed72-cc84-4813-a912-ccf741147317
0
public void sendtobcast(String s) { String title = ChatColor.GREEN + "[" + ChatColor.GOLD + "pvpϵͳ" + ChatColor.GREEN + "] " + ChatColor.WHITE; Bukkit.broadcastMessage(title + s); }
38d658f2-5b3e-4c9a-890e-f0a97ed35272
2
@Override protected void process_reaped () { --sockets; // If reaped was already asked to terminate and there are no more sockets, // finish immediately. if (sockets == 0 && terminating) { send_done (); poller.rm_fd (mailbox_handle); poller....
0fa75ba6-68cb-4d25-be68-08ad0ed62376
4
public static String getJailReason(String playerName){ String reason = "Not Jailed"; if(isJailed(playerName)){ try { SQL_STATEMENT = SQL_CONNECTION.createStatement(); SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM jails WHERE username='" + playerName + "'"); // This loop c...
68b0e2a1-aa8f-47c8-aecc-bf7af367acfe
5
public static List<String> getPluginFiles() { List<String> pluginFiles = null; try { //String pluginList = ""; File jarLocation = new File(ControllerEngine.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); String parentDirName = jarLocation.getParent(); // to get the parent d...
f93f8f76-d58d-4eed-9517-03f4fffaf261
2
public Value get(Identifier id) { // traverse the list of environments backwards for(int i = env.size() - 1; i >= 0; i--) { Value rval = env.get(i).get(id); if(rval != null) { return rval; } } // exited the search without finding the Identifier, return null return null; }
006065dc-0aa9-4656-a204-cd3cd0cb5da8
1
public Cluster(FeatureVector fv) { featureVector = new FeatureVector(); for (Entry<Integer, Double> entry : fv.getVector().entrySet()) { featureVector.add(entry.getKey(), entry.getValue()); } numOfMembers = 0; }
11c7a743-4e89-452b-92d3-fa7f0d39519d
4
public ScoreModel(){ entete=new String[]{"Joueur","Score","Type de Jeu","Date"}; //lecture � partir du fichier score.dat String ligne=null; String[] elements=null; list=new ArrayList<Joueur>(); //lire � partir d'un fichier BufferedReader in=null; try{ in=new BufferedReader(new FileReader("Ressource...
77dba755-7ad2-4e92-ac97-8b82ee1e65c0
4
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { user = (User) request.getSession().getAttribute("user"); System.out.println("User: " + user); //Check is user is logged in for session if (checkLoggedIn(request)) { //Logged-in... ...
1f1d41ba-7a67-4229-bb30-d0c392870b39
8
private List<Class<?>> getClassesFromJar(String name) throws ClassNotFoundException { List<Class<?>> classes = new ArrayList<Class<?>>(); try { FileInputStream fis = new FileInputStream(name); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis)); ZipEntry entry; ...
afc7b5ad-7864-4765-bba2-d12cc0bb64c9
1
public ModeEnum getSelectedMode() throws GOLException { int i = comboMode.getSelectionIndex(); if (i == -1) { throw new GOLException("Bitte Spielmodus auswählen."); } else { return availableModes[i]; } }
3c45e9ec-bdb0-4cb6-879c-b909a123011b
9
public Tour getRandomTour(boolean beEmpty, boolean beFull){ if(beEmpty && !hasEmptyTour()) return null; if(beFull && !hasFullTour()) return null; Tour ret = null; while(ret == null){ int idx = randGen.nextInt(this.tours.size()); ...
9427782d-7e83-4f1e-94a4-c5954da54165
4
public int ouderRotatie(Gezin ouderlijkGezin) { int count = 0; if(ouderlijkGezin.getOuder1() != null) if(ouderlijkGezin.getOuder1().getOuderlijkGezin() != null) { count += ouderRotatie(ouderlijkGezin.getOuder1().getOuderlijkGezin()) + 1; }...
89ff9b8e-93e6-4d46-9b25-fcdb430f2f55
4
@Test public void WhenLevelBiggerThanRefMax_ExpectFinalSizeEqualToRefMax() throws UnknownHostException { int refMax = 1; Host localhost = new PGridHost("127.0.0.1", 3000); localhost.setHostPath("0010"); RoutingTable routingTable = new RoutingTable(); routingTable.setLocalhost...
e0525625-bd55-41de-b7fb-2c8ada46240a
3
public static boolean genericIntersects(IIntervalsTimeDomain a, IIntervalsTimeDomain b) { // if boundary do not cross, they sure not intersect Interval aBounding = a.getBoundingInterval(); Interval bBounding = b.getBoundingInterval(); if (aBounding == null || bBounding == null) { ...
f2fb9636-686e-4fe6-90a6-f25cc46f23c2
6
public void shutdownMinecraftApplet() { try { this.statFileWriter.func_27175_b(); this.statFileWriter.syncStats(); if (this.mcApplet != null) { this.mcApplet.clearApplet(); } try { i...
404edbd5-a1d2-4959-aad2-8840b12a25c6
4
public void step() { int w = getWidth(); int h = getHeight(); if (pos_x < 0) { delta[0] = 1; } else if (pos_x > w - radius) { delta[0] = -1; } if (pos_y < 0) { delta[1] = 1; } else if (pos_y > h - radius) { del...
262e5c59-27a8-480d-8639-6c4274ea93a6
0
public SomeBean[] getSomeObjArray() { return someObjArray; }
6e7e1d12-9103-4199-99b5-dc7bdf5389c6
1
private static boolean isFibo(long n) { BigInteger bigN = new BigInteger(Long.toString(n)); BigInteger big5 = new BigInteger("5"); BigInteger big4 = new BigInteger("4"); BigInteger value1 = ((bigN.multiply(bigN)).multiply(big5)).add(big4); BigInteger value2 = ((bigN.multiply(bigN)).multiply(big5)).subtrac...
aafccf46-3d51-4a60-a528-4cb150ed0b68
6
public static void main(String[] args){ int max=0, maxP=0; for(int i=3;i<=1000;i++){ int count=0; for(int a=1;a<i/2;a++){ for(int b=1;b<a;b++){ int c = i-a-b; if (c > i/2) continue; if(c*c+b*b==a*a) count++; } } if (count>max){ max = count; maxP = i; } } System.out....
afb02520-4f07-4557-8da3-eeefd9549001
5
public String getCPUStateInfo() { String ret = ""; for(int i=0;i<8;i++) if(rMask[i] == 0xFF) ret += " " + registerNames[i]+" = "+Integer.toHexString(r[i]); if(getCarry() != -1) ret += " carry = "+getCarry(); if(getZero() != -1) ret += " zero = "+getZero(); if(loadedBank != -1) ret += " bank = ...
2287367b-3994-4b6d-b7c6-92ad915235b4
0
public Coordinate(int x, int y) { this.x = new Integer(x); this.y = new Integer(y); }
74343a68-088e-4f59-8484-ed401630bb7a
4
public boolean match(TokenType... args) { if (empty()) { return false; } try { for (int i = 0; i < args.length; i++) { if (tokenList.get(i).type != args[i]) { return false; } } } catch (IndexOutOfBoun...
8ac79b0f-acda-4f63-a6b4-02b7ac12a446
5
@Override public Account findAccountByAccountIdAndRoleId(int accountId, int roleId) { Account account = null; Connection cn = null; PreparedStatement ps = null; ResultSet rs = null; try { cn = ConnectionHelper.getConnection(); ps = cn.prepareStatemen...
29acce4f-467a-4618-be88-5f9cdbff485e
9
public boolean isMatch(String s, String p) { // Start typing your Java solution below // DO NOT write main() function int i = 0; int j = 0; int star = -1; int pre = 0; while (i < s.length()) { while (j < p.length() && p.charAt(j) == '*') { star = j++; pre = i; } if (j == p.length() |...
d28b4f58-114f-4fba-b64c-804dfc1adde1
6
public void CreateNewLeveledLists(String folder) throws Exception { LVLI targetlvl = null; NumberFormat formatter = new DecimalFormat("000"); LVLI LItemClothesAll = (LVLI) SkyProcStarter.merger.getLeveledItems().get(new FormID("106662Skyrim.esm")); for (int i = 1; i < RBS_Main.amountBod...
192cd8a3-f530-48b2-95a7-19286d9c5cf2
8
* @return der neue Konfigurationsbereich * * @throws ConfigurationChangeException Falls der neue Bereich nicht erstellt werden konnte. */ private ConfigurationArea createConfigurationArea(final ConfigurationAreaProperties property, final ConfigurationControl configurationControl) throws ConfigurationChangeExc...
70295584-be74-4452-b11d-a55617583d18
9
public Line2D.Double getClippedLine(Line2D.Double line) { if (isInside(line.x1, line.y1) && isInside(line.x2, line.y2)) { return line; } if (isInside(line.x1, line.y1) == false && isInside(line.x2, line.y2) == false) { return null; } if (line.x1 != line.x2 && line.y1 != line.y2) { return null; } ...
98503a87-51c8-4c6b-81c9-edc7c68774da
8
private void mergeNewChildren (Collection<AbstractPage> oldChildren, Collection<AbstractPage> newChildren) { childPages.clear(); // discard previous data if any. List<AbstractPage> resultChildren = new LinkedList<>(); for (AbstractPage newChild: newChildren) { // search if exactly that child existed. Abs...
87e8efd9-4aa2-4992-a862-b0f3c79b6ca3
0
@Override public boolean supportsComments() {return true;}
ff249700-3599-48b6-ace1-eed26eaad282
2
public boolean attaquePossible(Region regionDefensive) { if ((this.estVoisin(regionDefensive)) && (this.nbArmee > 1)) return true; return false; }
c8a9efc6-b968-4be7-bea8-e76bc11ff0fa
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(mob.isInCombat()&&(mob.rangeToTarget()>0)) { mob.tell(L("You are too far away to touch!")); return false; } final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) ...
6754ccfe-4307-4ea9-838d-e50e8d05b3ba
6
@Test public void testReserveSpot() throws Exception{ resetSpots(); AccessControlServer server = new AccessControlServer(1927); server.start(); SpotStub spot = new SpotStub("101",1927); spot.start(); String ans = ""; int x = 0; ...
1ea49531-abd6-4c13-9fac-88a465e4afc3
5
public SemanticRec[] gen_cast(SemanticRec left, SemanticRec right) { Type leftType = getTypeFromSR(left); Type rightType = getTypeFromSR(right); SemanticRec[] arrRec = new SemanticRec[2]; if (leftType == rightType) { //no cast needed arrRec[0] = left;...
db995572-2abf-4f36-81a5-86d81592f2b4
2
public static String findSingleFile(String inFilepath, Filtro isFiltro, String file) { File fileFound = null; List<String> gdbList = findFile(inFilepath, isFiltro); for (String gdbFile : gdbList) { if (gdbFile.contains(file)) { fileFound = new Fi...
012b52a4-5309-4fec-af66-77916e63568f
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 157 // do, line 159 v_1 = cursor; lab0: do { // call prelude, line 159 if...
b83b59a0-2834-4f24-b4d9-8df849f801b7
6
@EventHandler public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) { if (main.isIngame()) { if (event.getEntity() instanceof Player) { main.updateHealth((Player)event.getEntity()); } if (event.getDamager() instanceof Player && event.get...
b6054607-1c92-4d69-99e5-a959b12522bd
9
public static ArrayList<Rental> postPropertiesRentals( HashMap<String, String> map) throws ConnectionDatabaseException, IllegalCommandException, FileException{ ArrayList<Rental> list = new ArrayList<Rental>(); try{ link = new DataBaseManager(); int yearActual = Calendar.getInstance().get(Calendar.YEAR); ...
58466e5a-57e9-42e6-9bc1-716a750222fd
3
public static void setAttribute(Node node, String attribute, Object value) { if (node.getNodeType() == Node.ELEMENT_NODE && attribute != null && value != null) { ((Element) node).setAttribute(attribute, String.valueOf(value)); } }
e7739d4e-ab6b-4636-92ba-8d461c181aaa
3
protected Transferable createTransferable(JComponent jcIn) { EzimContactTransferable ectOut = null; if ( jcIn instanceof JList && ((JList<?>) jcIn).getModel() instanceof EzimContactList ) { @SuppressWarnings("unchecked") JList<EzimContact> jlstEc = (JList<EzimContact>) jcIn; ectOut = new ...
1c04135c-4251-41ab-80df-44313631a209
5
private void updateVillainMissiles4() { ArrayList<VillainMissile4> deadVillainMissiles = new ArrayList<VillainMissile4>(); for(int i = 0; i < villainMissiles4.size(); i++) { VillainMissile4 v = villainMissiles4.get(i); v.move(); if(CollisionDetector.isColliding(v, sc)) { if(!sc.isShieldActive()) ...
b87c1e60-b168-447a-ac25-389e0664d73a
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...
0c9fae4d-a6c2-4fde-8989-e617b5fb3c50
2
public JMenu findJMenu( String id ) { int i; for( i=0; i < listOfJMenu.size(); i++ ) { if( listOfJMenu.get( i ).getText().equals( id ) == true ) { return listOfJMenu.get( i ); } } return null; }
91111108-113f-43fe-9f2c-e8bbfce72b81
7
public static CRISPR scanRight(CRISPR candidateCRISPR, String pattern, int minSpacerLength, int scanRange, SearchUtil searchUtil) { int numRepeats = candidateCRISPR.numRepeats(); int patternLength = pattern.length(); int sequenceLength = DNASequence.seq.length(); int lastRepeatIndex = candid...
26e48cc0-9988-416d-a4f6-d9d77f3a836d
0
public int ID() { return ID; }
06dfaa2c-c8ab-4d7c-a3b1-f8aa91ddfaa9
2
@EventHandler public void onRespawn(PlayerRespawnEvent e) { Player p = e.getPlayer(); World world = p.getWorld(); if (utils.isValidWorld(p)) { ConfigurationSection section = plugin.getConfig().getConfigurationSection(world.getName()); if (section == null) return; p.setFoodLevel(section.getInt("h...
1e3f2420-6328-4d33-a2e8-4a14e6516552
8
public static void find() { int []longSeq = new int[a.length]; int [] retrack = new int[a.length]; int max = Integer.MIN_VALUE; int max_index = Integer.MIN_VALUE;; //set longest length of array sized i as 1 for( int i=0; i< longSeq.length; i ++){ longSeq[i]...
0213fe89-0f22-48d8-b5d2-7feb43174a3c
9
public static boolean isRotatedPalindromeDP(String input) { String augmentedInput = input + input; boolean[][] length = new boolean[augmentedInput.length()+1][augmentedInput.length()+1]; int maxLength = input.length(); //setting up base case .. all single letter palindromes for(...
439ba9e6-b31e-451d-b531-e1cd9c11bfe7
2
private static void createParameterFilePath() { File f; f = new File(gameDir); if (!f.exists()) f.mkdir(); f = new File(parameterDir); if (!f.exists()) f.mkdir(); }
c0ab8d43-e2e4-4816-8e14-53f57b9ef07f
0
public void setN(int n) { this.n = n; }
63ba4396-39d1-46b9-968f-f9332424d1b7
5
private Element generateColumnJustInFile(Document doc, ColumnInfo col) throws ParserConfigurationException { /** Пример того что должно получится на выходе * <Column place="base"> * <sTableName>CMS_WF_STATUS</sTableName> * <sColumnName>ID</sColumnName> * <sOwner> ...
046a0324-b805-4987-adbf-8f0aa63f46fa
5
public static void putInt(ByteBuffer out, int x) { int value = (x < 0 ? -x : x); int sign = (x < 0 ? BYTE_SIGN_NEG : BYTE_SIGN_POS); int a = (value & 0x3F); int more = (value >>>= 6) != 0 ? BYTE_MORE : 0; out.put( (byte)(more | sign | a) ); while (mo...
8e52b44e-7a79-47c9-8bc5-29e1ba735071
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...
27ac294c-8668-4b9f-b178-68aa6d90d02d
1
@Test public void testCreatingContactWithNullLastNameShouldFail() { try { new Contact("Matt", null, phoneNumber); fail("Was expecting an Exception when no last name is provided."); } catch (IllegalArgumentException iae) { Assert.assertEquals("Please provide a value for Last Name as it is a non-nullable fi...
aefa231f-62ea-432f-badf-e5fc006ef0b0
3
public static Pair minmax(double[] values) { double min = Double.MAX_VALUE; double max = Double.MIN_VALUE; for (double v : values) { if (min > v) min = v; if (max < v) max = v; } return new Pair(min, max); }
9cfa7f1d-4fcd-4304-a2bc-242cb85fe535
7
@Override public boolean equals(Object o) { if(o == null) return false; if(o == this) return true; if(!(o instanceof AuftragDTO)) return false; AuftragDTO a = (AuftragDTO)o; if(a.getNr() != nr || a.getIstAbgeschlossen() != istAbgeschlos...
502bd774-196a-4d60-ae58-c34e01f4e468
0
private Date getDateFromString(String date) throws ParseException { DateFormat df = new SimpleDateFormat(DATE_FORMAT); return df.parse(String.valueOf(date)); }
bb8cd768-6854-467f-9c63-000d1587b28e
0
public BitSet getBitfield() { return this.bitfield; }
678e97e2-8440-47b7-86ec-132ff6617c60
0
public Transition getTransitionForProduction(Production production) { String lhs = production.getLHS(); String rhs = production.getRHS(); String rrhs = getReverse(rhs); Transition transition = new PDATransition(START_STATE, START_STATE, "", rrhs, lhs); return transition; }
05ece189-5090-4161-a840-bb205cc31606
6
private void handleAddCard(IServerPlayer p, CardInterface c) throws IOException { try { if (t.getNumberOfCardsOnTable() == 0) { data.clearCardsOnTable(); LOG.info("Cleared table on beginning of round!"); } pm.sendSuccessPacket(p.getName(), Lang...
80cc5bfa-0f94-4efb-a148-2a8a4ac302b7
0
public void setAliases(String aliasString) { gameAliases = aliasString.split(",,"); }
9e1ef04f-7b5b-4d2e-822a-bdc6a9968e07
5
private void initComponents() { class1ComboBox = new javax.swing.JComboBox<String>(); class2ComboBox = new javax.swing.JComboBox<String>(); jSeparator1 = new javax.swing.JSeparator(); okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); nameTex...
a13e773b-f0b6-48d3-a310-2b48674c2de0
3
@Test public void test_solvable_matrix_size_3_solve2() throws ImpossibleSolutionException,UnsquaredMatrixException, ElementOutOfRangeException{ int height=3; int width=3; float[][] matrix; float[] resultVector; float[][] knownMatrix = new ...
b9b0dc7a-4a47-44b5-b2e5-4ae2ac29527a
7
private void setUpForAction(){ switch(action){ case HASHFUNCTIONS: jLabel4.setEnabled(true); jRadioButtonVitesse.setEnabled(true); jRadioButtonCollisions.setEnabled(true); jRadioButtonLoiUniforme.setEnabled(true); jCheckBox3.setEnabled(false); break; case HYPERLOGLOG: b.setEnabled(true); j...
51e2f397-905b-4d22-bdc6-2d006101e1f8
7
public void addEdge(T start, T end) { // copy the out and in list HashMap<T, List<T> > newOut, newIn; newOut = new HashMap<>(); newIn = new HashMap<>(); for (Entry<T, List<T> > e : out.entrySet()) { newOut.put(e.getKey(), new ArrayList<>(...
93372241-80d0-4f75-8153-68a41aca7310
1
private ByteBuf toByteBuff(String message) { ByteBuf bytebuf = Unpooled.buffer(); bytebuf.writeByte(255); char[] achar = message.toCharArray(); bytebuf.writeShort(achar.length); char[] achar1 = achar; int i = achar.length; for (int j = 0; j < i; ++j) ...
47829eb5-c3b0-40e1-8465-552910c1c47f
3
public static UserTypeEnum getTypeByName(String name) { if (StringUtils.isEmpty(name)) { return null; } for (UserTypeEnum value : values()) { if (StringUtils.equals(value.name(), name)) { return value; } } return null; }
7c25cfb2-b918-408e-b7ab-db2b558f9813
7
public boolean hasNext() { if (currentPiped == null) return false; else if (currentPiped.hasNext()) return true; else if (nextPiped != null) return nextPiped.hasNext(); else if (!in.hasNext()) return false; else while (true) { pipe.setKey(in.next()); nextPiped = pipe.execute(); if (ne...