text
stringlengths
14
410k
label
int32
0
9
public void chooseCheckerPieceCPU() { int index = 0; for (int x = 0; x < checkersSpaces.length; x++) { for (int y = 0; y < checkersSpaces.length; y++) { if(checkersSpaces[x][y].getIcon() != null && (checkersSpaces[x][y].getIcon().equals(playerTwoCheckerPiece) || checkersSpaces[x][y].getIcon().equals...
5
protected synchronized InputStream readFileDataBlockInputStream(int blockID) throws IOException { if(blockID < 0) { throw new IllegalArgumentException("blockID must be positive"); } // read from local if available if(this.localFileSystem && this.localCachedBlocks != ...
8
public static <GItem, GItem2> Comparator<GItem> navigatedComparator(final Converter<? super GItem, ? extends GItem2> converter, final Comparator<? super GItem2> comparator) throws NullPointerException { if (converter == null) throw new NullPointerException("converter = null"); if (comparator == null) throw new Nu...
5
public static ArrayList<Person> read(Person person) { ArrayList<Person> personList = new ArrayList<>(); if(person == null){ try { Class.forName("org.h2.Driver"); Connection conn = DriverManager.getConnection("jdbc:h2:tcp://localhost/~/test", "sa", ""); Statement st = conn.creat...
3
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final ChangeOfValue other = (ChangeOfValue) obj; if (newValue == null) { ...
9
@Override public Command planNextMove(Info info) { // TheGameView. Point C = new Point(info.getX(), info.getY()); double min = GameData.GAME_WIDTH+GameData.GAME_HEIGTH; int enemy = 0; for (int i = 0; i < info.getEnemies().size(); i++) { InfoDetail d = info.getEnemies().get(i); Point A = new Point(d.g...
7
@Override public void caseAAssignStmt(AAssignStmt node) { inAAssignStmt(node); if(node.getSmc() != null) { node.getSmc().apply(this); } if(node.getExp() != null) { node.getExp().apply(this); } if(node.getEq() != null) ...
4
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } catch (InvalidConfigurationExcept...
4
public int getResult() { int i, j; double var_or = 0, var_ta = 0, var, result; for ( i = 0 ; i < orig.getWidth() ; i ++ ) { for ( j = 0 ; j < orig.getHeight() ; j ++ ) { var_or += Math.pow(((double)orig.getlum(i, j) - avg_or),2.0); } } for ( i = 0 ; i < target.getWidth() ; i ++ ) { ...
5
@Override public String toString() { String output = "ID: " + mID + " " + String.format("%.7g%n", mLat[mCoordIndex]) + ", " + String.format("%.7g%n", mLon[mCoordIndex]) + " Speed: " + String.format("%.4g%n", mSpeedMPH); if (mStopHistoryIndex >= 0 && mStopHistoryIndex < mStopHistory.size() && m...
7
public void splitMultiRange(String sourceVideoFile, final String destVideoFile, final int... time) { final IStatusListener oldListener = listener; final int countOfTime = time.length; mulitRangeIndex = 0; if (countOfTime < 2) { return; } listener = new IStatusListener() { List<String> filenames = ...
9
public void Write(RandomAccessFile raf) throws Exception { raf.writeInt(this.id); raf.writeUTF(this.Name); raf.writeDouble(this.height); }
0
public Vector3f checkCollision(Vector3f oldPos, Vector3f newPos, float objectWidth, float objectLength){ Vector2f collisionVector = new Vector2f(1, 1); Vector3f movementVector = newPos.sub(oldPos); if(movementVector.length() > 0){ Vector2f blockSiz...
5
@Override public void remove() { throw new UnsupportedOperationException(); }
0
public float getProgress() { if (this.total == 0L) return 0.0F; return (float)this.current / (float)this.total; }
1
public static double getHue(int color) { double var_R = ( color >> 16 & 0xff ) / 255.0; //RGB from 0 to 255 double var_G = ( color >> 8 & 0xff ) / 255.0; double var_B = ( color & 0xff ) / 255.0; double var_Min = Math.min(Math.min( var_R, var_G), var_B ); //Min. value of RGB double var_Ma...
6
public void receive(final PacketHandler handler) { receive = new Thread("receive_thread") { public void run() { while(running) { byte[] buffer = new byte[1024]; DatagramPacket dgpacket = new DatagramPacket(buffer, buffer.length); try { socket.receive(dgpacket); } catch (IOExcept...
2
public DefaultConnectionUserID( UUID serverID, InetAddress localAddress, int localPort, InetAddress remoteAddress ) throws NullPointerException { super(); if( serverID == null ) throw new NullPointerException( "Cannot create a DefaultConnectionUserID with a null-serverID." ); if( loc...
3
public String stemming(String sen){ sen+=" "; Stemmer s = new Stemmer(); String result = ""; char[] w = new char[501]; char[] chars = sen.toCharArray(); for(int a=0;a<chars.length;a++){ int ch = chars[a]; if (Character.isLetter((char)ch)){ int j = 0; a++; for(;a<chars.length;a++){...
7
@Override public void run() { String message; try { User user = (User) ois.readObject(); if (authentication(user)) { LOGGER.info(user.getNickname()+" connected"); clientList.add(user); oos.writeObject(clientList); }...
5
public SortedMap<Long, Boolean> berechneZustandsWechselZustand(Long von, Long bis, int jahr) { // Die Abfrage besitzt eine eigene Zustandsliste //ListeZustandsWechsel listeZustandsWechselAbfrage = new ListeZustandsWechsel(); listeZustandsWechsel = new ListeZustandsWechsel(); Integer temp = jahr; ...
8
public String getDirectionStr() { String dir = this.toString().toLowerCase(); switch(dir) { case "northwest": dir = "NW"; break; case "northeast": dir = "NE"; break; case "east": dir = "E"; break; case "west": dir = "W"; break; case "southwest": dir = "SW"; break; case "...
6
private void match(SegmentedImage A, SegmentedImage B){ // int numNodes = Math.max(A.numCells(), B.numCells()) + 3; double[][] costs = assignCosts(A, B); HungarianAlgorithm hungarian = new HungarianAlgorithm(costs); int[] assigns = hungarian.execute(); for(int i = 0; i < A.numCells(); i++){ A.se...
3
public void printTree(TreeNode node) { if(node == null) return; //for root we have all data with out any division if(node.parent != null) { for(int i = 0; i < node.depth - 1; i++) System.out.print("| "); System.out.print("attr" + "" + node.parent.selectedAttribute + " = " + node.selectedAttributeValue +...
6
private void field_localidadFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_localidadFocusLost boolean es_componente=false; // voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos int i=0; Component[] components = panel_d...
7
private void addAnimation(Animation animation, int frame) throws LowDurationException, DuplicateFrameElementException, FrameOutOfBoundsException, DuplicateNameException { actualDuration += animation.getDuration(); checkDuration(animation, frame); if(frame > (duration-1)) throw new FrameOutOfBoundsExcept...
5
private void executeAction(List<String> actionList, Player p) { for(String action : actionList) { String[] a = action.split(" "); // Give action if(a[0].equalsIgnoreCase("give")) { String[] itemData = a[1].split(":"); int item = Integer.parseInt(itemData[0]); byte data = 0; sh...
9
public static void main(String[] args) { final int max = 1000000; final HashMap<Integer, Integer> primes = new HashMap<Integer, Integer>(); final SieveOfAtkin sieve = new SieveOfAtkin(max); final ArrayList<Integer> list = sieve.run(); for (int prime : list) { primes.p...
7
@Override public void nativeKeyPressed(NativeKeyEvent e) { if(e.isMenuKey()) ControlKeys.setKeyPressed(e.getKeyCode()-16, true); else if(Constants.KEYS_ENABLED) { String[] scs = Configuration.getSetting("shortcuts").split("\\|"); for(byte i=0;i<scs.length;++i) { if(Byte.parseByte(scs[i].substring(3...
5
public static DateTimeObject timeAdd(DateTimeObject t1, DateTimeObject t2) { { Surrogate testValue000 = Stella_Object.safePrimaryType(t1); if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_CALENDAR_DATE)) { { CalendarDate t1000 = ((CalendarDate)(t1)); { Surrogate testValue001 = Stel...
6
public void setLastMove(int lastMove) { move = NO_MOVE; canMove = true; this.lastMove = lastMove; switch(lastMove){ case MOVE_LEFT+MOVE_UP: setLookRight(false); break; case MOVE_RIGHT+MOVE_UP: setLookRight(true); break; case MOVE_LEFT+MOVE_DOWN: setLookRight(false); break; case MOVE_RI...
6
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>[] declaredExceptions) { if (!isCheckedException(ex)) { return true; } if (declaredExceptions != null) { int i = 0; while (i < declaredExceptions.length) { if (declaredExceptions[i].isAssignableFrom(ex.getClass())) { ret...
5
public void addPage(String document){ //add to termIndex the parsed words from *document* HTMLParser pageParser = new HTMLParser(document); docCount++; //For each word in our parsed array... for(String word: pageParser.getParsedArray()){ if (termIndex.size() == 0) ...
6
private boolean removeCmd(CommandSender sender, String[] args) { if(Validate.isPlayer(sender)) { UPlayer player = plugin.getPlayerManager().getUPlayer(sender.getName()); if(player == null) return true; if(!StaffRank.isEqualOrGreater(player, StaffRank.ADMIN)) { player.sendMessage("§4You can't use this com...
6
public Pos SearchMaxPos( Stone color) { Pos retPos = null; Pos workPos = new Pos(); int maxCnt = 0; for (int y = Common.Y_MIN_LEN; y < Common.Y_MAX_LEN; y++) { workPos.setY(y); for (int x = Common.X_MIN_LEN; x < Common.X_MAX_LEN; x++) { workPos.setX(x); int getCnt = this.DoSet(workPos, color, fal...
3
public MapDef getDef(KeyPressedEvent e) { if (e.getID() == KeyPressedEvent.KEY_RELEASED) { MapDef def = (MapDef) keysCurrentlyDown.get(e .getCharCode()); registerKeyPressedEvent(e, def); // if (e.getID() == KeyPressedEvent.KEY_RELEASED) //l...
8
void setConfigurationData(SystemObject systemObject, AttributeGroupUsage atgUsage, Data data) throws ConfigurationChangeException { try { final ConfigurationRequester requester = getRequester(); // Den Datensatz in ein byte-Array umwandeln. final byte[] dataAsByteArray; if(data != null) { // Prüfen ...
7
public void render() { for (Enemies enemies : enemises) enemies.render(); }
1
public Matrix transpose() { Matrix A = new Matrix(N, M); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) A.data[j][i] = this.data[i][j]; return A; }
2
public boolean process(File inputFile, boolean overwrite) throws IOException, InterruptedException, CommunityFinderException { File outputDir = inputFile.getParentFile(); if (!new File(inputFile.getAbsolutePath() + ".mcliques").exists() || overwrite) { if (!generateMaxCliques(inputFile)) th...
9
public String printPropertiesFromFile(String fileName) { String result = ""; try { Properties properties = new Properties(); FileStreamLoader fileStreamLoader = new FileStreamLoader(); Context cx = Context.enter(); validateFileName(fileName); String evaluationScript = "function print(){ fileStreamL...
2
public static String word2num(String word) { // convert word to upper case String _word = word.trim().toUpperCase(); // for each letter, convert to number StringBuilder sb = new StringBuilder(); String _num = ""; for (int i = 0; i < _word.length(); i++) { _num = getNumberEncoding(_word.substring(i, i +...
1
private boolean jj_2_65(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_65(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(64, xla); } }
1
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { int i = par1World.getBlockMetadata(par2, par3, par4); boolean flag = false; if (i == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) { flag = true; } if ...
9
private Map<Integer, Double> getTagRecencies(List<UserData> bookmarks) { //Collections.sort(bookmarks); // TODO: necessary? int testIndex = bookmarks.size() + 1; Map<Integer, Integer> firstUsages = new LinkedHashMap<Integer, Integer>(); Map<Integer, Integer> lastUsages = new LinkedHashMap<Integer, Integer>(); ...
9
@Override public int getPrevPage() { return (hasPrevPage()) ? this.currPage-1 : 0; }
1
static public char classChar(Object x){ Class c = null; if(x instanceof Class) c = (Class) x; else if(x instanceof Symbol) c = primClass((Symbol) x); if(c == null || !c.isPrimitive()) return 'O'; if(c == long.class) return 'L'; if(c == double.class) return 'D'; throw new IllegalArgumentExce...
6
public List<List<GraphComponent>> findGraphPaths() { List<GraphNode> allGraphNodeList = _graphFragment.listAllNodes(); if ((allGraphNodeList != null) && (allGraphNodeList.size() > 0)) { /* Go through each node looking for out-bound relationships that haven't been visited yet. * Trying to use as few...
8
public void placeMines(BoardModel boardModel) { int addedMines = 0; while (addedMines < boardModel.getNumberOfMines()) { int x = getRandomInt(boardModel.getBoardWidth()); int y = getRandomInt(boardModel.getBoardHeight()); if (!boardModel.getBoard()[x][y].isMine()) { ...
2
@Test public void getConnectedComponentsTest(){ VertexSet set = new VertexSet(); set.addVertex(new City(4, 213, 250, Owner.Rom)); set.addVertex(new City(6, 300, 300, Owner.Rom)); set.addVertex(new City(5, 387, 250, Owner.Rom)); City testCity = city_graph.getCity(4); assertTrue(city_graph.getConnected...
0
@Override public void draw(Graphics2D drawScreen) { // Draw a white background first. This won't be needed if the graphics // of a layer cover the entire screen. But I am keeping this as a lot of // my tests of the game engine don't cover the entire screen, and it // would be annoying to the end user if they d...
1
public boolean collision() { // We hit the right wall. if (xPosition + BALL_RADIUS > BALL_MAX_X) { if (theta < Math.PI / 2 || theta > 3 * Math.PI / 2) { /* Critical Region */ synchronized (this) { theta = wrapTheta(Math.PI - theta); return true; } } } // We hit the left w...
9
private void drawHighScores(Graphics2D g){ g.setColor(Color.white); g.drawString("HIGH SCORES", (getWidth()-fm.stringWidth("HIGH SCORES"))/2, 100); if (highScores.size() == 0){ g.drawString("No Scores Added!", (getWidth()-fm.stringWidth("No Scores Added!"))/2, getHeight()/2); }else{ for (int i = 0; ...
3
public static String getJavaFieldOracleTypeByDBType(String type){ String str = "String"; String typeUC = type.toUpperCase(); if(typeUC.equalsIgnoreCase("NUMBER") || typeUC.startsWith("INTEGER")){ str = "Integer"; }else if(typeUC.startsWith("NUMBER")){ str = "Double"; }else if(typeUC.equalsIgnoreCase("LO...
7
static double [] findPercentageNumbers(int arr[]){ double fraction []=new double[3]; double total =0; for(int arr_i=0; arr_i < arr.length; arr_i++){ if(arr[arr_i]>0){ fraction[0]=fraction[0]+1; }else if(arr[arr_i]==0){ fraction[1]=fraction[1]+1; ...
3
public void checkDateAndGetStat(boolean force) { if (force || nextDate.before(new Date())) { logger.info(getName() + " collecting now..."); collectStat(force); nextDate = state.getNextDate(); } else { logger.debug(getName() + " going to collect " +...
2
public static void main(String[] args) { try { List<String> strDNAs = FileUtils.readFileFASTA2("d:/temp/rosalind_glob.txt"); char[] st1 = strDNAs.get(0).toCharArray(); // вертикальная (первая) char[] st2 = strDNAs.get(1).toCharArray(); // горизонтальная (вторая) //st1 = "PLEASANTLY".toCharArray(); //st...
5
public static Host getHost () throws IOException { synchronized (RemoteHostFactory.class) { if (self != null) return self; // FIXME: handle _both_ RMI/JRMP and RMI/IIOP ... try { self = (Host) Naming.lookup ("usb.core.Host"); } catch (ConnectException e) { // no (default) registry ...
3
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getSource()==jb1){ //上移 //先获得选择项的索引 int index = list.getSelectedIndex(); if(index!=-1){ if(index > 0){ System.out.println(model.getSize()+" index="+index); //再把当前选择项的值赋给上一个索引处的值 model.set(i...
9
@Override public void deserialize(Buffer buf) { houseId = buf.readInt(); if (houseId < 0) throw new RuntimeException("Forbidden value on houseId = " + houseId + ", it doesn't respect the following condition : houseId < 0"); modelId = buf.readShort(); if (modelId < 0) ...
8
@EventHandler public void onCrazySmokeMove(PlayerMoveEvent pME) { Player player = pME.getPlayer(); if(CrazyFeet.CrazySmoke.contains(player)) { Location to = pME.getTo(); Location from = pME.getFrom(); Location loc = player.getLocation(); if(to.getX() != from.getBlockX() || to.getY() != fr...
4
public Element handle(FreeColServer server, Player player, Connection connection) { ServerPlayer serverPlayer = server.getPlayer(connection); Unit unit; try { unit = serverPlayer.getFreeColGameObject(unitId, Unit.class); } catch (Exception e...
6
private boolean r_mark_suffix_with_optional_U_vowel() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; // (, line 159 // or, line 161 lab0: do { v_1 = limit - cursor; lab1: do { // (, line 160 // (, line 160 // test, line 160 v_2 = limit - cursor; if (!(in_g...
9
public static void updateMain() { //V spremenljivko zapiši trenutno lokacijo aplikacije in jo shrani v datoteko, //katero bo kasneje prebral posodobljevalnik, da bo vedel kam //shraniti novo verzijo. File file=new File(com.DzinVision.preprosteSuplence.main.Main.class.getProtectionDomain(...
3
@Override public final void dec(final Integer... a) { for (final Integer i : a) { if (filter[i]>=0) filter[i]--; } }
2
@Test public void testGetS1() { System.out.println("getS1"); Turn instance = new Turn(Turn.direction.LEFT, 6); int expResult = 6; int result = instance.getS1(); assertEquals(expResult, result); }
0
private void generateHeader(PrintStream out) { out.println("digraph G {"); out.println(" ranksep = " + repository.meta("rankSep", ""+rankSep)); out.println(" rankdir = " + repository.meta("direction", ""+direction)); if(repository.hasMeta("nodesep")) out.println(" nodese...
1
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing // TODO add your handling code here: System.out.println("closing"); try { FileWriter configwriter=new FileWriter(configfile); configwriter.write(startaddress+"\r\n"); ...
1
public GuiceTestRunner(Class<?> klass) throws InitializationError { super(klass); // Check the @WithModules annotation WithModules wm = this.getTestClass().getJavaClass() .getAnnotation(WithModules.class); if (wm == null) { throw new InitializationError( "The class should have the @WithModules ann...
3
public Console() { everyone = new HashMap<String, Player>(); games = new HashMap<String, TournyGame>(); norder = new Vector<Player>(); if (!new File("masterlist.txt").exists()) { File file = new File("masterlist.txt"); try { file.createNewFile(); } catch (IOException e) { e.printStackT...
4
@Override public String toString() { String ret = null; switch(type) { case CHATCMD: ret = "ChatCommand from " + nick + " : " + command + " -- " + args; break; case GAMECMD: ret = "GameCommand from " + nick + " : " + command + " -- " + args; break; case JOIN: ret = "JoinEvent : " + nick + " -- " + args; ...
4
*/ public boolean hasIsDead() { boolean b = false; for (int index = 0; index < animalFactory.getQuantityOfVictims(); index++) { if (animalFactory.getVictim(index).isDead) { b = true; } } return b; }
2
private void construirGrafo (Nodo origen) { origen.minDistancia = 0; PriorityQueue<Nodo> cola = new PriorityQueue<>(); cola.add(origen); while (!cola.isEmpty()) { Nodo u = cola.poll(); for (Arista e : u.adyacente) { Nodo v = ...
3
public ParseServlet() { super(); }
0
@Override public void fly() { System.out.println("I fly just like an eagle."); }
0
public void setY(int y) { this.y = y; }
0
public void dfs(Object root, mxGraph graph) { if (root == null) return; if (graph.getModel().isVertex(root)) { visited.add(root); } for (Object n : graph.getChildCells(root)) { if (!visited.contains(n)) dfs(n, graph); } }
4
protected int parseLineName() throws ParseError { int rc = parseToken(false); boolean inp_line = s.equals("input"); boolean gate_line = s.equals("gate"); if ((rc != WORD_INDICATOR) || (!inp_line && !gate_line)) { throw new ParseError("parseLineName : Bad line name"); ...
5
private static void rangeQ(int l, int r, int bSize, int[] a, long[] bSums, StringBuilder sb){ long s=0; if(r-l<bSize){ for(int k=l;k<=r;k++){ s+=a[k]; } } else { int lowerB = l/bSize + 1; int upperB = r/bSize; for(int k=l;k<=bSize*lowerB;k++){ s+=a[k]; } // System.out.println("DEBUG: "...
5
public void resolveCollision(Pinball pinball) throws Exception { int startPoint = -1, endPoint = -1; for (int i = 0; i < 361; i++) { if (getMapVal(Constants.toInt(pinball.position.getX() + pinball.getRadius() * Math.sin(Math.toRadians(i))), Constants.toInt(pin...
9
private void keresAllitmanyt(Mondat mondat) { List<Szo> potencialisSzavak = new ArrayList<>(); for (String s : mondat.getVizsgalandoSzavak()) { s = s.toLowerCase(); s = igekototLevesz(s); for (Szo szo : szokincs) { if (!szo.getSzofajok().contains("ige"...
8
public InternalCommand[] listCommands() { int numInvisible = 0; for (String cmd : commands.keySet()) if (!commands.get(cmd).visible) numInvisible++; InternalCommand[] list = new InternalCommand[commands.size() - numInvisible]; int i = 0; for (String cmd : commands.keySet()) { if (commands.get(cmd).v...
4
public Vector3d getLocalNormal(Vector3d position, Matrix3d rotation, Vector3d point) { Vector3d localPoint = getLocalPoint(position, rotation, point); // Calling methods should catch this since it means that a potentially // intersecting point is not intersecting after all. if ((localPoint.x >= signedDistan...
6
private void parse_authUserFile( String line, String keyword, String[] split, int lineNumber, boolean strictMode ) throws ParseException { // Line has the format: // "AuthUserFile" <AbsoluteFilePath> if( split.length != 2 ) { throw new ParseException( "Invalid '"+keyword+...
3
@Override public void run() { long delta = 0; while (true) { long start = System.currentTimeMillis(); update((int) delta); BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); continue; } render(bs.getDrawGraphics()); if (bs != null) bs.show(); ...
6
public void actionPerformed(ActionEvent e) { System.out.print("click"); String[] params = loginView.getLoginParams(); startupModel.Login(params); Boolean result = startupModel.getLoginResult(); if(!result){ loginView.setResu...
1
@SuppressWarnings("unchecked") private void getDebateList() { debateList = debate.getDebateList(); topicDBDLM.removeAllElements(); numberTurnDBDLM.removeAllElements(); statusDBDLM.removeAllElements(); winnerDBDLM.removeAllElements(); int activeTopic = 0, completedTopic = 0, pendingTopic = 0; for (int i =...
9
private String decrypt(String encryptedMessage) { byte[] encMsgAsBytes = null; byte[] decrypted = null; try { encMsgAsBytes = hexStringToByteArray(encryptedMessage); SecretKeySpec keyspec = new SecretKeySpec(RemoteQuery.secretKey.getBytes("UTF-8"), "AES"); //IvPara...
4
public ChannelLPC(BitInputStream is, Header header, ChannelData channelData, int bps, int wastedBits, int order) throws IOException { super(header, wastedBits); this.residual = channelData.getResidual(); this.order = order; // read warm-up samples //System.out.println("Order="+...
8
* @Post: No changes * @Return: Whether or not the king can safely move out of check */ private boolean canMoveOutOfCheck() { King theKing =this.getCurrentKing(); for(Point p :theKing.possibleMoves())//if any of them wouldn't place the king in check, it works { if(!(wouldBeInCheck(theKing,p))) { ret...
2
@SuppressWarnings("unchecked") public void setDefaultFont() { GL11.glDisable(GL11.GL_TEXTURE_2D); try { font = Font.createFont(Font.PLAIN, new FileInputStream(System.getProperty("resources") + "/fonts/" + defaultFontName)); font = font.deriveFont(defaultSize); } catch (FontFormatException e) { System.er...
3
public static int indexOfIgnoreCase(String longer, int skip, String shorter) { char chInShorter = shorter.charAt(0); int indexOf = longer.indexOf(chInShorter, skip); if (indexOf == -1 && chInShorter <= 'z') { char switchCaseHead = Character.isLowerCase(chInShorter) ? Character.toUpperCase(chInShorter) ...
5
public Object[] list() { ArrayList<Object> ret = new ArrayList<Object>(); while (true) { if (off >= blob.length) break; int t = uint8(); if (t == T_END) break; else if (t == T_INT) ret.add(int32()); ...
7
void setLocation(SimpleVector location) { this.location = location; }
0
public static void sortStudentsPromotion(int mode) { if (sList.isEmpty()) { System.out.println("There is no Student !"); } else if (pList.isEmpty()) { System.out.println("There is no Promotion !"); } else { System.out.println("Which promotion do you want ?"); displayPromotionList(); Scanner scIn...
4
public static void main(String[] args) throws Exception { VorbisStream vs = new VorbisStream(new FileInputStream(args[0])); InputStream pcm = vs.pcmstream(); byte[] buf = new byte[4096]; int ret; while((ret = pcm.read(buf)) >= 0) System.out.write(buf); }
1
public void mouseExited(MouseEvent e) {}
0
public void placePlayerIntoList(Player player) { // check if player is already in the quester list boolean wasInList = false; for (Quester quester : theQuesterList) { if (quester.theQuestersName.equalsIgnoreCase(player.getName())) { wasInList = true; } } if (wasInList == false) { // needs to be adde...
4
public String methodLLParser(){ //this.displayTokenStack(); do{ //System.out.println("input stack top: "+tokens.peek().getToken()); //System.out.println("productions: "+productions+"\n\n"); try{ if(!tokens.peek().getToken().equals(productions.peek())){...
9
public boolean equals(Object object) { return object == null || object == this; }
1