method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fd53050d-f952-46a8-a0bd-e0071d73dcc2
0
public int getValue(){ return value; }
326e2c27-ac3c-453b-968c-b69554fae476
5
private static Field getField(Object instance, Class<?> clazz, String fieldName) { if (clazz == null) clazz = instance.getClass(); // Ignore access rules for (Field field : clazz.getDeclaredFields()) { if (field.getName().equals(fieldName)) { field.setAcc...
f912375a-4a1a-41a5-8904-566c0eb92869
1
public void pushStack() { Item item = new Item(); if (stack.isEmpty()) { result = item; } else { stack.getLast().getList().add(item); } stack.add(item); }
5a18616d-b32d-4f2d-97b5-196d51a3f0f2
9
@Override public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info, XYPlot plot, ValueAxis domainAxis, ValueAxis ra...
8d99ef1f-bd79-4a83-8f24-f48254af863f
9
private Node<K, V> higherAll( V value ) { if( value == null ) { return null; } Node<K, V> node = mAllRoot; Node<K, V> ret = null; if( mValueComparator != null ) { Comparator<? super V> comp = mValueComparator; while( node != null ) { int c = co...
dbc41e0a-8114-444e-b010-6e7a0a5f7170
9
private void init(File file) throws IOException, CiraException { CSVReader reader = null; lineNum = 1; sdf = prepSdf("yyyy-MM-dd HH:mm:ss"); try { reader = new CSVReader(new FileReader(file)); items = new ArrayList<CiraRec>(); totalAmount = new BigDecimal(0); ...
c220b4aa-c86e-489c-9f01-fa64663eb942
5
private boolean checkForCheckmate(int colorOfKingPotentiallyDefeated) { //if at least one piece in that color has a possible move there is no checkmate for (int column = 0; column < 8; column++) { for (int row = 0; row < 8; row++) { if (pieces[column][row] != null ...
8169bab5-2919-49d6-bd11-fece47b97674
5
static void AuxillaryMergeSort(int[] A, int[]B, int p, int r) { if (p < r) { if((r-p)>11){ int q = p + ((r-p)>>1);// Get the medium element by shifting AuxillaryMergeSort(A, B, p, q); AuxillaryMergeSort(A, B, q+1, r); AuxillaryMerge(A, B, p, q, r); } el...
e9d34447-ae27-4be8-adc0-bcd74f97c2ab
1
public static List<FileType.TagConfig> getTagsByFile(File f) { FileType ft=fileTypes.get(MediaFileUtil.getFileExtension(f).toLowerCase()); if(ft==null) return null; return ft.tagInfo; }
6b2c836f-04bf-467d-bb57-2a0552327ada
3
private By decrementLocator(By locator){ for (Field field : locator.getClass().getDeclaredFields()) { field.setAccessible(true); try { String strLocator = (String)field.get(locator); field.set(locator,strLocator.substring(0, strLocator.length()-1)); } catch (IllegalArgumentException...
dcd4ad47-0bda-44d2-8dca-5037df6d8ed5
8
private Object getDataMeaning(CIMClassProperty property) { CIMQualifier[] qualifiers = property.getQualifiers(); String[] mapKeys = null; String[] mapValues = null; for (int j = 0; j < qualifiers.length; j++) { CIMQualifier q = qualifiers[j]; if (q.getName().toLow...
cddd48de-aadd-41d9-a27c-dabfe9dbdc86
9
protected void writeChildren(XMLStreamWriter out, Player player, boolean showAll, boolean toSavedGame) throws XMLStreamException { if (showAll || toSavedGame || player.owns(this)) { for (ExportData data : exportData.values()) { data.toXML(out)...
05fc22ae-9ead-4fa0-b639-528d09742eea
4
private void drawUI() { /** Serveur informations **/ top = new JPanel(); top.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 15)); top.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); serverLabel = new JLabel("IP du serveur : "); serverInput = new JTextField("...
71971bb7-81fc-436b-84c8-6d0b17c237aa
4
public void addItem(Item item) { boolean added = false; if(item.isStackable()) { for(Item i : items) { if(i.equals(item)) { i.addQuantity(item.getQuantity()); added = true; break; } } } if(!added) { items.add(item); } dirty = true; }
3b4b8f83-7ec7-4817-9540-f103d0b0fa9c
6
@Override public boolean isValid(GObject target, Context context) { Rectangle2D box = target.getTransformedBoundingShape().getBounds2D(); GObject parent = target.getParent(); if (parent == null) { return false; } boolean verticalInvalid = validateVertical && (box.getY() < 0 || box.getY() + box.getHeig...
5e6e71b6-3b2c-4bc2-9415-3ea515ce7663
6
public double getRatingForItem(int itemId) { int beginIndex = 0, halfIndex, endIndex = itemIds.length; if(itemIds.length > 0) { while(true){ halfIndex = (endIndex - beginIndex) / 2 + beginIndex; if(itemId < itemIds[halfIndex]){ if(endIndex - beginIndex <= 1){ return -1.0; } endIndex ...
569fef25-2d2c-4665-9c97-2c09c8a7b732
9
public void propertyChange(PropertyChangeEvent ev) { if (!isEditing() || (getClientProperty("terminateEditOnFocusLost") != Boolean.TRUE)) { //NOI18N return; } Component c = focusManager.getPermanentFocusOwner(); while (c != null) { if ...
654cdf71-600e-4c84-8296-57655f727c12
3
public void tacle_load() { DefaultTableModel dftt1 = (DefaultTableModel) jTable1.getModel(); dftt1.setRowCount(0); try { ResultSet rs = DB.myConnection().createStatement().executeQuery("select * from members "); while (rs.next()) { Vector v2 = new Ve...
d5347443-d659-4a08-89bb-ea3a193a8d91
7
private boolean r_Step_1c() { int v_1; int v_2; // (, line 93 // [, line 94 ket = cursor; // or, line 94 lab0: do { v_1 = limit - cursor; lab1: do { // literal, line 94 if (!(eq_s_b(1, "y"))) { break lab1; } break lab0; } while (false); cursor = limit - v_1; // literal,...
48cc4896-68c4-4ea3-90fb-457cad84171a
2
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; if(list != null && list.size() > 0){ g2d.setColor(getBackground()); g2d.fillRect(0, 0, getWidth(), getHeight()); n = 1; output = drawSegments(g2d, list); } }
9ec52f8f-1879-4d51-b7fe-9f006542e42f
9
public static int validateItemToBuy(Collection<ItemToBuy> itemsToBuy) { Iterator<ItemToBuy> iteratorItemToBuy = itemsToBuy.iterator(); while (iteratorItemToBuy.hasNext()) { ItemToBuy itemToBuy = iteratorItemToBuy.next(); Integer id = itemToBuy.getId(); String name = itemToBuy.getName(); String amount =...
f3b29745-f577-4926-96d3-602f1785a680
4
public int executeQuery(String query) { //System.out.println("Result SET QUERY"); int id = 0; //System.out.println("MySQL DAO executeResultSet"); // --- 3) prepare and execute statement stmt = null; // SQL statement object rset = null; // statement result set object // get resultset //...
d9c0b96f-46f1-4fbe-8dd9-5a58972e3b51
3
public void run() { try { Socket socket = _ss.accept(); socket.setSoTimeout(60000); BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); BufferedWriter writer = new Buf...
097e1711-4d59-4627-b15a-6cf2b9efded6
3
synchronized void setChunkOpDone(int x, int z, int op) { chunks[x][z].opsDone[op] = true; for (int xx = x - 2; xx <= x + 2; xx++) for (int zz = z - 2; zz <= z + 2; zz++) if (canDoOpToChunk(xx, zz, op + 1)) scheduleChunkForOp(xx, zz, op + 1); }
ff0d2b63-ad81-4f18-b8ed-18e3f8a51a23
3
@Override public void stateChanged(ChangeEvent ce) { //if for some reason the object which changed state is not a subclass of //of Component, do nothing as this code only handles Components if (!(ce.getSource() instanceof Component)) { return; } //cast the object to a Com...
629f23e4-3988-4322-9ac2-48dd4f6c8033
4
@Override public boolean equals(Object o) { if (o instanceof Vector3f) { Vector3f b = (Vector3f) o; if (x == b.x && y == b.y && z == b.z) { return true; } } return false; }
bb357330-0d19-49b4-85bf-ebfbddfc530e
8
public static void main(String[] args) { Settings settings = loadSettings(); if (args.length > 0) { if (args[0].equals("nogui")) { if (args.length == 2 && args[1].equals("notifications")) { noGui(settings, true); } else { ...
7147c8d8-11d6-4d38-8013-2f3ff7bdaebb
7
public void mobs(MOB mob, List<String> commands) throws IOException { if(commands.size()<3) { mob.tell(L("You have failed to specify the proper fields.\n\rThe format is CREATE MOB [MOB NAME]\n\r")); mob.location().showOthers(mob,null,CMMsg.MSG_OK_ACTION,L("<S-NAME> flub(s) a powerful spell.")); return; ...
c25f121c-af3c-49ae-99bf-2cb4ee195e35
7
@Override public InitialContextFactory createInitialContextFactory(Hashtable<?, ?> environment) throws NamingException { return new InitialContextFactory() { @Override public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException { for (Map.Entr...
45b1f0b3-9b9a-41cc-9b93-c64c1c3dd560
7
public Boolean hasPathSum(TreeNode root, int sum){ if(root.value==sum){ return true; } if(root.value>sum){ return hasPathSum(root.left, sum) || hasPathSum(root.right, sum); } if(root.value<sum){ return hasPathSum(root.left, sum - root.value) || h...
688609ae-b447-43bd-9b6f-372a68fdff6f
8
public void remove(final String name) { try { //Construct the new file that will later be renamed to the original filename. File tempFile = new File(file.getAbsolutePath() + ".tmp"); BufferedReader br = new BufferedReader(new FileReader(file)); PrintWriter pw = ne...
5b0f5c0c-2899-476c-8e7a-069706e14766
6
protected void calcAttraction() { // Check the neighbours of each vertex and calculate the attractive // force of the edge connecting them for (int i = 0; i < vertexArray.length; i++) { for (int k = 0; k < neighbours[i].length; k++) { // Get the index of the othe cell in the vertex array int j = ...
3610779d-7963-4500-a2a5-85070521a938
3
public void configureMainPanel(TestInfo testInfo) { boolean isRunning = (testInfo != null && testInfo.getStatus() == TestStatus.Running); if (testInfo != null) { testNameArea.setText(testInfo.getName()); testIdArea.setText(testInfo.getId()); createNewButton.setEnable...
ee0f50cd-4fcb-44ea-9e84-b32575d958dd
9
public void addSettingConstraintsInfo(String key, String type, String name, String description, String defaultValue) throws MdException { SettingConstraintsInfo sci = new SettingConstraintsInfo(); sci.setType(type); sci.setKey(key); sci.setName(name); sci.setDescription(description); sci.setDefaultValue(def...
110b2d13-9a3d-49f1-b0ce-7092e15db0c2
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...
76115986-f0c0-4109-9919-314b5dee77fc
5
public void createTreeRoot(Node n) { Node root = n.getFirstChild(); while(root != null) { if(root.getNodeType() == Node.ELEMENT_NODE) { ResearchItem rootItem = allResearch.get(root.getAttributes().item(0).getNodeValue()); treeRoots.add(rootItem); ...
922b9174-91a9-4bcf-8204-7c50e2e26e84
4
public String echo(String input)throws java.rmi.RemoteException { connect(); if (echoSocket != null && os != null && is != null) { try { os.println(input); os.flush(); output= is.readLine(); } catch (IOException e) { System.err.println("I/O failed in reading/...
9ed0f884-b56c-4cfd-905c-bed0f3bbed72
5
@Override protected void onJoin(String channel, String sender, String login, String hostname) { super.onJoin(channel, sender, login, hostname); int targettab = 0; int i = 0; while(true) { try { if(Main.gui.tabs.get(i).title.equalsIgnoreCase(channel) || Main.gui.tabs.get(i).title.substring(1).equal...
6dbf7d1a-7f26-491e-8ef8-7e91e5104727
5
@Override public void caseAGetlengthExp(AGetlengthExp node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(ArrayLength"); inAGetlengthExp(node); if(node.getHexp() != null) { node.getHexp().apply(this); } ...
a428c2ba-9c95-40b5-8bed-c3d367f1d9f5
8
public static void main(String[] args){ //testSuite(); //if (true) return; //http://www.spellensite.nl/spellen-spelen.php?type=spellen&spellen=Tower+blaster&id=1291 /** * TESTING NEEDED: * - AI BUGS * - Casandra * - TD BUGS */ //* //SETTINGS int rack_size = 10, //rack size st...
b22f9cfa-d7d9-47e9-8a88-e89421c18ff3
6
public ResultSet preencherTabelaATividadePesquisadasGESTAO(String NomeAtividade, String codDepartamento) throws SQLException { Connection conexao = null; PreparedStatement comando = null; ResultSet resultado = null; try { conexao = BancoDadosUtil.getConnection(); ...
2cdeeb14-1e6a-4be7-8aae-4604501b5726
0
public Move(int x, int y, int x_2, int y_2) { x1 = x; y1 = y; x2 = x_2; y2 = y_2; }
5ec4b65b-fbce-4047-b4f9-a61b84250d44
4
public boolean collision(int x, int y, int a, int b, int w, int h){ boolean up=(y-b)<h; boolean down=(y-b)>0; boolean left=(x-a)<w; boolean right=(x-a)>0; if(left&&right&&up&&down){ return true; } return false; }
c48c32e0-ee40-43f0-a727-e552431f6e2f
9
@Override public void readInternal(Environment env) throws IOException, TypeException { readChar(env); if (!(env.peek() instanceof VChar)) { return; } int c = ((VChar)env.peek()).getChar(); if (c == -1) { env.pop(); env.pushError("Unexpected EOF"); return; } char ch = (char)c; IVal...
1c6c894c-1d98-44f8-9755-da2d560560de
1
private void putScore(final String score) { if (!score.equals("Счет не ведется")) { prefs.putScore(Integer.parseInt(score)); } }
173036e5-8277-4f35-b2c6-a6fae5d12f5d
3
public void extractNgramsFromAnnotation(Annotation annotation, JCas aJCas) { AnnotationIndex<Annotation> tokens = aJCas.getAnnotationIndex(Token.type); Iterator<Annotation> tIterator = tokens.subiterator(annotation); Annotation token = null; Annotation prev = null; Annotation prev_prev = null; ...
9e855d55-3295-4fe1-b3fb-98988c454650
5
public static int inputArticleID(int defaultArticleID) { int id = -1; String input = ""; do { System.out.print("Geben Sie die ID des gewuenschten Artikels ein (0-" + (Assortment.getSize() - 1) + ")[" + defaultArticleID + "]: "); BufferedReader br = new BufferedReader(new InputStreamReader(System.in));...
10e20bbb-6718-4d24-92c4-e2a1f69b1daa
9
String read(int id, Point3f position) { if (id < 0 || id >= moleculeMap.size()) return null; if (reader == null) reader = new MoleculeReader(model); int n0 = model.getAtomCount(); reader.read(getClass().getResource("resources/" + moleculeMap.get(moleculeMap.keySet().toArray()[id]))); int n1 = model.getA...
64097378-7ddb-465f-a6bc-cf883099761f
9
private ArrayList<Meld> getRelatedSets(ArrayList<Tile> originalTiles, ArrayList<Meld> board){ ArrayList<Meld> adjacentSets; ArrayList<Tile> adjacentTiles; Integer[] numAdjacent; int indexOfMostMatches, maximumMatches; boolean addedTiles; adjacentSets = new ArrayList<Meld>(); adjacentTiles = new ArrayLi...
48108329-aa0a-45ba-971c-7d31c1cacd08
0
public SelectIterator(Iterable<T> source, Selector<T, TResult> selector) { this._source = source.iterator(); this._selector = selector; }
4d2402f0-db0a-435f-9216-8f4df348b1b4
2
public void updateSelected() { Selection selected = selection.getSelected(); switch( selected ){ case PRIMARY: label.getLabel().setBackground( selectedPrimary ); break; case SECONDARY: label.getLabel().setBackground( selectedSecondary ); break; default: label.getLabel().setBackground( b...
0d9e11cb-7f4c-4fc1-b9ba-fd7b64b79b95
9
private int jjMoveStringLiteralDfa7_0(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0); return 7; } switch(curChar) { case 67: ...
24c08096-eb96-400d-8515-4fe5090e1cd4
4
public float RetrieveBankAccountBalance(String bankName) throws SQLException{ String temp; float amount = 0; try{ databaseConnector=myConnector.getConnection(); stmnt=(Statement) databaseConnector.createStatement(); ...
4282b860-e719-47ac-8936-f2847971e4e1
0
public JobSchedulerBuilder withTrigger(Trigger trigger) { this.trigger = trigger; return this; }
5b36fbf7-d1a6-46c7-8a7a-629811b7a747
8
private void setNewConf(Configuration conf) { finishedConf = job.getJobConfiguration(); newConf = finishedConf.copyConfiguration(); isXmxChanged = false; isXmsChanged = false; isSplitSizeChanged = false; isMapperConfChanged = false; isReducerConfChanged = false; // judge whether mapper and reducer...
5fc2f2f2-3774-4515-a50a-46f62313eacc
1
@Override public void handleEvent(Event event) { if (event.getType() == EventType.END_GAME) { showMessage("Game ended!", "The game has ended! " + event.getOriginator().toString() + " has won!"); askForNewGame(); } }
d0e7377f-a315-46bb-81ee-f32fbab7ee72
3
public char nextClean() throws JSONException { for (; ; ) { char c = this.next(); if (c == 0 || c > ' ') { return c; } } }
066a8abc-2bdf-42ea-a444-ba89c2c6a75f
6
private Double calculateAssociativeComponent(int tag, Map<Integer, Double> destinationTags, boolean destCount) { SparseVector vec = this.coocurenceMatrix.get(tag); double associativeValue = 0.0; int numbAssociatedNodes = 0; for (Map.Entry<Integer, Double> destinationTag : destinationTags.entrySet()) { Double...
dfff04ad-69bc-49aa-ac1e-942b5bf8d0d3
8
public void actionPerformed(ActionEvent event) { if(event.getActionCommand().equals("Log Off")) SystemInit.setLogInScreen(); else if(event.getActionCommand().equals("Delete All")) ReceiptPanel.clearReceipt(); else if(event.getActionCommand().equals("Delete Line")) ReceiptPanel.deleteItem(); else if(ev...
f7d7daa2-35b5-486d-9f2a-1d735178b7c4
4
private void buildCheckConnection(){ checkConnection = new Thread(new Runnable(){ public void run(){ while(true){ try { if(serverConnected != null) serverConnected.getName(); } catch (RemoteException e) { gui.addLogArea("Persa connessione con " + getServerName() + "\n"); serv...
3607cdd1-05da-4147-b899-e30be11935bb
3
public static String concatenateUsingStringJoin(String[] stringArray, String delimiter) { if (delimiter == null || stringArray == null || stringArray.length == 0) { return null; } return String.join(delimiter, stringArray); }
286ff047-4ad4-4a71-982c-2a9a65981911
9
public void actionPerformed(ActionEvent actionEvent) { String actionCommand = actionEvent.getActionCommand(); if(actionCommand.equals("Quit")){ System.exit(0); } else if (actionCommand.equals("New Class")){ this.diagramPanel.addClass(); } else if (actionCommand.equals("Add Link")){ this.dia...
1aebef23-6153-460d-ba73-45ec3e080dc8
2
public CtBehavior[] getDeclaredBehaviors() { CtMember.Cache memCache = getMembers(); CtMember cons = memCache.consHead(); CtMember consTail = memCache.lastCons(); int cnum = CtMember.Cache.count(cons, consTail); CtMember mth = memCache.methodHead(); CtMember mthTail = mem...
99e5f25e-1c10-4a80-a35c-a0759a5eeac3
0
private static void init() { //init command = new String(); stillPlaying = true; //items Items item0 = new Items(); item0.setItemName("Water"); item0.setDesc("--Will you take some water?"); Items item1 = new Items(); ...
512d2446-a7d7-4414-a8d7-02a13df410a2
6
public static Cons walkSlotValueTree(Cons tree, Object [] MV_returnarray) { { Stella_Object objectref = null; StandardObject objecttype = null; { Object [] caller_MV_returnarray = new Object[1]; objectref = Stella_Object.walkATree(tree.rest.value, caller_MV_returnarray); objecttype = (...
fa143071-9c1a-488e-9864-e98c6efb0d1d
4
private static BufferedImage transparant(BufferedImage src) { BufferedImage work = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_ARGB); for (int i = 0; i < src.getWidth(); i++) { for (int j = 0; j <src.getHeight(); j++) { if (src.getRGB(i,...
436020fd-258d-4ad5-8dd6-7fb18ca2eb07
7
public static boolean insertDept(String depName, String description) { ResultSet rs=null; Connection con=null; PreparedStatement ps=null; boolean result=true; try{ String sql="INSERT INTO department(deptName, description) VALUES (?, ?)"; con=ConnectionPool.getConnectionFromPool(); ps=con.prepareStat...
53e8d3bb-0726-4c29-bb21-35731af3dafd
9
public void findTilesAndBoard(ArrayList<char[]> inList) { this.in = new char[inList.size()][]; for (int i = inList.size(); i-- > 0;) in[i] = inList.get(i); RawTile raw; ArrayList<RawTile> rawTiles = new ArrayList<RawTile>(); for (int j = 0; j < in.length; j++) { for (int i = 0; i < in[j].length; i++) {...
a7ea2012-a742-4533-bbe4-ed5593a7ca6c
2
@Override public int hashCode() { int hash = super.hashCode() + 7; hash += clazz.hashCode() + (isSetValue() ? value.hashCode() : 0); hash += (defaultValue != null ? defaultValue.hashCode() : 0); return hash; }
1ff8b605-b744-42bb-9803-972db50a720a
6
public String ParseCommand(String s) throws InterruptedException { String answer = ""; Match m; if(s.startsWith(Commands.GET_LIST_MATCH.toString())) { s = s.substring(Commands.GET_LIST_MATCH.toString().length()); answer = "ListMatch|" + ListeDesMatchs.getListeDesMatchs().ToJson(); } else if (s....
95fc6342-b317-4d87-ac86-008c79cf3198
2
private synchronized void resetTask(long newTime) { disableScoreboard(); if(task != null) getServer().getScheduler().cancelTask(taskId); task = new ServerRestartTask(this, newTime); for(Action action : defaultActions) task.register(action); taskId = getServer().getScheduler().scheduleSyncRepeatingTask(t...
a47c491b-bc62-4df6-8fc2-d63ed051a76d
5
public boolean connectAcutionDB() { try { Class.forName(driver).newInstance(); } catch (ClassNotFoundException cnfe) { System.err.println("\nUnable to load the JDBC driver " + driver); System.err.println("Please check your CLASSPATH."); cnfe.printStackTrace(System.err); } catch (InstantiationException...
416168c9-2146-453d-941e-c06f3e3fa86f
9
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
93bafefd-8be3-427d-acee-f20651960aa1
3
public static void update(int delta) { beatCount++; if (beatCount % 4 == 0) getNextPrimary(ColorType.PLAYER); if (beatCount % 4 == 0) { getRandomPrimary(ColorType.WALL); if (colorRandom.nextInt(3) == 0) setColor(ColorType.SLOW_WALL, getColor(ColorType.PLAYER)); else setColor(ColorType.SLOW_W...
26c0222d-9a8f-4e8e-908d-bf0bd9ad614f
3
public Long nextBroadcast(String world) { long nextBroadcast = 0; if(dL.isItPvPTime(world)) { // Check how long until pvp is over. if(Bukkit.getWorld(world).getTime() > Long.parseLong(getValue(pvpWorlds,world,"endTime").toString())) { nextBroadcast = 24000 - Bukki...
9f7b4ea7-7e4f-4c60-b9f1-af8ea6916ddf
8
public void start() throws IOException { myServerSocket = new ServerSocket(); myServerSocket.bind((hostname != null) ? new InetSocketAddress(hostname, myPort) : new InetSocketAddress(myPort)); myThread = new Thread(new Runnable() { @Override public void run() { ...
fef12a5f-c022-46c7-94f5-a43d34f36422
6
static final Class142_Sub27_Sub6 method131(byte byte0) { if (byte0 > -40) { return null; } if (Class26.aNodeChildList_471 == null) { return null; } for (Class142_Sub27_Sub6 class142_sub27_sub6 = (Class142_Sub27_Sub6) Class142_Sub18.aClass38_3546.method398(...
c48b5e81-dd12-47af-b35d-2ffa5ed3b57f
6
public void printAncestors(BSTNode<T> root, BSTNode<T> target) { Map<T,T> parentMap = new HashMap<>(); LinkedList<BSTNode<T>> queue = new LinkedList<>(); queue.add(root); parentMap.put(root.data, null); while(!queue.isEmpty()) { BSTNode<T> node = queue.remove(); ...
ebb92be6-d089-4a50-8809-b3a75d0222b0
1
public static MessageConfig parse(InputStream inputStream){ try { JAXBContext jaxbContext=JAXBContext.newInstance(MessageConfig.class); Unmarshaller unmarshaller=jaxbContext.createUnmarshaller(); MessageConfig messageConfig= (MessageConfig) unmarshaller.unmarshal(inputStream)...
f77ee201-eb84-48dd-9116-8a7faf7d8aea
6
public boolean shouldExecute() { if (!this.theEntity.isTamed()) { return false; } else if (this.theEntity.isInWater()) { return false; } else if (!this.theEntity.onGround) { return false; } else ...
12fc1e3b-4163-4162-80cf-32ae1409603a
7
public boolean wordBreak(String s, Set<String> dict) { if (s.length() == 0) { return false; } boolean[] possiblity = new boolean[s.length()]; for (int i = 0; i < s.length(); i++) { for (String word : dict) { if (i < word.length() - 1) { ...
61716324-9669-4a6b-ada7-cbf67d849dc8
2
private void addTransaction(String playerName, String itemName, int quanitity, double value) { if (!playerName.equalsIgnoreCase("Shop")) { // create a new transaction Transaction t = new Transaction(playerName, itemName, quanitity, value); // add the transaction to the dataClass // check if there is a...
9d458dbc-2d16-4787-9746-03f880c43386
1
public void testIncorrectlyOrderedParenthesis() throws Exception { String openParenString = ") 3 + 5 ("; try { new Expression(openParenString); fail("Did not throw exception"); } catch (MalformedParenthesisException mpe) {} }
83cdc22d-07b6-4d41-90bf-e1b7814615c1
9
private void findCutOff(double[] pos, double[] neg){ int[] pOrder = Utils.sort(pos), nOrder = Utils.sort(neg); /* System.err.println("\n\n???Positive: "); for(int t=0; t<pOrder.length; t++) System.err.print(t+":"+Utils.doubleToString(pos[pOrder[t]],0,2)+" "); System.err.println...
bbea4ac5-1535-4c91-83e2-157617e7c5b1
7
public boolean addItem(ProductTypes type) { Item item; int id = this.getSysCtrl().getStore().getItems().size(); System.out.println("Description:"); String description = JDealsController.scan.nextLine(); System.out.println("Insert price:"...
2e42111f-266f-4a0b-9c54-2a9f3b061649
5
public int [] execute(int [] vectors){ if(vectors.length == 3) System.out.println("Vectors" + Arrays.toString(vectors)); reset(); // for(int j = 0; j < vectors.length; j++){ // gates.get(inputLabels.get(j)).value = intToBoolean(vectors[j]); //set the signal from the vector input // gates.get(inputLabels.get...
db93a6a4-843f-4f51-8763-0aabbce8847b
6
public static String pideCadena(String letrero) { StringBuffer strDato = new StringBuffer(); String strCadena = ""; try { System.out.print(letrero); BufferedInputStream bin = new BufferedInputStream(System.in); byte bArray[] = new byte[256]; int numCaracteres = bin.read(bArray); while (numCara...
ea1c47fa-e55c-4e4c-9a3f-fc85b0781848
6
private static List<Float> getRandomNumbersThatSumToOne(int numToGet) throws Exception { if( numToGet < 2 ) throw new Exception("Please call for at least 2"); List<Float> tempList = new ArrayList<Float>(); for(int x=0; x < numToGet -1 ; x++) tempList.add(random.nextFloat()); Collections.sort(tem...
3f7cde05-ef98-4a8c-8f62-3b1f8a972b4f
2
private static void PreLaunchSequence() { File file = new File(""); String path = file.getAbsolutePath(); ListeDesMatchs listMatch = new ListeDesMatchs(); try { String bdtext = lireFichier(path + "/bd.json"); if(bdtext != null){ listMatch = ListeDesMatchs.JsonToListDesMatchs(bdtext); ListeDe...
cc5f1289-6f4c-4a00-a9fd-3cb27b5d7864
0
public static int euclideanDistance(int color1, int color2) { int dRed = ((color1 & RED_MASK) >> 16) - ((color2 & RED_MASK) >> 16); int dGreen = ((color1 & GREEN_MASK) >> 8) - ((color2 & GREEN_MASK) >> 8); int dBlue = (color1 & BLUE_MASK) - (color2 & BLUE_MASK); int dist = dRed*dRed...
5186c787-68d5-41cf-a9e2-91c1a3e253a2
4
static char getAction(String str) { char result = 'x'; gameInfo = new GameInfo(smallBetSize, dealer, opponentModel); GameState currentState = new GameState(NodeType.PLAYER, bettingRound, playerBetAmount, opponentBetAmount, knownCards, actionHistory, gameInfo); System.out.println(currentState....
61953aa5-c095-4a37-b141-91bba0d3cf01
8
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed //Validação dos campos String msg = ""; if (emailField.getText().equals("")) { msg += "Email\n"; } if (NomeField.getText().equals("")) { ...
b54a987e-1fd3-4ae5-9714-de59218e1412
5
@Override public void run() { /* * This code will run in a different Thread * Thread that is responsible to listen to new messages from the client * */ if (dataInputStream == null) //check if we already created the dataInputStream stream { ...
f6f23341-e352-40f0-8218-ebf7bc7ccdf0
0
public void setLastName(String lastName) { this.lastName.set(lastName); }
ff7bd25b-f788-4739-ad93-33eabb4a4908
4
public boolean isInside(int x, int y){ if(this.posX < x && x < (this.posX + this.width) && this.posY < y && y < (this.posY + this.height)) return true; return false; }
f517c2dc-fa24-41ed-9846-fec21c834879
0
public static SameAsService getSingletonInstance() { return INSTANCE; }
172a18fa-5e12-4bdf-a8a1-e1912709cabd
8
private void moveVectorBoxFace(byte face, int x, int y) { if (face < 0) return; if (!(selectedComponent instanceof Atom)) return; Atom at = (Atom) selectedComponent; switch (face) { case 0x00: // front case 0x01: // rear Point3f p = viewer.findPointOnPlane('x', x, y, 0); int delta = (int) (2 * (...
bb4dea35-250c-44e6-b86b-bb78bfab2371
5
@Override public void onDraw(Graphics G, int viewX, int viewY) { if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300) { // g.setComposite(new Additive()); G.setColor(Color.ORANGE); for (int i = 0; i < 4; i ++) { G.fillArc((int)X-viewX+(i*2)-...
520e7bbf-e611-453c-88b7-26841d558ccd
4
private void deleteIgnore(long target) { try { if (target == 0L) return; for (int i = 0; i < ignoreCount; i++) if (ignoreListAsLongs[i] == target) { ignoreCount--; redrawTab = true; System.arraycopy(ignoreListAsLongs, i + 1, ignoreListAsLongs, i, ignoreCount - i); stream.putO...
c548edae-9dec-4875-be48-ae2eca01f418
0
public void setQ(byte[] value) { this.q = value; }