text
stringlengths
14
410k
label
int32
0
9
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof Room) { Room room = (Room)obj; if (this.id != room.id) { if (this.id == null || !this.id.equals(room.id)) { return fals...
5
public List<String> getProductNames(String proMgrName){ PreparedStatement stmt = null; ResultSet rs = null; List<String> proNames=null; try { stmt = conn .prepareStatement("select proName from ProductInfo where productManager = ? "); stmt.setString(1, proMgrName); rs = stmt.executeQuer...
4
@Override public void actionPerformed(ActionEvent e) { if(e.getSource()== this.botaoImprimir){ ArrayList<Reputacao> reputacoes = agente.getTodasReputacoes(); System.out.println("****************************"); System.out.println("Imprimindo todas as reputacoes"); System.out.println("*********************...
3
public void create(Bitacora bitacora) throws PreexistingEntityException, RollbackFailureException, Exception { if (bitacora.getId() == null) { bitacora.setId(new BitacoraId()); } EntityManager em = null; try { utx.begin(); em = getEntityManager(); ...
5
public boolean getReceiveDateByBookID(IssueBookVO issueBookVO) throws LibraryManagementException { boolean returnValue = true; ConnectionFactory connectionFactory = new ConnectionFactory(); Connection connection; try { connection = connectionFactory.getConnection(); } catch (LibraryManagementException ...
5
private static void setDefaults() { // variables that always must be set if ( encoding == null ) encoding = Charset.defaultCharset().name(); if ( groupName == null ) groupName = "top level"; if ( longName == null ) longName = "version "+Short.toString(version); if ( shortName == null ) shortName ...
7
public void laggTillFramfor (Punkt hornet, String hornNamn) { Punkt[] h = new Punkt[this.horn.length + 1]; int pos = 0; for (int i = 0; i < this.horn.length; i++){ h[i] = this.horn[i]; if(hornNamn == this.horn[i].getNamn()){ pos = i; h[pos] = hornet; } } for(int i = pos + 1; i < this.h...
3
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); ...
6
static int DFS(int r, int c, int t) { int s = side(r, c); for (int[] d : dir) if (inside(r + d[0], c + d[1]) && v[r + d[0]][c + d[1]] != t && on[r + d[0]][c + d[1]]) { v[r + d[0]][c + d[1]] = t; s |= DFS(r + d[0], c + d[1], t); } return s; }
4
public void insertarEnMedio( E pData, Nodo<E> pNodoPrevio){ if (pNodoPrevio == cabeza){ this.insertar(pData); return; } Nodo<E> nuevoNodo = new Nodo<>(pData); Nodo<E> nodoTmp = pNodoPrevio.getSiguiente(); pNodoPrevio.siguiente = nuevoNodo; ...
1
public static void main(String[] args) { String line = ""; String message = ""; int c; try { while ((c = System.in.read()) >= 0) { switch (c) { case '\n': if (line.equals("go")) { PlanetWars pw = new PlanetWars(message); DoTurn(pw); pw.FinishTurn(); message = ""; } e...
4
public static boolean search2DMatrix(int[][] matrix, int target) { int start = 0; int end = matrix.length-1; int row=0; while(start<=end) { int midrow = (start + end)/2; if(target<matrix[midrow][0]) { end = midrow-1; }else if(target>=ma...
8
private StartupContainer(final String[] args) { boolean disableGUI = false; for (final String param : args) { if ((param != null) && param.equals(stone.Main.NO_GUI_ID)) { disableGUI = true; } } this.io = new IOHandler(disableGUI ? null : Main.TOOLNAME); boolean jar_ = false; Path workingDirectory_...
6
private String findCommonPrefix(String common, String str) { if (common.length() == 0 || str.length() == 0) return ""; int i = 0; while (i < common.length() && i < str.length() && common.charAt(i) == str.charAt(i)) { i++; } if (i == 0) return ""; return common...
6
public static void copyRecursively(File src, File dest) throws IOException { Assert.isTrue(src != null && (src.isDirectory() || src.isFile()), "Source File must denote a directory or file"); Assert.notNull(dest, "Destination File must not be null"); doCopyRecursively(src, dest); }
2
private void interpolateBones(SpriterKeyFrame firstFrame, SpriterKeyFrame secondFrame, float xOffset, float yOffset){ for (int i = 0; i < firstFrame.getBones().length; i++) { SpriterBone bone1 = firstFrame.getBones()[i]; this.tempBones[i].setName(bone1.getName()); this.moddedBones[i].setName(bone1.getName())...
8
public static int[][][] readmodel(String path){ int[][][] out = new int[3][aa][windowsize]; //Letzte Zeile des Modells auf 0 setzen try{ FileReader input = new FileReader(path); BufferedReader br = new BufferedReader(input); String line; line = br.readLine(); if(line.startsWith("//")){ br.readL...
8
private static void direct_range_search(finger_print fp, double dis, Data data) { ArrayList<Integer> lst1 = new ArrayList<Integer>(); HashMap<Integer, Integer> potent = new HashMap<Integer, Integer>(); ArrayList<Integer> lst2 = new ArrayList<Integer>(); // to be commented /*for (int i : data.data_set.keyS...
6
public void siguienteRegla() throws IOException { String antecedentes[] = new String[Ante.length]; String consecuentes[] = new String[Cons.length]; char etiqueta[] = new char[15]; for(int j = 0; j < antecedentes.length;j++) { for (int i = 0; i <...
4
final public void AndExpression() throws ParseException { Token t=null; EqualityExpression(); label_11: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_AND: case BIT_ANDX: ; break; default: break label_11; } switch ((jj_ntk==-1)?j...
8
public void test_15_DnaCoder_copy_1() { DnaCoder dnaCoder = DnaCoder.get(); // Rand long seed = 20100809; Random rand = new Random(seed); int numTests = 10000; int maxLen = 1000; for( int i = 1; i < numTests; i++ ) { int seqlen = rand.nextInt(maxLen) + 10; String srcStr = randSeq(seqlen, rand); ...
6
public void cargarListaBorrar(){ try{ r_con.Connection(); String puntoVenta=combo_pto_venta.getSelectedItem().toString(); ResultSet rs=r_con.Consultar("select tc_codigo,tc_descripcion,vxc_numero " + "...
6
@Override public boolean equals(Object obj) { // generated if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Measurement other = (Measurement) obj; if (temperature == null) { if (other.temperature != null) return false; } else if ...
9
public GameHistory() { history = new Field[MAX_NUMBER_OF_STEPS]; for (int i = 0; i < MAX_NUMBER_OF_STEPS; i++){ history[i] = new Field(); history[i].emptyField(); } }
1
private static void detectFirstCycle(ArrayList<Integer> numSeq){ int length = numSeq.size(); ArrayList<Integer> subSeq = new ArrayList<Integer>(); subSeq.add(numSeq.get(0)); int size = 1; for(int i = 1; i<length; i++){ for(int j=0; j<size; j++){ if(subSeq.get(j)==numSeq.get(i)){ int k = j; in...
7
@Override public void update(long deltaMs) { if(ai != null) { ai.update(deltaMs); } }
1
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof AgencyAndId)) return false; AgencyAndId other = (AgencyAndId) obj; if (!agencyId.equals(other.agencyId)) ...
5
public treeNode getNextInsertParent() { treeNode parent = this.lastInsertNode.parent; // last insert is right child of parent // scenario 1锛�current node is not the right most on its level, then // parent's next right sibling's left child is the next spot to insert if (!isRightMost(this.lastInsertNode)) { ...
1
public int getType() { return type; }
0
private ArcDef createArcDef() { ConsolFun consolFun = (ConsolFun) consolFunCombo.getSelectedItem(); double xff; try { xff = Double.parseDouble(xffField.getText()); if (xff < 0 || xff >= 1D) { throw new NumberFormatException(); } } ...
8
public String getTypeAlias(String typeSig) { String alias = (String) aliasesHash.get(typeSig); if (alias == null) { StringBuffer newSig = new StringBuffer(); int index = 0, nextindex; while ((nextindex = typeSig.indexOf('L', index)) != -1) { newSig.append(typeSig.substring(index, nextindex + 1)); i...
2
final void method624(int i, int i_195_, int i_196_, int i_197_) { anInt5534++; for (int i_198_ = 0; anInt5632 > i_198_; i_198_++) { int i_199_ = 0xffff & aShortArray5580[i_198_]; int i_200_ = (i_199_ & 0xfd9e) >> 1107300586; int i_201_ = i_199_ >> -942433721 & 0x7; if ((i ^ 0xffffffff) != 0) i_2...
7
private void lsSort (final int ISA, final int n, final int depth) { final int[] SA = this.SA; int ISAd; int first, last, i; int t, skip; for (ISAd = ISA + depth; -n < SA[0]; ISAd += (ISAd - ISA)) { first = 0; skip = 0; do { if ((t = SA[first]) < 0) { first -= t; skip += t; } else...
9
@Override public boolean activate() { return (Constants.BEAR_AREA.contains(Players.getLocal()) && !Inventory.isFull() && !Widgets.get(13, 0).isOnScreen() && !isTalking() && !isAnswering() && !isListening() && !Settings.noob ); }
6
public void close() { if (USE_INTERNET) { try { AddressProvider.disconnect(); } catch (MalformedURLException ex) { System.err.println("Could not discconnect correctly... MalformedURLException."); } catch (IOException ex) { Syst...
6
public boolean setOptionsbarHeight(int height) { boolean ret = true; if (height < 0) { this.optionsbar_Height = UISizeInits.OPTIONSBAR.getHeight(); ret = false; } else { if (height > UISizeInits.OPTIONSBAR.getHeight()) { this.wrapBtnAccInNewE...
2
@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 (); ...
5
@Override public void advanceMinute() { for(int i = 0; i < cashiers; i++){ lines[i].get(0).servedMinute(); if(lines[i].get(0).getExpectedServiceTime() <= 0){ lines[i].remove(lines[i].get(0)); } } }
2
@Override public void setValueAt(Object value, int row, int column) { // Get the selected Pair final Pair<Boolean, String> selected = data.get(row); // Mark the sync status on the actual object folderLoop: for (final FolderConfig folderConfig : GuiUtils.syncConfig.getConfigs()) { for (final SongConfig songC...
3
private BitSet selectRBonds(String str) { int n = model.rBonds.size(); if (n == 0) return null; BitSet bs = new BitSet(n); if ("selected".equalsIgnoreCase(str)) { synchronized (model.rBonds) { for (int i = 0; i < n; i++) { if (model.getRBond(i).isSelected()) bs.set(i); } } return ...
8
public void read(String filename) throws FileNotFoundException, IOException { String curRow[]; BufferedReader file = new BufferedReader(new FileReader(filename)); try { int n = Integer.valueOf(file.readLine()); L = new int[n][n]; for (int i = 0; i < n; i++) { curRow = file.readLine().split(delim);...
4
private MessungInfo lookupMessung(int station_id, Date date) throws SQLException { try { MessungInfo messung = new MessungInfo(); ResultSet setMinDate = connection.query( "select *" + "from dbsp_wettermessung\n" + "where station_id = " + station_id + "\n" + "order by datum ASC\n" + "limit...
3
private static String[][] parseCSV(String text) { Logger.log("Starting parsing on text:\n" + text); String[] lines = text.split("\n"); ArrayList<String[]> array = new ArrayList<>(); for (String line : lines) { array.add(line.split(",")); } String[][] out = new String[array.size()][array.get(0).length]; ...
2
public static List<Cromossomo> roleta(List<Cromossomo> cromossomos, int nElementos) { int dimensao = cromossomos.size(); double fitnessTotal = 0; double[] fitness = new double[dimensao]; //pegar o primeiro fitness como menor temporariamente double menorFitness = 1 / cromossomos....
7
public void set(Object t) { this.t = t; }
0
@Override public void readAssemblyFile() { String line; Scanner s = null; boolean leadingCommentsFinished = false; //To signal end of any leading comments try { s = new Scanner(new BufferedReader(new FileReader(fileReference))); while (s.hasNextLine()) { line = s.nex...
8
@Override public void update(Observable o, Object arg) { ServerModel model = presenter.getClientModel().getServerModel(); Player player = model.getPlayerByID(presenter.getPlayerInfo().getID()); getView().setElementAmount(ResourceBarElement.BRICK, player.getBrick()); getView().setElementAmount(ResourceBarElemen...
6
public static void loadResources() { log.info("loading resources..."); // load servericon final String iconPath = "server-icon.png"; final File serverIcon = new File(iconPath); if (!serverIcon.exists()) { log.warning("icon file '" + iconPath + "' not foun...
9
@Override public void replaceArgument(Value replace, Value i, boolean throwOnError) throws Exception { boolean found = false; if(arg1.equals(replace)) { arg1 = i; found = true; } if(arg2.equals(replace)) { arg2 = i; found = true...
4
public boolean portsAreValid(){ if(reciever == null || sender == null){ return false; } return true; }
2
public void updateWantedGoods() { List<GoodsType> goodsTypes = new ArrayList<GoodsType>(getSpecification().getGoodsTypeList()); Collections.sort(goodsTypes, wantedGoodsComparator); int wantedIndex = 0; for (GoodsType goodsType : goodsTypes) { // The natives do not trade milit...
6
public boolean dropTetrominoe(){ for(int x=emplacement.getNombreColonne()-1 ; x>=0 ; x--) for(int y=emplacement.getNombreRangee()-1 ; y>=0 ; y--) if(!emplacement.IsEmpty(x, y)) try{ emplacement.setCoordonee(x, y, false); ...
4
private JPanel getPanCodes() { if (panCodes == null) { panCodes = new JPanel(); panCodes.setLayout(new BoxLayout(getPanCodes(), BoxLayout.Y_AXIS)); ButtonGroup group=new ButtonGroup(); for(int i=0;i<Interface.CODES.values().length;i++) { final int t=i; JRadioButton temp=new JRadioButton(Interface....
9
public Double getLoyalty(String playerName) { if (loyaltyCache.containsKey(playerName)) return loyaltyCache.get(playerName); Double loyalty = Config.leadershipSkillDefault; String SQL = "SELECT `loyalty` FROM " + tblSkills + " WHERE `player` = ? AND `leadership` IS NOT NULL"; Connection con = getSQLConnect...
3
public void run(){ Scanner uScan; String sMsg; String sStatus = ""; String sPrevStatus = ""; while(true){ //Check to see if the player is in an active game: uScan = new Scanner(Client.sendMsg("GET_PLAYER_STATUS")); uScan.next(); sStatus = uScan.next(); if(sStatus.equals("ACTIVE") ...
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TClassout other = (TClassout) obj; if (!Objects.equals(this.kodeClass, other.kodeClass)) { re...
3
public CompiledExpression compileExpression(String expressionDefinition) throws CompilationException { Syntax syntax = getSyntax(); String whiteSpaces = syntax.getWhiteSpaceCharacters() != null ? syntax .getWhiteSpaceCharacters() : ""; StringTokenizer rechStr = ne...
8
public static void main(String[] args) throws Exception { /* gdb.addNode("regionName", null,null); gdb.addNode("regionName", "agentName",null); gdb.addNode("regionName", "agentName","pluginName"); gdb.addNode("regionName", "agentName","pluginName2"); gdb.addNode("regionName", "agentName2",null); gdb....
5
public static void stop(long uid) { UserNotificationBuffer buffer = getMonitorFor(uid); buffer.stopNotification(); }
0
@Override public String process(HttpServletRequest request) throws MissingRequiredParameter { ResultSet resultSet = null; String email = request.getParameter("email"); if (email == null) { throw new MissingRequiredParameter(); } String result = null; try { connection = dataSource.getConnection();...
8
@Override public void paint(Graphics2D g, int width, int height) { double dividerPercentage = getCaseWidth(g) / (double) getLabelledWidth(g); int divider = (int) (width * dividerPercentage); int titleHeight = getTitleHeight(g); g.drawRect(0, 0, width, height); g.drawLine(0, 0, divider, titleHeight); g.draw...
5
public String getUrl() { return url; }
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
private boolean r_more_than_one_syllable_word() { int v_1; int v_3; // (, line 445 // test, line 446 v_1 = cursor; // (, line 446 // atleast, line 446 { ...
7
public int hashCode() { int hash = 7; hash = 31 * hash + (this.groupId != null ? this.groupId.hashCode() : 0); hash = 31 * hash + (this.artifactId != null ? this.artifactId.hashCode() : 0); // ignore type hash = 31 * hash + (this.version != null ? this.version.hashCode() : 0); ...
3
private final String getChunk(String s, int slength, int marker) { StringBuilder chunk = new StringBuilder(); char c = s.charAt(marker); chunk.append(c); marker++; if (isDigit(c)) { while (marker < slength) { c = s.charAt(marker...
5
@SuppressWarnings("unused") public void run() { Socket s2; try { s2 = new Socket("localhost", InitiationDispatcher.LOGGING_SERVER_CONNECTION_PORT); LogManager.getLogger(Lab6Test1.class).log(Level.DEBUG, "connected: {}, addr: {}, remote...
5
public void setCheckboxIcons( JCheckBox box, String baseImagePath ) { InputStream stream = null; try { stream = DataManager.get().getResourceInputStream(baseImagePath); Image scaled = getScaledImage(stream); int scaledYoffset = (maxIconHeight-scaled.getHeight(null))/2; BufferedImage unlocked = new Buffe...
3
private void StartRide() { V10Dragon d = null; for (Entity e : player.getNearbyEntities(20, 20, 20)) { if (!(e instanceof EnderDragon)) { continue; } EntityEnderDragon eed = ((CraftEnderDragon) e).getHandle(); if (eed instanceof V10Dragon) ...
5
public StringBuffer format(final CommandSender target) { // format all dates with time zone for target TimeZone timeZone = null; final Format[] formats = this.getFormatsByArgumentIndex(); for(int i = 0; i < formats.length; i++) { if (!(formats[i] instanceof DateFormat)) conti...
3
public static void main(String args[]) { long begin = System.currentTimeMillis(); int total = 338614; int limit = 22574; ExecutorService executorService = Executors.newFixedThreadPool(total / limit); for (int i = 0; i <= total / limit; i++) { executorService.execute(new SetCitedIDList(i * limit, limit)...
2
public static String replace(String inString, String oldPattern, String newPattern) { if (!hasLength(inString) || !hasLength(oldPattern) || newPattern == null) { return inString; } StringBuffer stringBuffer = new StringBuffer(); int pos = 0; int index = inString.indexOf(oldPattern); int patLen = oldPatte...
4
@Override public void sampleOccurred(SampleEvent e) { if (e.getResult().isSuccessful()){ if (isErrorsOnly()){ return; } } else { if (isSuccessOnly()){ return; } } JMeterVariables variables = JMeterContextService.getCont...
9
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (debug) { log("LoginFilter:doFilter()"); } doBeforeProcessing(request, response); HttpServletRequest serv...
9
private List<File> getMinifyFiles(List<File> filesToMinify, List<File> outFiles) { if (outFiles != null && outFiles.size() > 0) { getLog().info("About to exclude the following files: " + FileUtilities .getCommaSeparatedListOfFileNames(outFiles)); List<File> filesToMinifyMinusDestFile = Lists...
7
public static void clearTable(PatientProfilePage profileP){ int rows= profileP.getPrescriptionHistory().getRowCount(); int i=0; while(i<rows){ profileP.getPrescriptionHistory().setValueAt("",i,0); profileP.getPrescriptionHistory().setValueAt("",i,1); profileP.getPrescriptionHistory().setValueAt("",i,2); ...
1
private void readAndSetCards() throws IOException { //reset cards if there are any cardList.clear(); String line; //read in the cards for the answer for (int cardRow = 0; cardRow < 4; cardRow++) { line = reader.readLine(); String[] temp = line.split(" "); ...
2
public static boolean isDiffChar(String a, String b) { int diff = 0; for (int i = 0; i < a.length(); i++) { if (a.charAt(i) != b.charAt(i)) { diff++; if (diff >= 2) return false; } } return diff == 1; }
3
@Override public double predict(int userID, int itemID) { double prediction = 0; if (data.getAverageUserRatings().get(userID) != null) { prediction = data.getAverageUserRatings().get(userID); } ArrayList<Double> similaritiesList = new ArrayList<Double>(); ArrayList<Double> ratingsList = new ArrayList<D...
8
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
6
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(args.length >= 1) { if(args[0].equals("sell") || args[0].equals("s")) { return plugin.com_sell.onCommand(sender, command, label, ArrayManip.arraySub(args, 1)); } else if(args[0].equals("sellagain") |...
9
private float[] calcOrbit(int i, int depth, int color) { double xf, yf, a, b, aa, bb; int iter = 0; xf = smart_random_points[color][i][0]; yf = smart_random_points[color][i][1]; a = 2 * (xf - 0.5f); b = 2 * (yf - 0.5f); aa = a; bb = b; Complex z = new Complex(aa, bb); Complex old = new Complex(z....
7
Pair toPair( HashMap<Arc,Pair> parents, HashMap<Arc,Pair> orphans ) throws MVDException { if ( versions.nextSetBit(0)==0) throw new MVDException("Ooops! hint detected!"); Pair p = new Pair( versions, data ); if ( this.parent != null ) { // we're a child - find our parent Pair q = parents.get( paren...
8
public void testSafeMultiplyLongInt() { assertEquals(0L, FieldUtils.safeMultiply(0L, 0)); assertEquals(1L, FieldUtils.safeMultiply(1L, 1)); assertEquals(3L, FieldUtils.safeMultiply(1L, 3)); assertEquals(3L, FieldUtils.safeMultiply(3L, 1)); assertEquals(6L, Field...
4
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked try { // TODO add your handling code here: saveMetaRecords(); } catch (IOException ex) { Logger.getLogger(VAuthor.class.getName()).log(Level.SEVERE, null,...
1
public boolean addRoom(String name){ if (chatRooms.get(name.toLowerCase())!=null) return false; ChatServerChatRoom room = new ChatServerChatRoom(name, chatRooms.size()); chatRooms.put(name.toLowerCase(), room); System.out.println("New room added: "+name); return true; }
1
public synchronized void actionPerformed(ActionEvent e){ File[] filePath = new File[4]; filePath[0] = new File("./ExampleText/tree.txt"); filePath[1] = new File("./ExampleText/forest.txt"); filePath[2] = new File("./ExampleText/semilattice.txt"); filePath[3] = null; ...
5
public static List<Integer> getKNearestMovies(int k, int index) { SparseVector base = colMatrix.get(index); List<Integer> nearestIndices = new ArrayList<Integer>(); List<Double> nearestScores = new ArrayList<Double>(); for (int i=0; i<colMatrix.size(); i++){ if (i == index) continue; doubl...
8
public static void walkOldStyle(File file) { System.out.println(file.getPath()); if (file.isFile()) { return; // leaf element } File[] subs = file.listFiles(); // directory if (subs == null) { return; } for (File subDir : subs) { // go ...
3
public static double chiVal(double [][] matrix, boolean useYates) { int df, nrows, ncols, row, col; double[] rtotal, ctotal; double expect = 0, chival = 0, n = 0; boolean yates = true; nrows = matrix.length; ncols = matrix[0].length; rtotal = new double [nrows]; ctotal = new do...
9
public void run() { while(isRefreshing) { if(!OptionsManager.getInstance().isRefresh()) { isRefreshing = false; refreshView(); } long timePassed = (new Date()).getTime() - lastRefresh.getTime(); fps = (timePassed==0)?0:(1000/timePassed); refreshView(); lastRefresh = new Date(); ...
4
public int[] twoSum(int[] numbers, int target) { int[] numbers2 = Arrays.copyOf(numbers, numbers.length); Arrays.sort(numbers2); int start = 0; int end = numbers2.length - 1; while (start < end) { int sum = numbers2[start] + numbers2[end]; if (sum == targ...
7
protected int widestDim(double[][] nodeRanges, double[][] universe) { final int classIdx = m_Instances.classIndex(); double widest = 0.0; int w = -1; if (m_NormalizeDimWidths) { for (int i = 0; i < nodeRanges.length; i++) { double newWidest = nodeRanges[i][m_DistanceFunction.R_WIDTH] / un...
7
public void updatePosition() { if (xPos < xDestination) xPos += 1; else if (xPos > xDestination) xPos -= 1; if (yPos < yDestination) yPos += 1; else if (yPos > yDestination) ...
9
public Matrix solve (Matrix B) { if (B.getRowDimension() != n) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } if (!isspd) { throw new RuntimeException("Matrix is not symmetric positive definite."); } // Copy right hand side. do...
8
public static Instances clusterInstances(Instances data) { XMeans xmeans = new XMeans(); Remove filter = new Remove(); Instances dataClusterer = null; if (data == null) { throw new NullPointerException("Data is null at clusteredInstances method"); } //Get the ...
7
protected void interrupted() { end(); }
0
@Override public void tick() { xo = x; yo = y; zo = z; yd -= 0.04F; move(xd, yd, zd); xd *= 0.98F; yd *= 0.98F; zd *= 0.98F; if(onGround) { xd *= 0.7F; zd *= 0.7F; yd *= -0.5F; } if(!defused) { if(life-- > 0) { SmokeParticle smokeParticle = new SmokeParticle(level, x,...
4
public int queueLengthIter(){ Patient temp = this; int count = 0; while (temp != null){ temp = temp.nextPatient; count++; } return count; }
1
@Override public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) { if (!Commands.isPlayer(sender)) return false; if (args.length != 1) return false; Player p = (Player) sender; ConfigurationSection cs = ChannelsConfig.getChannels().getConfigurationSection("channe...
3