text
stringlengths
14
410k
label
int32
0
9
@Override public void setMiscText(String newMiscText) { onlyRoomDomains.clear(); neverRoomDomains.clear(); skills.clear(); super.setMiscText(newMiscText); this.message=CMParms.getParmStr(newMiscText, "MESSAGE", "You can't do that here."); String domains=CMParms.getParmStr(newMiscText, "ONLYROOMS", ""); ...
8
public void actionPerformed( ActionEvent e ) { Object sender = e.getSource() ; if ( sender == saveButton) { if ( fileDialog.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { TGlobal.config.saveToFile(fileDialog.getSelectedFile()); } } else if (sender == loadButton) ...
6
private void fineAdd(FineNode<T> curr, T t) { if (curr != root) { if (curr.getParent() != root) { curr.getParent().getParent().unlock(); } curr.lock(); } try { switch (t.compareTo(curr.getValue())) { case -1: fineInternalAddLeft(curr, t); break; case 1: fineInternalAddRight(curr,...
6
public static void main(String[] args) { Params.readConf(); Params.printConf(); Rule r = new Rule(Params.rule, Params.radius); boolean[][][] e = { getRandomTestCase(r), getTestCase(r), getTestCase2(r) }; GeneticAlgorithmKernel kernel = new GeneticAlgorithmKernel(Params.populationCount, e); double bestF...
8
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) return false; // Is metrics already running? if (task != null) return true; // Begin hitting the server with glorious data task = plugin.getServer().getScheduler() ...
7
private void compute_pcm_samples0(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { float pcm_sample; final float[] dp = d16[i]; pcm_sample = (float)(((vp[0 + dvp] * d...
1
void createChildWidgets () { /* Add common controls */ super.createChildWidgets (); /* Add TableEditors */ comboEditor = new TableEditor (table); nameEditor = new TableEditor (table); table.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent e) { resetEditors (); index = tab...
3
public void setItemId(int itemId) { this.itemId = itemId; }
0
public void setShutdownButtonBorderthickness(int[] border) { if ((border == null) || (border.length != 4)) { this.buttonShutdown_Borderthickness = UIBorderthicknessInits.SHD_BTN.getBorderthickness(); } else { this.buttonShutdown_Borderthickness = border; } someth...
2
public void dealClueCards() { Random hazard = new Random(); int playerIndex = 0; Card someCard; dealDeck.addAll(deck); // create solution set while (true) { someCard = dealDeck.get(hazard.nextInt(dealDeck.size())); if (someCard.type == CardType.PERSON){ dealDeck.remove(someCard); solution.a...
8
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); diccionario = new TreeMap<Integer, ArrayList<char[]>>(); for (int c = 0, C = parseInt(in.readLine().trim()); c < C; c++) { String str = in...
9
private WriteResponseList processRecordDeletesInBatchMode(BaseRef[] refs, String methodName) { ArrayList<WriteResponse> responses = new ArrayList<WriteResponse>(); BaseRef[] batch = new BaseRef[getDeleteRequestSize()]; for (int i=0; i<refs.length; i++) { if (i != 0 && (i%getDeleteRequestSi...
7
private boolean r_mark_suffix_with_optional_U_vowel() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; // (, line 159 // or, line 161 lab0: do { ...
9
public void upgrade() { if(tier < 19) { fuelCapacity += 20; fuelLevel += 20; tier++; } else { tier = 20; fuelCapacity = 500; fuelLevel = 480; } }
1
public static int[] twoSum(int[] numbers, int target) { int[] result = new int[2]; result[0] = -1; result[1] = -1; HashMap<Integer, Integer> table = new HashMap<Integer, Integer>(); int other = 0; //start from 1 for(int m=0;m<numbers.length;m++) { Integer otherPart = table.get(target-numbers[m]); i...
8
@Override protected void init() { try { // check to see if the user is using a File or InputStream. This is // here for backwards compatability if (dataSourceStream != null) { final Reader r = new InputStreamReader(dataSourceStream); setDat...
5
private boolean handleMessage(SelectionKey key, SocketChannel socketChannel, ProtocolHeader protocolHeader) { long numRead; numRead = 0; int offset = 1; buffer[offset] = ByteBuffer.allocate(ProtocolUtils.getBodySize(protocolHeader)); numRead = readBuffer(key, offset); i...
4
public static int[] sort(int[] list){ if(list == null || list.length <= 0){ return list; } boolean changed; do { changed = false; for(int i=1; i<list.length; i++){ if(list[i-1] > list[i]){ swap(list, i-1, i); changed = true; } } } while(changed); return list; }
5
public String getCivilState() { return CivilState; }
0
@Override public int compareTo(DBUpdateTimestamp o) { int t = this.year - o.year; int u = this.month - o.month; int v = this.day - o.day; int w = this.count - o.count; if (t != 0) return t; if (u != 0) return u; if (v != 0) return v; if (w != 0) return w; return 0; }
4
public DistributionSkew(int rack_size, int max_card, double skew){ super(rack_size, max_card); //Clamp skew value, so we can keep the error weights normalized between 0-1 if (skew > 1) skew = 1; else if (skew < -1) skew = -1; //Compute skew line offset = skew > 0 ? skew : 0; slope = -skew / (double) rack_...
3
@Override public String getParameter(String name) { String custom = (String)this.customParameters.get(name); if (custom != null) return custom; try{ return super.getParameter(name); }catch(Exception e){ this.customParameters.put(name, null); } return null; }
2
public static void main(String[] args) { Sleeper sleepy = new Sleeper("Sleepy", 1500), grumpy = new Sleeper("Grumpy", 1500); Joiner dopey = new Joiner("Dopey", sleepy), doc = new Joiner("Doc",grumpy); grumpy.interrupt(); }
0
public boolean dateConcorde(DateTime d){ if(dateDepart.minusHours(4).isBefore(d) && dateDepart.plusHours(4).isAfter(d)) return true; return false; }
2
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 ...
9
private int requestEngineMove() { int move = Game.NULL_MOVE; int ponder = Game.NULL_MOVE; try { if (client.isPondering()) { client.send("stop"); while (client.isPondering()) client.receive(); } ...
9
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
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked this.jPanel1.setVisible(false); this.jPanel2.setVisible(false); if (this.jPanel3.isVisible()) this.jPanel3.setVisible(false); else { this.jPanel3.setVi...
1
private void fxInitErrorHandler() { webEngine.getLoadWorker().exceptionProperty().addListener( new ChangeListener<Throwable>() { public void changed( ObservableValue<? extends Throwable> o, Throwable old, final Throwable value ) { if( webEngine.getLoadWorker().getSta...
3
public static DataType getType(String type) { if (type.equalsIgnoreCase("YAML")) { return YAML_SHARED; } for (DataType dt : DataType.values()) { if (dt.name().equalsIgnoreCase(type)) { return dt; } } return null; }
3
public final WaiprParser.machine_return machine() throws RecognitionException { WaiprParser.machine_return retval = new WaiprParser.machine_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token string_literal2=null; Token ID3=null; Token char_literal4=null; Token char_literal6=null; Pa...
9
public void handleKeyPress(int value) { System.out.println(this.name + ": Keyboard key " + value + " was pressed."); switch(value) { case MinuetoKeyboard.KEY_Q: this.closing = true; window.close(); break; case MinuetoKeyboard.KEY_W: window.setCursorVisible(true); break; case Mi...
5
public Server() { try { serverSocket = new ServerSocket(11111); } catch (IOException ioe) { System.out .println("Not create server socket. WTF?."); System.exit(-1); } while (ServerOn) { try { Socket cl...
4
public void write( SelectionKey key ) throws IOException { SocketChannel chan = (SocketChannel) key.channel(); TcpConnection tcp = getConnection(key); ByteBuffer buf = null; // find something to write while( tcp.hasWrite() ){ buf = tcp.fetchWrite(); if( buf != null && buf.hasRemaining() ){ ...
5
private int decodeBlackCodeWord() { int current; int entry; int bits; int isT; int code = -1; int runLength = 0; boolean isWhite = false; while (!isWhite) { current = nextLesserThan8Bits(4); entry = initBlack[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (ent...
6
public void print(Byte[] jeu){ for (int i=0; i < 37; i++){ if (i==4 || i==9 || i==15 || i==22 || i==28 || i==33) System.out.println(); System.out.print(jeu[i]); } System.out.println(); }
7
public void pathSumRec(TreeNode root, int sum, Stack<Integer> tmp) { if(root == null) return; if(root.left == null && root.right == null) { if(root.val == sum){ res.add(new ArrayList(tmp)); } } if(root.left != null){ tmp.add(root.left.val); pathSumRec(root.left, sum - root.val, tmp); tmp.pop(...
6
public int oppDir(int dir) { switch (dir) { case 0: return 2; case 1: return 3; case 2: return 0; case 3: return 1; case 4: return 5; case 5: return 4; default: return -1; } }
6
private final int appendPostings(final FormatPostingsTermsConsumer termsConsumer, SegmentMergeInfo[] smis, int n) throws CorruptIndexException, IOException { final FormatPostingsDocsConsumer docConsumer = termsConsumer.addTerm(smis[0].term.text); int df = 0; for (int i = 0; i < n; i++) { Segm...
8
public void mezclarTodosLosNodos(){ Nodo<E> cambiandoNodoA = cabeza; Nodo<E> cambiandoNodoB; for (int i = 0; i < talla; i++){ int posicionAzar = (int )(1+(Math.random() * (talla-1))); //numeros [1 , talla-1] cambiandoNodoB = cabeza; while( posicionAza...
2
@Override public synchronized void run() { String msg; try { while(!Thread.currentThread().isInterrupted()){ while(!messageQueue.isEmpty()){ try{ msg = messageQueue.removeFirst(); if(msg.contains(" JOIN ") || msg.contains((" PART "))){ messageDisplay.output(msg); } ...
9
public String stripLineBackup(String navigationLine) { String arrow = " <-+-- "; String vertical = " | "; String corner = " +-- "; String navigationLine2 = navigationLine; if (navigationLine2.contains(corner)) navigationLine2 = navigationLine2.replaceAll(" \...
6
public void typeKeycode(int keyCode) { if( keyMap.containsKey((char)keyCode) ){ ShiftIndex shi = keyMap.get((char)keyCode); if(shi.shift){ keyType(shi.keyVal, KeyEvent.VK_SHIFT); }else{ keyType(shi.keyVal); } } else { keyType(keyCode); } }
2
public static void start() { Rooms.currentRoom = 1; Rooms.ChangeRoom("", -1, true); showRoomInfo(1); }
0
public static void main(String[] args) { Main mainContext = new Main(); try { mainContext.loadFileActions(); mainContext.performFileActions(); mainContext.deobfuscateAndDecompile(args); mainContext.downloadCache(args); } catch(Exception exception) { exception.printStackTrace(); } Logger...
1
public DefaultItem( DefaultUmlDiagram diagram, ItemKey<T> key ) { this.diagram = diagram; contextCapability = new DefaultItemContextCapability( diagram, this ); setCapability( CapabilityName.CONTEXT_MENU, contextCapability ); if( key == null ) { key = createKey( diagram ); } this.key = key; }
1
public void mouseClicked(int button, int x, int y, int clickCount){ if(this.playButton.contains(x, y)){ PlayerData.resetPlayer(); PlayerData.setLevel(this.currentLevel + 1); this.sbg.enterState(TowerDefense.GAMEPLAYSTATE); } else if (this.prevButton.contains(x, y)){ if (this.currentLevel == 0) thi...
4
private Point pickBestMove(Point pointA, Point pointB) { Point best = pointA; Item itemA = _worldMemory.get(pointA).getKey(); Item itemB = _worldMemory.get(pointB).getKey(); if (greenEnergy <= pinkEnergy) { if (itemB != null) { best = itemA.greenGain * itemA.quantity > itemB.greenGain * itemB.quantity /*...
5
public int findPivot(int array[], int start, int end) { int mid = (start+end)/2; if(mid<end && array[mid] > array[mid+1]) return mid; else if(mid>start && array[mid] < array[mid-1]) return mid-1; else if(array[mid] < array[start]) return findPivot(array, start, mid-1); else if(array[mid] > ar...
6
private void updateFromNonCachableResponse(HttpRequest currentRequest, HttpResponse currentResponse) { //update from 304 NOT MODIFIED responses CachedResponse cached = responseCache.get(currentRequest.getUri()); if (currentResponse.getStatus().code() == 304) { long lastModified = det...
7
public static String inferDialectName(String url) { return match(url, name -> { switch (name) { case "h2": return "h2"; case "hsqldb": return "hsqldb"; case "sqlite": return "sqlite"; case "mysql": ...
8
private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed int colCnt = loanScheduleTable.getColumnCount(); int rowCnt = loanScheduleTable.getRowCount(); File csvFile = null; File renCsvFile = null; String newFileName =...
8
void pack(Object i, Buffer opb){ InfoFloor1 info=(InfoFloor1)i; int count=0; int rangebits; int maxposit=info.postlist[1]; int maxclass=-1; /* save out partitions */ opb.write(info.partitions, 5); /* only 0 to 31 legal */ for(int j=0; j<info.partitions; j++){ opb.write(info.parti...
7
private static Method getMethod(Class<?> theClass, String methodName, Class<?>... params) { try { Method method = theClass.getDeclaredMethod(methodName, params); method.setAccessible(true); return method; } catch (Exception exception) { Log.error(exception); return null; } }
3
public AlarmPanel() { setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(221dlu;default)"),}, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, RowSpec.decode("4dlu:grow"), FormFactory.DEFAULT_ROWSPEC, Fo...
9
public boolean[] getAction() { double[] inputs;// = new double[numberOfInputs]; // byte[][] scene = observation.getLevelSceneObservation(/*1*/); // byte[][] enemies = observation.getEnemiesObservation(/*0*/); inputs = new double[numberOfInputs]; int which = 0; for (int ...
7
private Filter.FilterAction buildExtractionTreeForFollow(ExtractedNode node, Cmd cmd) throws Exception { if (cmd.getType() != Cmd.CmdType.FOLLOW) { throw new Exception("Expected FOLLOW command"); } CmdArg link = cmd.getArg("FOLLOW"); CmdArg with = cmd.getArg("...
9
public void mouseMoved(MouseEvent e) { if (isInside(e.getX(), e.getY()) && !highlighted) { highlight(); } if (!isInside(e.getX(), e.getY()) && highlighted) { deHighlight(); } }
4
public void keyReleased(int k) { if(k == KeyEvent.VK_A) player.setLeft(false); if(k == KeyEvent.VK_D) player.setRight(false); if(k == KeyEvent.VK_UP) player.setUp(false); if(k == KeyEvent.VK_DOWN) player.setDown(false); if(k == KeyEvent.VK_SPACE) player.setJumping(false); if(k == KeyEvent.VK_W) player.setGl...
8
public void saveWorldInfo(WorldInfo var1) { NBTTagCompound var2 = var1.getNBTTagCompound(); NBTTagCompound var3 = new NBTTagCompound(); var3.setTag("Data", var2); try { File var4 = new File(this.saveDirectory, "level.dat_new"); File var5 = new File(this.saveDirectory, "level.d...
4
public void setValue(String s) { for (int i = 0; i < values.length; i++) { if (values[i].equals(s) && values[i] != null) { value = i; break; } } }
3
double t(int N1[], int N2[], double weight[]) { int R1 = 0, R2 = 0; int k = N1.length; for (int i = 0; i < k; i++) { R1 += N1[i]; R2 += N2[i]; } double t = 0; for (int i = 0; i < N1.length; i++) t += weight[i] * ((N1[i] * R2) - (N2[i] * R1)); return t; }
2
public void initconfig() { BufferedReader bin; boolean foundcmd; String[] str; String cfile; cfile = fileName; mytotmsg = 0; // determine self process id mypid = Integer.parseInt(cfile.substring("Server".length(),cfile.indexOf("."))); tr...
7
public static void parseJSONResponse(HttpsURLConnection conn, String json_response){ try { if (conn.getResponseCode() == 200 && json_response.contains("transaction")) //http status 200 { Gson gson = new Gson(); TransactionResponse transaction_response = gson.fromJson(json_response, TransactionRe...
7
public static <A, B, C, D, E> Equal<P5<A, B, C, D, E>> p5Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed, final Equal<E> ee) { return equal(p1 -> p2 -> e...
4
public ExtDecimal log10(int scale) { // Not yet customized if (compareTo(ZERO) < 0) { throw new ArithmeticException("Logarithm of a negative number in a real context"); } else if (compareTo(ZERO) == 0) { throw new ArithmeticException("Logarithm of 0"); } else if (...
4
public boolean jsFunction_waitStartMove(int timeout) { deprecated(); int curr = 0; if(timeout == 0) timeout = 10000; while(!JSBotUtils.isMoving()) { if(curr > timeout) return false; Sleep(25); curr += 25; } return true; }
3
@Override public void restoreTemporaryToCurrent() { copyHashMap(cur,tmp); }
0
@Override public boolean equals(Object ob) { if (ob.hashCode() == this.hashCode()) { return true; } return false; }
1
public boolean isMaximized() { return maximized; }
0
public SQLite(Logger log, String prefix, String directory, String filename) { super(log,prefix,"[SQLite] "); if (directory == null || directory.length() == 0) throw new DatabaseException("Directory cannot be null or empty."); if (filename == null || filename.length() == 0) throw new DatabaseException("Fi...
8
@Override public void run() { try { while (running) { Message m = messages.take(); String message = m.getMessage(); int command = Protocol.CheckMessage.registrerProtocolType(message); switch (command) { case 1: ...
5
private int detectPacket0(byte[] buffer, int i) { // if (buffer.length <= i) // return PACKET_MAYBE; // if (buffer[i] != (byte)0xAA) // return PACKET_NO; if (buffer.length <= i+1) return PACKET_MAYBE; if (buffer[i+1] != (byte)0xAA) return PACKET_NO; if (buffer.length <= i+2) return PACKET_MAYBE; ...
8
public static void main(String[] args) { new Ship(); new Ship("Varangian"); }
0
private void VerEntradaSeleccionadaConsultaControloResultados() { int linha = jTableConsultaEntradas.getSelectedRow(); int contaLinhas = 0; String nomeTabela = "ENTRADA"; if (linha == -1) { JOptionPane.showMessageDialog(jDialogConsultaEntradas, "Seleccione ...
7
public int size() { if(packetList != null) { return packetList.size(); } else { if(singlePacket != null) { return 1; } else { return 0; } } }
2
private void find(Map<String,PriorityQueue<String>> tickets, String cur,List<String> result){ while (tickets.containsKey(cur) && !tickets.get(cur).isEmpty()) { find(tickets, tickets.get(cur).poll(), result); } result.add(0,cur); return; }
2
public void setVolume(float volume) { if (Debug.video) System.out.println("VideoPlayer -> setVolume called with " + volume); if ((null != player) && (realizeComplete)) { // Verify the input if (80 < volume){ if (Debug.video) System.out.println("VideoPlayer -> setVolume -> vol over limit"); volume = 8...
8
private static void qsort(MilkFarmer[] milkFarmers, int start, int end) { if (start >= end) return; int l = start; int r = end; int pivot = milkFarmers[(l + r) / 2].p; while (l <= r) { while (milkFarmers[l].p < pivot) l++; while (milkFarmers[r].p > pivot) ...
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass() != obj.getClass()) { return false; } Department d = (Department) obj; if (hashCod...
8
public void kill() { try { this.playerAcceptor.interrupt(); worldHandle.interrupt(); expander.interrupt(); SocialSecurity.close(); try { if (!playerList.isEmpty()) { for (PlayerOnline ...
4
public final List<MonsterDropEntry> retrieveDrop(final int monsterId) { if (drops.containsKey(monsterId)) { return drops.get(monsterId); } final List<MonsterDropEntry> ret = new LinkedList<MonsterDropEntry>(); PreparedStatement ps = null; ResultSet rs = null; try { ps = DatabaseConnection.getConnection...
6
public String getText(String key) { String retVal = (String) textResources.get(key); if (retVal == null) { System.out.println("Invalid text resource key: " + key); } return retVal; }
1
@Override public void setVisible(boolean state) { if (state) { } super.setVisible(state); }
1
public void mouseClicked(MouseEvent me) { int x, y; Rectangle r = new Rectangle(0, 0, (int) (m_nPaddedNodeWidth * m_fScale), (int) (m_nNodeHeight * m_fScale)); x = me.getX(); y = me.getY(); for (int iNode = 0; iNode < m_BayesNet.getNrOfNodes(); iNode++) { r.x = (int) (m_BayesNet.getPositionX(iNode)...
7
public String simplifyPath(String path) { if (path == null || path.length() < 2) { return "/"; } Stack<String> s = new Stack<String>(); for(String p: path.split("/")) { if (p.length() == 0 || p.equals(".")) { continue; } else if (p.equa...
9
public void processGridletReturn(Sim_event ev) { Object obj = (Object) ev.get_data(); Gridlet gl = null; int glID; if (obj instanceof Gridlet) { gl = (Gridlet) obj; glID = gl.getGridletID(); System.out.println("<<< " + super.get_name() +...
3
public void removeSpace(char[] arr, int length){ if(arr==null) return; int spaceCount=0; for(int i=0; i<arr.length ;i++){ if(arr[i]==' '){ spaceCount++; } } char newarr[]=new char[arr.length+(spaceCount*2)]; for(int i=arr.length-1; i>=0;i-- ){ int k=i+spaceCount*2; if(arr[i]==' '...
6
final void method2670(int i) { anInt4222++; if (archiveLoaders != null) { for (int i_0_ = 0; ((archiveLoaders.length ^ 0xffffffff) < (i_0_ ^ 0xffffffff)); i_0_++) { if (archiveLoaders[i_0_] != null) archiveLoaders[i_0_].method2342(0); } for (int i_1_ = i; i_1_ < archiveLoaders.length; i_1_++) {...
5
@Override public String toString() { StringBuilder string = new StringBuilder(); if (this.operator.getNumOperands() > 1) { string.append(this.operands.get(0)).append(" "); } string.append(this.operator).append(" "); String prefix = ""; for (int curOperand = this.operator.getNumOperands() > 1 ? 1 : 0; cu...
7
public int alloc(int size) { int i, prev_i = 0; for (i = this.head.s_free.next; i != 0; i = this.nf[i].free.next) { if (this.nf[i].free.size >= size) break; prev_i = i; } // there is no free node if (i == 0) { System.err.format("alloc:NO FREE NODE\n"); return 0; } if (prev_i == 0) { ...
6
private String binaryCode(int cellAdress, int nbrVar) { byte bt[] = new byte[nbrVar]; String binaryAdress = ""; for (int i = 0; i < nbrVar; i++) bt[i] = 0; if (cellAdress != 0) { while (cellAdress != 0) { bt[nbrVar - 1] = (byte) (cellAdress % 2); cellAdress = cellAdress / 2; nbrVar--; } }...
4
private void writeShipUnlocks(OutputStream out, boolean[] unlocks) throws IOException { for (int i = 0; i < unlocks.length; i++) { writeInt(out, unlocks[i] ? 1 : 0); } }
2
public static String long2TimeString(final long time) { long ms = time % 1000; long sec = (time / 1000); long min = (sec / 60); sec = sec % 60; long hr = min / 60; min = min % 60; StringBuilder sbTime = new StringBuilder(); if (hr > 0) sbTime.append(hr).append(" hr "); if (min == 0) { if (sbTime.l...
5
@Override public boolean equals(Object obj){ if (obj == null) return false; if (!(obj instanceof Point)) return false; Point point = (Point)obj; if (!(getX() == point.getX())) return false; if (!(getY() == point.getY())) return false; if (!(getZ() == point.getZ())) return false; return true; }
5
@Override public String getRealName() { return name(); }
0
public void testSet_DateTimeFieldType_int2() { MutableDateTime test = new MutableDateTime(TEST_TIME1); try { test.set(null, 0); fail(); } catch (IllegalArgumentException ex) {} assertEquals(TEST_TIME1, test.getMillis()); }
1
public static void main(String[] args) { VideoPlayer player = new VideoPlayer(); ServerSocket server = null; int port = getPort(args); try { server = new ServerSocket(port); } catch(SecurityException e) { System.out.println("It appears you cannot use the port:...
5
@SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { int i = par2 & 7; if (i == 0){ return Block.cobblestone.getBlockTextureFromSide(1);} else if (i == 1){ return Block.stoneSingleSlab.getBlockTextureFromSide(par1);} else if (i == 2){ return Block.stoneBrick.getBlockTextureFromSide(...
7
public static void main(String[] args) throws InterruptedException { long startTime; long endTime; // Test case #1: // start up WORKER_THREAD_NUM worker threads (each of which will request // TRANSACTION_NUM transactions from the server) System.out.println("Benchmarking server performance with " + Ba...
2