text
stringlengths
14
410k
label
int32
0
9
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (label.equalsIgnoreCase("tenki")) { if (sender instanceof Player) { Player player = (Player) sender; if (args.length == 0) { player.sendMes...
6
public double getOut4Organism() { double out = 0.0; for (int i = 0; i < outNodes.size(); i++) { out += outNodes.get(i).getPotential(); } return out; }
1
public static Object newProxyInstance(Class<?> superclass, Class<?>[] interfaces, InvocationHandler h) throws ExportException { HandlerAdapter ha = new HandlerAdapter(h, superclass, interfaces); if (interfaces != null) { Class<?>[] source = interfaces; interfaces = new Class<?>[...
8
public boolean isOfType(Type type) { return (type.typecode == TC_INTEGER && (((IntegerType) type).possTypes & possTypes) != 0); }
1
@Override public void keyPressed(KeyEvent e) { //Uso del teclado para la traslacion //tecla z y x para la traslacion en 'Z' int keyCode = e.getKeyCode(); switch( keyCode ) { case KeyEvent.VK_UP: transformaciones.Traslacion(0, -15, 0); brea...
6
@Override public T pull() throws InterruptedException { updateLength(-1); return taskSupplier.pull(); }
0
private boolean isMoving(){ if(state == StateActor.UP || state == StateActor.DOWN || state == StateActor.LEFT || state == StateActor.RIGHT){ return true; } else return false; }
4
public String displayGW_ShoreMMSI (List<Integer> mm,int totalDigits) { StringBuilder sb=new StringBuilder(); int a,digitCounter=0; for (a=0;a<6;a++) { // High nibble int hn=(mm.get(a)&240)>>4; // Low nibble int ln=mm.get(a)&15; // The following nibble int followingNibble; // Look at the next...
6
public String getHost() { return host; }
0
public void mousePressed(int button,int x,int y){ if(xpos >= Button.GAME_WIDTH/2-replayWidth/2 && xpos <= Button.GAME_WIDTH/2+replayWidth/2 ){ if(ypos >= Button.GAME_HEIGHT/2+100 && ypos <= Button.GAME_HEIGHT/2+100+replayHeight){ mousePress = true; } } }
4
private String removeDuplicateCharacters(String s) { Set characters = new HashSet(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i++) { Character c = new Character(s.charAt(i)); if (characters.add(c)) sb.append(c.charValue()); } return sb.toString(); }
2
public void set_field( String section, String field, String data ) throws NullPointerException { Hashtable s; if( section== null || field == null ) throw new NullPointerException(); s = (Hashtable) sections.get(section); if(s==null) { s = new Hashtable(); sections.put(section, s); } s.put(field, data...
3
public static int prevenirHostChanged(String id) { // previens une machine que cette machine remplace m pour le paquet d'id // Id SocketChannel clientSocket; Paquet p = Donnees.getHostedPaquet(id); int placeToModify = p.power; LinkedList<String> table = new LinkedList<String>(); for (int i = 0; i < Globa...
8
public Builder electricCharge(int receivedElectricCharge) { if (receivedElectricCharge < 0) { this.population = -receivedElectricCharge; return this; } this.electricCharge = receivedElectricCharge; return this; }
1
public void testGetPartialConverterRemovedNull() { try { ConverterManager.getInstance().removePartialConverter(NullConverter.INSTANCE); try { ConverterManager.getInstance().getPartialConverter(null); fail(); } catch (IllegalArgumentException ex...
1
public void addUnsearchList(String url){ if(url.length() > DB_URL_CHAR_SIZE){ log.warn("URL size is too long: "+url); return; } // List<SqlParameter> sqlParamList = new LinkedList<SqlParameter>(); // sqlParamList.add(new SqlParameter(Types.VARCHAR, url)); // sqlParamList.add(new SqlParameter(Types.VARCHAR,...
1
public void start() { if ( isRunning ) return; run(); }
1
@Override public void validate() { if (platform == null) { addActionError("Please Select Platorm"); } if (location == null) { addActionError("Please Select Location"); } if (iphone.equals("Please select")) { addActionError("Please Sele...
5
public EventService(EntityManager manager, EntityTransaction tx){ this.manager = manager; this.tx = tx; }
0
public void installAndMakeSelecatable(AID packageAID, AID appletAID, AID instanceAID, byte privileges, byte[] installParams, byte[] installToken) throws GPException, CardException { if (installParams == null) { installParams = new byte[] { (byte) 0xC9, 0x00 }; } if (instanceAID == null) { instanceAID = a...
5
static public void testStorage(Storage storage, String fileName) throws IOException { int entryCount, uniqueWordsCount; long start, end; BufferedReader br = new BufferedReader(new FileReader(fileName)); String line = br.readLine(); String[] words; Matcher matcher; ...
3
@Test public void onlyBishopOnFilledBoard() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(BISHOP.toString(), 2); Chessboard chessboard = Chessboard.newBuilder(figureQuantityMap).withDimension(DIMENSION_6).withBishop().build(); assertThat("all elem...
7
public static boolean removeContactAcct(String contactID,int index){ boolean status = false; AddressBook addressBook = Helpers.getAddressBook(); if (addressBook == null) { System.out.println("removeContactAcct - addressBook returns null"); return false; } ...
5
public void actionPerformed(ActionEvent event) { Date now = new Date(); System.out.println("At the tone, the time is " + now); if (beep) Toolkit.getDefaultToolkit().beep(); }
1
public void updateDirection() throws BadMoveException { if(start.row == end.row && start.column == end.column) { throw new Board.BadMoveException("Bad move initialized"); } if(start.column == end.column) { if(start.row > end.row) { direction = Direction.UP; } else { direction = Direction.DOWN;...
9
public String getName() { if (isFree) { return ("FREE"); } if (isInvalid) { return ("INVALID-CONSTANT"); } return name; }
2
protected void loadReactionlikeEvent2CatalystActivity() { String name = "ReactionlikeEvent_2_catalystActivity"; String fileName = dirName + name + ".txt"; if (verbose) Timer.showStdErr("Loading " + name + " from '" + fileName + "'"); int i = 1; for (String line : Gpr.readFile(fileName).split("\n")) { // P...
7
private String prepareConfigString(String configString) { int lastLine = 0; int headerLine = 0; String[] lines = configString.split("\n"); StringBuilder config = new StringBuilder(""); for(String line : lines) { if(line.startsWith(this.getPluginName() + "_COMMENT")) { String comment = "#" + l...
8
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); Outliner.documents.addOutlinerDocumentListener(this); Outliner.documents.addDocumentRepositoryListener(this); setEnabled(false); }
0
public void setTaintWrapper(ITaintPropagationWrapper taintWrapper) { this.taintWrapper = taintWrapper; }
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
@Test public void canGetProductsByCost() { ProductModel addedProduct = ProductModel.builder("Night Visions", 1) .description("Imagine Dragons").cost(149).rrp(400).build(); List<ProductModel> products = null; boolean isInResult = false; try { addedProduct = new ProductModel(insertProduct(addedProduct), ...
3
public static final Method getMethod(final Class clazz, final String methodName, Class... parameters) { parameters = parameters == null ? new Class[0] : parameters; Method method = null; try { method = clazz.getMethod(methodName, parameters); } catch (NoSuchMethodException e)...
9
@Override public void paintComponent(Graphics g) { super.paintComponent(g); // redraw paint method. so it doesnt draw on // top of each other mainMenuObj.menuMessage(mx, g); if (currentMode.equals(mode1)) { // MainMenu mainMenuObj.paint(g, hoverLeft); } else if ...
8
@Override public void doAction (String o) { setVisible(false); dispose(); }
9
public ExtraLife(int courtWidth, int courtHeight, int INIT_X) { super(INIT_VEL_X, INIT_VEL_Y, INIT_X, INIT_Y, SIZE, SIZE, courtWidth, courtHeight); try { if (img == null) { img = ImageIO.read(new File(img_file)); } } catch (IOException e) { System.out.println("Internal Error:" + e.getMessage()); ...
2
public void filter(List<String> guessHistory, List<String> feedbackHistory) { Iterator<String> it = possibleAnswer.iterator(); int i = feedbackHistory.size() - 1; if (i >= guessHistory.size()){ return; } String gs = guessHistory.get(i); String fb = feedbackHistory.get(i); for (int coun...
4
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 157 // do, line 159 v_1 = cursor; lab0: do { // call prelude, line 159 if...
8
public ArrayList<Meld> getInitialMeld() throws Exception{ ArrayList<Meld> melds; int score; melds = getGroups(); melds.addAll(getRuns()); melds = findLargestSubset(new ArrayList<Tile>(this.getTiles()), new ArrayList<Tile>(), melds); if(melds == null) return null; score = 0; for(int i=0; ...
5
public void updateCraftingResults() { for(int var1 = 0; var1 < this.inventorySlots.size(); ++var1) { ItemStack var2 = ((Slot)this.inventorySlots.get(var1)).getStack(); ItemStack var3 = (ItemStack)this.inventoryItemStacks.get(var1); if(!ItemStack.areItemStacksEqual(var3, var2)) { ...
4
public Object[][] updateAccountManagerTableView() { Collection<User> users = instance.getUsers(); //calculate number of rows int rows = 0; for (User user : users) { if (!user.isActiveCustomer()) { rows++; } for (Account acc : user.getAc...
9
public String getFullHouse() { String stt = "0"; //search for a set (three of a kind) and a pair. if found, we probably have a winner :D if (cards[0].getRank() == cards[1].getRank() && cards[1].getRank() == cards[2].getRank()) { if (cards[3].getRank() == cards[4].getRank()) { ...
6
public static DeckArrayManager getDeckArrayManager() { if (instance == null) { instance = new DeckArrayManager(1); log.debug("[DeckArrayManager] inside getter() method"); } return instance; }
1
public Product(Character productCode) { prices = new TreeMap<Integer, BigDecimal>(); this.productCode = productCode; }
0
@Test public void testQueueUsage() { Thread testThread = new Thread(pipelinedFDstage); //A thread running through pipelined FDstage. testThread.start(); //Start the thread, which runs until interrupted (execute stage is responsible for terminating int opcodeValue = 0; for (int i = 0; i < 10; i ++) { //There a...
3
public static String longToName(long longName) { try { if (longName <= 0L || longName >= 0x5b5b57f8a98a5dd1L) return "invalid_name"; if (longName % 37L == 0L) return "invalid_name"; int i = 0; char name[] = new char[12]; while (longName != 0L) { long n = longName; longName /= 37L; n...
5
@Override public boolean colides(SchlangenKopf head) { if (!super.colides(head)) { head.die(); return true; } return false; }
1
@Override public void dispose () { super.dispose(); if (this.conn != null) { try { if (this.conn.isClosed() == false) { this.conn.close(); } } catch (SQLException ex) { LOGGER.warning("Unable to clo...
3
public static void processAction(Object container,SwingWorkerInterface swingworker){ ActionProcessor processor=new ActionProcessor(); try{ try { if(!swingworker.proceed()){ return; } processor.initCompsAndValidate(container,swingworker); ...
8
public double teaTypeInfo() { double result = 0.0; double blackTeaSize = 0.0; double blackGood = 0.0; double blackBad = 0.0; double whiteTeaSize = 0.0; double whitekGood = 0.0; double whiteBad = 0.0; double greenTeaSize = 0.0; double greenGood = 0.0; double greenBad = 0.0; for (Tea t : trainingSet...
7
public final void setProgress(int var1) { if(!this.minecraft.running) { throw new StopGameException(); } else { long var2; if((var2 = System.currentTimeMillis()) - this.start < 0L || var2 - this.start >= 20L) { this.start = var2; int var4 = this.minecraft.w...
5
public String longestPalindrome(String s) { // Start typing your Java solution below // DO NOT write main() function if (s == null || "".equals(s.trim())) return s; for (int i = s.length() ; i >= 1 ; i-- ) { for (int j = 0; j < s.length() - i + 1 ; j ++ ) { if (checkPal...
5
public static void main(String[] args) { int input=1000000; ArrayList<Integer> prime=new ArrayList<Integer>(); prime.add(3); prime.add(5); int primes= 3; //long start=System.currentTimeMillis(); long startTime = new Date().getTime(); boolean temp=false; for(int i=7; i<=input; i+=2){ ...
5
public Diff getDifForDirection() { Diff diff = null; switch (this) { case UP: diff = createDiff(0, -1); break; case DOWN: diff = createDiff(0, 1); break; case RIGHT: diff = createDiff(1, 0); break; case LEFT: diff = createDiff(-1, 0); break; } return diff; }
4
private BasicComboBoxRenderer dayRenderer() { BasicComboBoxRenderer renderer = new BasicComboBoxRenderer(){ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(...
2
@SuppressWarnings({ "rawtypes", "unchecked" }) public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException{ resp.setContentType("text/html"); resp.setCharacterEncoding("utf-8"); Cache cache = null; try { CacheFactory cacheFactory = CacheManager.getInstance() .getCacheFactory(...
2
public static List<Appointment> findByDay(long uid, long day) throws SQLException { List<Appointment> aAppt = new ArrayList<Appointment>(); // once aAppt.addAll(Appointment.findOnceByDaySpan(uid, day, day)); // daily aAppt.addAll(Appointment.findDailyByDaySpan(uid, day, day)); // weekly aAppt.addAll...
0
public void commit() { // if you haven't committed anything in 10,000 cycles, simulator is probably deadlocked --> kill SimAssert.check(((currCycle - lastCommitCycle) < 10000), "Deadlock! no commits in 10K cycles", currCycle); for (int i = 0; i < machineWidth; i++) { ...
7
public static void main(String[] args){ for(int i= 20*19; i<Integer.MAX_VALUE; i++){ //will go through all integers until it reaches an answer boolean goodnum = true; //if it is the right number for(int j = 20; (goodnum == true) && (j>0); j--){ //goes through from 20 to 1 and tests if it is divisible, if not, i...
5
public Set<Map.Entry<Byte,V>> entrySet() { return new AbstractSet<Map.Entry<Byte,V>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TByteObjectMapDecorator.this.isEmpty(); } public bool...
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb = new JSONObject(); String userId = request.getParameter("userId"); String dateTimeInMillis = request.getParameter("dateTimeInMillis"); dat...
3
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || this.length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this....
4
public void dijkstra(int s) { PriorityQueue<Edge> q = new PriorityQueue<Edge>(); q.add(new Edge(s, 0)); dis[s] = 0; while (!q.isEmpty()) { Edge cur = q.poll(); if (vis[cur.id]) continue; vis[s] = true; for (int i = 0; i < adj[cur.id].size(); i++) { Edge neigh = adj[cur.id].get(i); if (!v...
5
@Override public void init(List<String> argumentList) { lineNumber = Integer.parseInt(argumentList.get(0)); }
0
private void give(String name, int amount, String playerName, CommandSender sender){ Player player = Bukkit.getPlayer(playerName); if(!player.getName().equals(sender.getName())){ if(!sender.hasPermission(pluginMain.pluginManager.getPermission("thf.give.others"))){ sender.sendMessage(ChatColor.DARK_RED + "You...
5
private int jjMoveStringLiteralDfa14_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(12, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(13, active0); return 14; } switch(curChar) { case 1...
6
public static int parseString(StringBuilder sb, String[] args, int offset) { // string is empty? return an empty string if (offset >= args.length || args[offset].isEmpty()) { sb.append(""); return 1; } // first char is not a quote char? return the str...
9
public int getScore(final List<Vraag> vragen) { int vragenGoed = 0; for (Vraag vraag : vragen) { int aantalGoed = 0; int aantalFout = 0; int jokers = vraag.getHoeveelJokersGebruikt(); for (GekozenAntwoord gk : vraag.getGekozenAntwoorden()) if (gk.isGoed()) aantalGoed++; else aantalFout++; ...
6
public void perteTerritoire(Territoire t) { int unite = t.getNbUnite(); /* Recherche dans les bonus s'il faut défausser une unité ou non */ //if (unite > 1) { << TODO: Utilité du if ? if( !( this.bonusDefausseUnite() || (hasPower() && pouvoir.bonusDefausseUnite()) ) ){ unite--; this.nbUnite--; ...
3
public void mouseReleased(MouseEvent me) { Node mouseNode = getMouseNode(); if(me.getButton() == MouseEvent.BUTTON1) { target = mouseNode; System.out.println("Target pos set to: x= "+mouseNode.getX()+", y= "+mouseNode.getY()); if(start != null) { clearPath(); AStar.findPath(start.getX(), start.getY...
3
public static void add(short magic, Class clazz) { if(magic < MIN_CUSTOM_MAGIC_NUMBER) throw new IllegalArgumentException("magic ID (" + magic + ") must be >= " + MIN_CUSTOM_MAGIC_NUMBER); if(magicMapUser.containsKey(magic) || classMap.containsKey(clazz)) alreadyInMagicMap(magic,...
8
private int checkChar(char c) { switch (c) { case '{': return 1; case '[': return 2; case '\"': return 3; case '-': return 4; case '}': case ']': return 6; default: { if (Character.isDigit(c)) return 4; ...
8
public void handleCommand(Message message) { if(!conn.isConnected()) return; String body = message.getBody(); if(body.startsWith(prefix)){ body = body.substring(prefix.length()); }else{ //(message.getBody().startsWith(connection.getNick()){ body = body.substring(conn.getNick().length()); if(body.match...
9
public static List<List<Integer>> subsets(int[] S) { Arrays.sort(S, 0, S.length); List<List<Integer>> res = new ArrayList<List<Integer>>(); List<Integer> n = new ArrayList<Integer>(); res.add(n); for (int i : S) { int len = res.size(); for (int j = 0; j < len; j++)...
3
private LinkedList generatecontent() { int maxitems=0; LinkedList loot = new LinkedList(); //Maximale Anzahl von Items in einer Kiste int randmax = UtilFunctions.randomizer(1, 100); if (randmax <80) { maxitems=1; } else if (randmax >...
9
public void checkActive() { if (building.requires.length > 0 && !castle.getBuildings().containsAll(Arrays.asList(building.requires))) { buy.setEnabled(false); String requirestr = "<i>Wymaga: "; Set<core.CastleBuilding> diff = new HashSet<core.CastleBuilding>(Arrays.asList(building.requires)); diff.re...
9
protected void createCalendarDoc() { try { /** * Clear the document. Required for date roll overs. */ document.remove(0, document.getLength()); /** * Insert the calendar header of month and year. */ document.insertString(0, MONTHS[displayMonth] + HEADER_TAB_SPACE[displayMonth] + HEADER...
9
public static Cons idlTranslateUnit(TranslationUnit unit) { { Symbol testValue000 = unit.category; if (testValue000 == Stella.SYM_STELLA_GLOBAL_VARIABLE) { return (null); } else if (testValue000 == Stella.SYM_STELLA_TYPE) { return (TranslationUnit.idlTranslateDeftypeUnit(unit)); ...
8
public FileParser getParserInstance() { if (system.indexOf(UNIX_IDENTIFICATION) >= 0) { log.debug("Found UNIX identification, try to use UNIX file parser"); return new UnixFileParser(locale); } else if (system.indexOf(WINDOWS_IDENTIFICATION) >= 0) { ...
4
protected Variable getImportedVar(String name) throws UtilEvalError { // Try object imports if (importedObjects != null) for (int i = 0; i < importedObjects.size(); i++) { Object object = importedObjects.get(i); Class clas = object.getClass(); Field field = Reflect.resolveJavaField(clas, name, false/...
6
public String nextLine() { if(console) advance(); String ret = line; st = new StringTokenizer(""); //force advance to readLine if(!console) advance(); return ret; }
2
@Override public void display( GLAutoDrawable glautodrawable ) { long now_time = System.currentTimeMillis(); float dt = (now_time - last_time)*0.001f; last_time = now_time; //System.out.println(dt); // Clear The Screen And The Depth Buffer GL2 gl2 = glautodrawable.getGL().getG...
4
private Collection getMimeTypes2(Collection mimeTypes, InputStream in) { try { if (mimeTypes.isEmpty() || mimeTypes.size() > 1) { Collection mimeTypes2 = getMimeTypesInputStream(in = new BufferedInputStream( in)); if (!mimeTypes2.isEmpty()) { if (!mimeTypes.isEmpty()) { // more than one ...
9
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 void paint(Graphics g) { g.setColor(super.getBackground()); g.fillRect(0, 0, this.getWidth(), this.getHeight()); if(autosize) { if(mouseOver) { if(!selected) { Image tmp = this.icon_hover.getImage().getScaledInstance(this.getWidth(), this.getHeight(), java.awt.Image.SCALE_SM...
5
public List getBundles() { clearResultMetaInformation(); List bundles = new ArrayList(); StringBuffer result = new StringBuffer(); GetMethod get = new GetMethod(apiEndpoint + DeliciousConstants.BUNDLES_ALL); get.setDoAuthentication(true); try { httpResult = ...
7
@Test public void testBubbleSort(){ sortSelection.load(array,null,null); sortSelection.run(); assertArrayEquals(array, arrayActuals); }
0
public boolean updateEmptySpace () { int i = 0, j = 0; /* Checks the size */ if (size.equals("9x9")){ /* Uses nested for loops to check if a space is empty */ for (i = 0; i < 9; i++) { for (j = 0; j < 9; j++) { if (entries[i][j].getText().equals("")) { entries[i][j].setText(sol...
7
public PersonAssignation() { setModal(true); setIconImage(Toolkit.getDefaultToolkit().getImage(PersonAssignation.class.getResource("/InterfazGrafica/Images/Search48.png"))); setTitle("BUSQUEDA"); setBounds(100, 100, 450, 235); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(...
0
public static LoLRTMPSClient returnClient(String region) throws NullClientForRegionException { if(PvPNetClients.get(region) == null) { throw new NullClientForRegionException("No client for region " + region + " available.", region); } int numClients = PvPNetClients.get(region).values().size(); LoLRTMPSCli...
1
public ListNode deleteDuplicates(ListNode head) { if(head == null){ return null; } ListNode superHead = new ListNode(0); superHead.next = head; ListNode previous = superHead; ListNode check = head; boolean dup = false; while(check.next !=null){...
5
private boolean okToCreate() { boolean res = false; boolean beteckningOk = !Validate.tfEmpty(tfBeteckning) && Validate.notOverSize(tfBeteckning); boolean checkDates = Validate.startdateBeforeReleasedate(calStartDate.getDate(), calReleaseDate.getDate()); if (beteckningOk) { i...
5
public void pass() throws IllegalStateException{ if(passedBefore) throw new IllegalStateException(); board.pass(); this.passedBefore = true; }
1
public static double compute(double a, double x) throws ArithmeticException { if (x <= 0 || a <= 0) return 1.0; if (x < 1.0 || x < a) return 1.0 - Igam.compute(a, x); final double MACHEP = 1.11022302462515654042E-16; final double MAXLOG = 7.09782712893383996732E2; double big = 4.503599627370496e15; ...
8
public MainFrame(boolean silent){ super(AlienFXProperties.ALIEN_FX_APPLICATION_NAME); try{ lockApplication(); }catch(Exception e){ JOptionPane.showMessageDialog(null, AlienFXTexts.ALREADY_RUNNING_ERROR_TEXT, AlienFXTexts.ALIEN_FX_ERROR_TITLE_TEXT, JOptionPane.ERROR_MESSAGE); return; } ProfileMo...
7
public static TopQueue search(String target, String dictFile) throws IOException { BufferedReader reader; reader = new BufferedReader(new FileReader(dictFile)); TopQueue topQueue = new TopQueue(); String word; int distance; while((word = reader.readLine()) != null) ...
3
public static void main(String[] args) throws Throwable{ int[][] res = new int[101][5]; for(int i = 1; i < res.length; i++){ res[i]=res[i-1].clone(); if(i%10<=3)res[i][0]+=(i%10); else if(i%10==4){res[i][0]++;res[i][1]++;} else if(i%10<=8){res[i][1]++;res[i][0]+=(i%10)-5;} else {res[i][0]++;res[i][2]...
8
public static Point invertDirection(Point direction) { Point newDirection = (Point) direction.clone(); newDirection.x *= -1; newDirection.y *= -1; return newDirection; }
0
private boolean testHypothesis() { if (hypothesis == Hypothesis.LESS_THAN && testStatistic < criticalRegion) { return true; } else if (hypothesis == Hypothesis.GREATER_THAN && testStatistic > criticalRegion) { return true; } ...
7
@Override public boolean equals(Object other) { if(other == this) return true; if(!(other instanceof Quantity)) return false; //return value == ((Quantity) other).convert(this.unit).value; //return value - ((Quantity) other).convert(this.unit).value < 0.00001; double otherVal...
2