text
stringlengths
14
410k
label
int32
0
9
public static SanitaryFacilityEnumeration fromValue(String v) { for (SanitaryFacilityEnumeration c: SanitaryFacilityEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
2
@SuppressWarnings("unchecked") @EventHandler public void onSignEdit(SignChangeEvent event){ for(String line:event.getLines()){ for(String word:simplify(ChatColor.stripColor(line)).split("[,./:;-`~()\\[\\]{}+ ]")) if(wordList.fuzzilyContains(word)){ swearReport(event.getPlayer().getName()); event.ge...
6
private static void runEntityProcessorThread() { Thread rawEntityConsumerThread = new Thread(new RawEntityConsumer()); rawEntityConsumerThread.start(); }
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
public String getEmployeeId() { return employeeId; }
0
public ListGroup(TKey key) { this._key = key; }
0
public static void toggleExpansion(Node currentNode, JoeTree tree, OutlineLayoutManager layout, boolean shiftDown) { JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { Node node = nodeList.get(i); if (node.isExpanded()) { node.setExpanded(false, !shi...
3
public void processEntity(Entity entity, long elapsedTime) { Shoot shootComponent = entity.getComponent(Shoot.class); // Decrease their delayed shooting time so that they may be able to // fire again shootComponent.currentWaitingTime -= elapsedTime; if (shootComponent.shootRequired && shootComponent.curre...
2
public static boolean isWin7() { if (os == null) { getOS(); } return (os.contains(WIN7_REGEX)); }
1
public int GetNextbusStop() { //get the next bus stop to visit return nextBusStop; }
0
@Override public void applyDisguise(Collection<Player> players) { UUID uid = new UUIDRetriever(name).getUUID(); GameProfile gp = new GameProfile(uid == null ? UUID.randomUUID() : uid, name); UUIDRetriever.setSkin(gp); EntityPlayer playerEntity = ((CraftPlayer) getPlayer()).getHandle(); EntityPlayer ep = ...
4
public static boolean kick(String[] args, CommandSender s){ //Various checks if(Util.isBannedFromGuilds(s) == true){ //Checking if they are banned from the guilds system s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you believe th...
8
private void updateChanges() { Map<Integer, BoxState> changes = game.getLastChanges(); for (Map.Entry<Integer, BoxState> entry : changes.entrySet()) { int index = entry.getKey(); BoxState state = entry.getValue(); switch (state) { case SAFE: ...
7
public void getNewAbility() { // TODO Auto-generated method stub if(this.getLevel() == 2) { //lightning strike //deals more damage the less hp the opponent has addAbility(new Lightning()); } if(this.getLevel() == 4) { //mass fireball //aoe hits everything addAbility(new MassFireball()); ...
4
private Object callMethod(Method method, String o, Object arg, List<Object> initParametersProcessed) throws TemplateException { if (!((Class<?>) method.getDeclaringClass()).isAssignableFrom(((Class<?>) arg.getClass()))) { throw new TemplateException("Unable to render '\...
9
public static Point calculateIntersectingPoint(Line lineOne, Line lineTwo) { double a1 = lineOne.getA(); double b1 = lineOne.getB(); double c1 = lineOne.getC(); double a2 = lineTwo.getA(); double b2 = lineTwo.getB(); double c2 = lineTwo.getC(); // two lines are p...
6
private void CboxOuderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CboxOuderActionPerformed CboxGezin.removeAllItems(); if (!CboxOuder.getSelectedItem().equals("Onbekend")) { Persoon p = (Persoon) CboxOuder.getSelectedItem(); if (p != null) { ...
3
protected boolean checkForCollision(int[][] tempBlock, int tempX, int tempY) { clearMovingBlocks(tempBlock, 1); for (int i = 0; i < tempBlock.length; ++i) { for (int j = 0; j < tempBlock[i].length; ++j) { //Testing if the block is in the bounds of gamestatus i...
9
public String [] getOptions() { String [] options = new String [9]; int current = 0; options[current++] = "-X"; options[current++] = "" + getCrossVal(); if (m_evaluationMeasure != EVAL_DEFAULT) { options[current++] = "-E"; switch (m_evaluationMeasure) { case EVAL_ACCURACY: options[...
8
public void initInterfaceJeu(){ //HIGHSCORE bestScore = new BPBestScore(); //STATISTIQUE statistique = new BPStatistiques(); // JEU jeu = new PJeuTetris(10,20,new Dimension((int) (this.getWidth()*0.6), (int) (this.getHeight()*0.925))); if (couperSon.isS...
1
@Test public void execute() { LOGGER.info("Starting test execute method..."); AreaLineManager gardenLineManager = new AreaLineManager(); gardenLineManager.initCommands(); String result; // 1. null input LOGGER.debug("testing null input..."); try { result = gardenLineManager.execute(null); assertEq...
7
public void mReleased(MouseEvent e) { if(rdown) { PermClass nodeToAdd = getClassUnderPoint(e.getX(), e.getY()); if(nodeToAdd != null) { boolean shouldAdd = true; if(nodeToAdd == selectedOne) { shouldAdd = false; } for(PermClass is : selectedOne.inheritsFrom) { ...
6
@Override public String analyze_round( List<Submission> list ) { if ( list.isEmpty() ) return null; List<Submission> trumps = is_suit(list, trump()); if (trumps.size() == 1) { return trumps.get(0).who; } if ( !trumps.isEmpty() ) { return is_rankier(tr...
5
public final void need(int count) throws VerifyException { if (stackHeight < count) throw new VerifyException("stack underflow"); }
1
public void getNextMovesBack(List<State> nextStates) { // for each box. Chech which boxes we can reach // box : The current box we are looking at for (Position box : boxes) { // for each empty position adjucent to this box // adjucent : the current adjucent position to t...
5
private void analyzeUtility() { if (getKingLocation( playerToMove.equals(KrakenColor.WHITE_PLAYER)? KrakenColor.BLACK_ITEM:KrakenColor.WHITE_ITEM) == null || actions(playerToMove.toLowerCase()).size()<1) utility = playerToMove.equals("W")? 1:0; }
4
public double weightedStandarError_as_Complex_ConjugateCalcn() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } boolean hold2 = Stat.nEffOptionS; if (nEffReset) { if (nEffOptionI) { St...
7
public Point getInitialP() { return initialP; }
0
public boolean checkVictory() { int yourLocation = yourPaddle.getPosition()[0]; int yourSize = Paddle.getSize()[0]; int[] ballLocation = ball.getPosition(); int radius = Ball.getSize(); if (ballLocation[1] < 300) { if (ballLocation[0] > 155 + radius && ballLocation[0] < 445 - radius) { if (ballLo...
5
public boolean equals(Object o) { if(o instanceof IMessage && o!=null) { IMessage c=(IMessage)o; if(c.taille()==this.taille()) { boolean trouve=false; int i=0; while(i<this.taille() && !trouve) { if(c.getChar(i)!=this.getChar(i)) { trouve=true; } i++; } return !trouve; ...
6
public int removeDuplicates(int[] A) { if(A ==null || A.length ==0) return 0; int index =1; boolean flag = true; for (int i = 0;i < A.length-1 ;i++){ if(A[i] != A[i+1]){ flag = true; A[index++] = A[i+1]; }else if(flag){ ...
5
public static Double caculate(Model m, List<String> observe) { List<Double> initial = m.pi; List<Double> temp = new ArrayList<Double>(); Double result = 1d; for (String s : observe) { int index = m.V.indexOf(s); result *= Matrix.multiply(initial, m.B.get(index));...
2
public static void main(String[] args) { long start = System.nanoTime(); int totalSum = 0; for (Integer i = 2; i <= 194979; i++) { String intStr = i.toString(); int strLen = intStr.length(); int sum = 0; for (int k = 0; k < strLen; k++) { int num = Character.getNumericValue(intStr.charAt(k)); ...
3
@Override public Object getValueAt(int row, int col) { int round = currentRound + ( row / teamsPerTable ); int table = ( col - 1 ) / 2; if(col == 0) { if(row == 0) return "Playing:"; if(row == teamsPerTable) return "Next:"; } else if((col-1) % 2 == 0) { if(row == 0) return tableNames[(c...
8
private TreeNode rotateLeft(TreeNode rotatingNode) { TreeNode rotatedTreeRootNode = rotatingNode.right; rotatedTreeRootNode.parent = rotatingNode.parent; rotatingNode.right = rotatedTreeRootNode.left; if (rotatingNode.right != null) { rotatingNode.right.parent = rotatingNode; } rotatedTreeRootNode.le...
4
public final void show() { StackPane parentRoot = (StackPane) ((Stage) stage.getOwner()) .getScene().getRoot(); parentRoot.getChildren().add(mask); stage.show(); }
0
public static HardwareAddress getHardwareAddressByString(String macStr) { if (macStr == null) { throw new NullPointerException("macStr is null"); } String[] macAdrItems = macStr.split(":"); if (macAdrItems.length != 6) { throw new IllegalArgumentException("macStr["+macStr+"] has not 6 items"); } byte[...
5
public void install() { try { if (plugin.getConfig().getBoolean("internet")) { try { String path = plugin.getDataFolder().getParent(); if (download(path)) { plugin.getLoggerUtility().log("Downloaded new Version!", Logger...
9
private void scanColorUnit(JPEGBitInputStream bis, Set<Integer> color_ids, Map<Integer, Integer> dc_base) throws MarkAppearException, IOException { // 对颜色空间进行扫描 for (int color_id : color_ids) { JPEGImage.JPEGLayer layer = mImg.getLayer(color_id); // 对每一种颜色的采样值进行扫...
6
public Items getLast() { return last; }
0
public void restoreStatus(){ // EDebug.print("I am mucking with that data structure."); if (myDeck.size() == 0) return; Automaton p = null; while (myDeck.size() > 0 && (p = myDeck.pop()).hashCode() == myMaster.hashCode()); // EDebug.print("Master's hash i...
6
private boolean equals( final Data item, final InnerDataSubscription subscription, final SystemObject transactionObject) { final SystemObject requiredObjectType = item.getReferenceValue("ObjektTyp").getSystemObject(); if(requiredObjectType != null && !subscription.getObject().getType().equals(requiredObjectType)...
8
static LinkedHashSet<EXECUTION_MODE> getDefaultExecutionModes() { LinkedHashSet<EXECUTION_MODE> defaultExecutionModes = new LinkedHashSet<EXECUTION_MODE>(); if (OpenCLLoader.isOpenCLAvailable()) { defaultExecutionModes.add(GPU); defaultExecutionModes.add(JTP); } else ...
8
public void stopGather(Player p) { if (registry.getGameController().multiplayerMode != registry.getGameController().multiplayerMode.CLIENT) { Resource resource = null; try { for (String key : resources.keySet()) { resource = (Resource) resources.get(ke...
7
public int compare(JAFieldDescription field1, JAFieldDescription field2) { Integer order1 = (field1.hasView()) ? (field1.getView().getOrder()) : -1; Integer order2 = (field2.hasView()) ? (field2.getView().getOrder()) : -1; if ((order1 >= 0) && (order2 < 0)) { return 1; } if ((order2 >= -1) && (order1 < ...
8
protected void checkFlush(Texture sprite) { if (sprite == null) throw new NullPointerException("null texture"); // we need to bind a different texture/type. this is // for convenience; ideally the user should order // their rendering wisely to minimize texture binds ...
3
@Override public String infix_toString(){ String representation = root.name; if(children.length != 0){ representation += "["; for(int index = 0; index < children.length; index++){ representation += children[index].toString(); } representation += "]"; } return representation; }
2
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int times = Integer.parseInt(line.trim()); for (in...
7
public void setId(int id) { this.id = id; }
0
public String translate(final String key) { final String pattern = this.base.getString(key); if (pattern.equals("")) { this.plugin.getLogger().log(Level.FINEST, "String value not found for {0} in {1}", new Object[] { key, ( this.base.getCurrentPath().equals("") ? "(root)" : this.base.getCurr...
3
@Test @TestLink(internalId = 5) public void testSuccessInternal2() { assertTrue(true); }
0
public void doAction() { // Verificar se não existe toca if( isTocaNull() ) { // Incrementar número de vezes em que se comeu toca permanente e correr método de adição if( getEngine().getTocaPermanente().check() ) { numTocaPermanenteComida++; add(); } return; } // Verificar se não com...
6
public String getSpNum() { return spNum; }
0
public void setLength(double value) { if (value <= 0) { throw new IllegalArgumentException( "Illegal length, must be positive"); } else { length = value; weight = calculateTotalWeight(); } }
1
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Specialty)) { return false; } Specialty other = (Specialty) object; if ((this.id == null && other.id != null) |...
5
@Override public boolean waitForCardPresent(long timeout) throws CardException { long sleeptime = timeout / POLLING_INTERVAL; for (short i = 0; i < POLLING_INTERVAL; i++) { if (isCardPresent()) return true; try { Thread.sleep(sleeptime); } catch (InterruptedException e) { break; } } ret...
3
public boolean caricaLista() { try { f1 = new FileReader("parole.txt"); fIN = new BufferedReader(f1); try { int l = 0; while (fIN.readLine() != null) { l++; } ...
5
@Override public int open(JoeTree tree, DocumentInfo docInfo, InputStream stream) { FileFormatManager manager = Outliner.fileFormatManager; String extension = getExtension(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_PATH)); OpenFileFormat format = null; String format_name = null; ...
1
public static void main(String[] args) { // Working with Method Parameters and Return Types System.out.println("string"); String name = "Madalin"; int nameLength = name.length(); System.out.println(nameLength); }
0
@Override public boolean hit(Ray ray, ShadeRec sr, FloatRef tmin) { float t = subtract(p0, ray.getOrigin()).dot(normal) / ray.getDirection().dot(normal); if (t <= K_EPSILON) return false; Vector3 p = ray.pointAt(t); Vector3 d = subtract(p, p0); double ddota = d...
5
private void buildHeap(int index) {// using postOrder if (index + 1 > size) return; buildHeap(2 * index + 1); buildHeap(2 * index + 2); trickleDown(index); }
1
private void animateNextFrame() { // Animate next frame on buffer Graphics2D g = (Graphics2D) buffer.getDrawGraphics(); drawFrame(g); // Display the buffer if (!buffer.contentsLost()) { buffer.show(); } g.dispose(); // Repainting solves the problem of the applet not updating properly // on the Red ...
1
public void doCSVHeaderAndTrailer() { try { final String mapping = ConsoleMenu.getString("Mapping ", CSVHeaderAndTrailer.getDefaultMapping()); final String data = ConsoleMenu.getString("Data ", CSVHeaderAndTrailer.getDefaultDataFile()); CSVHeaderAndTrailer.call(mapping, dat...
1
public final String getDisplay() { String data; data = "Welcome to Kohl's. Expect Great Things \n"; data += "------------------------------------------- \n"; data += "Customer Name: " + customer.getCustName() + "\n"; data += "Date of Purchase: " + formattedDate + "\n"; da...
1
public static Maze parseMaze(String filename) throws IOException{ /* Parse to lines of strings */ List<String> mazeText = new ArrayList<String>(); BufferedReader br = new BufferedReader(new FileReader(filename)); String line; int mazeHeight = 0; int mazeWidth = 0; while ((line = br.readLine()) != null) { ...
6
public void testAllPairs(File file){ try { Scanner scan = new Scanner(file); while(scan.hasNextLine()){ String[] line = scan.nextLine().split("\t"); if(line.length != 2) continue; int ip = stringToIP(line[0].trim()); String host = line[1].trim(); if(!testPair(ip, host)){ System.out.prin...
5
public void work(Contract... contracts) { // do the most risky jobs first int maxRisk = Integer.MIN_VALUE; int riskIndex = 0; boolean theresJobToBeDone = true; while (theresJobToBeDone) { for (int i = 0; i < contracts.length; i++) { Contract contract = contrac...
8
public static void getFilesHashAndUpdate(EcProrgressBar bar,EcButton btn,EcServerButton aquilla) throws NoSuchAlgorithmException, IOException { UpdateUtils.bar = bar; UpdateUtils.btn = btn; UpdateUtils.aquilla=aquilla; aquilla.setEnabled(false); btn.setEnabled(false); upd...
8
private static void generateRandomTree(World world){ BlockLog b = null; TileMap tm = world.tileMap; for(int numTrees = 0; numTrees < 4; numTrees++){ int x = new Random().nextInt(tm.getXRows()); int y = new Random().nextInt(tm.getYRows()); for(int numLogs = 0; numLogs < 3; numLogs++){ if(y - numL...
4
public RegistrantList getRegistrantList(int aiMaxSize, String asLastModified) { String lsParam = ""; if (aiMaxSize > 0) { lsParam += "&max_size=" + Integer.toString(aiMaxSize); } if (UtilityMethods.isValidString(asLastModified)) { lsParam += "&last_modified=" + as...
3
static private boolean jj_3R_16() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(43)) { jj_scanpos = xsp; if (jj_scan_token(40)) { jj_scanpos = xsp; if (jj_scan_token(28)) { jj_scanpos = xsp; if (jj_scan_token(44)) { jj_scanpos = xsp; if (jj_scan_token(39)) { jj_scanpos...
9
public static String GetDzienNoc() { String dziennoc; Calendar cal = Calendar.getInstance(); int s = cal.get(Calendar.HOUR_OF_DAY); int p; int dn; dn = 0; if (s>=19) { p = 5; dn = 0; } else { ...
7
@Override public int getAbilityFlagType(String strflag) { for (final String element : Ability.ACODE_DESCS) { if(element.equalsIgnoreCase(strflag)) return 1; } for (final String element : Ability.DOMAIN_DESCS) { if(element.equalsIgnoreCase(strflag)) return 2; } if(strflag.startsWith("!")) ...
8
@Override public String toString() { return nom; }
0
private synchronized void containMouse(int x, int y){ Window w = sm.getFullScreenWindow(); if(robot != null && w.isShowing()){ finalPos.x = x; finalPos.y = y; SwingUtilities.convertPointToScreen(finalPos, w); robot.mouseMove(x, y); } }
2
public void setProgress(String oid, String progress) { Objective o = q.getObjective(oid); if(o == null) throw new IllegalArgumentException("Quest \"" + q.getName() + "\" has no such objective: " + oid); if(!o.getType().isValid(progress)) throw new IllegalArgumentException("progress is not valid for type " ...
7
private static Pair<Integer, Integer> findNest(String value, int target, boolean fromEnd){ int lastFound = Integer.MIN_VALUE; int nest = 0; for(int i = 0; i < value.length(); i++){ int search = fromEnd ? value.length() - 1 - i : i; if(value.charAt(search) == '('){ nest++; } else if(value.charAt(se...
5
public JCellule[][] getGrid() { return cellules; }
0
@Override public void rout(NetworkPacket networkPacket) throws IOException { if (networkPacket.isFlagSet(NetworkPacket.ARP)) { if (!networkPacket.getSourceAddress().equals(networkInterface.getLocalHost())) { networkInterface.process(networkPacket); if (networkPacket.getHopcount() > 0) { networkP...
9
private void preOrderRec(Position<T> node) throws InvalidPositionException { if (node != null) { BTPosition<T> BTnode = checkPosition(node); System.out.print(node.element() + " "); preOrderRec(BTnode.getLeft()); preOrderRec(BTnode.getRight()); } }
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just did the holy cross attack!"); return random.nextInt((int) agility) * 3; } return 0; }
1
public boolean isInterleave(String s1, String s2, String s3) { int m = s1.length(); int n = s2.length(); if(m + n != s3.length()) return false; //dp[i][j]: s1[0...i-1],和s2[0...j-1]可以交错匹配s3的最长长度 int dp[][] = new int[m+1][n+1]; dp[0][0] = 0; //初始化第一列,即只用s1 ...
9
public void loadConfig(String config){ int configlength = config.length(); for (int i = 0; i < 369; i++){ int[] xy = indexToXY(i); int x = xy[0]; int y = xy[1]; String cellValue = ""; if (i < configlength){ char configValue = config.cha...
5
private int validateSkill(String skillName, MainMenuHeroSlot temp) { for(int p = 0; p < temp.getcharacter().getSkillNames().length; p++) { if(temp.getcharacter().getSkillNames()[p].getDesc().equalsIgnoreCase(skillName)) return p; } // End for return -1; }
2
@EventHandler public void onPlayerMove(PlayerMoveEvent event) throws IOException { Player player = event.getPlayer(); String playerName = player.getName(); if (!statusData.containsKey(playerName)) { statusData.put(playerName, false); } Block block = player.getWorl...
6
private mxCell addNode(mxGraph graph, Object parent, mxGraphMlNode node) { mxCell v1; String id = node.getNodeId(); mxGraphMlData data = dataNodeKey(node); if (data != null && data.getDataShapeNode() != null) { Double x = Double.valueOf(data.getDataShapeNode().getDataX()); Double y = Double.valueOf(d...
3
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { if (response instanceof HttpServletResponse && request instanceof HttpServletRequest) { HttpServletRequest httpRequest = (HttpServletRequest) request; HttpServletR...
8
public final ObjectProperty<ToggleGroup> toggleGroupProperty() { if (null == toggleGroup) { toggleGroup = new ObjectPropertyBase<ToggleGroup>() { private ToggleGroup oldToggleGroup; @Override protected void invalidated() { final ToggleGroup toggleG...
5
private static void setMapping(){ obsMapping = new SimpleBindings(); // creates an arrayList to contain the elements InputStreamReader isReader= new InputStreamReader(Obstacle.class.getClassLoader().getResourceAsStream(pathAttr)); try (BufferedReader reader = new BufferedReader(isReader)) { String line = re...
2
public static Iterator sqlQuery(Proposition proposition, LogicObject database, Stella_Object arguments) { RDBMS.checkForExternalDbUpdates(proposition, database); { MemoizationTable memoTable000 = null; Cons memoizedEntry000 = null; Stella_Object memoizedValue000 = null; if (Stella.$MEMOIZATIO...
7
public void recoverGoal(GoalDecider goalDecider) { Unit.MoveType mt; if (cost == CostDecider.ILLEGAL_MOVE && unit != null && current.getTile() != null && dst.getTile() != null && goalDecider != null && goalDecider.ch...
8
public void disconnect(String reason){ client.getSession().disconnect(reason); world = null; }
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 String buildString() { StringBuffer builder = new StringBuffer(); if (!StringUtils.isBlank(this.protocol)) { builder.append(protocol); builder.append("://"); } if (!StringUtils.isBlank(this.host)) { builder.append(this.host); if (this.port > 0) { builder.append(":"); builder.append(t...
5
public Object setMnemonic(String section,String tool,int key) { int i; for(i=0;i<_tb.size() && !_tb.get(i).name().equals(section);i++); if (i==_tb.size()) { return null; } else { toolbarSection sec=_tb.get(i); for(i=0;i<sec.size() && (sec.get(i)==null ? true : (!sec.get(i).getName().equals(tool))) ;i++...
9
private float mtmWeights(float rate){ /* Link rate | MTM Weights | * ---------------------------------- * 11 | 1 | * 5.5 | 1.44 | * 2 | 3 | * 1 | 5.45 | * */ if(rate == 11f) return 1f; if(rate == 5.5f) return 1.44f; if(rate == 2f) return 3f; if(rate == 1f) ...
4
private void paintBalls(Graphics g) { for (Ball b: com.github.abalone.elements.Board.getInstance().getBalls() ) { Coords ballCoords = b.getCoords(); Coords coords; if ( this.reversed ) coords = new Coords(-ballCoords.getRow(), ballCoords.getCol()); else ...
5
public static void main(String[] args) { String count = "unknown"; switch (args.length) { case 0: count = "zero"; break; case 1: count = "one"; break; case 2: count = "two"; break; } switch (args.length) { case 200000: count = "two...
8
public AdditionProblem(int aNew, int bNew){ a = aNew; b = bNew; String tempaBinary = Integer.toBinaryString(a); String tempbBinary = Integer.toBinaryString(b); checkValue = a+b; diff = Math.abs(tempaBinary.length() - tempbBinary.length()); String temp = ""; for(int i = 0; i < diff; i++){ temp += "0...
5
@Override public void run(){ System.out.println("RUN THREAD?"); if(this.type == 1) runRequestGenerator(); else runFailureGenerator(); if(this.type == 1) try { fis.append("Thread: "+ this.getId() + "\n"); fis.append("Clients: " + this.numberClients + "\n"); fis.append("Requests: " + this....
6