text
stringlengths
14
410k
label
int32
0
9
private void recalculateCellSize(int minSize) { if (numRows == 0 || numCols == 0) { cellSize = 0; } else { JViewport vp = getEnclosingViewport(); Dimension viewableSize = (vp != null) ? vp.getSize() : getSize(); int desiredCellS...
6
private void commandSwitch(){ //Takes an input from the console and uses just the first letter String input = menuScan.next(); char inputChar = input.charAt(0); // Runs it through a switch to execute the appropriate command switch (inputChar) { case 'a': loadFile(); break; case 'b': stateSearch(); ...
8
public static void main(String[] args) { System.out.println("Starting network example ..."); try { ////////////////////////////////////////// // First step: Initialize the GridSim package. It should be called // before creating any entities. We can't run ...
6
public void addRequiredParameters(OAuthAccessor accessor) throws OAuthException, IOException, URISyntaxException { final Map<String, String> pMap = OAuth.newMap(parameters); if (pMap.get(OAuth.OAUTH_TOKEN) == null && accessor.accessToken != null) { addParameter(OAuth.OAUTH_TOKEN,...
8
@Basic @Column(name = "POP_NOMBRE_PROVEEDOR") public String getPopNombreProveedor() { return popNombreProveedor; }
0
public static Keyword inequalitySpecialist(ControlFrame frame, Keyword lastmove) { lastmove = lastmove; { Proposition proposition = frame.proposition; Surrogate relation = ((Surrogate)(proposition.operator)); if (((Boolean)(Logic.$REVERSEPOLARITYp$.get())).booleanValue()) { { Object old$Rev...
9
public Point2D getRelativeCenter() { return new Point2D.Double(getSideLength()/2.0, getSideLength()/2.0); }
0
public PERangeList intersection(PERangeList listb) { PERangeList rIts = new PERangeList(); if(getNumPE() == 0 || listb.getNumPE() == 0) { return rIts; } sortRanges(); listb.sortRanges(); for(PERange rq : this.ranges) { for(PERange ru : listb.ranges) { // rq's...
6
public void run() { while (true) { try { Thread.sleep(1000); } catch (Exception ex) { ex.printStackTrace(); } CometEngine engine = CometContext.getInstance().getEngine(); if (COM1.equals(portName)) { long totalMemory = Runtime.getRuntime().totalMemory(); System.out.println("...
5
public static EasyDate smartParse(String date) { if (date == null) { throw new NullPointerException("指定的日期字符串不能为null"); } int length = date.length(); // 字符串长度 String format = null; switch (length) { case 10:// 2012-01-02 format = DATE; break; case 19:// 2012-01-02 13:22:56 format = DATETIME; ...
5
public boolean hasConverged() { if (x >= 0 && x <= MAX_X && y >= 0 && y <= MAX_Y) { return true; } return false; }
4
private int binarySearchInArray(K key) { int left = 0; int right = entryList.size() - 1; // Optimization: For the common case in which entries are added in // ascending tag order, check the largest element in the array before // doing a full binary search. if (right >= 0) { int cmp = key....
6
private void clearRows() { for (int i=0;i<board.length;i++) { boolean canRowClear=true; for (int j=0;j<board[0].length;j++) { if (board[i][j]==0) { canRowClear=false; } } if (canRowClear) { score+=10; //clear row for (int k=0;k<board[0].length;k++) { board[i]...
8
String getNextDataToken() throws Exception { String str = peekToken(); if (str == null) return null; if (wasUnQuoted()) if (str.charAt(0) == '_' || str.startsWith("loop_") || str.startsWith("data_") || str.startsWith("stop_") || str.startsWith("glob...
7
public void deleteDuplicatesByGenes(List<Bin> newGenes) { for(int i = 0; i < this.bins.size(); i++){ for(int j = 0; j < newGenes.size(); j++){ for(int n = 0; n < newGenes.get(j).getAll().size(); n++){ for(int m = 0; m < this.bins.get(i).getAll().size(); m++){ if(this.bins.get(i).getElem...
8
@SuppressWarnings("unchecked") protected T findOneResult(String namedQuery, Map<String, Object> parameters) { T result = null; try { Query query = session.createQuery(namedQuery); // Method that will populate parameters if they are passed not null and empty if (parameters != null && !parameters.isEmpty(...
4
public boolean isOnEarth(){ if(jumpEnd){ if(jumpAnimation == 5){ jumpEnd = false; jumpAnimation = 0; } else { jumpAnimation++; } return true; } else { return false; } }
2
static byte[] getFakedCookie(Session session){ synchronized(faked_cookie_hex_pool){ byte[] foo=(byte[])faked_cookie_hex_pool.get(session); if(foo==null){ Random random=Session.random; foo=new byte[16]; synchronized(random){ random.fill(foo, 0, 16); } /* System.err.print("faked_cookie: "); for(int...
2
private void checkWinner() { boolean test = false; if (test || m_test) System.out.println("ConnectFour::checkWinner() - BEGIN"); for (int y = 0; y < GAME_HEIGHT; y++) { for (int x = 0; x < GAME_WIDTH; x++) { checkRight(x, y); checkDown(x, y); checkDiagonalUp(x, y); checkDiagonalDown(x, y); ...
6
public static BufferedImage resizeImage(BufferedImage image, double scale) { if ((scale == 1.0) || (image == null)) { return image; } int type = image.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : image .getType(); float width = image.getWidth(); float height = image.getHeight(); int newHeight = ...
3
public ArrayList viewMyBookingCheckin() { ArrayList temp = new ArrayList(); Query q = em.createQuery("SELECT t from BookingEntity t"); for (Object o : q.getResultList()) { BookingEntity p = (BookingEntity) o; temp.add(sdf.format(p.getCheckinDate())); System.o...
1
private void jButtonBekaeftBetalingActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonBekaeftBetalingActionPerformed {//GEN-HEADEREND:event_jButtonBekaeftBetalingActionPerformed if (jCheckBoxBetalt.isSelected()) { for (int i = 0; i < control.getOrderlist().size(); i+...
4
@Override public void keyPressed(KeyEvent ke) { //synchronized(this) //{ this.input = this.input.concat(Character.toString(ke.getKeyChar())); if(ke.getKeyChar() == KeyEvent.VK_BACK_SPACE ) if(this.input.length()>=2)this.input= this.input.substring(0, this.input.length()-2); ...
3
private void storeEditData () { int selRow = rosterTable.getSelectedRow(); if (selRow >= 0) { Roster selRoster = MainWindow.rosterDB.getRosters().get(selRow); selRoster.setFamilyName (familyNameField.getText()); selRoster.setGivenName (givenNameField.getText()); selRoster.setPhoneNumber(phoneNumberFi...
1
@Override public void draw(Graphics2D drawScreen, int offsetX, int offsetY) { totalVisibleEnities = 0; clearMaps(); sortEntitiesToMap(); // At this point we will have a list of only visible sprites, and // the map should contain the draw order required. Remember that not // every key will match up with t...
6
private boolean r_factive() { int among_var; // (, line 132 // [, line 133 ket = cursor; // substring, line 133 among_var = find_among_b(a_7, 2); if (among_var == 0) { ...
8
public boolean removeBlockFromRoulette(Block block) { Set<Integer> tilesKeys = tilesLocations.keySet(); for(Integer key : tilesKeys) { SerializableLocation blockLocation = new SerializableLocation(block.getLocation()); if(tilesLocations.get(key).contains(blockLocation)) { tilesLocations.get(key).remove(bl...
4
public static void back(int index, int cur) { if (index >= list.length) { if (cur > nBlacks) { nBlacks = cur; ans = color.clone(); } return; } boolean neighBlack = false; for (int i = 0; i < list[index].size() && !neighBlack; i++) if (color[list[index].get(i)]) neighBlack = true; if (!...
7
@Override public void render() { if(location.getWeaponID() == WeaponLocation.NO_WEAPON) { super.render(); } if(renderData) { locData.render(); } }
2
private void initialize() { frmGui = new JFrame(); //frmGui.setResizable(false); frmGui.setTitle("guiTSP"); frmGui.setBounds(100, 100, 346, 786); frmGui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmGui.getContentPane().setLayout(new BorderLayout(0, 0)); JPanel pnlInput = new JPanel(); frmGui.getC...
8
private void itmMnu_EncarregadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnu_EncarregadoActionPerformed if ((usuarioLogado.getTipo().equals("Diretor")) || (usuarioLogado.getTipo().equals("Gerente"))) { GerenciarEncarregadoForm gerenciarEncarregadoForm = null; ...
2
@Override protected void checkAfterParse(Method method) throws DaoGenerateException { super.checkAfterParse(method); Class<?> returnType = method.getReturnType(); isReturnCollection = ClassHelper.isTypeCollection(returnType); if (isReturnCollection && StringUtils.isEmpty(vkey)) { throw new DaoGenerateExcep...
3
public Map<String, Map<Integer, Map<String, Double>>> getAll() throws FileNotFoundException, IOException { for (String file : trainingFileString) { getWordInClass(file); } return allMap; }
1
private void processConnection() throws IOException { String message = "Connection successful"; sendData( message ); // send connection successful message // enable enterField so server user can send messages // setTextFieldEditable( true ); do // process messages sent from client { try // read mess...
2
public int getSteps() { return steps; }
0
public void printOutput() throws Exception { if (inFile==null) throw new Exception("class not initialized"); String sIn=this.inFile.readLine(); sIn=sIn.trim(); Integer iVal=new Integer(sIn); System.out.println("Got3: [" + iVal + "]"); for (int i=1; i<=iVal.intValue(); ++i) { boolean blThree=((i%3)==0); ...
6
public static String[] dataToStringArray(byte[][] data) { String[] strings = new String[data.length]; for(int i = 0; i < data.length; i++) { strings[i] = new String(data[i]); //.toString(); } return strings; }
1
public void handleKeyboardEvent(int keycode){ availableMoves = gameboard.getAvailableMoves(workingTetromino, column, row); //Gestion des mutateurs switch(keycode) { case KeyEvent.VK_UP:{ if(availableMoves.canRotateRight()) { ...
9
public static float getFloat() { float x = 0.0F; while (true) { String str = readRealString(); if (str == null) { errorMessage("Floating point number not found.", "Real number in the range " + (-Float.MAX_VALUE) + " to " + Float.MAX_VALUE); } ...
4
public static void main(String[] args) { Human human = new Human(); //human.name = "Slava"; human.setName("Sanya"); System.out.println(human.getName()); human.setAge(10); //human.age = -345; System.out.println(human.getAge()); }
0
public Projectile createNewProjectile(String name) { Projectile projectile = null; if (name.equals("random")) { name = Helper.getWeightedRandomValue(this.weightedValues); } try { Class<?> projectileClass = Class.forName(name); Con...
9
public void modelUpdate(final ModelEvent e) { EventQueue.invokeLater(new Runnable() { public void run() { switch (e.getID()) { case ModelEvent.SCRIPT_START: if (disabledAtScript) enableButton(false, e.getSource()); break; case ModelEvent.SCRIPT_END: if (disabledAtScript) enab...
8
public void initToNull() { for (int z = 0; z < mapSizeZ; z++) { for (int x = 0; x < mapSizeX; x++) { for (int y = 0; y < mapSizeY; y++) groundArray[z][x][y] = null; } } for (int l = 0; l < anInt472; l++) { for (int j1 = 0; j1 < cullingClusterPointer[l]; j1++) cullingClusters[l][j1] = null;...
7
public static void ensureTokenizerBufferSize(TokenizerStreamState state, int currenttokenstart, int requiredspace) { { int size = state.bufferSize; int newsize = size; int end = ((state.end) % size); int freespace = ((currenttokenstart == -1) ? size : (((end <= currenttokenstart) ? (currenttokenst...
9
private void qsort(Object[] items, Comparator comparator, int l, int r) { final int M = 4; int i; int j; Object v; if((r - l) > M) { i = (r + l) / 2; if(comparator.compare(items[l], items[i]) > 0) { swap(items, l, i); } if(comparator.compare(items[l], ite...
8
public boolean saveAsRaw(String filename) throws Exception { if (null == filename) { throw new Exception("Filename must not be null"); } // open the streams and send the height data to the file. try { FileOutputStream fos = new FileOutputStream(filename); DataOutputStream dos = new DataOutputStream(...
5
private int getConstructorType(StructuredBlock body) { /* * A non static constructor must begin with a call to another * constructor. Either to a constructor of the same class or to the * super class */ InstructionBlock ib; if (body instanceof InstructionBlock) ib = (InstructionBlock) body; else ...
9
public int[] getData() { return data; }
0
public void WGListWords(String sender, String login, String hostname, Command command) { Game game = null; User user = null; if(command.arguments.length == 2) { game = games.get(getServer() + " " + command.arguments[1]); user = getUser(game, sender, login, hostna...
8
public static void run(Class serverClass) { try { executeInstance((NanoHTTPD) serverClass.newInstance()); } catch (Exception e) { e.printStackTrace(); } }
1
public Student(String name) { this.name = name; }
0
public static boolean modifyRow (Object bean, String field) { PreparedStatement stmt = null; try{ if(bean instanceof Patient){ return modifyPatient((Patient)bean, stmt, field); } if(bean instanceof Employee){ return modifyEmployee((Employee)bean, stmt, field); } if(bean instanceof Drug)...
8
public void setServerTypeClassName(String newClassName){ if(newClassName.equals(serverTypeClassName)) return; if (ServerType.isValidServerTypeClassName(newClassName)) throw new IllegalArgumentException(INVALID_CLASSNAME); serverTypeClassName = newClassName; useNewModel(); }
2
public void configForLanding(Object arg[]) { text.setText("") ; text.append("\nExpedition Settings:\n") ; describePerk(0, "Site Type" , SITE_DESC ) ; describePerk(1, "Funding Level", FUNDING_DESC) ; describePerk(2, "Granted Title", gender == 1 ? TITLE_MALE : TITLE_FEMALE) ; text.a...
9
public void setName(String name) { this.name = name; }
0
private boolean createGridlets() { int type = INTERACTIVE_JOBS; int nodes = 1, runTime = -1; long arrTime = -1; arrivalInit(aarr, barr, anum, bnum, start, weights); for (int i=0; i<numJobs; i++) { long[] info = getNextArrival(type, weights, aarr, barr); type = (int)in...
3
private void convertToArrAdj() { // Log.print(Log.system, "Converting graph to ARR_ADJ"); switch (getState()) { // ARR_INC -> ARR_ADJ case ARR_INC: clearGraph(States.ARR_ADJ); for (int j = 0; j < M; j++) { boolean isFirstFinded = false; // First - отрицательное число, откуда ребро уходит, Second ...
9
private Color getColor(int col) { switch (col) { case BLACK: return Color.BLACK; case LIGHT_GRAY: return Color.LIGHT_GRAY; case RED: return Color.RED; case ORANGE: return Color.ORANGE; case YELLOW: return Color.Y...
8
public void drawScreen(int par1, int par2, float par3) { this.func_41040_b(par1, par2, par3); Tessellator var4 = Tessellator.instance; short var5 = 274; int var6 = this.width / 2 - var5 / 2; int var7 = this.height + 50; float var8 = -((float)this.updateCounter + par3)...
6
public void cancelPieceForConnection(ManagedConnection mc, int piece){ Piece p = disseminatedPiecesToCompete.get(piece); if(p!=null){ List<ManagedConnection> list = pieceToClients.get(p); list.remove(mc); if(list.size()==0){ //ok remove this from every where. //This might be the only client that ha...
5
public int compare(String o1, String o2) { String s1 = (String)o1; String s2 = (String)o2; int thisMarker = 0; int thatMarker = 0; int s1Length = s1.length(); int s2Length = s2.length(); while (thisMarker < s1Length && thatMarker < s2Length) { ...
8
private boolean handleDamageBlocked(Player player, DamageCause type) { if (WorldRegionsPlugin.getInstanceConfig().ENABLE_BLOCKED_DAMAGE && WGCommon.willFlagApply(player, WorldRegionsFlags.BLOCKED_DAMAGE)) { // Disabled? if (WGCommon.areRegionsDisabled(player.getWorld())) return true; // Bypass? if (!W...
6
public void back() { i++; if(i>modtexts.length-1) i=0; modname = modtexts[i].getName(); boolean gef=false; for(Modinfo prop: proposals) if(prop.getName().equals(modname)) gef=true; if(!gef)back(); headl.setText(modname); headl2.setText(modname); if(geladen) laden(); else neu=fa...
5
public void afficheTable(){ System.out.println("\nVoici la table de coordonnées [" + nombreColonne + "]["+ nombreRangee+ "]"); for(boolean[] temp : coordoneeJeu){ //System.out.print("Poura la rangée " + rangee); for(boolean used : temp) System.out.print(used+ " ")...
2
private void creerTriangle(final int position,final Case c) { int num = 25-position; Point p = new Point(0,0); if(num<=6) { p = new Point(454-(num-1)*33,30); }else if(num<=12) { p = new Point(392-173-(num-7)*33,30); }else if(num<=18) { p = new Point(392-173+(num-18)*33,233); }else if(num<=24)...
5
public static Entry[] mergeSort(Entry[] list) { // Uses merge sort, and does not change the original array. if(list.length == 1) { return Arrays.copyOf(list, 1); } else { Entry[] list1 = Arrays.copyOfRange(list, list.length/2, list.length); Entry[] list2 = Arrays.copyOfRange(list, 0, list.length/2); r...
1
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { f = new JFrame("WiMAP"); JPanel p = new MainWindow(); f.setExtendedState( f.getExtendedState()|JFrame.MAXIMIZED_BOTH ); f.setContentPane(p); f.setJMenuBar(createMenuBar()); ...
3
public boolean canMakeMove(Direction dir, Color [] [] placedBlocks) { int XCoord, YCoord, Y = 0,X = 0; switch (dir) { case DOWN: Y = 1; break; case UP: Y = -1; break; case LEFT: X = -1; ...
9
private void drawGameElement(Graphics2D graphics, Element element, Position position) { Image image = findGameElementImage(element); if (image != null) { graphics.drawImage(image, position.xCoordinate, position.yCoordinate, 40, 40, null); } }
1
@Override public boolean handleException(Throwable e, CommandBase command, CommandInvocation invocation) { for (ExceptionHandler handler : handlers) { if (handler.handleException(e, command, invocation)) { return true; } } retur...
2
public void printStyles() { ensureOut(); // First, copy the base css BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader( ToHtml.class.getResourceAsStream("excelStyle.css"))); String line; while ((line = i...
8
public ListingPanel(String user, Item i) { super(); ImagePanel picture = new ImagePanel(i.getImage(), 65, 65); JLabel title = new JLabel(i.getTitle()); JLabel bid = new JLabel(i.getHighestBid().formatted()); JLabel time = new DynamicTimeLabel(i); // Won/Lost messages if (i.timeLeft() == 0) { time...
5
@Override public Object getValueAt(int rowIndex, int columnIndex) { Utilizador ut = dados.get(rowIndex); switch (columnIndex) { case 0: return ut.getNome(); case 1: return ut.getEmail(); case 2: return ut.getLogIn()...
9
public int getSignID(final Location sign) throws SQLException, InvalidSignLocationException{ long time = 0; plugin.getLoggerUtility().log("getting Sign!", LoggerUtility.Level.DEBUG); time = System.nanoTime(); Statement st = null; String sql; ResultSet result; try { st = connector.getConnection().create...
4
@Override public void go(HasWidgets container) { this.container = container; if ("".equals(History.getToken())) { History.newItem(HISTORY_TOKEN); } else { History.fireCurrentHistoryState(); } }
1
private static void method232(int ai[], int ai1[], int ai2[], byte abyte0[], int i, int j, int k) { int l = 0; for(int i1 = i; i1 <= j; i1++) { for(int l2 = 0; l2 < k; l2++) if(abyte0[l2] == i1) { ai2[l] = l2; l++; } } for(int j1 = 0; j1 < 23; j1++) ai1[j1] = 0; for(int k1 = ...
9
public void printBoard() { for(int y = 0; y < 9; y++) { for(int x = 0; x < 9; x++) { Player player; if (attacker.getPieceTypeOnBoardAt(new Point(x, y)) > 0) player = attacker; else player = defender; String str = ""; Boo...
8
@Test public void arithmeticInstr_testInvalidDestinationSourceRef() { //Checks instr. not created with invalid register ref. try { instr = new ArithmeticInstr(Opcode.DIV, 75, 2); } catch (IllegalStateException e) { System.out.println(e.getMessage()); } assertNull(instr); }
1
public static BufferedImage[][] split(BufferedImage source, int xSize, int ySize) { int xSlices = source.getWidth() / xSize; int ySlices = source.getHeight() / ySize; BufferedImage[][] newIm = new BufferedImage[xSlices][ySlices]; for(int x = 0;x < xSlices;x++) { for(int y = 0;y < ySlices;y++) { new...
2
public void runDay() { for(int i=0; i<teller.length; i++) teller[i] = new RoboTeller(); for(int i=0; i<teller.length; i++) teller[i].start(); int done = 0; while(done < teller.length) try{teller[done].join();done++;} catch(InterruptedException e) {} int finalCapital = 0; for(int i=0; i<acco...
5
public void Process(int id){ switch(id){ case 102:ActivateImageSpace(); break; case 141:BasicSpaceReasoning(-5,0);//左 break; case 142:BasicSpaceReasoning(5, 0);//右 break; case 143:BasicSpaceReasoning(0, -5);//上 break; case 144:BasicSpaceReasoning(0, 5);//下 break; case 145:BasicSp...
8
@Override public void action() { ACLMessage msg = myAgent.receive(msgFilter); if (msg != null) { if (msg.getConversationId() == null) { logger.log(Level.WARNING, (teacherSymbol + ": ConversationId == null : sender: " + msg.getSender().getLocalName(...
5
public void setAdminUnitMasterListWithZero( List<AdminUnit> adminUnitMasterListWithZero, AdminUnit foundMaster) { List<AdminUnit> res = new ArrayList<AdminUnit>(); if (adminUnitMasterListWithZero == null) { adminUnitMasterListWithZero = new ArrayList<AdminUnit>(); } // create new AdminUnitType AdminU...
6
private static <E extends Comparable<? super E>> List<LisNode<E>> lis(List<LisNode<E>> n) { List<LisNode<E>> pileTops = new ArrayList<>(); // Sort into piles for (LisNode<E> node : n) { int i = Collections.binarySearch(pileTops, node); if (i < 0) { i = ~i; } if (i != 0) { node....
7
private void createRivers(Map map) { final Specification spec = map.getSpecification(); final TileImprovementType riverType = spec.getTileImprovementType("model.improvement.river"); final int number = getApproximateLandCount() / mapOptions.getInteger("model.option.riverNu...
9
public static boolean isFullMask(int itemID) { for (int i=0; i<fullMask.length; i++) if (fullMask[i] == itemID) return true; return false; }
2
public JobSchedulerBuilder withTriggerGroup( String triggerGroup ) { this.triggerGroup = triggerGroup; return this; }
0
public void update(String str) { System.out.println(str); }
0
private void printCardsOnHand() { o(String.format(" Cards on your Hand: ")); Map<Integer, List<CardInterface>> cards = new HashMap<Integer, List<CardInterface>>(); for (int i = 0; i < Settings.getNationcount(); i++) { cards.put(i, new ArrayList<CardInterface>()); } fo...
4
public Location[] adjacentLocations(){ // Make a new arraylist Location[] locations = new Location[(r == 0 || r == 3) ? 5 : 8]; int count = 0; // Add locations that are in the grid for (int i = r - 1; i < r + 2; i++) { if (-1 < i && i < 4){ for (int j = -1; j < 2; j++){ // Don't add the s...
8
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (rotation == 1) { g.drawLine(0, 100, 80, 100); g.drawLine(120, 100, 200, 100); g.drawLine(120, 78, 120, 122); g.drawLine(80, 78, 80, 122); g.drawLine(80, 78, ...
9
public void addCity(final String cityName, final int surveyInterval) { final String transformedCityName = City.transformCityName(cityName); final int cityId; try { cityId = cityParser.retrieveCityId(transformedCityName); final City city = new City(transformedCityName, ci...
5
@Override public String readLine() throws IOException { final StringBuffer result = new StringBuffer(); try { for (int value; true;) { switch (value = this.readUnsignedByte()) { case '\r': final long cur = this.index(); if (this.readUnsignedByte() == '\n') return result.toString(); th...
6
private static void distribute(final boolean[] higherPriorityCells, final DimensionInfo info, int toDistribute, final int[] widths) { int stretches = 0; for (int i = 0; i < info.getCellCount(); i++) { if (higherPriorityCells[i]) { stretches += info.getStretch(i); } } { final i...
9
@Override public void onStringInput(String input) { System.out.println("Your age is: "+ input); }
0
@SuppressWarnings("unchecked") @Override public B get(A a) { B b = null; try { b = (B) getMethod.invoke(a, new Object[0]); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTra...
3
@Override public OmahaHiLoWorker build() { if (super.getRounds() <= 0) { throw new IllegalStateException("The number of rounds must be a strictly positive number"); } else if (super.getProfiles() == null || super.getProfiles().size() < 2) { throw n...
8
protected HashMap<String, Double> rankChild4StnByHybrid(_Stn stnObj, _ParentDoc pDoc) { HashMap<String, Double> childLikelihoodMap = new HashMap<String, Double>(); double smoothingMu = m_LM.m_smoothingMu; for (_ChildDoc cDoc : pDoc.m_childDocs) { double cDocLen = cDoc.getTotalDocLength(); _SparseFeature...
4
@Override public boolean equals(Object other) { if (other == this) { return true; } if (other instanceof BookModel) { BookModel otherBook = (BookModel) other; boolean isSameClass = this.getClass().equals(otherBook.getClass()); return (this.isbn == otherBook.isbn) && isSameClass; } return false...
3
public static void main(String[] args) { double above = 0.7, below = 0.4; float fabove = 0.7f, fbelow = 0.4f; System.out.println("Math.round(above): " + Math.round(above)); System.out.println("Math.round(below): " + Math.round(below)); System.out.println("Math.round(fabove): " + Math.round(fabove)); System....
0