text
stringlengths
14
410k
label
int32
0
9
@Override public boolean equals(Object o) { if (this == o){ return true; } if (!(o instanceof Position)){ return false; } Position p = (Position) o; if (point == null) { if (p.point != null) return false; } else if (!point.equals(p.point)) return false; if (room == null) { if (p.room...
8
public static HttpServletRequest login(HttpServletRequest request) { Models.DatabaseModel.User user = new Models.DatabaseModel.User(); String username = request.getParameter("username"); String password = request.getParameter("password"); if(validLoginParameters(username, pass...
2
public FloatElement[] getSortedSimilarWords(String word) throws Exception{ int index = model1.index(word); FloatElement[] similarWords = new FloatElement[model1.sizeOfVocabulary]; for (int i=0; i<model1.sizeOfVocabulary; i++){ float pmi1 = 0; float pmi2 = 0; float similarity = Float.NEGATIVE_IN...
9
private boolean memeChecker(String currentText) { boolean isAMeme = false; for (String currentMeme : memeList) { if (currentMeme.equalsIgnoreCase(currentText)) { isAMeme = true; } } for (int loopCount = 0; loopCount < memeList.size(); loopCount++) { if (memeList.get(loopCount).equalsIgno...
4
@SuppressWarnings("resource") public TestRecord getMedicalTest(DataSource ds) { while (true) { System.out.print("Back = 0. Enter name or health care number of patient: "); Scanner s = new Scanner(System.in); String patient_info = s.nextLine(); try { int option = Integer.parseInt(patient_info); i...
8
public void bringToFront(int index) { /* illegal index or bring the first node */ if (index >= numElements || index <= 0) { return; } int currentIndex = 0; SingleNode cursor = head; while (cursor != null) { if (currentIndex == index - 1) { /* node to be moved to the front */ SingleNode temp ...
4
public long getType() { return this._type; }
0
public Integer getPassRate() { return this.passRate; }
0
public void startGame(int numPlayers) { removeAllPanels(); GameController game = new GameController(numPlayers); ViewController view = new ViewController(game, frame); ControlController control = new ControlController(game, playerKeyCodes); if (soundActive) { SoundController sound = new SoundControll...
6
private Msg xxrecv (int flags_) { Msg msg_ = null; // If there is a prefetched message, return it. if (prefetched) { msg_ = prefetched_msg ; prefetched = false; prefetched_msg = null; return msg_; } // DEALER socket doesn't u...
4
public Vertex<V, E> next() { this.previousVertex = this.nextVertex; Vertex<V, E> currentVertex = null; Iterator<Edge<V, E>> curEdgeIter = null; Vertex<V, E> unvisitedVertex = null; while (!this.edgeIters.isEmpty()) { currentVe...
6
@RequestMapping(value = "/{contactId}", method = RequestMethod.DELETE, produces = "application/json") public ResponseEntity<?> delete(@PathVariable("contactId") int contactId, @RequestParam(required = false) String searchFor, @RequestParam(requ...
3
public final void setLineIncrement(double increment) { incrementWidth = increment; parametersToNumbers.put("lineIncrement", new Double(increment)); }
0
@Override public void init() { /* 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://download.o...
7
public static void GUI(){ //Every player's action list default values for (int i = 0; i < 5; i++){ for (int j = 0; j < 12; j++){ actionAll[i][j] = -1; } } raam = new JFrame("Raam"); raam.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); raam.setSize(1280, 800); raam.setLayout(null); //ac...
8
public java.lang.Object get(int field$) { switch (field$) { case 0: return names; case 1: return name; case 2: return favorite_number; case 3: return favorite_color; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } }
4
@Override public void run() { try { byte[] dlen = new byte[4]; System.out.println(socket.getRemoteSocketAddress() + " connected."); in = new DataInputStream(socket.getInputStream()); out = new DataOutputStream(socket.getOutputStream()); ...
3
public void drawGrid(Game game, Graphics2D g2d, int[] screen) { int hexWidth = screen[0]/8; int hexHeight = hexWidth/8*9; g2d.setColor(COLORS[1]); boolean off = false; g2d.translate(-hexWidth*2+hexWidth/2,-hexHeight/9*7); for(int y = 0; y < game.grid.getHeight(); y++) { int leftOffset = 0...
3
public void paint(Graphics g){ Graphics2D g2d = (Graphics2D)g; at.setToTranslation(x, y); if(ax>0 && !isLanding) at.rotate(Math.toRadians(-angle), 3.5, 8); else if(ax>0 && isLanding) at.rotate(Math.toRadians(-angleDown), 3.5, 8); else if(ax<0 && !isLanding) at.rotate(Math.toRadians(angle), 3.5, 8); ...
6
protected Position<Entry<K, V>> treeSearch(K key, Position<Entry<K, V>> p) throws InvalidPositionException, BoundaryViolationException { if (p == null) return null; else { K currentK = key(p); int comp = this.comp.compare(key, currentK); if (comp < 0) return treeSearch(key, left(p)); else if (...
3
private void scrapeBasketball() { PGsPlaying = new ArrayList<BasketballPlayer>(); SGsPlaying = new ArrayList<BasketballPlayer>(); SFsPlaying = new ArrayList<BasketballPlayer>(); PFsPlaying = new ArrayList<BasketballPlayer>(); CentersPlaying = new ArrayList<BasketballPlayer>(); Elements script = doc.selec...
8
public void setX2Coordinate(double x) { this.x2Coordinate=x; }
0
@Override public void recieveMouseEvent(int mouseX, int mouseY){ if (mouseX < 800){ int newX = -1; int newY = -1; int cx = Boot.getPlayer().getX(); int cy = Boot.getPlayer().getY(); newX = cx + (mouseX / Standards.TILE_SIZE) - 12; newY = cy + ((Standards.W_HEIGHT - mouseY) / Standards.TILE_SIZE) -...
5
@Override public Paciente listById(int codigo) { Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; Paciente p = new Paciente(); try { con = ConnectionFactory.getConnection(); pstm = con.prepareStatement(LISTBYID); p...
3
private static int getNumberOfMappers() { // default TODO change to 6 before submission int cores = conf.Constants.NUMBER_OF_CORES; File cpuInfo = new File("/proc/cpuinfo"); //check if AFS /proc/cpuinfo exists if(!cpuInfo.exists()){ Logger.errLog("NO CPUINFO FILE. Using default value of 6 cores."); retu...
6
public int getTableNumber(int i, int j) { int n = trainSet.getNbrOfVariables(); int tableCounter = 0; for (int l = 0; l < n - 1; l++) { for (int l2 = l+1; l2 < n; l2++) { if (j<i) { if (l==j && l2==i) { return tableCounter; } } else if (l==i && l2==j) { return tableCounter; ...
7
private void decreaseLife(int value){ this.life_delay -= value; if(life_delay <= 0){ this.life -= 1; life_delay += 100; } }
1
public void sendMoveStatus() throws GameOverException { if (game) { if (isAttack) { sendAttackMessage(isSecondPlayerInMove); if (player1.getHealth() <= 0) { game = false; sendGameOverMessage(1); throw new Gam...
5
public void COMForce() { if (myToggles.get(COM)) { for (HashMap<String, Mass> massList : springies.getMassMaps()) { int xTotal = 0; int yTotal = 0; for (Mass m : massList.values()) { xTotal += m.x; yTotal += m.y; } int xCOM = xTotal / massList.size(); int yCOM = yTotal / massList....
4
public void buildAssociations(Instances instances) throws Exception { // can associator handle the data? getCapabilities().testWithFail(instances); m_errorMessage = null; m_targetSI.setUpper(instances.numAttributes() - 1); m_target = m_targetSI.getIndex(); Instances inst = new Instance...
8
final void method1337(int i) { anInt2300++; ((Class174) this).anInt2298 = Class70.cosineTable[anInt2302 << 259569763]; long l = (long) ((Class174) this).anInt2291; long l_10_ = (long) ((Class174) this).anInt2290; long l_11_ = (long) ((Class174) this).anInt2294; ((Class174) this).anInt2299 = (int) Math.s...
5
private CardPower isFourOfKind(int[] valueCounts) { int highCard = -1; int kickerCard = -1; for (int i = valueCounts.length - 1; i >= 0; i--) { if (valueCounts[i] == 4) { highCard = i; break; } } if (highCard >= 0) { for (int i = valueCounts.length - 1; i >= 0; i--) { if (i != highCard &&...
6
public void handle(String target,Request baseRequest,HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException { response.setContentType("application/json;charset=utf-8"); response.setStatus(HttpServletResponse.SC_OK); baseRequest.setHandled(true)...
9
private void ResetFinanceTables() { if(table_FinanceData != null) { while(table_FinanceData.getRowCount() > 0) { ((DefaultTableModel) table_FinanceData.getModel()).removeRow(0); } } if(table_FinanceDetails != null) { while(table_FinanceDetails.getRowCount() > 0) { ((DefaultTa...
4
@Override protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.fill(new Rectangle(getPreferredSize())); drawBackground(g2, board); for (int row = HIDDEN_LINES; row < board.getHeight(); row++) { for (int col = 0; col < board.getWidth(); col++) { ...
5
private void traverseGrid(final String prevString, final int currentx, final int currenty, boolean[][] visited) { if (currentx < 0 || currentx >= this.getWidth() || currenty < 0 || currenty >= this.getHeight() || visited[currentx][currenty]) return; visited[currentx][currenty] = true...
9
private String getCombinedList() { StringBuilder total = new StringBuilder(); for ( int i = 0; i < javaVariables.size(); i++ ) { StringBuilder list = new StringBuilder(); switch ( databaseType ) { case H2: case ORACLE: list.append( sqlVar...
5
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> alread...
8
public AffineTransform getCoordTransform() { return coordTransform; }
0
@Override public void requestFocus() {}
0
private void makeResult() { if (mode == ADD_MODE) { TProjectData pData = project.getProjectData() ; TProjectFileList liste = pData.getAvailableLangs() ; int keysBefore = pData.getRowCount() ; // insert a file, if available String str = filenameField.getText() ; if ((str !...
7
private static int[][] calcFrom(char[][] grid, int N, int M) { int[][] from = new int[N][M]; from[0][0] = 1; for (int i = 1; i < M; i++) { if (grid[0][i] == '#' || from[0][i-1] == -1) from[0][i] = -1; else from[0][i] = from[0][i-1...
9
public void runSimulation() throws VehicleException, SimulationException, IOException { this.log.initialEntry(this.carPark, this.sim); for (int time = 0; time <= Constants.CLOSING_TIME; time++) { // queue elements exceed max waiting time if (!this.carPark.queueEmpty()) { this.carPark.archiveQueueFailu...
5
private boolean isLinkInDirection(Direction direction) { int xPos = x; int yPos = y; // Search in the direction until a wall or Link is encountered. while (!objects.isWallAtPosition(xPos, yPos)) { // Increment the direction specified. switch (...
6
public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; if (this.materialType == Material.water) { this.particleRed = 0.2F; this.particleGreen = 0.3F; this.particleBlue = 1.0F; } ...
8
public Relation(State stateFrom, State stateTo, String symbol) { this.stateFrom = stateFrom; this.stateTo = stateTo; this.symbol = symbol; if (stateFrom == null || stateTo == null) { throw new IllegalArgumentException("Relation can't be build on null states."); } if (stateFrom == stateTo) { throw n...
3
private void performHashFunctionTests(){ String hashFunc = (String) this.hashFunction.getValue(); Path[] paths = new Path[selectedFiles.length]; for(int i=0; i<selectedFiles.length; i++) paths[i] = Paths.get(selectedFiles[i].getAbsolutePath()); if(this.jRadioButtonVitesse.isSelected()) hash.HashFunctio...
4
List<Range> exclude(Range another) throws RangesNotMergeableException { if (!isOverlappedWith(another)) throw new RangesNotMergeableException(this, another); final List<Range> result = new ArrayList<Range>(); if (another.contains(this)) return result; if (contain...
9
public Blog saveBlog(Blog pBlog){ return this.blogModelBS.saveBlog(pBlog); }
0
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the ...
9
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
6
@Override protected void controlUpdate(float tpf) { if(gameInfo.playerNode != null && lastFloor != gameInfo.playerNode.getFloor()) { if(gameInfo.playerNode.getFloor() < floor && !isInvisible) { //Make invisible setInvisibility(true); } else if(gameInfo...
6
@Override public boolean equals( Object otherObj ) { if ( this == otherObj ) { return true; } if ( otherObj == null || !(getClass().isInstance( otherObj )) ) { return false; } Pair<T1, T2> otherPair = getClass().cast( otherObj ); return (first == null? otherPair.first =...
6
@Override public void setValueAt(Object value, int rowIndex, int columnIndex) { Language language = languages.get(rowIndex); switch (columnIndex) { case COLUMN_NAME: language.setName(value.toString()); break; case COLUMN_FILE_EXTENSION: language.setFileExtension(value.toString()); break; case CO...
4
private String readLine(Socket client) throws IOException { InputStreamReader in = new InputStreamReader(client.getInputStream()); int offset = 0; boolean receivedNewline = false; do { int length = in.read(inputBuffer, offset, inputBuffer.length - offset); if (length == -1) { return null; } else ...
7
@Override protected void paintComponent(Graphics g) { g.setColor(Color.WHITE); g.fillOval(0, 0, R*2, R*2); g.setColor(Color.BLACK); g.drawOval(0, 0, R*2, R*2); g.drawString(id, R-5, R/2+3); if(signal.length()>0){// TODO знову якісь костилі, пов'язано з тим, щ...
3
public String getValue() { try { return readValue(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block ...
3
public void setQuantity(String quantity) { this.quantity = quantity; }
0
public void addLockUnlockUnitsForThread2() { Iterator unitIt = this.unitChain.iterator(); while (unitIt.hasNext()) { Unit u = (Unit) unitIt.next(); Stmt s = (Stmt) u; Iterator boxIt = s.getUseBoxes().iterator(); while( boxIt.hasNext() ) { final ValueBox box = (ValueBox) boxIt.next(); ...
8
public long[] roots() throws Exception { ArrayList<Polynomial> lf = this.factor(1); // factorize into monomials // check factors are all monomials, eliminate any constants int constants = 0; for (Polynomial f : lf) { int x = f.degree(); if (x > 1) return new long[...
5
private static String stringConverter(String in) { String out = ""; int level = 0; String[] sep1 = in.split("\\["); for (int i = 0; i < sep1.length; i++) { String[] sep2; boolean found = false; if (sep1[i].indexOf("]") != -1) { sep2 = s...
9
public Cycle add(FigurativeNumber number) { // Printer.print("attempt : " + number + " first two " + firstTwoOfFist); if (isCycle.isPresent()) { if (isCycle.get()) { // Printer.print("Nothing added. Cycle is already a cycle"); return this; } ...
7
public void run(){ while(true){ TankClient.this.repaint(); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } } }
2
private void start() { List<File> tempMoveFile = new ArrayList<File>(); for (int i = 0; i < list_main.size(); i++) { for (int j = i + 1; j < list_main.size(); j++) { for (int iIn = 0; iIn < list_main.get(i).size(); iIn++) { for (int jIn = 0; jIn < list_mai...
7
private CFGResult funcBody(String funcName, VariableTable globalVarList, ArrayList<String> paramsList) throws SyntaxFormatException, IOException { VariableTable localVar = varDecl(); for (VariableTable newDecl = varDecl(); newDecl != null; newDecl = varDecl()) { localVar.append(newDecl); } // Take every p...
4
@Override public String toString() { return String.format( "containsMethod(%s(%s))", this.name, Arrays.toString( this.argumentsType ) ); }
0
public void addNote(String userId, String note) throws Exception { if(currentUser == null || currentUser.getDepartment() != Department.COMPUTER_SCIENCE || (currentUser.getRole() == Role.STUDENT && !(userId.equals(currentUser.getId())))) { Exception exception = new InvalidUserException("Invalid user"...
9
public byte[] getPacket() throws IOException { int lengthHi = 0; int typ = 0; int lengthLo = 0; int length = 0; int pos = 0; typ = _in.read(); // System.out.println(typ); switch (typ) { case 0xc1: case 0xc3: { length = _in.rea...
9
public void visit_if_acmpne(final Instruction inst) { if (longBranch) { final Label tmp = method.newLabel(); addOpcode(Opcode.opc_if_acmpeq); addBranch(tmp); addOpcode(Opcode.opc_goto_w); addLongBranch((Label) inst.operand()); addLabel(tmp); } else { addOpcode(Opcode.opc_if_acmpne); addBranc...
1
public Sprite createSprite(String oldName, String newName, int pos, int z) throws IOException { oldName = oldName.toLowerCase(); int x = 0; int y = 0; BufferedImage image = null; for (Tuple2<String, BufferedImage> entry : imageCache) { if (entry.x.equals(oldName)) { image = entry.y; break; } ...
9
public static dtAllocHint swigToEnum(int swigValue) { if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) return swigValues[swigValue]; for (int i = 0; i < swigValues.length; i++) if (swigValues[i].swigValue == swigValue) return swigValues[i];...
5
public static ArrayList<bRegistro> PesquisaFun(String arg_serial) throws SQLException, ClassNotFoundException { ArrayList<bRegistro> sts = new ArrayList<bRegistro>(); ResultSet rs; Connection conPol = conMgr.getConnection("PD"); if (conPol == null) { throw new SQLException("N...
3
private void resolveLine(Node lineNode) throws RrdException { if(hasChildNode(lineNode, "datasource")) { // ordinary line definition validateTagsOnlyOnce(lineNode, new String[] { "datasource", "color", "legend", "width" }); String datasource = getChildValue(lineNode, "datasource"); String colorStr =...
4
public void contextInitialized(ServletContextEvent arg0) { CometContext cc = CometContext.getInstance(); Map<String, String> rtnMap = new HashMap<String, String>(); // 注册应用的channel cc.registChannel(CHANNEL); Map<String, MeasureSite> siteMap = new HashMap<String, MeasureSite>(); // 获取当前机器所有的COM端口 portList...
5
private void saveToFile() { try { FileOutputStream fileOut = new FileOutputStream(CONFIG_FILE); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(this); out.close(); fileOut.close(); } catch (IOException e) { e.printStackTrace(); } }
1
public ResultatComparaison comparerAvec(Combinaison autreCombinaison) { int nombreDePionsBienPlaces = 0; int nombreDePionsMalPlaces = 0; boolean[] pionANegligerDansLaCombinaison = new boolean[this.pions.length]; boolean[] pionANegligerDansLAutreCombinaison = new boolean[this.pions.length]; for (int numeroD...
8
public void setIsRunning(boolean running) { this.running = running; }
0
public void append(char c) { // array full? if (top == capacity) { // double the space resize(capacity * 2); } // insert data[top++] = c; }
1
@Override public boolean equals(Object rhs) { if (this == rhs) { return true; } if (rhs == null) { return false; } if (!(rhs instanceof BaseAccount)) { return false; } BaseAccount other = (BaseAccount) rhs; if (acctNumber != other.acctNumber) { return false; } if (Double.compare(this.ba...
8
public final JSONObject optJSONObject(String key) { Object o = opt(key); return o instanceof JSONObject ? (JSONObject)o : null; }
1
public void actionPerformed(ActionEvent evt) { if (actionListeners != null) { Object[] listenerList = actionListeners.getListenerList(); // Recreate the ActionEvent and stuff the value of the // ACTION_COMMAND_KEY ActionEvent e = new ActionEvent(evt.getSource(), evt.getID(), (String) getValue(Action...
2
static double[][] transpose(double[][] A){ double[][] B = new double[A[0].length][A.length]; for(int i = 0; i < A.length; i++){ for(int j = 0; j < A[i].length; j++){ B[j][i] = A[i][j]; } } return B; }
2
private void doViewAllUser(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String pageNum = StringUtil.toString(request.getParameter("pageNum")); if("".equals(pageNum)) { pageNum = "1"; } try { Pager<User> pager = ...
2
public int getLeft(int yBottom, int range, TBlock movingBlk) { int maxX = 0; int yTop = yBottom + range; for (TBlock blk: blks) { if (!blk.equals(movingBlk)) { TSquare[] sqs = blk.getSquares(); for (int i = 0; i < sqs.length; i++) { Point2D pInContainer = blk.getSqCoordinate(i); in...
5
public void run(IAction action) { try { if ("unknown".equals(this.selected)) { MessageDialog.openInformation(new Shell(), "Easy Explore", "Unable to explore " + this.selectedClass.getName()); EasyExplorePlugin .log("Unable to explore " + this.selectedClass); return; } File directory =...
9
private void btn_scanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_scanActionPerformed try { CommPortIdentifier cpid = CommPortIdentifier.getPortIdentifier(port); sp = (SerialPort) cpid.open("Virtual 3D Designer", 3000); os = sp.getOutputStream();...
9
private void sink(int k) { while (2 * k <= N) { int j = 2 * k; if (j < N && greater(j, j + 1)) j++; if (!greater(k, j)) break; exch(k, j); k = j; } }
4
public void askAttendant(ArrayList<Attendant> aList){ if (!free){ for (int i=0;i<aList.size();i++){ if (aList.get(i).free()){ aList.get(i).busy(); } } } }
3
public int canJump(String side, Hexpos pos){ State state = this; if(side != "red" && side != "blue") return -1; if(state.owner(pos) != null) return 0; MyList jumpArea = pos.jumpNeighbours(); for(Object tmp : jumpArea){ if(state.owner((Hexpos)tmp) == side) return 2; } return 1; }
5
public void saveStatus(){ // EDebug.print("I have been called upon"); if (wait){ wait = false; return; } // EDebug.print("\nFirst place"); // for (int i = 0; i < myDeck.size(); i++) // EDebug.print(((LinkedList)myDeck).get(i).hashCode()); // ...
4
public final String getAuthor() { return author; }
0
@Override public void execute(String[] args) { String dbId = args[1]; String[] userNames = args[2].split(";"); String path = args[3]; Db db = DbFactory.getDb(dbId); String triggersPath = path + "triggers\\"; String functionsPath = path + "functions\\"; S...
4
public static void main(String[] args) { //initialize game BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = null; initializeGame(); drawBoard(); //game loop while (true){ //read the player's move input = null; try { ...
8
public List<Flight> searchUserFlight(FlightDTO dto) { List<Flight> flights = null; String DepArrKey = (dto.getDepLoc() + dto.getArrLoc()).toUpperCase(); try{ flights = FlightData.getDepArrivalFlights(DepArrKey); } catch(NewCustomException exception){ exception.printMessage(); } if(flights!=null){ ...
5
public static double getApproximateHeight( java.awt.Font f, String s, double w ) { double len = StringTool.getApproximateStringWidth( f, s ); while( len > w ) { int lastSpace = -1; int j = s.lastIndexOf( "\n" ) + 1; len = 0; while( (len < w) && (j < s.length()) ) { len += StringTool.getApproxi...
7
public synchronized void update(long elapsedTime) { if (frames.size() > 1) { animTime += elapsedTime; if (animTime >= totalDuration) { animTime = animTime % totalDuration; currentFrame = 0; } while (animTime > getFrame(currentFrame).endTime) { currentFrame++; } } }
3
private void sotilaanKorottaminen(int korMista, int levMista, int korMinne, int levMinne, List<int[]> mahdollisetSiirrot) { if (nappula[korMista][levMista].nimi() == 's') { for (int[] s : mahdollisetSiirrot) { if (s[0] == korMinne && s[1] == levMinne && (korMinne == 0 || korMinne == ...
6
public void write (Kryo kryo, Output output, Map map) { int length = map.size(); output.writeInt(length, true); Serializer keySerializer = this.keySerializer; if (keyGenericType != null) { if (keySerializer == null) keySerializer = kryo.getSerializer(keyGenericType); keyGenericType = null; } Serializ...
9
* @param carrier The carrier to board. * @return True if the unit boards the carrier. */ public boolean boardShip(Unit unit, Unit carrier) { if (!requireOurTurn()) return false; // Sanity checks. if (unit == null) { logger.warning("unit == null"); return fa...
8
public boolean isBlocked(boolean front) { if (front) { for (Creature c : game.getCreatures()) { if (c.getLocation() == current.getNeighbors()[faceTo]) { return true; } } return false; } else { for (Creature c : game.getCreatures()) { if (c.getLocation() == current.getNeighbors()[backTo]...
5