text
stringlengths
14
410k
label
int32
0
9
@Override public void draw(Graphics g) { if(Constants.getWidth() > viewport.getWidth()){ System.out.println("Updating viewport."); viewport = new Rectangle(0, 0, Constants.getWidth(), Constants.getHeight()); } g.setColor(Color.WHITE); /** * Draw the map. */ try{ ...
5
protected String GetPreferredLanguage(HttpServletRequest httpRequest, String parseLangQueryParams) { String preferredLang = null; // Attempt to detect a lang parameter in the referral URL preferredLang = InferLangFromReferralUrl(httpRequest, parseLangQueryParams); // If the cookie failed, ...
4
public void createGUI(Composite parent) { GridLayout gridLayout; GridData gridData; /*** Create principal GUI layout elements ***/ Composite displayArea = new Composite(parent, SWT.NONE); gridLayout = new GridLayout(); gridLayout.numColumns = 1; displayArea.setLayout(gridLayout); // Creating these e...
6
public void sigmoidThresholdFit(){ if(this.nAnalyteConcns<4)throw new IllegalArgumentException("Method sigmoidThresholdFit requres at least 4 data points; only " + this.nAnalyteConcns + " were supplied"); this.methodUsed = 5; this.sampleErrorFlag = true; this.titleOne = "Sigmoid threshol...
4
public String formatLegal_name(String value) { String[] delimiterlist = {" ", "-", "_", "'", "."}; String[] abbreviationlist = {"ag", "bvba", "cv", "cvba", "cvoa", "esv", "nv", "pvba", "vzw"}; boolean first = true; boolean afterdelimiter = false; int index = 0; String des...
9
public BrainPanel() { BoxLayout mainBoxLayout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(mainBoxLayout); TopPanel topPanel = new TopPanel(); add(topPanel); final QuestionPanel questionPanel = new QuestionPanel(); TimerButtonPanel timerButtonPanel = new Time...
0
@Override public void paint(Graphics2D g) { super.paint(g); Image image = new ImageIcon("resources/sprites/player1.png").getImage(); if (getFace() == 1) { image = new ImageIcon("resources/sprites/player1.png").getImage(); } if (getFace() == 2) { image = new ImageIcon("resources/sprites/player2...
8
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
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); String line = ""; while ((line = in.readLine()) != null && line.length() != 0) { tree = new Node(); int n = Integer.parseInt(line);...
3
public StaticHelloProxy(IHello hello) { this.hello = hello; }
0
public static int closestPoint() { Shapes.Point min = new Shapes.Point(Integer.MAX_VALUE, Integer.MAX_VALUE); int index = 0; for (Shapes.Point point : points) { if (point.getY() < min.getY()) { min = point; index = points.indexOf(point); } ...
4
@Override public void receiveOrder(OrderMessage message) throws RemoteException { LOGGER.debug(echoIndex() + "received order from " + message.getSender()); incomingMessages.put(message.getAlreadyProcessed(), message); sendAck(message); //valid for the exchange rounds starting from 2...
8
public ExceptionList() { exceptions = new ArrayList<Throwable>(); }
0
public static void save(Game g){ try { Connection conn = ConnectionHandler.getConnection(); Statement stmt=conn.createStatement(); DatabaseMetaData md = conn.getMetaData(); ResultSet rs = md.getTables(null, null, "PLAYERS", null); if(!rs.next()){ String create = "CREATE TABLE PL...
3
public static boolean DeleteSuffix(String hostname) { Read(hostname); List<String> todel = new ArrayList<String>();//list to delete for(String s : Suffixes) { String[] split = s.split(" "); if(split[0].equalsIgnoreCase(hostname)){ todel.add(s);...
4
@SuppressWarnings("unchecked") public final <ValueT> ValueT valueFor(Class<? extends Property<ValueT>> propertyT) { Property property = this.properties.get(propertyT); return property == null ? null : (ValueT)property.value(); }
2
@Override public boolean isDone(Game game) { boolean ended = super.isFinished(game); if(ended) return true; int countAcum = 0; if(itype1 != -1) countAcum += game.getNumSprites(itype1) - game.getNumDisabledSprites(itype1); if(itype2 != -1) countAcum += game....
9
public void visit_iaload(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
1
public void report(final String reportPath) throws IOException { //// Preconditions if (reportPath == null) throw new NullPointerException("reportPath must not be null"); if (reportPath.length() == 0) throw new IllegalArgumentException("reportPath must not be an empty string"); assert mos...
3
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub TuoteService palvelu = new TuoteService(); try { ArrayList <Tayte> taytteet = palvelu.haeTaytteet(); System.out.println(taytteet.toString()); request.se...
3
public static void main(String[] args){ PumpingLemma r; LanguageTester t = new LanguageTester(); String[] s; /* r = new ABnAk(); s = new String[] {"abababaa", "ababab", "ab", "ababac", "aba", "abc", "a", "b", ""}; t.test(r, s, 1); r = new AnBkCnk(); s = new String[] {"aabbcccc", "abbccc", "aabccc...
0
@Override public void applyStatus(GameObject holder) { for(SpriteGroup sg : myPlayField.getGroups()){ for(Sprite s : sg.getSprites()){ if(Math.abs(s.getX() - holder.getX()) <= myRange && Math.abs(s.getY() - holder.getY())<= myRange) { if(((GameObject) s).getType().equals("Enemy")){ Enemy enemy = (E...
8
public static Class<?> getClass(Object classLoaderObj, String path) throws ClassNotFoundException { if( THREAD ) { ClassLoader cl = null; if( classLoaderObj != null ) cl = classLoaderObj.getClass().getClassLoader(); if( cl == null ) return Thread.currentThread().getContextClassLoader().loadClass(path...
7
public boolean ResetPlayerVars() { teleportToX = 0; teleportToY = 0; heightLevel = 0; playerRights = 0; playerIsMember = 0; playerMessages = 0; playerLastConnect = ""; playerLastLogin = 20050101; playerEnergy = 0; playerEnergyGian = 0; playerFollowID = -1; playerGameTime = 0; playerGameCount =...
9
private ArrayList<Integer> processOpenings(ArrayList<Integer> openings) { int prev = openings.get(0); int current; boolean check = false; int counter=0; //tellen hoeveel openingen na elkaar komen ArrayList<Integer> ret = new ArrayList<Integer>(); for (int i = 1; i < openings.size(); i++) { current = open...
4
public void installAttributes(CellView view) { super.installAttributes(view); Map map = view.getAllAttributes(); shape = CellConstants.getVertexShape(view.getAllAttributes()); stretchImage = CellConstants.isStretchImage(map); // Adds the inset as an empty border to the existing border. int i = GraphConstan...
9
public void run() { try { ois = new ObjectInputStream(socket.getInputStream()); userInfo = (UserInfo)ois.readObject(); if(userInfo!=null){ System.out.println("Your name is : "+userInfo.getUserName()); writers.add(oo...
5
public void test_01() { String args[] = { "-classic", "-noOut", "testHg3766Chr1", "./tests/huge_deletion_DEL.vcf" }; SnpEff cmd = new SnpEff(args); SnpEffCmdEff cmdEff = (SnpEffCmdEff) cmd.snpEffCmd(); List<VcfEntry> vcfEntries = cmdEff.run(true); // Make sure these are "CHROMOSOME_LARGE_DELETION" type of ...
2
public boolean addNumberToBoard () { int row = 0, col = 0, counter = 0; Random randomGenerator = new Random(); /* Checks board size */ if (size.equals("9x9")) { /* uses a while loop to generate a random number and then an if statement to place a solution */ while (counter < 200) { row =...
7
public void annotation_process(){ if(this.q!=null && this.q.size()>0){ for(int i=0; i<this.q.size(); i++){ for(int j =0; j<this.q.get(i).v.size(); j++){ this.annotation_replace(this.q.get(i).v.get(j).name); //System.out.println("replace " + this.q.get(i).v.get(j).name + " with a_" + this.q.get(i).v.g...
8
private String[] _smsc_send_cmd(String cmd, String arg){ String[] m = {}; String ret = ","; try { String url = (SMSC_HTTPS ? "https" : "http") + "://smsc.ru/sys/" + cmd +".php?login=" + URLEncoder.encode(SMSC_LOGIN, SMSC_CHARSET) + "&psw=" + URLEncoder.encode(SMSC_PA...
7
public void doDelimitedWithPZMap() { try { final String mapping = ConsoleMenu.getString("Mapping ", DelimitedWithPZMap.getDefaultMapping()); final String data = ConsoleMenu.getString("Data ", DelimitedWithPZMap.getDefaultDataFile()); DelimitedWithPZMap.call(mapping, data); ...
1
public void pelaajaOnKoilisessa() { Pelaaja kiekollinen = getKiekollinen(); int pelaajiaSuunnassa = 0; for (Pelaaja pelaaja : pelaajat) { if (kiekollinen.getY() > pelaaja.getY() && pelaaja.getX() > kiekollinen.getX()) { int x = pelaaja.getX() - kiekollinen.getX(); ...
9
public <T> int sendData(T data, String typeURI) throws Exception { Gson gson = new Gson(); String json = gson.toJson(data); System.out.println(json); prepareConnection(); webResource = client.resource(address + "adminPanel/" + typeURI); ClientResponse response = webResource.type(MediaType.APPLICATION_JSO...
0
public String printXMLResults(boolean all) { StringBuffer sb = new StringBuffer(100); double singleMultiRatio = 0.0; sb.append("<?xml version=\"1.0\"?>"); sb.append("<bsbm>\n"); sb.append(" <querymix>\n"); sb.append(" <scalefactor>" + parameterPool.getScalefactor() + "</scalefactor>\n"); sb.appe...
6
public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); if (var2 != null && this.isWheat(var2) && this.getGrowingAge() == 0) { if (!par1EntityPlayer.capabilities.isCreativeMode) { --var2.s...
6
String headerGetToolTip (int x) { if (resizeColumn != null) return null; int orderedIndex = computeColumnIntersect (x, 0); if (orderedIndex == -1) return null; CTableColumn[] orderedColumns = getOrderedColumns (); CTableColumn column = orderedColumns [orderedIndex]; if (column.toolTipText == null) return null; ...
8
public final String getSalt() throws IllegalAccessException { StackTraceElement[] stacks = Thread.currentThread().getStackTrace(); try { StackTraceElement e = stacks[2]; //The heartbeat class will always be the 3rd in the stacktrace if the heartbeat is being sent correctly Class<?> class_ = Class.forName(e.ge...
6
public void actionPerformed(ActionEvent ev) { Object o = ev.getSource(); String font = fontComboModel.getSelectedItem().toString(); String fontSize = sizeSpin.getValue().toString(); String printOptions = " <PRINT FONTSIZE=\"" + fontSize + "pt\" FONTFACE=\"" + font + "\"/>\n"; if (o == prevButton) { File...
5
public BufferedImage toImage(ImageBean i) { BufferedImage image = new BufferedImage(i.getWidth(), i.getHeight(), 1); int[] pixels = i.getPixels(); for (int x = 0; x < image.getWidth(); x++) { for (int y = 0; y < image.getHeight(); y++) { int rgb = pixels[(x + y * image.getWidth())]; if (rgb == 0) { ...
3
public List<Basket> getALL() { List<Basket> baskets = null; try { beginTransaction(); baskets = session.createCriteria(Basket.class).list(); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } finally { closeSession(); } return baskets; }
1
public void saveAs() { if(_isOSX || ostype == ostype.Linux || ostype == ostype.Other) { saveAs_OSX_Nix(); saveFile(curFile); } else /* Windows */ { JFileChooser fc = new JFileChooser(); if(curFile != null) fc.set...
6
public static String getCellValueAsString(XSSFCell cell) { String strCellValue = null; if (cell != null) { switch (cell.getCellType()) { case XSSFCell.CELL_TYPE_STRING: strCellValue = cell.toString(); break; case XSSFCell.CELL_TYPE_NUMERIC: if (DateUtil.isCellDateFormatted(cell)) { SimpleD...
6
public boolean textAtContains(String locator, String verificationText) throws Exception { boolean isTextMatched = false; try { String temp = textAt(locator).toLowerCase(); if(temp.length() < 1) return isTextMatched; isTextMatched = temp.contains(verifi...
3
public void setCoordinates(LngLatAlt coordinates) { this.coordinates = coordinates; }
0
public String getTitle() { if (doc.title() != null) { return doc.title(); } else { return "RESERVE"; } }
1
public void render(Graphics g) { background.render(g); for (int i = 0; i < obstacles.size(); i++) { obstacles.get(i).render(g); } for (int i = 0; i < fruits.size(); i++) { if (fruits.get(i).spawned) { fruits.get(i).render(g); } } for (int i = 0; i < snakes.size(); i++) { if (snakes.get(i).de...
6
private String DDCRET_String(int retcode) { switch ( retcode ) { case DDC_SUCCESS: return "DDC_SUCCESS"; case DDC_FAILURE: return "DDC_FAILURE"; case DDC_OUT_OF_MEMORY: return "DDC_OUT_OF_MEMORY"; case DDC_FILE_ERROR: return "DDC_FILE_ERROR"; case DDC_INVALID_CALL:...
7
public Set<Literal> getOverlappedLiterals(Literal literal, ProvabilityLevel provability) { Set<Literal> relatedLiterals = getRelatedLiterals(literal, provability); if (null == relatedLiterals) return null; Set<Literal> extractedLiterals = new TreeSet<Literal>(); Temporal literalTemporal = literal.getTemporal()...
5
public boolean hasCard(int value, int suite) { ListIterator<Card> iterator = cardPile.listIterator(); while (iterator.hasNext()) { if (iterator.next().value == value && iterator.next().suite == suite) { return true; } } return false; }
3
public void setBlockTileEntity(int var1, int var2, int var3, TileEntity var4) { if (!var4.isInvalid()) { if (this.scanningTileEntities) { var4.xCoord = var1; var4.yCoord = var2; var4.zCoord = var3; this.addedTileEntityList.add(var4); ...
3
public boolean commitReservation(int reservId) { Reservation reservation = getReservation(reservId); if(reservation == null) { logger.info("Error commiting reservation, ID is invalid"); return false; } int resId = reservation.getResourceID(); try { ...
3
@Override public boolean setA(DenseMatrix64F A) { pinv.reshape(A.numCols,A.numRows,false); if( !svd.decompose(A) ) return false; DenseMatrix64F U_t = svd.getU(null,true); DenseMatrix64F V = svd.getV(null,false); double []S = svd.getSingularValues(); int ...
7
private void formUserOrderList(SessionRequestContent request) throws ServletLogicException { Criteria criteria = new Criteria(); User user = (User) request.getSessionAttribute(JSP_USER); if (user != null) { criteria.addParam(DAO_USER_LOGIN, user.getLogin()); criteria.addP...
3
Class14_Sub2(NativeOpenGlToolkit class377, int i, boolean bool, int[][] is) { super(class377, 34067, Class108.aClass304_1662, Class68.aClass68_1183, 6 * (i * i), bool); try { ((Class14) this).aClass377_5082.method3850((byte) -109, this); if (!bool) { for (int i_0_ = 0; i_0_ < 6; i_0_++) OpenG...
6
private void checkBossStatus() { if(Application.get().getLogic().getActor(bossID) == null) { // boss is dead! dead = true; } }
1
public void drawUnits(){ for ( int r = 0; r < GameConstants.WORLDSIZE; r++ ) { for ( int c = 0; c < GameConstants.WORLDSIZE; c++ ) { Unit u = game.getUnitAt(new Position(r,c)); if (u != null){ UnitFigure uf = new UnitFigure(u, ...
3
public void updateModes(String modes) { IRCModeParser parser = new IRCModeParser(modes); modes = ""; // reset modes, we will order them String args = ""; char operator; char mode; for (int i = 1; i <= parser.getCount(); i++) { operator = parser.getOperatorAt(i); mode = parser.getMode...
3
public void resizeMainMenu(double scaleFactorX, double scaleFactorY){ this.scaleFactorX=scaleFactorX; this.scaleFactorY=scaleFactorY; layers.setBounds(0, 0, (int)(scaleFactorX * (double)getWidth()), (int)(scaleFactorY * (double)getHeight())); systemScroll.setBounds((int)(scaleFactorX * (double) 110), (int)(scal...
2
public Bus [] getBusses () throws IOException { Bus value [] = host.getBusses (); Bus retval []; if (value.length == 0) return value; retval = new Bus [value.length]; for (int i = 0; i < retval.length; i++) retval [i] = get (value [i]); return retval; }
2
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (arg1.length != 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.join + " (channel)"); return; } String c...
6
public void handleIntersections() { if (armed) { triggered = false; for (Tank player : level.getPlayers()) { if (intersectsEntity(player)) { triggered = true; explode = true; } } } touchingGround = false; for (FloatingPoint point : hitbox) { if (level.getTerrain().hitTestpoint((int...
6
public static void start() { Setup.println("Router iniciado en " + Setup.address.getHostAddress() + ":" + Setup.ROUTING_PORT); server = new RoutingService(); new Thread(server).start(); }
0
private void initTablasCoches(){ tabCch = (DefaultTableModel) tablaCoches.getModel(); coches = taller.searchCoches(""); tabCch.setNumRows(coches.size()); for(int i=0; i<coches.size(); ++i){ tablaCoches.setValueAt(coches.get(i).getMatricula(), i, 0); ...
1
* @return boolean */ public static boolean constantP(Stella_Object objectref) { { Surrogate testValue000 = Stella_Object.safePrimaryType(objectref); if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_LITERAL_WRAPPER)) { { LiteralWrapper objectref000 = ((LiteralWrapper)(objectref)); ...
6
public boolean similar(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set<String> set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator<St...
9
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); Color color = (Color) value; setText(""); setBac...
0
public List<User> getAllUsers(String userEmail) { initConnection(); List<User> userList = new ArrayList<User>(); String preparedString = null; PreparedStatement preparedQuery = null; try { //Prepare Statement - Get all users except logged-in user preparedString = "SELECT * " + "FROM users...
3
public static ListNode deleteDuplicates(ListNode head) { if (null == head || null == head.next) return head; ListNode p = head.next; ListNode q = head; while (null != p) { if (p.val == q.val) { q.next = p.next; } else { q = q.next; } p = p.next; } return head; }
4
private Character getSquareChar(SquareType squareChar) { //SquareType squareChar = myBoard.getSquare(row, column); if (squareChar == null) { return '*'; } else { switch (squareChar) { //I, L , J, T, O, S, Z, EMPTY, OUTSIDE; case I: ...
9
@Override public boolean equals(Object object) { if(object == null || !(object instanceof LedShape)) return false; LedShape shape = (LedShape) object; if(x != shape.x || y != shape.y) return false; for(LedRow row1 : ledRows) for(LedRow row2 : shape.ledRows) if(!row1.equals(row2)) return...
7
public void checkParameter(String name, String email, String tel) { ParameterUtils.checkAllEmpty(email, tel); if (email != null) { ParameterUtils.checkEmail(email); } if (tel != null) { ParameterUtils.checkPhoneNum(tel); } int num = userInfoDao.getUserInfoNum(name, email, tel); if (nu...
3
protected void redirect(String url, HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { response.sendRedirect(url); }
0
public void insert(int pos, T obj) { if (count == arr.length) { // time to grow the array if (increment == 0) throw new UnsupportedOperationException(getClass().getName()+"/"+clss.getName()+" has max capacity="+arr.length); grow(increment); } if (pos == count) { // append at tail - checking for this...
8
public Rachel(String s, TileMap tm){ super(tm); this.tiley = tm; width = 44; height = 60; cwidth = 30; cheight = 44; moveSpeed = 0.6; maxSpeed = 2.0; stopSpeed = 0.4; facingRight = false; facingUp = true; facingDown = false; health = maxHealth = 2; ammunition = maxAmmuni...
7
@Override public void handleDrawing(List<Row> rows, ViewEventArgs args){ this.logicalDocument.draw(rows, args, this.index); this.updateLogicalLocations(args); if (this.selectionRange != null){ this.selectGlyphs(args); } if (this.spellCheckEnabled){ IVisitor visitor = new SpellingCheckingVisitor(this...
3
protected void L2RModelTraining() { //select the training pairs createTrainingCorpus(); if (m_ranker==0) { ArrayList<Feature[]> fvs = new ArrayList<Feature[]>(); ArrayList<Integer> labels = new ArrayList<Integer>(); for(_Query q:m_queries) q.extractPairs4RankSVM(fvs, labels); Model rankSVM ...
7
public static void main(String[] args) { // TODO Auto-generated method stub Scanner sIn = new Scanner(System.in); long N = sIn.nextLong(); if (N ==0){ System.out.println(10); return; } else if (N < 10) { System.out.println(N); return; } long result = 0; long cur = N; int power = 1; ...
6
public void setSignedInfo(SignedInfoType value) { this.signedInfo = value; }
0
@Override public Integer getIdFromDataBase() throws SQLException { if (name == null || name.isEmpty()) { return null; } else if (name2 == null || name2.isEmpty()){ return null; } else if (surname == null || surname.isEmpty()){ return null; } else i...
9
public Id3v2RawFrame(Property property, PropertyTree parent) { super(property, parent); }
0
public double[] train(List<Instance> trainingInstances, List<Instance> testingInstances) { int dimension = trainingInstances.get(0).getFeatures().length; int trainSize= trainingInstances.size(); int testSize = testingInstances.size(); double[] weight = new double[dimension]; boolean continueLoop = true; ...
7
public static void main(String[] args) throws IOException { /** * The file to be read */ String path; System.out.println("Please enter the path of the input file: "); path = TextIO.getlnString(); String fileName; System.out.println("Please enter the name of the input file: "); fileName = TextIO.g...
5
public boolean[] getTipo() { boolean tipo[] = new boolean[6]; if(this.jCheckBox1.isSelected()) tipo[0]=true; else tipo[0]=false; if(this.jCheckBox2.isSelected()) tipo[1]=true; else tipo[1]=false; if(this.jCheckBox3.isSe...
6
public void initialisationPorteeCases() { int x = this._parametre.getNbCaseX(); int y = this._parametre.getNbCaseY(); this.casesBateaux = new HashMap(); // Permet d'afficher les cases a portee de tir for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { ...
9
public void parseMultiple(){ String[][] inputs = myModel.getInputs(); int size = 1; if(environment.myObjects != null) size = environment.myObjects.size(); int uniqueInputs = inputs.length/size; Grammar currentGram = grammar; if(environment.myObjects != null) currentGram = (Grammar)environment.myObjects.get(...
5
public void setNumber(Integer number) { this.number = number; }
0
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
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //on verifie que l'utilisateur est connecté en temps que particulier if(request.getSession(false).getAttribute("connecte")==null ||request.getSes...
9
@SuppressWarnings("fallthrough") private void beforeValue(boolean root) throws IOException { switch (peek()) { case NONEMPTY_DOCUMENT: if (!lenient) { throw new IllegalStateException( "JSON must have only one top-level value."); } // fall-through case EMPTY_DOCUMENT: ...
8
@EventHandler public void EnderDragonBlindness(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getEnderDragonConfig().getDouble("En...
6
private void decodeMapEntry(String serviceName, OMMMapEntry mapEntry) { OMMFilterList serviceFilterList = (OMMFilterList)(mapEntry.getData()); for (Iterator<?> filter = serviceFilterList.iterator(); filter.hasNext();) { OMMFilterEntry serviceFilterEntry = (OMMFilterEntry)filter.n...
8
@SuppressWarnings({ "deprecation", "resource" }) private static void fixSkin(GameProfile profile, String skinOwner) { try { URL url = new URL("https://sessionserver.mojang.com/session/minecraft/profile/" + Bukkit.getOfflinePlayer(skinOwner).getUniqueId().toString().replace("-", "")); ...
4
@Override public String toString() { if(super.toString() == "HUMAN"){ return "H "; }else if(super.toString() == "ZOMBIE"){ return "Z "; }else{ return ". "; } }
2
public byte[] decompressFile(String name) { int hash = 0; name = name.toUpperCase(); for (int c = 0; c < name.length(); c++) hash = (hash * 61 + name.charAt(c)) - 32; for (int file = 0; file < fileCount; file++) if (hashes[file] == hash) { byte[] output = new byte[decompressedSizes[file]]; if (!d...
4
public boolean matchesAndPreservesGroupArtifactAndType(Dependency dependency) { if (!matches(dependency)) { return false; } Dependency transformed = apply(dependency); return transformed.getGroupId().equals(dependency.getGroupId()) && transformed.getArtifactId...
3
@Override public boolean isDeadlyOrMaliciousEffect(final PhysicalAgent P) { if(P==null) return false; if(flaggedBehaviors(P, Behavior.FLAG_POTENTIALLYAUTODEATHING).size()>0) return true; if(isTrapped(P)) return true; for(final Enumeration<Ability> a=P.effects();a.hasMoreElements();) { final Abil...
9
public boolean hasCycle(){ Hashtable<Vertex,Color> color=new Hashtable<Vertex,Color>(); LinkedList<Vertex> vertices=graph.getVertices(); Iterator<Vertex> i = new Iterator<Vertex>(vertices); while(i.hasNext()){ Vertex v = i.getNext(); color.put(v, Color.WHITE); ...
4
public ArrayList<String> restoreIpAddresses(String s) { ArrayList<String> rst = new ArrayList<String>(); if (s == null || s.length() < 4 || s.length() > 12) return rst; int[] buf = new int[4]; for (int i =1;i<4;i++) { int vl = -1; try { vl = Integer.valueO...
8
public void rescaleCenter(double minLevel, double maxLevel) { double maxImage = -Double.MAX_VALUE; double minImage = Double.MAX_VALUE; double[] slice; for(int z=0; z<nz; z++) { slice = (double[])data[z]; for(int k=0; k<nxy; k++) { if ((slice[k]) > maxImage) maxImage = slice[k]; if ((slice[k...
8