text
stringlengths
14
410k
label
int32
0
9
public JokerScherm(final SpeelScherm speelscherm, final Spel spel) { setBackground(new Color(0, 0, 0, 150)); setBounds(0, 0, 800, 600); setLayout(new MigLayout("", "[grow][530,center][grow]", "[grow][200px,center][grow]")); JPanel panel = JPanelFactory.createBackgroundJPanel(); add(panel, "cell 1 1,grow"); ...
2
public Main() { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { try { UIManager.setLookAndFeel(info.getClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e...
5
public static String downloadStringResource(HttpURLConnection connection) { StringBuffer content; InputStream inputstream = getSafeInputStream(connection); if (inputstream == null) { return null; } // load the Stream in a StringBuffer // Check encoding ...
6
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String args[]) { if(cmd.getName().equalsIgnoreCase("freeze")) { if(args.length < 1) { sender.sendMessage(new StringBuilder(pre).append("Please specify a player you would like to freeze!").toString()); return true; } ...
9
public void setFname(String fname) { this.fname = fname; }
0
@Override public void onCollide(CollisionBox tempBox) { if(tempBox.getCollisionType() == CollisionType.PLAYER) { if(biteWait == 0) { int tempH = GameCore.spawnEngine.getPlayer().currentHealth - 1; GameCore.spawnEngine.getPlayer().setCurrentHealth(tempH); biteWait++; } if(biteWait == 15) ...
4
public void setHSBColor(int row, int col, double hue, double saturation, double brightness) { if (row >=0 && row < rows && col >= 0 && col < columns) { grid[row][col] = makeHSBColor(hue,saturation,brightness); drawSquare(row,col); } }
4
protected void cleanFiles() throws Exception { final Logger log = log(); if (null == epoch) { log.fine("Epoch is not set, cleanup skipped"); return; } Manager db = getDb(); PathFilter filter; try { filter = getEffectiveFilter(); } catch (IOException invalid) { throw new RuntimeExcepti...
9
public int minMaxIndexLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 30; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; return (optInTimePeriod-1); }
3
private ExtendedPolygon[] convertWorldToScreen2(GameObject that, int width, int height) { ExtendedPolygon[] poly = new ExtendedPolygon[3]; double[][][] faces = that.getBounds().getFaces(); double[][] faceX; double[][] faceY; double[][] faceZ; Color xFaceColor; Color yFaceColor; Color zFaceColor; /...
9
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; }
1
public ResultSet getAllProcessorsOfType(int processorType) { ResultSet res = null; try{ String query = "SELECT * FROM processor_types WHERE processorBrandID=?"; stmnt = CONN.prepareStatement(query); // Bind Parameters stmnt.setInt(1, processorType); res = stmnt.executeQuery(); } catch ...
1
@Override public void deserialize(Buffer buf) { mapId = buf.readInt(); int limit = buf.readUShort(); npcsIdsWithQuest = new int[limit]; for (int i = 0; i < limit; i++) { npcsIdsWithQuest[i] = buf.readInt(); } limit = buf.readUShort(); questFlags = ...
3
@Override public void onCombatTick(int x, int y, Game game) { List<Entity> neighbors = ((SinglePlayerGame) game) .getSquareNeighbors(x, y, 1); for (Entity neighbor : neighbors) { if (neighbor.id == EntityType.archer.id) { ((MortalEntity) neighbor).damage(1...
3
public ReturnObject remove(int index) { ReturnObjectImpl returnValue = new ReturnObjectImpl(); if (index < 0 || index >= size()) { returnValue.value = ErrorMessage.INDEX_OUT_OF_BOUNDS; return returnValue; } for (int i = index; i < size(); i++) { array[i] = array[i + 1]; } return null; }
3
public static void toggleWordWrap(IEditorPart editor) { if (editor == null) { return; } // editor (IEditorPart) adapter returns StyledText Object text = editor.getAdapter(Control.class); if (text instanceof StyledText) { StyledText styledText = (StyledTex...
2
private void initializeQueryPropertiesNew() { synchronized (defaultQueryProperties) { defaultQueryProperties.clear(); try { final InferenceParameterDescriptions desc = DefaultInferenceParameterDescriptions.loadInferenceParameterDescriptions(this, 10000); final InferenceParameters default...
6
public RetCode RestoreCandleDefaultSettings( CandleSettingType settingType) { int i; if (settingType.ordinal() > CandleSettingType.AllCandleSettings .ordinal()) return RetCode.BadParam; if (settingType == CandleSettingType.AllCandleSettings) { for (i = 0; i < CandleSet...
3
public boolean IDscanner(int trackingNumber){ int loop; for (loop = 0; loop < enemiesPresent.size(); loop++){ if (enemiesPresent.get(loop).getID() == trackingNumber){ return true; } } return false; }
2
private static void checkFA(Object fa, Object o, String field) { if (fa == null) { throw new ComponentException("No such field '" + o.getClass().getCanonicalName() + "." + field + "'"); } }
1
public void actionPerformed(ActionEvent ae) { if(ae.getSource() == jRegisterPanel.getCancelButton()) { setVisible(false); jLoginFrame.setVisible(true); dispose(); } else if (ae.getSource() == jRegisterPanel.getRegisterButton()) { String szEmail = jRegist...
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SondageReponse other = (SondageReponse) obj; if (this.id != other.id) { return false; ...
5
private static void run(String sourceName, InputStream in, ImageInfo imageInfo, boolean verbose) { imageInfo.setInput(in); imageInfo.setDetermineImageNumber(true); imageInfo.setCollectComments(verbose); if (imageInfo.check()) { print(sourceName, imageInfo, verbose); } }
1
int guessPoleIndex(int poleCellId) { if (alreadyIncludes(poleCellId)) { return cellIds.indexOf(poleCellId); } int cenRow = getCenterRow(); int cenCellId = cellIds.get(getCenterIndex()); int cellsToPole = mesh.getDistanceInCells(poleCellId, cenCellId); int pole...
4
public double getEccentricity() { return Math.sqrt(1 - b * b / a * a); }
0
public Mask multiplyBy(Mask mask) { if (this.getWidth() != mask.getHeight()) { throw new IllegalArgumentException("Incompatible matrix"); } Mask result = new Mask(this.getHeight(), mask.getWidth()); for (int i = -1 * this.getHeight() / 2; i <= this.getHeight() / 2; i++) { for (int j = -1 * mask.getWidth(...
4
private void write(BufferedWriter out) { StringBuffer sb = new StringBuffer(); sb.append("db." + JSONWriter.COLLECTION_NAME + ".insert({"); sb.append("stationId: \"" + _stationId + "\""); sb.append(", stationName: \"" + Stations.getName(_stationId) + "\""); sb.append(", latitude: \"" + Stations.ge...
1
protected void readCommentHeader() throws Exception { readOggHeader(); byte[] headerTest = new byte[7]; // unfortunately we need to look for the vorbis header do { raf.read(headerTest); raf.seek(raf.getFilePointer() - 6); } while (headerTest[0] != 0x03 && // comment header id...
7
private void appendFrameTypes( final boolean local, final int n, final Object[] types) { for (int i = 0; i < n; ++i) { Object type = types[i]; AttributesImpl attrs = new AttributesImpl(); if (type instanceof String) { attrs.addAttri...
4
public static void countChar(String string) { if (string == null || string.isEmpty()) { System.out.println("Null or empty"); return; } for (int i = 0; i < string.length(); i++) { char asd = string.charAt(i); if (treeMap.get(asd) == null){ ...
4
public static int getDashboardTensionUnit() throws ClassNotFoundException { int weightUnit = 0; try{ //Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar"); Class.forName(driverName); Class.forName(clientDriverName); }catch(java.lang.ClassNotFoundE...
4
public static void main(String[] args) { try { Logger.getAnonymousLogger().info("Starting."); final CycAccess cycAccess = new CycAccess("public1.cyc.com", 3600); Logger.getAnonymousLogger().info("Connected to: " + cycAccess.getHostName() + ":" + cycAccess.getBasePort()); // cycAccess.tr...
2
private static DecimalImpl mulInt(final long d1Base, final long d2Base, final int d2Factor) { final long d1_1 = d1Base / MUL_COMPONENT; final long d1_2 = d1Base % MUL_COMPONENT; final long d2_1 = d2Base / MUL_COMPONENT; final long d2_2 = d2Base % MUL_COMPONENT; final long r11 = d1_1 * d2_1; final long r12 = d1_...
2
@Override public List<Object> getAll(int gameID){ XStream xStream = new XStream(new DomDriver()); List<Object> model=new ArrayList<Object>(); Object temp=null; Statement stmt=null; try { stmt = db.getConnection().createStatement(); ResultSet rs = stmt.executeQuery("SELECT command FROM MoveCommand where...
2
public boolean bateCom(Aula aula2) { if(this.diaDaSemana != aula2.getDiaDaSemana()){ return false; } Periodo p1 = this.getPeriodo(); Periodo p2 = aula2.getPeriodo(); if((p1.getLimiteSuperior().after(p2.getLimiteInferior()) && p1.getLimiteSup...
5
public byte[] handleRequest(byte[] request) { try { String req = Utils.byteToString(request); if (req.startsWith(HEARTBEAT_COMMAND)) { req = req .substring((HEARTBEAT_COMMAND + COMMAND_PARAM_SEPARATOR) .length()); logger.info(myInfo + " recieved heartbeat ping with server list " + re...
7
Map<String, ArrayList<ArrayList<String>>> datasOfClass(ArrayList<ArrayList<String>> datas){ Map<String, ArrayList<ArrayList<String>>> map = new HashMap<String, ArrayList<ArrayList<String>>>(); ArrayList<String> t; String c; for (ArrayList<String> data : datas) { t = data; ...
2
private void setConfigFile(String conf) throws FileNotFoundException, IOException { this.configFile = conf; File f = new File(configFile); if (!f.exists()) { return; } try { BufferedReader reader = new BufferedReader(new FileReader(f)); StringBuilder stringBuilder = new StringBuilder(); String ...
8
public double[] rawItemMeans(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.rawItemMeans; }
2
public static Boolean CheckMapsize(int players, int mapsize) { if ((mapsize > 50) || (mapsize <= 0)) { System.out.println("Invalid Map Size"); return false; } else { if (players >= 2 && players <= 4) { if (mapsize < 5) { System.out .println("Minimum size of map for the number of players is...
6
public void keyPressed(KeyEvent e) { if (stage != null) { stage.keyPressed(e); } }
1
public boolean rateReview(String isbn, String reviewer, int score) throws SQLException { if (reviewer.equals(username)) { return false; } LinkedList<String> columns = new LinkedList<String>(); LinkedList<String> values = new LinkedList<String>(); columns.add("ISBN"); ...
1
private static void postQueryCleanup(Connection c, Statement st, ResultSet rs) { try { if(rs != null) { rs.close(); st.close(); c.close(); } } catch(Exception e) { Actions.addAction(new Action(ActionType.WARNING, "Unable to close Database connections " + "post query.")); } }
2
private String getServerSetting(String tagName) { String val = ""; // try { NodeList nodeList = m_root.getElementsByTagName( "MyServer" ); if ( nodeList == null ) { return val; } Element child = (Element)nodeList.item(0); NodeList childNodeList = child.getElementsByTagName( tagName ); Element c...
6
@Override public Object clone() { return this; }
0
public boolean canImportTransferable(DataFlavor[] transferFlavors) { boolean result = false; for (DataFlavor df:transferFlavors) { if (DataFlavor.javaFileListFlavor.equals(df) || DataFlavor.imageFlavor.equals(df) || (urlListDataFlavor != null && urlListDataFlavor.equals(df)) ) { result = true; ...
7
private void renderThings(Graphics2D g){ g.clearRect(0,0,screenWidth,screenHeight); //render field g.setColor(Color.WHITE); //The base measurement g.fillRect(worldXToScreen(1000), worldYToScreen(4000), (int)(4000*screenXFactor), (int)(2000*screenYFactor)); //entity draw loop for(int i=0; i<pla...
1
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode()); result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); result = prime * result + ((lastName == null) ? 0 : lastName.hashCode...
4
private void setData() { ArrayList<String> list = campaignRef.getSettings(); background1Field.setText(list.get(0)); background2Field.setText(list.get(1)); background3Field.setText(list.get(2)); logoField.setText(list.get(3)); buttonField.setText(list.get(4)); }
0
public boolean searchForPyro() { // look for a Pyro in the same Room Pyro target_pyro = null; double smallest_angle_to_pyro = Math.PI; for (Pyro pyro : current_room.getPyros()) { if (pyro.isVisible()) { double abs_angle_to_pyro = Math.abs(MapUtils.angleTo(bound_object, pyro)); if (...
8
public int onEnd() { if(log.isLoggable(Logger.WARNING)) log.log(Logger.WARNING, "onEnd"); return transition; }
1
private void balanceOut(){ int balance = hoehe(rechts) - hoehe(links); assert (balance <= 2); assert (balance >= -2); if (balance == -2) { int ll = (links.links == null) ? 0 : links.links.hoehe; int lr = (links.rechts == null) ? 0 : links.rechts.hoehe; if (ll >= lr) // >= ?? rechtsRotation()...
8
public void body() { initializeResultsFile(); createGridlet(super.get_id(), NUM_GRIDLETS); // schedule the initial sending of gridlets. // The sending will start in a ramdom time within 5 min Random random = new Random(); int init_time = random.nextInt(5*60); ...
4
public void setAgencia(String ag) { this.agencia = ag ; }
0
private JPanel createMatrixPanel() { JPanel panel = new JPanel(); for (int i = 0; i < bMatrix.length; i++) { for (int j = 0; j < bMatrix[0].length; j++) { panel.add(bMatrix[i][j]); } } return panel; }
2
public void insert(TestBean bean) { jdbcTemplate.update("insert into TEST VALUES ( ?, ? )", bean.getId(), bean.getName()); }
0
public static void main(String [] args) { ExperimentDao experimentDao = new JpaExperimentDao(); // ExperimentDataStore cache = new RedisABSeeCache(); ExperimentDataStore cache = new MemcachedExperimentDataStore(); // ExperimentDataStore cache = new HashMapABSeeCache(); cache.flush(); // Clear down from previous...
8
public void copyFile(String copyFrom,String copyTo){ File file1 = new File(copyFrom); File file2 = new File(copyTo); try { if(!file1.exists()){ throw new SecurityException(); } if(file2.exists()){ System.out.println("The file yo...
5
public boolean add(Libros l){ PreparedStatement ps; try { ps = mycon.prepareStatement("INSERT INTO Libros VALUES(?,?,?,?,?,?)"); ps.setString(1, l.getCodigolibro()); ps.setString(2, l.getNombrelibro()); ps.setString(3, l.getTitulolibro()); ps.s...
1
public static void main(String[] args) { String[] texts = new String[] { "kiedy xP x-D :-D :( :(((( ;)kierowca samochodu stracił panowanie? :) I Ci ludzie ciągle piją do wszystkich, że nie chcą ich przepuszczać na skrzyżowaniach, że kierowcy samochodów nie chcą wjeżdżać na chodniki, aby przepuścić przepychającego...
8
public void updateLabels(Label l, ArrayList<String> labels) throws RollbackException { for(String s : labels) { if(s.equals("funny")) l.setFunny(l.getFunny() + 1); else if(s.equals("cute")) l.setCute(l.getCute() + 1); else if(s.equals("animal")) l.setAnimal(l.getAnimal() + 1); else if(s.equals...
9
private void doIndex() throws IOException { for (int i = 0; i < files.size(); i++) { InputStream is = files.get(i); String s = new BufferedReader(new InputStreamReader(is)).readLine(); tokenize(s, i); } }
1
protected ModReader(){ try { unimodController = new UnimodDataAccessController(unimodUrl); psiModController = new PSIModDataAccessController(psiModUrl); prideModController = new PRIDEModDataAccessController(prideModdUrl); } catch (Exception e) { String msg...
5
private void loadChidren() { Iterable<T> iterable = _selector.select(_ancestor); if(iterable != null) { _children = iterable.iterator(); if(_children.hasNext()) { _childIterator = new FlatternerIterator<T>(_children.next(), this._selector); _state = 1; } else { _state ...
2
public Warrior(Grid g, Patch p) { super(g, p); setFriendly(true); setMove(3); setRange(0); setHealth(100); setShield(5); setDamage(20); setMaxHealth(110); try { getStates().add(ImageIO.read(new File("res/Warrior/Warrior.gif"))); } catch (IOException e) { } try { getStates().add(ImageIO.re...
7
public void sql_add_account() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver").newInstance(); Statement s = GUI.con.createStatement(); //CHANGE FUNCTIONS DEPENDING ON HIERARCHY if(GUI.Level == 1) { s.executeUpdate ("INSERT...
4
public void startWorkers (int workersNum) { for (int i = 0; i < workersNum; ++i) { Worker worker = new Worker(this, i); workers.add(worker); (new Thread(worker)).start(); } }
1
public static List<Interval> merge(List<Interval> intervals) { Collections.sort(intervals, new Comparator<Interval>() { @Override public int compare(Interval o1, Interval o2) { // TODO Auto-generated method stub return o1.start-o2.start; } }); for (int i = 0; i < intervals.size() - 1; i++) { ...
4
public static void zeigeBmiAn (double bmi) { // Ausgabe System.out.print("Der BMI ist: " + bmi + ", dass ist "); // mit Zusatzinfo if(bmi < 20){ System.out.println("Untergewicht"); } else if(bmi >= 20 && bmi <= 24){ System.out.println("Idealgewicht"); } else if(bmi >= 25 && bmi <= 30){ Sy...
6
public void deleteDupNodeInPlace(ListNode head){ if(head == null) return; ListNode current = head; while(current != null){ ListNode runner = current; while(runner.next!=null){ if(current.val == runner.next.val) runner.next = runner.ne...
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (hashCode() == o.hashCode()) return true; NaturalSatellite that = (NaturalSatellite) o; if (population != that.population) return false; ...
9
public boolean isLeaf() { return (this.fDroit == null && this.fGauche == null); }
1
public MethodVisitor visitMethod( final int access, final String name, final String desc, final String signature, final String[] exceptions) { buf.setLength(0); buf.append("{\n"); buf.append("mv = cw.visitMethod("); appendAccess(access); ...
4
public static ArrayList<Question> getQuestionsByQuizID(int quizID) { ArrayList<Question> questionList = new ArrayList<Question>(); try { String statement = new String("SELECT * FROM " + DBTable + " WHERE quizid = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, qui...
2
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ElementScore elementScore = (ElementScore) o; if (element != null ? !element.equals(elementScore.element) : elementScore.element != null) return false;...
7
@Id @Column(name = "PCA_GENERICO") public Integer getPcaGenerico() { return pcaGenerico; }
0
public void paint1(Graphics g) { //g.drawImage(introImagen, 0, 0, this); g.drawImage(background, 8, 30, this); g.setFont(new Font("Serif", Font.BOLD, 34)); g.drawString("Score: " + score, 44, 195); g.setColor(Color.red); g.drawString("Vidas: " + vidas, 44, 250); ...
7
@Test public void test_insertions() { int m = 3; int n = 5; Matrix m1 = new MatrixList(m, n); for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) m1.insert(i, j, (double) (i * j)); } for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) assertEquals(m1.get(i, j), (double) (i *...
4
private void subledger2(ArrayList<ArrayList> arrayL) throws SQLException { String query3; this.getORDTLID(); System.out.println("sub2 size "+arrayL.size()); Statement stmt = null; this.connect(); conn = this.getConnection(); stmt = conn.createStatement(); ...
5
public void actionPerformed(ActionEvent e) { System.out.println(e.getActionCommand() + " pressed."); if (e.getActionCommand() == "BOXSELECT") { boxSelect(); } else if (e.getActionCommand() == "BRUSH") { brush(); } else if (e.getActionCommand() == "ERASER") { eraser(); } else if (e.getActionComm...
7
public void addChangeListener(ChangeListener listener) { changeListeners.add(listener); }
0
public int ladderLength(String beginWord, String endWord, Set<String> wordList) { Set<String> beginSet = new HashSet<String>(); Set<String> endSet = new HashSet<String>(); int len = 1; HashSet<String> visited = new HashSet<String>(); beginSet.add(beginWord); endSet.add(endWord); while (!beginSet....
9
private final int getHpFilter() { int[] hps = { 0, 1000, 5000, 10000, 20000, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000, 600000, 700000, 800000, 900000, 1000000, 1200000, 1400000, 1600000, 1800000, 2000000, 2250000, 2500000, 2750000, 3000000, 3500000, 4000000, 450000...
6
protected void paintButtonPressed(Graphics g, AbstractButton b) { boolean divider = b.getName() == null ? false : b.getName().equals("dividerButton"); if(divider) { return; } int lenText = b.getFontMetrics(b.getFont()).stringWidth(b.getText() == null ? "" : b.getText()); int star...
8
public boolean move(){ int x =getPlayerposX(); int y=getPlayerposY(); boolean hite = false; System.out.println(x); if (x<=x+1&&x>=x-1&&x==x){ System.out.println("estoy aqui dentro de los margenes"); if(y>=y+1&&y>=y-1){ System.out.println("estoy aqui dentro de los margenes"); hite=true; } }...
5
static boolean isCongruent(Class<?>[] params, Object[] args){ boolean ret = false; if(args == null) return params.length == 0; if(params.length == args.length){ ret = true; for(int i = 0; ret && i < params.length; i++){ Object arg = args[i]; Class<?> argType = (arg == null)...
8
private void mc(int itr) { List<P> wybrane = new ArrayList<P>(); Random r = new Random(); P wybrane_n = new P(); for (int i = 0; i < this.tabSizeX; i++) { for (int j = 0; j < this.tabSizeY; j++) { //if ( this.naGranicy(i, j) ) continue; // nie biez pod uwage gotowych ziaren wybrane.clear(); i...
5
public static void recv(String provider, String server, String user, String password) { Store store = null; Folder folder = null; try { // -- Get hold of the default session -- Properties props = System.getProperties(); Session session = Session.getDefaultInstance(props, null); // -- Get hold of...
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 feel. * For details see http://down...
7
public double[][] cholesky(double[][] matriz) { double temp[][] = new double[linhas][colunas]; for (int i = 0; i < linhas; i++) { for (int j = 0; j <= i; j++) { double soma = 0.0; for (int k = 0; k < j; k++) { soma += temp[i][k] * temp[j][...
5
public static void send(String message){ }
0
public static void main(String[] args) { IMamifer mamifer1 = new AnimalSalbatic("leu", false, 5); IMamifer mamifer2 = new AnimalDomestic("vaca", true, "Andrei"); Animale animal1 = new AnimalSalbatic("zebra", false, 0); AnimalSalbatic salbatic = new AnimalSalbatic("hiena", false, 2); ...
6
public void add_bits (int bitstring, int length) { int bitmask = 1 << (length - 1); do if (((crc & 0x8000) == 0) ^ ((bitstring & bitmask) == 0 )) { crc <<= 1; crc ^= polynomial; } else crc <<= 1; while ((bitmask >>>= 1) != 0); }
2
private int lengthOfCurrentString() { int i = 0; while (bytes[streamPosition + i] != 0) { i++; } return i; }
1
public void updateGroup(Group f) { if (groups == null) { updateGroups(); } //save changes to db MongoHelper.save(f, MongoHelper.GROUP_COLLECTION); if (!user.getGroups().contains(f.getId())) { //user doesn't have the group yet user.addGroup(f.g...
5
public boolean mouseDrag (Event event, int x, int y) { boolean firstDrag = false; if (!dragged) { if (x > dragStart.x+dragThreshhold || x < dragStart.x-dragThreshhold || y > dragStart.y+dragThreshhold || y < dragStart.y-dragThreshhold) { dragged = true; firstDrag = true; }...
7
public N getCeilingNode(T payload) { N p = m_root; while (p != null) { int cmp = compare(payload, p.getPayload()); if (cmp < 0) { if (p.getLeft() != null) p = p.getLeft(); else return p; } else if (cmp > 0) { if (p.getRight() ...
7
private JMenu getBoardsMenu() { //add List of Boards final JMenu boards = new JMenu("Board(s)"); //clicking the new board button brings up the new board dialog JMenuItem newBoardButton = new JMenuItem("New Board"); boards.add(newBoardButton); newBoardButton.addActi...
5
private void recursiveDelete(File file) { if (file == null || !file.exists()) { return; } if (file.isDirectory()) { File[] files = file.listFiles(); if (files == null || files.length == 0) { return; } for (File f : files...
6
public void checks() { if (Mouse.isButtonDown(0)) { Vector3D vector = new Vector3D(0, 0, 0); vector.y = ((float) -Math.sin(Math.toRadians(camera.pitch))); float v = (float) Math.cos(Math.toRadians(camera.pitch)); vector.x = ((float) (Math.sin(Math.toRadians(camera...
8