text
stringlengths
14
410k
label
int32
0
9
public byte variance(String fileName) throws IOException { FileInputStream is = null; DataInputStream dis = null; BufferedWriter br = new BufferedWriter(new FileWriter("variance_bin.txt")); NumberFormat formatter = new DecimalFormat(); formatter = new DecimalFormat("0.000E00"); try { is = new FileInpu...
7
public Spielfeld(Game game) { super(); this.game = game; this.setFocusable(true); }
0
private void lifeCycle() { String s = ""; StringBuilder sb = new StringBuilder(); while (isInputActive) { try { s = readInput(); if (s.length()==0) { this.isInputActive = false; break; } if (this.isValidInput(s)) { sb.append(s); } } catch (IOException e) { ...
4
public void renderProjectile(int xp, int yp, Projectile p){ xp -= xOffset; yp -= yOffset; for(int y=0;y<p.sprite.SIZE;y++){ int ya = y + yp + 0; for(int x=0;x<p.sprite.SIZE;x++){ int xa = x+xp; if(xa< -p.sprite.SIZE || xa >= width || ya<0 || ya >=height) continue; if(xa<0) xa =0; ...
8
public synchronized void setValues(Double[] values, Double marked1, Double marked2) { this.values = values.clone(); this.marked1 = marked1; this.marked2 = marked2; repaint(); }
0
public StringBuilder readFromFileMethod(String fileName) { try { // Initialize the file input stream FileInputStream fstream = new FileInputStream(fileName); int count = 0; // Get DataInputStream object in = new DataInputStream(fstream); br = new BufferedReader(new InputStreamReader(in)); String ...
8
private void addStakesToStakeTempStartingFrom(int i) { while (lastStake() < endStake) { if (nextStakeFitsInGeometry(i)) { addNewStake(i); resetLeftovers(); } else if (onlyOneStakeLeft(i)) { addFinalStake(i); break; } else { addRestOfTheGeometryToLeftovers(i); i++; } } }
3
@Override public void process(Deque<String> par1Args) { for(int i = 0; i < argc; i++){ String s = par1Args.poll(); if(s.length() < 1) continue; if(s != null && conv.accept(s)){ vals.add(s); } else { throw new IllegalArgumentException(); } } }
4
void coverageByExons(Marker read, Marker m, String typeRank) { // Find corresponfing transcript Transcript tr = (Transcript) m.findParent(Transcript.class); if (tr == null) return; // Number of exons int exons = tr.numChilds(); // Do we need to add new counters? if (coverageByExons.size() <= exons) { ...
3
private void grabBranch() { if(Main.VERBOSE) System.out.println("[INFO] Determining current Git branch..."); BufferedReader buffRead = null; String branch = null; try { Process proc = Runtime.getRuntime().exec("git branch"); buffRead = new BufferedReader...
8
private static void extractFromZip( String szZipFilePath, String szExtractPath, String szName, ZipFile zf, ZipEntry ze) { if(ze.isDirectory()) return; String szDstName = slash2sep(szName); String szEntryDir; if(szDstName.lastIndexOf(File.separator) != -1) { ...
6
private static String byte2hex(byte[] b) { StringBuilder hs = new StringBuilder(); String stmp; for (int n = 0; b != null && n < b.length; n++) { stmp = Integer.toHexString(b[n] & 0XFF); if (stmp.length() == 1) hs.append('0'); hs.append(stmp); } return hs.toString().toUpperCase(); }
3
public static void printFactorization(int num) { int temp = num; ArrayList<Integer> array = new ArrayList<Integer>(); while (temp != 1) { for (int i = 2; i <= temp; i++) if (temp % i == 0) { array.add(i); temp /= i; break; } } Collections.sort(array); System.out.print(num + " = ...
5
private void renderBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renderBrowseButtonActionPerformed JFileChooser f = new JFileChooser(renderToField.getText()); File fi = new File(renderToField.getText()); if(fi.isDirectory()) { f.setCurrentDirectory(fi...
4
public void entrenar(String[][] entradas){ boolean finalizado = false; int Pw,error, y; this.numeroEpocasFinal = 0; while(!finalizado){ finalizado = true; for(int n = 0; n < entradas.length; n++){ Pw = this.desicion(entradas[n]); y = Integer.valueOf(entradas[n][entradas[n].le...
4
public static synchronized Object evalSubL(CycAccess connection, String subl) { Object result = null; try { if (CycConnection.inAWTEventThread()) { throw new RuntimeException("Unable to communicate with Cyc from the AWT event dispatch thread."); } long resultMsecs = 0; if(useTimi...
4
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
7
private boolean waitForSelect(){ try{ while (!fNext && !fCancel){ Thread.sleep(50); } if (fNext){ PrintLog.Log("button was pressed"); String path = textField.getText(); File f = new File(path); if...
7
private void verifyPlayersInBoard() throws Exception { for (int row = 0; row < _board.length; ++row) { for (int col = 0; col < _board.length; ++col) { if (isCellEmpty(row, col)) { continue; } if (_board[row][col] != _leftPlayer && _board[row][col] != _rightPlayer) { throw new JProblemsE...
5
public void testToStandardDays_months() { Period test = Period.months(1); try { test.toStandardDays(); fail(); } catch (UnsupportedOperationException ex) {} test = Period.months(-1); try { test.toStandardDays(); fail(); ...
2
public Color getGroutingColor(Color c) { return groutingColor; }
0
@Override public String toString() { String className = this.getClass().getSimpleName(); return ((getTitle() == null || getTitle().isEmpty())? url.toString() : "[" +className+ "] " + getTitle()); }
2
private void initProjectivization(DependencyStructure pdg) throws MaltChainedException { nodeLifted.clear(); nodeTrace.clear(); headDeprel.clear(); nodePath.clear(); isCoveredRoot.clear(); nodeRelationLength.clear(); for (int index : pdg.getDependencyIndices()) { nodeLifted.add(false); nodeTrace.ad...
7
protected String readStream() throws Exception { while (!reader.ready()) { Thread.sleep(50); } String out = reader.readLine(); for (int i = 0; i < error.length; i++) { if (out.equals(error[i])) { throw new Exception(); } } return out; }
3
@Override public final synchronized void display() { this.slider.setMinimum(this.min); this.slider.setMaximum(this.max); this.slider.setValue((int) (this.value * this.factor)); this.slider.setPaintTicks(true); this.slider.setPaintLabels(true); this.slider.setMajorTickSpacing(this.step); this.slider.setMi...
4
public boolean deleteItem(int id, int slot, int amount) { if (slot > -1 && slot < playerItems.length) { if ((playerItems[slot] - 1) == id) { if (playerItemsN[slot] > amount) { playerItemsN[slot] -= amount; } else { playerItemsN[slot] = 0; playerItems[slot] = 0; } resetItems(3214); ...
4
@Override public void render(Graphics g) { if (slomoEffect > 0) { g.setColor(new Color(0.0F, 0.0F, 0.0F, 0.051F)); } else { g.setColor(defaultBackground); } g.fillRect(0, 0, Game.WIDTH, Game.HEIGHT); g.setColor(defaultColor); g.setFont(new Font("Courier New, Courier", 12, 12)); if (firstRun) { ...
5
public int etsiOikeaX(){ int oikX = 0; for (Palikka palikka : palikat) { if (palikka.getX() > oikX){ oikX = palikka.getX(); } } return oikX; }
2
void paintOpacityFlow(CPRect srcRect, CPRect dstRect, byte[] brush, int w, int opacity, int flow) { int[] opacityData = opacityBuffer.data; int by = srcRect.top; for (int j = dstRect.top; j < dstRect.bottom; j++, by++) { int srcOffset = srcRect.left + by * w; int dstOffset = dstRect.left + j * width; ...
4
private void sendClickBlockToController(int par1, boolean par2) { if (!par2) { this.leftClickCounter = 0; } if (par1 != 0 || this.leftClickCounter <= 0) { if (par2 && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == EnumMovingObjectTy...
8
public void test_04_Pe() { int numTests = 1000; Random rand = new Random(20100617); for( int t = 0; t < numTests; t++ ) { // Create gap String gapStr = ""; int gap = rand.nextInt(50) + 1; for( int i = 0; i < gap; i++ ) gapStr += "N"; // Sequence 2 int len1 = rand.nextInt(100) + 1; Stri...
4
public static CustomButton doFileMoveButton(final File dls) { final String title = dls.getName(); final CustomButton a = new CustomButton(title); a.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { String root = EarningsTest.PATH_SOURCE.getText(); if ...
8
public void enable() { }
0
@Override public void setVisible(boolean b) { if (b) { serverTextField.setText(Config.getInstance().getHost()); int port = Config.getInstance().getPort(); if (port == 0) { portTextField.setText(""); } else { portTextField.setTex...
2
public JSONObject putOnce(String key, Object value) throws JSONException { if (key != null && value != null) { if (opt(key) != null) { throw new JSONException("Duplicate key \"" + key + "\""); } put(key, value); } return this; }
3
protected static String parsePathForZip( String p, String parentDir ) { if( ((p.indexOf( "/" ) != 0) || (p.indexOf( "\\" ) == 0)) ) { while( p.indexOf( ".." ) == 0 ) { p = p.substring( 3 ); if( !parentDir.equals( "" ) && ((parentDir.charAt( parentDir.length() - 1 ) == '/') || (parentDir.charAt( paren...
8
public static double[] evaluateWinningOdds(Cards[] hands, Cards board, Cards other) { int numhands = hands.length; double[] odds = new double[numhands]; int[] wins = new int[numhands]; int[] ties = new int[numhands]; int total = 0; // Get a fresh deck Cards remai...
9
public void run() { long lastTime = System.nanoTime(); double ns = 16666666.666666666D; double delta = 0.0D; double delta2 = 0.0D; int ticks = 0; int frames = 0; long timer = System.currentTimeMillis(); while (run) { long now = System.nanoTime(); delta += (now - lastTime) / ns; delta2 += (now -...
7
public boolean hasSpam(String text) { String[] words = text.toLowerCase().split(" "); for (String imp : impossibles) { if (text.contains(imp)) return true; } boolean hasSpam = true; for (String word : words) { if (word.length() > 20) return true; for (String vowel : vowels) { ...
9
public void updateStarAnm(int k, Character plat) { // manages vertical moving platforms Platform tempStar = (Platform) plat; int tempy1 = tempStar.getY(); int tempv = tempStar.getVV(); int vcount = tempStar.getVcount(); if (tempv == -1) { if (vcount >= 100) { tempStar.setVV(1); } if (vcount ...
6
private Game createGame(String gameType) { Game game = null; Player playerA = null; Player playerB = null; if (gameType == null) { new MemoryGameError().displayError("MainCommands - create: gameType is null"); return null; } if (g...
3
public void setBubbleRange( String bubbleSizes ) { if( (bubbleSizes != null) && !bubbleSizes.equals( "" ) ) { myseries.getParentChart().setMetricsDirty(); Ai ai = myseries.getBubbleValueAi(); if( ai.getWorkBook() == null ) { ai.setWorkBook( wbh.getWorkBook() ); } ai.changeAiLocation( ai.toStr...
4
@Test public void kameraSeuraaOikein() { this.k = new Kamera(0, 0); this.p = new Pelaaja(); p.setXY(new Piste(0, 0)); for (int i = 0; i < 100; i++) { k.seuraa(p); } assertTrue("Kamera ei liikkunut oikeaan x - koordinaattiin, vaan " + k.to...
1
private void initIgnored() { if (!fIgnore.isFile()) return; String line; try { BufferedReader br = new BufferedReader(new FileReader(fIgnore)); while ((line = br.readLine()) != null) { ignoredList.add(new File(line)); } br.close(); } catch (FileNotFoundException e) { // checked with ".exis...
4
private List<Tile> getShuffledTiles() { List<Tile> shuffledTiles = new ArrayList<Tile>(); for (int i = 0; i < BEARS; i++) shuffledTiles.add(new Bear()); for (int i = 0; i < FOXES; i++) shuffledTiles.add(new Fox()); for (int i = 0; i < LUMBERJACKS; i++) shuffledTiles.add(new Lumberjack(...
7
void animate(int start,int end, float interpolation,ArrayList<Integer> aggNodes,boolean outlineOnly){ Integer startPosition = this.persistence.get(start); Integer endPosition = this.persistence.get(end); int interpolationAmt=0; if (startPosition ==1 && endPosition ==...
9
public boolean shapeValido() { return (numSymbol != 4 ? true : false); }
1
public void setup() { //To reduce pixelation smooth(); noStroke(); //Create an PApplet ssize of 800x700 size(800, 700); //Zooming and Panning Libaries zoomer = new ZoomPan(this); zoomer.setZoomMouseButton(PConstants.RIGHT); //Get the observer, map and sizes this.obiwan = w.getObserver(); curMap...
9
public void fullyMoveTondeuses() { for (int i = 0; i < tondeuses.size(); i++) { Tondeuse t = tondeuses.get(i); Integer totalNumberOfActions = t.getActions().size(); for (int j = 0; j < totalNumberOfActions; j++) { t.executeAndRemoveNextAction(); } } }
2
static byte[] changeLdcToLdcW(byte[] code, ExceptionTable etable, CodeAttribute ca, CodeAttribute.LdcEntry ldcs) throws BadBytecode { ArrayList jumps = makeJumpList(code, code.length); while (ldcs != null) { addLdcW(ldcs, jumps); ldcs...
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 Membergebuehr)) { return false; } Membergebuehr other = (Membergebuehr) object; if ((this.id == null && other.i...
5
public synchronized void addBaudRate(Link link) { double baudRate = link.getBaudRate(); if (baudRates_ == null) { return; } baudRates_.add( new Double(baudRate) ); if (bandwidth_ < 0 || baudRate < this.bandwidth_) { this.setBandwidth(baudRate); ...
3
public boolean imageUpdate(Image img, int flags, int x, int y, int width, int height) { if((flags & HEIGHT)!=0) { this.imgHeight=height; } if((flags & WIDTH)!=0) { this.imgWidth=width; } return(this.imgHeight<0 || this.imgWidth<0 /*|| this.imgBitsPerPixel ...
3
private void initComponents(){ setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); backButton = new JButton("<"); trackSelection = new JLabel(); Dimension labelSize = new Dimension(200,50); trackSelection.setPreferredSize(labelSize); trackSelection.setText("Next Track...
4
public void deleteElement(String value) { ListElement index = head; if (index.value == value) { deleteFromBegin(); } else { while (index.next != null) { if (index.next.value == value) { index.next = index.next.next; } el...
5
private static Path getCodegenDir(CommandLine line) { if (!line.hasOption(CODEGEN) && (!line.hasOption(SHOW_VALUES) && !line.hasOption(OUTPUT_MODEL))) { printHelp(configureOptions()); System.exit(1); } if (line.hasOption(CODEGEN)) { File codegenDir = new File(line.getOptionValue...
7
public HTMLParser(String file) { File html = new File(file); parseHTML(html); }
0
public static NumberWrapper timesComputation(NumberWrapper x, NumberWrapper y) { { double floatresult = Stella.NULL_FLOAT; { Surrogate testValue000 = Stella_Object.safePrimaryType(x); if (Surrogate.subtypeOfIntegerP(testValue000)) { { IntegerWrapper x000 = ((IntegerWrapper)(x)); ...
6
public static String getOption() { String option = "gui"; try { BufferedReader r = new BufferedReader(new FileReader("config.txt")); String line = r.readLine(); while (line != null) { if (line.startsWith("Option=")) ...
8
@Override public String getAcademicLevel() { return super.getAcademicLevel(); }
0
public boolean matches(Operator loadop) { return (loadop instanceof InvokeOperator || loadop instanceof GetFieldOperator); }
1
private void setUpdateStatementValues(ArrayList<Integer> keyIndexes, PreparedStatement pstmt, String[] columns, String[] values, Double[] doubleValues) throws MobbedException { String[] keyColumns = addByIndex(keyIndexes, columns); String[] nonKeyColumns = removeByIndex(keyIndexes, columns); String[] keyVal...
6
public SelectHTMLExportStyleDialog(Frame owner, String title) { super(true, true, true, INITIAL_WIDTH, INITIAL_HEIGHT, MINIMUM_WIDTH, MINIMUM_HEIGHT); // Initialize CSS_DIR = new File(Outliner.PREFS_DIR + System.getProperty("com.organic.maynard.outliner.Outliner.cssdir", "css") + System.getProperty("file.separ...
0
private int isEqualSomething(String str) { for (int i = 0; i < list_From_file.size(); i++) { if (((data) list_From_file.get(i)).getBinary_Code().equals(str)) return i; } return -1; }
2
public static void main(String[] args) { List<Integer> abundants = new ArrayList<>(); for (int i = 1; i < 28123; i++) { Collection<BigInteger> factors = Utils.factorize(BigInteger .valueOf(i)); int sum = 0; for (BigInteger factor : factors) { sum += factor.intValue(); } if (sum > i) { ...
7
private static int applyComboScore(String passwd, int letterScore, int numberScore, int specialScore) { int comboScore = 0; // COMBOS // [verified] both upper and lower case if (letterScore == MIXED_IMPLIED) { comboScore += 2; log.debug("2 combo points for upper and lower letters."); } //...
9
public void doConversion(){ String worldName; String fileName; String number = "0"; String[] oldData; String[] newData; String[] worlds = FH.getFolders("Undo Saves"); for(int i = 0; i < worlds.length; i++){ worldName = worlds[i]; File folde...
7
@Override public boolean MoveUp() { undodata.addLast(dataClone()); undoscore.addLast(scoreClone()); initFlag(); win = false; noMoreMoves = false; boolean flag = true; int count = 0; while (flag == true) { flag = false; for(int i=1; i<N; i++) { for(int j=0; j<N; j++) { if (data[i...
9
public static String desencriptar(/*String passPhrase, */String str) { Cipher ecipher = null; Cipher dcipher = null; try { // Crear la key KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), SALT_BYTES, ITERATION_COUNT); SecretKey key = SecretKeyFactor...
9
public static int getIntFromUser(String prompt) { while (true) { try { return Integer.parseInt(getUserInput(prompt)); } catch (Exception e) { System.out.println("FUCK OFF THATS NOT A NUMBER"); } } }
2
public boolean matchesAndOneAbove(Card other) { return (other.getSuit() == this.suit && this.rank.ordinal() == other.getRank().ordinal() + 1); }
1
public void union(Set s) { ListNode thisNode = list.front(); ListNode anotherNode = s.list.front(); while (thisNode.isValidNode() && anotherNode.isValidNode()) { try { Comparable thisItem = (Comparable) thisNode.item(); Comparable anotherItem = (Comparable) anotherNode.item(); if (thisItem.compareT...
8
public void setNetwork(HaplotypeNetwork hapNet) { this.hapNet = hapNet; maxCardinality = 0; maxDist = 0; //Go through all haplotypes and create haplotypeElements for each one ArrayList<NetworkNode> haps = hapNet.getAllNodes(); for(NetworkNode node : haps) { Haplotype hap = (Haplotype)node; if (hap....
7
public void onloadBrowserHandler(JavascriptContext ctx) { String inpUrl = findUrlField().getText(); this.ctx = ctx; // added download button Button dload = new Button("Download"); dload.setName("Download"); dload.addActionListener(new ActionListener() { public void actionPerformed...
7
public boolean equals(Object obj) { if (!(obj instanceof Point)) return false; Point point = (Point) obj; if (this.getX() == point.getX()) if (this.getY() == point.getY()) if (this.getColor() == point.getColor()) if (this.getDotLineSize() == point.getDotLineSize()) if (this.getDotLineForme()....
6
public int update(MouseEvent event) { int mask = (event.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK); boolean buttonDown = mask == MouseEvent.BUTTON1_DOWN_MASK; if (_pressed && !buttonDown) { _pressed = false; return _id; } if (event.getX() >= _rec...
8
private void initOldTables() { oldTables = new ReferenceTable[reference.getFileCount()]; for (int i = 0; i < oldTables.length; i++) { ByteBuffer data = reference.get(i); if (data != null) { oldTables[i] = new ReferenceTable(i, data, null); } } }
2
public byte[] getAuthenticatorClient() { return authenticatorClient; }
0
public String properCase(String value) { if (value == null) { return ""; } if (value.isEmpty()) { return ""; } String[] delimiterlist = {" ", "-", "_", "'", "."}; boolean first = true; boolean afterdelimiter = false; String destina...
8
@Override public Object getValueAt(int rowIndex, int columnIndex) { SimpleDateFormat format = new SimpleDateFormat("HH:mm"); switch(columnIndex) { case 0: return trains.get(rowIndex).getNumber(); case 1: return trains.get(rowIndex).getFromStation(); case 2: retur...
8
@Override public void input() { if (Input.isLocked()) { if (Input.getKeyDown(Input.KEY_ESCAPE)) Input.setLocked(false); yaw(-Input.getMouseDX() * sensitivity); pitch(Input.getMouseDY() * sensitivity); } else { if (Input.getMouseDown(Input.MOUSE_LEFT)) { Input.setLocked(true); } ...
9
public void acquirePackets(final List<Packet> buffer, final int count) { //Method to hold the received packets in an arrayList of packets //ArrayList of packets called List final PacketReceiver receiver = new PacketReceiver() { //Declaration of a new packetReciever called receiver @Override public voi...
3
public Profile getProfile(String id) { System.out.println("MineshafterProfileClient.getProfile(" + id + ")"); URL u; try { u = new URL(API_URL + "?uuid=" + id); HttpURLConnection conn = (HttpURLConnection) u.openConnection(); InputStream in = conn.getInputStream(); String profileJSON = Streams.toStr...
7
@Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; }
1
private static void updateViewTable(final String itemContent) { /** * itemContent is the format: * PathToFile:::FunctionName:::Type+LineNo */ System.out.println("Adding from tableResult: " + itemContent); final String[] itemColums = itemContent.split(":::"); Display display = Display.getCurrent(); ...
8
public boolean interactOn(Tile tile, Level level, int xt, int yt, Player player, int attackDir) { if (player.health < player.maxHealth && player.payStamina(staminaCost)) { player.heal(heal); return true; } return false; }
2
public static Stella_Object accessContextSlotValue(Context self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Stella.SYM_STELLA_CHILD_CONTEXTS) { if (setvalueP) { self.childContexts = ((List)(value)); } else { value = self.childContexts; } } ...
9
public boolean isValid() { //check for valid number of states if (brainInstructions.size() > 10000) { return false; } //check that instructions use correct syntax int i = 0; int j = 0; boolean valid = true; boolean match = false; //iterate through each instruction and check for a match in //the ...
5
private void checkVehicletool() { List<Integer> list = new ArrayList<Integer>(); for (Route r : Solution.getRoutes()) { list.clear(); int vehicle = 0; boolean b=false; if (r.isHasType()) { vehicle = r.getType(); } List<Integer> vehicleTool = getToolVehicle(Instance.getFleet() .get(vehicle...
9
protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { if( rosterDB.isDataChanged () || tripDB.isDataChanged() || riverDB.isDataChanged() ) { if ( JOptionPane.showConfirmDialog(null, "Sollen die Daten jetzt abgespeichert werden?", "...
6
final public void And_operator() throws ParseException { /*@bgen(jjtree) And_operator */ SimpleNode jjtn000 = new SimpleNode(JJTAND_OPERATOR); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { if (jj_2_73(3)) { jj_consume_t...
3
public static void sortStudentsPromotion() { if (FileReadService.sList.isEmpty()) { System.out.println("There is no Student !"); } else if (FileReadService.pList.isEmpty()) { System.out.println("There is no Promotion !"); } else { System.out .println("Do you want to sort in an Ascending Order (0)...
6
public Graph() { edges = new DynamicArray(); vertices = new DynamicArray(); adjacencyList = new AdjacencyList(); directed = false; hasNegativeWeights = false; }
0
@Override public Action choose() { switch (this.getCurrent()) { case 0: return Action.MOVE; case 1: return Action.ATTACK; case 2: return Action.CAST; case 3: default: return Action.CANCEL; } }
4
public boolean equals(Puzzle p) { boolean equals = true; for(int i=0; i<9; i++) { for(int j=0; j<9; j++) { equals = equals && grid[i][j].equals(p.getGrid()[i][j]); } } return equals; }
3
public static void main(String[] args) throws SlickException { new AppGameContainer(new StateFreeGame("CameraTest"){ private Camera cam; private Vector2i loc; @Override public void renderProcess(GameContainer arg0, Graphics arg1) { cam.draw(arg0,arg1); arg1.setColor(Color.gray); arg1...
9
public static void newTurn() { for(int i = 0; i < unitList.size(); i++) //Loops through all units { unitList.get(i).reset(); } }
1
public int searchInsert(int[] A, int target) { int low = 0; int high = A.length - 1; while (low <= high) { if (low == high) { if (A[low] >= target) return low; return low + 1; } int mid = (low + high) >>> 1...
5
@Override public void setCurrentHp(int hp) { if (hp > this.maxHP) { this.curHP = this.maxHP; } else { this.curHP = hp; } }
1
public static void sendAdminChat( String message, Server server ) { if ( ChatConfig.logChat ) { LoggingManager.log( message ); } ByteArrayOutputStream b = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream( b ); try { out.writeUTF( "S...
5