text
stringlengths
14
410k
label
int32
0
9
private void send_with_congestion_control(Packet[] packets) throws InterruptedException { boolean recebeu = false; ArrayList<Integer> acks = new ArrayList<Integer>(); this.sliding_window = 1; for (int curr_packet = 0; curr_packet < packets.length; curr_packet++) { //envia uma janela de pacotes for (...
7
public void visitMonitorStmt(final MonitorStmt stmt) { if (CodeGenerator.DEBUG) { System.out.println("code for " + stmt); } stmt.visitChildren(this); genPostponed(stmt); if (stmt.kind() == MonitorStmt.ENTER) { method.addInstruction(Opcode.opcx_monitorenter); stackHeight -= 1; } else if (stmt.ki...
3
public static void hypothesizeUnit(GrammarEnvironment env, Grammar g) { UnitProductionRemover remover = new UnitProductionRemover(); if (remover.getUnitProductions(g).length > 0) { UnitPane up = new UnitPane(env, g); env.add(up, "Unit Removal", new CriticalTag() { }); env.setActive(up); return; } ...
1
public static synchronized Singleton getInstance() { if (instance == null) { instance = new Singleton(); } return instance; }
1
private static String getCryptFilterName(PDFObject param) throws IOException { String cfName = PDFDecrypterFactory.CF_IDENTITY; if (param != null) { final PDFObject nameObj = param.getDictRef("Name"); if (nameObj != null && nameObj.getType() == PDFObject.NAME) { c...
3
public void setId(String id) { this.id = id; }
0
public void remove(Integer k) { Node<Integer, Integer> x = root, y = null; while (x != null) { int cmp = k.compareTo(x.key); if (cmp == 0) { break; } else { y = x; if (cmp < 0) { x = x.left; ...
9
protected StringBuffer prepareFile(JoeTree tree, DocumentInfo docInfo) { //String lineEnding = Preferences.platformToLineEnding(docInfo.getLineEnding()); StringBuffer buf = new StringBuffer(); // write the prelude to data // TBD // write the data //Node node = tree.getRootNode(); //for (int i = 0...
0
public void setPrivate(final boolean flag) { int modifiers = classInfo.modifiers(); if (flag) { modifiers |= Modifiers.PRIVATE; } else { modifiers &= ~Modifiers.PRIVATE; } classInfo.setModifiers(modifiers); this.setDirty(true); }
1
public boolean parse(Throwable throwable) { boolean identified = false; if (throwable.getCause() != null) { identified |= parse(throwable.getCause()); } if (throwable instanceof UmbrellaException) { if (((UmbrellaException) throwable).getCauses() != null) { for (Throwable subthrowable : ((UmbrellaExce...
6
private void loadEmployerDateFromFile(String employerRepository) { InputStream is = getInputStreamForFile(employerRepository); XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance(); try { XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(is); while (xmlEventReade...
4
@Override public void render(Graphics2D g) { int textBaseLine = getYI() + fontMetrics.getAscent(); if (showLine) { g.setColor(lineColour); g.drawLine(getXI(), textBaseLine, getXI() + getWidthI(), textBaseLine); } if (this.getSelectedText() != "") { g.setColor(selectionC...
6
private void doUpdateXinWen(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String xinwenId = StringUtil.toString(request.getParameter("xinwenId")); if(!StringUtil.isEmpty(xinwenId)) { ObjectMapper mapper = new ObjectMapper(); Map...
3
@Override public String stringify(int level) { ArrayList<String> strArray = new ArrayList<String>(); int width = 0; for (int i = 0; i < length; ++i) { JSON obj = mapArray.get(i); String strJSON; if (obj == null) strJSON = "null"; else strJSON = obj.stringify(level + 1); width += strJSON...
9
private String getDateValue(final Field field, final Object object) { String resValue = null; Object value = getRawValue(field, object); if (value != null && value instanceof Date) { resValue = DateUtils.format((Date) value, DATE_FORMAT); } return resValue; }
2
public void ausschreiben(){ for(int i=0; i < spieler.length; i++){ if(spieler[i].getX(i) - spieler[i].getRange(i) < pos_x && pos_x < spieler[i].getX(i) + spieler[i].getRange(i) && spieler[i].getY(i) - spieler[i].getRange(i) < pos_y && pos_y < spieler[i].getY(i) + spieler[i].getRange(i)){ spieler[i]...
5
public String getTwitchInfo(String message) { URL url; StringBuilder allWords = new StringBuilder(); String[] parts = message.split(" "); for (String word:parts) { if (word.contains("twitch.tv/") && (word.contains("/c/") || word.contains("/b/"))) { ...
8
InventoryGUI(CardGUI c) { cgui = c; inv = c.currentGame.player.getItems(); inventorySize = c.currentGame.player.inventorySpace; this.setLayout(new AbsoluteLayout()); slots = new JLabel[inventorySize]; stackCount = new JLabel[inventorySize]; highLights = new JLabel...
5
private boolean win(){ for(ERow row : ERow.values()){ if(getRow(row) == -2){ //we may win System.out.println("we may win!"); return getFreeCell(row); } } return false; }
2
public void resetPlotOption(int opt){ if(opt<0 || opt>4)throw new IllegalArgumentException("The plot option, " + opt + ", must be greater than or equal to 0 and less than 5"); this.plotOptions = opt; }
2
private void loadConfig(){ if(xmlConfig == null){ xmlConfig = new XMLConfiguration(); try { xmlConfig.load(PublishConstants.SYSTEM_CONFIG_DIR + PublishConstants.PUBLISH_CONFIG_FILE_NAME); } catch (ConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
2
private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed if (cmbProjeto.getSelectedItem().equals("Selecione")) { JOptionPane.showMessageDialog(null, "Erro selecione o Projeto", "Gestão de Atividade", JOptionPane.ERROR_MES...
3
public void addBit(int theBit) { if (!(theBit == 0 || theBit == 1)) { throw new IllegalArgumentException("argument must be 0 or 1"); } if (length == 32) { throw new IllegalStateException("cannot fit additional bits"); } // Add the new bit to the right of...
3
public static void main(String[] args) throws IOException { // TODO Auto-generated method stub JpcapCaptor captor=JpcapCaptor.openFile("test"); while(true) { Packet readPacket = captor.getPacket(); if(readPacket==null || readPacket==Packet.EOF) break; System.out.println(readPacket); captor.close(...
3
public boolean isUgly(int num) { if(num <=0){ return false; } if(num ==1){ return true; } long tnum = num; // if (num<0){ // tnum = -tnum; // } System.out.println(tnum); boolean res = true; int i=0; List<Integer> l = new LinkedList<>(); int[] arr = {2,3,5}; while(i<arr.length ){ int t...
9
public JanelaPrincipal() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 701, 399); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); JMenu mnFile = new JMenu("File"); menuBar.add(mnFile); JMenuItem mntmOpen = new JMenuItem("Carrega Imagem..."); mntmOpen.addActionListener...
9
@Override public void update() { if (!init) init(); level.update(); mouseOverOptionIndex = -1; double mouseX = GameInput.mouseX; double mouseY = GameInput.mouseY; for (int i = 0; i < menuOptions.length; i++) { float x = xyWidthHeight[i][X]; ...
8
@Override protected DPLotSizingDecision getDecision( DPBackwardRecursionPeriod[] periods, int setupPeriod, int nextSetupPeriod, double alpha) throws ConvolutionNotDefinedException { //Get the vector of open and realized demand RealDistribution[] openOrders = new RealDistribution[nextSetupPeriod-setupPe...
2
public ProductionChecker() { }
0
public PosControlTransacciones getPosControlTransaccionesFromItemDeMovimiento(PhpposSalesItemsEntity itemMovPos, long fesCedula, PhpposSalesEntity movimient...
0
private static String locate(CSVParser csv, String name, String... type) throws IOException { if (name == null) { // match anything name = ".+"; } Pattern p = Pattern.compile(name); String[] line = null; while ((line = csv.getLine()) != null) { ...
7
public static AbilityType getAbility(ActiveWeaponEnchant type) { switch (type) { case FIREBALL: return AbilityType.abil_aim_fire; } return null; }
1
protected void takeTier(){ //check how many tiers is taken and take another tier if possible if(this.tiersTaken < this.enhancementMaxRank && requirementsMetSpend()){ if(DDOCharacter.pointAvailible()){ DDOCharacter.pointsSpent(prestige, apPerTier.get(tiersTaken)); ++this.tiersTaken; this.setImage(tier...
3
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...
6
@Test public void test() { clock = new Clock(); TimeControl tc = new Quota(30, 1800, 5, IncrementTypes.FISCHER); clock.setTimeControl(tc); clock.init(); Thread t = new Thread(new Runnable(){ public void run() { while(true) {...
7
public static void close() { //Закрытие окна if(Core.getIntance().getCurrentController().equals(EForm.MainForm.getController())) Model.getIntance().empty(); //Если закрывается окно с игрой, то удаляем игру (иначе таймеры продолжат работать) stage.close(); if(!stages.isEmpty())...
3
@EventHandler public void onFrameBrake(HangingBreakEvent e) { if(e.getCause() == RemoveCause.ENTITY){ if(e.getEntity() instanceof ItemFrame){ e.setCancelled(true); } } }
2
@Override public void keyPressed(KeyEvent e) { System.out.println(e.getKeyCode()); switch(e.getKeyCode()) { case KeyEvent.VK_UP: if(Snake.direction != Util.SOUTH) Snake.direction = 0; break; case KeyEvent.VK_LEFT: if(Snake.direction != Util.EAST) Snake.direction = 1; break; case KeyEvent....
9
public boolean editShipWorks(Ship ship) { if(myTurnEditing) return mySea.shipWorks(ship); else return theirSea.shipWorks(ship); }
1
void hideAndShowToolbars(boolean leftOnly) { boolean hide = bottomPanelVisible || leftPanelVisible; MouseEvent me; if (leftOnly || hide == leftPanelVisible) { me = new MouseEvent(hideLeftPanel, 0, 0, 0, 1, 1, 1, false); for (MouseListener ml : hideLeftPanel.getMouseListeners()) { ml.mouseReleased(me);...
7
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Tree other = (Tree) obj; if (root == null) { if (other.root != null) { return false; } } else if (!root...
6
public boolean isConnectedOK() { boolean ok = false; Connection conn = null; SQLException ex = null; try { conn = DriverManager.getConnection(jdbcUrl,user,password); if (!conn.isClosed()) { ok = true; } } catch (SQLException e) ...
6
public static void solve(String[] args) throws IOException{ String fileName = null; // get the temp file name for(String arg : args){ if(arg.startsWith("-file=")){ fileName = arg.substring(6); } if(arg.startsWith("-type=")){ ty...
6
public boolean calculateEnergyConsumptionGeneration() { int i = 1; boolean feasible = false; System.out.println("EVALUATING SYSTEMS\n"); for (SoftwareSystem system : systems) { System.out.println("\tSystem " + (i++) + "\n\t\t" + system); int j = 0; double totalTime = 0; Calculator calculator = new C...
7
@Test public void tasoAsetaPelaajanAlkusijaintiToimii() { Piste r = new Piste(20, 20); t.asetaPelaajanAlkusijainti(r); Pelaaja pe = new Pelaaja(); pe.setTaso(t); assertTrue("Pelaajan alkusijainti oli väärä", pe.getX() == 20 && pe.getY() == 20); assertTrue("GetPelaajan...
1
private void send(String pro,String sxo){ /* * apothikeuei sthn vash thn anafora */ String query="insert into anafores(provlima,sxolia,odigos_id) values(?,?,?)"; try { con.pS=con.conn.prepareStatement(query); con.pS.setString(1, pro); con.pS.setString(2, sxo); con.pS.setInt(3, odigosId); } cat...
2
@Override public void disconnected(DisconnectedEvent e) { }
0
private Cell[] getWillFlip(int x, int y){ List<Cell> willFlip = new ArrayList<>(); try { willFlip.add(puzzlePanels[y][x]); } catch (ArrayIndexOutOfBoundsException ex) { throw new RectangularPuzzleIndexOutOfBoundsException(); } try { willFlip.add(puzzlePanels[y][x + 1]); } catch (ArrayIndexOutOfBou...
5
public String addBinary(String a, String b) { if (a == null && b == null) return null; if (a == null) return b; if (b== null) return a; int lengthA = a.length(); int lengthB = b.length(); int length = Math.max(lengthA, lengthB); ...
9
public boolean testEgalite() { for (Case c : this._j2.getCases()) { if (c.isAPortee() && !c.isEtat()) { return false; } } return true; } // testEgalite()
3
@Override public void execute(CommandSender sender, String[] args) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (args.length < 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.tp + " (playername)"); return; } if (ar...
8
private State_Abstract createState(String[] tokens) { // tokens[0] is the instruction for this state if (!E_Instruction.valid().contains(E_Instruction.valueOf(tokens[0]))) { Main.error("Error : unknown instruction: " + tokens[0]); } // Based on this we create the correct state switch (E_Instruction.valueO...
9
public int getPriority() { return postfix ? 800 : 700; }
1
public boolean areAllClientsReady() { if (clients.size() == 1) return true; for (Player p : clients) { if (!p.isReady()) return false; } return true; }
3
public static java.awt.Color getColorForPlayer(Player p) { switch (p) { case RED: return java.awt.Color.RED; case BLUE: return java.awt.Color.CYAN; case YELLOW: return java.awt.Color.YELLOW; case GREEN: return java.awt.Color.GREEN; } return java.awt.Color.WHITE; }
4
public int getIsoinLapsi(int indeksi) { int isoin = -1; if (keko.size() == 0) { return isoin; } int ekanLapsenIndeksi = indeksi * this.d + 1; isoin = ekanLapsenIndeksi; if (ekanLapsenIndeksi >= keko.size()) { return -1; } for (int i...
5
public static int personneX(int travee,int orientation){ int centreX = centrePositionX(travee) ; switch(orientation){ case Orientation.NORD : centreX -= 10 ; break ; case Orientation.EST : centreX -= 25 ; break ; case Orientation.SUD : centreX -= 10 ; break ; case Orientation.OUE...
4
private void initializeLogger() { this.log = Logger.getLogger(this.getClass().getName()); try { FileHandler fh = new FileHandler(this.getClass().getName() .replace("class ", "") + this.id + ".log"); fh.setFormatter(new SimpleFormatter()); this.log.addHandler(fh); } catch (SecurityException e1) ...
2
public void buttonP() { if(bMSounds.contains(Main.mse)) { mSounds = !mSounds; if(mSounds) { sS = "On"; } else { sS = "Off"; } } }
2
public static int findPalindromeMinCut(String input) { int[][]cost = new int[input.length()][input.length()]; boolean [][] isPalindrome = new boolean[input.length()][input.length()]; //base case all single length elements are palindromes for( int i=0; i< input.length(); i++) { ...
8
public ACodeInterface(String file, JavaScriptObject callbacks) { this.file = file; init0(callbacks); stateChange0("LOADING"); timer = new Timer() { @Override public void run() { if (!paused) { try { trace0("Running code..."); // Run only if the interpreter is running for (int ...
9
@Override public void removerUsuario(){ if ( this.num_usuarios == 0 ) System.out.println("\nNão existem " + "usuários."); else{ System.out.println("\nQual dos usuários você gostaria de remover? " + "[ 1 - " + this.num_usuarios + " ]" ); int...
9
@Test public void test_1_Constructor() { // Initialisation int size = 10; Grid g = new Grid(size); // TEST FOR SIZE (SQUARE) boolean ok = true; if(g.getBoard().length != size) { ok = false; } int badSize =size; int i = 0; while(ok && (i<g.getBoard().length)) { if(g.getBoard()[i].length != s...
9
public void update() { if (active) { x += vx / Level.speed(); y += vy / Level.speed(); } }
1
private double readFloatBody(final boolean shouldBeNegative) throws IOException { long signif; long exp; if (trace == API_TRACE_DETAILED) { debugNote("readFloatBody shouldBeNegative=" + shouldBeNegative); } Object obj = readObject(); if (obj instanceof BigInteger) { BigInte...
5
public void save(DataOutputStream out) { try { for (Blocks b : blocks) { b.save(out); } } catch (IOException e) { e.printStackTrace(); } }
2
public void buildSituations() { System.out.println("Building graph database..."); serverSituationHistory = new HashMap<>(); applicationSituationHistory = new HashMap<>(); FakeServer livingServer; FakeApplication livingApplication; int stepStartResearch; int state ...
6
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Close")) { this.dispose(); } }
1
private void jRadioButton1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jRadioButton1KeyPressed if (evt.getKeyCode() == 40) { jRadioButton2.setSelected(true); } else if (evt.getKeyCode() == 37) { jTextField9.grabFocus(); } else if (evt.getKeyCode() == 38) { jRadioButton1...
3
private void compileColorBoard() { cells = new int[board.length][board[0].length]; largest = 0; for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[0].length; j++) { Matcher m = compileRegex(reg, board[i][j]); int amt = 0; ...
7
private void browseButtonAction() { loggerMainClass.entry(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setDialogTitle("Select The Source Directory"); if (fileChooser.showDialog(nu...
2
public static void main(String[] args) throws CloneNotSupportedException { IPlaystationNetwork device = new Uncharted(); device.uploadUpdate(); System.out.println("Version: " + IPlaystationNetwork.VERSION); if(device instanceof Uncharted && device instanceof PS3Game &...
5
@Override public Token parse() { Token test = first.getNext(); if (!test.isOperator(Operator.BRACKET_LEFT)) throw new RuntimeException("Expected '(' after FOR, found: " + test.toString()); test = test.getNext(); if (!test.isOperator()) { preForAssign = new AssignmentExpression(test, scope); test...
9
@SuppressWarnings("unchecked") public List<Order> getAllDoneOrders() { return (List<Order>)this.em.createNamedQuery("findAllDoneOrders").getResultList(); }
0
public void paint2D(Graphics graphics) { Graphics2D g2 = (Graphics2D)graphics; /** set the rendering hints */ g2.setRenderingHints((RenderingHints)hints); /** if game is over */ if (gameOver) { /** fill the screen with black color */ g2.setColor(Color.blac...
8
public void move() { if(hasBreadcrumb) { location = tripAdvisor.proceed(location, colonyLocation); } else if(pileLocation != null) { location = tripAdvisor.proceed(location, pileLocation); } else { location = tripAdvisor.randomWalk(); } if(isOnAPile()) { hasBreadcrumb = true; } else if(isInCo...
4
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; int times = 1; d: do { line = br.readLine(); if (line == null || line.length() == 0) break d; double[] val = returnDoubles(line); double[] answe...
9
private XML buildElement() { EventNode token = eventReader.next(); if (token.getType() != TokenType.START_TAG) throw new XMLException("Broken XML: first token must be START_TAG"); String qname = token.getValue(); XMLElement element = new XMLElement(qname); List<Entry<String, String>> attributes = token.getA...
8
public void Menu(String protocolo, BufferedReader in, PrintWriter out){ System.out.println("Entrou menu\n"); String comando[] = protocolo.split("-"); System.out.println(comando[0]); switch (comando[0]) { case "Logar": try { ...
2
public SatisfiedApplication() { setBounds(10, 50, 836, 739); setLocationRelativeTo(rootPane); setModal(true); getContentPane().setLayout(new BorderLayout()); contentPanel.setBackground(new Color(248, 248, 255)); contentPanel.setLayout(new FlowLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));...
0
public boolean areNondeterministic(Transition t1, Transition t2) { FSATransition transition1 = (FSATransition) t1; FSATransition transition2 = (FSATransition) t2; if (transition1.getLabel().equals(transition2.getLabel())) return true; else if (transition1.getLabel().startsWith(transition2.getLabel())) ret...
3
public ArrayList<Integer> mergeTwoArrays(ArrayList<Integer> a, ArrayList<Integer> b) { if (a.size() != b.size()) { return null; } if (a.size() == 0) { return new ArrayList<Integer>(); } ArrayList<Integer> result = new ArrayList<Integer>(); int len = a.size(); int ai = 0; int bi = 0; while (ai...
9
public int getQueueSize() { int count = 0; try { QueueBrowser browser = context.createBrowser(pointsQueue); Enumeration elems = browser.getEnumeration(); while (elems.hasMoreElements()) { elems.nextElement(); count++; } ...
2
@Override public void signalEndOfData() { synchronized (taskQueue) { endOfData = true; taskQueue.notifyAll(); } }
0
@Override public void performPhysics(Matter matter, Planet nearbyPlanet) { Gravity planetGravity = nearbyPlanet.getGravity(); double hitsGroundIn = getHitGroundTime(matter, planetGravity); double processedTime = 0; double currentTimeStep = 1; while (hitsGroundIn < currentTimeStep && !Matter.isEffectivelyRest...
3
public void write6bytes(long n) throws IOException { long b0 = n & 0xff; long b1 = (n & 0xff00) >> 8; long b2 = (n & 0xff0000) >> 16; long b3 = (n & 0xff000000) >>> 24; long b4 = (n & 0xff00000000L) >> 32; long b5 = (n & 0xff0000000000L) >> 40; if (le) { write(b0); write(b1); write(b2); write(b3); writ...
1
private boolean check() { if (!isBST()) System.out.println("Not in symmetric order"); if (!isSizeConsistent()) System.out.println("Subtree counts not consistent"); if (!isRankConsistent()) System.out.println("Ranks not consistent"); if (!is23()) System.out.println(...
9
public static WebDriver getDriver() { return driver; }
0
public Poly getPoly(int type) { switch(type) { case 0: { return new Poly(makeL()); //creates an L-piece } case 1: { return new Poly(makeJ()); //creates a J-piece } case 2: { return new Poly(makeS()); //creates an S-piece } case 3: { return new Poly(makeZ()); //creates a Z-piece ...
7
public int get_main_data_len(){ int ans = 0; for(int gr = 0; gr < max_gr; gr ++) for(int ch = 0; ch < channels; ch ++) { ans += side_info.gr[gr].ch[ch].part2_3_length; } ans = ((ans % 8) > 0)? (ans/8 + 1): (ans / 8); return ans; }
3
@Override public final void refreshList() { entityList.clear(); // Update our entityList to only bother with enemies which contain // OUR specific SpawnSystemTag. List<Entity> entitesWithSpawnTags = entityManager.getEntitiesContaining(SpawnSystemTag.class); // Only keep track of our own spawn tag list for ...
2
public Point getFaceOffset(Face face) { switch (face) { case TOP: return this.getTopFaceOffset(); case BOTTOM: return this.getBottomFaceOffset(); case FRONT: return this.getFrontFaceOffset(); case BACK: return this.getBackFaceOffset(); case LEFT: return this.getLeftFaceOffset(); ...
6
public static boolean isMac() { // [deric] 31Sep2001 String osName = System.getProperty("os.name"); if (osName.toLowerCase().startsWith("mac")) { return true; } else { return false; } }
1
private void initText() throws FileNotFoundException, IOException { java.io.BufferedReader reader; String line; String[] splitLine; for (File f : filenameresolver.listFiles("localisation")) { if (!f.getName().endsWith(".csv")) continue; // Could use a FileFi...
7
public static ArrayList<Rating> getTestSet(String file) { ArrayList<Rating> testset = new ArrayList<Rating>(); InputStream fis = null; BufferedReader br; try { fis = new FileInputStream(file); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } br = new ...
3
protected void addListeners() { buttonStart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String fResult = "# Celsius to Fahrenheit: \n"; String cResult = "# Fahrenheit to Celsius: \n"; try { fResult += String.valueOf(adapter.celsiusT...
4
static byte PistonFix(byte data, String kierunek) { if (kierunek.equals("right")) { if (data == 2) { return 5; } if (data == 4) { return 2; } if (data == 5) { return 3; } if (data == 3) { return 4; } } else...
9
public boolean isMouseOverCloseButton(Point mousePosition) { if(mousePosition == null || fButtonShape == null) { return false; } return fButtonShape.contains(mousePosition); }
2
private int findSlot(int hash){ int mask = cap - 1; int bkt = (hash & mask); int bhash = hopidx[bkt<<2]; int slot; if(bhash == 0) slot = bkt<<2; else { for(;hopidx[(bkt<<2) + 2] != 0; bkt = (bkt + 1) & mask) ; slot = (bkt<<2) + 2; } return slot; }
2
public static void main(String[] args) throws Exception { String baseFilename = args[0]; int nShards = Integer.parseInt(args[1]); String fileType = (args.length >= 3 ? args[2] : null); /* Create shards */ FastSharder sharder = createSharder(baseFilename, nShards); if (b...
3