method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3ed6759e-caa7-40bf-a4e2-245badc8acb5
5
public Type3Font(String baseFont, PDFObject fontObj, HashMap<String,PDFObject> resources, PDFFontDescriptor descriptor) throws IOException { super(baseFont, descriptor); rsrc = new HashMap<String, PDFObject>(); if (resources != null) { rsrc.putAll(resources); } ...
bfde1bad-e828-458c-ac3b-2e2820da621b
7
public void findBestHand(Player p) { int size = p.getAllCards().size(); Hand curHand; Hand bestHand = new Hand(p.getAllCards().get(0), p.getAllCards().get(1), p.getAllCards().get(2), p.getAllCards().get(3), p.getAllCards().get(4)); if(size > 5) { for(int i = 0; i <...
5631bfdc-fea0-49b7-aa5a-dab2f6fa3d67
2
public String getEffects() { String effects = ""; for(int x = 0; x<listModel.getSize(); x++) effects += ";" + listModel.get(x); if(!effects.isEmpty()) return textPane.getText() + effects; return null; }
32f1b83b-52fc-4599-9245-2bf1ac0b6ed8
7
public static void main(String[] args) { // SWAP 2, TEAM 06 // BONUS FEATURE / FURTHER ELABORATION (Our group didn't do an additional feature last time so we added one) // Now have the option to load a schedule from file via the command line // Before this was a hard coded value, which h...
d9bdd566-2b54-4e74-aee2-edf2426e30df
2
public String toString() { double valueOfTheQuantity = this.value; Map<String,Integer> mapOfTheQuantity = this.unit; // Ensure we get the units in order TreeSet<String> orderedUnits = new TreeSet<String>(mapOfTheQuantity.keySet()); StringBuffer unitsString = new StringBuffer(); ...
486e19b6-4cf5-412e-88b2-b1d5259f12c2
9
private synchronized void performCoordinatorElection() { if(Logger.DEBUG)Logger.d(TAG, "performCoordinatorElection() : isElectionFlag : " + Election.getInstance().isElectionFlag()); if(this.isCoordinatorFlag()) return; if( Election.getInstance().getElectionNodeList().size() >= 0 ){ if(Election.getInstanc...
9a6b0ae5-df26-4f07-8d35-cc4b4a8ef77f
5
public Window() { File[] languages; try { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty( "com.apple.mrj.application.apple.menu.about.name", "Test"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { System.out...
5ce12e6d-3761-4322-b2f7-df4d327c6990
3
public String replace(String data, String what, String replace){ String tmp1 = data.toLowerCase(); String tmp2 = what.toLowerCase(); int i = what.length(); StringBuffer stringbuffer = new StringBuffer(); int j = 0; for(int k = tmp1.indexOf(tmp2, j); k > -1; k = tmp1.index...
f05dc7fb-9fff-43b4-a1d3-f316d0eb36a8
0
public static void setBreedingAge(int newBREEDING_AGE) { BREEDING_AGE = newBREEDING_AGE; }
efb2cf0d-5e08-4833-a2b1-40dc6aa4a85c
0
public int getB_data(){ return b_data; }
ec07aae0-cfa9-4255-82e7-57f8748f4557
1
public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { //first goal is to be able to receive and process //a well formatted XML move piggybacked on a POST //this gives me a raw stream to payload of Post reque...
8c4f40c1-c8b1-4f8c-af1a-4a0e5244b5c6
1
public void writeBytesC(int off, int len, byte buf[]) { // method442 for (int i = (len + off) - 1; i >= len; i--) { buf[i] = payload[offset++]; } }
773f8a5c-5f13-4c02-aef1-0c40cd761ccf
2
public ArrayList<String> traerUsuario(Usuario u){ conn = Conector.conectorBd(); int pa =u.getPassword(); int ru =u.getRut(); String sql = "SELECT u.nombre, u.coded, u.codtipousuario, e.nombre as edificio \n" + "from usuario u inner join edificio e\n" + "ON(u.coded=e.cod_ed) where r...
0ae8aab5-0736-4ee6-add6-e332f0dc196a
8
public static synchronized Collection purchaseStock(String tickername, User username, int no, ArrayList<User> users, ArrayList<Stock> stocks) { stocks = DataReader.getStocks(); users = DataReader.getUsers(); tickername = tickername.toUpperCase(); // the collection that is returned Collection results = n...
eda00088-46cb-48fc-9d07-7db58d3c301a
7
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException, RollbackFailureException, Exception { EntityManager em = null; try { utx.begin(); em = getEntityManager(); Patients patients; try { patients = em.getReference(Patients.class, id); patients.getId(); } ca...
75efa5b1-2665-4a96-a81c-1036ada1ab2e
0
public Sync() { writeLocks = new ArrayList <String>(); readLocks = new ArrayList <String>(); }
1338a292-2804-47ae-9d87-4001de9f81d7
1
@Override public void selectionChanged(TreeSelectionEvent e) { JoeTree tree = e.getTree(); Document doc = tree.getDocument(); if (doc == Outliner.documents.getMostRecentDocumentTouched()) { calculateEnabledState(tree); } }
d353a129-0211-4a2b-be02-0c5d40d16cce
1
public long[] Calculate(long[] l) { updateNeighbors(l); RecursiveAction ut = new UpdateTask(submesh, height, 0, width, 0, threshold, true); fjp.invoke(ut); ut.reinitialize(); if(this.stable == 0) { this.stable = 1; this.updating = 0; } else { ...
f530df6a-c020-4f3e-be00-7b3bd7f7896a
4
public boolean installForWindows() { boolean result = false; File installer = extractInstaller(); if(installer!=null) { if(label!=null) { label.setText("<html>Installing driver..."); } String command = "msiexec /i " + installer.getAbsolutePath(...
791375d3-06e8-488f-b6eb-f0c82106e145
7
public static void SetFieldValue(Persistent obj, Field field, NodeReference node) { String fieldName = field.getName(); try { if (Persistent.class.isInstance(field.get(obj))) { Persistent fieldAsPersistentObject = (Persistent) field.get(obj); if (fieldAsPersistentObject ...
58ff5925-d386-49b4-8608-f258c875f3a6
9
public void run(ArrayList<Token> tokens, SymbolTable sb){ try { st = new StreamTokenizer(br); while (st.nextToken() != StreamTokenizer.TT_EOF) { if (String.valueOf((char) st.ttype).equals("\'")) { tokens.add(new Token(TokenType.CHAR, st.sval, 0, st.lineno())); } else if (String.valueOf((char)...
2495c3c2-dfd3-4380-bff5-1b458d1fe277
3
private void doSomethingInWorkerThread() { //define and instantiate a worker thread to create the file //---------------------------------------------------------------------- //class SwingWorker // workerThread = new SwingWorker<Void, String>() { @Override public Void doInBackgr...
f5304edd-a6aa-4356-a23f-0f12028611aa
9
private void postorderNR(Node<Item> r){ if (r == null){ return; } while (r != null || !s.isEmpty()){ while (r != null){ s.push(r); if (r.hasLeft()){ r = r.left; } else { r = r.right; } } if (!s.isEmpty()){ r = s.pop().data; queue.enqueue...
d2d54a22-727a-4155-b413-94b761ad4bac
8
public boolean getDecision(ArrayList<Boolean> enemyDecision) { int loyalty = 0; int betrayed = 0; boolean lastDecision = false; for (boolean e : enemyDecision) { if (e == true) { betrayed++; } else { loyalty++; } ...
a91aa676-8788-49e7-97a5-e4559a4c463d
9
private void processElementData(String[][] data) { HashMap<String, Double>[] categories = new HashMap[2]; categories[0] = new HashMap<String, Double>(); categories[1] = new HashMap<String, Double>(); for (int i = 0; i < data.length; i++) { for (int j = 0; j < 2; j++) { if (!categories[j].containsKey(data...
378029b7-122a-474d-89ad-bd2675efd818
1
public void tableChanged(TableModelEvent e) { try { // get the index of the inserted row //tableModel.getRowSet().moveToCurrentRow(); int firstIndex = e.getFirstRow(); // create a new table model with the new data tableModel = new AudienceTableModel(tableModel.getList(),...
b525649f-3531-4fb6-8fae-567d21aff4d6
1
@Override public V get(Object key) { if(!super.containsKey(key)){ return null; }else{ return super.get(key); } }
ea44d2d6-66c8-4e9e-b95f-d6b54fc81903
5
@Override public void paintComponent(Graphics graphic) { super.paintComponent(graphic); Graphics g = backBuffer.getGraphics(); g.setColor(Color.black); g.fillRect(0, 0, backBuffer.getWidth(null), backBuffer.getHeight(null)); g.setColor(Color.red); g.drawRect(convertX(...
9cdd7615-c2de-46bd-900f-8bf98b15e741
2
@Override public boolean evaluate(T t) { if(firstSearchString.evaluate(t) && secondSearchString.evaluate(t)){ return true; } else{ return false; } }
742a38b5-e680-44cf-9333-8ce8e15d5f72
7
public double partialContains(Instance instance) throws Exception { int count = 0; for (int i = 0; i < instance.numAttributes(); i++) { if (i == m_ClassIndex) { continue; } if (instance.isMissing(i)) { continue; } double current = instance.value(i); if (m_NumericBounds[i] != null) { //...
7fc07bd9-a164-4822-8565-2a43dbf3b2ec
0
public int getTotalNoOfSeats() { return totalNoOfSeats; }
b7cde9c3-39c8-4426-ae74-e74957b03db2
3
private void initializeLogger() { this.log = Logger.getLogger(this.getClass().getName()); try { FileHandler fh = new FileHandler(this.getClass().getName() .replace("class ", "") + ".log"); fh.setFormatter(new SimpleFormatter()); this.log.addHandler(fh); } catch (SecurityException e1) { // TO...
7edac9f9-4ef0-4a9b-abf6-878208829e49
4
public static void save(String filename) { File file = new File(filename); String suffix = filename.substring(filename.lastIndexOf('.') + 1); // png files if (suffix.toLowerCase().equals("png")) { try { ImageIO.write(onscreenImage, suffix, file); } catch (IOExcep...
ce673c1a-957d-443c-8d80-7f9cee387171
4
@Override public boolean onMouseDown(int mX, int mY, int button) { super.onMouseDown(mX, mY, button); if(mX > x && mX < x + width && mY > y && mY < y + height) { selected = true; return true; } else { selected = false; } ...
1d225a5b-c0b0-4c84-9758-c0f538ad93ea
4
private void drawContinueArrow(Graphics g, int x, int y) { boolean cont = status == 2; // true if we're drawing the "Continue" button and // false if we're drawing the "Start Game" button Polygon arrow = new Polygon( new int[] {x, x, x + CONTINUE_ARROW_SIZE.width - ARROW_HEAD_W...
64c86fd3-0402-44fd-83b4-e17e03169e79
9
@Override public boolean setEventID(String newID) { IDclassFilter=-1; IDflagFilter=-1; IDdomainFilter=-1; for (final String element : MISC_TRIGGERS) { if(element.equalsIgnoreCase(newID)) { ID = element; return true; } } for(int i=0;i<Ability.ACODE_DESCS.length;i++) { ...
2861f71e-dadc-4562-bdb9-fbcad5386dca
5
private void accept() throws IOException, SocketTimeoutException { Socket socket = this.socket.accept(); try { logger.debug("New incoming connection ..."); Handshake hs = this.validateHandshake(socket, null); //< obfuscated handshake extension this.sendHandshake(socket, hs.getPeerId(), hs.isObfuscated(...
dd40b25d-64db-4a29-87d6-cc6a73cd2642
4
private String getColor() { switch(getAttitudeRank()) { case Stakeholder.MARGINAL: return WHITE; case Stakeholder.NONSUPPORTIVE: return RED; case Stakeholder.MIXED: return YELLOW; case Stakeholder.SUPPORT...
a2121938-28fc-449b-a5c0-d0ff8e6b1701
0
public Message(int date1, int id1, int taille1){ date = date1; id = id1; taille = taille1; }
5a25e149-3be3-43e3-b3cc-2699d712e8a0
7
public Map.Entry<K, V> traverse(Cursor<? super K, ? super V> cursor) { TrieEntry<K, V> entry = nextEntry(null); while(entry != null) { TrieEntry<K, V> current = entry; Cursor.SelectStatus ret = cursor.select(current); entry = nextEntry(current); switch(ret...
9ba618e5-315f-4c3d-aad1-4ad7b4961fb8
8
public static void ExportInFile(String address, String fileName) { try (BufferedWriter bw = new BufferedWriter(new FileWriter(address + fileName))) { // Essai d'ouvrir le fichier et de créer un pointeur. switch (fileName) { case "ObjectsLeague.txt": for (Iterato...
a805cf78-485f-4823-a76e-4e350e0b901a
9
private static void detectAndCorrectHydrazoneDerivativeViolation(List<Fragment> suffixFragments) { fragmentLoop: for (Fragment suffixFrag : suffixFragments) { List<Atom> atomList = suffixFrag.getAtomList(); for (Atom atom : atomList) { if (atom.getElement() == ChemEl.N && atom.getIncomingValency() ==3 ){ ...
1b99ec8a-6376-471d-85f5-f8f120a6ec17
3
private GameState frenchDay(GameState state, Card card, boolean output) { Color faction = card.getFaction(); Player player = state.getPlayer(faction); int gold = player.getGold(); if(gold >= 9) { if(output) { state.log(Faction.getPirateName(faction) + " has " + gold + " gold so the " + "French ...
e174f6f0-a2c9-46b6-811c-e67d774db15b
2
public static boolean wildCardMatch(String text, String pattern) { //from http://www.adarshr.com/papers/wildcard // Create the cards by splitting using a RegEx. If more speed // is desired, a simpler character based splitting can be done. String [] cards = pattern.split("\\*"); ...
7e382266-4688-489b-a071-a072682567e3
7
@Override public void mouseReleased(MouseEvent e) { int size = length / 9; if (e.getPoint().y > p.y && e.getPoint().y < p.y + size) { for(int i = 0; i < 9; i++){ if(e.getPoint().x > p.x + i * size && e.getPoint().x < p.x + (i + 1) * size){ if(e.getButton() == 1){ selected = i + 1; } else if(...
1370c1b4-abdd-4448-82eb-ac2d063b0996
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); ...
b4e8fe94-51b0-456e-96f0-56ddb364980e
6
@EventHandler public void CreeperWither(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getCreeperConfig().getDouble("Creeper.Withe...
46c0f236-902d-45b9-884b-b4a25f8f9e73
8
protected HashMap<PhysicalNode, Path> getPathsFromNode(PhysicalNode physicalSourceNode, SubstrateNetwork substrateNetwork) { SimpleWeightedGraph<Node, DefaultWeightedEdge> graph = new SimpleWeightedGraph<Node, DefaultWeightedEdge>(DefaultWeightedEdge.class); for...
521e360d-75f6-4dc5-bffe-53d41d7bc2f1
8
private void lockToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lockToggleButtonActionPerformed // Mettre à jour le document d'après le contenu du textarea setDocumentFromTextArea(); lockToggleButton.setEnabled(false); // Non verrouillé -> verrouillé ...
0ac69add-b118-4215-938e-2969c8acf464
6
public boolean save(User user) { // inserted this pseudo-condition for testing purposes. if(true) return true; insertUserSql = String.format(insertUserSql, user.getName(), user.getPassword()); Connection conn = null; Statement stmt = null; try { ...
c2854843-2435-4b08-ad3a-17b751b4bb67
3
public boolean isEqual(ClusterPoint p) { if(dimensions.size() != p.getDimensionSize()) return false; for(int i = 0; i < dimensions.size(); i++) { if(dimensions.get(i) != p.getValueAtDimension(i)) return false; } return true; }
978ad770-c3dd-46ac-9e7a-0caa240536aa
3
private void connectTax(Tax tax, ArrayList<FieldCircularList> fieldArrayList, Parking parking) { if(parking == null) { for(FieldCircularList next : fieldArrayList) { if(next instanceof Parking) { tax.setParking((Parking) next); break; } } } else { tax.setParking(parking); } }
9247c7ca-4ec5-4dca-8bba-a4cb67cedb9a
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 = maxNextCharInd = 0; else ExpandBuff(false); } el...
19ac1e09-f56c-475b-9a20-1ca43ce164c9
6
public static String cppCreateCharacterSubstitutionTable() { { StringBuffer table = edu.isi.stella.javalib.Native.makeMutableString(256, '_'); { int code = Stella.NULL_INTEGER; int iter000 = (int) '0'; int upperBound000 = (int) '9'; boolean unboundedP000 = upperBound000 == Stella.NULL...
6ddaeb4b-9829-4936-8748-2e49f2762052
3
Record getImageRecord(PDFPage page, ImageInfo info) { // first find the relevant page record Integer pageNumber = new Integer(page.getPageNumber()); // System.out.println("Request for image on page " + pageNumber); PageRecord pageRec = getPageRecord(pageNumber); if (pageRec != ...
f4e993a0-5165-4e06-8414-c6f7b6fb692c
0
public String getName() { return name; }
375e3b73-6f8c-4422-aee7-24ffa1e6c5da
6
@Override public void render(float interpolation) { super.render(interpolation); removeField.render(interpolation); Fonts.get("Arial").drawString("Texture Path", 10, 95, 20, 0xffffff); texturePath.render(interpolation); savePath.render(interpolation); Renderer.drawRect(new Vector2(250,10), new Vector2(...
2245d00e-902b-475d-903e-340838f49fc5
0
@Test public void testBoyerMoore() { String docs = "substring search application"; String pattern1 = "app"; String pattern2 = "apa"; BoyerMoore bm1 = new BoyerMoore(pattern1, 256); BoyerMoore bm2 = new BoyerMoore(pattern2, 256); assert(bm1.search(docs) == docs.indexOf(pattern1)); // success asser...
af18953c-af45-4ffb-ae83-e28b21a364de
2
public BCNode[] inputToBCNodes(ArrayList<String[]> inputList){ BCNode[] output= new BCNode[inputList.size()]; Double[] pointHolder; int id = 0; int index = 0; for(int i = 0 ; i < inputList.size(); i ++){ pointHolder = new Double[inputList.get(0).length]; for(int j = 0; j < inputList.get(i).length; j...
4b2fe361-71cc-4b1d-964e-93d1e45f5bba
9
public void render(Graphics g) { // for (int i=mapRenderIndexX;i<mapRenderIndexX + screenTileWidth;i++) { // for (int k=mapRenderIndexY;k<mapRenderIndexY + screenTileHeight;k++) { // try { // ArrayList<Tile> jimmy = tiles.get(i); // jimmy.get(k).render(g); // } catch(Exception e) {} // } // } /...
6c2ace50-56b4-4baa-bd87-16eec5bef636
0
@Override public int compareTo(Shape shape) { return new Integer(getCorners()).compareTo(shape.getCorners()); }
cc156df9-df0c-4b51-ba30-5d901e72ebb5
4
public void generateNextGeneration() { List<Chromosome> nextGeneration = new ArrayList<Chromosome>(); nextGeneration = population; List<Chromosome> tournament = new ArrayList<Chromosome>(); Random rand = new Random(); for (int i = 0; i < 10; i++) { int index = rand.nextInt(nextGeneration.size()); t...
365b27be-532e-40df-8ddc-03d0c227ffb8
3
public void delete(int i) { if (i < 0 || i >= NMAX) throw new IndexOutOfBoundsException(); if (!contains(i)) throw new NoSuchElementException("index is not in the priority queue"); int index = qp[i]; exch(index, N--); swim(index); sink(index); keys[i] = null; ...
63323f43-c2d2-4727-89ca-5b4642ccd918
0
public void configure(Binder binder) { // Singleton Implementations /*binder.bind(ValidatorJNotifyListener.class).asEagerSingleton(); binder.bind(Watchers.class).asEagerSingleton(); binder.bind(JNotifier.class).asEagerSingleton(); binder.bind(XmlManager.class).asEagerSingleton();*/ binder.bind(PoolExecutor....
2e98255b-f798-4da4-80aa-5b4afd58f13c
1
protected void sleep(long ms) { try { Thread.sleep(ms); } catch (InterruptedException e) { } }
8738b12f-a03f-4535-bcc5-23226e5c9a5b
7
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 fe...
464a15ee-213d-4d37-9baa-084b9064fefa
0
public void init() throws ServletException{ }
6412c649-9c0f-4b7f-8839-9e9caa04f353
1
public boolean canAtk(){ return (!this.tapped && !this.sumSick); }
65db9056-aa40-4538-8f8c-cd5339e18fea
8
private static void pideDatosIniciales(){ //datos personales System.out.println("***"); System.out.println("Ingrese su nombre y presione enter:"); jugador.setNombre(in.nextLine()); System.out.println("***"); System.out.println("Bienvenid@ " + jugador.getNombre() + " ! Rec...
aff24322-daf8-4c13-94d6-95a542305284
6
public H getAdjacentTo(GeoElements.OfHexagon.Segments side){ switch(side){ case SIDE_0: return neighbors.get(0); case SIDE_1: return neighbors.get(1); case SIDE_2: return neighbors.get(2); case SIDE_3: return neighbors.get(3); case SIDE_4: return neighbors.get(4); case SIDE_5: ...
bd519f3e-7570-49ac-8dde-3b1650d090af
0
@Override public String getWorkingDay() { return super.getWorkingDay(); }
3b68c509-3c9e-4424-8af8-c067c95affb6
7
public void parseExtension() throws FileIsInMainFolderException, CantParseFileException, NotAllowedFileException { String caseString = this.extension.toUpperCase().replace(".", ""); // Main Folder nicht benutzen? if (!cXMLGenerator.main.dontUseMainFolder) { if (this.isFileInMainFolder(this.pfad)) { ...
65e6a52b-ba43-41fe-8553-5d8a2a5d7a24
4
private boolean hasNoIntersectingNeighbourInRow( Rectangle areaOfCardToCheck, int rowNumberOfRemovedCard) { Rectangle areaToCheck; Card cardToCheck; /* * helper for Stage 7 (20 Marks) */ for (int i = 0; i < cards[rowNumberOfRemovedCard].length; i++) if (cards[rowNumberOfRemovedCard][i] != null ...
b3ca22c3-e107-473a-8b15-d11d4dabc5ab
6
public boolean isValidStateToGo(int state) { switch (state) { case CREATED: return CREATED == getState(); case RUNNING: return CREATED == getState(); case ENDED: return RUNNING == getState() || CREATED == getState(); case ENDED_CANCELLED: case ENDED_TIMEOUT: return RUNNING == getState(); defau...
6db2fb17-a897-4ef5-a19c-348b4717df17
1
public CSVDocument where(String columnName, String value) { if (header != null) { Objects.requireNonNull(header.findByCellValue(columnName)); Integer columnIndex = header.findByCellValue(columnName).getCellIndex(); //records.stream().filter( data -> data.getCellByIndex(orderC...
c29fe625-5e80-40c9-80ef-effb0bd5b3e9
7
public static final String getCardinal(int number) { while (number > 100) { number -= 100; } if ((number - 1) % 10 == 0 && number != 11) { return "st"; } if ((number - 2) % 10 == 0 && number != 12) { return "nd"; } if ((number -...
f51c2cc0-aed6-49be-97c8-f7c13cd02a66
1
public void visitAttribute(final Attribute attr) { if (attrs == null) { attrs = new ArrayList(1); } attrs.add(attr); }
c6ad942f-62b7-4a06-b532-921554e6293a
5
public void go(){ theGui=this; frame.getContentPane().removeAll(); dealerTurn = false; playerTurn = 1; canPlayer1DD =true; canPlayer2DD =true; canPlayer3DD =true; canPlayer4DD =true; //create menubar createMenuBar(); // create dealer's label createDealerLabels(); // create ...
340960ee-5888-4600-b93f-1b2340ff5093
5
public static void main(String[] args) { // byte by byte counter int count = 0; InputStream streamReader = null; if (args.length < 1) { System.out.println("Usage: java FileLength <filename>"); // the parameter 0 is interpreted as an indication to the // JVM that the program has terminated with success...
cedf1293-e25b-4519-88b9-b3af21c07e17
8
private void waitIfNeeded() throws StopException{ synchronized(this){ if(breakPoint > 0 && lastLineNum<=breakPoint && lexer.getLineNum()>breakPoint){ breakPoint = -1; numStepsToRun=0; } while(numStepsToRun==0 && !StopRun){ try{ wait(); } catch(InterruptedException e) {} ...
d77cc05e-0d4f-4e89-9013-c3275b538517
4
public Matrix mul(Matrix other){ if(this.getCol() != other.getRow()){ System.out.print("两个矩阵无法相乘!"); System.exit(0); } double[][] res = new double[this.getRow()][other.getCol()]; for(int i=0; i <this.getRow(); i++){ for(int j=0; j<other.getCol(); j++){ double item = 0; for(int m=0;...
dc829712-0170-4772-928e-fd2e5468db1a
7
private void refreshChannel() { synchronized (this) { OutputStream stream = new OutputStream(); stream.writeString(displayName); String ownerName = Utils.formatPlayerNameForDisplay(clanowner); stream.writeByte(getOwnerDisplayName().equals(ownerName) ? 0 : 1); if (!getOwnerDisplayName().equals(ownerName...
a5591a85-26a1-42b0-83e9-6bb2411fcd89
7
public void rotateSelectedAtomsXYBy(Matrix3f transform, BitSet bs, float dx, float dy) { if (rotationMatrix == null) rotationMatrix = new Matrix3f(); if (tempMatrix1 == null) tempMatrix1 = new Matrix3f(); if (tempMatrix2 == null) tempMatrix2 = new Matrix3f(); if (tempMatrix3 == null) tempMatrix3 = n...
6ca426a9-c7a4-43cd-a525-45fc0c233e56
4
public static void analyse() { schedSystem = new SchedSystem(); // CompositionalAnalyzer.PRM(p) // XmlReader.printXmlFile("partitions/partition1.xml"); ArrayList<Partition> partitionList = XmlPartitionParser .parsePartitions(); // CompositionalAnalyzer.PRM(al.get(0)); for (Partition p : partitionList)...
4618c20e-340e-46ee-9b83-6430ad1d7add
4
@Override public boolean isReference(Object obj, String attr, Object value, boolean isWrite) { if (attr.equals("child") && obj instanceof mxChildChange && (((mxChildChange) obj).getPrevious() != null || !isWrite)) { return true; } return idrefs.contains(attr); }
49279d27-3fc6-4773-a688-1909a62b943d
2
private static int parseInt(String s) { int val = -1; if (s != null) { try { val = Integer.parseInt(s); } catch (NumberFormatException e) { val = -1; } } return val; }
8c1a6790-645f-4032-9689-5a0b5559e42f
6
Class310_Sub1(DirectxToolkit class378, int i, boolean bool, int[][] is) { super(class378, Class108.aClass304_1662, Class68.aClass68_1183, bool && ((DirectxToolkit) class378).aBoolean9802, 6 * i * i); anInt6329 = i; if (((Class310_Sub1) this).aBoolean3892) anIDirect3DCubeTexture6330 = ((DirectxToolkit) ...
52fdb3ca-776b-4dc8-8897-485dda71d8bc
7
static Plantation[] placeAllotment( final BotanicalStation parent, final int minSize, boolean covered ) { final World world = parent.world() ; Plantation bestSite[] = null ; float bestRating = 0 ; for (int m = 10 ; m-- > 0 ;) { final Tile t = Spacing.pickRandomTile(parent, 12, worl...
d35d86d0-bb42-4a05-a8f0-fe673bedc1da
7
public void changeState(GameState newState) { switch(newState) { case INITIALIZED: currentState = GameState.INITIALIZED; break; case MAIN_MENU: clear(); actorManager.clear(); currentState = GameState.MAIN_MEN...
f74407c0-73da-4270-adcc-e117ee11cfa2
6
public void set(int i, int j, double value) { if (0 <= i && 0 <= j && i < s.length && j < s.length) { if (i > j) { s[i][j] = value; } else if (i < j) { s[j][i] = value; } } }
2576749a-6834-430c-8e44-d96bdc6bdee1
3
public static void updateBlue() { for (int i = 0; i < bOrgs.size(); i++) { Organism g1 = bOrgs.get(i); g1.move(); for (int j = i + 1; j < bOrgs.size(); j++) { Organism g2 = bOrgs.get(j); if (g1.getDist(g2) < 40) { g1.closeTo(g2); // mating purposes } } }...
0ad00630-807b-47eb-ac77-2aa4f3536859
9
public boolean canFit(int[][] piece,Point corner) { for (int i=0;i<piece.length;i++) { for (int j=0;j<piece[i].length;j++) { int bx=corner.getX()+i; //row int by=corner.getY()+j; //col boolean xInRange=!(bx >= board.length || bx < 0); boolean yInRange=!(by < 0 || by >= board[0].length); i...
d83457ff-9a56-4798-8e17-3da5ed829b9c
8
SearchResultsList search(String field, String string) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { if (field == "strongs") return searchStrongs(string); // determine whether to count from book 1 or book 40, which is of // the New Testament int books...
66d3075f-fb19-4fe3-bb48-45ec4bfa148e
9
public Class<?> getColumnClass(int column) { switch (column) { case 0: return String.class; case 1: return String.class; case 2: return String.class; case 3: return String.class; case 4: return String.class; case 5: return String.class; case 6: if(type.equals("TVSeries")) { retu...
c7afd2d8-2025-474b-8fc0-5f1212273831
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
414f3f10-04a5-40cf-aca5-e96c613abcfc
5
protected void patch_addContext(Patch patch, String text) { if(text.length() == 0) { return; } String pattern = text.substring(patch.start2, patch.start2 + patch.length1); int padding = 0; // Look for the first and last matches of pattern in text. If two different // matches are found, increase the p...
fe93b9fa-b963-44a3-8cfe-0a21fd43b0dd
4
public Car out(Ticket ticket) { Car car = null; for(Park park : this.parkList) { try{ if((car = park.out(ticket)) != null) { return car; } } catch (ParkException e) { } if(car != null) { b...
dccb73fa-51a0-471c-b6c9-a936d8846ece
0
public void invertChecked(int index) { checkedItems[index] = !checkedItems[index]; //别忘了发送event。 CheckListBoxModel model = (CheckListBoxModel) getModel(); model.fireCheckChanged(this, index); this.repaint(); }
feba013c-fafd-4793-a250-aa704dc26cc2
0
public final void setAngleChange(double change) { angleChange = Math.IEEEremainder(change, 360.0); parametersToNumbers.put("angle", new Double(change)); }
ecd98160-7c4d-4a9a-ab2a-f1bb543bf776
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...