method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e69c287a-0e86-41b2-977c-a58baa288827
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
6f96b0d3-abdc-4234-b9f7-2e7cd38afdbd
5
private void addCardElementsToList(NodeList nList, String type) { for (int temp = 0; temp < nList.getLength(); temp++) { Node nNode = nList.item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; if ( type == "CommunityChest" ) { cardElements.add(createCommu...
7ff04151-ed86-4e33-8472-e3a08efcd4c6
6
public void checkProjectileCollisions() { for (Projectile p : projectiles) { //projectile to wall collisions boolean tmp[] = check.checkWallCollisions(p); for (int i = 0; i < 4; i++) { //mahdollista muuta käyttöä myöhemmin if(tmp[i...
4410da8a-b3b9-4934-987a-599fd0893765
9
public Tex rendered() { if(rnm == null) { boolean hv = (type & 2) != 0; BufferedImage nm = null; if(name.length() > 0) nm = Utils.outline2(nfnd.render(name, BuddyWnd.gc[group]).img, Utils.contrast(BuddyWnd.gc[group])); int w = 0, h = 0; if(nm != null) { w += nm.getWidth(); if(nm.getHeigh...
c869d57a-47a5-4c26-bcc4-994d7594c1dc
9
private double parseLevel1() throws ParsingException { if (tipoTokenActual == TOKEN_TYPE.VARIABLE) { TOKEN_TYPE tokenTemp = tipoTokenActual; String tokenNow = token;/*new String(token);*/ int temp_index = i; getToken(); if (token.equals("=")) { ...
0ed3f442-5820-4dd3-a552-f5e5ef3b5e88
0
public void updateCustomer(Customer customer) { this.em.merge(customer); }
5a451a50-b46b-464f-b8f1-1f88caaadad9
1
static int calculate(int x, int y) { if (y == 0) throw new ArithmeticException(); return x / y; }
660eba0e-d531-41dc-b78f-830ff181e8c0
5
private void writeHeader() throws IOException { byte FileLangId = dbfConfig.getLanguageID(); int HeaderSize = 0; int RecordHeaderSize = 0; byte[] header = null; if (dbfConfig.getDbfVersion() == ru.nyrk.util.jdbf.DBFConfig.DbfVersion.xBaseVII) { HeaderSize = 68; ...
47acc7eb-e778-4fa8-81e8-2b6afca8dca7
8
@Override public void run() { while (true) { if (!pause) { Log.i("TaskClearing!!!"); try { Set<String> keys = runningTasks.keySet(); Iterator<String> iterator = keys.iterator(); while (iterator.hasNext()) { String key = iterator.next(); ServerTask task = runningTasks....
870d97e0-44cc-473a-9cd7-d42fa0d250dc
3
public boolean isCellEditable(int row, int col) { if (col == ID || col == USE || col == ENTITY) return false; return true; }
c758f6a0-e118-4356-8cd3-7abcf0a6f755
8
public static void main(String ... a) throws Exception { Options options = new Options(); options.addOption("i", "input", true, "input path. Required"); options.addOption("o", "output", true, "output path. Required"); options.addOption("b", "block-size", true, "size in bytes of i/o block...
f8d8eb58-061e-41e2-928b-e3b8e53e17b3
6
private void waterFlow() { float flowRate = Globals.getSetting("Flow rate", "Water");//0.04f; float flowThreshold = Globals.getSetting("Flow threshold", "Water");//0.1f; for(int x = 1; x < Globals.width-1; x++){ for(int y = 1; y < Globals.height-1; y++){ if(groundWaterLevel[x][y] >= flowRate){ float h...
689e3e06-fa87-42f3-8600-47592c76fc7e
7
void gotoNextLiftSource() { if (!demoMode) return; Hill hill = null; Cloud cloud = null; if (app.landscape != null) { hill = app.landscape.nextHill(new Vector3d(p.x, p.y + 2, p.z)); } if (app.sky != null) { cloud = app.sky.ne...
781f006d-7f3d-43eb-a25e-81e216bcea07
9
public static String composeWhereForNum(String sql, String fieldName, String fieldValue, int action) { // String sTmp = String.valueOf(fieldValue); if (fieldValue == null || fieldValue.trim().compareTo("") == 0) return sql; String sTmp = fieldName + " = " + fieldValue; switch (action) { case EQUAL: b...
521c2808-64b9-4762-9a6b-f170156cc706
3
private void btnEkleMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnEkleMousePressed if(!btnEkle.isEnabled()) return ; HashMap<String, String> values = new HashMap<>(); values.put("ad", txtAd.getText().trim()); values.put("soyad", txtSoyad.getText...
79ed1646-de4e-420d-8226-bc1cfe3cf626
0
public void setScale(double scale){ scaleBy = scale; // drawer.setScale(scale); }
fc3c877a-edf5-4d97-b82c-1ffba3ab168e
8
public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please enter number of rows for a matrix operation"); int rows = Integer.parseInt(reader.readLine()); System.out.println("Please enter number of columns f...
97173806-89e0-42c5-9981-243a0ac60595
4
public static void download(final String from, final String to) { try { final URL url = new URL(from); out = new BufferedOutputStream(new FileOutputStream(to)); in = url.openConnection().getInputStream(); while ((read = in.read(buffer)) != -1) out.write(buffer, 0, read); System.out.println("The fil...
1fcca62d-8567-462b-a501-fb116a2a1449
4
public void process(){ for(Entity e : getEntities()){ Velocity v = (Velocity) e.getComponent(velocityID); if(v.isEnabled()){ v.x += v.dx; //v.y += v.dy; if(v.x > 450 || v.x < 0) v.dx *= -1; //if(v.y > 450 || v.y < 0) v.dy *= -1; } } }
1753a534-f743-41d6-a557-16b28c2278c3
8
@Override public int getIndexOfChild(Object parent, Object child) { int count = 0; Class<?> type = parent.getClass(); if (type == Schema.class) { TreeMap<String, Table> tables = ((Schema)parent).getTables(); for (Map.Entry<String, Table> t : tables.entrySet()) { if (t.getKey().compareTo(child.toString(...
b794bb25-4eb6-43b9-8d76-d9550280091f
3
public static int kadaneAlgo (int[] seq) { int curr_max_sum = seq[0]; int max_sum = 0xFFFFFFFF; int temp_start = 0; for (int i = 1; i < seq.length; i++) { if (curr_max_sum < 0) { temp_start = i; curr_max_sum = seq[i]; } else {...
efec8f9a-108e-464c-abbe-e078c2ca7141
8
int getInfluencer(boolean[][] followingMatrix){ if(followingMatrix == null || followingMatrix.length != followingMatrix[0].length) return -1; Queue<Integer> queue = new LinkedList<Integer>(); boolean[] checked = new boolean[followingMatrix.length]; queue.offer(0); ...
14f25d29-b521-4d66-8841-0a1d5a47474b
9
public static void mobSpawner() { // int mobSpawnGoal1; // int mobSpawnGoal2; // int mobSpawnGoal3; // mobSpawnGoal1 = 1; if(spawnFrameMob1 >= spawnTimeMob1){ // && mobSpawnCount1 < mobSpawnGoal1 for(int i = 0; i < Screen.mobs.length; i++){ if(!Screen.mobs[i].inGame){ Screen.mobs[i].spawnMob(Value....
bc64c615-1a68-4855-95bc-79b6ef8b9e28
6
@EventHandler(priority=EventPriority.LOW) public void getEnchantments(EnchantItemEvent event) { if(event.isCancelled()) return; Player play = event.getEnchanter(); Map<Enchantment, Integer> enchantments = event.getEnchantsToAdd(); if(MCListeners.isMultiWorld() && !play.h...
f1be167e-2f70-4d4c-a484-44a2ed90fb73
5
static final boolean method989(int i, int i_92_, int i_93_) { anInt8401++; if (Class156.method1241(i_93_, i, i_92_ ^ 0x1fe) | (0x10000 & i) != 0 || BufferedPacket.method3325(i, i_93_, true)) return true; if (i_92_ != -385) return false; if ((i_93_ & 0x37) != 0 || !Class273.method2056(i, 120, i_93_)) ...
3c78bab6-0af0-4187-9abd-f1f0e5e7e766
9
private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged if (editor == jTextField1) { if (jList1.getSelectedValue() == null) jTextField1.setText(""); else jTextField1.setText(jList1.getSelectedValue().toString()); } ...
40a65895-6f51-4b19-9176-bb2bff80147c
9
@Override public void handleWindow(final Window window, int eventID) { if (!firstTradesWindowOpened) { showAllTrades = Settings.settings().getBoolean("ShowAllTrades", false); } if (!showAllTrades) { firstTradesWindowOpened = true; return; } ...
baa6e5ea-4074-42c5-9fd0-83941bc10ae9
0
public String getImie() { return imie; }
508916c7-9a1f-4663-8fc0-fa3b54d76067
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...
492bca32-cb72-4606-8a88-f34bba70189f
0
public Point2D getLocation() { return this; }
2f0358d7-44e4-4022-a6e8-64be4d9907bd
1
public int getUnsignedSmart() { // method421 int i = payload[offset] & 0xff; if (i < 0x80) { return getUnsignedByte() - 0x40; } else { return getUnsignedShort() - 0xC000; } }
2f538be1-bf38-417b-a432-23cc46ced2d6
4
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } Position other = (Position) obj; return this.x == other.x && this.y == other.y; }
816bddf8-4008-4942-a8fb-8a3b7b0d512f
4
private void setID(String num){ switch(num){ case "A": id = 1; break; case "J": id = 11; break; case "Q": id = 12; break; case "K": id = 13; break; default: id = In...
445d298c-d742-4e67-a392-3c646204369d
6
public ResultPage<Book> getBooks(String search, String searchColumn, String orderColumn, int offset) throws SQLException { openBooksDatabase(); StringBuilder query = new StringBuilder("SELECT * FROM Titles WHERE "); if (searchColumn.equals("Title")) { query.append("Title"); } else { query.append(...
25acda1a-0381-4765-9cdb-e14caef66a58
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...
f55ccdae-766b-4035-95b4-b8cba64e0b6f
8
private static String getNumberEncoding(String characters) { if ("ABC".contains(characters)) { return "2"; } else if ("DEF".contains(characters)) { return "3"; } else if ("GHI".contains(characters)) { return "4"; } else if ("JKL".contains(characters)) { return "5"; } else if ("MNO".contains(chara...
2ebea55b-7a60-42bd-8b77-4802d2383517
6
public static void removeVarObject(int objectType, int objectX, int objectY, int objectHeight) { for (int index = 0; index < varObjects.size(); index++) { VariableObject vo = varObjects.get(index); if(vo == null) continue; if(vo.getType() == objectType && vo.getX() == objectX && vo.getY() == objectY &...
c3b8ad76-62bf-419e-b03d-671fa18fc00e
6
public ArrayList<FrameSet> partition(String partitionType, int partitionOption){ //System.out.println("Partitioning."); // Generate set number of partitions. int itemsPerPartition = 0; int numberOfPartitions = 0; if (partitionType.equalsIgnoreCase("numberPartitions")){ itemsPerPartition = this...
99db5f65-ee5c-4a8d-8711-2adfe6de6ef3
8
public ArrayList<Integer> cluster(){ int number_of_clusters = 3;//(int)Math.ceil(this.p.len/4); int its = 100; Dataset data = new DefaultDataset(); data.addAll(Arrays.asList(instances)); Dataset[] best_clusters = null; double best_score = 999999999999.0; for (i...
bc653f9b-9bea-46f6-8b63-d9402f8839ea
4
public void receivePose(SimplePose pose) { if (markerTransGroup == null){ return; } double[] trans = new double[3]; double[] rot = new double[4]; trans[0] = pose.getTx(); trans[1] = pose.getTy(); trans[2] = pose.getTz(); rot[0] = pose.getRx(); rot[1] = pose.getRy(); rot[2] = pose.getRz(); rot[...
233b3305-608a-44d8-b71c-ae70bcdeae03
7
public int compareTo(InvalidOperation other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; InvalidOperation typedOther = (InvalidOperation)other; lastComparison = Boolean.valueOf(isSetWhat()).compare...
333d660a-79a1-445e-8fdd-8f027a8500c0
3
@Override public boolean hasNext() { while (count < vortexSpaces.length && vortexSpaces[count] == null) { count++; } if (count < vortexSpaces.length) { return true; } count = 0; return false; }
83e41f5a-67c7-4268-acf7-faf83b5bf8c9
1
@Override public int compareTo(Oriented<S> o) { return orientation ? item.compareTo(o.item) : o.item.compareTo(item); }
a7310df7-0aa4-45e9-89a2-2f2557f369d0
1
public BufHashTbl() { // initializes all entries in the Page Table to null for (int i=0; i < HTSIZE; i++) ht[i] = null; } // end constructor
4757169d-c557-4b16-956f-528909ed9d98
8
private void RightButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RightButtonActionPerformed if (FocusOwnerIndex == 1) { if (NumberField1.getCaretPosition() >= NumberField1.getText().length()) { // jump to next textfield FocusOwnerIndex += 1; ...
7052bed3-6657-4144-9767-dca882f20e9f
8
public List<T> DFS() { List<T> dfsTraversalElements = new ArrayList<T>(); Stack<BinaryTree<T>> nodes = new Stack<BinaryTree<T>>(); nodes.push(this); while (!nodes.isEmpty()) { BinaryTree<T> node = nodes.pop(); if(node != null) { nodes.push(node); ...
ddb5631e-90d7-4708-a15d-225656e1ebea
9
public static void openURL(String url) { try { //attempt to use Desktop library from JDK 1.6+ Class<?> d = Class.forName("java.awt.Desktop"); d.getDeclaredMethod("browse", new Class[] {java.net.URI.class}).invoke( d.getDeclaredMethod("getDesktop").invoke(null), new Objec...
738ae1c8-df0c-444c-a82e-6f3095578ff9
4
public void execute() { try { while( !terminated ) { final List commandList = getCommandList(); final Map resultMap = getCommandResult( commandList ); List[] lists = getCommandResultAsLists( commandList, resultMap ); info( lists[ 0 ].size() + "/" + ipList.size() + " servers alive." ); info( lists[ 1 ].si...
451193fc-b86a-4d29-9268-d6d16c885d90
4
@Override public void start() { Logger l = plugin.getLogger(); try { if (socket == null) { socket = new ServerSocket(port); running = true; } if (running) { try { l.log(Level.INFO, "Waiting for connection.."); Socket client = socket.accept(); ClientHandler handler = ...
f8cde762-6c2f-4c12-8cfc-e30103e5d538
4
private void synchronizeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_synchronizeButtonActionPerformed synchronizeButton.setEnabled(false); this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { final String sourceDir = sourceDirecto...
e9bc17aa-b0d5-475f-8a80-4f3c3805e851
2
public static void main(String[] args) { FileMerger app = new FileMerger(); app.getFileName(); if (!app.createFileList()) { System.exit(0); } try { app.mergeFiles(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
b1c6d1e5-87a5-4835-ae74-11f30bd4b709
6
private void ssInsertionSort (int PA, int first, int last, int depth) { final int[] SA = this.SA; int i, j; // pointer within SA int t; int r; for (i = last - 2; first <= i; --i) { for (t = SA[i], j = i + 1; 0 < (r = ssCompare (PA + t, PA + SA[j], depth));) { do { SA[j - 1] = SA[j]; } while...
ecf310cb-8afc-4ac0-a4b9-5b2292b5885b
5
public Processor(Privilege privilege, int numPhysPages) { System.out.print(" processor"); // Sets the pagesize if(Config.getString("Processor.pageSize")!= null) { pageSize = Config.getInteger("Processor.pageSize"); } else { // default pagesize ...
91f554e1-4411-4dc7-bec2-006f6ce46f02
5
public static int runToAddressLimit(int baseKeys, int startKeys, int stepLimit, int... addresses) { if (!curGb.onFrameBoundaries) { int add = curGb.step(0, addresses); if (add != 0) return add; } int steps = 0; while (steps < stepLimit) { int add = curGb.step(steps == 0 ?...
adab2109-6555-4db6-ab29-30d3ec067938
5
@Override public void run() { Thread.currentThread().setName("FileDeleter-" + getName()); Logger.log("Running FileDeleter on " + getAbsolutePath()); while (!done && isFile()) { if (System.currentTimeMillis() >= killTime) { Logger.log("Removing TemporaryFile " + getAbsolutePath()); try { r...
6c1c4c0c-cba6-42a4-a9c6-075f1c4bab50
6
public void map() { //points is start, controls, end double[][][] V = new double[points.length-1][intervals+1][2]; for (int c = 0; c < V.length; c++) { for (int i = 0; i < V[c].length; i++) { V[c][i][0] = (1 - (double)i/intervals)*points[c][0] + ((double)i/intervals)*points[c+1][0]; V[c][i][1] = ...
1dd1888f-bf2b-4b05-923b-e8c9c9c121c6
5
public String getColumnName(int columnIndex) { switch (columnIndex) { case 0: return "Name"; case 1: return "Level"; case 2: return "Teacher"; case 3: return "Quantity"; case 4: return "Schedule"; } return ""; }
d100adda-7975-4f6e-9742-705b4f0fea29
2
private final void push(int ch) { if (ch != 0) { if (mTextPos == mTextBuffer.length) { char[] bigger = new char[mTextPos * 4 / 3 + 4]; System.arraycopy(mTextBuffer, 0, bigger, 0, mTextPos); mTextBuffer = bigger; } mTextBuffer[mTextPos++] = (char) ch; } }
846f0e37-2e95-42c8-80f1-f8dc057cf77a
7
public static boolean saveImage(Image img, String filename) { String extension = null; try { int index_of_extension = filename.lastIndexOf("."); extension = filename.substring(index_of_extension); if(extension.equalsIgnoreCase(".gif") ) { ...
6af48dba-12ed-426b-b07b-70bc66010551
9
public void executeCommand(CommandType userCommand) throws IOException, ParseException { CommandTypesEnum commandType = determineCommandType(userCommand); switch (commandType) { case ADD: AddCommandType addUserCommand = (AddCommandType) userCommand; add(addUserCommand.getDescription(), addUserCommand.ge...
a6443b20-41cc-4b37-88fd-39c334a0b0a9
6
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName());...
62dc7652-8122-4dcf-87ff-905171178fe8
1
public String getNotationSystemId(String nname) { Object notation[] = (Object[]) notationInfo.get(nname); if (notation == null) { return null; } else { return (String) notation[1]; } }
93b8ae01-064e-4e60-9787-9cee943b28f4
7
GameLoader(String[] classNames) throws Exception{ Arrays.sort(classNames); for(String s:classNames){ Class<?> c = classLoader.loadClass(s); if(Scene.class.isAssignableFrom(c)){ scenes.put(s, (Scene) c.newInstance()); System.out.println("Found scene " + s); continue; } ...
e71e6473-9636-439d-a05d-c6651b1a5a0a
1
public void testSubtractDays() { // This is a test for a bug in version 1.0. The dayOfMonth range // duration field did not match the monthOfYear duration field. This // caused an exception to be thrown when subtracting days. DateTime dt = new DateTime (1112306400000L, GJChro...
409f4bba-4b62-4679-8f34-292af939bd0a
2
public int getNonNullPropertyCount() { int res = 0; for (Object o : values) { if (o != null) { res++; } } return res; }
55b48126-a551-449c-83ff-ee7269ff1509
0
public void setPassiveActivities(PassiveActivities passiveActivities) { this.passiveActivity = passiveActivities; }
cf3799c9-ce7e-4c01-a20d-4a46823c9d3f
2
public int compare(Instance s1, Instance s2) { double d = s2.predict - s1.predict; if(d > 0) return 1; if(d < 0) return -1; return 0; }
4fb3cb8e-68f4-445c-8d04-fd0d010af505
2
@Override public void run() { // TODO Auto-generated method stub try{ while(run){ Socket socket = socketListen.accept(); ComingRequestChatHandler handleRequest = new ComingRequestChatHandler(socket, myUserName); handleRequest.start(); } } catch( IOException e){ } }
34fe24f3-4da0-47cf-95a5-df2df973da61
7
private Point findSpawnLocation(LayeredMap map) { for(int y=3; y<map.getHeight(); y++) { for(int x=3; x<map.getWidth(); x++) { boolean ok = true; for(int j=0; j<4; j++) { for(int i=0; i<4; i++) { int ground = map.get(0, ...
7a4b2205-35e3-4cc2-bc84-994bd642e87d
4
private static void createAndShowGUI() { // http://docs.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java //Create and set up the window. JFrame frame = new JFrame("VennMesh"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // capture glo...
fa1d87ba-754c-4994-a448-878f9c77ff77
7
private void simulate() { // Prepare the model for the iteration earthModel.begin(); // Submit the sim iteration to the thread pool. // Wait on the Future objects returned to block the current // thread until the iteration is complete across the whole surface. // Inspired...
2925ca6b-696d-4d90-a910-78816a765405
8
public ListNode sort(ListNode p, int len) { if (len == 1) { return p; } ListNode a = p; ListNode b = p; ListNode atail = null; for (int i = 0; i < len / 2; i++) { atail = b; b = b.next; } atail.next = null; a = sort(a, len / 2); // don't forget renew a&b b = sort(b, len - len / 2); List...
229665b2-a4e4-4256-9271-ac5ff069949b
7
@Override public Success<Type[]> parse(String s, int p) { // Parse the '['. if (s.charAt(p) != '[') return null; ++p; p = optWS(s, p); // Parse the first type. List<Type> genericArgs = new ArrayList<Type>(); Success<Type> resArg = TypeParser.singl...
9ca4f494-7ded-48d4-9f0e-3e1cbdf3ec25
7
@Override public void run() { try { long startTime = System.currentTimeMillis(); long currentTime = startTime; Random r = new Random(); double amount = 1000.0; while(isRunning()){ switch(operations){ case deposit: myBank.deposit(Account.DEFAULT_ACCOUNT_ID, amount); break; case wi...
fdd61bfe-5de8-43ff-b877-2bd04ed570fe
7
public int addLeaf(Node root, Node leaf) { Node node = this.leafs.get(leaf.getInfo()); if (node!=null) { return -1; } if (root==null && this.head==null) { // no se el padre y no hay head -> head = leaf this.head = leaf; this.leafs.put(leaf.getInfo(), leaf); } else if (root==null && this.hea...
107e02ff-b9a7-4ef3-aa87-028ad9a60781
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final ObjectPropertyIdentifier other = (ObjectPropertyIdentifier) obj; if (objectType...
e633ed85-756b-40c9-b947-c388cbdf8b18
2
public void setRef2(String ref) { if (ref != null && ref.length() > 256) throw new IllegalArgumentException("Ref cannot be longer than 256 characters!"); this.ref2 = ref; }
2122af20-31cd-4066-888b-4e074ad8d6b2
2
public void removeLaser(Object player){ for(int i = 0; i < lasers.size(); i++){ if(lasers.get(i).getParent() == player){ lasers.remove(i); } } }
92ecfa3f-890d-4e11-b07b-4ee93efeff45
5
@Override public void paintComponent(Graphics g){ boolean[][] tiles = next.getTiles(); int count = 0; int width = next.getTiles()[0].length == 9 ? 3 : 4; // get width (3 or 4) of piece width = next.getTiles()[0].length == 4 ? 2 : width; for(int row = 0; row < width; ++row) { for(int col = 0; col < width; ...
b57d87e9-15f3-4bae-983b-3a5b4d4ffcbb
1
public static List<BoundaryBox> getBoundaries(ImageProcessor im, List<Point> maximPoints){ List<BoundaryBox> result = new ArrayList<BoundaryBox>(); for(int i = 0; i < maximPoints.size(); i++){ result.add(new BoundaryBox(maximPoints.get(i), im)); } return result; }
9200fdee-bf6f-4976-bb42-cfddc5ae970a
2
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cellComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); setHorizontalAlignment( JLabel.CENTER ); if ...
fc3a8462-26d8-47e5-8c3b-64838a051174
8
public void move(Direction d) { this.lastInspected = ""; Direction up = boardState.getDirection(); d = Direction.values()[(d.ordinal() - up.ordinal() + 4) % 4]; if (!player.isFrozen() && System.currentTimeMillis() - lastMovedTime > player.getStepDelay()) { if (player.getDirection() == d) { Location newLo...
94f2f412-7ccc-4ee4-b54f-794ec47b0fea
5
public static Color contrastColor(Color color, Constrast type) { if (type == Constrast.invert) { return new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue()); } if (type == Constrast.textbw) { // nasledovne konstanty nie su nahodne, neodporucam me...
37c0f234-806a-488a-b183-af0387375ab0
0
public void publish(ApplicationEvent event) { applicationEventPublisher.publishEvent(event); }
75558cbf-b9de-4dc0-bc11-deb3016d06bd
5
boolean siOuvert(int case1, int case2) { boolean ouvert = true; for (int i=0; i<aretes.size(); i++) { if (aretes.get(i).s1.num == case1) { if (aretes.get(i).s2.num == case2) ouvert = false; } else if (aretes.get(i).s1.num == case2) { if (aretes.get(i).s2.num == case1) ouvert = false; ...
1283771b-6482-44d7-9cfa-3be985832c5d
7
public boolean isOnPF(int marginx,int marginy) { if (!getTileBBox(temp_bbox_copy)) { temp_bbox_copy.x = (int)x; temp_bbox_copy.y = (int)y; temp_bbox_copy.width = 0; temp_bbox_copy.height = 0; } if (!pfwrapx) { if (temp_bbox_copy.x+temp_bbox_copy.width < -marginx) return false; if (temp_bbox_cop...
394eb2c8-4bee-4a63-b20f-6bb3cabe3a6b
9
private void validateCustomerInfo(HttpServletRequest request, Customer customer) { if (!customer.isValid()) request.setAttribute("error", "true"); if (!customer.isValidGivenName()) request.setAttribute("invalidGivenName", "Given Name must not be empty and number"); if (!customer.isValidSurname()) requ...
557a243c-a3c3-4f16-b8e3-39609ba3180b
7
public int moveUp(boolean findChange) { int total = 0; for (int y = 3; y > 0; y--) { for (int x = 0; x < 4; x++) { if (next.grid[x][y] != 0 && next.grid[x][y] == grid[x][y-1]) { next.grid[x][y] *= 2; next.grid[x][y-1] = 0; ...
d473b8de-8827-4d5f-9824-559a235aaf2f
7
public String command(CommandSender sender, Command command, String[] args) { if (args.length < 1) return plugin.getString(Language.LOCKDOWN_ARGUMENTS); String admin = Ultrabans.DEFAULT_ADMIN; if (sender instanceof Player) admin = sender.getName(); boolean locked ...
5e472a28-e3d1-4dec-8ebb-aa8367298640
6
public static void parse_str(String string, Map<String, Object> results) { // parse a string that's URL encoded into an array if (results == null) return; if (string == null) return; String[] stuff; if (string.contains("&amp;")) { stuff = string.split("&amp;"); } else { stuff = string.split("&"); }...
eadf4fb8-baee-4d1a-8bd0-bd51fa81bfb5
8
protected void configFromAdjacent(boolean[] near, int numNear) { final Tile o = origin() ; type = TYPE_SOLAR ; if (numNear > 0 && numNear <= 2) { if (near[N] || near[S]) { facing = Y_AXIS ; if (o.y % 8 == 0) { type = TYPE_WIND ; attachModel(MODEL_TRAP_RIGHT) ; ...
545883a9-841b-41bd-8f1b-d1d99ff819c1
9
public static double binomialCoefficientLog(final int n, final int k) { ArithmeticUtils.checkBinomial(n, k); if ((n == k) || (k == 0)) { return 0; } if ((k == 1) || (k == n - 1)) { return FastMath.log(n); } /* * For values small enough to...
418ca4a3-7aa5-462a-9aa8-8e5f262bd83e
5
@Test public void testSpeicherVerwaltung() { Speicher speicher = new Speicher(); int anz = speicher.getAnzZellen(); //Kompletter Speicher erstellt? if (anz != Speicher.SPEICHERGROESSE) assertFalse(true); //Speicher richtig initialisiert? for (int i = 0; i < Speicher.SPEICHERGROESSE; i++) { if(spei...
a3a13c01-68ba-4f6b-af9d-002422cc2340
8
public void removeEventListener(IGameEventListener listener) { if (listener != null) { Iterator<Entry<GameEventType, Map<Integer, Set<IGameEventListener>>>> iterator = eventListeners.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<GameEventType, Map<Integer, Set<IGameEventListener>>> entry = i...
1163b93c-7e79-4f97-8b70-608091d2f139
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 Segmento)) { return false; } Segmento other = (Segmento) object; if ((this.codsegmento == null && other.codsegm...
166ea069-ff2a-4689-bb45-17cbae13813d
8
public HostManifest(String file) throws Exception { Properties p=read(file); host=p.getProperty("host"); if(host==null) throw new RuntimeException("host name is required in "+file); for(Object x:p.keySet()) { String name=(String)x; if(!reservedName(n...
55a4a529-9f80-41b4-a63a-41815670cbf8
9
public static void updateAccountView() { Investor inv = (Investor) userList.get(userIndex); investorGUI.getBrokerNameText().setText(inv.getBroker().getFname() .concat(" ").concat(inv.getBroker().getLname())); investorGUI.getBalanceText().setText(Double.toString( i...
30869059-046f-4a82-95ed-92a793d071b3
3
public static void main(String[] args) { Scanner scanner=new Scanner(System.in); HDOJ1070 hdoj1070=new HDOJ1070(); int cases=scanner.nextInt(); while (cases-->0){ int milkCnt=scanner.nextInt(); List<Milk> milks=new ArrayList<>(); while (milkCnt-->0) { ...
a2ed2aa1-f599-441b-a575-d64c314741fe
5
public static void main(String[] args) { Locale.setDefault(Locale.US); Scanner s = new Scanner(System.in); String op = s.nextLine(); double sum = 0; for(int i = 0; i < 5; i++){ int pad = i+1; for(int j = 0; j < pad; j++){ s.nextDouble...
0e23fa11-c787-4127-830a-067d8461f7d8
1
protected void ensureOpen(String methodName) { if (isClosed) { throw new RuntimeException(methodName + "() called on a closed AbstractResultSet."); } }