text
stringlengths
14
410k
label
int32
0
9
@Override public void start(Map<String, List<String>> incAttributes, String incUrl, Socket socket) { System.out.println("Starting NavigationSystem Plugin"); ResponseHandler respHandle = new ResponseHandler(socket); if (incAttributes.isEmpty()) { try { respHandle.s...
9
@Override protected void mine(Player p) { //oven can not be destroyed with items in it if(inventory[0] == null && inventory[1] == null && inventory[2] == null){ super.mine(p); }else{ System.out.println("Oven can not be recovered while it has items stocked !"); resetHealth(); } }
3
public DigestMethodType getDigestMethod() { return digestMethod; }
0
public List<Material> Wastage(int ME) { List<Material> wastage; wastage = new ArrayList<Material>(); for (int i = 0; i < Materials.size(); i++) { Material mat; mat = new Material(); mat.ProductID = Materials.get(i).ProductID; mat.ProductName = Mate...
1
public static void main(String[] args) { logger.setLevel(Level.SEVERE); ConsoleHandler handler = new ConsoleHandler(); handler.setLevel(Level.SEVERE); logger.addHandler(handler); if (args.length == 0) { logger.warning("Invalid arguments count."); return; ...
9
public static Set<Player> run(GameState state, GameSettings gSettings) { //Setup global game settings settings = gSettings; //Launch the GUIs state.launchGUIs(); //Hello! state.log("The game is starting!\nLook for a log of game events here"); //get the list of all the drawable cards ArrayList<...
6
public static String reverseVowels(String s) { if (s == null) return ""; char chars[] = new char[s.length()]; int i = 0, j = s.length() - 1; while (i <= j) { while (i < s.length() - 1 && !isvowel(s.charAt(i))) { chars[i] = s.charAt(i); i++; } while (j >= 0 && !isvowel(s.charAt(j))) { cha...
9
public double standardError_as_double() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } double standardError = 0.0D; switch (type) { case 1: double[] dd = this.getArray_as_double(); ...
5
private DecisionTreeNode parseNode(XMLStreamReader reader, String[] labels) throws XMLStreamException { DecisionTreeNode result = null; //Put reader on the next node goToNext(reader, "node"); //Leaf or not ? if(reader.getAttributeValue(null, "type").equals("leaf")) { //Create decision Decision d =...
7
public Log_record(String one_line_rec) { //14/03/09 13:41:36.852 subsys event print_job_start user_name=operator1; file_name=default; sizeX=1200; sizeY=600; inkC=678; inkM=756; inkY=456; inkK=789; data = new Date(); data.setTime(0); subsystem = record_subsystems.Unknown; mes...
4
@Override protected void process(List<RuleTaskState> chunks) { for (RuleTaskState chunk : chunks) { int progressValue = chunk.i; String stringToLog = chunk.s; if (progressValue == -1) { rd.addToMatchesList(stringToLog); continu...
2
private boolean rekAble(int x, int y) { for (int i=1;i<this.rekAbleR;i++) { for (int j=1;j<this.rekAbleR;j++) { if (y-j>=0 && x-i>=0) if (this.P[x-i][y-j].rek==1) return false; if (y+j<this.tabSizeY && x+i<this.tabSizeX) if (this.P[x+i][y+j].rek==1) return false; }//j }//i return true; }//--
8
public String[] GetData() { return dataPieces; }
0
@SuppressWarnings("unchecked") private void updateIncomingReferences(ModelElementInstance oldInstance, ModelElementInstance newInstance) { String oldId = oldInstance.getAttributeValue("id"); String newId = newInstance.getAttributeValue("id"); if (oldId == null || newId == null) { return; } ...
8
public void setjCheckBoxComptesRendus(JCheckBox jCheckBoxComptesRendus) { this.jCheckBoxComptesRendus = jCheckBoxComptesRendus; }
0
private void deleteFolder_fileManagerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteFolder_fileManagerButtonActionPerformed try { selectedDevice.getFileSystem().delete(directoryLabel_fileManagerLabel.getText() + jList1.getSelectedValue()); } catch (IOException...
1
private void dealtDamage(int getX, int getY, int getWidth, int getLength, int getTime, int getDelay, double getDamage,int applyForce) { if (character.equals("P1")) // player 1 { if (moveDirection) { // add new object (player 1) into the world at the correctio...
4
public int getXAxisValue() { if (xaxis == -1) { return 127; } return getAxisValue(xaxis); }
1
@Override public void endElement(String uri, String localName, String qName) throws SAXException { currentLevel--; currentElement = false; String name = null; if (localName != null && localName.length() != 0 && !elementsHandled.contains(localName)) { name = ...
9
public void updateGenerator() { if (generatorCoolDown == 0) { int structGenWeight; Random structGenRdm = new Random(); structGenWeight = structGenRdm.nextInt(15); if (structGenWeight == 11) { int valueWeight; ...
6
private void fullCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fullCBActionPerformed tablespaceT.clearSelection(); if(fullCB.isSelected()){ for(int i=0;i<tablespaceT.getRowCount();i++){ tablespaceT.getModel().setValueAt(false,i,1); } ...
2
public static void ClockLoop(int duration) { // GUI_NB.GCO("Clock time is now " + DisplayTimeFull() + " with time rate " + ClockControl.PrintTimeScale()); GlobalFuncs.ticksStable++; if (GlobalFuncs.runtoEq || GlobalFuncs.updateVapor) { GlobalFuncs.maxDelta = 0; GlobalFuncs.scenMap.updateVapor...
9
public boolean collide(Block block) { if (this.hasPoint(block.getX() - block.getWidth() / 2, block.getY() - block.getHeight() / 2) || this.hasPoint(block.getX() - block.getWidth() / 2, block.getY() + block.getHeight() / 2) || this.hasPoint(block.getX() + block.getWidth() / 2, block.getY() - block.getHeight() / ...
4
public int matchScore(Person p, Person q){ set.forEach(k -> engine.put(k, p.match(q, k))); Object ret = null; try{ ret = ((Invocable)engine).invokeFunction(FUNC_NAME); } catch (ScriptException | NoSuchMethodException ex){ throw new RuntimeException(ex); } ...
3
private void Jornada_ComboBox2ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_Jornada_ComboBox2ItemStateChanged // TODO add your handling code here: int i = 0; if (Jornada_ComboBox2.getSelectedIndex() > -1) { int p = Integer.parseInt(Jornada_ComboBox2.getSelectedIte...
2
public static void sort(Comparable[] a){ int N = a.length, h = 1; // while(h < N/3) h = 3*h + 1; while(h < N/3) h = 3*h ; while(h>=1){ for(int i = h; i < N; i++){ for(int j = i; j>=h; j-=h){ if(a[j].compareTo(a[j-h]) < 0){ Comparable tmp = a[j-h]; a[j-h] = a[j]; a[j] = tmp; } ...
5
protected boolean isValidLocation(UnitMover mover, int sx, int sy, int x, int y) { boolean invalid = (x < 0) || (y < 0) || (x >= map.getWidthInTiles()) || (y >= map.getHeightInTiles()); if ((!invalid) && ((sx != x) || (sy != y))) { invalid = map.blocked(mover, x, y); } return !invalid; }
6
public void run() { Debug.println("PhysicsEngine.run()"); synchronized (workQueue) { while (true) { if (workQueue.peek() == null) { try { workQueue.wait(); } catch (InterruptedException e) { continue; } } else { int doWhat = workQueue.poll(); switch (doWhat) { c...
5
private static void handleDropOfferReq(SerializableDropOfferReq pack) { //List<String> sellers = pack.commandInfo; Server.loggerServer.info("[Server] drop auction"); List<String> sellers = new ArrayList<String>(); SelectionKey key; sellers.addAll(pack.commandInfo); // reset list in pack (no longer needed) ...
2
protected void findBounds(int w,int h) { // top line for ( int y=0;y<h;y++ ) { if ( !hLineClear(y) ) { downSampleTop=y; break; } } // bottom line for ( int y=h-1;y>=0;y-- ) { if ( !hLineClear(y) ) { downSampleBottom=y; break; }...
8
public static void anotherWatcher() { try { WatchService watchService = FileSystems.getDefault().newWatchService(); Path dir = Paths.get("/home/xander/test/"); dir.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY); FileTime lastModified = null; ...
7
private static void loadComponents(AutoCodeConfig autoCodeConfig,Map variables) throws InvalidPropertiesFormatException { if(variables == null || variables.get("component") == null){ throw new InvalidPropertiesFormatException("Can't find any component!"); } if(!(variables.get("compon...
6
@Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("Save")) { // Saves the current values in an existing notice model.edit(view.getNotice(), view.getSubject(), view.getText(), view.getPriority()); view.actualizeList(model.getSubjects()); view.revalidate(); view.repaint(...
6
@Test public void timer() { final List<Long> expecteds=Arrays.asList(1L,2L,3L,4L,5L); final List<Long> actuals=new ArrayList<Long>(); final Timer timer = new Timer(1000, 5); timer.addEventListener(TimerEvent.TIMER, new EventListener() { @Override public void handleEvent(Event event) { System.out....
3
public boolean remove(String sana) { if (etsiSana(sana) == false) { return false; } Node poistettava = getChild(sana.charAt(0)); if (sana.length() > 1) { String loput = sana.substring(1); poistettava.remove(loput); } if (poistettava.si...
3
@Override public void run() { while (true) { try { String data = blockingDeque.takeFirst(); System.out.println(Thread.currentThread().getName() + " take(): " + data); Thread.sleep(1000); } catch (InterruptedExcep...
2
public String convertInitial(char initial){ String name = null; if(initial == 'C'){ name = "Conservatory"; } if(initial == 'K'){ name = "Kitchen"; } if(initial == 'B'){ name = "Ballroom"; } if(initial == 'R'){ name = "Billiard room"; } if(initial == 'L'){ name = "Library"; } if(in...
9
public void appendSamples(int channel, float[] f) { int pos = bufferp[channel]; short s; float fs; for (int i=0; i<32;) { fs = f[i++]; fs = (fs>32767.0f ? 32767.0f : (fs < -32767.0f ? -32767.0f : fs)); s = (short)fs; buffer[pos] = s; pos += channels; } buf...
3
@Override public void executeMove(ChessBoard board) { promoted_coin = null; if (option == NOT_DEFINED) { // PromotionDialog temp = new PromotionDialog(null, true); // temp.setVisible(true); // option = temp.getOption(); } switch (option) { ...
9
public boolean either24(int[] nums) { boolean is22 = false; boolean is44 = false; for (int i = 0; i < nums.length-1; i++) { if (nums[i] == 2 && nums[i+1] == 2) { is22 = true; } else if (nums[i] == 4 && nums[i+1] == 4) { is44 = true; ...
8
public void createFromXML(NodeList attributes) { Node n = attributes.item(0); while(n != null) { if(n.getNodeType() == Node.ELEMENT_NODE) { if(n.getNodeName().equals("rateOfFire")) { rateOfFire = Float.parseFloat(n.getFirstChild().getNodeValue()); ...
6
private void findOutAboutFriends() { //Friend names String alexName; alexName = JOptionPane.showInputDialog("What is your name"); alexFriend.setName(alexName); String alexHumorStyle; alexHumorStyle = JOptionPane.showInputDialog("What is your humor style"); alexFriend.setHumorStyle(alexHumorStyle); ...
8
static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos...
9
public boolean isBlockAlreadyInRoulette(Block block) { Set<Integer> tilesKeys = tilesLocations.keySet(); for(Integer key : tilesKeys) { SerializableLocation blockLocation = new SerializableLocation(block.getLocation()); if(tilesLocations.get(key).contains(blockLocation)) return true; } Set<Integer> spin...
4
@Override public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) { final java.util.Map<String,String> parms=parseParms(parm); final String last=httpReq.getUrlParameter("SOCIAL"); if(parms.containsKey("RESET")) { if(last!=null) httpReq.removeUrlParameter("SOCIAL"); return "";...
8
void kvpExpand(StringBuilder b, List<KVP> l, String method) { for (KVP c : l) { String[] from = c.getKey().split("\\."); String tos = c.getValue().toString().trim(); String[] t = tos.split("\\s+"); // multiple @In for (String kvp : t) { String to_obj = kvp; // default target is just object name St...
3
public byte[] decrypt(byte[] in) { int iterations = 1; if(in.length > 128) { iterations = (int)Math.ceil(in.length/128); } int messageLen = 0; byte[] message = new byte[iterations * 117]; try { for(int i = 0; i < iterations; i++){ byte[] toBeDecrypted = new byte[128]; System.array...
3
public static ClassLoader getClassLoader() { ClassLoader contextCL = Thread.currentThread().getContextClassLoader(); ClassLoader loader = contextCL == null ? ClassHelper.class.getClassLoader() : contextCL; return loader; }
1
private Map makeRequest(HttpGet httpGet) { InputStream inputStream = null; for (int i = 0; i < 15; i++) { // try some times try { HttpClient httpClient = new DefaultHttpClient(); HttpResponse response = httpClient.execute(httpGet); HttpEntity e...
6
@Override public String toString() { StringBuilder sb = new StringBuilder(); if (target == null) { sb.append(BeansUtils.NULL); } else { Class<?> clazz = target.getClass(); sb.append(clazz == String.class ? BeansUtils.QUOTE : BeansUtils ...
9
@Test public void peekingDoesntChangeHeap() { heap.insert(1); for (int i = 0; i < 1336; i++) heap.insert((int)(2 + Math.random() * 10000)); int j = -1; for (int i = 0; i < 1337; i++) j = heap.peek(); assertTrue(j == 1 && heap.size() == 1337); }
3
private String encryptString(String str) { StringBuffer sb = new StringBuffer (str); int lenStr = str.length(); int lenKey = key.length(); for (int i=0, j=0; i < lenStr; i++, j++ ) { if (j >= lenKey) j = 0; sb.setCharAt(i, (char)(str.char...
2
public static void deleteDir(String path){ File f =new File(path); if(f.exists() && f.isDirectory()) { if(f.listFiles().length == 0) { f.delete(); } else { File delFile[] = f.listFiles(); int i = f.listFiles().length; for(int j=0;j<i;j++) { if(delFile[j].isDirectory()){ ...
5
public void deleteTeacher(int id) { try { PreparedStatement ps = con.prepareStatement( "DELETE FROM teacher WHERE id=?" ); ps.setInt( 1, id ); ps.executeUpdate(); ps.close(); } catch( SQLException e ) { e.printStackTrace(); } }
1
public void mouseClicked(MouseEvent event) { if (event.getClickCount() == 1){ Transition trans = getDrawer().transitionAtPoint(event.getPoint()); if (trans != null){ if (trans.isSelected){ trans.isSelected = false; selectedTransition = nu...
5
public Component getComponentWithCard(Card card) { for(Component comp : this.getComponents()) { if(comp instanceof CardInHand) { if(((CardInHand) comp).getName().toLowerCase().equals(card.getName().toLowerCase())) { return comp; } } } return null; }
3
static void resampleProcess(int newR) throws IOException{ /* * Determine the threshold for resampling */ long indexsize = index.size(); int threshold = -1; long c = 0; estiRatio = getEstimateRatio(); measuredRatio = (double)dup/total/estiRatio; resultRecord.println("Total chunks are: " + totalChu...
4
public Object getAnswers(ClientRequest clientRequest) { Question question = (Question) clientRequest.getObject(); Random random = new Random(); GameDBLogic bLogic = new GameDBLogic(); List<Answer> allAnswers = null; try { allAnswers = bLogic.getAnswers(question); ...
5
public boolean Save() { String filename = m_fileTitle.getText(); //Stop saving if no filename is given. if (filename.isEmpty()) { JOptionPane.showMessageDialog(null, "No filename"); return false; } int width; int height; String str_width = m_chartWidth.getText().toString(); String str_h...
3
public void renderScreen() { if (buffer == null) { // create the buffer buffer = createImage(PWIDTH, PHEIGHT); dbg = buffer.getGraphics(); } // Render campus dbg.setColor(Color.LIGHT_GRAY); for (int i=0; i<TILESX; i++) for (int j=0; j<TILESY; j++) { if (tiles[i][j]!=null) dbg.drawImage...
8
public static Direction getPlayerDirection(int x, int y) { if (x != 0) { if (x > 0) { if (y > 0) { return Direction.DOWNRIGHT; } else if (y < 0) { return Direction.UPRIGHT; } else { return Dir...
9
public static void main(String[] args) throws Exception { String env = null; if (args != null && args.length > 0) { env = args[0]; } if (! "dev".equals(env)) if (! "prod".equals(env)) { System.out.println("Usage: $0 (dev|prod)\n"); ...
8
private boolean hasEveryIdentityDiscPositionOnlyOneIdentityDisc(Grid grid) { List<IdentityDisc> identityDiscs = getIdentityDiscsOfGrid(grid); for (IdentityDisc idDisc : identityDiscs) { final Position idDiscPos = grid.getElementPosition(idDisc); for (Element e : grid.getElementsOnPosition(idDiscPos)) ...
4
public void pack() { boolean isrunestone = cap.text.equals("Runestone"); Coord max = new Coord(0, 0); for (Widget wdg = child; wdg != null; wdg = wdg.next) { if ((wdg == cbtn) || (wdg == fbtn)) continue; if ((isrunestone) && (wdg instanceof Label)) { ...
7
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Requests)) { return false; } Requests other = (Requests) object; if ((this.id == null && other.id != null) || (...
5
public Date getFecha() { //no pongas mierda en mi codigo return fecha; }
0
public int getHeight() { return height; }
0
public Coord getMaxCoord(){ int max = 0; Coord res = new Coord(); for(int i = 0 ; i < taille ; i++){ for(int j = 0 ; j < taille ; j++){ if(getValue(i,j)> max){ max = getValue(i,j) ; res.x = i; res.y = j; ...
3
public void gameUpdated(GameUpdateType type) { // find our super parent frame -- needed for dialogs Component c = this; while (null != c.getParent()) c = c.getParent(); switch (type) { case ERROR: boardFrame.bp.repaint(); boardPanel.repaint(); controlPanel.play.setEnabled(false); controlPan...
8
static long LCA(int p, int q) { int tmp, log, i; // if p is situated on a higher level than q then we swap them if (L[p] < L[q]) { tmp = p; p = q; q = tmp; } // we compute the value of [log(L[p)] for (log = 1; 1 << log <= L[p]; log++) ; // ---- log--; long sum = 0; // we find the ancestor ...
8
public static void main(String[] args) { StudentList students = new StudentList(10000); //System.out.println(students); SeparateChainingHashST sc = new SeparateChainingHashST(97); for (int i = 0; i < 10000; i++) { sc.put(students.getList()[i].getLdap(), students.get...
1
private boolean r_postlude() { int among_var; int v_1; // repeat, line 75 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 75 ...
9
public void or(BitSet set) { if (this == set) return; int wordsInCommon = Math.min(wordsInUse, set.wordsInUse); if (wordsInUse < set.wordsInUse) { ensureCapacity(set.wordsInUse); wordsInUse = set.wordsInUse; } ...
4
public void simpan(Mahasiswa k) { try { Connection c = koneksi.connect(); long myId = 0; String sqlIdentifier = "select * from mahasiswa"; PreparedStatement pst = c.prepareStatement(sqlIdentifier); synchronized (this) { ResultSet rs = pst.executeQuery(); if (rs.next()) { myId = rs.getLong...
3
public void updateSocialVelocity() { for(int i = velocities.length / 2; i < velocities.length; i++){ for(int k = 0; k < velocities[i].length; k++){ int socialBest = neighbourhood.neighbourhoodBest(i); double normDevDist = calculateNormalisedDeviationDistance(k, positions[i][k], personalBest[socialBest]); ...
2
public Msg process(Msg msg) { System.out.println("MSG TYPE:"+msg.get_msg_tp()); Msg ret_msg = new Msg(); if (msg.get_msg_tp() == MESSAGE_TYPE.LOOKUP) { String name = msg.getObj_name(); // suppose the remote object is in the registry if (reg.get(name) != null) { ret_msg.setRemote_ref(re...
7
public void run() { mainFrame.lock(true); final String osMinecraftName = profile.getOs().getMinecraftName(); LogUtils.log(Level.INFO, Constants.PLAY_TASK_PREFIX + "Debug infos :"); LogUtils.log(Level.INFO, Constants.PLAY_TASK_PREFIX + "OS : " + profile.getOs().getName()); LogUtils.log(Level.INFO, Constants.P...
7
@Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLACK); g.fillRect(0, 0, this.getWidth(), this.getHeight()); g.setColor(Color.GREEN); ArrayList frame = synth.outputHistory; //we cannot use frame.size() here because it is ...
2
protected String getUrlForPath(final String path) { if (path.startsWith("http://") || (path.startsWith("https://"))) { return path; } else if (getHostname().startsWith("http://") || (getHostname().startsWith("https://"))) { return getHostname() + path; } e...
4
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!sender.hasPermission("under50.kick")) { sender.sendMessage(ChatColor.RED + "No access"); return true; } if (args.length < 1) { sender.sendMessage(...
5
@Override public void onNodeCreate(DataSourceEvent event) throws ResourceException { DataNode node = event.getNode(); DataNode parentNode = event.getParent(); if (node.getName().equals(ResourceDefinition.RESOURCE_TAG)) { String id = node.getAttribute(ResourceDefinition.ID); String parentId = parentNode.g...
4
private void readTableHeader() throws IOException { long columnCount = nraf.readUnsignedInt(); long l = 0; StringBuilder sb; Set<String> row = new LinkedHashSet<String>(); while(l < columnCount) { sb = new StringBuilder(); long charCount = nraf.readUnsignedInt(); long m = 0; while(m < ...
3
public int largestRectangleArea(int[] height) { Stack<Integer> stack = new Stack<Integer>(); int top ; int length = height.length; int max = 0; int i=0; while(i < length){ if(stack.empty() || height[stack.peek()] <= height[i]) stack.push(i++); ...
6
private static AckResponse generateResponse(Request req, String userID, String type, String groupID) { if (req instanceof ReadRequest) { Journal jurre = db.getJournal(req.getID(), userID, groupID, type); if (jurre == null) return new AckResponse(false, "\"acce...
9
private static void shuffle(int[] arr, Random gen) { for (int i = 0 ; i != arr.length ; ++i) { int j = gen.nextInt(arr.length - i) + i; int t = arr[i]; arr[i] = arr[j]; arr[j] = t; } }
1
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
@Override protected Object doGet(final String key) { Element element = null; try { element = cache.get(key); } catch (Throwable e) { CacheErrorHandler.handleError(e); } if (element != null) { return element.getObjectValue(); } else { return null; } }
2
private synchronized void doParse(String systemId, String publicId, Reader reader, InputStream stream, String encoding) throws java.lang.Exception { basePublicId = publicId; baseURI = systemId; baseReader = reader; baseInputStream = stream; initialize...
2
@Test public void depthest02opponent5() { for(int i = 0; i < BIG_INT; i++) { int numPlayers = 6; //assume/require > 1, < 7 Player[] playerList = new Player[numPlayers]; ArrayList<Color> factionList = Faction.allFactions(); playerList[0] = new Player(chooseFaction(factionList), new SimpleAI()); ...
5
private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) { int rounds, i, j; int cdata[] = (int[])bf_crypt_ciphertext.clone(); int clen = cdata.length; byte ret[]; if (log_rounds < 4 || log_rounds > 31) throw new IllegalArgumentException ("Bad number of rounds"); rounds = 1 << log_rounds; ...
7
public Timestamp getSumbitTime() { return this.sumbitTime; }
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==null) return false; if(target.fetchEffect(ID())!=null) { mob.tell(targ...
9
public static Car create(String className, Map<String, Object> content) throws Exception { Class<?> inputClass = Class.forName(className); Class<? extends Car> currentCarClass = inputClass.asSubclass(Car.class); Car car = currentCarClass.newInstance(); for (Entry<String, Object> entry : content.entrySet())...
5
public boolean addUnit(Unit u) { if (unit == null) { unit = u; //System.out.println("Unit added at: (" + x + ", " + y + ")"); return true; } return false; }
1
public OperationExpression simplify() { if (((PrimitiveOperator) op).isComplexIDOfLeft()) { return new UnaryOpExpression(new PrimitiveOperator(PrimitiveOperator.ID_OP), left); } if (((PrimitiveOperator) op).isComplexNotOfLeft()) { return new UnaryOpExpression(new PrimitiveOp...
4
public double[] processWindow(double[] window, int start) throws IllegalArgumentException { //number of unique coefficients, and the rest are symmetrically redundant int fftSize = (windowSize / 2) + 1; //check start if(start < 0) throw new IllegalArgumentException("start must be a positve value...
4
public static int findLIS(int size) { int[] dp = new int[size]; Arrays.fill(dp, 1); int ans = 1; for (int i = 0; i < dp.length; i++) for (int j = 0; j < i; j++) if (match(j, i) && dp[i] + 1 > dp[j]) dp[i] = Math.max(dp[i], dp[j] + 1); for (int i = 0; i < dp.length; i++) ans = Math.max(ans, d...
5
@SuppressWarnings("unchecked") @EventHandler public void onPlayerDeath(EntityDeathEvent e){ if(e instanceof PlayerDeathEvent){ if(this.plugin.getConfig().getBoolean("show_death") && !this.privatePlayers.contains(e.getEntity()) ){ JSONObject json = new JSONObject(); json.put("message",((PlayerDeathEvent) ...
3
private boolean registraUsuario(HttpServletRequest request, HttpServletResponse response) throws IOException { ConexionBD bd = new ConexionBD(); String categoria = request.getParameter("categoria"); String nombre = request.getParameter("nombre"); String login = request.getParameter("log...
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { ...
6