text
stringlengths
14
410k
label
int32
0
9
public void onStop() throws JFException { for (IOrder order : engine.getOrders()) { order.close(); } console.getOut().println("Stopped"); }
1
@Override public void run() { //start(); Packet p_in; while(true) { p_in = null; try { p_in = (Packet) in.readObject(); } catch (IOException ex) { System.out.print("ERR1"); Logger.getLogger(Client...
9
@Override public List<?> asList() { if (obj == null) { return Collections.EMPTY_LIST; } else if (obj.getClass().isArray()) { if (obj.getClass().getComponentType().isPrimitive()) { // Wrapper für primitive Typen, da diese nicht in ein Objekt-Array konvertiert werden können. Object[] wrapper = ne...
6
private static Line[] handleGeneralCase(ArrayList<Point> convexHull) { Line[] minRectangle = new Line[4]; Line[] currentRectangle = new Line[4]; int[] hullIndices = { 0, findMin(true, convexHull), findMax(false, convexHull), findMax(true, convexHull) }; int size = convexHull.size(); double minArea; double t...
9
public void isValidSolution() { int targetSum = (int) (Math.pow(2, n+1) - 2); for (int i = 0; i < n; i++) { int sumR = 0; int sumC = 0; for (int j = 0; j < n; j++) { sumR+=Math.pow(2, sudokuBoard[i][j]); sumC+=Math.pow(2, sudokuBoard[j][i]); } if (sumR != targetSum) { System.out.print...
9
private String getMessage() { if (this.state == InitState.DRUM_MAP) { return "Copying drum-maps to working dir"; } if (this.state == InitState.UNPACK_JAR) { return "Unpacking BruTE"; } if (this.state == InitState.INIT) { return "Init"; } if (this.state == "INSTRUMENT_MAP") { return ...
6
public void SQLCreateTableForFirst() { String tname= "profile"; boolean founds=false; try { MyCon = new SQLConnection(); c = MyCon.getConnection("journal"); md = c.getMetaData(); rs = md.getTables(null, null, "%", null); while (rs.next()) { if (rs.getString(3).equa...
5
private void init() { if(!source.ready ) return; DataLine.Info info = new DataLine.Info(SourceDataLine.class, source.format); try { line = (SourceDataLine) AudioSystem.getLine(info); line.open(source.format); } catch (LineUnavailableException e) { e.printStackTrace(); return; } catch (Exception ...
5
public boolean isWin(int token) { final int DI[]={-1,0,1,1}; final int DJ[]={1,1,1,0}; for(int i=0;i<3;i++) for(int j=0;j<3;j++) { /* we skip if the token in position(i,j) not equal current token */ if(getBoardValue(i, j)!=token) continue; for(int k=0;k<4;k++) { int ctr = 0; ...
6
@Test public void testSortMerge(){ sortMergerSort = new SortMergerSort(); List<int[]> arrays = new ArrayList<int[]>(); int[] firstArray = {1,3,5,7,9,11}; int[] secondArray = {2,4,6,8,10,12,14}; arrays.add(firstArray); arrays.add(secondArray); int[] mergerArra...
0
public static boolean isNumberFirst(int numToCheck){ if (numToCheck == 1){ return false; } int[] MFB = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}; int divisor = 0; int i = 0; while ((divisor ^ 2) < numToCheck){ if (i < MFB.length) { ...
5
public GsonBuilder getGsonBuilder() { if (gsonBuilder == null) { gsonBuilder = new GsonBuilder(); } return gsonBuilder; }
1
public void createNegativePairsFile(File negativePairsFile, int n) { BufferedOutputStream os = null; try { os = new BufferedOutputStream(new FileOutputStream( negativePairsFile)); for (int i = 0; i < n; i++) { os.write(String.format("-1,%d", i + 1).getBytes()); for (Integer pair : createRandomPair...
8
@Override public boolean commit(long txnID, long numOfMsgs) throws MessageNotFoundException, RemoteException { if (fileNameTransaction.containsKey(txnID)) { String fileName = fileNameTransaction.remove(txnID); FileContent content = cache.remove(fileName); ReplicaLoc[] locations = null; try { locat...
8
private void updateSelectedChip(String selectedItem) { try { if (!selectedItem.isEmpty()) { ClassRecord classSet = this.directoryClasses.get(selectedItem); String className = classSet.getBaseClass().toString().substring(classSet.getBaseClass().toString().lastIndexOf(' ') + 1); String componentName = ...
8
public static void readKeyWord() { try { File file = new File("data/keyword.txt"); if (file.isFile() && file.exists()) { InputStreamReader read = new InputStreamReader( new FileInputStream(file)); BufferedReader bufferedReader = new BufferedReader(read); String lineTxt = null; while ((line...
4
public FileRef child(String relativePath) { String path = this.path; if (path.equals(".")) { path = ""; } else if (!path.endsWith("/")) { path += "/"; } return new FileRef(this.classLoader, path + relativePath); }
2
public void main() throws java.io.FileNotFoundException, java.io.IOException { InputProcessor.process(this.m_teams, this.m_sports, this.m_print); for (int i = 0; i < this.m_print.size(); i++) { // If print sport if (m_print.elementAt(i).country < 0 && m_print.elementAt(i).sport ...
7
@EventHandler public void signEdit(SignChangeEvent e){ plugin.logger.info("Event Triggered"); String[] lines = e.getLines(); Player player = e.getPlayer(); //plugin.logger.info(lines[0]); //plugin.logger.info(plugin.getConfig().getString("kitSignHeader")); //plugin.logger.info(Integer.toString(lines.length...
3
public boolean processField(final int id) throws NoCleanEquipmentException { boolean fieldProcessed = true; Equipment plow, tractor, seeder, combine; NormalFertilityField fieldToModify = getFieldById(id); // String currentStatus = fieldToModify.getStatus().toLowerCase(); FieldS...
9
@Override public void init(List<String> argumentList) { label = argumentList.get(0); }
0
public void renderLevel(Graphics2D g2) { for (Sprite level : game.getGUIButtons().values()) { if (level.getSpriteType().getSpriteTypeID().contains(LEVEL_BUTTON_TYPE)) { // level.setState(pathXTileState.UNSUCCESSFUL_STATE.toString()); SpriteType ...
5
final public int writeVarLong (long value, boolean optimizePositive) throws KryoException { if (!optimizePositive) value = (value << 1) ^ (value >> 63); int varInt = 0; varInt = (int)(value & 0x7F); value >>>= 7; if (value == 0) { writeByte(varInt); return 1; } varInt |= 0x80; varInt |= (value...
9
private void endImage(String to) { if (to.equals("slide")) slide.addEntity(image); else if (to.equals("quizslide")) quizSlide.addEntity(image); else if (to.equals("scrollpane")) scrollPane.addEntity(image); else if (to.equals("feedback")) quizSlide.addFeedback(image); }
4
@Override public void execute(CommandSender sender, String[] arg1) { if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) { sender.sendMessage(plugin.NO_PERMISSION); return; } if (arg1.length < 1) { sender.sendMessage(ChatColor.RED + "/" + plugin.delWarp + " (name)"); return; } try { ...
4
private void handleResponsePacket(DatagramPacket packet) { try { String strPacket = new String(packet.getData(), 0, packet.getLength()); Log.d(LOG_TAG, "response=" + strPacket); String tokens[] = strPacket.trim().split("\\n"); Log.d(LOG_TAG, "tokens.length=" + tokens.length); String location = null; ...
8
public static boolean isAlphanumeric(String string) { for (int i = 0; i < string.length(); i++) if (!Character.isLetterOrDigit(string.charAt(i))) return false; return true; }
2
public void setColor(VertexColor color) { this.color = color; }
0
private boolean isColliding(Vector2 position, int padding){ if(position.x > (x - padding) && position.y > (y - padding) && position.x < (x + padding) + World.current.tileSize/3 && position.y < (y + padding) + World.current.tileSize/3) return true; return false; }
4
public void setRightChild(Node child){ right = child; if (child != null) { child.parent = this; } }
1
public static Tape getTapeFromFile(File f) throws TuringException, FileNotFoundException { Tape tape = null; Scanner scan = new Scanner(f); int instructionCount=0; try { instructionCount = Integer.parseInt(scan.nextLine()); } catch(NumberFormatException ex) { ...
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 String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filterop...
7
public List<ProcessedCell> getCells(){ return cells; }
0
public StageShop(StageManager stageManager, Map<String, String> data) { super(stageManager, data); try { background = ImageIO.read(getClass().getResourceAsStream("/graphics/level/background/BlueBackgroundPixel.png")); coin = ImageIO.read(getClass().getResourceAsStream("/graphics/entity/coin/coin.png")); b...
1
public static boolean hasLoops( ListNode myList ) { if (myList == null || myList.next == null) return false; ListNode slow = myList; ListNode fast = myList; while (fast.next != null && fast.next.next!=null) { slow = slow.next; fast = fast.next.next; if (slow == fast) return tru...
5
private void addAdditionalTravellers(int seats, String nameOfSeats, int customerID) { JPanel cusInputWest = new JPanel(new GridLayout(0,1)); JPanel cusInputEast = new JPanel(new GridLayout(0,1)); //Creates as many textfields as there are remaining seats. JTextField[] ...
7
private synchronized void toBuffer(int s,Object a){ a1.add(s);a2.add(a); if(s==clear){clearBuffer();} if(s==opaque) theOpaque=(Boolean) a; if(s==setBackground)theBackground=(Color) a; if(inBuffer)return; if(isSetter(s))return; Graphics g=getGraphics(); if(g==null)return; Gra...
8
private void saveScene() { File stdSceneDir = new File("scenes"); if (!stdSceneDir.exists()) { stdSceneDir.mkdir(); } UIManager.put("FileChooser.cancelButtonText", LOCALIZER.getString(L_CANCEL)); UIManager.put("FileChooser.cancelButtonToo...
9
private boolean jj_2_45(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_45(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(44, xla); } }
1
public int isOrdonnancable(List<Tache> taches) { int isOrdo = -1; double U = 0; int nbTachesPeriodiques = 0; for (Tache tache : taches) { if (tache instanceof TachePeriodique) { U += tache.getCi() / new Double(((TachePeriodique)tache).getPi()); nbTachesPeriodiques++; } } if (U > 1) { ret...
4
@Override public void run() { int n = 0; while (!isBound() && n < 10) { WebServer.logInfo("Waiting for Socket on port " + this.getLocalPort() + " to bind"); try { Thread.sleep(1000); } catch (InterruptedException e) { } n++;...
8
@After public void tearDown() { }
0
public static void main(String[] args) { new Timer().schedule(new TimerTask() { @Override public void run() { System.err.println("Aborting"); System.exit(0); } }, 5000); ExecutorService exec = Executors.newCachedThreadPool(); ...
2
void setPdomParent(final Block block) { if (pdomParent != null) { pdomParent.pdomChildren.remove(this); } pdomParent = block; if (pdomParent != null) { pdomParent.pdomChildren.add(this); } }
2
public static void startupRuleInduction() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ...
7
public static Cons yieldConstructorBody(Stella_Class renamed_Class, Cons requiredassignments) { { Cons initialvalueassignments = Stella_Class.yieldInitialValueAssignments(renamed_Class, (Stella_Class.decidedToRecycleP(renamed_Class) ? Stella.KWD_INITIAL_VALUE_ONLY : Stella.KWD_ANY_INITIAL_VALUE)); if ((initi...
7
final <T> Class<? super T> randomAssignableType(final Class<T> type) { List<Class<?>> list = assignableTo.computeIfAbsent(type, new Function<Class<?>, List<Class<?>>>() { public List<Class<?>> apply(Class<?> t) { return Collections.unmodifiableList(new ArrayList<>(ClassTestUtil.findA...
7
public boolean scape(ArrayList<AntsPredator> spiders, ArrayList<Food> foods) { Iterator<AntsPredator> spidersIterator = spiders.iterator(); boolean advanceX, advanceY; int velocityY = 1, velocityX = 1; if (spiders.size() > 0) { while (spidersIterator.hasNext()) { AntsPredator spider = spidersIterator.nex...
8
@Test public void test_getNextPawn(){ assertNotNull(board); board = new Board(2, xSize, ySize, xBonusSquare, yBonusSquare); ArrayList<Pawn> pawns = getAllPawn(board); for (int i = 0; i < pawns.size(); i++) { assertNotNull(pawns.get(i)); } for (int i = 0...
3
public InfoNode SplitLeaf(int key, String value, Node node) { node.add(key, value); LeafNode sibling = new LeafNode(); int mid = (node.getSize()+1)/2; int loopTo = node.getSize(); for(int i = mid; i < loopTo;i++){ sibling.add(node.getKey(i), node.getValue(i)); } for(int i = mid; i < loopTo;i++){ nod...
2
public Piirtoalusta getPiirtoalusta() { return this.piirtoalusta; }
0
public void setLocationRelativeTo(Rectangle r) { // Multi-monitor support - make sure the completion window (and // description window, if applicable) both fit in the same window in // a multi-monitor environment. To do this, we decide which monitor // the rectangle "r" is in, and use that one (just pick top-...
7
@Override public JSONObject getValueForOutput() { try { return this.venue.toJson(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); return new JSONObject(); } }
1
private void mumHelper() { Jokes joke = new Jokes(this.connection, config.getChannel()); try { if (!hasArgs) { connection.msgChannel(config.getChannel(), joke.getMommaJoke(getRandChanUser())); } else { int temp = cmdArgs.indexOf(' '); if (temp != -1) { connection....
3
public static boolean isIntegerInRange(int number, int firstBoundary, int secondBoundary, boolean inclusive) { int minimum, maximum; if (firstBoundary < secondBoundary) { minimum = firstBoundary; maximum = secondBoundary; } else { minimum = secondBoundary; maximum = firstBoundary; } if (inclusi...
4
public int getMeterValue(int pos) { if (pos < 1) pos = 1; int meterPos = 1; for (Widget i = wdg().child; i != null; i = i.next) { if (i instanceof VMeter) { if (meterPos == pos) { VMeter v = (VMeter) i; return v.amount; }// pos== else { meterPos++; continue; }// else }...
4
private int findZero(int n, int k) { ArrayList<Integer> nineBase = getNineInvertedDigits(n); for (int i = 0; i < nineBase.size(); i++) { int current = nineBase.get(i); if (i == nineBase.size() - 1 && current == 0) break; if (current == -1) { ...
6
public boolean isSatisfied(Tin tin, HashMap<String, Equivalence> equivs) { if(tin.getManu().equals(manu)) { if(tin.getPaintNo().equals(paintNo)) { if(tin.getAcrylic()) { if(acrylic) { return true; } else { return false; } } else { if(enamel) ...
8
public boolean similar(Object other) { if (!(other instanceof JSONArray)) { return false; } int len = this.length(); if (len != ((JSONArray)other).length()) { return false; } for (int i = 0; i < len; i += 1) { Object valueThis = this.ge...
8
private void makeKeywordCSV() { // multi-threaded processing... int processorCount = Runtime.getRuntime().availableProcessors(); ExecutorService executor = Executors.newFixedThreadPool(processorCount); List<UrlKeywordTask> urlKeywordTasks = new ArrayList<>(processorCount); f...
5
public synchronized void removeUnsafeToCopyPrivateChunks() { List<String> newChunkType = new ArrayList<String>(); List<byte[]> newChunkData = new ArrayList<byte[]>(); int len = getNumPrivateChunks(); for (int i = 0; i < len; i++) { String type = getPrivateChunkType(i); char lastChar = type.charAt(3); ...
3
private void bmhashdisplay() { hashTable.display(); } // end dmhashdisplay()
0
public int getQuantity(int size){ switch(size){ case(1):return small; case(2):return med; case(3):return large; default:return 0; } }
3
public void setUp() { trie = new Trie(); }
0
public ArrayList<String> getGlobicProperties(String filename) { ArrayList<String> globicProperties = new ArrayList<String>(); Document doc = (Document) session.getObjectByPath("/" + filename); List<Property<?>> properties = doc.getProperties(); for (Property<?> p : properties)...
6
public Chunk[] split(int d) { int cutoff = (classes.length / d); if (cutoff <= 0) { cutoff = 1; } LinkedList<Chunk> chunks = new LinkedList<>(); ArrayList<ClassNode> list = new ArrayList<>(); for (ClassNode c : classes) { list.add(c); if (list.size() == cutoff) { chunks.add(new Chunk(list.toArr...
4
public static void changeMemberTelNR(String telNR, int memberID){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit...
4
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Space Shooter Game"); frame.addKeyListener(keyControl); frame.addWindowListener(windowControl); frame.setResizable(false); ...
4
private void writeDegrees() throws IOException { DataOutputStream degreeOut = new DataOutputStream(new BufferedOutputStream( new FileOutputStream(ChiFilenames.getFilenameOfDegreeData(baseFilename, useSparseDegrees)))); for(int i=0; i<inDegrees.length; i++) { if (!useSparseDeg...
3
private XmlAction createHookNodeUndoAction(MindMapNode focussed, List selecteds, String hookName) { CompoundAction undoAction = new CompoundAction(); HookNodeAction hookNodeAction = createHookNodeAction(focussed, selecteds, hookName, null); ...
7
public void refreshNotificaion() { try { // check user isRemoving if(this.isRemoving()) { UserRemovalInitiated notification = new UserRemovalInitiated(this); Notification.add(this.getId(), notification); } // check venue isRemoving List<Venue> aVenue = Venue.createFromResultSet(Data._find...
4
@FXML protected void addFiles(ActionEvent event) throws Exception { final FileChooser fileChooser = new FileChooser(); List<File> list = fileChooser.showOpenMultipleDialog(currentStage); if (list != null) { for (File file : list) { addFileToList(...
2
public void landet(Spiller sp) { sp.besked("Du er landet p "+navn); if (sp==ejer) { // eget felt sp.besked("Det er din egen grund"); if (antalHuse<5 && sp.konto>huspris && // bemrk: kun hvis betingelserne sp.sprgsml("kbe hus for "+huspris))// er opfyldt stilles sprgsmlet { // by...
7
private Entry<K, V> getEntry(Object key) { if (size == 0) { return null; } int hash = key == null ? 0 : key.hashCode(); int index = hash % table.length; for (Entry<K, V> entry = table[index]; entry != null; entry = entry.next) { if (hash == entry.hash && (...
7
synchronized void applyBoundary() { int iAtom = model.iAtom; float radius = 0; Atom a = null; for (int i = 0; i < iAtom; i++) { a = atom[i]; if (!a.isMovable()) continue; radius = 0.5f * a.sigma; if (a.rx > xbox - radius) { a.vx = -Math.abs(a.vx); } else if (a.rx < radius - xbox) { ...
8
public static boolean isMounted(File mountPath) { if (Environment.isWindows()) { File[] roots = File.listRoots(); for (File f : roots) if (f.getAbsolutePath().charAt(0) == mountPath.getAbsolutePath().charAt(0)) return true; return false; // mountPath.exists(); } try { Process child = Ru...
5
public void listProducts() { products = new ArrayList<Product>(); try { ResultSet results; if (listAllProducts) { results = listAllProductsStatement.executeQuery(); } else { listByCustomerStatement.setString(1, customerLogin); results = listByCustomerStatement.executeQuery(); } while (r...
8
@Override public void update(IObservable ui) { if (!tablecards.initDone()) { tablecards.init(ui.getUIData().getPlayers().length); } if (scores.notInitialized()) { scores.initTable(ui.getUIData()); } // shortcut UIDataInterface d = ui.getUIData...
7
public static boolean unitIncludedInOtherUnitsP(TranslationUnit unit) { { MethodSlot method = null; if (!(unit.category == Stella.SYM_STELLA_METHOD)) { return (false); } else { { method = ((MethodSlot)(unit.theObject)); if (((BooleanWrapper)(KeyValueList.dynami...
8
public void onEnable() { checkvault();// Ƿvault setupPermissions();// vault Ȩ setupEconomy();// vault this.log = getLogger(); pm = this.getServer().getPluginManager(); configmanager = new ConfigManager(this); saveConfig(); loadAccessCommands(); // ļлȡھʹõ setupHeroes();// heroes arenas = new Has...
0
public static boolean isFileLocked(String filename) throws SwingObjectException { boolean isLocked=false; RandomAccessFile fos=null; try { File file = new File(filename); if(file.exists()) { fos=new RandomAccessFile(file,"rw"); } } catch (FileNotFoundException e) { isLocked=true; }catch (Excep...
5
private void openSocket(MailAccount account) { sTrace.debug("open Socket for Account " + account.userName); try { /* Socket erzeugen --> Verbindungsaufbau mit dem Server */ clientSocket = new Socket(account.serverAddress, account.portNo); sTrace.debug("socket opened for " + account.userName + " on Port " ...
3
public void removeEntry(String firstColumnValue) { boolean removed=false; int rowNumber=0; for (int i = columns.size(); i < cells.size(); i+=columns.size()) { if(cells.get(i).getText().equals(firstColumnValue)){ removed=true; rowNumber=i; } } if(removed){ int numberOfCells = cells.size(); ...
9
public void doPost(HttpServletRequest request, HttpServletResponse response) { //request.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); PrintWriter out=null; DButil db=new DButil(); try { out = response.getWriter(); }catch...
4
private String parseIdentifierInternal() { final boolean quoted = string.charAt(position) == '"'; if (quoted) { final int endPos = string.indexOf('"', position + 1); final String result = string.substring(position, endPos + 1); position = endPos + 1; ret...
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PlayerMatchesID other = (PlayerMatchesID) obj; if (matches == null) { if (other.matches != null) return false; } else if (!matches.equal...
9
@EventHandler(priority = EventPriority.HIGHEST) //On craft public void onCraft(CraftItemEvent ci){ //Getting the data value String data = ci.getCurrentItem().getData().toString(); Player player = (Player)ci.getWhoClicked(); int endIndex = data.indexOf("("); String replacement = ""; String toBeReplaced = dat...
9
private static Drug getDrug(Drug bean, PreparedStatement stmt, ResultSet rs) throws SQLException{ if(bean.getDrugId()!=0) stmt.setInt(1, bean.getDrugId()); else stmt.setString(1, bean.getDrugName()); rs = stmt.executeQuery(); if (rs.next()) { Drug newBean = new Drug(); newBean.setDrugId(rs.get...
2
public static HashMap<String, Integer> fillAccessExceptionMap(String[] cmdInfo) { HashMap<String, Integer> accessExceptionMap = new HashMap<String, Integer>(); for (int i = 3; i < cmdInfo.length; i++) accessExceptionMap.put(cmdInfo[i].substring(1).toLowerCase(), Integer.parseInt(cmdInfo[...
1
public static String secondsToHour(int time) { if (time < 0) return null; int hours = (time / 3600) % 12; String hoursStr = hours == 0 ? "12" : hours + ""; return new String(hoursStr); }
2
public E getIndice(String pIndex){ E resp = null; for (Nodo<E> i = cabeza; i != null; i = i.getSiguiente() ) if(i.getIndex() == pIndex) resp = i.getDato(); return resp; }
2
public getNow() { this.info = "get server time"; }
0
public boolean isAccept() { if (getUnprocessedInput().length() != 0) return false; State s = getCurrentState(); Automaton a = s.getAutomaton(); return a.isFinalState(s); }
1
private void drawWalls( Graphics2D wallG, int originX, int originY, SavedGameParser.ShipState shipState, ShipLayout shipLayout ) { Color prevColor = wallG.getColor(); Stroke prevStroke = wallG.getStroke(); Color floorCrackColor = new Color(125, 125, 125); Stroke floorCrackStroke = new BasicStroke(1); Color r...
9
private void verify() { if(!input.isEnabled()) { return; } String text = ((JTextField) input).getText(); if(text.length() == 0) { return; } boolean valid = false; try { BigInteger value = new BigInteger(input.getText(...
5
@Override public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) { if (cs instanceof Player) { final Player player = (Player) cs; if (DatabaseHandler.isPremium(player)) { if (args.length == 1) { final String name = args[0]; player.setDisplayName(name); //TODO SE...
3
public List<OrganismTree> step(int generationNum) throws DeepCopyException { Random r = new Random(); nextGen.clear(); List<OrganismTree> currentGeneration = OrganismRepository.getInstance().getGeneration(generationNum); Collections.sort(currentGeneration); int numElites = populationSize*elitePercent...
7
public void downloadFile(final URL downloadURL, final File pathToDownload) throws IOException { if (mainWorker != null && !mainWorker.isCancelled()) { textArea.append("Downloading newest pack...\n"); if (currVer == 0) { getLatestVersionFromURL(new ...
6
public String convert(String s, int nRows) { if (s == null || nRows < 1) { return null; }; if (nRows == 1) { return s; } List<StringBuilder> lines = new LinkedList<>(); for (int i = 0; i < nRows; i ++) { lines.add(new StringBuilder());...
9