text
stringlengths
14
410k
label
int32
0
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TestDescriptor other = (TestDescriptor) obj; if (!getOuterType().equals(other.getOuterType())) return false; if (size != other.si...
5
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((code == null) ? 0 : code.hashCode()); return result; }
1
public void create(int x, int y, double d, double e, Color color) { for (Particle p : particles) { if (!p.active) { p.life = 0.05F; p.x = x; p.y = y; p.yV = d; p.xV = e; p.active = true; p.color = color; return; } } }
2
public static void main(String[] args){ UCIParams p = new UCIParams(); for(int a = 0; a < args.length; a++){ try{ if(args[a].equals("--hash")){ //sets main hash size (must be power of 2) p.hashSize = Integer.parseInt(args[++a]); } else if(args[a].equals("--pawnHash")){ //sets pawn hash size (must...
9
@Override public void componentResized(ComponentEvent ce) { FRAME_HEIGHT = this.getHeight(); FRAME_WIDTH = this.getWidth(); FONT_SIZE = (FRAME_HEIGHT / 100) * 4; LABEL_SIZE = new Dimension(FRAME_WIDTH/5 + FONT_SIZE*2, FONT_SIZE + FONT_SIZE/4); for (Component p : getC...
2
protected void activate(){ // Activation de l'Environnement en creant un tableau de cellule et en lan�ant tous ces agents cellules requestRole(Societe.SOCIETE , Societe.SIMU , Societe.CARTE ); // Créer la grille de jeu (grille de cellule) for (int i=0 ; i < this.longueur; i++){ f...
3
public boolean itemDeposit(WebInventoryMeta wim) { // Unsupported action if (!this.canDeposit) { this.player.sendMessage(MineAuction.prefix + ChatColor.RED + MineAuction.lang.getString("action_invalid_deposit")); return false; } try { // Save item to database // exist in database (a - update, ...
7
public <T> T loadConfig(Class<T> cl, String configPath) { try { T config = cl.newInstance(); Map<String, String> map = FileUtil .readKeyValueConfigFile(configPath); if (map == null) { Log.e(TAG + ":" + " read configfile error filepath is " + configPath == null ? "null" : configPath); retur...
9
public static String cPath(String path) { for (int i = 0; i < path.length(); i++) { if (path.charAt(i) == '/' && File.separatorChar != '/') { path = path.substring(0, i) + File.separator + path.substring(i + 1); } } return path; }
3
* @param directory * @param input * @param output * @param error * @return int */ public static int executeShellCommand(Stella_Object command, String directory, InputStream input, OutputStream output, OutputStream error) { { ShellProcess self000 = ShellProcess.newShellProcess(); self000.comm...
8
@Override public double compute(double[] params) { double a = params[0]; double b = params[1]; switch (type) { case ADD: return a + b; case SUBTRACT: return a - b; case MULTIPLY: return a * b; case DIVIDE: return a / b; case POWER: return Math.pow(a, b); } return a; }
5
private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; ...
6
private void jBtnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnAceptarActionPerformed // TODO add your handling code here: try { if (flagcli) { //Le Codigo Connection connPed = Conexion.GetConnection(); connPe...
6
@Override public void deleteOfOldResults() throws SQLException { switch (driverName) { case "org.h2.Driver": statement = connection.prepareStatement(deleteOfOldResultsStringH2); break; case "com.mysql.jdbc.Driver": statement = connecti...
2
public final GalaxyXLinkingParser.modifier_return modifier() throws RecognitionException { GalaxyXLinkingParser.modifier_return retval = new GalaxyXLinkingParser.modifier_return(); retval.start = input.LT(1); int modifier_StartIndex = input.index(); CommonTree root_0 = null; Tok...
9
public void test_getValue_long_long() { assertEquals(0, MillisDurationField.INSTANCE.getValue(0L, 567L)); assertEquals(1234, MillisDurationField.INSTANCE.getValue(1234L, 567L)); assertEquals(-1234, MillisDurationField.INSTANCE.getValue(-1234L, 567L)); try { MillisDurationFiel...
1
public void updateTo(int index) { if (index >= 0 && index < chain.size()) { if (currentIndex > index) { //Go back for (int i = currentIndex; i > index; i--) { chain.get(i).revert(); } } else if (currentIndex < index) { ...
6
public SLKeyframe(SLConfig cfg, float duration) { this.cfg = cfg; this.duration = duration; for (SLSide s : SLSide.values()) { cmpsWithStartSide.put(s, new ArrayList<Component>()); cmpsWithEndSide.put(s, new ArrayList<Component>()); } }
1
public Message getNextMessage () throws IOException { // check for pending message from peek. if (pending != null) { Message msg = pending; pending = null; return msg; } // read incoming message from wrapped channel Message msg = next.getNextMessage(); if (msg == null) return null; // g...
8
public static File getFile(String path) { return new File(path); }
0
public boolean batchExecIntQuery(String command, Vector<int[]> values) throws SQLException { boolean value = false; Connection connection = null; PreparedStatement stmt = null; try { Class.forName(driver); connection = DriverManager.getConnection(url, username, passwd); connection.setAutoCommit(fal...
8
public static boolean check(int row, int col) { for (int prev = 1; prev < col; prev++) if (board[prev] == row // Verify row || (Math.abs(board[prev] - row) == Math.abs(prev - col))) // Verify // diagonals return false; return true; }
3
public boolean attemptCast(Player p) { if (!Mana.hasMana(p, manaCost)) { p.sendMessage(ChatColor.RED + "You do not have enough mana to cast this spell."); return false; } else { String name = p.getName(); long t = System.currentTimeMillis(); if (!cast.containsKey(name)) { cast.put(name, t); M...
3
@Override public void actionPerformed(ActionEvent e) { if((e).getSource() == view.getButtons()[CANCELMOVE]){ view.setVisible(false); model.getMove().resetTerritories(); model.nextPhase(); }else if((e).getSource() == view.getButtons()[MOVE]){ view.setVisible(false); model.getMove().moveUnits(view.get...
7
@Override public void execute(Map<String, Object> map, MainFrame frame) { System.out.println("Receive Confirm Msg" + map); String origin = (String) map.get("Origin"); Map<String, Object> reply = (Map<String, Object>) Utilities.deserialize((byte[]) map.get("Content")); Boolean isConfi...
8
public void renderPiston(TileEntityPiston par1TileEntityPiston, double par2, double par4, double par6, float par8) { Block block = Block.blocksList[par1TileEntityPiston.getStoredBlockID()]; if (block != null && par1TileEntityPiston.getProgress(par8) < 1.0F) { Tessellator tessell...
7
public void setDuplicate(boolean duplicate){ this.duplicate = duplicate; }
0
public void putAll( Map<? extends Double, ? extends Integer> map ) { Iterator<? extends Entry<? extends Double,? extends Integer>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Double,? extends Integer> e = it.next(); this.put(...
8
public int getSelection() { if(selectionOvalY == 94) return 1; else if(selectionOvalY == 114) return 2; else if(selectionOvalY == 134) return 3; else if(selectionOvalY == 154) return 4; else if(selectionOvalY == 174) return 5; return 0; }
5
public void launchDialog(){ NotificationFactory.notify("https://au.finance.yahoo.com/", "Visit finance.yahoo.com to look up Stock Symbols"); JTextField stockfield = new JTextField(""); JRadioButton fullscreen = new JRadioButton(); JRadioButton testdata = new JRadioButton(); JSlider ...
3
private void validateCustomerInfo(HttpServletRequest request, Customer customer) { if (!customer.isValid()) request.setAttribute("error", "true"); if (!customer.isValidGivenName()) request.setAttribute("invalidGivenName", "Given Name must not be empty and number"); if (!customer.isValidSurname()) requ...
9
public int getTextDisplayedWidth(String text) { if (text == null) return 0; int width = 0; /* * Iterate through every character in the text. */ for (int c = 0; c < text.length(); c++) { /* * If the current character is the start of a colour * code or a crown code we can skip it as it will...
5
@Override public int hashCode() { int result = item != null ? item.hashCode() : 0; result = 31 * result + (item2 != null ? item2.hashCode() : 0); result = 31 * result + (item3 != null ? item3.hashCode() : 0); result = 31 * result + (item4 != null ? item4.hashCode() : 0); resu...
7
public double weightedGeometricMean_as_double() { if (!weightsSupplied) { System.out.println("weightedGeometricMean_as_double: no weights supplied - unweighted value returned"); return this.geometricMean_as_double(); } else { boolean holdW = Stat.weightingOptionS; if (weightingReset) { if (weighting...
6
final void da(int i, int i_254_, int i_255_, int[] is) { try { anInt7528++; float f = (((float) i_254_ * (((Class101_Sub3) ((OpenGlToolkit) this).aClass101_Sub3_7760) .aFloat5754)) + (((Class101_Sub3) ((OpenGlToolkit) this).aClass101_Sub3_7760) .aFloat5756) * (float) i + ((...
8
private void leftPossibleMoves(Piece piece, Position position) { int x1 = position.getPositionX(); int y1 = position.getPositionY(); if(x1 >= 1 && x1 <= 7) { boolean pieceNotFound = true; for (int i = x1 - 1; pieceNotFound && (i >= 0) && (board.getChessBoardSquare(i, y1).getPiece().getPieceColor() !=...
7
public static void main(String [] args) { try { boolean readExp = Utils.getFlag('l', args); final boolean writeExp = Utils.getFlag('s', args); final String expFile = Utils.getOption('f', args); if ((readExp || writeExp) && (expFile.length() == 0)) { throw new Exception("A filename must be ...
7
private void printJoins(Vector<LogicalJoinNode> js, PlanCache pc, HashMap<String, TableStats> stats, HashMap<String, Double> selectivities) { JFrame f = new JFrame("Join Plan for " + p.getQuery()); // Set the default close operation for the window, // or else the progra...
8
static Point[] convexHull2D(Point[] ps, Point normal) { final Point dir = perpendicular(normal); // 任意の点が相異ならdir=ps[1]-ps[0]でよい Arrays.sort(ps, new Comparator<Point>() { @Override public int compare(Point o1, Point o2) { double d = dir.dot(o2.subtract(o1)); ...
7
private void downloadParseOutput() { try { WebPage page = loadWebPage(); quotes = Parser.getQuotes(page); sortQuotesByScore(); takeOnlyTopTenQuotes(); shuffleQuotes(); takeOneQuoteAndSetOutput(); cooldown.start(); } catc...
1
public void run() { // If any of these stay the same then something is wrong InetAddress IPAddress; try { IPAddress = InetAddress.getByName(request.getIP()); } catch (UnknownHostException e1) { e1.printStackTrace(); bot.sendMessageToChannel("Error: Query IP address could not be resolved or is using IPv...
6
public ArtistFeature(File song) throws MP3Exception { super(song); this.obf= new ObjectFactory(); this.artist= this.obf.createArtistType(); this.getHttp= GetHttpPage.getInstance(); try { this.log= ArtistLogger.getInstance().getLog(); } catch (LogException e) { throw new MP3Exception("LogExcepti...
1
public void visitAttribute(final Attribute attr) { buf.setLength(0); buf.append(tab).append("ATTRIBUTE "); appendDescriptor(-1, attr.type); if (attr instanceof Traceable) { ((Traceable) attr).trace(buf, null); } else { buf.append(" : unknown\n"); ...
1
public OutlineEditableIndicator(OutlinerCellRendererImpl renderer) { super(renderer, GUITreeLoader.reg.getText("tooltip_toggle_editability")); }
0
public Config newConfig(App app) throws IOException { //System.out.println("MultiConfigMaker.newConfig"); MultiConfig ret = new MultiConfig(); for (Object obj : configs) { if (obj instanceof Config) { ret.add((Config)obj); } else if (obj instanceof File) { File f = (File)obj; if (f.isDirectory()) { r...
8
public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Enter Number:"); int input = in.nextInt(); System.out.println("Square is "+(input*input)); System.out.println("Cube is "+(input*input*input)); System.out.println("Fourth Power ...
0
protected NCBIFastqIdParser(String id) { Matcher m = Pattern.compile(REGEX).matcher(id); if (!m.matches()) return; if (m.group(2) != null) { IdParser subParser = IdParserFactory.createParser("@" + m.group(2)); if (subParser != null) { for (IdAttributes a : subParser.getAllAttributes()) setAttrib...
5
public void buttonClicked(WizardButtonEvent wbe) { if( wbe.getButtonType() == WizardButtonListener.NEXT && wbe.getCard() == ep ){ options = new EmbedExtractOptions(); options.setInputFile( sif.getSelectedFile() ); options.setOutputFile( sof.getOutputFile() ); opt...
9
@Override public double getVariance() throws VarianceException { if (lambda <= 1) { throw new VarianceException("Pareto variance lambda > 1."); } else if (1 < lambda && lambda <= 2) { return Double.POSITIVE_INFINITY; } else { return Math.pow(k / (lambda - 1), 2) * lambda / (lambda - 2); } }
3
public void actionPerformed(ActionEvent e){ String action = e.getActionCommand(); if (action.equals("refreshList")){ System.out.println("refreshing..."); refreshGUIServer(); } else if(action.equals("arClick")){ System.out.println("arClick"); if(cRefresh.getModel().isSelected()){ timerText.setEdita...
4
public long getId() { return Id; }
0
@Override public String call() throws Exception { return "result of TaskWithResult " + id; }
0
public void keyReleased(KeyEvent ke) { Action action = actionOf(ke.getKeyCode()); if (action == null) return; releaseKey(action); switch (action) { case MOVE_UP: if (vy < 0) { vy = 0; } break; case MOVE_DOWN: if (vy > 0) { vy = 0; } break; case MOVE_LEFT: if (vx < 0) { vx = 0; } break; ...
9
public static void setLook() { try { // for( LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) // System.out.println("look and feels: " + info.getClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel")...
4
protected void load(PropertiesConfiguration config) throws IOException, ConfigurationException { this.name = config.getString("name"); this.collection = config.getString("collection"); if (collection != null) collection = collection.trim(); String urlPattern = config.get...
4
public void keyPressed(KeyEvent evt) { int modifiers = evt.getModifiersEx(); int keyCode = evt.getKeyCode(); // Ctrl + <key> int onmask = KeyEvent.CTRL_DOWN_MASK; int offmask = KeyEvent.SHIFT_DOWN_MASK | KeyEvent.ALT_DOWN_MASK; if ((modifiers & (onmask | offmask)) == onmask) { switch(keyCode) ...
9
private void buildIntersections() { //initialize _intersections = new Intersection[_gridDimensions.getRow()][_gridDimensions.getColumn()]; // Add organize by [rows][column] for (int i=0; i<_gridDimensions.getRow(); i++) { for (int j=0; j<_gridDimensions.getColumn(); j++) { //create a ...
2
public static Type getType(String name) { Type type = null; if(listTypes.containsKey(name)) { type = listTypes.get(name); } return type; }
1
public static void main(String[] args) { int i = 200; long lng = (long)i; lng = i; // "Widening," so cast not really required long lng2 = (long)200; lng2 = 200; // A "narrowing conversion": i = (int)lng2; // Cast required }
0
public double MacroRecall() { if (computed == 0) countStuff(); double mrec = 0; for (int i=0; i<catnum; i++) { if ((tp[i] != 0) && (tp[i]+fn[i] != 0)) mrec += tp[i]/(tp[i]+fn[i]); } re...
4
protected void changedBroadcastEnable(){ for(ModelChangeListener mcl : listeners){ mcl.changedBroadcast(bcast_enabled); } }
1
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jCheckBoxComptesRendus = new javax.swing.JCheckBox(); jCheckBoxVisiteurs = new javax.swing.JCheckBox(); jCheckBoxPracticiens = new jav...
0
public static UUID nameUUIDFromBytes(byte[] name) { MessageDigest md; try { md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException nsae) { throw new InternalError("MD5 not supported"); } byte[] md5Bytes = md.digest(name); md5Bytes[6] &= 0x0f; /* clear version ...
1
private void jTextField5FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField5FocusLost if(!responsableAntiguo.equals(jTextField5.getText())){ int i = JOptionPane.showConfirmDialog(frame, "Seguro que quieres cambiar el rol responsable: "+responsableAntiguo+ "\npor "+...
8
@Test public void testRandomArray() throws Exception { FileWriter FW = getFileWriter(); TestClass[] tests = FW.getArray("arrRand", new TestClass()); assert tests.length == testArray.length; for(int i = 0; i < tests.length; i++) { assert tests[i].val == testRandomArray[i]; } }
1
private void queueInorder(BSTNode node){ //Fill queue inorder if(node.getLeft() != null) { queueInorder(node.getLeft()); } Term t = (Term)node.getTerm(); queue.add(t); if(node.getRight() != null){ queueInorder(node.getRight()); } }
2
public void play(Sequence sequence, boolean loop) { if (sequencer != null && sequence != null && sequencer.isOpen()) { try { sequencer.setSequence(sequence); sequencer.start(); this.loop = loop; } catch (InvalidMidiDataException...
4
public void login(String password) { currentEmployee = timeMan.login(password); if(currentEmployee == null) { JOptionPane.showMessageDialog(null, "Sorry, no password match found. Please try again."); return; } else { bLogin.setEnabled(false); bLogout.setEnabled(true); tPassword.setEnabled...
3
public static void main(String args[]) { Board b = new Board(); b.loadBoardGraphFromResource("cs283/catan/resources/board.csv"); b.loadBoardTilesFromResource("cs283/catan/resources/tiles.csv"); for (Map.Entry<Coordinate, Node> x : b.nodeSet.entrySet()) { System.out.println(x.getKey()); ...
7
public void loadRoomConfig() throws BadConfigFormatException, FileNotFoundException { // Creates a FileReader and then wraps it in a scanner to read the file FileReader roomConfigFile = new FileReader(roomConfigFilename); Scanner fileScanner = new Scanner(roomConfigFile); String nextLine; Character key; ...
4
public void setData(Object data) { if(data.getClass().isArray()){ if(!Array.get(data, 0).getClass().isArray()){ this.data = vectorToMatrix(data); }else{ this.data = data; } }else{ if(data instanceof Byte){ this.data = new byte[][]{{(Byte)data}}; } else if(data instanceof Short){ th...
8
public boolean exchangeCashPurse(String serverID, String assetID, String nymID, String oldPurse, ArrayList selectedTokens) throws InterruptedException { Helpers.setObj(null); System.out.println(" Cash Purse exchange starts, selectedTokens:" + selectedTokens); String newPurse = processCashPurse(...
3
public String errorMessage() throws Exception { switch (errorCode) { case OK: throw new Exception("TILT: Should not get here."); case UNEXPECTED_ARGUMENT: return unexpectedArgumentMessage(); case MISSING_STRING: return String.fo...
5
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == clearAll) { clear(); } else if(e.getSource() == save) { saveFile(); } else if(e.getSource() == load) ...
6
public HashMap beep() throws Exception { ArrayList<Integer> answer = this.device.send(0x13, 1, new char[]{}); if (answer.size() == 0 || answer == null) throw new Exception("Пустой ответ"); HashMap<String, Integer> result = new HashMap<String, Integer>(); result.put("resu...
3
public List<Conversation> getConversationList( int person_id, int page_size, int offset ){ if( !handler_cvs.initialize() || !handler_msg.initialize() || !handler_person.initialize() || !handler_group.initialize() ){ System.out.println( "ConversationServer : failed to initialize!" ); return null; } L...
8
@Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._avalie_ == oldChild) { setAvalie((PExpLogica) newChild); return; } for(ListIterator<PEstrCaso> i = this._...
7
@Override public void onEnable() { getConfig().options().copyDefaults(true); saveConfig(); gm = new GameManager(this); lh = new LocationHandler(this); tm = new TeamManager(this); fm = new FlagManager(this); sm = new ScoreManager(this); sm.setupScoreboa...
5
@Override public void reflect(State s) { state = s; if (s.gameOver()) { // show end state, overlaid with scores and shit JFrame f = new JFrame(); int[] players = s.players(); f.setLayout(new GridLayout(0, players.length)); // sigh. gridlayout insists on ltr, ttb child insertion for (int y = 0; ...
7
public static void main(String[] args) throws Exception { Collection<DataClip> clips = new LinkedList<DataClip>(); for(int i = 0; i < args.length; i++) { if(args[i].equals("-b")) { bufsize = Integer.parseInt(args[++i]); } else { DataClip c = new DataClip(new java.io.FileInputStream(args[i])); clips.ad...
4
@Test public void testGetValue() { Layer l = new Layer(); List<Double> weights = new ArrayList<Double>(); l.insertNeuron(new ConstantOneInputNeuron()); l.insertNeuron(new ConstantOneInputNeuron()); weights.add(1.0); weights.add(1.0); try { FeedForwardNeuron neuron = new FeedForwardNeuron(l, weights); ...
1
private boolean zzRefill() throws java.io.IOException { /* first: make room (if you can) */ if (zzStartRead > 0) { System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0, zzEndRead-zzStartRead); /* translate stored positions */ zzEndRead-= zzStartRe...
5
final private void createActiveLayer() { // DeferredByteArray3D statemap = fm.getStateMap(); int px_zero = 0, px_inside = 0, px_outside = 0; int grey_zero = 0, grey_inside = 0; final DeferredObjectArray3D<StateContainer.States> statemap = init_state.getForSparseField(); for (int x = 0; x...
9
public void get_audio( byte[] output_buffer, int frames ) { int output_idx, mix_idx, mix_end, count, amplitude; output_idx = 0; while( frames > 0 ) { count = tick_length_samples - current_tick_samples; if( count > frames ) { count = frames; } mix_idx = current_tick_samples << 1; mix_end = mix_i...
6
private static char [] zzUnpackCMap(String packed) { char [] map = new char[0x10000]; int i = 0; /* index in packed string */ int j = 0; /* index in unpacked array */ while (i < 90) { int count = packed.charAt(i++); char value = packed.charAt(i++); do map[j++] = value; while (--cou...
2
private void checkSpriteCollisions(ArrayList<ArrayList<Sprite>> spriteLists) { for (ArrayList<Sprite> spriteList : spriteLists) { int startIndex = spriteList.indexOf(this) + 1; for (int i = startIndex; i < spriteList.size(); i++) { if (intersects(s...
3
private JPanel createVerticalList( String[] strings, boolean decorate ){ JPanel list = new JPanel(); BoxLayout l = new BoxLayout( list, BoxLayout.Y_AXIS ); list.setLayout( l ); list.setAlignmentX( JPanel.RIGHT_ALIGNMENT ); for( String s : strings ){ // JLabel label = new JLabel( s ); // // list.add(...
3
public T read(Timestamp currentDateTime) throws IOException { Deal deal = new Deal(); int type = dataInput.readUnsignedByte(); if ((type & DealFlags.DATE_TIME.getValue()) > 0) { DataReader.readDateTime(dataInput, baseDateTime); } deal.setTime(currentDateTime); ...
6
private static void login(BufferedReader br, ServiceInterface obj, Scanner cs) throws IOException{ // TODO Auto-generated method stub String str[] = new String[2]; for (int i = 0; i < 2; i++) { str[i] = br.readLine(); } if (obj.login(str[0], str[1])) { System.out.println("Hello "+str[0]); showMe...
2
@Override public void run(){ byte[] data = new byte[1024]; DatagramPacket packet = new DatagramPacket(data, data.length); try { socket.receive(packet); } catch (IOException e) { e.printStackTrace(); } this.parsePacket(packet.getData(), packet.g...
1
static String judge(String a,String b){ if(a.equals(b)){ return ACCEPTED; } a=a.replaceAll("[ \n\t]+",""); b=b.replaceAll("[ \n\t]+",""); if(a.equals(b)){ return PRESENTATION_ERROR; } return WRONG_ANSWER; }
2
@After public void tearDown() { try { AqWsFactory.close(clientProxy); } catch(Exception ex) { fail("tearDown failed..."); } }
1
@Test public void testConstructNimMatrix_10Sticks() { int numberOfSticks = 10; int matrixSize = numberOfSticks + 1; NimVertex[][] expectedMatrix = new NimVertex[matrixSize][matrixSize]; expectedMatrix[10][9] = new NimVertex(10,9); expectedMatrix[9][2] = new NimVertex(9,2); expectedMatrix[8][4] = new Nim...
8
private static void normalizeVariableContent(String varName) { String value = Config.get(varName); if (value != null && value.toLowerCase().endsWith(".zip")){ Config.set(varName, value.replaceFirst("\\.[Zz][Ii][Pp]$", "")); } }
2
public boolean assignSong(Song s) { String path= s.getPath(); if(this.songMap.get(path) != null) return false; this.songMap.put(path, s); return true; }
1
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((country == null) ? 0 : country.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; }
2
public User loginUser(User user){ try { Socket loginSocket = new Socket(SERVER_ADDRESS_LOGIN, LOGIN_PORT); loginSocket.setSoTimeout(TIMEOUT); OutputStream outputStream = loginSocket.getOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream( outputStream); objectOutp...
3
public void setPropertyElementType (Class type, String propertyName, Class elementType) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null."); if (elementType == null) throw new IllegalArgumentEx...
6
public void convertSolu(){ if (brute == false) { for (int i = 0; i < this.soluList.size(); i++) { ArrayList tmp = this.soluList.get(i); HashMap<Integer, ArrayList<Unit>> solu = new HashMap<Integer, ArrayList<Unit>>(); for (int j = 0; j < tmp.size(); j++) { ArrayList<Integer> rowY = mtrY.get(tmp.ge...
7
public void getSoundsToPlay(int deltaTime){ if(!soundToggled) return; int lastTime = currentTime; currentTime += deltaTime * scale; //Check each time for sounds that should play this frame for(int i = 0; i < times.size(); i++){ int time = times.get(i); //If this index's time is between last...
5