text
stringlengths
14
410k
label
int32
0
9
private static Population[] generate(){ Population[] h = new Population[GLOBAL_STEPS]; operationCounter = new double[OPERATIONS_NUMBER]; for (int pop = 0; pop < GLOBAL_STEPS; ++pop){ h[pop] = new Population(populationSize, individualSize); } resultsRandom = new double...
5
@Test public void runTestActivityLifecycle4() throws IOException { InfoflowResults res = analyzeAPKFile("Lifecycle_ActivityLifecycle4.apk"); Assert.assertEquals(1, res.size()); }
0
public List<Integer> returnIntsFromStart (int start) { List<Integer> listI=new ArrayList<Integer>(); BitSet bset=new BitSet(); int a,bcount=0; for (a=start;a<totalLength;a++) { if (this.get(a)==true) bset.set(bcount); else bset.clear(bcount); bcount++; if (bcount==8) { listI.add(binaryToInt8(bse...
3
public InsertStatus insertFromBuffer(ItemStack[] buffer) { if (isFull()) return InsertStatus.FAIL; for (ItemStack is : buffer) { if (is == null || is.stackSize == 0) continue; InsertStatus i = insert(is, false); switch (i) { case FAIL: case PARTIAL: return InsertStatus.PARTIAL; case SUC...
7
@Override public int compareTo(Track o) { int artistcompare = this.get("artist").compareToIgnoreCase(o.get("artist")); if(artistcompare == 0) { try { int albumcompare = this.get("album").compareToIgnoreCase(o.get("album")); if (albumcompare == 0) { ...
6
public static void main(String[] args) { RecursionFb fb = new RecursionFb(); System.out.println(fb.fbMethod(4)); }
0
private void drawChunks(int x0, int y0, int width, int height, Graphics2D gI) { for (int x = (int) ((x0-.0)/Chunk.getPixelLength()-0.5); x <= Math.ceil(((double)x0+width)/Chunk.getPixelLength()); ++x) { for (int y = (int) ((y0-.0)/Chunk.getPixelLength()-0.5); y <= Math.ceil(((double)y0+height)/Chunk.getPixelLen...
7
@Override public void addProduct(Product product) throws SQLException { Session session=null; try{ session=HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.save(product); session.getTransaction().commit(); }catch(Exception e){ e.printStackTrace(); }finally{ ...
3
double tryGetProfit(Match m) { double total = 0; if ((total = makeTotalPredict(m)) < 0) { return 0; } return m.betLine.getProfit(total, m.score.total, eps1, eps2); }
1
public Sha1Hash (byte[] bytes) { if (bytes == null) { throw new NullPointerException(); } if (bytes.length != 20) { throw new IllegalArgumentException(); } this.bytes = Arrays.copyOf(bytes, bytes.length); hash = Arrays.hashCode(bytes); ...
5
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...
9
public int getImageIndex() { if (type.equalsIgnoreCase("red")){ return 6; } else if (type.equalsIgnoreCase("blue")){ return 7; } else if (type.equalsIgnoreCase("dark")){ return 8; } else if (type.equalsIgnoreCase("blank")){ return 9; } else if (type.equalsIgnoreCase("darkRed")){ return 10; } ...
6
private int MakeThem(Commande data) throws InterruptedException { int nbRatees = 0, nbFaites = 0; TypePiece tp = Commande.TypePiece.valueOf(data.GetPiece()); Random r = new Random(); while (nbFaites < data.GetNbrPieces()) { if (r.nextInt(5) == 3) nbRa...
2
static void tuneAll(Instrument[] e) { for (Instrument i : e) tune(i); }
1
@Override public String toString() { String words = ""; for (Map.Entry<String, Integer> entry : countWords.entrySet()) { words += entry.getKey() + " - " + entry.getValue() + "\n"; } String extractedSentences = ""; for (String sentence : sentences) { e...
2
public boolean isEmpty() { if (hasNoGold() && hasNoWumpus() && hasNoPit()) return true; return false; }
3
private void checkFormatting(int lineNumber, String line, String[] partsToCheck) throws Exception { String baseMessage = "On line " + lineNumber + ": Invalid formatting found - "; String pFound = findIllegalPunctuation(line); if (pFound != null) { throw new Exception(baseMes...
8
@Override public void repaint(TextGraphics graphics) { border.drawBorder(graphics, new TerminalSize(graphics.getWidth(), graphics.getHeight()), title); TerminalPosition contentPaneTopLeft = border.getInnerAreaLocation(graphics.getWidth(), graphics.getHeight()); TerminalSize contentPaneSi...
3
public boolean checkStatus(User user) throws BusinessException { boolean canAccess = false; // O usuário foi autenticado com sucesso e se encontra ativo. if(User.STATUS_ATIVO == user.getStatus()) { canAccess = true; } else if(User.STATUS_BLOQUEADO == user.getStatus()) { // Caso o usuário esteja bloquea...
3
public Movie[] load() throws Exception { Movie[] finalResult = new Movie[0]; if (!Session.hasKey("LoggedUser")) { throw new Exception("User is not authorized"); } if (Session.hasValue("LoggedUser", "admin")) { XmlDocument xmlMovies = loadXml(); ArrayL...
6
public boolean isOnPoint(double mx, double my) { if (locked) { mx = (mx - (x - graph.canvas.offX) / graph.canvas.zoom) * Math.sqrt(graph.canvas.zoom) + (x - graph.canvas.offX) / graph.canvas.zoom; my = (my - (y - graph.canvas.offY) / graph.canvas.zoom) * Math.sqrt(gra...
4
public void updateTileBar(ArrayList<Integer> pages, Color c, int RedGreenOrBlue){ for(int i = 0;i < pages.size(); i++){ if(pointersToRecolors[pages.get(i) - startingPage] == null){ addPortion(pages.get(i)-startingPage, c); } else { Color currentPanelColor = pointersToRecolors[pages.get(i) - starti...
8
private static String byteToHex(byte[] messageDigest) { StringBuilder buf = new StringBuilder(); for (byte b : messageDigest) { int halfbyte = (b >>> 4) & 0x0F; int two_halfs = 0; do { buf.append( (0 <= halfbyte) && (halfbyte <= 9) ? (char) ('0' + halfbyte) : (char) ('a' + (halfbyte - 10))); ...
4
public synchronized int bytesCompleted(){ int num = 0; for(Integer k : this.blocks.keySet()){ Block b = this.blocks.get(k); if(b != null) num += b.getLength(); } return num; }
2
public void angleDistanceBeforeStarted() { if (score <= -anglebow.angle*5 || score <= 600 + anglebow.angle*5) { if (score < -anglebow.angle*5) { flydot.y += FLYDOT_JUMP_VY; } else if (score > -anglebow.angle*5) { flydot.y += 1; } } if (score <= 600 + anglebow.angle*5 || score <= -anglebow.a...
8
@Override public String stringify(int level) { ArrayList<String> strArray = new ArrayList<String>(); int width = 0; for (int i = 0; i < length; ++i) { JSON obj = mapArray.get(i); String strJSON; if (obj == null) strJSON = "null"; else strJSON = obj.stringify(level + 1); width += strJSON...
9
private final void method2333(BufferedStream buffer, int i, int i_8_) { anInt9517++; if ((i_8_ ^ 0xffffffff) != -2) { if ((i_8_ ^ 0xffffffff) == -3) { int i_9_ = buffer.readUnsignedByte(); anIntArray9522 = new int[i_9_]; for (int i_10_ = 0; (i_10_ ^ 0xffffffff) > (i_9_ ^ 0xffffffff); i_10_++) an...
9
private void checkWater() { if(this.water >= 10){ this.water = 10; this.waterStatus = "Fulness"; this.isAlive = true; } if(this.water < 10 && this.water >= 7){ this.waterStatus = "Dursty"; this.isAlive = true; } if(this.water < 7 && this.water > 2){ this.waterStatus = "Very Hungry"; this...
7
@Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { if (args.length == 0) { Main.courier.send(sender, "requires-argument", "message", 0); return false; } final String text = Add.join(args, "...
5
private static void updateMaps () { for (int i = 0; i < mapPanels.size(); i++) { if (selectedMap == i) { String packs = ""; if (Map.getMap(getIndex()).getCompatible() != null) { packs += "<p>This map works with the following packs:</p><ul>"; ...
5
public boolean addPolyNode(int coefficient, int exponent){ //Check to see if exponent is a positive number(-1 = no exponent) if(exponent < -1) throw new IllegalArgumentException("Exponent must be a positive" + " integer."); //Check to see if Polynomial is empty ...
4
@Override public void documentRemoved(DocumentRepositoryEvent e) {}
0
public static byte[] encryptSecretKey(SecretKey sk,PublicKey pk) { try { Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, pk); return cipher.doFinal(sk.getEncoded()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(...
5
public static KAryTreeNode<Integer> genRandomIntegerKAryTree(int k, int treeNodeCount, boolean full) { Random random = new Random(); KAryTreeNode<Integer> root = new KAryTreeNode<Integer>(random.nextInt(1000), k); int currNodeCount = 0; Queue<KAryTreeNode<Integer>> queue = new LinkedList<KAryTreeNode<Integer...
9
public static int countNeighbours(boolean[][] world, int col, int row) { int c = 0; if (getCell(world, col - 1, row - 1) == true) { c += 1; } if (getCell(world, col, row - 1) == true) { c += 1; } if (getCell(world, col + 1, row - 1) == true) { c += 1; } if (getCell(world, col - 1, row) == true)...
8
private void parseAndAddBiomes(Collection<ParameterNode> nodes) throws Exception { for (ParameterNode p : nodes) { if (!p.isGroup()) { continue; } ParameterGroup g = (ParameterGroup) p; Logger.getLogger(WorldGenerator.class.getName()).log(Level.SEVERE, g.toString()); if (!g.hasChild("colo...
5
public boolean isPrimitive() { if (this.type.equals("void")) { return true; } else if (this.type.equals("byte")) { return true; } else if (this.type.equals("char")) { return true; } else if (this.type.equals("double")) { return true; ...
9
private void setLookAndFeel() { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (UnsupportedLookAndFeelException e) { // handle exception } catch (ClassNotF...
6
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { JFrame frame = new JFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
1
public static String rexecute(String command, String success, String failure){ //Queries the data class for login credentials. The data class directly queries //A local embedded database for the information. String username = data.getUser(); String hostname = da...
8
public synchronized void unblock() throws IOException { boolean running = false; if (state == RUNNING || state == CONFIRMED || state == ERROR) { running = true; } state = CLOSED; if (socket != null) { socket.close(); socket = null; ...
5
public void openDoor(String name, InternalDoor door) { Avatar a = null; for(Avatar b: avatars){ if(b.getName().equals(name)){ a = b; } } if(a!= null){ String locName = a.getLocationName(); String doorName = door.getName(); Location l = locations.get(locName); for(GameObject g: l.getAllObj...
5
@Override protected TreeContainerRow clone() { TreeContainerRow other = (TreeContainerRow) super.clone(); ArrayList<TreeRow> children = new ArrayList<>(mChildren.size()); for (TreeRow row : mChildren) { row = row.clone(); children.add(row); row.mParent = other; } other.mChildren = children; other....
1
public List<ReceiptSaleSummaryBean> getCashOutData(final Long customerGroup, final Long revision) { List<ReceiptSaleSummaryBean> ret = new ArrayList<ReceiptSaleSummaryBean>(); List<Receipt> receipts = null; Currency currency = null; try { currency = CurrencyApiService.getByNumber(DbReader.getToken(), Long....
5
private void validerHeuresTransferees() { if (declaration.getHeuresTransfereesDuCyclePrecedent() < 0) { declaration.setHeuresTransfereesDuCyclePrecedent(0); declaration.ajouterMessageErreur("Nombre d'heures transférées du" + " cycle précédent est négatif. La valeur 0 s...
2
@Override public List<ChessPosition> getTargetPos(ChessPosition current) { List<ChessPosition> pos = new ArrayList<ChessPosition>(); ChessPosition CpTemp; int x, y, upBound, lowBound, leftBound, rightBound, value; int dx[] = { 0, 1, 1, -1, -1 }; int dy[] = { 0, 1, -1, 1, -1 }; // khoi tao gioi han di chuye...
8
public boolean validateLocation(Point cellLocation) { MapObstacle obstacle = getMapObstacle(cellLocation); if (obstacle != null) { /* Note that this implementation provide a default obstacle event * handler "this.obstacleEvent(obstacle)" - see method above - that ...
6
private int jjMoveStringLiteralDfa33_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 32); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 32); } switch(curChar) { case 49: return jjMoveStringLiter...
4
public UserImplXml() throws DaoException { super("/xml/User.xml", User.class); }
0
public static void main(String[] args) { int[][] arr = {{75}, {95, 64}, {17, 47, 82}, {18, 35, 87, 10}, {20, 4, 82, 47, 65}, {19, 1, 23, 75, 3, 34}, {88, 2, 77, 73, 7, 63, 67}, {99, 65, 4, 28, 6, 16, 70, 92}, {41, 41, 26, 56, 83, 40, 80, 70, 33}, {41, 48, 72, 33, 47, 32, 37, 16, 94, 29}, {53, 71, 44, 65, 25, 43, 9...
6
public static void equateValues(Proposition prop, Stella_Object term1, Stella_Object term2) { if (Stella_Object.eqlP(term1, term2)) { } else if (Logic.skolemP(term1)) { Skolem.bindSkolemToValue(((Skolem)(term1)), term2, false); } else if (Logic.skolemP(term2)) { Skolem.bindSkolemToValue(...
7
public static void executeThreads(Runnable... runnables) { if (exct == null) { exct = Executors.newCachedThreadPool(); } for (Runnable r : runnables) { exct.execute(r); } }
2
public static void main(String[] args) { File file = null; if (args.length == 0) { JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new FileFilter() { public boolean accept(File f) { if (f.isDirectory()) return true; String filename = f.getName(); return filename.to...
9
private void importConfig(){ File configFile = new File("voidCosmos.conf"); try { configHashMap = SimpleConfig.getHashMap(configFile); } catch (FileNotFoundException e) { JFileChooser jf = new JFileChooser(); jf.setFileSelectionMode(JFileChooser.FILES_ONLY); //only files jf.setMultiSelectionEnabled...
6
public void desenhar(Graphics2D g2) { Rectangle2D.Double retangulo = new Rectangle2D.Double(this.getPosX(), this.getPosY(), largura, altura); g2.draw(retangulo); }
0
private void saveConversionRules(Map<String, Set<String>> conversionRules, // Map<String, Set<String>> conflictRules, Map<String, Set<String>> exclusionRules) throws IOException { List<String> modeUsed = new Vector<String>(); modeUsed.addAll(conversionRules.keySet()); for (String m : conflictRules.keySet()) {...
8
public void setOptions(String[] options) throws Exception { String tmpStr; setRawOutput(Utils.getFlag('D', options)); setRandomizeData(!Utils.getFlag('R', options)); tmpStr = Utils.getOption('O', options); if (tmpStr.length() != 0) setOutputFile(new File(tmpStr)); tmpStr = Utils.get...
9
@Override public void run() { //streams BufferedReader bufferedReader = null; DataOutputStream dataOutputStream = null; try { //create wrapper streams bufferedReader = new BufferedReader(new InputStreamReader(this.socket.getInputStream())); dataOutputStream = new DataOutputStream(this.socket.get...
9
public static int maxProduct (int[] seq) { int max_product = 1, min_product = 1, max_sofar = 0xFFFFFFFF; int temp_max_begin = -1; int temp_min_begin = -1; for (int i = 0; i < seq.length; i++) { if (seq[i] > 0) { max_product *= seq[i]; min...
6
public void draw(Graphics2D g) { g.drawImage(tileTexture, posX, posY, 16, 16, null); if(icon != null) g.drawImage(icon.getSubimage(0, 0, 32, 32), posX, posY, 16, 16, null); }
1
public static void addBan(String victim, int type, long length, String mod, String reason, int display) { PreparedStatement ps = null; ResultSet rs = null; // add player try { ps = conn .prepareStatement( "INSERT INT...
5
public void paintComponent(Graphics g2) { final int w = getWidth() / 2 + 1; final int h = getHeight() / 2 + 1; if (img == null || img.getWidth(null) != w || img.getHeight(null) != h) { img = createImage(w, h); final Graphics g = img.getGraphics();...
6
public static Database createDatabase(DatabaseConfig config) throws InvalidConfigurationException { if (!config.isValid()) throw new InvalidConfigurationException( "The configuration is invalid, you don't have enought parameters for that DB : " + config.getType()); switch (config.getType()) { case My...
3
public void addErrorMessage(BeamMeUpMQError errorMessage) { if (this.errorMessages == null) { this.errorMessages = new ArrayList<BeamMeUpMQError>(2); } this.errorMessages.add(errorMessage); }
1
public void drawState(int x, int y){ /* State Drawing Option * 0 = Regular drawing * 1 = Checker Board pattern * 2 = Randomized * 3 = Randomized/Checker Board */ if(rcflag){if(sdo == 1){ stateCheckDraw(x,y, false);}else{stateAltDraw(x,y);}} else{ switch(sdo){ ...
6
private void MovieSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MovieSearchButtonActionPerformed String search = MovieNameTextField.getText(); String movieReturn; boolean wordSearched; wordSearched = Pattern.compile("[a-zA-z].*").matcher(search).matches(...
7
private String convertFileToString(File file) { final int bufferSize = 1024; if (file != null && file.exists() && file.canRead() && !file.isDirectory()) { Writer writer = new StringWriter(); InputStream is = null; char[] buffer = new char[bufferSize]; try...
8
public static Map<String, String> GetEntityColumnsWithParameters(Class<?> c, boolean hasAutoGenerated) { Map<String, String> res = new HashMap<String, String>(); for (Field field : Arrays.asList(c.getDeclaredFields())) { if ((field.isAnnotationPresent(Column.class) && hasAutoGenerated) ...
7
@SuppressWarnings("unchecked") public void handshake(Byte destination) { System.out.println("Handshaking initialized"); lock.lock(); byte sequence = (byte) (new Random()).nextInt(); while (sequence == 0) sequence = (byte) (new Random()).nextInt(); sequencer.setSequenceTo(destination, sequence); System...
4
public void initializeConverter() { MAP = new HashMap(); UNIQUE_ID = 0; }
0
protected Content throwsTagsOutput(ThrowsTag[] throwTags, TagletWriter writer, Set<String> alreadyDocumented, boolean allowDups) { Content result = writer.getOutputInstance(); if (throwTags.length > 0) { for (int i = 0; i < throwTags.length; ++i) { ThrowsTag tt = thro...
8
@Autowired @Qualifier("dao") //TODO убрать заглушку, юзать dao public void setEmployeeDao(EmployeeDao employeeDao) { this.employeeDao = employeeDao; }
0
public static Component getChild(Component parent, String name) { parent = getContainer(parent); if (parent instanceof JSplitPane) { JSplitPane split = (JSplitPane) parent; if (JSplitPane.TOP.equals(name)) { return split.getTopComponent(); } else if (...
9
@Override public void componentResized(ComponentEvent e) { if(e.getComponent() == null || e.getComponent() instanceof JFrame == false) return; JFrame frame = (JFrame)e.getComponent(); Container contentPane = frame.getContentPane(); ...
4
protected void calculateMotion() { boolean fallGlide = gliding && dir.y > 0; fallSpeed = (fallGlide)?glideFallSpeed:baseFallSpeed; maxFallSpeed = (fallGlide)?glideMaxFall:baseMaxFall; super.calculateMotion(); if((sprite.getCurrentState() == SCRATCHING || sprite.getCurrentState() == FIREBALL) && !(jumping ...
9
@Override public void draw(Graphics2D g) { updateInformation(); if (list.size() == 0) return; if (!GUI.controls.get("v_bubble-all-vertices").isActive()) return; float alpha = transparency * (isOnPoint(graph.mousex, graph.mousey) ? 0.5f : 1.0f); if (alp...
8
public int compareTo(PeptideLocationLine p) { if(this.chromosomeName < p.getChromosomeName()){ return -1; } if(this.chromosomeName > p.getChromosomeName()){ return 1; } if(this.startLocation < p.getStartLocation()){ return -1; } if(this.startLocation > p.getStartLocation()){ return 1; } ...
8
private void SetZipChckbx(String project ,JFrame frame){ String projectName=""; if("designer".equals(project)){ projectName="zip_designer"; }else if("res".equals(project)){ projectName="zip_res"; }else if("mobile".equals(project)){ projectName="zip_mobile"; } zipNameList=GetZipNames(projectName); ...
6
private void setScrollPaneDefault(Attributes attrs) { // find the value to be set, then set it if (attrs.getValue(0).equals("starttime")) { scrollpaneDef.setStartTime(Integer.valueOf(attrs.getValue(1))); } else if (attrs.getValue(0).equals("endtime")) { scrollpaneDef.setEndTime(Integer.valueOf(attrs.getValu...
4
public String getName() { return Name; }
0
public Filter xnor( Filter other ) { return new Not( xor( other ) ); }
0
protected Instances determineOutputFormat(Instances inputFormat) throws Exception { FastVector atts; FastVector values; Instances result; int i; // attributes must be numeric m_Attributes.setUpper(inputFormat.numAttributes() - 1); m_AttributeIndices = m_Attributes.getSelecti...
8
@Override public void keyTyped(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { try { // login(); } catch (Throwable e1) { e1.printStackTrace(); } } }
2
private void quicksort(int low, int high) { int i = low, j = high; // Get the pivot element from the middle of the list int pivot = numbers[low + (high - low) / 2]; // Divide into two lists while (i <= j) { // If the current value from the left list is smalle...
6
public Tile[][] generateTBlock() { Tile[][] piece = new Tile[3][2]; for (int i = 0; i < piece.length; i++) for (int j = 0; j < piece[i].length; j++) { if (j == 0 || (j == 1 && i == 1)) ...
5
public String escapeAttributeValue(String value) //protected void writeAttributeValue(String value, Writer out) throws IOException { int posLt = value.indexOf('<'); int posAmp = value.indexOf('&'); int posQuot = value.indexOf('"'); int posApos = value.indexOf('\''); i...
9
private char randChar(boolean numbers) { if(numbers) { if(ClassParseTests.RANDOM.nextBoolean()) { if(ClassParseTests.RANDOM.nextBoolean()) { // 65-90 return (char) (ClassParseTests.RANDOM.nextInt(90 - 65) + 65); } else { // 97-122 return (char) (ClassParseTests.RANDOM....
4
public void calcPossiblePos(MapScrollPane msp) { Tile[][] grid = msp.getGrid(); for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[i].length; j++) { if (Collision.noCollision(grid, new Point(i,j), new Point(i + width - 1,j + height - 1))) { this.possiblePos.add(new Rectangle(i,j,...
3
public void draw() { System.out.println("Draw Triangle"); }
0
void setState(State state) { this.state = state; }
0
public static boolean dismissInvite(String[] args, CommandSender s){ //Various checks if(Util.isBannedFromGuilds(s) == true){ //Checking if they are banned from the guilds system s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you b...
5
public void recoveryTokenCheck() { switch (this.currentToken) { case TokenNameLBRACE : RecoveredElement newElement = null; if(!this.ignoreNextOpeningBrace) { newElement = this.currentElement.updateOnOpeningBrace(this.scanner.startPosition - 1, this.scanner.currentPosition - 1); } this.lastCheckPoint ...
8
public List<ACommand.Executor> processClass(Class<?> clazz, Object instance) { List<ACommand.Executor> cmdList = new ArrayList<ACommand.Executor>(); Method[] methodList = clazz.getMethods(); for(Method method : methodList) { ACommand acmd = method.getAnnotation(ACommand.class); // skip it if it doesn't have...
8
public static void dlModlist(File modlist, String dloc) throws InterruptedException, IOException{ FileReader fr = new FileReader(modlist); //Opens the selected modlist LineNumberReader lnr = new LineNumberReader(fr); //Used to read the modlist int totalmods = 0; //Start the...
7
@Test public void diag_test() { try{ double []mat= {1.0,2.0}; double[][]result = Matrix.diag(mat); double [][]exp= {{1.0,0.0}, {0.0,2.0}}; Assert.assertArrayEquals(exp, result); } catch (Exception e) { // TODO Auto-generated catch block fail("Not yet implemented"); } }
1
private Sound(String name) { try { clip = AudioSystem.getClip(); AudioInputStream inputStream = AudioSystem.getAudioInputStream( this.getClass().getClassLoader().getResource("sounds/" + name)); clip.open(inputStream); } catch (Throwable e) { e.printStackTrace(); } }
1
@Override public int hashCode() { int hash = 5; hash = 23 * hash + (states != null ? states.hashCode() : 0); hash = 23 * hash + (initialState != null ? initialState.hashCode() : 0); hash = 23 * hash + (liveStates != null ? liveStates.hashCode() : 0); return hash; }
3
private void btnIntersectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIntersectionActionPerformed JFileChooser saveFile = new JFileChooser(); int selected = saveFile.showOpenDialog(this); if(selected == JFileChooser.APPROVE_OPTION){ String path = saveFile.getSelectedFile(...
7
private void talk() { while (true) { question(); logWriteUser(question); if (exit()) { break; } else if (stop()) { answer(MSG_FOR_STOP); while (true) { question(); if (start())...
9
public static String task2(String expression) { int openBrackets = 0; for(int i=0; i<expression.length(); i++) { if(expression.charAt(i) == '(') { openBrackets ++; } if(expression.charAt(i) == ')' && openBrackets>0) { openBrackets --; ...
7