method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
de48287f-af74-44e1-bf97-55958cda35ba
9
static int process(String line) { int cases = Integer.parseInt(line.trim()); for(int c = 1; c <= cases; c++) { String s = readLine().trim(); while(s.compareTo("") == 0) { s = readLine().trim(); } int[] arr = giveArray(s.split(" ")); int n = arr[0], b = arr[1], r = arr[2]; int[] jump = new ...
74152abc-3bb7-4e59-940d-ff892e92ba1b
7
public static boolean isPlate(String plate) { if(plate.length() == 7) { char[] charPlate = plate.toCharArray(); for (int i = 0; i < charPlate.length; i++) { if(i < 3) { if(!Character.isLetter(charPlate[i])) { return false; } } else { if(i == 3) { ...
c235f056-55fc-4a63-87a4-f5d7fd118957
2
public static boolean zmq_disconnect(SocketBase s_, String addr_) { if (s_ == null || !s_.check_tag ()) { throw new IllegalStateException(); } return s_.term_endpoint (addr_); }
92df167f-4719-4000-973f-b5da39fcca27
4
double []tax_rate(char status, int income){ double []ledger = new double[2]; //String norma = String.format("%s",status); //ledger[0] = (String.format("%s",status).toLowerCase().equals("s")) ? income < 32000 ? .10*32000 : 3200 + // (income * .25):2; if (String.format("%s",status)...
65e977cd-c76b-4ef9-ab96-d5f3d931a5ea
2
public void swt() throws SWTException { display = new Display(); shell = new Shell(display); createContents(); addListener(); update(); shell.open(); shell.layout(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
29996e48-86b9-4fd8-8513-1cbba1d9beae
7
public void sendJoinClanChat(String username, String clanName) { OutputStream stream = new OutputStream(); stream.writePacketVarShort(7); stream.writeByte(1); if (!player.inClanChat) { int idk = 2; int idk3 = 1; boolean idk1 = false; boolean idk2 = false; stream.writeByte(idk); if (idk == 1) {...
92486cd8-ddf2-4d10-a4b2-b34d77d74e46
6
public void update(float dt){ highlight.update(dt); if(scrolling){ scrollTime+=dt; scrollOff.x = Vars.easingFunction(scrollTime, .2f, prevScroll.x, goalScroll.x); scrollOff.y = Vars.easingFunction(scrollTime, .2f, prevScroll.y, goalScroll.y); if(scrollTime>=SCROLL_TIME) scrolling = false; }...
7e99fcd1-c43f-47f9-8e51-2d97b5023abc
1
public int addUtf8Info(String utf8) { Utf8Info info = (Utf8Info)strings.get(utf8); if (info != null) return info.index; else { info = new Utf8Info(utf8, numOfItems); strings.put(utf8, info); return addItem(info); } }
8fa5a3a1-d607-414f-bef3-0d934d215329
2
@Override public boolean onCommand(CommandSender cs, Command c, String l, String[] args) { if(c.getName().equalsIgnoreCase("flogin")){ new FLoginCommand(cs, args); return true; } if(c.getName().equalsIgnoreCase("flogout")){ new FLogoutCommand(cs, args); return true; } return false; }
4d4f83a7-02ce-4ee5-8906-c0f20855b9a5
8
public void deleteSelectedItem() { // DELETE THE SELECTED INTERSECTION, BUT MAKE SURE IT'S // NOT THE STARTING LOCATION OR DESTINATION if ((selectedIntersection != null) && (selectedIntersection != level.startingLocation) && (selectedIntersection != level.des...
011d9f2b-7b52-4378-9478-1366cb8d4ad6
8
private static void readTaskSet() { try { BufferedReader br = new BufferedReader(new FileReader(inputFile)); String line = ""; /*Skip first line*/ br.readLine(); while((line = br.readLine()) != null) { /*split line on spaces*/ String[] tokens = line.split("[ \t]+"); ...
d81e16ae-def6-4d80-b53a-82f5faa8dc93
2
void retract() { assert movesMade() > 0; Move lastMove = _moves.remove(_moves.size() - 1).reversed(); makeMove(lastMove); _moves.remove(_moves.size() - 1); if (numOnLine(lastMove) != lastMove.length()) { setPiece(lastMove.getRow0(), lastMove.getCol0(), ...
858c7ce7-2eb1-40d7-aa54-9d3c10ed1034
6
@Override public void received(Connection c, Object o) { UserConnection connection = (UserConnection) c; User user = connection.user; if (o instanceof Login) { LoginResult lr = new LoginResult(); lr.result = true; // Ignore if alr...
49963300-5606-452e-993a-b60cbed3ef72
1
public void render(Graphics g) { for (int i = 0; i < 4; i++) { g.drawLine(edges[i].x0, edges[i].y0, edges[i].x1, edges[i].y1); } }
2a2cc55a-fbb6-4cb6-9201-b6db3eb2181d
4
public void loadOrFail(String fileName) throws IOException { // set the current picture's file name this.fileName = fileName; // set the extension int posDot = fileName.indexOf('.'); if (posDot >= 0) this.extension = fileName.substring(posDot + 1); // if the current title is null use th...
a95b0ce1-e6e6-4e1a-b858-9e390c97ff00
6
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equals...
d6b14695-c9a0-4448-a4f2-1e6142c4a766
3
public HTMLAnchor getAnchorByText(String regex) { Pattern p = Pattern.compile(regex); for (HTMLAnchor a : anchors) { final String bodyText = a.getBody(); if (bodyText != null && p.matcher(bodyText).find()) return a; } return null; }
bf7ed053-a751-4e50-9c24-f698ec8fc9bf
3
@Override @Execute public void preLogic(IChassis chassis) { //Generate the primary camera matrices if(this.camera != null) this.camera.generateMatrices(chassis.getRenderEngine().getDelta()); Iterator<GUIElement> it = this.guiElements.values().iterator(); while(it.hasNext()) { GUIElement element = it.nex...
e0ea51f6-93e2-49a7-bcf4-e2291e200a0d
5
public void unhideCards(CardGame game) { //Not efficient, but easy if (!game.getDeck().isEmpty()) { game.getDeck().peek().setHidden(false); } for (List<Card> cardList : game.getBoard()) { for (Card card : cardList) { card.setHidden(false); ...
6ded63eb-a08f-47e9-903c-32378ddf45d8
8
public Long[] getPropertyLongArry(String key, Long[] defaultValue) { try { if (containsPropery(key)) { StringTokenizer stk = new StringTokenizer(getProperty(key), ","); Long ret[] = new Long[stk.countTokens()]; for (int i = 0; stk.hasMoreTokens(); i++)...
5c271131-1f70-4fc3-bf75-785ad23de18e
9
private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged try { if (jList1.getSelectedValue().equals("Artist")) { sort.byArtist(); DefaultListModel model = new DefaultListModel(); for(int i = 0; i <...
8bbb25c2-bc48-4ede-964d-be96e419abe3
5
private void create(final String skinname) { JPanel topPanel = new JPanel(); topPanel.setBackground(GUIConstants.DEFAULT_BACKGROUND); String tmp = GUIStrings.keyToLocatedString(GUIStrings.KEY_RENAMEDIALOG_TITLE); topPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createE...
5222ed94-7de1-4e54-9d09-ecacb1af67eb
4
@Override public void deserialize(Buffer buf) { jobId = buf.readByte(); if (jobId < 0) throw new RuntimeException("Forbidden value on jobId = " + jobId + ", it doesn't respect the following condition : jobId < 0"); minSlot = buf.readByte(); if (minSlot < 0 || minSlot > 9)...
ce01fd42-fa1f-4b70-a059-91327171dbee
0
@Override protected void setColoredExes() { // TODO Auto-generated method stub coloredEx = LineGenerator.Brezenhem(begin, end); }
d64bc7bf-0994-42f7-ae31-cb940c1d5f3f
8
public void readFile() throws FileNotFoundException { File inFile = new File(fileName); Scanner in = new Scanner(inFile); // Check for the header, the right format of specifying the width, // height and the color instance. If all ok, proceed with the reading // RGB components. try { String header = ...
cafb5097-b60c-431f-8fcd-673a3fa65cbb
8
private boolean expr_sempred(ExprContext _localctx, int predIndex) { switch (predIndex) { case 0: return precpred(_ctx, 11); case 1: return precpred(_ctx, 10); case 2: return precpred(_ctx, 9); case 3: return precpred(_ctx, 8); case 4: return precpred(_ctx, 7); case 5: return precpred(_ctx, 6); case 6: ...
28a52fab-9fc8-43a3-bc3a-455726f8738a
1
private String makePileMove(CardGame game) { if (topRow) { return game.moveCardOntoTopRowFromRow(boardIndexFrom, boardIndexTo); } else { return game.moveCardOntoCardFromTopRow(boardIndexFrom, boardIndexTo); } }
8582bde3-7cd6-4e4a-a4f7-3b0f41810a15
7
boolean scrambleHelper(int is, int js, int l) { if (!setMatch(is, js, l)) return false; if (l == 1) return true; for (int cut = 1; cut < l; cut++) { boolean valid; valid = scrambleHelper(is, js, cut) && scrambleHelper(is + cu...
f3d10c26-369f-4513-a17b-c7f7be6918c0
7
public void setAttributeValue(int i, int j) { try { if (vn.toString(i + j).equals("action")) { int attr = j + 1; actions = vn.toString(i + attr); setActions(actions); } if (vn.toString(i + j).equals("element_location")) { int attr = j + 1; elementLocation = vn.toString(i + attr); setE...
7e663428-a1db-4634-a00d-9f2ec7b10c5e
7
public void execute(NewRowEvent newRowEvent){ String[] formattedResults = new String[finalReportColumnCount]; Object[] nonFormattedResults = new Object[finalReportColumnCount]; Object[] previousRowGrpValues = getPreviousRowOfGroupingValues(); Object valueForCurrentColumn = null; boolean groupChanged = ...
9af63622-640b-41e4-ac7b-fad18b9360fd
8
public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); String input= userNameField.getText(); if (OK.equals(cmd) && !input.trim().equals("")) { if (checkAccount(input)==false && input.equalsIgnoreCase("Admin") || input.equalsIgnoreCase("Administrat...
e6d7d111-6e57-4ae3-a106-f50dccb4bca8
0
@Override public T findByID(Integer id) throws DaoException { waitCompete(); return getEntities().get(id); }
adbe4580-611f-47b9-af80-b147cbf99151
0
@Override public void update() { }
56c8d637-6807-4496-af2a-c235aa5febf9
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
a843796c-a129-4608-8b4f-4949ddd42156
4
@Override public double getValue(int row, int col) throws MatrixIndexOutOfBoundsException { if ((row < 0) || (col < 0) || (row >= mas.size()) || (col >= mas.get(0).size())) { throw new MatrixIndexOutOfBoundsException("Inadmissible value of an index."); } return mas.get(row).get(c...
860666e7-299b-449d-9a98-58c01c146796
3
private void botonAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonAceptarActionPerformed int fila = tabla.getSelectedRow(); int columna = tabla.getSelectedColumn(); if(fila == -1 || columna == -1){ JOptionPane.showMessageDialog(this, "Debe seleccionar u...
2547ea39-3466-485f-a3e9-a7289fbd080a
4
private void loadConfig() { String configpath = "/plugins/BungeeSuite/config.yml"; config = new Config(configpath); username = config.getString("BungeeSuite.SQL.Username", "root"); password = config.getString("BungeeSuite.SQL.Password", "password"); database = config.getString("BungeeSuite.SQL.Database", "...
06b71f5f-6d0c-4f13-800f-704efcbc02c9
9
public void addTank(Tank t, int battles, int wins) { if (tankBattles.containsKey(t)) { BattleStats b = tankBattles.get(t); battlesByType[t.type.ordinal()] += battles - b.battles; b.battles = battles; b.victories = wins; } else { BattleStats b = new BattleStats(); b.battles = battles; b.victorie...
a9a6e282-7ce3-48b8-9812-55b4b4dfce4d
9
private void writeValue(Object value) throws JSONException { if (value instanceof Number) { String string = JSONObject.numberToString((Number) value); int integer = this.valuekeep.find(string); if (integer != none) { write(2, 2); write(integer,...
38929c9a-4ae8-45b6-90d1-3ab58be243ec
4
@Test @SuppressWarnings("unused") public void testSynchronizeString() { final int ITERATIONS = 1000000; watch.start("Without synchronized... "); String j = ""; for (int i = 0; i < ITERATIONS; i++) { j += i; if (i % 20 == 19) { j = ""; } } watch.stop("%.6f seconds.\n"); long x = watch.n...
db90ab3b-193d-49d8-8014-dac5a6e2e8e5
1
public ArrayList<String[]> solveNQueens(int n) { ArrayList<String[]> res = new ArrayList<String[]>(); if (n <= 0) return res; board = new boolean[n][n]; solveNQueensDFS(0, n, res); return res; }
5e4c82c0-6df7-4fc3-83f6-57fc47adb240
0
public Environment getEnvironment() { return environment; }
2fee7ae1-7f74-4116-a68a-26f17b2c97fd
0
public boolean accept(File f) { return true; }
ff845846-0c7b-4419-b172-4f19541eca99
2
private boolean pluginFile(String name) { for (final File file : new File("plugins").listFiles()) { if (file.getName().equals(name)) { return true; } } return false; }
00366e1d-a3a3-44f3-a1eb-12d4cbd63209
8
private void expand1(byte[] src, byte[] dst) { for(int i=1,n=dst.length ; i<n ; i+=8) { int val = src[1 + (i >> 3)] & 255; switch(n-i) { default: dst[i+7] = (byte)((val ) & 1); case 7: dst[i+6] = (byte)((val >> 1) & 1); case 6: dst[i+...
98ebe32e-f362-4ad9-bf20-350be075b5ff
8
@Override public int attack(final NPC npc, final Entity target) { final NPCCombatDefinitions defs = npc.getCombatDefinitions(); npc.setNextAnimation(new Animation(defs.getAttackEmote())); switch (Utils.getRandom(5)) { case 0: npc.setNextForceTalk(new ForceTalk("Bwuk")); break; case 1: npc.setNextFor...
31c2ff5b-e7bf-454f-b8e9-521e0a3da221
3
public Task updateTaskByIdName( String id, String name, String date, String status, String required, String description, String attendants)throws JAXBException, IOException{ //Check this line //FileInputStream stream = new FileInputStream("/WEB-INF/task-manager-xml.x...
4dd4b843-02dc-48bc-8249-993ea5ebe7f3
0
public boolean supports(final Class clazz) { return EntityForm.class.equals(clazz); }
af3fb383-f830-403b-843b-e41b310c7b12
3
private Item onItem(double nx, double ny){ for (Item i : model.getItems()){ Rectangle s = (Rectangle) i.getShape(); if(s.getX()== nx && s.getY() == ny ){ return i; } } return null; }
926ae112-5ea8-475a-b7cf-42ea870875f7
8
@Override public void getResults(Course curr, StyledDocument doc) { // TODO Auto-generated method stub // Load the default style and add it as the "regular" text Style def = StyleContext.getDefaultStyleContext().getStyle( StyleContext.DEFAULT_STYLE ); Style regular = doc.addStyle( "regular", def ); // Cre...
1e41a5cd-d044-4395-ac77-f3307c6b7d40
6
public static void blur( int[] in, int[] out, int width, int height, int radius ) { int widthMinus1 = width-1; int tableSize = 2*radius+1; int divide[] = new int[256*tableSize]; for ( int i = 0; i < 256*tableSize; i++ ) divide[i] = i/tableSize; int inIndex = 0; ...
ef08605a-c45a-424d-b5f2-6a606fe842ba
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Measurement that = (Measurement) o; if (channel != that.channel) return false; if (id != that.id) return false; if (timestamp != that.t...
6f9de4ec-e83f-4771-b9d9-7eb7a26ab486
1
public void addAllCreatures(Collection<? extends ICreature> creatures) { actionables.addAll(creatures); }
e3ee7e06-787c-409a-b575-24439868a6a8
1
private void parseFields( Token token ) { if ( !token.isWord() ) { throwException( "Expecting type." ); } else { parseCommonFields( token ); } }
33ce4e27-8454-4d27-a7ea-65254afe1ae4
7
private void analyzeWhere() { if(where==null) return; ArrayList<Expression> exprs=new ArrayList<Expression>(); decomposer.andBreaker(where, exprs); System.out.println("***************************************************************************"); //print the broken expression out Iterator<Expression...
702daed0-d89a-42d2-ad20-325b71da29ea
0
Capture(Socket s){ this.s=s; }
b1c64826-de98-4965-8a56-3c42bc0f1347
6
public void print(String outStr) { try { // Open output file? if ((outputFile != null) && (out == null)) out = new BufferedWriter(new FileWriter(outputFile)); // Write something? if ((outStr != null) && (!outStr.isEmpty())) { // Write to file? if (out != null) { out.write(outStr); out.w...
266f380b-06b8-476e-9951-db2a28acabf4
5
public void generateSetPath() { double currentX = this.startX; double currentY = this.startY; double tempY = this.widthY; int i; if (currentX < (this.widthX) / 2) { i = 0; } else { i = 1; } // pushes points in reverse order from the opposite corner into the robot in an s pattern // while ignori...
8215ef54-e4bd-4db8-9f0d-39283d370bee
8
private String unicodeToPlain(String source, Boolean uppercase, String postchars) { String plainResult = ""; Integer srcLen = source.length(); String hex = ""; int j; // Cycles through encoded text. Finds all instances of %XX and converts them // to the plain text equiv...
9ae11c67-b716-4f76-afa1-3f781eb79a24
4
@Override public Object _save(Object o) { if (null == o) { System.err.println("Warning, object to save is a nullptr"); return null; } Connection connection = createConnectionObject(); try { checkAndSyncSchema(o.getClass(), connection); } catch (SQLException e) { e.printStackTrace(); return ...
67b6ae4f-ec0f-492e-af2d-c2891692d000
4
protected boolean out_grouping_b(char [] s, int min, int max) { if (cursor <= limit_backward) return false; char ch = current.charAt(cursor - 1); if (ch > max || ch < min) { cursor--; return true; } ch -= min; if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) { cursor--; return true; } return...
650c9df5-99f3-455d-8ad2-4fc9f831e4ea
4
private void addToList(Class<?> c, Listener l){ if(map.containsKey(c)){ if(map.get(c)!= null){ if(!map.get(c).contains(l)){ map.get(c).add(l); } } } }
48e664f5-7634-4eb5-9cf1-043a851d2cc4
1
public static void printAllHebrewCharter() { for (int i = 0X0591; i <= 0x05f4; i++) { System.out.printf("%2c %3c %4X\n", i, 0x2502, i); } }
13865086-9427-4e55-925f-3ef0b18ef08d
0
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignedInfo") public JAXBElement<SignedInfoType> createSignedInfo(SignedInfoType value) { return new JAXBElement<SignedInfoType>(_SignedInfo_QNAME, SignedInfoType.class, null, value); }
d0b71cfa-23af-40ec-9450-21ba52bdf280
4
private void setHeadSprite() { if(direction.y() < 0) { snake.set(0, sprites[0]); } else if(direction.y() > 0) { snake.set(0, sprites[1]); } else if(direction.x() < 0) { snake.set(0, sprites[2]); } else if(direction.x() > 0) { snake.set(0, sprites[3]); } }
547b2e0b-2f96-486d-bf58-39351b862d5c
0
public int getEnergy() { return energy; }
77735427-f686-459a-a272-6762934c77be
9
public void calcRepulsion() { for (int i = 0; i < vertexArray.length; i++) { for (int j = i; j < vertexArray.length; j++) { if (progress.isStopped()) return; if (j != i) { double xDelta = cellLocation[i][0] - cellLocation[j][0]; double yDelta = cellLocation[i][1] - cellLocation[j][1]; ...
4fb3d1f6-3e63-4117-8686-2a2a39558c36
2
protected void cacheCtClass(String classname, CtClass c, boolean dynamic) { if (dynamic) { super.cacheCtClass(classname, c, dynamic); } else { if (repository.isPrune()) c.prune(); softcache.put(classname, c); } }
fbe76d03-65c3-42ed-9e79-5ed5f49b8dff
5
private void postPlugin(boolean isPing) throws IOException { // Server software specific section PluginDescriptionFile description = plugin.getDescription(); String pluginName = description.getName(); boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enab...
552b17d3-762a-4fea-96b4-9d6f59814435
6
public static Stella_Object accessReverseIntegerIntervalIteratorSlotValue(ReverseIntegerIntervalIterator self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_INTERVAL_CURSOR) { if (setvalueP) { self.intervalCursor = ((IntegerWrapper)(value)).wrapperValue; ...
c9cac5d3-dcd7-4d07-8a9d-4aacad1fd751
4
private String evalExpectedType2(ArrayList equiv, int n) throws BadBytecode { String origName = null; for (int i = 0; i < n; i++) { TypeData td = (TypeData)equiv.get(i); if (!td.isNullType()) if (origName == null) origNa...
ae674fef-94cc-4638-b669-8c5fb8f08ed5
5
private void setListeners() { nameText.addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ...
e19c6df6-7f50-4b45-988f-2aff06f07af5
7
public void sortColors2Pass(int[] A) { int[] counts = new int[3]; // count for color 0,1,2 System.out.println("Before"); printIntArray(A); for (int i = 0; i < A.length; i++) { switch (A[i]) { case 0: counts[0]++; break; case 1: counts[1]++; break; case 2: counts[2]++; break...
5edeef9a-6af3-414c-867e-5bca8028fe6d
3
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return toString().equals(o.toString()); }
e15563bb-7c16-424b-abf9-ecadd1ed9365
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BoardCell other = (BoardCell) obj; if (index == null) { if (other.index != null) return false; } else if (!index.equals(other.index)) ...
c7f1337d-c8e2-4f91-a0b6-7fc1de52da86
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 Tournament)) { return false; } Tournament other = (Tournament) object; if ((this.id == null && other.id != null...
f2a1513f-8cbc-438b-9466-0a153ee135e0
4
private static void inputgraph() throws FileNotFoundException { // TODO Auto-generated method stub File f = new File("src/dijkstraData.txt"); int i; int j; for (i = 0; i < 201; i++) { graph.add(new ArrayList<Integer>()); //exploredarray.add(false); pathlength[i]= 15000; for(j =0 ; j<205;j++){ ...
059bc994-c7b2-46b1-a23f-0c5285de04ba
8
static public AudioInputStream convertToPCM(AudioInputStream in) throws IllegalArgumentException { AudioFormat targetFormat = null; AudioInputStream pcm = in; AudioFormat sourceFormat = in.getFormat(); int sampleSizeInBits; //check for not null if(in == null) throw new IllegalArgumentEx...
4b36fceb-e68f-4a2b-81b6-ebaca48390c7
2
public void setLocation(float xPos, float yPos) { if( keyPoint != null) { float keyPointXLoc = keyPoint.getXPos(); float keyPointYLoc = keyPoint.getYPos(); float extraShiftY = 0; float extraShiftX = 0; for( Point movingPoint: PointList ) { extraShiftX = movingPoint.getXPos() - keyPointXLoc; ...
ca150723-16c0-43ec-9d78-5d6074ca8802
7
public static int longestValidParentheses1(String s) { int len = s.length(); if(len == 0) { return 0; } Stack<Integer> last = new Stack<Integer>(); String[] parts = s.split(""); int count = 0; int tmp = 0; int max = 0; for(int i=0;i<len;i++) { if(parts[i].equals("(")) { count++; las...
6b9b93da-d8e9-4b6a-ab79-f2f516f01e37
0
public AutomatonPane getAutomatonPane() { return automatonPane; }
91110cc2-2f0f-4ca9-b9d0-639fed3e55ca
4
private Matrix getExcludedMatrix(int row, int column) { Matrix m = new Matrix(numRows - 1, numColumns - 1); for(int i = 0; i < numRows - 1; i++) { for(int j = 0; j < numColumns - 1; j++) { m.elements[i][j] = elements[i < row ? i : i + 1][j < column ? j : j + 1]; } } return m; }
eaebf384-1f0a-4a69-a5fa-076fa285f673
3
public void dailyBonus(Player player) { if (!player.getName().equals("dummy")) { movePoints = getMaxMovePoints(); } if (color == player.getColor()) { for (Artifact a: active.values()) { a.dailyBonus(player); } } }
afde0ec8-7788-4f12-903b-7567ceb7a21a
5
public void onEnable() { instance = this; getConfig().options().copyDefaults(true); saveConfig(); Server server = getServer(); ConsoleCommandSender console = server.getConsoleSender(); if(getConfig().getString( "Send Stats" ).equals("enabled" ) ) { try { ...
1a101983-e54b-4582-b7d2-fa65d9b80db5
8
public boolean hasCollided(int xa, int ya) { int xMin = 0; int xMax = 7; int yMin = 3; int yMax = 7; for (int x = xMin; x < xMax; x++) { if (isSolidTile(xa, ya, x, yMin)) { return true; } } for (int x = xMin; x < xMax; x++) { if (isSolidTile(xa, ya, x, yMax)) { return true; } } ...
23f20565-d178-48b3-b61f-484ceeec3500
6
@Override public void messageSent(NextFilter nextFilter, IoSession session, Object message) throws Exception { InputStream inputStream = (InputStream) session .getAttribute(CURRENT_STREAM); if (inputStream == null) { nextFilter.messageSent(session, message); ...
e59128e5-ea39-4bee-b807-76cd04d5768e
8
public synchronized boolean needsGui() { BeanContext bc = getBeanContextPeer(); if (bc != this) { if (bc instanceof Visibility) return ((Visibility)bc).needsGui(); if (bc instanceof Container || bc instanceof Component) return true; } synchroniz...
9fb921c9-4c3e-4b36-86eb-c4a93b2f439d
8
public static GraphFilter getCorrectFilter(ArrayX<String> filter) { GraphFilter gf = null; if (filter.getValue().equals(Filters.Integral)) { gf = new IntegralFilter(); } else if (filter.getValue().equals(Filters.LaplacianIntegral)) { gf = new LaplacianIntegralFilter(); ...
b68e30c3-8e85-41e7-9086-37458e73f2bc
2
public boolean looksLike(Peer other) { if (other == null) { return false; } return this.ip.equals(other.getIp()) && this.port == other.getPort(); }
703d741c-3e49-4d09-b3b2-953be4594f2b
3
public boolean ApplyRingz() { if (IsDeadTimer == false) { actionAmount++; actionTimer = 4; ResetAttack(); //setAnimation(0x718); IsDeadTimer = true; } if (actionTimer == 0 && IsDeadTimer == true) { teleportToX = 2899; teleportToY = 3557; resetAnimation(); IsDeadTeleporting = true; up...
58636fbc-7432-4562-954b-7594722e4037
2
public String getCode(){ String str = condition.getCode() + this.printLineNumber(true) + "if " + condition.place + " == false " + "goto := " + String.valueOf(this.currentLineNumber + truePart.tLineCount() + (falsePart != null ? 2 : 1)) + "\n" + truePart.getCode(); if(falsePart != null) str += ...
b312871b-a97d-4609-9393-8c86760e4732
8
@Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = getLine(value); lastKLines.add(line); while (lastKLines.size() > k) { lastKLines.poll(); } if (line == null || line.isEmpty()) { return; } // Handle line ...
f7c77ca0-01df-4833-b8de-c0e56d461bb7
6
public String getClassString(ClassInfo clazz) { String name = clazz.getName(); if (cachedClassNames == null) /* We are not yet clean, return the full name */ return name; /* First look in our cache. */ String cached = (String) cachedClassNames.get(name); if (cached != null) return cached; int pkg...
27ee7b68-03ff-4e44-adb2-805f8049bf9b
1
public boolean equals(Object object) { try { ColorComparator comparator = (ColorComparator) object; } catch (ClassCastException e) { return false; } return true; }
cd58535f-c52c-4151-ab6a-d83f7de270f5
3
public boolean commitSportsBooking(Connection conn) throws SQLException { boolean status = true; try { // Start of system transaction conn.setAutoCommit(false); BookingMapper bm = new BookingMapper(); status = status && bm.addNewSportsBooking(newSPBooking,...
54f9163d-8269-4ced-8510-4fd6aa45f139
7
public static void run(){ try{ while(true){ cWaitTime=waitTime; synchronized (LOCK){ while (!running){ LOCK.wait(); } if (!field.act(curP)){ int lC = field.take...
3071e173-6d74-4d5b-8df7-8d217fb74cf0
3
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int n = Integer.parseInt(line.trim()); out.append(...
2945813a-e885-44f3-a492-4f5b9188746e
9
public static void main(String[] args) { try { Console console = new Console(); loop: while (true) { System.out.println("1 | Toon alle programmaties voor een bepaalde bioscoop tussen 2 datums"); System.out.println("2 | Voeg een soc...
e133dda0-11b4-4e54-aa21-fb011917e873
0
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ @Override public void run() { new JuliaMandelbrotFrame(); } }); }
1e178985-d734-4c35-bfb0-acdb5427928d
2
@Override public boolean execute() { Boolean val = true; try { List<Font> fonts = new ArrayList<Font>(); for (int i = this.startFrom; i <= this.endAt; i++) { Font previousFont = this.document.getChildren().get(i) .getFont(); Font newFont = new Font(previousFont.getName(), previousFont...