text
stringlengths
14
410k
label
int32
0
9
public void addMatch(Match match){ match.setPlaymode(this.playmode); match.setGameID(this.gID); match.setScoreList(this.scoreList); if(this.runningMatch == null){ this.runningMatch = match; }else{ this.upcomingMatches.add(match); } }
1
private void createSR(String in1, String in2, String out) { SRFlipFlop sr = new SRFlipFlop(); // Connect the first input // Check if the in wire is an input if (stringToInput.containsKey(in1)) { Wire inWire = new Wire(); stringToInput.get(in1).connectOutput(inWire); sr.connectInput(inWire); } /...
8
public void clickChooseCharacterSkills(Scanner scanchoice, ArrayList<MainMenuHeroSlot> heroies) { state.clickChooseSkills(scanchoice, heroies); }
0
@Override public void draw(Graphics g) { //Draw Score Card g.setFont("Arial", Graphics.BOLD, 25); g.setColor(Color.WHITE.getRGB()); g.drawString("Score:",GamePanel.GAMEWIDTH+20,70); g.setFont("Arial",Graphics.PLAIN,15); ...
9
public static double[][] benchmarkJLargeArraysDoubleSequentualNative(long[] sizes, int[] nthreads, int iters, String file) { LargeArray.setMaxSizeOf32bitArray(1); double[][] results = new double[nthreads.length][sizes.length]; long k; System.out.println("Benchmarking JLargeArrays (do...
8
private void updateAIPaddle() { if (ballXSpeed < 0) { double destination = AI.outputs(new double[] {ballY, ballX, ballYSpeed})[0]; destination = destination*2-1; //retour entre 0 et 1 if (Math.abs(destination-AIPaddlePos) > 0.04) { if (destination > AIPaddlePos) { AIPaddlePos += 0.03; } else { AIP...
3
private static void processSource(final Socket connectionSocket) { //create a new source task Runnable sourceTask = new Runnable() { @Override public void run() { //get source socket Socket sourceSocket = connectionSocket; while (li...
3
public void removeChild(int index) { if (children != null && index >=0 && index < children.size()) children.remove(index); }
3
@Test public void testExecutionSucceededState() throws ProcessExecutionException, ProcessRollbackException { IProcessComponent<?> comp = TestUtil.executionSuccessComponent(true); // use reflection to set internal process state TestUtil.setState(comp, ProcessState.EXECUTION_SUCCEEDED); assertTrue(comp.getStat...
5
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
5
public List<Player> getWinner(){ List<Player> winners = new ArrayList<Player>(); winners.add(allPlayers.get(0)); int max = allPlayers.get(0).getPoints(); for(int i=1;i<allPlayers.size();i++){ Player p = allPlayers.get(i); if(p.getPoints()>max){ winners.clear(); winners.add(p); max = p.getPoin...
3
public Map<String, String> getFileLocks(String dir) { Map<String, String> map = new HashMap<>(); String currentPid = null; for(String line : getFileLocksLines(dir)) { if(line == null || line.trim().length() == 0) { continue; } if(line.startsWith("p")) { currentPid = line.substring(1); } els...
5
private static int quickSort0(int[] a, int low, int high, String tabs) { //the valid elements of the list are [low, high] if (high - low <= 1) return high - low; if (high - low == 2) { //efficient! if (a[low] > a[low + 1]) swap(a, low, low + 1); retu...
9
public AIBoard16x16 (int width, int height, String diff, User u){ pencilMode_ON_OFF = false; user = u; difficulty = diff; this.setBackground(Color.WHITE); this.setLayout(new BorderLayout()); JTextPane titleMessage = new JTextPane(); JPanel title = new JPanel(); title.setBackground(Color.WHITE); title....
7
public static String formatearNombreCalle(String c){ String[] l = c.toLowerCase().split(" "); String ret = ""; for (String s : l){ if (!s.isEmpty() && !s.equals("de") && !s.equals("del") && !s.equals("la") && !s.equals("las") && !s.equals("el") && !s.equals("los")){ char mayus = Character.toUpperCase(s.c...
8
public List<Country> randomCountriesFromDifferentContinents(Country startPoint, int size) { List<Country> neighbours = new ArrayList<Country>(size); int tries = MAX_RANDOM_TRIES; do { Country next = randomCountry(); boolean canBeAdded = true; if(StringUtils....
7
public Integer save(Journal journal) { return (Integer) sessionFactory.getCurrentSession().save(journal); }
0
public void setOutputFormat(String outputFormat) { this.outputFormat = outputFormat; }
0
@Override public int[][] findMatching(DeviceGraph graph) { ObjectGraphBuilder ogb = new ObjectGraphBuilder(); HashSet<Requestor> unsortedRequestors = ogb.buildObjectGraph(graph); int requestorCount = unsortedRequestors.size(); TreeSet<Requestor> requestors = new TreeSet<Requestor>(new RequestorComparator()); ...
5
private void tritomyRoot(JadeNode toberoot) { JadeNode curroot = this.getRoot(); assert curroot != null; assert curroot.getChildCount() == 2; // @todo code duplication could be lessened by using a pair of ints: toBeDeletedIndex, toGetExtraBLIndex set to (0,1) or (1,0) if (toberoot == null) { if (curroo...
7
public List<Tiedote> haeEtusivunTiedotteet() throws DAOPoikkeus { // Tämä metodi hakee tiedotteet etusivulle järjestämällä taulun päivämäärän mukaan ja valitsemalla viimeisimmät kolme. List<Tiedote>etusivuntiedotteet; try { // haetaan tiedotteet tietokannasta TiedoteDAO tDao = new TiedoteDAO(); ...
1
ObstaclePopupMenu(AtomisticView v) { super("Obstacle"); view = v; JMenuItem mi = new JMenuItem(view.getActionMap().get(AtomisticView.COPY)); String s = MDView.getInternationalText("Copy"); if (s != null) mi.setText(s); add(mi); mi = new JMenuItem(view.getActionMap().get(AtomisticView.CUT)); s = M...
9
public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException { System.out.println(System.getProperty("java.class.path")); if ("loader".equalsIgnoreCase(args[0])) { connectToALoaderServer(args[1], Integer.valueOf(args[2])); return; } else { if ...
5
public Matrix4f Mul(Matrix4f r) { Matrix4f res = new Matrix4f(); for(int i = 0; i < 4; i++) { for(int j = 0; j < 4; j++) { res.Set(i, j, m[i][0] * r.Get(0, j) + m[i][1] * r.Get(1, j) + m[i][2] * r.Get(2, j) + m[i][3] * r.Get(3, j)); } } return res; }
2
static StringBuffer getRequirePath(String string) { int start = -1; int end = -1; int len = string.length(); StringBuffer result = new StringBuffer(); for (int i = 0; i < len; i++) { if (string.charAt(i) == '>') { end = i; break; } if (start >= 0 && end < 0) { ...
5
@Deprecated public static String manualRequest(String line) { //Region_Service:operation-param1,param2,... String region = line.substring(0,line.indexOf("_")); String service = line.substring(line.indexOf("_")+1,line.indexOf(":")); String operation = line.substring(line.indexOf(":")+1,line.indexOf("-")); St...
4
public void playGame() { System.out.println("The game has begun! Good luck!"); Scanner sc = new Scanner(System.in); boolean win=false; // Game is not won by default do { win = player[this.current].makeGuess(g); char res = player[this.current].opponentGrid.returnCharacter(g.get_Y(), g.get_X()...
4
private boolean DFSCycle(Vertex a, Hashtable<Vertex,Color> color){ color.put(a,Color.GREY); LinkedList<Vertex> adjacencyVertices=graph.getAdjacencyVertices(a); Iterator<Vertex> i = new Iterator<Vertex>(adjacencyVertices); while(i.hasNext()){ Vertex u = i.getNext(); ...
4
@Override public void preUpdate() { Event ev; boolean expDamage = false; while(eventExist()) { ev = popEvent(); if(ev.getName().equals("explosion")) { if(!expDamage) { hp-=5; expDamage = true; if(hp <= 0 && alive) { destroy(); } } } if(ev.getName().equ...
6
public static ResultSet _findAll(String tableName) throws SQLException { PreparedStatement statement = connect.prepareStatement(" select * from `" + tableName + "`" ); ResultSet result = statement.executeQuery(); return result; }
0
public Stolik chceStolik(Osoba osobaChcacaStolik) throws InterruptedException { lock.lock(); try { log.info("osoba numer {} z pary {} wchodzi", osobaChcacaStolik.podajNumerOsoby(), osobaChcacaStolik.podajNumer()); ++pary[osobaChcacaStolik.podajNumer()]; while (pary[osobaChcacaStolik.podajNumer()] < 2...
7
private void processBuffer(byte[] buffer, List<Token> tokens, TokenGenerator tokenGenerator, ZipEntry zipEntry) { tokenGenerator.setBuffer(buffer); final int length = tokenGenerator.length(); int row = 1, column = 0; int i = 0; while (i < length) { char c = tokenGenerator.charAt(i++); ++column; ...
8
public LinkedList<ListEmp> getFaults(){ LinkedList<ListEmp> psl = new LinkedList<ListEmp>(); Connection Conn; ListEmp ps = null; ResultSet rs = null; try { Conn = _ds.getConnection(); } catch (Exception et) { System.out.println("No connection"); return null; } PreparedStatement pmst = null; ...
7
public void delete(BaseDO baseDO) { //baseDO = this.makeObjectPersistent(baseDO); getEntityManager().remove(baseDO); }
0
private boolean r_instrum() { int among_var; // (, line 76 // [, line 77 ket = cursor; // substring, line 77 among_var = find_among_b(a_3, 2); if (among_var == 0) { return false; } // ], line 77 bra = cursor; // call R1, line 77 if (!r_R1()) { return false; } switch (among_var) { cas...
8
public static int arithmeticSequence(int[] nums) { if (nums == null || nums.length < 3) return 0; int res = 0; int gap = nums[1] - nums[0]; int length = 2; for (int i = 1; i < nums.length - 1; i++) { if (nums[i+1] - nums[i] == gap) { length++; } else { gap = nums[i+1] - nums[i]; if (length >...
8
public void update(long deltaMs) { Iterator<RenderObject> it = renderableActors.iterator(); while(it.hasNext()) { RenderObject ro = it.next(); ro.update(deltaMs); } Collections.sort(renderableActors); }
1
static MemoryBTXObject readObject(DataInput in) throws IOException { String name = readString(in); MemoryBTXObject ret = new MemoryBTXObject(name); int count = read32BitUnsigned(in); while (count > 0) { ret.attrs.add(readAttribute(in)); } count = read32BitUnsigned(in); while (count > 0) { ret.childr...
2
@Override public void whatToDo(Character character) { Game currentGame = Game.getInstance(); int rollResult = currentGame.rollDice(3); if(rollResult == 4){ Trait physicalTraitChosen = currentGame.chooseAPhysicalTrait(); if(physicalTraitChosen == Trait.SPEED){ character.incrementSpeed(); }else if(ph...
7
@Test public void eventNotified() { eventBus.post( new ApplicationEvent() ); assertTrue( eventNotified ); }
0
public static void drawTransparent(Graphics g, int x, int y, int width, int height) { Shape clip = g.getClip(); g.clipRect(x, y, width, height); int size = 8; for (int xx = 0; xx <= width / size; xx++) for (int yy = 0; yy <= height / size; yy++) { ...
3
public static void odd_square_sum(Integer x, Integer y) { int sum = 0; for (int i = x; i <= y; i++) { if (i % 2 != 0) { sum += i * i; } } System.out.println(sum); }
2
@Override public void setValueAt(Object o, int r, int c) { if (r == 0) lmodel.info.name = (String)o; else if (r == 1) lmodel.info.author = (String)o; else if (r == 2) lmodel.info.source = (String)o; else if (r == 3) lmodel.info.modelNumber = (String)o; ...
4
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == nextPlayer) { if(game.turnDone && !game.isGameDone()) { if(game.getCurrentPlayerIndex() + 1 == game.getPlayers().size()) game.setCurrentPlayerIndex(0); else game.setCurrentPlayerIndex(game.getCurrentPlayerIndex() +...
9
public boolean addToTree(CoreInterface ci){ if(ci.getClass() == Dvd.class){ dvdTree.add(ci); return true; }else if(ci.getClass() == Location.class){ locationTree.add(ci); return true; }else if(ci.getClass() == Genre.class){ genreTree.add(ci); return true; } return false; }
3
public void setCalculateFromScratch(Boolean calculateFromScratch) { this.calculateFromScratch = calculateFromScratch; }
0
private static String getIndentString(int indent) { String indentString = ""; for (int i = 0; i < indent; i++) indentString += "\t"; return indentString; }
1
public NewsDialog() { super(MainFrame.instance(), "添加新闻", true); setLayout(null); setSize(420, 420); setLocationRelativeTo(null); newsDialog = this; JLabel jlbName = new JLabel("新闻内容(100字):"); JButton ensure = new JButton("确定"); JButton cancel = new JButton("取消"); jTextArea = new JTextArea(); jlbNa...
2
public static String[] delimitedStringArray(String from, char start, char end){ //���ʂ��i�[����z��̐����B�e�ʂ͊܂܂��start�̐���葽���͂Ȃ�Ȃ��B final int maxOfResultSize = countIncludedChar(from, start); String[] temporaryResult = new String[maxOfResultSize]; int resultSize = 0; int index = 0; String testedStr...
3
public void getMap() { try { status.setText("Connect to runescape.com..."); BufferedReader read = new BufferedReader(new InputStreamReader( new URL("http://www.runescape.com/downloads.ws").openStream())); String line; while ((line = read.readLi...
4
@Override public List<Description> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException { int pageSize = 10; List paramList = new ArrayList<>(); StringBuilder sb = new StringBuilder(WHERE); String queryStr = new QueryMapper() { @...
2
public boolean updateProdutos(Produtos produtos) { this.getConectaBanco(); try { if (this.getConn() != null || !this.getConn().isClosed()) { this.getConn().setAutoCommit(false); this.setStmt(this.getUpdateProdutos()); this.getStmt().execute(); this.setSuc...
5
protected Collection<Object> getCellsForChange(mxUndoableChange change) { mxIGraphModel model = getGraph().getModel(); Set<Object> result = new HashSet<Object>(); if (change instanceof mxChildChange) { mxChildChange cc = (mxChildChange) change; Object parent = model.getParent(cc.getChild()); if (cc....
9
public MainGUI() { super("Sudoku"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(new Dimension(500, 550)); board = new JPanel(new GridLayout(3, 3)); boxes = new JPanel[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { boxes[i][j] = new JPanel(new GridLayout(3, 3)); ...
9
@Override public void execute(Player player, String[] args) { if(args.length != 0){ if(BanHandler.isBanned(args[0])){ player.sendMessage(args[0]+ " is already banned"); return; } if(!args[0].equalsIgnoreCase(player.username)){ BanHandler.ban(args[0]); player.sendMessage("You successfu...
3
public static Rule_HASH parse(ParserContext context) { context.push("HASH"); boolean parsed = true; int s0 = context.index; ArrayList<Rule> e0 = new ArrayList<Rule>(); Rule rule; parsed = false; if (!parsed) { { ArrayList<Rule> e1 = new ArrayList<Rule>(); int s1...
7
private ArrayList<Integer> generateActions(int[][] state) { ArrayList<Integer> result = new ArrayList<Integer>(); int middle = x/2; //TODO choose random when x is even if (state[middle][0] == 0) { result.add(middle); } for (int i=1; i <= x/2; i++){ if(middle + i < x) { if ...
6
public Peg(String name, int maxDisks, int initDiskCount) { this.name = name; this.maxDisks = maxDisks; disks = new Stack<Integer>(); for (int i = 1; i <= initDiskCount; i++) { disks.push(i); } width = maxDisks * DISK_WIDTH_DELTA + SIDES_MARGIN; h...
1
private void moveMBlocks() { for (MBlock b : mBlocks) { b.move(); if (edges.contains(b.location())) b.respawn(); } }
2
public Chlodzenie dawajChlodzenie(){ System.out.println("Dodaje: " + name); return new ChlodzenieDlaLaptopa(); }
0
@Override public JMenu createMenu() { JMenu menu = new JMenu("Edit"); //$NON-NLS-1$ menu.add(new DynamicMenuItem(UndoCommand.INSTANCE)); menu.add(new DynamicMenuItem(RedoCommand.INSTANCE)); menu.addSeparator(); menu.add(new DynamicMenuItem(CutCommand.INSTANCE)); menu.add(new DynamicMenuItem(CopyCommand.INS...
1
public static boolean run(Automaton a, String s) { if (a.isSingleton()) return s.equals(a.singleton); if (a.deterministic) { State p = a.initial; for (int i = 0; i < s.length(); i++) { State q = p.step(s.charAt(i)); if (q == null) return false; p = q; } return p.accept; } else { ...
9
private <T> Elements<T> join (Elements<T> min, Elements<T> inserted) { if (min == null && inserted == null) { return null;} else if (min != null && inserted == null) { return min; } else if (min == null && inserted != null) { return inserted; } else { Elements<T> minNext = min.rightk...
7
@Override public synchronized boolean removeUser(String username, UUID uuid) { FileWriter writer = null; try { BufferedReader reader = new BufferedReader(new FileReader(new File(OnlineUsers.directory+OnlineUsers.flatfileData))); String line = ""; StringBuilder toSave = new StringBuilder(); while ((line...
6
public static MapObject loadMapObjectFromString(String uin, TileMap tm, World w){ switch (uin) { case LOG: return new BlockLog(tm, w).setType(Block.WOOD); case CRAFTINGTABLE: return new BlockCraftingTable(tm, w).setType(Block.WOOD); case IRON: return new BlockIron(tm, w).setType(Block.ROCK); case ROC...
6
public static void main(String[] args) throws Exception { DataOutputStream dos = new DataOutputStream( new BufferedOutputStream(new FileOutputStream("data.txt"))); byte b = 3; int i = 12; char ch = 'b'; float f = 3.3f; dos.writeByte(b); dos.writeInt(i); dos.writeChar(ch); dos.writeFloat(...
0
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> already <S-...
8
public void reduce() { if (isSingleton()) return; Set<State> states = getStates(); setStateNumbers(states); for (State s : states) { List<Transition> st = s.getSortedTransitions(true); s.resetTransitions(); State p = null; int min = -1, max = -1; for (Transition t : st) { if (p == t.to) { ...
9
public static void endRound() { GUI.nextRound.setEnabled(true); GUI.submit.setEnabled(false); if(wordExists(latestWord) == false){ GUI.resultText.setText("That Word Doesn't Exist. You Scored 0 Points."); heresWhatYouCouldHaveWon(); gui.updatePotentialSolutionsBar(answers); } else if(lettersInOrder(...
4
public List<RangStatistik> getRangStatistik(String spielerName, String datePattern, String dateStart) { List<EloStatistik> eigeneEloStatistik = getEloStatistikInternal(spielerName, datePattern, dateStart, true); Map<String, List<EloStatistik>> andereEloStatistiken = new HashMap<String, List<EloStatistik>>(); List...
8
protected boolean isConverged(int iter) { // print out debug info if (verbose) { Logs.debug("{}{} iter {}: errs = {}, delta_errs = {}, loss = {}, delta_loss = {}, learn_rate = {}", new Object[] { algoName, foldInfo, iter, (float) errs, (float) (last_errs - errs), (float) loss, (float) (Math.abs(last...
8
public java.security.cert.X509Certificate[] getAcceptedIssuers() { java.security.cert.X509Certificate[] chain = null; try { TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); KeyStore tks = KeyStore.getInstance("JKS"); tks.load(this.getClas...
1
public Coord negSize() { if (gob().getneg() != null) return gob().getneg().bs; return new Coord(0, 0); }
1
@Override public Result<Boolean> register(String username, String password) { UsersDAO dao = new UsersDAO(getDBConnection()); try { if (!checkLoginPassword(username, password)) return new Result<>(false, ExceptionMessages.EMPTY_DATA); if (dao.getUser(username) != null) return...
4
@Override public void process(SimEvent event) { NodeReachedEvent _event = (NodeReachedEvent) event; this.setPosition(_event.getNode()); // Sets the actual position to the reached node. System.out.println(getName() + "@" + getEngine().getCurrentTime() + ": reached node " + getPosition()); getLog().addNode(getP...
3
public final String getPassword() { return _password; }
0
public void drawLine(double x1, double y1, double x2, double y2) { if (x1 > maxX) { maxX = x1; } if (x2 > maxX) { maxX = x2; } if (x1 < minX) { minX = x1; } if (x2 < minX) { minX = x2; } if (y1 > maxY...
8
public void setStatus(String status) { this.status = status; }
0
public void attemptToPerformAction(Player actingPlayer, String actionStringKey){ Action action = playerActionMaps.get(actingPlayer.toString()).get(actionStringKey); gameHistory += actingPlayer + " attempted " + actionString(action) + ":::"; for(Player nonEliminatedPlayer : players){ nameToOutWriter.get(nonE...
8
public boolean isVisited() { return visited; }
0
public void setWeight(Vertex a, Vertex b, int weight){ if(!isConnected(a,b)){ connect(a,b,weight); }else{ int edgeWeight = this.weight.get(new Edge(a,b)); if(edgeWeight!=1){ this.withWeight--; } if(edgeWeight<0){ ...
5
public static void main(String []arg) { System.out.println("Sudoku Solver is Started .."); if(arg.length > 0) { if(arg[0].equals("-c")) { SudokuGrid m_grid=new SudokuGrid(); Scanner sc = new Scanner(System.in); int val; for(int i=0;i<9;i++) { for(int j=0;j<9;j++) { ...
6
public static void main( String[] args ) throws MVDException { if ( args.length == 1 ) { File file = new File( args[0] ); File[] files = file.listFiles(); try { for ( int i=0;i<files.length;i++ ) { FileInputSt...
4
private int generateContactId() { // Generates a random 6 digit integer as the ID number. int newId = (int)(Math.random()*999999); // Then checks to see if this number is already in use recursively. if(getContactFromID(newId) != null) { return generateContactId(); } ...
1
public static void main(String args[]){ ExecutorService executor = Executors.newFixedThreadPool(2); for (int i=0;i<5;i++){ executor.submit(new processor(i)); } executor.shutdown(); System.out.println("all tasks submitted"); try { executor.awaitTermination(1, TimeUnit.DAYS); } catch (Interru...
2
public void visitArithExpr(final ArithExpr expr) { if (expr.left().type().isIntegral()) { foldArithInteger(expr); } else if (expr.left().type().equals(Type.LONG)) { foldArithLong(expr); } else if (expr.left().type().equals(Type.FLOAT)) { foldArithFloat(expr); } else if (expr.left().type().equals(Type.D...
4
public static void main(String[] args) { RandomList<String> rs = new RandomList<String>(); String[] arrayStrings = ("The quick brown fox jumped over " + "the lazy brown dog").split(" "); for(String s : arrayStrings) { rs.add(s); } for(int i = 0; i < ...
6
public static void main(String arg[]) { String username = "Alice"; String ip = "192.158.1.1"; boolean available = true; try { User alice = new User(username,ip,available); DatabaseHandler dbHand = new DatabaseHandler(); dbHand.onCreate(); dbHand.addUser(alice); dbHand.addUser(new User("Bob","1...
2
private void setUpArmor() { for (int i = 0; i < 25; i++) { armor.add("Armor" + File.separator + "leatherarmor.properties"); } for (int i = 0; i < 15; i++) { armor.add("Armor" + File.separator + "chainmail.properties"); } for (int i = 0; i < 10; i++) { armor.add("Armor" + File.separ...
4
public static String decrypt(String input, String key){ int inputLength = input.length(); char[] out = new char[inputLength]; int code = key.hashCode(); Character[] mapping = antiRandomizeArray(getMasterMapping(), code); for(int i = 0; i < inputLength; i++){ char x = input.charAt(i); if(x < 32 && x != 9...
7
public static void main(String[] args) throws java.io.IOException { if (args.length != 8) { System.out.println("Usage: LDAExpt <instances> <num_topics> <num_itns> <print_interval> <save_sample_interval> <symmetric> <optimize> <output_dir>"); System.exit(1); } String file = args[0]; int T ...
8
private void setRecommendedIndex(int index, boolean silent) { if(index == recommendedIndex) return; if(index < 0) index = 0; if(index > model.getSize() - 1) index = model.getSize() - 1; boolean first = false; if(recommendedIndex > -1 && recommendedIndex < model.getSize()) { model.setElement(model.get(recom...
7
@Override //handles the player's keystrokes public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT){ this.player.setSavedDir(0); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT){ this.player.setSavedDir(2); } else if (e.getKeyCode() == KeyEvent.VK_UP){ this.player.setSavedDir(1...
5
public static void main(String[] args) { int sum = 0; for(int i = 0; i <= 10; i++){ System.out.println("i=" + i); sum +=i; } }
1
public IImage createImage(String path) { if(getExtension(path).equals("jpg")) { return new ImageX(path); } else if(getExtension(path).equals("gif")) { return new ImageX(path); } else if(getExtension(path).equals("png")) { return new ImageX(path); } else if(getExtension(path).equals("bmp")) { r...
4
int getSize() { int size = 0; AnnotationWriter aw = this; while (aw != null) { size += aw.bv.length; aw = aw.next; } return size; }
1
public String getProfiles( String mKey ) { StringBuffer sb = new StringBuffer(); sb.append("select id,key,title,description,reverse_cost,"); sb.append("public,enabled,pgr_sp,pgr_dd,rid from app.profiles "); if( mKey != null ) { sb.append("where key in (").append(mKey).append(") "); } sb.appen...
6
public List<Player> getplayers() { return players; }
0
int insertKeyRehash(byte val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look u...
9
private Color calculateColour(PColorSpace colorSpace, float s, float t0, float t1) { // find colour at point 1 float t = parametrixValue(s, t0, t1, extend); // find colour at point float[] input = new float[1]; input[0] = t; if (functi...
3