method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
92f36a29-4cc8-42fd-b62b-7dcede38a0bf
3
public Player(int pID){ playerID = pID; //Jeder Spieler bekommt 15 Steine for(int i=0; i<14; i++){ steine.add(new Steinchen(this.playerID, i)); } dice = new Dice(); //Startposition fuer die einzelnen Spieler initialisieren switch(playerID){ case 0: this.startposition = 0; case 1: ...
dd495889-4ffd-44cd-80dc-245b316f6da4
2
public BBLogHandler(File f) { log.finer("Creating new BBLogHandlerInstance"); try { if(!f.exists()) { //noinspection ResultOfMethodCallIgnored f.getParentFile().mkdirs(); //noinspection ResultOfMethodCallIgnored f.createNewFile(); } fw = new FileWriter(f, true); toFile = true; } catch(...
5831f0a2-39f3-4174-a93b-455cb92e826d
4
public void update(UserBall b){ BPx = b.getPx(); BPy = b.getPy(); BVx = b.getVx(); BVy = b.getVy(); BRad = b.getRadius(); if ((BPy+BRad > Py) && (BPy+BRad < Py+BRad) && (BPx+(0.5)*BRad > Px) && (BPx-(0.5)*BRad < Px+width)){ // ball is on top of platform BPy = Py-BRad; BVy = -60; } b.setP...
e9279a64-ffd3-4094-a3c4-a11858b306a5
4
public static String decode(X509Certificate x509) { List<String> result = new ArrayList<>(); boolean[] usage = x509.getKeyUsage(); if (usage == null) { return "<missing>"; } for (int i = 0; i < NAMES.length; i++) { if (i >= usage.length) break; if (usage[i]) { result.add(NAMES[i]); } } retur...
3f600654-1479-4a53-9375-c4c8663605a5
5
public void applyBackpropagation(double expectedOutput[]) { int i = 0; for (Neuron n : outputLayer) { // update weights for output layer ArrayList<Connection> connections = n.getAllInConnections(); for (Connection con : connections) { double ak = n.getOutput()...
fe7ac02c-d2ef-4e51-b8d8-3529ab6461a4
1
@RequestMapping(value = "/event-branch/{id}", method = RequestMethod.GET) public ModelAndView eventBranchPage( final HttpServletRequest request, final HttpServletResponse response, @PathVariable(value = "id") final String idStr ) throws IOException { ModelAndView mode...
28475d55-480e-490b-a1f1-3cb1ee2adda1
6
@Override public void run() { try { BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.println(Encriptador.CifrarMensaje("Ingrese una operacion (SUMAR, RESTAR, MUL...
a5541476-c251-4376-9564-30d69f240b46
5
public String read(String player, String element) { String value = null; Node players = doc.getFirstChild(); NodeList playerNode = null; NodeList list = players.getChildNodes(); for(int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if(player.equals(node.getNodeName())) playerN...
d3a3f644-565b-483e-a19c-7a87eca2b3d5
4
public boolean accept(File file) { if (file.isDirectory()) { return true; } else { String path = file.getAbsolutePath().toLowerCase(); for (int i = 0, n = extensions.length; i < n; i++) { String extension = extensions[i]; if ((path.endsWith(extension) && (path.charAt(path.lengt...
400e536a-ba47-4416-bece-1b062a02bca0
1
public static <K> void incrementValue(TreeMap<K, Integer> map, K key) { Integer count = map.get(key); if (count == null) { map.put(key, 1); } else { map.put(key, count + 1); } }
fe0360c9-eb38-4760-bebb-f126faac2032
0
public void setYearStored (Year y) { yearStored = new Year (y); }
486b38bd-8326-4392-9fd1-bb23ea04de73
2
public List<Schedule> getScheduleList() { List<Schedule> list = new ArrayList<Schedule>(); try { ResultSet rs = con.createStatement().executeQuery("SELECT * FROM schedule"); while(rs.next()) { list.add(getScheduleFromRS(rs)); } rs.close(); } catch (SQLException e) { // TODO Auto-generat...
2d474cf6-6c38-4abe-ad32-cbcb27ca7d87
8
public void setImages() { if (waitImage == null) { File imageFile = new File(Structure.baseDir + "ChronoTower.png"); try { waitImage = ImageIO.read(imageFile); } catch (IOException e) { e.printStackTrace(); } } if (attackImage == null) { File imageFile = new File(Structure.baseDir + "Chro...
9a1865e7-2f05-475e-90d5-6cdb46765093
6
public static void main(String[] args) { try { Manifest manifest = new Manifest(FreeCol.class.getResourceAsStream("/META-INF/MANIFEST.MF")); Attributes attribs = manifest.getMainAttributes(); String revision = attribs.getValue("Revision"); FREECOL_REVISION = FREE...
ec6ed7d7-384c-407c-8110-5085e056f9f9
8
@Override public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] split) throws NullPointerException, ArrayIndexOutOfBoundsException { // get basic info needed Player player; Boolean isPlayer; if (sender instanceof Player) {// If it's a player, we respond differently than ...
41fbcebe-009b-45dd-94cf-4489a39328f4
6
static final void method2267(int i, int i_0_, int i_1_, int i_2_, int i_3_, int i_4_, int i_5_, int i_6_) { anInt6324++; if (i != 10499) method2267(55, -44, 14, -122, 70, 0, 127, 112); if ((i_0_ ^ 0xffffffff) == (i_6_ ^ 0xffffffff)) Npc.method2441(i_2_, i_6_, i_4_, -22728, i_5_, i_3_, i_1_);...
951d5f4e-7250-469c-9d98-0e1051e4e102
2
private void newSong() { boolean cont = true; if (StateMachine.isSongModified()) cont = Dialog .showYesNoDialog("The current song has been modified!\n" + "Create a new song anyway?"); if (cont) { theStaff.setSequence(new St...
fc8edd50-db53-4881-8ca6-bb372f2a40cf
4
public JLabel getPlayer1Name() { boolean test = false; if (test || m_test) { System.out.println("Drawing :: getPlayer1Name() BEGIN"); } if (test || m_test) System.out.println("Drawing:: getPlayer1Name() - END"); return m_player1Name; }
938f9f95-47d1-488c-a45f-e0b248fd8f77
4
public final void init(InjectorClassLoader classLoader, InjectorPluginLoader loader) { if (this.classLoader != null && this.pluginLoader != null || isEnabled()) { return; } this.classLoader = classLoader; this.pluginLoader = loader; if (getDescriptio...
ba4f6e21-fbb4-48a4-a557-cf055790e0cc
7
private static int runmemsize(String[] args) { String rstr = null; String path = null; for (int i = 1; i < args.length; i++) { String arg = args[i]; if (path == null && arg.startsWith("-")) { usage(); } else if (rstr == null) { rstr = arg; } else if (path == null) { ...
d6e46dde-23ef-4aef-b51c-c0e8cc0da9cc
1
public ResultSet Select(String query){ //DO NOT USE IN PRODUCTION //This method will take a query and blindly execute it // We'll fill this ResultSet from the query and return it. The calling code can then break it down and pop it into the target attributes ResultSet r...
8446bd8c-0216-4db3-9611-e732a17dc1c5
5
protected static Ptg calcOdd( Ptg[] operands ) { if( operands.length != 1 ) { return PtgCalculator.getNAError(); } double dd = 0.0; try { dd = operands[0].getDoubleVal(); } catch( NumberFormatException e ) { return PtgCalculator.getValueError(); } if( new Double( dd ).isNaN() ) // Not a ...
e4ab5a0c-b5f7-47cc-9a08-e2beecd0bea9
2
public static void main(String[] args) { char again; int n; do{ print("Enter the dimension of the matrix: "); n = scan.nextInt(); double[][] matrix = new double[n][n]; print("\nEnter the matrix data:\n"); input(matrix); print("The trace of the matrix is: " + trace(matrix)); print("\nContinue?...
231f526a-95c3-431c-ab97-e82a60d9c785
2
public boolean userNameInList(User user, ArrayList<String> friendNamesList) { String curName = user.getName(); for (String friendName : friendNamesList) { if (curName.equals(friendName)) { return true; } } return false; }
df3781ba-7c2d-44b0-b26f-1b70c8d03dd1
0
public static void updates(Year year)//update the events in the year and the displayed event { myYears.set(0, year); }
2c92128c-1494-4847-9647-c170914cf61d
4
public static boolean isFileClass(String file) { byte[] magicNumber = {(byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE}; try (FileInputStream input = new FileInputStream(file)) { byte[] number = new byte[4]; if (input.read(number) != -1){ if (Arrays.equals(ma...
97330a57-8972-44e6-ae16-997c55300148
7
protected ObjectFormatter getObjectFormatter(Field field) { Class type = field.getType(); if (List.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type)) { type = String.class; } if (field.isAnnotationPresent(Formatter.class)) { Formatter formatter = fi...
0b963e79-f58d-4ab1-a17f-9f91e8589825
0
public DuplicateEntryException(Exception e, String name) { super(e, name); }
5e731ecc-9055-476b-be1e-f07818008e48
3
public void openBraceNoIndent() { if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0) { print(currentLine.length() > 0 ? " {" : "{"); println(); } else { if (currentLine.length() > 0) println(); println("{"); } }
e1e12c20-9ae9-4eea-b918-483c15fc7f1a
6
protected void paintComponent(Graphics g) { g.drawImage(background, 0, 0, this.width, this.height, null); switch (pageId) { case MAINMENU: { resume.draw(g); save.draw(g); load.draw(g); options.draw(g); break; } case OPTIONSMENU: { audio.draw(g); video.draw(g); controls.draw(g);...
0d9bcb56-cb83-480d-ba7d-92a04cc9387d
3
public void readSensors() throws IOException{ try{ com.requestData(Communication.LATITUDE); com.requestData(Communication.LONGITUDE); com.requestData(Communication.HEADING); com.requestData(Communication.ABSOLUTE_WIND); com.requestData(Communication.OBSTACLES); com.readMessage(); }catch(Num...
8d2033a4-9a31-4198-aa57-79e774e02a59
7
@Override //SimpleEntry: NextHop, Distance public SimpleEntry<Byte, Byte> getRoute(Byte destination) throws RouteNotFoundException { lock.lock(); // TODO Respond whenever a route is requested. if(destination == this.deviceID) { lock.unlock(); return new SimpleEntry<Byte,Byte>((byte)1,(byte)0); } else...
f0b256f3-77bc-40ea-aa89-38f6d40dc77b
6
static public void stop() { setStopFlag(true); if (mp3 != null) mp3.stop(); mp3 = null; if (music != null) music.stop(); music = null; if (musicType.equals("midi")) { if (sequencer == null) return; if (sequencer.isRunning()) sequencer.stop(); if (sequencer.isOpen()) sequencer.clos...
82cb391c-f16a-4690-9241-e054cb3cd1b7
9
public List<ShopDataBean> getarticleList() throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; String sql = ""; List<ShopDataBean> articleList = null; ShopDataBean shopBean = null; try{ conn = getConnection(); sql = "select cou_name,count(*) from coupon"; ...
dc46d0c6-66cd-4656-9ece-151742ff7229
5
public static int getExpressionLocByPtg( Ptg ptg, Stack expression ) throws FormulaNotFoundException { for( int i = 0; i < expression.size(); i++ ) { Object o = expression.elementAt( i ); if( o == null ) { throw new FormulaNotFoundException( "Couldn't get Ptg at: " + ptg.toString() ); } if( o i...
969b7f9d-cc3f-4260-9038-609501b44129
2
public void control(Agent[] agents, Thing[] things) { MeView meV = new MeView(); meV.t = t; meV.vt = vt; meV.x = x; meV.y = y; meV.r = r; meV.a = a; meV.AMIN = AMIN; meV.AMAX = AMAX; meV.VTMIN = VTMIN; meV.VTMAX = VTMAX; meV...
52d8d87e-a400-4641-940b-ed8297e584f5
0
Precision(String fmt,String regex,int expectedStringLength) { this.formatter=new SimpleDateFormat(fmt); this.regex=regex; this.expectedStringLength=expectedStringLength; }
825bbe9c-0ded-4f8b-b6bd-138ecb820d85
9
public static void calculate(int x, int y) { Queue<Node> cola = new LinkedList<Node>(); cola.add(new Node(x, y, 0)); for (int i = 0; i < v.length; i++) { for (int j = 0; j < v[0].length; j++) { v[i][j] = false; } } v[x][y] = true; dp[x][y][x][y] = 0; while (!cola.isEmpty()) { Node actually...
7c3ca733-c22c-44b3-8e72-7ff38dd7a2df
9
private void cftfsub(int n, double[] a, int offa, int[] ip, int nw, double[] w) { if (n > 8) { if (n > 32) { cftf1st(n, a, offa, w, nw - (n >> 2)); if ((ConcurrencyUtils.getNumberOfThreads() > 1) && (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_2Threads())) { ...
69668756-a575-4513-8fa1-a75d2138d02e
7
private static void checkUIAvailable() { String checkUIStr = System.getProperty(CHECK_UI); //if not in nogui mode check for a visible window if (Boot.isHeadless() == false && (checkUIStr == null || checkUIStr.equals("true"))) { //We need to check for a UI. Create a Timer to Check f...
7b673fc6-7300-4cc0-8694-6b8dae8c3507
5
@Override public int doStartTag() throws JspException { try { JspWriter out = pageContext.getOut(); if (status == 0) { out.write("<option class='" + invalClass + "' value='" + value + "'>"); } else if(status == 1) { if (date != null) { ...
5262251a-2928-438b-828e-8de7ec215c39
8
private RealDistribution resolveDistribution(DistributionType d){ switch(d){ case BETA: return bettafishd; case NORMAL: return normald; case CAUCHY: return cauchyd; case CHISQUARED: return chid; case EXPO...
43c5d7af-ce69-4a87-b2f0-d09b42b42a10
9
private void getUpgrade(RobotController rc) { if(upgradeTwo){ if (this.upgrade==NUKE) { this.upgrade = VISION; } else { this.upgrade = NUKE; } } else { if(rc.hasUpgrade(PICKAXE)&&rc.hasUpgrade(DEFUSION)&&rc.hasUpgrade(FUSION...
beac4b11-f189-4dfe-9b57-83505be8a1ab
3
public void findAllPairsShortestPath() throws IOException { PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outputFileName))); PrintWriter log = new PrintWriter(new BufferedWriter(new FileWriter(logFileName))); for(Map.Entry<Character,Position> s : nodes.entrySet()) { for(Map.Entry<Ch...
bee21f76-c058-4c12-a9b2-92ab20de0798
2
public static Role findByName(String name) { for (Role role : values()) { if (name.equalsIgnoreCase(role.name())) { return role; } } return null; }
657e07c5-7896-4a19-ab9c-80de452fde36
4
@Override public boolean createTable(String query) { Statement statement = null; try { this.connection = this.open(); if (query.equals("") || query == null) { this.writeError("SQL query empty: createTable(" + query + ")", true); return false; } statement = connection.createStatement(); ...
ebb77519-1971-44e5-a0c7-b58f7ecba907
6
@Test public void testConvertToDataNode() throws FileNotFoundException { try { InputStream inputStream = new FileInputStream(new File("xml/example.xml")); NodeList nodes = source.getXMLNodes(inputStream); Node parent = nodes.item(0); NodeList realList = parent.getChildNodes(); for (int i = 0; i < rea...
dcc08f69-fc80-46e1-9d35-cfbe82f41c66
8
@Override public List<AdminCol> getColSrchList(String tblNm) { log.debug("get column search list for table = " + tblNm); Connection conn = null; PreparedStatement statement = null; ResultSet rs = null; ArrayList<AdminCol> list = new ArrayList<AdminCol>(); StringBuilder sql = new StringBuilder(); sql.a...
88afde44-d3a7-48af-b097-014344082b56
8
public boolean goToHunter(List ants) { Iterator<Ant> antsIterator = ants.iterator(); boolean advanceX, advanceY; int velocityY = 1, velocityX = 1; Ant target=null; while (antsIterator.hasNext()) { Ant ant = antsIterator.next(); if(target==null &&distance(this.getX_position(), ant.getX(), this.getY_posit...
1aa7c1e5-1c19-4cc2-9e9b-aa46922c380b
6
private void handleHttpRequest(ChannelHandlerContext ctx, FullHttpRequest req, String ip) { String uri = req.getUri(); FullHttpResponse resp = null; if (uri.equalsIgnoreCase(STATUS)) { ManagerDB.addOrUpdateRequestAmount(ip, dateFormat.format(new Date())); ServerStatus.add...
f3ab97af-c848-4faa-b140-8347315d1548
7
protected void print() { for (int i = 0; i < mLocalMem.size(); i++) { System.out.println("i: " + i); if (mLocalMem.get(i).getDescription() != null) { System.out.println(mLocalMem.get(i).getDescription()); } if (mLocalMem.get(i).getFromDateTime() != null) { System.out.println(mLocalMem.get(i).getFr...
50d23058-4789-4d15-8076-29a1f1671ce2
8
public int eventOnNoExplore(int noExploreCounter, int idealLeashLength, int randomNumber) throws ExploringControlException { double noExploreCounterD = (double) noExploreCounter; double minLeashLenght = 4; if (noExploreCounter < 0 || noExploreCounter > 10) { // test for good leashlenght ...
b505cd1b-a9f1-46d7-b28b-b8fbb83317b7
3
public AnimationField(Color bg, Animation init, String fieldTitle) { if (fieldTitle == null) { fieldTitle = ""; } if (init == null) { init = Animation.ORIGINAL; } if (bg == null) { bg = Color.WHITE; } create(bg, init, fieldTi...
200e1dc6-6d53-43b0-bf21-787b55c88aa3
7
public void draw(Graphics g) { int i; for (i = 0; i != 5; i++) { setVoltageColor(g, volts[i]); drawThickLine(g, ptEnds[i], ptCoil[i]); } for (i = 0; i != 4; i++) { if (i == 1) { continue; } setPowerColor(g, curre...
62617315-e830-45a1-8106-57faa1a87099
7
public static String getAppropriateCode(Environmental E, Environmental RorM, List classes, List list) { if(CMLib.flags().isCataloged(E)) return "CATALOG-"+E.Name(); else if(list.contains(E)) return ""+E; else if(((RorM instanceof Room)&&(((Room)RorM).isHere(E))) ||((RorM instanceof MOB)&&(((MOB)RorM)...
7b0dd558-acfc-4227-8b32-9da0ca0f7726
8
private boolean r_shortv() { int v_1; // (, line 49 // or, line 51 lab0: do { v_1 = limit - cursor; lab1: do { // (, line 50 if (!(out_grouping_...
8b3eacb7-5796-4f80-9d81-dc684657518a
0
public void setBirth(String birth) { Birth = birth; }
9c496cff-5ea2-4710-aac8-0ed2b0d153d1
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS-ARE>...
ed61d136-8d75-4614-89c7-f7bd9f1716ab
1
protected void prepareCanvas(int[] bits){ for(int i = 0; i < bits.length; i++){ bits[i] = GUIStandarts.backgroundColor; } }
2f3ea638-0b00-4b07-9f85-3514e2ad8df1
6
private String _smsc_read_url(String url) { String line = "", real_url = url; String[] param = {}; boolean is_post = (SMSC_POST || url.length() > 2000); if (is_post) { param = url.split("\\?",2); real_url = param[0]; } try { URL u = ...
c45e6ed1-58aa-405f-b8db-b563bed9b4bc
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Settings)) { return false; } Settings other = (Settings) object; if ((this.id == null && other.id != null) || (...
73e82396-8bba-4fab-b872-9f822a27b3f4
4
private void seriesTableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_seriesTableKeyPressed Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "seriesTableKeyPressed"); if (evt.getKeyCode() == KeyEvent.VK_TAB) { evt.consume(); alb...
0966e7f6-d5a3-4d16-b864-5e7c22ab04e5
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...
126d57ac-b295-480e-8dd7-ecd8fc03ec6d
4
@Override public void deserialize(Buffer buf) { presetId = buf.readByte(); if (presetId < 0) throw new RuntimeException("Forbidden value on presetId = " + presetId + ", it doesn't respect the following condition : presetId < 0"); position = buf.readUByte(); if (position <...
b6c782f4-4a64-4450-afc8-fd0d53f129c1
9
@Override public synchronized void finalize() { try { try { closeDocument(); } catch (RemoteException ex) { /* Nothing */ } catch (FileNotFoundException ex) { /* Nothing */ } catch (MalformedURLException e) { ...
720dea58-602d-4c4b-b465-f0fab72bf60c
1
public void setInsets(Insets insets) { if (insets != null) { mInsets.set(insets.top, insets.left, insets.bottom, insets.right); } else { mInsets.set(0, 0, 0, 0); } }
65c83f96-250d-4783-a32f-f9ae3b6933d5
2
public String eqMember(String membername, String desc, int index) { MemberrefInfo minfo = (MemberrefInfo)getItem(index); NameAndTypeInfo ntinfo = (NameAndTypeInfo)getItem(minfo.nameAndTypeIndex); if (getUtf8Info(ntinfo.memberName).equals(membername) && getUtf8Info(nti...
fccc9017-cc01-4082-9d22-8540c31fbde0
7
public boolean move(double newBearing) { // if the newBearing is -1, then leave it on the ground if ((bearing == -1 && newBearing == -1)) return true; // see if it's a legal move if (!isLegalMove(newBearing)) { return false; } // this allows bearing to be equal to 360, in which case we treat it ...
74d7fe8a-cd61-4e5b-b674-e309f2990bde
9
private void readLuminance() { int type = sourceImage.getType(); if (type == BufferedImage.TYPE_INT_RGB || type == BufferedImage.TYPE_INT_ARGB) { int[] pixels = (int[]) sourceImage.getData().getDataElements(0, 0, width, height, null); for (int i = 0; i < picsize; i++) { int p = pixels[i]; int r ...
fed18e3e-0106-4910-98c3-7d72578b29b4
7
public static boolean isPowerProviderOrWire(IBlockAccess par0IBlockAccess, int par1, int par2, int par3, int par4) { int var5 = par0IBlockAccess.getBlockId(par1, par2, par3); if (var5 == Block.redstoneWire.blockID) { return true; } else if (var5 == 0) { ...
5ae1a20e-ba36-46b3-b2e8-eac1ad599a56
9
public int IndexOfByKMP(String q, String D) { int m = q.length(); int n = D.length(); // get special cases out of the way if (m == 0) { return 0; } if (m > n) { return -1; } LongestEquifix equiSolver = new LongestEquifix(); // E[i] holds the length of the longes...
449fb21e-a5ab-4ee8-9474-1bde4a7b0d38
9
public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = new String(); int i; i = sc.nextInt(); while (i > 0) { str = sc.next(); String rnp = new String(); int len = str.length(); Stack<Character> stk = new Stack<Character>(); char c; for (int k = 0; k...
1681d1b5-1560-40c4-bb07-f5baf2e06217
3
public final void currVote() { Date today = new Date(); Calendar cal = new GregorianCalendar(); cal.setTime(today); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 1); List<VoteData>...
d19123b9-8d66-4cbb-9137-1ef66797b72a
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...
8861b6e0-7730-4f2a-babf-911e6d3ebb3e
2
public boolean addRecord(Record record){ for(Record r:table){ if(r.getUsername().compareToIgnoreCase(record.getUsername())==0){ return false; } } return table.add(record); }
8dab17c7-ba5a-448f-a713-79a6b8236867
3
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } String[] list = null; try { list = plugin.getUtilities().getWarpList(sender); } catch (SQLException e) { e.pri...
49b69c8e-e46f-4cf0-a104-2dae00ec3093
9
public void splash(GraphicsEngine g) throws JavaLayerException{ StdDraw.setXscale(0.0, 610); //Set scale to 500 StdDraw.setYscale(0.0, 610); //Set scale to 500 while(true){ String file = "splash/splashscreen.jpg"; //String shoot = "Portal2_sfx_portal_gun_fire_blue.mp3"; FileInputStream welcome = null; ...
8c297532-f5ea-442d-8a83-059e9edb3473
5
@Override protected void loopImpl(ServerSocket listener) throws Exception { Socket socket = null; try { socket = listener.accept(); } catch(SocketTimeoutException e) { // No-Op } try { if(socket != null) { logger.info("Socket recieved."); InputStream iStream = socket.getInputStream();...
43f389a3-4b53-4653-9bd8-3ff1a117d592
4
public SubProcess getNextSubProcess(State state) { if (state == null) return null; reSortSubProcesses(); SubProcess sp = state.getSubProcess(); if (sp == null || !this.subProcesses.contains(sp) || this.subProcesses.indexOf(sp) >= this.subProcesses.size() - 1) return null; return this.subProcesses.get(...
844eee73-e2c8-4024-9eab-b29df1102141
5
public ProfileEntry checkAvailability(int reqPE, double startTime, long duration) { Iterator<ProfileEntry> it = avail.itValuesFromPrec(startTime); if (!it.hasNext()) { return null; } PERangeList intersec = it.next().getAvailRanges().clone(); double finishTime = startTime + duration; ...
ac77f5ee-5eaf-42c1-a509-9e5d1f21d2dc
6
private static String myCrypt(String password, String seed) throws RuntimeException { String out = null; int count = 8; MessageDigest digester; // Check for correct Seed if (!seed.substring(0, 3).equals("$H$")) { // Oh noes! Generate a seed and continue. byte[] randomBytes = new byte[6]; java.util.R...
d47cbb4b-b0c9-4c5b-b1c0-072c963302dd
4
@Override public boolean equals(Object o) { if (o == null) { // fast fail return false; } if ((o == this) || (o == payload)) { // fast success return true; } if (!(o instanceof CachedValue)) { // cope with non-cached values return o.equals(payload); } return ((CachedValue...
07a8dda0-f66e-4c19-b2cd-b38ef57c95bc
8
private void checkForPrompt() { // Text has been entered, remove the prompt if (document.getLength() > 0) { setVisible( false ); return; } // Prompt has already been shown once, remove it if (showPromptOnce && focusLost > 0) { ...
70e74006-b725-4210-8064-9b4e5dfa688a
6
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Ball other = (Ball) obj; if (this.color != other.color) { return false; } if (this.coords != other.coor...
b6b710e4-7229-475c-9882-202c2e833b85
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
9b1d879f-a37e-476e-aa07-a69c366560fa
9
public final List<Answer> getAnswers() { final Random rand = new Random(); final Answer[] ans = new Answer[this.answers.length]; boolean hasBottom = false; for (final Answer a : this.answers) { if (a.dispStr.equals(Card_Question.BOTTOM_ANSWER)) { hasBottom = true; } } for (final Answer a :...
8649cf94-2038-4868-a527-a969437c4c0f
1
public void provideCapacity(final int capacity) { if (c.length >= capacity) { return; } int newcapacity = ((capacity * 3) >> 1) + 1; char[] newc = new char[newcapacity]; System.arraycopy(c, 0, newc, 0, length); c = newc; }
6c7e7bad-e3e7-4162-883b-b8d096508ffe
6
public void init() { boolean debug = CommandLine.booleanVariable("debug"); if (debug) { // Enable debug logging Logger logger = Logger.getLogger("com.reuters.rfa"); logger.setLevel(Level.FINE); Handler[] handlers = logger.getHandlers(); ...
bda71798-54ee-46ac-b2df-d7d73b44522d
7
protected String unFilterString(String str) { final StringBuffer buf=new StringBuffer(str); for(int i=0;i<buf.length()-1;i++) if(buf.charAt(i)=='\\') switch(buf.charAt(i+1)) { case '\\': buf.deleteCharAt(i); break; case 't': buf.deleteCharAt(i); buf.setCharAt(i,'\t'); break; ca...
28896772-33ee-442a-8fa6-9555ff5e4172
3
public boolean jsFunction_waitStartProgress(int timeout) { deprecated(); int curr = 0; if(timeout == 0) timeout = 10000; while(!JSBotUtils.hourGlass) { if(curr > timeout) return false; Sleep(25); curr += 25; } return true; }
c8d92f75-7bf5-423d-816f-bb45e8606044
8
public List<User> getInitialUserForSecondActivityCluster(List<FirstActivityCluster> facList, List<SleepingCluster> scList, List<User> allUserList) { List<User> returnUserList = new ArrayList<>(); for (SleepingCluster sc : scList) { for (User user : allUserList) { ...
4cff2681-4e3b-4548-9ab6-eeba40989266
8
public SudokuGame(){ File f = new File("Sudoku.sudoku"); Scanner sc = null; try{ sc = new Scanner(f); } catch (FileNotFoundException e){ e.printStackTrace(); System.out.println("File doesn't exist"); System.exit(1); } Color c = Color.BLACK; for (int i=0;i<9;i++){ for (int j=0;j<9;j++){ ...
bf87f512-7adb-4be1-acdb-88fb2091f1c9
9
private void generateSongStructure(File songsDirectory) { songList.getItems().clear(); for(File songFolder : songsDirectory.listFiles()) { //Check that only directories are processed if(songFolder.isDirectory() || songFolder.listFiles() == null) { if(!songFolder.can...
a70016a8-2270-47f2-97b4-b33da85542f7
8
private void computeNext() { int i = k - 1; int j = k; // find smallest j > k - 1 where a[j] > a[k - 1] while (j < n && a[i] >= a[j]) { ++j; } if (j < n) { swap(i, j); } else { reverseRightOf(i); // i = (k - 1) - 1 ...
3acc34b9-f172-4ed7-aa3a-cbb1847feb70
5
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (axis == Axis.X_AXIS) { int height = getIconHeight(); for (Icon icon : icons) { int iconY = getOffset(height, icon.getIconHeight(), alignmentY); icon.paintIcon(c, g, x, y + iconY); x += icon.getIconWid...
0e9ccbb8-a2ef-4bc7-bbc9-04d3f5ceb21d
5
public GnuNeutron (String computer_algorithme) { autodisplay = true; display = 1; computerColour = NeutronBoard.BLACK; playerName = ""; ponder = true; nb = new NeutronBoard (); if (computer_algorithme.equals("random")) { cp = new ComputerPlayerRandom (); } else if (compute...
cf1f5a2f-e33a-4853-8275-7d269c356779
9
private void doPrint(String aInText, Throwable aInT) { switch (this) { case WARN: case ERROR: case DEATH: if (null == stream) { System.err.println(aInText); if (null != aInT) ...
9d01d643-d1f6-41cc-81b6-b18ca70af9e4
4
public void resetPlplayer() { start = false; if (P1character.equals("White")) { whiteKnight.reset(100,450,true); } else if (P1character.equals("Bond")) { jamesBond.reset(100,450,true); } else if (P1character.equals("Ninja")) ...
a1661c84-763c-4a1a-9355-b4cda6ed5b22
8
public Song(String filePath) { measures = new ArrayList<Measure>(); titleCards = new ArrayList<String>(); try { BufferedReader in = new BufferedReader(new FileReader(filePath)); String line = null; while ((line = in.readLine()) != null) { if (line.length() > 0) { switch(line.charAt(0)) {...
35e0fbf3-1464-4969-8fbe-aadf4de7e3ac
4
public int getMove(int place1,int place2) { if (System.currentTimeMillis() - c.lastSpear < 4000) return 0; if ((place1 - place2) == 0) { return 0; } else if ((place1 - place2) < 0) { return 1; } else if ((place1 - place2) > 0) { return -1; } return 0; }