text
stringlengths
14
410k
label
int32
0
9
private int bestMove(int rm,int rw, int pm, int pw, int sm, int sw){ int bestMove = 0; ArrayList<Double> move = new ArrayList<>(); if(rm!=0||rw==0){ move.add((double)rw/(double)rm); } if(pm!=0||pw==0){ move.add((double)pw/(double)pm); } if(...
9
@Test public void validaNome(){ assertTrue("Valida nome: ", validadorUsuarios.validaNome("ams") == true); }
0
private void readFrames(LittleEndianInputStream in, int ver) throws IOException { int numPoints = in.readUnsignedShort(); int alpha = 0; if (ver == 8) { switch (in.readShort()) { case 0: break; case 1: alpha = 1; break; case 0x101: alpha = 4; break; default: throw new FileFormatException("Unknow...
8
public void setWindowBorderthickness(int[] border) { if ((border == null) || (border.length != 4)) { this.window_Borderthickness = UIBorderthicknessInits.WINDOW.getBorderthickness(); } else { this.window_Borderthickness = border; } somethingChanged(); }
2
@Override public void paint(Graphics g) { locationImg = CreateGUI.returnInstance().createImageIcon("img/location.png", "Location"); Graphics2D g2 = (Graphics2D) g; paintComponent(g2); if(dragging) { g2.setColor(Color.RED); if(rectWidth/rectHeight < preferredRatio) { rectWidth = rectHeight * preferred...
5
private boolean checkForWinHorizontal() { for (int i = 0; i < COL_COUNT; i++) { Cell cell4 = arrayOfLogicCells[0][i]; Cell cell5 = arrayOfLogicCells[1][i]; Cell cell6 = arrayOfLogicCells[2][i]; if (cell4.isZeroChecked() && cell5.isZeroChecked() ...
7
public void writeTextFile(String fileName, String s) { FileWriter output = null; try { output = new FileWriter(fileName); BufferedWriter writer = new BufferedWriter(output); writer.write(s); writer.close(); } catch (IOException e) { e....
3
public boolean writeWorld(String fileName) { try { worldWriter = new BufferedWriter(new FileWriter(fileName)); worldWriter.write(Integer.toString(rows)); worldWriter.newLine(); worldWriter.write(Integer.toString(columns)); worldWriter.newLine(); for (int i = 0; i < rows; i++) { String currentLin...
5
public boolean equals(VertexSet that){ return this.cityMap.keySet().equals(that.cityMap.keySet()); }
0
public final void update() { ++chunkUpdates; int var1 = this.x; int var2 = this.y; int var3 = this.z; int var4 = this.x + this.width; int var5 = this.y + this.height; int var6 = this.z + this.depth; int var7; for(var7 = 0; var7 < 2; ++var7) { this.dirty[va...
9
private synchronized void checkWinCondition() { int playersWithMoney = 0; int winningPlayer = -1; for(int i = 0; i < players.size(); i++) { if(players.get(i).getMoney() > 0 || players.get(i).getProperty().size() > 0) { playersWithMoney++; // No one has won yet if(playersWithMoney > 1) { ...
6
public void drawPiece( int lx, int ty, float red, float green, float blue, Graphics screen) { Color newColor = new Color(red, green, blue); Color newBorder = new Color( (red > 0.5f) ? red - 0.5f : red, (green > 0.5f) ? green - 0.5f : green, (blue > 0.5f) ? blue - 0.5f : blue); screen.s...
3
public boolean hasPrev() { if (currentPiped == null) return false; else if (currentPiped.hasPrev()) return true; else if (previousPiped != null) return previousPiped.hasPrev(); else if (!in.hasPrev()) return false; else while (true) { // TODO - This is not the optimal way to do things, /...
8
public static HelloCorba.Hello unchecked_narrow (org.omg.CORBA.Object obj) { if (obj == null) return null; else if (obj instanceof HelloCorba.Hello) return (HelloCorba.Hello)obj; else { org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ...
2
public boolean setLoadingStatusWidth(int width) { boolean ret = true; if (width <= 0) { this.loadingStatusWidth = 0; ret = false; } else { this.loadingStatusWidth = width; } somethingChanged(); return ret; }
1
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; State other = (State) obj; if (position == null) { if (other.position != null) return false; } else if (!position.equals(other.positi...
9
public void setCriteriaHightlight(int type) { HashMap<String, Integer> ranks = null; if (type == CriteriaStatistics.PRODUCT) ranks = rankVarianceScore(); else if (type == CriteriaStatistics.WEIGHT) ranks = rankVarianceWeight(); else if (type == CriteriaStatistics....
6
public void shoot(Point2D direcVect) { if(direcVect != null){ adjustVect = SPEED_NORME / (Math.sqrt(Math.pow(direcVect.getX(), 2) + Math.pow(direcVect.getY(), 2))); speedX = (float) (direcVect.getX() * adjustVect); speedY = (float) (direcVect.getY() * adjustVect); } else{ speedX = DEFAULT_SPEEDX; s...
1
private int[] findErrorMagnitudes(GenericGFPoly errorEvaluator, int[] errorLocations) { // This is directly applying Forney's Formula int s = errorLocations.length; int[] result = new int[s]; for (int i = 0; i < s; i++) { int xiInverse = field.inverse(errorLocations[i]); int denominator = 1;...
5
public boolean isPoweringTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { if (!this.isRepeaterPowered) { return false; } else { int var6 = getDirection(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); return ...
8
private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { Point eventP = e.getPoint(); int layer = -1; int number = 0; for (int i = 0; i < ffnn.getLayers().size(); i++) { if (layer != -1) break; for (int j = 0; j < ffnn.getLayers().get(i) .getNeuronCount(); j++) { ...
9
public boolean subclassOf(CtClass superclass) { if (superclass == null) return false; String superName = superclass.getName(); CtClass curr = this; try { while (curr != null) { if (curr.getName().equals(superName)) return true;...
4
public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) { StructureBoundingBox var6 = new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4); if (par1Random.nextInt(4) == 0) { var6.maxY += 4; ...
6
public String getTitle() { return this.title; }
0
public KeyStroke getKey() { return KeyStroke.getKeyStroke('s'); }
0
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
9
private double turnTo(double direction, double tickTime){ double dirDiff = direction - head.rotation; while(dirDiff < -180f) dirDiff += 360f; while(dirDiff > 180f) dirDiff -= 360f; double sign = Math.signum(dirDiff); // already done? if(dirDiff * sign <= 0.5d){ headVel = 0d; return 0d; } // alread...
6
private void calculate() { /* Calculating thing */ int last = 0; int level = 0; Set<ControlNode> calculated_lines = new HashSet<>(); for (int k = 0; k < nested.algorithm.size(); k++) { /* Searching thru all the ControlNodes... */ if (nested.algorithm.get(k) instanceof ControlNode) { ControlNode c...
8
public void add(E o) { checkForComodification(); lastReturned = head; if(next == null) { // append to the end of the list if(append(o)) { expectedModCount++; } } else { if(addBefore(o, next)) { // returns true if successfully inserted nextIndex++; expectedModCount++; } } ...
3
private void loadStudy(Study study) { // Do nothing if nothing selected. if(study == null) return; // Get previous display state. DisplayState state = study.getDisplayState(); if(state == null) // No previous display state MedImage.getIma...
2
public boolean opEquals(Operator o) { return (o instanceof ThisOperator && ((ThisOperator) o).classInfo .equals(classInfo)); }
1
public BatchPane() { frame = Frame.getInstance(); setLayout(null); FileFilter filter = new FileTypeFilter(".data", "Text files"); dataChooser = new JFileChooser(); dataChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); dataChooser.setFileFilter(filter); FileFilter filter2 = new FileTypeFilter...
8
public double[] predictDistribution() { int[] fruitCounts = new int[12]; int totalFruit = 0; double[] fruitProbabilities = new double[12]; for (int i = 0; i < firstRoundBowlHistory.length; i++) { for (int j = 0; j < firstRoundBowlHistory[i].length; j++) { fru...
6
public JSONObject getData() { JSONObject o = new JSONObject(); try { for (Resource r : Resource.values()) { o.put(r.name(), getF(r)); } } catch (JSONException e) { e.printStackTrace(); } return o; }
2
private boolean upToDate (File verFile) { boolean result = true; try { if (!verFile.exists()) { verFile.getParentFile().mkdirs(); verFile.createNewFile(); result = false; } BufferedReader in = new BufferedReader(new File...
6
public Vector<WorldMap> readMaps() { try { BufferedReader reader = new BufferedReader(new FileReader(mapFilename)); WorldMap wm = null; String line = reader.readLine(); while (line != null) { line = line.toUpper...
7
private void cycleFocusLevel(boolean next) { if (next) { // Next View to focus should be the first child View of the currently focused View. If there is no such View, the currently focused View should be clicked on. List<View> focusableViews = getNextFocusableViews(next); if ...
9
public void write(VariableMap vars, File target) { this.vars = vars; DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance(); dbfac.setValidating(false); dbfac.setNamespaceAware(true); DocumentBuilder docBuilder; try { docBuilder = dbfac.newDocumentBuilder(); //docBuilder.setErrorHandl...
5
public boolean removeNick(String nick) { if (nicks.contains(nick)) { nicks.removeElement(nick); char c = nick.charAt(0); switch (c) { case '@': beginningVoiced--; case '+': beginningNormal--; default: count--; } return true; } else return false; }
3
public boolean[][] getPassableMap() { final boolean[][] result = new boolean[getMapHeight()][getMapWidth()]; final byte[] bytes = ((DataBufferByte) mapImage.getRaster().getDataBuffer()) .getData(); final int w = getMapWidth(); final int h = getMapHeight(); for (int row = 0; row < h; row++) { final int ...
3
@Override public boolean invoke(MOB mob, List<String> commands, Physical target, boolean auto, int asLevel) { if(!auto) return false; final Physical P=target; if(P==null) return false; if((P instanceof Item)&&(room==null)) return false; if(P.fetchEffect("Falling")==null) { final Falling F=new ...
7
public static String safeReverseTranscribe(String inString ) throws Exception { StringBuffer buff = new StringBuffer(); for ( int x= inString.length() - 1; x >=0; x-- ) { char c = inString.charAt(x); if ( c == 'A' ) buff.append( 'T' ); else if ( c == 'T' ) buff.append( 'A' ); els...
7
public void pokemonFinalStats(int pokeDmg, double atkPercent, double defPercent) { GameFile.pokemonFullHp[0] = (int) (((double) ((GameFile.pokemon1Ivs[0] + (2 * baseHp) + 100) * GameFile.pokemonLevels[0]) / 100) + 10); statAtk = (int) ((((double) ((GameFile.pokemon1Ivs[1] + (2 * baseAtk)) * GameFile.pokemonL...
1
public void resetTo(String contig, int leftEdgePos) throws IOException, EndOfContigException, FullQueueException { if (reader.getCurrentContig() == null) { reader.advanceToContig(contig); } if ((! reader.getCurrentContig().equals(contig))) { bases.clear(); this.leftEdge = 1; reader.advanceToContig...
6
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed try { if (txtDNI_Agricultor.getText().compareTo("") != 0 && txtNombres_Agricultor.getText().compareTo("") != 0 && txtApePaterno_Agricultor.getTe...
8
public List<Attempt> solve() { ArrayList<Attempt> successes = new ArrayList<Attempt>(); if (isMetGoal()) { successes.add(this); } else if (isGoodAttempt()) { int moveIndex = -1; for (int i = 0; i < moves.length; i++) { if (null == moves[i]) { ...
9
@Override public void init() { signalTower = SignalTowerBuilder.create().build(); count = 0; lastTimerCall = System.nanoTime(); timer = new AnimationTimer() { @Override public void handle(long now) { if (now > lastTimerCall + 2_000_000_000l) { ...
5
public boolean modifyStudent(String originNo, Student now) { String select = "SELECT * FROM STUDENT WHERE NO=?"; try { PreparedStatement ps = conn .prepareStatement(select, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ps.setString(1, originNo); ResultSet rs = ps.executeQuery();...
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 public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; if (login != null ? !login.equals(user.login) : user.login != null) return false; if (password != null ? !password.equals...
7
public void update(InputHandler inHandler) { // movement setX_Point(getX_Point()-getxVel()); setY_Point(getY_Point()+getyVel()); if(isGravityOn()){ updateGravity(); if(getY_Point()>getHeight()){ setyVel(getyVel()-upAc); } } // "droping" if(getDropTimer().isReady()){ setDropTimer...
7
@Override public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { dispatchHotkeys(container, delta); if (currentState == STATE_DEAD || currentState == STATE_PAUSED) { return; } map.update(this, container, delta); // detect tower ...
9
private static void showResults(HuntField field) { int counter = 0; for (FieldItem item : field.getItemsInField()) { if (item.getType() == 'H') { counter++; Hunter hunter = (Hunter) item; switch (hunter.hunted()) { case 0: ...
6
private void drawBackground() { g.setColor(Color.cyan); g.fillRect(0, 0, WIDTH*SCALE, HEIGHT*SCALE); }
0
public int getVisibleColumnCount() { int count = 0; for (Column column : mColumns) { if (column.isVisible()) { count++; } } return count; }
2
public static void main(String[] args) throws Exception { String map = null; //String group = null; if (args.length > 0) map = args[0]; if (args.length > 1) L = Double.parseDouble(args[1]); if (args.length > 2) W = Double.parseDouble(args[2]); if (args.length > 3) gui = Boolean.parseBoolean(args...
6
private void extend(ITNode currNode) throws IOException { // loop over the brothers of that node int i = 0; while (i < currNode.getParent().getChildNodes().size()) { // get the brother i ITNode brother = currNode.getParent().getChildNodes().get(i); // if the brother is not the current node if (brother...
9
public static void main(String[] args) { try { int port = Integer.parseInt(args[0]); new ChatServer(port); } catch (Exception e) { System.out.println("Enter a valid port."); System.exit(0); } }
1
public void eat() throws GameException { ArrayList<Actor> intersectingObjects = (ArrayList<Actor>) getIntersectingObjects(MovingObject.class); if(intersectingObjects.isEmpty()) return; for(int i=0; i < intersectingObjects.size(); i++) { MovingObject chosenActor = (MovingObject)intersec...
4
public void passKeyPressed(ArrayList<KeyButtons> keyPressed) { if (!keyPressed.isEmpty() && keyPressed != null); { switch (whatcha) { case PLAYING: stage.handlePressedKeys(keyPressed); break; case PAUSE: ...
6
@Override public double getIntersectionValue(Ray ray) { //sphere: r^2 = (x - x1)^2 + (y - y1)^2 + (z - z1)^2 //Line: x = at + b // y = ct + d // z = et + g LinearEquation combinedX = LinearEquation.Add(ray.xEquation, -center.x); LinearEquation combinedY = LinearEquation.Add(ray.yEquation, -c...
5
private int getCompositeNum() { int n = 1; List<Integer> primes = new ArrayList<>(); while ((n += 2) > 0) { boolean isPrime = Problem3.isPrime(n); if (isPrime) { primes.add(n); continue; } boolean hit = false; for (int i = primes.size() - 1; i >= 0; i--) { int p = primes.get(i); int...
8
private void set2(Delegate d) { setVisible(d.visible); setDraggable(d.draggable); setRx(d.getX()); setRy(d.getY()); setAngle(d.getAngle()); setFont(d.getFont()); setFillMode(d.getFillMode()); setBorderType((byte) d.getBorderType()); setShadowType((byte) d.getShadowType()); setForegroundColor(d.getFo...
7
@Override public void close() { for (int i = 0; i < printStreams.length; i++){ printStreams[i].close(); } }
1
@Override public int read() throws IOException { return (prt < data.length) ? (data[prt++]):-1; }
1
private double compute_conductance(fgraph fg,community com) { double m=0,c=0; for(int i=0;i<fg.get_number_of_edges();i++) { edge e=fg.get_edge(i); if(com.contains(e.get_n1())&&com.contains(e.get_n2())) { m++; } else if((com.contains(e.get_n1())&&!com.contains(e.get_n2()))||(!com.contains(e.get...
7
public void analyzePath() { addedLength = actualLongestPath.getLength(); Direction dir = board.getWaterDirection(); List<Pipe> path = actualLongestPath.getPath(); for (int i = 0; i < path.size(); i++) { if (path.get(i).isCorner()) { if (!replaceWithCross(path.get(i), i, dir)) if (i + 1 < path.size()...
8
public static EntityInformation serializeEntity(InternalComponentManager componentManager, EntityRef clientEntity, int entityId, EntityRef entity, Iterable<? extends EntityComponentFieldFilter> componentFieldFilters) { EntityInformation entityInformation = new...
8
private void rellenaAleatorio() { for(int y=0; y<numeros.length; y++){ int min = y * 10; int max = ((y + 1) * 10) - 1; if(min == 0) min = 1; if(max == 89) max = 90; for(int x=0; x<numeros[y].length; x++){ int aleatorio = 0; boolean repetido = true; while(repetido){ aleator...
5
public static double clampDouble(double value, double min, double max) { return (value < min) ? min : (value > max) ? max : value; }
2
public void test() { String f = "SafeCommandBlock"; PluginUpdateInfo tar = null; for (PluginUpdateInfo pui : PluginUpdateInfo.plugins) { if (pui.p.getDescription().getName().equals(f)) { tar = pui; } } VersionsComparer vs = new VersionsComparer(Comparer.VERSION_WEBSITE_COMPARE); try { System.ou...
4
public int GetTravelTime() { //return the travel time return this.toLastBusStopTicks - this.firstTicks; }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ProposedCard other = (ProposedCard) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id) && (a...
7
@Override public void onDisable() { GcConfig.plugin = null; GcFiles.save(); Player [] list = Bukkit.getOnlinePlayers(); for (Player players : list) { if (GcEntityListener.signLocation.containsKey(players)) { Block block = GcEntityListener.signLocation.get(players).getBlock(); block.setType(Material....
5
public final void unpause() { if (paused.compareAndSet(true, false)) { synchronized (this) { notify(); } } }
1
public static void token_stemming(String[] tokens, String[] suffixes) { for (String token : tokens) { int longestMatchedSuffixLen = 0; for (String suffix : suffixes) { boolean matches = token.endsWith(suffix); boolean longer = longestMatchedSuffixLen < suf...
4
private BlockStatement compileFor() throws ParseException, IOException { // ( getSymbol('(', "( is excepted after for"); // <identifier> getNextToken(Tokenizer.IDENTIFIER, "identifier is excepted after ("); // <var-name> Vector<Expression> expressions = new Vector<Expression>(); Vector<Integer> lengths ...
8
void dump(String indent) { log.trace(indent + "***** CALL DUMP *****"); log.trace(indent + "TSCall: " + this); log.trace(indent + "TSCall ID: " + this.callID); log.trace(indent + "TSCall UCID: " + this.ucid); log.trace(indent + "TSCall non-Call ID: " + this.nonCallID); log.trace(indent + "TSCall state: " + ...
9
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof NightArrivedMessage)) return false; NightArrivedMessage that = (NightArrivedMessage) o; if (!Arrays.equals(playersName, that.playersName)) return false; return true; }
3
public int maxPoints(Point[] points) { int big =0; int flag =0; if(points.length<2){ return points.length; } for(int i = 0; i < points.length ; i++) for(int j=i+1; j <points.length; j++){ if((points[i].x != points[j].x) || (points[i].y != points[j]...
7
private void sendImageToGUI() { if (bulbPower < images.size()) { appFrame.changeImage(bulbPower); } }
1
public void switchArriereState(){ _arriere = !_arriere; _statutTexture = 0; if (_arriere) { _texture = _liste_texture_back.get(0); } else { _texture = _liste_texture.get(0); } }
1
public void setLineEnding(String lineEnding) {this.lineEnding = lineEnding;}
0
public Garage() { BufferedReader br = null; try { br = new BufferedReader(new FileReader("voitures.txt")); } catch (FileNotFoundException e) { e.printStackTrace(); } try { if (br.readLine() == null) { System.out.println("Aucune...
3
public PainelEsconde(Painel pn){ //tabuleiro.setLayout(null); tabuleiro = pn; //this.setBounds(10, 10, 500, 500); //this.setBackground(null); apagaBotao = new MouseListener() { @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } @Override...
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=prof...
8
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String operation = request.getParameter("operation"); Command com = null; if(operation == null){ com = new ShowCommand(); } else if(operation.eq...
7
public ControleurApplication(BDApplication modeleApp, VueApplication vueApp) { this.modeleApp = modeleApp; this.vueApp = vueApp; controleurListe = new ControleurListe(modeleApp.getListe(), vueApp.getVueListe()); for (int i = 0; i < vueApp.getVueCommande().NBBOUTONS; i++) { this.vueApp.getVueCommande().ge...
1
private void render() { if (!initialized) { if (this instanceof IPreloadModifier){ IPreloadModifier modifier = (IPreloadModifier) this; modifier.renderPreLoadScreen(); } else { fontRenderer.setRenderingSize(5); fontRenderer....
8
private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0); try { curChar = input_stream.readChar(); } catch(EOFException e) { jjStopStringLiteralDfa_0(6, active0); return 7; } switch(curChar) { case 99: ...
8
public Doctor(String name, String userName, String password, int room){ this.name=name; this.userName=userName; this.password=password; this.room = room; }
0
private void writeAchievements(OutputStream out, List<AchievementRecord> achievements) throws IOException { writeInt(out, achievements.size()); for (AchievementRecord rec : achievements) { writeString(out, rec.getAchievementId()); int diff = 0; switch(rec.getDifficulty()) { case NORMAL: diff = 1;...
3
@Test public void testGenerateOnlyDistributionsEVRangeFromRestrictions() { int maxEVs = 200; int minEVs = 80; when(restrictionsModel.getMaxEVs()).thenReturn(maxEVs); when(restrictionsModel.getMinEVs()).thenReturn(minEVs); Set<EVDistribution> initialCollection = evDistributionFactory.getInitialCollection(res...
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ArrayWorld other = (ArrayWorld) obj; return Arrays.deepEquals(cells, other.cells); }
3
@Override public String[] getListOfMembers() { List<Member> memberList = data.getListOfMembers(); String [] memberArray = new String[memberList.size()]; for(int i=0;i<memberList.size();i++){ memberArray[i]=memberList.get(i).getFirstname() + " " + memberList.get(i).getLastname(); } return memb...
1
@Override public void dragOver(DropTargetDragEvent event) { TreePanel panel = getPanel(); TreeContainerRow parentRow = null; int insertIndex = -1; if (acceptDrag(event)) { Point pt = panel.toContentView(new Point(event.getLocation())); TreeRoot root = panel.getRoot(); TreeRow overRow = panel.overRow(p...
8
protected boolean matchKind(Item item) { if (this.type != item.type) return false ; if (this.refers != null) { if (item.refers == null) return false ; if (! this.refers.equals(item.refers)) return false ; } return true ; }
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); boolean first = true, prevNoEmpty = true; while ((line = in.readLine()) != null && line.length() != 0) { if (!firs...
5
public static void makeFieldAccessible(final Field field) throws SecurityException { if (!field.isAccessible()) { if (System.getSecurityManager() == null) { field.setAccessible(true); } else { AccessController.doPrivileged((PrivilegedAction<Void>) () -> { field.setAccessible(true); return null...
2
private int find(int index){ int low = 0; int high = fillLevel - 1; while (low <= high) { int mid = (low + high) >>> 1; int midVal = index(mid); if (midVal < index) low = mid + 1; else if (midVal > index) high = mi...
3