method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
68f92de9-a133-4856-82ad-28e8d128dc0d
3
public static void renderSVG(Card card, Graphics2D g) { try { SVGDiagram diagram; if (card == null) { diagram = universe.getDiagram(ImageManager.class.getResource(urlBase + "blank.svg").toURI()); } else { diagram = universe.getDiagram(ImageMa...
f2524fb6-8025-4507-92a0-e6b7f6f030b3
7
private KDNode construct(List<E> c,int depth) throws VariedDimensionException { int length = c.size(); // edge cases if (length == 0) { return null; } if (length == 1) { if (c.get(0).getDimension() != dimension) { throw new VariedDimensionException("ERROR: Input list contained objects with non-ma...
4c565b23-d850-4a76-8ed3-26132d1c24a8
8
public String getNoDiskVMTemplate(String id) { String template = ""; try { ApplianceDescriptor a = idApp.get(id); String vmNetwork = ""; Collection<OVFVirtualNetwork> ns = a.getAssociatedVirtualNetworks(); for (OVFVirtua...
ff9cff7f-8f0e-455f-8706-828312c69b9a
3
public FordFulkerson(FlowNetwork G, int s, int t) { value = 0.0; while (hasAugmentingPath(G, s, t)) { double bottle = Double.POSITIVE_INFINITY; // compute bottleneck capacity for (int v = t; v != s; v = edgeTo[v].other(v)) bottle = Math.min(bottle, edgeTo[v].residualCapacit...
9e4c7a8b-1f6a-4943-91c9-d23c88e74c7c
1
public BigDecimal getValue1(int row, int clums, int sheetat) { BigDecimal value = new BigDecimal(0); String s = null; try { XSSFSheet xSheet = xWorkbook.getSheetAt(sheetat); XSSFRow xRow = xSheet.getRow(row - 1); XSSFCell xCell = xRow.getCell(clums - 1); xCell.setCellType(Cell.CELL_TYPE_STRING); s ...
2d8c566c-dd45-46e2-9100-da4fcce303b5
6
private static void loadAnimations() { File f = new File(Preferences.ANIMATION_PATH); String[] folders = f.list(); String[] files; if (folders != null) { for (String s : folders) { f = new File(Preferences.ANIMATION_PATH + "/" + s); files = f.list(); if (files != null) { ArrayList<Buffere...
5e1f3810-89db-43bb-a2e5-9c3ce18c9edf
3
void start() { while (true) { int random = generateRandomNumber(); prevayler.execute(new NumberStorageTransaction(random)); int randomNumbersSize = numbers.numbersSize(); System.out.println("Random numbers generated: " + randomNumbersSize + "...
bbb12450-2f87-4ccd-a2cc-13a4b1e9b24a
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Contact other = (Contact) obj; if (firstname == null) { if (other.firstname != null) return false; } else if (!firstname.equals(other.fi...
46310535-4f73-4380-80ae-437a65eee96c
9
public int pobierzZListyPozycjiStatkiPrzezID(int aktTrafionyId, Plansza plansza) { Integer[][] x; Integer[][] y; int wynik = 0; int k = 0; int posX; int posY; plansza.otoczenieListaStrzalow.clear(); while (k < plansza.po...
5ac5e848-af7d-4625-b868-005003c73cba
4
protected void render() { final float FADE_TIME = 0.25f ; super.render() ; final Texture realTex = texture ; final float realAlpha = absAlpha ; texture = highlit ; if (amPressed() || amDragged() || amClicked()) { absAlpha *= pressLit ; super.render() ; } if (amHovered()) { ...
ac9a7e32-f8ca-40d1-8574-247a1ba1dbbc
6
@Override public boolean deleteCustomer(Customer customer) { if (doc == null) return false; Element currRoot = doc.getRootElement(); Element parrentCusto = currRoot.getChild("customers"); List<Element> listCusto = parrentCusto.getChildren(); if (customer.getLoanList() != null) for (Loan item : custome...
b158f902-dc7c-40ab-b232-d7bfda06b2d1
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException("JSON does not allow non-finite numbers."); } } else if (o instanceof Float) { i...
3369dc6a-5795-4e11-9086-a272f8db6e86
5
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2) { if (e.getButton() == MouseEvent.BUTTON3) { callSmoothZoom(e.getX(), e.getY(), 1); return; } else if (e.getButton() == MouseEvent.BUTTON1) { callSmoothZoom(...
e83ff41c-5bae-48c3-aaf2-bf447381ef34
9
public int nextNode() { if(m_foundLast) return DTM.NULL; int next; org.apache.xpath.VariableStack vars; int savedStart; if (-1 != m_stackFrame) { vars = m_execContext.getVarStack(); // These three statements need to be combined into one operation. savedStart =...
a1f7f614-f07e-4809-8cac-4aad0f581de0
5
private void parseDocument() { //get a factory SAXParserFactory spf = SAXParserFactory.newInstance(); try { //get a new instance of parser SAXParser sp = spf.newSAXParser(); //parse the file and also register this class for call backs try { sp.parse(xmlfile, this); } catch(F...
68179439-cf69-494c-9c43-4c57e4fb8ecd
9
public void deleteEntry() { if (isOnline) { getListOfEvents(false); System.out.println("Which entry do you want to delete? Input the number."); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String numberOfLine = null; try { ...
16120d95-7bbc-451b-bffb-c5ab151875de
2
public void removerAdmin(String nick){ try{ if(getAdmin().getPassword().equals(Login.getPasswordOculta())){ admins.remove(buscarAdmin(nick)); System.out.println("Se ha borrado exitosamente."); } }catch(Exception err){ System.out.println("No se ha encontrado."); } }
77aba09d-5cc2-4f5c-a352-27df6bd2c551
9
public void drop(DropTargetDropEvent e) { UIManager.put("OptionPane.background", Color.WHITE); UIManager.put("Panel.background", Color.WHITE); Transferable tr = e.getTransferable(); DataFlavor[] flavors = tr.getTransferDataFlavors(); File file; for (int i = 0; i < flavors.length; i++) { if (flavors[i].is...
197a5476-46f4-446b-9ca0-6576bb8b7521
7
private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MouseClicked // TODO add your handling code here: boolean cambios = true; String contenidoEditor = Editor.getText(); String contenidoArchivo = ""; if(nombreArchivo != null){ ...
9a93312e-e9e8-45cb-945d-c92008b745b2
2
private boolean const_decl_id() { if( is(TK.ID) ) { boolean ret; if (ret = symtab.add_entry(tok.string, tok.lineNumber, TK.CONST)) { gcprint("int "); gcprintid(tok.string); } scan(); return ret; } else { ...
06012e2a-f226-4008-b85c-ad4e7c2de1c4
6
@Override public void mouseClicked(final MouseEvent e) { if (e.getSource() instanceof CellPanel && type != 42 && color != 42) { for (int y = 0; y < Board.Y; y++) { for (int x = 0; x < Board.X; x++) { if (((CellPanel) e.getSource()).getCell() == game.getBoard().getCell(x, y)) { client.doHumanMove(x...
25db5ef3-5eb2-4d91-8cfa-b355da9eec0a
5
@Override protected void addActualItem(Class<? extends Item> genericItem) { super.addActualItem(genericItem); Item item = null; try { item = genericItem.newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessExc...
738a77d4-223b-4882-8ed5-729b1a4a301f
5
@Override public void shoot(Spieler gegner) { boolean invalidInput = true; String input = null; ausgabe.printSeparator(); System.out.println("Geben sie das Ziel an: x,y"); // Einleseschleife while (invalidInput) { try { input = eingabe.getUserInput(); } catch (Exception e) { e.printStackTr...
e3b43bdf-413d-4fa9-be78-40e546e7e480
1
public Object get(int index) throws JSONException { Object object = this.opt(index); if (object == null) { throw new JSONException("JSONArray[" + index + "] not found."); } return object; }
39b4db33-daeb-4892-a190-a6cc15c88bf6
5
public UmlDiagramData readXml( XElement xdiagram, UmlDiagramConverter converter ){ UmlDiagramData diagram = new UmlDiagramData(); diagram.setNextUnqiueId( xdiagram.getElement( "next-unique-id" ).getInt() ); XElement xitems = xdiagram.getElement( "items" ); for( XElement xdata : xitems ) { switch( xdata.getN...
d98862aa-794f-4e59-9964-41e5b86ac58b
3
public String toString() { Enumeration<?> enm; StringBuffer result; result = new StringBuffer(); enm = elements(); while (enm.hasMoreElements()) { result.append(enm.nextElement().toString()); if (enm.hasMoreElements()) result.append(","); } return result.toString(...
fb183012-fa10-409f-8a63-605230307cd2
8
private int handleT(String value, DoubleMetaphoneResult result, int index) { if (contains(value, index, 4, "TION")) { result.append('X'); index += 3; } else if (contains(value, index, 3, "TIA", "TCH")) { result.append(...
fa01f94c-2e97-4d6b-b906-b9c6dc26212f
1
public void queueOver(int r, int c) { if (p2u != null) { core.GroupOfUnits unit = p2u.get(r, c); updateStats(unit); } }
a1aedcca-dac1-457c-9f58-1aa5a362439f
1
public String optimizeAt(String in, int level){ for(int i=0;i<level;i++) in = this.optimize(in); //in = this.optimizeOneTime(in); return in; }
45b1c812-a63d-429e-bbe8-12da57b49763
6
public void run() { long timer = System.currentTimeMillis(); long lastTime = System.nanoTime(); double delta = 0; final double NS = 1000000000. / 60.; requestFocus(); Sound.MUSIC_MENU.play(true); while(running){ updated = false; long now = System.nanoTime(); delta += (now - lastTime) / NS; ...
6e5248fd-1e59-475f-96c6-8ca57a9490f6
9
public static void quick_srt(int array[], int low, int n) { int lo = low; int hi = n; if (lo >= n) { return; } int mid = array[(lo + hi) / 2]; while (lo < hi) { while (lo < hi && array[lo] < mid) { lo++; } while (lo < hi && array[hi] > mid) { hi--; } if (lo < hi) { int T = arra...
0ebf4c49-f722-4f8c-9145-b467ae2252cb
0
public boolean shouldProceed() { return this.shouldProceed; }
15146a85-656d-415e-a5d6-3a604c2acd78
8
public void run() { //This method keeps listening the socket Message message; Task task = null; long time = -1; while(menager.hasMessage()){ try { System.out.print("message comming\n"); message = (Message) input.readObject(); if(message != null){ if(message instanceof ServerStatusMessag...
d54b48ff-0e3b-4722-9c3f-8097f610acc0
0
public Footer() { initComponents(); }
f4b8809f-85dd-47ab-9fc1-d493d1a61500
3
public JSONArray toJSONArray(JSONArray names) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (int i = 0; i < names.length(); i += 1) { ja.put(this.opt(names.getString(i))); } re...
c4d38bc2-0a52-4330-ae6a-146ee30566bc
3
public void append(String str) { int newsize = this.size + str.length(); // If there's insufficient capacity, make a new array if (newsize >= this.contents.length) { char[] oldcontents = this.contents; this.contents = new char[computeNeededCapacity(newsize)]; for (int i = 0;...
19cb474c-38e4-49bf-b04a-0d0551aa8ef2
3
public HungarianAlgorithm(double[][] costMatrix) { this.dim = Math.max(costMatrix.length, costMatrix[0].length); this.rows = costMatrix.length; this.cols = costMatrix[0].length; this.costMatrix = new double[this.dim][this.dim]; for (int w = 0; w < this.dim; w++) { if (w < costMatrix.length) { if (costM...
d40a3f9c-9128-40a9-a037-9f08d26fccf1
9
public Function computeFirstDerivative() { if (mFunctionTerms == null) { throw new IllegalStateException( "mFunctionTerms is null - Did you forget to override computeFirstDerivative()?"); } int termSize = mFunctionTerms.size(); Function deriv = new Function(new ArrayList<FunctionComponent>()); List<F...
2e74fcd4-d070-4ff2-9bd3-5f2e13e0d772
9
private void processFiles(Connection dbConnection) { logger.info("Polling for files that need processing..."); try { PreparedStatement s = dbConnection.prepareStatement("SELECT * FROM files WHERE ready_for_processing=1 AND process_state=0 AND ready_for_delete=0 AND (session_id IS NOT NULL OR in_use=1) AND (he...
6a405cc5-0986-4724-836c-a465ed3f77a1
5
public static double pearsonsCorrelatrion(double[] obs, double[] sim, double missingValue) { sameArrayLen(obs, sim); double syy = 0.0, sxy = 0.0, sxx = 0.0, ay = 0.0, ax = 0.0; int n = 0; for (int j = 0; j < obs.length; j++) { if (obs[j] > missingValue) { ax ...
fb66302e-1711-4fae-8300-619be3769037
1
protected void createTeleport() { if (isTeleport) { teleport.resetDuration(); } isTeleport = true; teleport.setLocations(ball); }
b131b86f-1ee3-488a-a96e-98aa6c99f0f4
5
public ShopEvent createEvent(Node n, int value) { String name = ""; String res = ""; Node attr = n.getFirstChild(); while(attr != null) { if(attr.getNodeType() == Node.ELEMENT_NODE) { if(attr.getNodeName().equalsIgnoreCase("Name")) { ...
8446583f-4c3a-46cb-8d7e-8659b8012165
8
void FormalParameters(ProcedureBuilder pb) throws Exception { if (Current_Token != Token.TOK_OPAREN) { throw new Exception("Opening Parenthesis expected"); } GetNext(); ArrayList lst_types = new ArrayList(); while (Current_Token == Token.TOK_VAR_BOOL ...
bef4ddd3-1bbb-4891-83c7-603597eb5466
3
@SuppressWarnings({ "deprecation", "unused" }) public static void setBar(Location origin, int length, int height) { //origin.getBlock().setTypeIdAndData(35, (byte) 5, true); Location loc10 = new Location(Bukkit.getWorld("COC"), origin.getX()+10, origin.getY(), origin.getZ()); int currentlength = 0; while(cu...
09b6d6e3-1911-4f39-9738-dbf95d751995
5
@Override protected void startMaster(StartMaster startMaster) { try { super.startMaster(startMaster); StartMasterVcf startMasterVcf = (StartMasterVcf) startMaster; vcfFileIterator = new VcfFileIterator(startMasterVcf.vcfFileName); vcfFileIterator.setParseNow(parseNow); // Show header if (showHeade...
7530349b-bff0-4f7b-aaa9-207a9e763157
7
@Override public boolean equals(Object o) { if (!(o instanceof ImageInfo)) { return false; } ImageInfo ii = (ImageInfo) o; if (width != ii.width || height != ii.height) { return false; } else if (clip != null && ii.clip != null) { return ...
ec4a4fd5-860e-4754-95c6-48cc171c2c84
8
public boolean save(String key, InputStream in) { if (in == null) return false; OutputStream out = null; File file = null; try { file = DiskUtils.getCacheFileForName(mAppContext, key); file.getParentFile().mkdirs(); out = new FileOutputStream(file); ...
b02b733a-4f9f-431c-84c9-207a9ded90a7
5
public static int floatToShortBits( float fval ) { int fbits = Float.floatToIntBits( fval ); int sign = fbits >>> 16 & 0x8000; // sign only int val = ( fbits & 0x7fffffff ) + 0x1000; // rounded value if( val >= 0x47800000 ) // might be or become NaN/Inf { ...
73b54539-dc5f-4f5c-804c-9dbedad8c528
4
public void visitTryCatchBlock(final Label start, final Label end, final Label handler, final String type) { checkStartCode(); checkEndCode(); checkLabel(start, false, "start label"); checkLabel(end, false, "end label"); checkLabel(handler, false, "handler label"); checkNonDebugLabel(start); checkNonDe...
f9fcbd39-c704-429f-8ef9-0325e0991f98
5
private boolean isInRect(){ if(mouse == null) return false; int x = mouse.x; int y = mouse.y; if(x > getxPos() && x < (getxPos() + width)){ if(y > yPos && y < (yPos + height)){ return true; } } return false; }
a7f4980d-0090-4e5a-b5cf-890807ad43a1
2
public void setPassengerCarsCnt(int passengerCarsCnt) throws OutOfRangeException { if (( passengerCarsCnt < 0 )&&( passengerCarsCnt > MAX_PASSENGERCARS_CNT )) { logger.error("incorrect passengerCarsCnt argument: " + passengerCarsCnt); throw new OutOfRangeException(); } this.passengerCarsCnt = passengerCarsC...
7c546c7b-9f6a-4311-addc-4233a8711b62
8
public ArrayList<ArrayList<Integer>> zigzagLevelOrder(TreeNode root) { // Start typing your Java solution below // DO NOT write main() function ArrayList<ArrayList<Integer>> resArr = new ArrayList<ArrayList<Integer>>(); if (root == null) return resArr; ArrayList<TreeNode> tmp = new ArrayList<TreeNode>(); ...
1143b048-bf4e-47ae-a0ef-b504a0b6f92f
9
public static PDFDecrypter createDecryptor (PDFObject encryptDict, PDFObject documentId, PDFPassword password) throws IOException, EncryptionUnsupportedByPlatformException, EncryptionUnsupportedByProductException, PDFAuthenticationFailureException ...
b5d77bd2-37f2-4b4f-87f8-1866341d5762
4
public void run() { while(threadSocket != null && !socket.isClosed()) { try{ Message message = (Message) reader.readObject(); message.setIp(socket.getInetAddress().getHostAddress()); message.setPort(socket.getPor...
a21aa494-1025-45d6-aea2-d1793b701f12
8
public static void LoadSettings() { File f = new File ("ue.ini"); if (!f.exists()) { CreateDefaultSettings(); } else { try { FileReader in = new FileReader("ue.ini"); BufferedReader br = new BufferedReader(in); String currentLine = ""; while( (currentLine = br.readLine()) != n...
210041f9-d627-4e3c-804f-ffea127adfca
3
public static String localXpath (Node node) throws DOMException { String localname = node.getLocalName(); if (null == localname) { throw new DOMException(DOMException.NOT_FOUND_ERR, "DOM Node doesn't have a local name!"); } else { int position = 1; No...
ae49d8dc-598b-4157-85d8-678ec9e60f5f
7
public String decrypt (String input) { if(input.matches(".*\\d.*")) throw new IllegalArgumentException(); String formatted = input.toUpperCase().replaceAll("[^A-Z]", ""); if(formatted.length() == 0) throw new IllegalArgumentException(); char[] characters = formatted.toCharArray(); char[][] Table5x5 = _makeTable5x...
f3cde5c1-3e6f-4bab-9f84-66b9e94005b6
2
public void setPasswordButtonBorderthickness(int[] border) { if ((border == null) || (border.length != 4)) { this.buttonPW_Borderthickness = UIBorderthicknessInits.PW_BTN.getBorderthickness(); } else { this.buttonPW_Borderthickness = border; } somethingChanged();...
5a216c55-0725-47ce-99c2-1ce8c81d98ca
7
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String action = request.getParameter("act"); String login = request.getParameter("login"); String pass = request.getParameter("pass"); try { RequestContext conte...
10491d18-7bb1-4f94-9249-581d374a9d8a
8
public TexturePortalFX() { super(Block.portal.blockIndexInTexture); Random var1 = new Random(100L); for (int var2 = 0; var2 < 32; ++var2) { for (int var3 = 0; var3 < 16; ++var3) { for (int var4 = 0; var4 < 16; ++var4) { ...
ba607b2a-02e2-4495-b8e6-fb0b51135838
5
private void findParent_knn(double[] target, KDNode node, int d) { // If the node would be inserted in the branch "below" if(target[d] < node.values[d]){ if (++d == dimensionCount) { d = 0; } if(node.below == null){ tryToSave(node, target); return; } tryToSave(node.below, target); f...
fcd57e20-6fe3-44f9-912d-af43ecfb869b
7
public static void checkRank(Player player) { int kills = player.getKillCount(); for (int i = 0; i < ranks.length; i++) { PkRank rank = ranks[i]; if (rank == null) break; if (rank.username.equalsIgnoreCase(player.getUsername())) { ranks[i] = new PkRank(player); sort(); return; } } fo...
02ae603c-4f30-43da-82a0-4a0fa850b55a
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; GenericDTO other = (GenericDTO) obj; if (codigo != other.codigo) return false; return true; }
0ffbef7f-330e-467c-a5e0-8ed477c2612a
2
public String Decrypt(String ctext) { BigInteger c = new BigInteger(ctext, 16); BigInteger m = this.DoPrivate(c); if (m.equals(Zero)) { return null; } byte[] bytes = this.pkcs1unpad2(m, this.GetBlockSize()); if (bytes == null) { return null; } return new String(bytes); }
0c2d2b30-2278-4505-8def-65d10a59e1f8
6
public void tabDragging(TabButton draggingTab){ if(getMousePosition() == null){ return; } int w = getMousePosition().x; draggingTab.setLocation(w-draggingTab.dragXOffset, draggingTab.getLocation().y); dropHighlightInfo.visible = true; dropHig...
e3739e34-3e5c-4f8c-a476-6ce11a8d00e5
1
public void setSave(final Expr expr, final boolean flag) { if (SSAPRE.DEBUG) { System.out.println(" setting save for " + expr + " to " + flag); } saves.put(expr, new Boolean(flag)); }
a9622b74-d382-4783-9173-13415f2db3bd
4
@EventHandler(priority = EventPriority.NORMAL) public void onPlayerKick(final PlayerKickEvent event) { if (event.isCancelled() || event.getLeaveMessage() == null) { return; } for (final IRCChannel c : Variables.channels) { if (!c.getBlockedEvents().contains("game_kick...
17d2cf59-ccb9-4571-b40a-a52f505a607a
9
public void writeTo(DataOutput dout) throws IOException { // Write out the size (number of entries) of the constant pool. int size = getSize() + 1; // add one because constant 0 is reserved if (size >= 65535) { throw new RuntimeException ("Constant pool entry count c...
cc82b58e-db75-4958-8b8f-c12a4512952b
8
void handleFocus(int type) { switch (type) { case SWT.FocusIn: { if (hasFocus) return; if (getEditable()) text.selectAll(); hasFocus = true; Shell shell = getShell(); shell.removeListener(SWT.Deactivate, listener); shell.addListener(SWT.Deactivate, listener); Display display = getDispla...
b7085ff0-cef9-498e-afd9-e1bf84e01932
3
public HttpRequest(String path, InputStream inputStream, OutputStream outputStream, int postIndex, Map<String, List<String>> headers) { this.inputStream = inputStream; this.outputStream = outputStream; this.postIndex = postIndex; this.headers = headers; try { this.url...
d4373067-a8c2-4056-8020-72a05d74cd9c
4
public Transaction oldesttransactionLockOnVar(int index) { List<Transaction> transactionsLockOnVar = new ArrayList<Transaction>(); for (Transaction t: locks.keySet()) { ArrayList<Lock> lockListT = locks.get(t); for (Lock lock: lockListT) { if(lock.getIndex()==index) { transactionsLockOnVar.add(t); ...
475e73dc-0a5c-478f-b6dc-d3d2849f2aa4
8
public ControllerNode(int _ControllerId, Config config, String jobConf) throws IOException, ParseException { controllerId = _ControllerId; primary = config.getController(_ControllerId).isPrimary(); JsonParser parser = new JsonParser(jobConf); workerNum = safeLongToInt(parser.parseWorker...
214e8f7d-d7c9-4311-8fe5-03d4ef029f22
2
public boolean remove(int codigo) { boolean status = false; Connection con = null; PreparedStatement pstm = null; try { con = ConnectionFactory.getConnection(); pstm = con.prepareStatement(REMOVE); pstm.setInt(1, codigo); pstm.execute(); ...
93c65791-27b1-417d-8069-8ccb7b676964
3
public Transition getOutgoingTransition (State toState) throws NoSuchTransitionException { Transition trans = null; for(Transition t:outgoingTransitions) { if (t.getToState() == toState) { trans = t; break; } } if(trans == null) ...
a6901bed-2967-4a7c-a269-ca8d7dc8c7de
8
public Particle getParticle(PhysicsEvent event){ try { if(particleID==5000) return event.beamParticle(); if(particleID==5001) return event.targetParticle(); if(particleType.compareTo("-")==0){ Particle fromEvent = event.getParticleByCharge(-1,particleSkip);...
16fb6e9b-2184-4efd-95e7-c652cdfefb6d
4
public void readFile() throws IOException { try{ FileInputStream fstream = new FileInputStream("dataIn.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; int me...
8ed5fdd3-5eee-4fd0-a3b2-bea52913d3da
7
public boolean doReadPackage() { boolean result = true; try { mBis.reset(); int len = 0; int totalLen = 0; while ((len = mSocketChannel.read(mBuffer)) > 0) { totalLen += len; } if (totalLen > 0) { mBuffer.flip(); // important mBuffer.get(mData, 0, totalLen); ObjectInputStream ...
c7be955a-5c42-4aae-860b-5facf5673414
5
public static void write(Matrix matrix, String path) throws MatrixIndexOutOfBoundsException { int rows = matrix.getRowsCount(); int cols = matrix.getColsCount(); BufferedWriter buffer = null; long startTime = System.currentTimeMillis(); try { buffer = new Buffered...
c81f0ec8-3f2f-46ae-97cc-2db4427f3147
6
public void init( StorageTable directories, WorkBookHandle wbh ) throws StorageNotFoundException { Storage child = directories.getChild( "_SX_DB_CUR" ); if( wbh != null ) { caches = new HashMap(); book = wbh.getWorkBook(); } while( child != null ) { if( wbh != null ) { caches.put( Integer....
c700d5ef-53f4-4a23-9f5b-08ae55406584
3
public static int getMouseButtonCode(MouseEvent e) { switch (e.getButton()) { case MouseEvent.BUTTON1: return MOUSE_BUTTON_1; case MouseEvent.BUTTON2: return MOUSE_BUTTON_2; case MouseEvent.BUTTON3: return MOUSE_BUTTON_3; ...
ebf49d66-b205-46c4-9af3-2c78dcf83596
2
private boolean jj_3R_76() { Token xsp; xsp = jj_scanpos; if (jj_3_17()) { jj_scanpos = xsp; if (jj_3_18()) return true; } return false; }
6b7f6036-e80f-4c2b-9d44-1ee3f9605b7f
5
public String getStringLine(int n,int largeur) { String toRet = ""; if(n>getHauteur()-1) { for(int i = 0; i < (largeur-1)/2 ; i++) { toRet+=" "; } toRet+="|"; for(int i = 0; i < (largeur-1)/2 ; i++) { toRet+=" "; ...
3eeefdad-91aa-4556-884e-49cc2ed52d28
8
public static java.util.List doit(String[] args) { try { // Check to see whether there is a provider that can do TripleDES // encryption. If not, explicitly install the SunJCE provider. try { Cipher c = Cipher.getInstance("DESede"); } catch (Exception e) { // An exception he...
0041b9f0-3861-4dea-9ce8-157e304e07d1
7
public void render(GameContainer container, Graphics g) { g.setFont(container.getDefaultFont()); float val = 1.00f - (isActive() ? (Board.mouseButtons.isDown(0) ? 0.20f : 0.10f) : 0.00f); int offset = (isActive() ? (Board.mouseButtons.isDown(0) ? 1 : 0) : 0); g.drawImage(buttonImage, getX() + 1, getY() + ...
c5fa75b9-6be3-447f-8e09-4d3ac981d7d0
1
public static byte[] toByte(String hexString) { int len = hexString.length()/2; byte[] result = new byte[len]; for (int i = 0; i < len; i++) result[i] = Integer.valueOf(hexString.substring(2*i, 2*i+2), 16).byteValue(); return result; }
69c13159-75cb-48b3-8fb0-f2451f0279b7
5
public String guiPressed(String button) { guiPressed = button; if(inBattle) { if(button.equals("hitFace") || button.equals("hitSholder")) { return Battle(button); } if(button.startsWith("inv") && !(inventory.getItem(getInt(button) - 1) == null)) { return Battl...
a2b983d3-9cb5-41fb-996f-94b573d722bb
0
@Override public String toString() { return "Section "+id+" of "+parent.toString(); }
e06c1536-f4b4-40a5-af54-584e97ce409c
2
public static Inventory decodeString(String encoded) { YamlConfiguration configuration = new YamlConfiguration(); try { configuration.loadFromString(Base64Coder.decodeString(encoded)); Inventory i = Bukkit.createInventory(null, configuration.getInt("Size"), StringUtil.limitCharac...
c0dcdadc-854d-4c34-a8f1-080ee59512a3
4
public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_A) { dx = 0; } if (key == KeyEvent.VK_D) { dx = 0; } if (key == KeyEvent.VK_W) { dy = 0; } if (ke...
4b0ac27e-ee7e-4390-a610-7fa24094e85b
5
final Class299 method3706(Class299 class299, Class299 class299_24_, float f, Class299 class299_25_) { try { anInt9873++; if (f < 0.5F) return class299; return class299_24_; } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929 (runtimeexception, ...
706716f3-a049-4716-a812-3c414bf85941
8
public static void kFoldValidation(double data[][],int k,ProbabilityOptions options) { int interval = data.length / k; double[][] results = new double[k][4]; ArrayList<ArrayList<double[]>> partitionedData = new ArrayList<ArrayList<double[]>>(); Classifier cl; double fScore = ...
950322de-a624-4e5b-8b06-b0c01c2efec3
4
public static void main(String[] args){ if (args.length != 1){ throw new RuntimeException("invalid number of arguments. Must receive one argument specifying working directory!!!"); } workingDir = args[0].replace("\\", "/"); if (workingDir.charAt(workingDir.length() - 1) != '/') workingDir += '/'; ...
dfecf9e5-27c3-44ab-8092-c2026213f30f
8
public void sendMessage(String channel, String message, boolean sanityCheck) { if(espanol && !message.startsWith("Activated on ")) { message = Translator.getInstance().translate(message, Language.ENGLISH, Language.SPANISH); espanol = false; } if(isTeamSpeak) { if(channel.equals("#pringers")) { for...
9d7f39d8-3336-4df7-ada4-90087d7d958e
7
public String deltalogin(){ System.out.println("111 Userbean "); String returnValue="login"; //default if((username != null )&& ( pw!= null) && (newpw!=null) ){ System.out.println("116 Userbean "); String strSQL; DBResults rs=null; strSQL= "call loginCheck('"+ usern...
267ca259-9df0-43a1-a7fa-89cc06218fa6
4
public static Suit getSuit(String suit) { switch(suit.toLowerCase()) { case ("s"): return Spades; case ("h"): return Hearts; case ("d"): return Diamonds; case ("c"): return Clubs; default: throw new RuntimeException("what suit is this?!"); } }
e57ac95e-a2ab-4540-97f0-6cb04f01e05f
2
public boolean matchesSub(Identifier ident, String name) { for (int i = 0; i < matchers.length; i++) { if (matchers[i].matchesSub(ident, name) == isOr) return isOr; } return !isOr; }
61ebf518-dd77-4a4a-bf5c-cd5c8e08b465
7
@Override protected boolean isValidNonDropMove(GameState state, int x, int y) { /* Checks if the target tile is 2 tiles in front * and one to the side. * Then verifies if the target tile is still in the board, * and whether the target tile could be moved into. * */ ...
4ddef974-1417-44d5-aba3-ce48326a9f8a
9
* @param bestMUM the best MUM at the start. may be a transposition * @throws Exception */ void mergeSpecial( Graph g, MUM bestMUM ) throws Exception { TreeMap<SpecialArc,Graph> specials = new TreeMap<SpecialArc,Graph>(new SpecialComparator()); while ( bestMUM != null ) { if ( bestMUM.verify() ) { ...
80a4e6e7-5e4c-4be3-8240-079d44a8d0bb
8
public synchronized void startElement(String uri, String localName, String qName, Attributes attrList) throws SAXException { ElementImpl elem; int i; String tagName = getName(qName, localName); if ( tagName == null ) throw new SAXException( "HTM004 Arg...
e969caec-68d1-497b-9445-167c48c52db7
3
public ListNode reverseKGroup(ListNode head, int k) { if(k <= 1) return head; ListNode dummy = new ListNode(0); dummy.next = head; ListNode p = dummy; ListNode f = dummy; int i = 0; while(f.next != null){ f = f.next; if(++i % k ==0){ ...