text
stringlengths
14
410k
label
int32
0
9
public void disconnected(Connection c) { Player buff = null; /* buscamos que el player se elimine de la lista de players del servidor */ for( Player p : GeoConflictServer.playerList ){ /* si no esta conectado sacamos una referencia a el */ if( !p.getConnection().isConnected() ){ buff = p; break; ...
8
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { if(mob.isInCombat()&&(mob.rangeToTarget()>0)) return Ability.QUALITY_INDIFFERENT; if(!Druid_ShapeShift.isShapeShifted(mob)) return Ability.QUALITY_INDIFFERENT; if(mob.charStats().getBodyPart(Race.BODY_LEG)<=0) ...
7
public CurrentQuest(UQuest plugin, LoadedQuest theQuest, int level) { this.name = theQuest.getName(); this.startInfo = theQuest.getStartInfo(); this.finishInfo = theQuest.getFinishInfo(); for(Reward reward : theQuest.getRewards()){ this.rewards.add(new Reward(reward)); } for(Objective objective : theQues...
2
public void addLink(GraphNode destiny, int weight) { //adds the link with the param destiny and its weight or price. if (actual_links == -1) {//if there are not links. links.append(new Link(this, destiny, weight));//creates new link and adds it to the list of links of this node. actual_l...
2
public int GetTime() { return time; }
0
public void compareRoomInventoryItems() { int ArrayListID = 0; if(player.getInventorySize() > 0) { for (Iterator it = rooms.get(player.getCurrentRoomID()).getItems().iterator(); it.hasNext();) { Item roomItem = (Item) it.next(); ...
4
private Student statsLE(Student s) { double creditsSci = 0.0; double creditsUpper = 0.0; double credits_NonCSEMath = 0.0; ArrayList<Course> courses = s.getCourses(); for (Course course : courses) { String grade = course.getGrade(); if (YORK_GRADES.contai...
9
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (commandLabel.equalsIgnoreCase("mcrp")) { if (args.length == 0) { commands.get(2).run(sender, args); return true; } if (args.length >= 1) { ...
9
private String getScoreList(int position) throws Finished { StatisticsInterface stats = d.getUIData().getStats(); int c = stats.getCurrentRoundNo(); if (position + 1 > c) { throw new Finished(); } else if (c > MAX_SCORE_LINES) { c = c - MAX_SCORE_LINES + position ...
6
public CodeEditor(){ JMenu jMenu1 = new JMenu("File"); jMenu1.add(jmiOpen); jMenu1.add(jmiSave); jMenu1.add(jmiClear); jMenu1.addSeparator(); jMenu1.add(jmiExit); JMenu jMenu2 = new JMenu("Edit"); jMenu2.add(jmiBackground); jMenu2.add(jmiForeground); jMenu2.add(jmiCaret); JMenuBar jMenuBar1 ...
3
public JTextField getjTextFieldNum() { return jTextFieldNum; }
0
public void paintSillasArriba(Graphics g) { //Color c = new Color(6, 100, 6, 100); //g.setColor(c); //g.fillRect(getPosX() - 25, getPosY() - 30, getAncho() + 50, getAlto() + 40); if (tipo == 2) { paintMonitoArriba(g); } else if (tipo == 1 || tipo == 3 || tipo == 4 || ...
9
@Override public void serialize(Buffer buf) { buf.writeInt(mapId); buf.writeUShort(npcsIdsWithQuest.length); for (int entry : npcsIdsWithQuest) { buf.writeInt(entry); } buf.writeUShort(questFlags.length); for (GameRolePlayNpcQuestFlag entry : questFlags) {...
3
public List<Entry> searchEntries(String searchItem, List<Entry> journal) { List<Entry> includedEntries = new ArrayList<Entry>(); for (Entry entrie : journal) { if (searchItem.matches("\\d{4}-\\d{1,2}-\\d{1,2}")) { if (searchItem.equals(entrie.getDate().stringDate())) { ...
8
public MenuConsulter() { initComponents(); if (MainProjet.lesOffres.size() != 0){ OffreStage OS = MainProjet.lesOffres.get(0); jTextNom.setText(OS.getEntreprise().getNom()); jTextVilleStage.setText(OS.getEntreprise().getAd...
1
* integer. */ public static float floor_f(final float a) { // Derived from StrictMath.floor(double): // Inline call to Math.getExponent(a) to // compute only once Float.floatToRawIntBits(a) final int doppel = Float.floatToRawIntBits(a); final int exponent = ((doppel & ...
7
protected Module addAnnotation(String name, Map env) throws SignatureException { if (modName.op == ModuleName.ANNOTATE) { return (Module)this.clone(); } Module result = new Module(type, modName.addAnnotation(name)); // clone module parts result.protectImportList = (ArrayList)(protectImportList.clon...
9
public static void main(String[] args) { ArrayToolBox tool = new ArrayToolBox(); int[] A = {1,4,72,65,23,17,57,94,54,10,100,3,22,1001,34,8}; boolean flag = tool.search(A,3,0); boolean flag2 = tool.searchRecurse(A,1001,0); if(flag) System.out.println(3+ " was found!...
3
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (hashCode() == o.hashCode()) return true; InhabitedPlanet that = (InhabitedPlanet) o; if (population != that.population) return false; ...
7
private ScriptRunner(CommandLineWrapper pCommandLineWrapper) { mCommandLineWrapper = pCommandLineWrapper; String lSourceLocation = mCommandLineWrapper.getOption(CommandLineOption.RUN); //Validate source location is not null if(XFUtil.isNull(lSourceLocation)){ throw new ExFatalError("-" +...
5
public String toString() { if (m_weights == null) { return "SPegasos: No model built yet.\n"; } StringBuffer buff = new StringBuffer(); buff.append("Loss function: "); if (m_loss == HINGE) { buff.append("Hinge loss (SVM)\n\n"); } else { buff.append("Log loss (logistic regressio...
7
public static boolean entreDate(Calendar ajdh, Calendar dateDebut, Calendar dateFin) { return ajdh.equals(dateDebut) || ajdh.equals(dateFin) || (ajdh.after(dateDebut) && ajdh.before(dateFin)); }
3
public void receive(){ boolean tcpComplete = false; ArrayList<byte[]> fileParts = new ArrayList<byte[]>(); byte responseBuffer[]; DatagramPacket responsePacket; Packet responsePacketData; int currentSequenceNumber = 1; try { if(logFileName.equals("stdout")){ this.logger = new PrintWriter(System....
8
public static void main(String[] args) throws Exception { FileReader fr = new FileReader("src\\ioTest\\FileReader1.java"); BufferedReader br = new BufferedReader(fr); String str; while(null != (str = br.readLine())) { System.out.println(str); } br.close(); }
1
private int findNombreSousClasse(Model m, String c) { for(Generalization g : m.getGeneralization()){ if(g.getIdentifier().equals(c)){ for(String sousclasse : g.getArrayIdent()){ return findNombreSousClasse(m, sousclasse) + 1; } } } return 1; }
3
static boolean buildTree() { double min1, min2; int i, j, minat1, minat2; HuffmanNode[] work = new HuffmanNode[256]; HuffmanNode tmp = new HuffmanNode(); for(i = 0;i < 256;i++) { work[i] = myWork[i]; work[i].val = (char) i; work[i].freq = freq[i]; work[i].zero = null; work[i].one = null; ...
8
public int maxSubArray(int[] A) { if(A.length == 0) return 0; int max = A[0]; int cur = A[0]; for(int i = 1; i< A.length;i++){ cur = Math.max(cur + A[i],A[i]); // 如果 cur + A[i] < A[i]的时候,表示cur 为负数,负数不可能是最大值的前缀。 max = Math.max(cur,max); } ...
2
public CloseView() { setTitle("Algorithme Close"); setLocation(150, 250); setSize(1000, 290); setDefaultCloseOperation(EXIT_ON_CLOSE); //Création des éléments pour importer un fichier tfParcourir = new JTextField(20); btParcourir = new JButton("Parcourir"); ...
6
public void onInvite(String targetNick, String sourceNick, String sourceLogin, String sourceHostname, String channel) { if (targetNick.equalsIgnoreCase(getNick())) { if (sourceNick.equalsIgnoreCase("ChanServ")) { channel = channel.replace("ChanServ!ChanServ@Services.GameSurge.net INV...
4
@Override public void run() { startFood(); while(true){ moreFood(); envi.repaint(); if(envi.getCritters().size() == 0){ break; } try { Thread.sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
3
private void writeMethods(final DataOutputStream out, final Set onlyMethods) throws IOException { if (onlyMethods != null) { out.writeShort(onlyMethods.size()); } else { if (Method.DEBUG) { System.out.println("Writing " + methods.length + " methods"); } out.writeShort(methods.length); } for...
5
public boolean checkPassword(int accountId, String checkPass) { String realPass = ""; PasswordType type = PasswordType.DEFAULT; Connection conn = plugin.getDbCtrl().getConnection(); PreparedStatement ps = null; ResultSet rs = null; try { String sql = String.format("SELECT `password`, `pwtype` FROM `%s`...
8
void initializeSortState (final Tree tree) { /* Reset to known state: 'down' on column 0. */ tree.setSortDirection (SWT.DOWN); TreeColumn [] columns = tree.getColumns(); for (int i = 0; i < columns.length; i++) { TreeColumn column = columns[i]; if (i == 0) tree.setSortColumn(column); SelectionListener ...
5
private void beforeCall(String command) { if (remoteClientCall == null) { throw new IllegalStateException("RemoteClientConnection is not initial."); } if (command == null) { throw new IllegalArgumentException("aMethodName is null"); } }
2
@Override public int classDurationModifier(MOB myChar, Ability skill, int duration) { if(myChar==null) return duration; if((((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_CRAFTINGSKILL) ||((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_BUILDINGSKILL))...
9
@RequestMapping(value="/{tripID}/editTravelTripForm", method=RequestMethod.GET) public String ediTravelTripForm(@PathVariable("tripID") String tripID, Model model){ TravelTrip tempTravelTrip = travelTripService.findById(Integer.parseInt(tripID)); if(tempTravelTrip == null){ ...
1
public static BigInteger sqrtMod(BigInteger val, BigInteger modulus) { BigInteger b, x, y, exp, exp2; BigInteger[] lm; int i, n; int K[] = new int[300]; val = val.mod(modulus); if (val.equals(ZERO)) return ZERO; if (modulus.equals(TWO)) return ONE; do { b = randomBetwe...
5
private void appendDecimalSeparator(String str) { switch (StringUtils.countMatches(str, ".")) { case 0: return; case 1: if (!ds) { ds = true; return; } } throw new IllegalArgumentExcep...
3
private void statement() throws Exception { if(scan.sym == Token.let) { scan.next(); assignment_rest(); } else if(scan.sym == Token.call) { scan.next(); funcCall_rest(); } else if(scan.sym == Token.if_t) { scan.next(); i...
5
private boolean isPrime(Integer number) { if ( (number > 2 && number % 2 == 0) || number < 2) { return false; } for (long i = 3; i <= Math.sqrt(number); i += 2) { if (number % i == 0) { return false; } } return true; }
5
private double medianOfFour(ArrayList<double[]> puntos, int axis, int start){ if(puntos.get(start)[axis]>puntos.get(start+1)[axis]) swap(puntos,start,start+1); if(puntos.get(start+2)[axis]>puntos.get(start+3)[axis]) swap(puntos,start+2,start+3); if(puntos.get(start)[axis]>puntos.get(start+2)[axis])...
4
public static String largestNumber(int[] nums) { StringBuffer sb = new StringBuffer(); qsort(nums); int i = 0; for (i = 0; i < nums.length; i++) { if (nums[i] != 0) break; } for (; i < nums.length; i++) { sb.append(nums[i]); } String res = sb.toString(); return (res == nu...
5
private void processPatBlt(RdpPacket_Localised data, PatBltOrder patblt, int present, boolean delta) { if ((present & 0x01) != 0) patblt.setX(setCoordinate(data, patblt.getX(), delta)); if ((present & 0x02) != 0) patblt.setY(setCoordinate(data, patblt.getY(), delta)); if ((present & 0x04) != 0) patblt...
7
public void split(Component newComp, Component child, DockingConstants.Split position) { SplitContainer split; if(position == DockingConstants.SPLIT_TOP || position == DockingConstants.SPLIT_BOTTOM) { split = new SplitContainer(JSplitPane.VERTICAL_SPLIT); } else /*if (position == DockingConstants.SPLIT_LEFT ...
7
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
9
public boolean isInverted() { return inverted; }
0
public Boolean matchNameExists(String hostName){ try { cs = con.prepareCall("{call GET_MATCHNAME(?)}"); cs.setString(1, hostName); if(!cs.executeQuery().next()){ return false; } } catch (SQLException e) { e.printStackTrace(); } return true; }
2
protected void buildWhirl() { int[] curXY=new int[]{xsize-1,0}; int dirs[]=new int[]{Directions.WEST,Directions.SOUTH,Directions.EAST,Directions.NORTH}; int num=xsize-1; Room lastRoom=null; while(num>0) { for(int dir : dirs) { for(int i=0;i<num;i++) { if(!linkRoomOpen(curXY,dir)) { ...
7
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) { if (disableValidation) { return true; } if (par5 == 0) { return false; } else if (par5 == 1) { return false; } ...
8
private void updateCritereList(boolean selectEnd) { critereList.setModel(new CritereListModel(domaine.getCriteres())); try { critereList.setSelectedIndex((selectEnd)?critereList.getModel().getSize()-1:0); } catch (IllegalArgumentException e) { System.err.println("Erreur lors du chargement des critères, sans...
2
private int getPing(Player player) { try { Class<?> entityCraftPlayer = Class.forName(plugin.craftBukkitClassName.concat(".entity.CraftPlayer")); Method getHandle = entityCraftPlayer.getMethod("getHandle", new Class[0]); Object playerHandle = getHandle.invoke(player); Object craftPlayer = craftBukk...
6
@Override public double playLevel(Map toPlay, boolean visuals) { int w = toPlay.getWidthInTiles(); int h = toPlay.getHeightInTiles(); int noSolid = 0; for (int x = 0; x < w; x++) for (int y = 0; y < h; y++) noSolid += toPlay.blocked(null, x, y) ? 1 : 0; double solidRatio = (double) noSolid / (double) ...
3
public PlayerSettings(Game game, boolean isOthello) { boolean test = false; if (test || m_test) { System.out.println("PlayerSettings :: PlayerSettings() BEGIN"); } ISOTHELLO = isOthello; if (isOthello) { PLAYERCOLOUR_A1 = new JRadioButton("Black"); PLAYERCOLOUR_B1 = new JRadioButto...
5
//@Test(expected=ReaderException.class) public void testReadCastFail() throws ReaderException { ConfigurationManager.init("src/test/resources/test.json"); // Cast exceptions expected ConfigurationManager.read.getIntegerItem("test", "double"); }
0
@Override public String getTmp() {return String.valueOf(tmp);}
0
private static PixImage array2PixImage(int[][] pixels) { int width = pixels.length; int height = pixels[0].length; PixImage image = new PixImage(width, height); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { image.setPixel(x, y, (short) pixels[x][y], (short) pixels[x][y], (sh...
2
public static boolean isValidBST(TreeNode root) { if (root == null) { return true; } TreeNode nodeL = root.left; TreeNode nodeR = root.right; if (nodeL != null) { if (nodeL.val >= root.val) return false; else { if (!isValidBSTHelper(nodeL, root, true)) return false; } } if (nodeR ...
7
public void earnBonus() { int bonus = numGen.nextInt(100)+101; this.setTotal(this.getTotal()+bonus); }
0
public void compFinalResult() { do { iStage++; compAllocation(); if (compDistribution()) { /* deadline can not be satisfied */ if (!bDeadline) { System.out.println("THE DEADLINE CAN NOT BE SATISFIED!"); return; } else { System.out.println("\nNEW ROUND WITHOUT CHECKING:"); dEv...
7
private void Upload(ByteBuffer packet) throws RuntimeException, IOException{ // given packet w/no header! // (for uploading request c->s) [header | filesize(8) | filename(?)] // (for upload acknowledgement s->c) [header | already exists (1) | file id (4)] // parse the req if (packet.capacity() < 4) thro...
9
public File getRessourceFile(int id) { String req; Statement st = null; ResultSet result; File f = null; try { req = "SELECT * FROM t_medias WHERE id='"+id+"'"; st = cnx(); if(st == null) return null; result = st.executeQuery(req); if(result.last() && result.getRow() == 1) ...
5
public void setOptions(String[] options) throws Exception { String tmpStr; super.setOptions(options); tmpStr = Utils.getOption('N', options); if (tmpStr.length() != 0) setNumInstances(Integer.parseInt(tmpStr)); else setNumInstances(20); tmpStr = Utils.getOption("n...
9
@Override public double[] updatePlanes(ArrayList<Plane> planes, int round, double[] bearings) { // if any plane is in the air, then just keep things as-is for (Plane p : planes) { if (p.getBearing() != -1 && p.getBearing() != -2) return bearings; } // if no plane is in the air, find the one with th...
7
public static void main(String[] args) throws IOException { File activeUsersFile = new File("activeUser.txt"); if (!activeUsersFile.exists()) { throw new IOException("Active users file does not Exists!!"); } String outDIr = "./Users-trimmed/"; if (!new File(outDIr).exists()) { new File(outDIr).mkdir(); ...
2
public long nextLong() throws IOException { int p = peeked; if (p == PEEKED_NONE) { p = doPeek(); } if (p == PEEKED_LONG) { peeked = PEEKED_NONE; return peekedLong; } if (p == PEEKED_NUMBER) { peekedString = new String(buffer, pos, peekedNumberLength); pos += peek...
8
private void preCalculateHeuristics() { heuristics = new double[adjacency.length]; for (int i = 0; i < heuristics.length; i++) { double minimum = Double.MAX_VALUE; for (int j = 0; j < adjacency[i].length; j++) { if (i != j && adjacency[i][j] >= 0 && adjacency[i][j] < minimum) { minimum = adjacency[i]...
5
public void destroy() { if (homeAction == null) return; // already destroyed if (Modeler.isMac()) { enabledComponentsWhenRemote.clear(); enabledComponentsWhenLocal.clear(); } actionMap.clear(); deadLinks.clear(); popupMenu.destroy(); PopupMenuListener[] pml = comboBox.getPopupMenuListeners(); i...
8
private CFGResult ifStatement(Block lastBlock) throws IOException, SyntaxFormatException { if (checkCurrentType(TokenType.IF)) { moveToNextToken(); ArithmeticResult cond = relation(lastBlock); if (cond == null) { throwFormatException("if statement relation expression expected"); } assertAndMoveNext...
5
@Override public DataTable generateDataTable (Query query, HttpServletRequest request) throws DataSourceException { DataTable dataTable = null; try (final Reader reader = new FilterCsv (new BufferedReader (new InputStreamReader (new URL (this.urlYahoo).openStream())))) { TableRow row = new TableRow (); ...
7
public static final synchronized StdImage createFadedImage(StdImage image, int percentage, boolean useWhite) { String name = REVERSE_MAP.get(image); StdImage img = null; if (name != null) { name = name + percentage + useWhite + FADED_POSTFIX; img = get(name); } if (img == null) { img = FadeFilter.cre...
4
private boolean checkAndSaveGroup() { boolean check = true; String error = ""; if(txtName.getText().length() < 1) { lblName.setForeground(Color.RED); error += " - Name \n"; check = false; }else lblName.setForeground(Color.BLACK); if(txtCapacity.getText().length() < 1) { lblCapacity.setForegro...
4
@Override public boolean isManagingFocus() {return true;}
0
private static void setField(Message msg, String str) { String[] strs = str.split(":"); strs[1] = strs[1].trim(); if(strs[0].equals("Host")) { msg.setHost(strs[1]); } else if(strs[0].equals("Port")) { msg.setPort( Integer.valueOf(strs[1]) ); } else if(strs[0].equals("Title")) { msg.setTitle(strs[1])...
8
@Override public boolean equals(Object obj) { if(this == obj) return true; if(obj == null) return false; if(getClass() != obj.getClass()) return false; Semaphore other = (Semaphore) obj; if(id == null) { if(other.id != null) return false; } else { if(!id.equals(other.id)) ...
6
public void setMaxLength(Long value) { this.maxLength = value; }
0
public static boolean run(CommandSender sender, boolean isPlayer, String[] args, Logger log) { if (!isPlayer){sender.sendMessage(notPlayer);return false;} if (args.length < 1) {sender.sendMessage(ChatColor.RED+"Needs a World argument");return false;} Player p = (Player)sender; Location to = p.getLocation(...
5
static final void setHslTable() { anInt6112++; if (Class126.hslColorTable == null) Class126.hslColorTable = new int[65536]; else return; double d = 0.7 + (0.03 * Math.random() - 0.015); int i_5_ = 0; for (int i_6_ = 0; (i_6_ ^ 0xffffffff) > -513; i_6_++) { float f = (((float) (i_6_ >> -1851515709)...
9
public SingleTreeNode expand() { int bestAction = 0; double bestValue = -1; for (int i = 0; i < children.length; i++) { double x = m_rnd.nextDouble(); if (x > bestValue && children[i] == null) { bestAction = i; bestValue = x; ...
3
private void openFile(int fileIndex){ if(quick_launch_files[fileIndex].canExecute()){ try { System.out.println("Attempting to open: "+quick_launch_files[fileIndex].getAbsolutePath()); Desktop.getDesktop().open( quick_launch_files[fileIndex] ); } catch (IOException e) { e.printStackTrace(); } } ...
2
private void actionAdd( ) { DefaultMutableTreeNode selNd = getSelectedNode(); if ( selNd == null ) { audioVectors.add(new LinkedList<double[]>()); DefaultMutableTreeNode newNd = new DefaultMutableTreeNode("Collection"); dataRootNd.add(newNd); dataTr.scrollPathToVisible(new TreePath(newNd.getPath())); dataT...
4
private String getTripleListFromTripleVector( Vector<Vector<String>> tripleVector ) {String tripleList="<triple_list>"; for(int i=0; i< tripleVector.size() ;i++) {String s=tripleVector.elementAt(i).elementAt(0); String p=tripleVector.elementAt(i).elementAt(1); String o=tripleVector.elementAt(i).elementAt(2); Str...
6
public void run() { MensajeServidor("Procesando conexion"); try { //Entrada es el input del cliente, es decir la request en su respectivo formato. BufferedReader entrada = new BufferedReader(new InputStreamReader(cliente.getInputStream())); //Salida es para enviar la response. sali...
9
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
7
public void init(String className) { imports = new TreeMap(comparator); /* java.lang is always imported */ imports.put("java.lang.*", new Integer(Integer.MAX_VALUE)); int pkgdelim = className.lastIndexOf('.'); pkg = (pkgdelim == -1) ? "" : className.substring(0, pkgdelim); this.className = (pkgdelim == -1)...
2
@Override public Answer getAnswer(String gameid, Combination<Colors> combi) { HttpGet request; try { request = new HttpGet(new URI("http", null, SERVER, PORT, TRY_URL, String.format("gameid=%s&combi=%s", gameid, combi.toString()), null)); } catch (URISyntaxException e) { throw new Ru...
4
public returnTypes deleteChunk(byte[] fileID, int chunkNo) { String recID = Packet.bytesToHex(fileID); for(BackupChunk chunk : backedUpChunks) { String comID = Packet.bytesToHex(chunk.getFileID()); if(comID.equals(recID) && chunk.getChunkNo() == chunkNo) { String filepath = "storage/"; filepath += chu...
5
private void encodePositions(int number,int posS,int posE,int[] encoding) { String bin = Integer.toBinaryString(number); System.out.println("In encodePositions "+bin); System.out.println("start"+posE); while(bin.length()<=posE-posS) { bin = 0+bin; } ...
2
private static void compareListToMvd( byte[] list, MVD mvd ) throws MVDTestException { String response = new String( list ); String[] parts = response.split("\n"); if ( parts.length==0 ||parts[0].indexOf('\t')!=-1 ) throw new MVDTestException("Invalid list versions header"); for ( int i=1;...
3
public void testPlus_Days() { Days test2 = Days.days(2); Days test3 = Days.days(3); Days result = test2.plus(test3); assertEquals(2, test2.getDays()); assertEquals(3, test3.getDays()); assertEquals(5, result.getDays()); assertEquals(1, Days.ONE.plus(Days....
1
public static void defineFloors(int level){ if (level == 1){ createFloor(0, 600, 800, level); createFloor(700, 475, 800, level); createFloor(1650, 500, 500, level); createFloor(2300, 650, 1000, level); createFloor(3400, 500, 600, level); createFloor(4050, 600, 900, level); levelEnd = new Rectangl...
1
public static String getCState(char c, HTTPRequest httpReq) { boolean changes = false; final CharState adjCState=(CharState)CMClass.getCommon("DefaultCharState"); adjCState.setAllValues(0); if(httpReq.isUrlParameter(c+"CSTATE1")) { int num=1; String behav=httpReq.getUrlParameter(c+"CSTATE"+num); whi...
7
@Override public void deserialize(Buffer buf) { short flag1 = buf.readUByte(); isOnSale = BooleanByteWrapper.getFlag(flag1, 0); isSaleLocked = BooleanByteWrapper.getFlag(flag1, 1); houseId = buf.readInt(); if (houseId < 0) throw new RuntimeException("Forbidden val...
3
public ClassBuilder method( MethodBuilder methodBuilder ) { if ( methodBuilder == null ) { return this ; } MethodMetadata metadata = methodBuilder.build() ; for ( MethodMetadataBuilder method : builder.getDeclaredMethods() ) { if ( metadata.getMethodName().equals( method.getMethodName())) return th...
3
@Override protected Void doInBackground() throws Exception { // Convert known data text files to treeset dictionaries // (because String.hashCode() is really slow) dictionaries = new ArrayList<>(); if (fields != null && !fields.isEmpty()) { ...
5
public void actionPerformed(ActionEvent e){ if(e.getSource() == midiMuteButton){ // test case if(Debug.sound)System.out.println("Mute Button Pressed"); if(isMidiMute() == false){ midiMuteButton.setIcon(new ImageIcon("icons/grey/Midi off.png")); SlideRenderer.muteBackground(); setMidiMute(true);...
8
public boolean isSameTree(TreeNode p, TreeNode q) { if (p == null && q == null) return true; if (p == null && q != null) return false; if (p != null && q == null) return false; if (p.val != q.val) return false; return isSameTree(p....
8
public int size() { return N; }
0
private void checkAnswer(){ if(tabIndex == 0){//Tab <code> TAB_MAIN </code> is chosen if(index == -1){ index++; setQuestion(); } String trueAnswer = words.get(index).getEWord().toLowerCase().trim(); String thisAnswer = answer.getTe...
8
public static MapleReactorStats getReactor(int rid) { MapleReactorStats stats = reactorStats.get(Integer.valueOf(rid)); if (stats == null) { int infoId = rid; MapleData reactorData = data.getData(StringUtil.getLeftPaddedStr(Integer.toString(infoId) + ".img", '0', 11)); MapleData link = reactorData.getChild...
8
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; cas...
6