text
stringlengths
14
410k
label
int32
0
9
private void placeLightGrenadeNearPlayer() { for (Player p : players) { boolean placed = false; int minX = p.getPosition().getxCoordinate() - 2; int maxX = p.getPosition().getxCoordinate() + 2; int minY = p.getPosition().getyCoordinate() - 2; int maxY = p.getPosition().getyCoordinate() + 2; if (...
9
public boolean connects(RouteLeg routeLeg) { return this.routeLeg.getStartNode().equals(routeLeg.getStartNode()) && this.routeLeg.getEndNode().equals(routeLeg.getEndNode()); }
1
private void addDependentType(String canonicalName) { Class<?> toAdd = null; try { toAdd = Class.forName(canonicalName); } catch (ClassNotFoundException e) { //System.err.println("Warning: class not found (" + canonicalName + ")"); } if (toAdd != null && Modifier.isPublic(toAdd.getModifiers()) &...
8
private void getSample () { // Tell the main thread we getting audio gettingAudio=true; int a,sample,count,total=0; // READ in ISIZE bytes and convert them into ISIZE/2 integers // Doing it this way reduces CPU loading try { while (total<ISIZE) { count=audioMixer.line.read(buffer,0,I...
6
private void centerMouse() { if (robot != null && component.isShowing()) { // Because the convertPointToScreen method // changes the object, make a copy! Point copy = new Point(center.x, center.y); SwingUtilities.convertPointToScreen(copy, component); robot.mouseMove(copy.x, copy.y); } }
2
public double minDataDLIfDeleted(int index, double expFPRate, boolean checkErr){ //System.out.println("!!!Enter without: "); double[] rulesetStat = new double[6]; // Stats of ruleset if deleted int more = m_Ruleset.size() - 1 - index; // How many rules after? FastVector indexPlus = new FastVector...
7
public void plotTrainingScrawl(File trainFile) { theNet.clearTrainingData(); loadTrainingData(trainFile); DisplayGraph[] dispGraph = new DisplayGraph[CypherType.size()]; for (int i = 0; i< dispGraph.length; i++) { dispGraph[i] = new DisplayGraph(CypherType.fromIntToString(i) + " : Scrawl Plot"); } ...
7
public List<Short> getShortList(String path) { List<?> list = getList(path); if (list == null) { return new ArrayList<Short>(0); } List<Short> result = new ArrayList<Short>(); for (Object object : list) { if (object instanceof Short) { r...
8
public void doesCollide(Drawable i, Drawable s, Window w) //Checks if two objects collide. If they do, it runs the doCollide() method in the Drawable i { if(i.getX() < s.getX()+s.getWidth()){ if(i.getX()+i.getWidth() > s.getX() ) if(i.getY() < s.getY()+s.getHeight()) if(i.getY()+i.getHeight() > s.getY() ) ...
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FightState other = (FightState) obj; if (!Arrays.deepEquals(atkCnt, other.atkCnt)) return false; if (spareDamage != other.spareDa...
6
public static void main(String[] args) { Cell[][] spreadsheet = new Cell[8][10]; length = spreadsheet[0].length; setSpreadsheetToEmpty(spreadsheet); printSpreadsheet(spreadsheet); String inputFromUser = inputFromUser(); while (!inputFromUser.equalsIgnoreCase("quit")) { int indexOfEquals = inputFromUser....
8
public LinkedList<StockPosition> qsort( LinkedList<StockPosition> d, int comparing ) { if (comparing == 0) // 0 means you are sorting by ticker name qsHelpTick( 0, d.size()-1, d ); if (comparing == 1) // 1 means compare by quantity of shares held qsHelpQuant( 0, d.size()-1, d ); return d; }
2
private boolean doAction(final String action, final SceneObject obj) { if(Players.getLocal().getAnimation() == -1 && !Players.getLocal().isMoving()) { if(obj.getLocation().distanceTo() > 5) { Walking.walk(obj.getLocation()); } else { if(!obj.isOnScreen()) { Camera.turnTo(obj); } else { if(...
7
@Override public void rightMultiply(Matrix other) { // TODO Auto-generated method stub for(int i=0;i<4;i++) for(int j=0;j<4;j++) copy[i][j]=0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { copy[i][j]=copy[i][j] + this.get(k, i) * other.get(j, k)...
7
public static TcpPollResult hostAvailable(String ip) { int port = 80; try { SocketAddress addr = new InetSocketAddress(ip, port); new Socket().connect(addr, 5000); return TcpPollResult.CONNECTED; } catch (UnknownHostException ex) { return TcpPollR...
7
public MenuLevel () { super(); int i; int posx; int posy; int index; try { setImg(ImageIO.read(new File("img/background/menu.jpg"))); } catch (IOException e) { e.printStackTrace(); } _title.setBounds(180, 25, 430, 70); _title.setFont(new Font("Arial", Font.BOLD, 45)); add(_title); ...
9
public boolean readField(aos.apib.InStream in, aos.apib.Base o,int i) { if ( i > __field_names.length ) return getBaseClassStreamer().readField( in, o, i - __field_names.length - 1 ); AuthenticationRequest v = (AuthenticationRequest)o; switch (i) { case 0: v.id = in.getInt(); break; ...
5
public static ConnectionSingleton getInstance() { if (instance == null) instance = new ConnectionSingleton(); return instance; }
1
public boolean isVariableWLocked(int index) { for (Transaction t: locks.keySet()) { ArrayList<Lock> lockListT = locks.get(t); for (Lock lock: lockListT) { if(lock.getIndex()==index && lock.isWrite()) { return true; } } } return false; }
4
private static List<Point[]> mergePolygonPointList(int labelCount, Map<Integer, Integer> mergeLabels, List<List<Point>> polygonPointList){ List<Integer> objectLabel = new LinkedList<Integer>(); for(Integer key : mergeLabels.keySet()) { // System.out.println(key+"<-->"+mergeLabels.get(key)); if(key.equals(me...
7
private List removeAssociatedBends(RadialBond killedBond) { if (bends.isEmpty()) return null; List<AngularBond> list = new ArrayList<AngularBond>(); Atom atomOne = killedBond.getAtom1(); Atom atomTwo = killedBond.getAtom2(); synchronized (bends.getSynchronizationLock()) { for (Iterator i = bends.iterato...
8
protected void eatCombinationOne() { int green = 0; int red = 0; for (Iterator<Plant> it = plants.iterator(); it.hasNext();) { Plant pl = it.next(); if (pl.getType() == Plant.GREEN_PLANT && green < 1) { it.remove(); green++; } if (pl.getType() == Plant.RED_PLANT && red < 1) { it.remove(); ...
7
private void recursion1(int depth, int index, ArrayList<String> result, ArrayList<Character> current) { //judge int left = 0; int right = 0; String item = ""; for (char c : current) { if (c == '(') { left++; } else { right+...
6
public boolean mineTile(){ if(resources > 0){ resources--; if(resources == 0){ Debug.game(tileType + " tile is depleted of resources and became a grass-tile."); tileType = TileType.GRASS; id = "G"; // TODO: it may be of interest later to *Tiles-- and grassTiles++. // Doesn't seem particularly impor...
2
public TableCellRenderer getCellRenderer(int row, int column) { TableCellRenderer renderer = (TableCellRenderer) renderers.get(getKey(row, column)); if (renderer == null) { // no renderer specified for the cell, checking if specified for the column... renderer = (TableCellRendere...
6
synchronized String getLine() { // Write the code that implements this method ... try { while (available == 0) wait(); } catch (InterruptedException exc) { throw new RTError("Buffer.putLine interrupted: "+exc); } String value = buffData[nextToGet]; if (...
3
@Override public void iterate(){ matcount += 1; if(matcount >= mat){matcount = 0; calculate(); } if(ages){ if(active){ if(age == 0){age = 1;} else{age += 1;}}else{ age = 0;} if(fades){ if( age >= fade){ purgeState(); age = 0;}} if( age > 1023){ age = 1023; } state = agify(age);} //else{...
7
public static void exportSequenceAsSpreadSheet(SegmentedImage[] images, String oName){ Workbook wb = new HSSFWorkbook(); for(SegmentedImage image : images){ dumpImageToSheet(image, wb); } try{ FileOutputStream out = new FileOutputStream(oName + ".xls"); wb.write(out); out.close(); } catch (E...
2
private void setupSelectionGL() { float xoff = this.getX(); float yoff = this.getY(); List<VertexData> ret = new LinkedList<VertexData>(); this.scalingConst = this.fontSize / this.font.getHeight("A"); int aqc = 0; for(int i = 0; i < this.selectionEnd; i++) { String c = this.actualText.substri...
7
@Override public TestResult test(Double input, Double... args) { double minValue = args[0]; double maxValue = args[1]; boolean passed = (input >= minValue && input <= maxValue); String message = passed ? null : String.format(messageT,minValue,maxValue); return new TestResult(...
2
protected void receiveMessageData(IRemoteCallObjectMetaData meta, IRemoteCallObjectData data) throws Exception { if (!meta.getExecCommand().equalsIgnoreCase(ISession.KEEPALIVE_MESSAGE)) { ConnectionInfo info = new ConnectionInfo( this.idConnection, ...
1
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || this.length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this....
4
public int min(int hori, int verti, int dia) { if (hori <= verti && hori <= dia) { return hori; } else if (verti <= hori && verti <= dia) { return verti; } else { return dia; } }
4
public void draw(){ BufferStrategy bs = getBufferStrategy(); if(bs == null){ createBufferStrategy(3); return; } Graphics2D g = (Graphics2D) bs.getDrawGraphics(); // g.setColor(Color.DARK_GRAY); g.fillRect(0, 0, dim.width, dim.height); if(kh.isPicureOn()) g.drawImage(image, 0, 0, dim.width, ...
6
private static void updateFPS() { if (Time.getTime() - lastFPS > 1000) { System.out.println("FPS: " + fps); fps = 0; lastFPS += 1000; } fps++; }
1
private static void sort(int[] array) { for (int i = 1; i < array.length; i++) { for (int j = 0; j < array.length - i; j++) { if (array[j] < array[j + 1]) { array[j] = array[j] ^ array[j + 1]; array[j + 1] = array[j] ^ array[j + 1]; ...
3
public static Set<String> addTwoChar( String word ){ //check permission if( word.length() < ADD_TWO_ACCESSIBLE ) return new HashSet<String>(); word = word.toLowerCase(); StringBuilder processBuilder = new StringBuilder( word ); int wordLength = processBuilder.length(); Set<String> returnList = new Ha...
9
public JTextField[] getTextFields() { return textFields; }
0
public Profile(){ emptyString = lambda; transTuringFinal = false; transTuringFinalCheckBox = new JCheckBoxMenuItem("Enable Transitions From Turing Machine Final States"); transTuringFinalCheckBox.setSelected(transTuringFinal); transTuringFinalCheckBox.addActionListener(new ActionListener() { ...
0
@Override public void keyPressed(KeyEvent flecha){ if(flecha.getKeyCode()==39){ if(posX==670){ posX = 670; contador += 1; }else{ posX = posX + 160; contador += 1; } } else if(flecha.getKeyCode()==37...
7
public void Print(boolean result, int ActiveTO, int sequence, boolean active,int TIME) { if(active) { if(result) System.out.println("Time: "+ TIME +" Attempting Bus: "+ (ActiveTO+1) +" Set -> ACTIVE Packet: "+sequence); else{ ...
3
public void saveGraph(File file) { BufferedImage image = new BufferedImage( contents.getWidth(), contents.getHeight(), BufferedImage.TYPE_INT_RGB ); Graphics2D g = image.createGraphics(); g.setColor(Color.WHITE); g.fillRect(0, 0, contents.getWidth(), contents.getHeight()); Statistics.drawGraph(g...
3
public Dimension getPreferredSize(JComponent c) { String tipText = ((JToolTip) c).getTipText(); if (tipText == null) return new Dimension(0, 0); textArea = new JTextArea(tipText); rendererPane.removeAll(); rendererPane.add(textArea); textArea.setWrapStyleWord(true); int width = ((JMultiLineToolTip) c)....
3
private void send(byte[] contents) throws IOException { checkOpen(); try { byte cs = checksum(contents); /* SOP */ tx.write((byte)0x0f); tx.write((byte)0x0f); /* send bytes, escape if needed */ for (byte b : contents) { if (b == 0x0f || b == 0x05 || b == 0x04) { tx.wr...
8
public void select() { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { //1、加载驱动 Class.forName("com.mysql.jdbc.Driver"); String url ="jdbc:mysql://localhost:3306/rock"; //2、建立连接 conn = DriverManager.getConnection(url,"root","123456"); String sql = "select * ...
7
public boolean attack(int destx, int desty, boolean returnfire) { //Disables the ability to attack when a unit has already moved positions. if ((x != oldx && y != oldy) && !MoveAndShoot) {return false;} units.Base target = FindTarget(destx, desty, true, false); if (target!=null) { if (inrange(target.x, targ...
8
public BigDecimal variance_as_BigDecimal() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } BigDecimal variance = BigDecimal.ZERO; switch (type) { case 1: case 12: BigDecimal[] bd = thi...
5
public void propagateBackNNA(Bin tst) throws IOException{ double sum = 0; int i = 0; Elem tek; if(tst==bins[0]){ constructNet(bins[1].binHead); tek = bins[1].binHead; i=1; } else { updateNet(bins[0].binHead); tek = bins[0].binHead; } //updateNet instead of updateIO in order to reset out...
9
public static String averageTimeZone(ArrayList<Kill> Kills) { String result; int[] quartile = new int[3]; int[] hours = new int[24]; int total = 0; for (Kill k : Kills) { hours[k.getKillTime().get(Calendar.HOUR_OF_DAY)]++; } int[] min = new int[] { 0, hours[0] }; for (int i = 0; i < 24; i++) { ...
7
public BinaryNode search(int key) { BinaryNode result = null; if (left != null && key < elementNumber) { result = left.search(key); } else if (right != null && key > elementNumber) { result = right.search(key); } else { result = this; } ...
4
public Hunter(HuntField field) { this.alive = true; this.type = 'H'; this.hunted = 0; this.field = field; synchronized (field) { this.position = new Position(random.nextInt(field.getXLength()), random.nextInt(field.getYLength())); while (field.isOccupied(p...
1
public boolean registryServer(String address, int id) throws RemoteException { /* Was the server registered? * If something fails it will be set to 'false' */ boolean registered = true; //New server InterfaceReplicacao newserver = null; //Looking for the new server try { newserver = (Interfac...
4
public void setId(String value) { this.id = value; }
0
public Set<Map.Entry<Short,Double>> entrySet() { return new AbstractSet<Map.Entry<Short,Double>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TShortDoubleMapDecorator.this.isEmpty(); } ...
8
private void implyRotationFrictionToMoments() { // If there are no moments, doesn't do anything if (this.moments.isEmpty()) return; ArrayList<Point> momentstobeended = new ArrayList<Point>(); // Goes through all the moments for (Point p: this.moments.keySet()) { double f = this.moments.get(p); ...
5
public void renderImage(int xp, int yp, int[] imagePixels, int Width, int Height, boolean fixed) { if (fixed) { xp -= xOffset; yp -= yOffset; } for (int y = 0; y < Height; y++) { int ya = y + yp; for (int x = 0;x < Width; x++) { int xa = x + xp; if (xa < 0 || xa >= width || ya < 0 || ya >= hei...
7
public SoapRequest(Service service, Method method, Object parameters) { //Set the results node resultsNode = method.getResultsNodeName(); //Create new http request request = new javaxt.http.Request(service.getURL()); request.setHeader("Content-Type", "text/xml; charset=ut...
9
public ICommand getCommand(HttpServletRequest request) { String action = request.getParameter("command"); ICommand command = commands.get(ParserType.valueOf(action.toUpperCase())); if (command == null) { command = (ICommand) new NotFoundCommand(); } return command; ...
1
@Override public void publishInterruptibly(long sequence, Sequence lowerCursor) throws InterruptedException { int counter = RETRIES; while (sequence - lowerCursor.get() > pendingPublication.length()) { if (--counter == 0) { if (yieldAndCheckInterrupt()) throw new InterruptedExcep...
7
public int bestMeleeAtk() { if(c.playerBonus[0] > c.playerBonus[1] && c.playerBonus[0] > c.playerBonus[2]) return 0; if(c.playerBonus[1] > c.playerBonus[0] && c.playerBonus[1] > c.playerBonus[2]) return 1; return c.playerBonus[2] <= c.playerBonus[1] || c.playerBonus[2] <=...
6
private void addHandlerEdges(final Block block, final Map catchBodies, final Map labelPos, final Subroutine sub, final Set visited) { // (pr) if (visited.contains(block)) { return; } visited.add(block); final Tree tree = block.tree(); Assert.isTrue(tree != null); final Iterator hiter = handlers.v...
7
@Override public ResourceTask nextTask(final int taskId) throws Exception { lock.lock(); try { while (true) { // 1. counting tasks: final Range numberRange = numberRangeIterator.next(); if (numberRange != null) { assert (sortingTasksSubmitted == 0); // compose...
8
public void removeOnetimeLocals() { block.removeOnetimeLocals(); if (nextByAddr != null) nextByAddr.removeOnetimeLocals(); }
1
public void doLexing() { LexerRule accRule = null; while (finishIndex < input.length() - 1) { while (currentState.isAnyAlive()) { ++finishIndex; LexerRule tmpRule = currentState.getAccepted(); if (tmpRule == null) { } else { accRule = tmpRule; lastIndex = finishIndex - 1; } if ...
5
public String nextCDATA() throws JSONException { char c; int i; StringBuffer sb = new StringBuffer(); for (;;) { c = next(); if (end()) { throw syntaxError("Unclosed CDATA"); } sb.append(c); i = ...
6
private static void toDescriptor(StringBuffer desc, CtClass type) { if (type.isArray()) { desc.append('['); try { toDescriptor(desc, type.getComponentType()); } catch (NotFoundException e) { desc.append('L'); String ...
3
@Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub }
0
public long set(long millis, int value) { long timeOnlyMillis = iChronology.getTimeOnlyMillis(millis); int[] ymd = iChronology.gjFromMillis(millis); // First set to start of month... millis = iChronology.millisFromGJ(ymd[0], value, 1); // ...and use dayOfMonth field to check rang...
1
public void findMails( ) { this.ec.clearMails(); File[] path = new File(this.path).listFiles(); for(File f : path) { if(f.isFile() && f.getName().contains(".eml")) { EMail e = new EMail(); e.setFileName(f.getName()); e.parseMail(this.path, f.getName()); e.setId(this.ec.getNewId()); this.ec....
3
@Override public String prefix_toString(){ int count = 0; String representation = ""; if(children.length != 0 && count/2 <= children.length){ representation += children[count].prefix_toString(); count++; } representation += root.name+ " "; if(children.length != 0 && count/2 > children.length){ rep...
4
public static void main(String[] args) { if (args.length != 2) { System.out.println("THERE WAS AN ERROR WITH THE INPUTS"); return; } String tfile = ""; // .torrent file to be loaded String sfile = ""; // name of the file to save the data to for (int i = 0; i < args.length; i++) { if (i == 0) { ...
9
private void CreateCourse() { //these will help set and control logic for courese points = new int[4]; passedPoint = new boolean[4]; passedPointLoc = new int[4]; for (int i = 0; i < points.length; i++) { points[i] = random.nextInt(1500 + 200); pa...
3
public boolean moveable(Game game, Piece piece, Square targetSquare) { Chess chess = game.getChess(); Square square = piece.getCurrent(); Piece targetPiece = chess.locatePiece(targetSquare); // if (chess.isLeapOver(piece.getCurrent(), targetSquare)) { return false; ...
7
public void addBan(String pname) { try { String[] banList = plugin.getBans(); ArrayList<String> arraylist = new ArrayList<String>(); for (String p : banList) { if (p != pname) { arraylist.add(p); } } new File(plugin.getDataFolder() + File.separator + "bans.txt") .createNewFile(); F...
5
public static void main(String[] args) { if (args.length == 0) { System.err.println("Please provide a text file name"); System.exit(1); } String fileName = args[0].toString(); int count = DEFAULT_COUNT; if (args.length > 1) { try { count = Integer.parseInt(args[1]); } catch (NumberFormatExce...
8
public static SharedTorrent fromFile(File source, File destDir) throws IllegalArgumentException, IOException { FileInputStream fis = new FileInputStream(source); byte[] data = new byte[(int)source.length()]; fis.read(data); fis.close(); return new SharedTorrent(data, destDir); }
0
@Override public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); String [] movieInfoStrings = line.split("%%%"); assert(movieInfoStrings.length==3); int year=0; try { year= Integer.parseI...
2
public ConnectionThread(final int id, final Socket socket) { ID = id; try { bReader = new BufferedReader(new InputStreamReader(socket.getInputStream())); pWriter = new PrintWriter(socket.getOutputStream(), true); } catch(Exception e) { e.printStackTrace(); } thread = new Thread() { @Override ...
9
public boolean calculate() { //nope, actually change it if (seqChange.isSnp()) setSNP(); if (seqChange.isIns()) setINS(); if (seqChange.isDel()) setDEL(); return this.transcriptChange(); }
3
public Frame9() { try{ Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL,USER, PASS); statement = conn.createStatement(); }catch(SQLException se){ se.printStackTrace(); }catch(Exception e){ e.printStackTrace(); } setTitle("Blok D, 1 - 33 ; 68 - 73"); setDefaultCloseOpe...
8
public UnknownExcelReport1(File file) { super(file); }
0
private void JTreeContaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JTreeContaMouseClicked DefaultMutableTreeNode node = (DefaultMutableTreeNode) JTreeConta.getLastSelectedPathComponent(); if (node == null){ return; } else{ if (this.op...
8
@Override public boolean addCommand(CommandBase command) { CommandDescriptor descriptor = command.getDescriptor(); if (!(descriptor instanceof Dispatchable)) { throw new IllegalArgumentException("The given command is not dispatchable"); } // Remove command f...
8
public List<Double> getColumn() { if (column == null) { column = new ArrayList<Double>(); } return this.column; }
1
@Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; for (int y = 0; y < Board.getHeight(); ++y ) { for (int x = 0; x < Board.getWidth(); ++x) { g2.setColor(board.getBackgroundColor()); g2.fill...
4
public List<Administrateur> ListerAdministrateurs() { try { String sql = "SELECT * FROM User WHERE role='Administrateur'"; ResultSet rs = crud.exeRead(sql); List<Administrateur> liste = new ArrayList<Administrateur>(); while (rs.next()) { Administr...
2
public VOCheckIndex checkIndex(VOBackupIndex backupIndex, final boolean checkExistsFile, final boolean checkFileCheckSum) { VOCheckIndex result = new VOCheckIndex(); if (CollectionUtils.isNotEmpty(backupIndex.getBackupFileList())) { ...
9
public boolean areTherePriceForQuantity (int productPackQuantity) { return prices.containsKey(productPackQuantity); }
0
public boolean equals(Object _other) { if (_other == null) { return false; } if (_other == this) { return true; } if (!(_other instanceof UserPk)) { return false; } final UserPk _cast = (UserPk) _other; if (id != _cast.id) { return false; } if (email == null ? _cast.email !=...
7
private int getItemIndexByElementName(String elementName) { int result = -1; Item [] items = tree.getItems(); for(int i = 0; i < items.length; i++) { if(items[i].getText().equals(elementName)) { return i; } } return result; }
2
public String getImportFileFormat() { return (String) importFormatComboBox.getSelectedItem(); }
0
@Override public String prepareConsoleMessage(int type, String msg, Throwable throwable) { StringWriter stackTrace = new StringWriter(); if (throwable != null) { throwable.printStackTrace(new PrintWriter(stackTrace)); } return (Logger.MSG_TYPE_STRING[type] + ": " + msg + stackTrace.toString()); }
1
public static NoteEditorFrame getInstance(){ if (instance == null){ instance = new NoteEditorFrame(); } return instance; }
1
public Project2_Move_Thompson getRandomMove(int RANDOMIZATION_ALGORITHM) { //Create a list to hold all of our pieces. java.util.ArrayList<Integer> pieces = new java.util.ArrayList<Integer>(); //Find all our pieces for(int i = 0; i < 64; i++) { if(color[i] ==DARK) { pieces...
9
private synchronized void integrate() { //в этом методе движок расчитывает, как взаимодействуют объекты for (PhysicalBody physBody : physBodies.values()) { Vector3d resultForce = new Vector3d(); for (ForceField forceField : forceFields.values()) { Vector3d anotherForce = forceField.forceForPhysicalBo...
5
public static void main(String[] args) { args = getCombinedArgs(args); String challengerBot = parseStringArgument("bot", args, "ERROR: Pass a bot with -bot, eg: -bot voidious.Dookious 1.573c"); String challengeFile = parseStringArgument("c", args, "ERROR: Pass a challenge file with -c, eg: -...
7
public void fireModifiedStateChangedEvent(Document doc) { modifiedStateChangedEvent.setDocument(doc); for (int i = 0, limit = documentListeners.size(); i < limit; i++) { ((DocumentListener) documentListeners.get(i)).modifiedStateChanged(modifiedStateChangedEvent); } for (int i = 0, limit = outlinerDocumentLi...
2
private void createFht() { fht = new FastHashTable<Integer,Short>(N,M,K,W,WORD,BITS); table = new Hashtable<Integer,Short>(N); }
0
public List<Person> getFriendsList(String accessToken) throws OAuthError { String basicInfoUrl = Constants.FB_FRIENDS_LIST_URI; List<Person> personList = new ArrayList<Person>(); try { String charset = "UTF-8"; List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePa...
8
@WebMethod(operationName = "ReadUser") public ArrayList<User> ReadUser(@WebParam(name = "user_id") String user_id) { User user = new User(); ArrayList<User> users = new ArrayList<User>(); ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>(); if(!user_id.equal...
3