method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
05f403a5-744b-4af9-a0fc-82bfbf37b2fe
8
@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...
9fa526ed-7a95-4a29-8222-ce55d80ede8d
2
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...
f52d2a94-481a-4dc7-ad52-1f4d0c864f2e
9
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...
2930f92f-8ff1-48bf-aa4a-e9c924313dcd
4
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...
405ddfa3-22a4-4ac8-a8d5-988739bf88dd
8
@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...
b7a7a965-0756-4df4-b0ee-81eea6485087
4
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 ...
39ba5362-972f-4d96-b128-22765499bc2d
0
public long getType() { return this._type; }
fbfbc5e2-88f1-449b-a54f-f2da1def0167
0
public Integer getPassRate() { return this.passRate; }
c3ef122e-9a7c-49e3-8320-798845869992
6
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...
82692e9f-8425-40c4-8d8f-fa480d791ca3
4
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...
e9dbea9e-1d5c-459f-820a-35164586c19e
6
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...
c838c944-d6b7-409e-9392-e879283f61f1
3
@RequestMapping(value = "/{contactId}", method = RequestMethod.DELETE, produces = "application/json") public ResponseEntity<?> delete(@PathVariable("contactId") int contactId, @RequestParam(required = false) String searchFor, @RequestParam(requ...
62252a62-463c-410f-baa2-d0fd70a6e396
0
public final void setLineIncrement(double increment) { incrementWidth = increment; parametersToNumbers.put("lineIncrement", new Double(increment)); }
fe6f92b0-0124-4369-a8de-d9517cf662e1
7
@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...
6d11977f-73de-43bc-b5fa-d30d0b296649
8
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...
6a96c135-3758-458d-a581-993d1d9cdf9e
4
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"); } }
1eb1c61e-2074-4520-8905-65e08c05fe78
3
@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()); ...
ce98fb95-5ec2-4fc7-acdd-f41864efe85f
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...
64a0da58-63fb-4988-89c7-4fe3084b61d2
6
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); ...
5366778f-ac25-4449-8dcd-b173524204a4
3
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 (...
5aeda940-512c-4817-93de-fb8073419e68
8
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...
777774c6-fc59-407a-870a-b11d935f8fcb
0
public void setX2Coordinate(double x) { this.x2Coordinate=x; }
1e274f5a-a2f9-48e5-aed3-a42365540cc7
5
@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) -...
0a0ee226-26ab-451a-a46f-c586e96f2016
3
@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...
8be1d5cf-b349-454e-b6ea-11d242ffc199
6
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...
8e137f6f-baa0-4405-8466-4c5f6c0e77fa
7
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; ...
4721b119-d7e2-4408-9f1b-39dec1560376
1
private void decreaseLife(int value){ this.life_delay -= value; if(life_delay <= 0){ this.life -= 1; life_delay += 100; } }
e3738db3-0a4d-4231-9171-261f3ee73209
5
public void sendMoveStatus() throws GameOverException { if (game) { if (isAttack) { sendAttackMessage(isSecondPlayerInMove); if (player1.getHealth() <= 0) { game = false; sendGameOverMessage(1); throw new Gam...
2e8914af-6c83-49df-b757-54b76960c7b5
4
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....
0b57fd5f-82ce-4a78-8681-9510fbb40a5d
8
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...
c6e53675-2c33-45d1-a474-55d646d5353c
5
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...
bacb40b3-abf8-497f-bb1e-e57f689c4b44
6
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 &&...
42816634-3f1a-4794-b673-2ffc76e37d77
9
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)...
4b1a17d2-b672-4e30-bfd2-a4b33d50dacf
4
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...
362d3fe1-6829-4562-9ee2-9a4351053674
5
@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++) { ...
d9ab58f4-7a1a-47d7-9af1-9197253b9cec
9
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...
16fba31f-d63a-495d-b7e8-ffa981cbc345
5
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...
83da9a5c-4861-42d3-8786-deb3404959d6
8
@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...
26e50524-2561-46aa-a4d1-534bcded3897
0
public AffineTransform getCoordTransform() { return coordTransform; }
4f139758-1472-4364-bec9-440f1aa5c19c
0
@Override public void requestFocus() {}
c9ed6c38-7f33-4556-9c5e-ce98d0b43b31
7
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 !...
a499addb-d51f-464f-b6fb-6010c1c737e1
9
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...
14aa4657-a9d5-40eb-b9d0-3cefce075215
5
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...
333234f5-912a-49f4-8ab6-a97445799e17
6
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 (...
4095523c-98dc-4da1-8dfa-d3d50fa71a60
8
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; } ...
7ae0af91-8361-4b06-be1a-80b77e4caddc
3
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...
71997a33-4815-4293-84d5-d45145498594
4
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...
d1ad8ae7-795c-496b-9b15-b6ed3183cc19
9
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...
07dbf571-7164-471a-bf59-9a44a8a8158a
0
public Blog saveBlog(Blog pBlog){ return this.blogModelBS.saveBlog(pBlog); }
f6770e15-114e-45a6-9bd9-d445dee221e7
9
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 ...
d1bd987f-47e5-4082-8ff5-78fa828dca04
6
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()); ...
c1c7a197-7971-4d03-b7cb-87c262a01edc
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...
cc90d549-9f86-4dbc-9b0a-90d2f7a7b6c0
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 =...
9c1c9d60-544b-401f-834b-fee9bf0ac2f1
4
@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...
28573dd0-ea09-46e9-adbc-b5396b7c3295
7
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 ...
436a8ec6-490f-4156-bceb-e4c59b12ef5a
3
@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 знову якісь костилі, пов'язано з тим, щ...
b7995034-389b-44d7-b1bf-8975b8ae3355
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 ...
a9a49e75-7bce-45ea-b507-f108a7d02bf2
0
public void setQuantity(String quantity) { this.quantity = quantity; }
e85d0264-9cd0-4f60-ae62-31230bf9f945
8
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(); ...
5d4ce352-0ef3-421b-86e0-6f75f15937f8
5
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[...
a96563a4-6ff2-41a8-8664-1a96abd441f4
9
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...
2c11f86f-b862-4c59-9d4a-9ec2515894bd
7
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; } ...
a46e2ba8-070e-4cb4-8011-f636049d63d7
2
public void run(){ while(true){ TankClient.this.repaint(); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } } }
4856d406-0d91-4460-8c93-642f6a2efc03
7
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...
be521237-ba1f-49d2-9d98-c77cb25d9d45
4
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...
c82ffbe6-b7d7-489a-a097-0120b0276747
0
@Override public String toString() { return String.format( "containsMethod(%s(%s))", this.name, Arrays.toString( this.argumentsType ) ); }
a6c41822-b09f-4a97-9566-72d3d764e03d
9
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"...
bf1e9977-6597-418b-9f2f-9a8eb0de8a58
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...
7aca8af5-edf0-4a49-9d46-d55b468589fc
1
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...
a0d5b6be-ab14-4702-bf60-62e676c11e85
9
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; } ...
ea8ebea1-99ea-48dd-999b-16ad27949fc9
5
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];...
7c1f5a11-27d6-46e6-87ea-f4b7b6550e6b
3
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...
ac8c287f-a6b3-4e9d-bbf8-324fc151a16a
4
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 =...
0e5530a3-166c-4031-9dde-4570a8f5c09c
5
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...
270e8698-9ea3-49f9-85da-e6762d514442
1
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(); } }
2305ba44-7c38-4082-83d1-4d0152f0a229
8
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...
abf940e9-4878-4379-a4bb-97fa29fc98d1
0
public void setIsRunning(boolean running) { this.running = running; }
cea4d18b-e86f-46b9-9e0c-84de65752950
1
public void append(char c) { // array full? if (top == capacity) { // double the space resize(capacity * 2); } // insert data[top++] = c; }
2bc6c969-f1ca-4216-b864-bc03c4c33de3
8
@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...
2b74ee48-a8a6-43ec-88ed-ce8231751027
1
public final JSONObject optJSONObject(String key) { Object o = opt(key); return o instanceof JSONObject ? (JSONObject)o : null; }
7f7e23fd-d52b-41f9-907a-62fc794d2652
2
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...
71339bda-32ac-4a53-9a30-762a6fa11747
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; }
3a013c61-d159-4b66-bb73-7d1862fae28a
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 = ...
8f1246ca-9d0b-4846-9caf-f66a2d8720a2
5
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...
dea305a0-772a-4f2d-a271-dc41517cb041
9
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 =...
ee99fc76-54d8-4712-8961-54a2bc73d0dd
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();...
c684a216-19f0-4a66-b101-5d3af1f1ef41
4
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; } }
ec2f7126-1186-4e10-a16a-c748f2e32901
3
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(); } } } }
d98741f1-e0a5-4673-afb0-c7051993a197
5
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; }
8426437b-7c76-48c7-a507-bfaa7778b108
4
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()); // ...
ba01d6ca-bcfe-40ed-b6ce-9788031ad51a
0
public final String getAuthor() { return author; }
87e078c8-c6ba-4340-a324-ef90b2d1395a
4
@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...
6995b4c1-4c06-4b31-94dc-70e084407dbc
8
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 { ...
58c068b6-2e59-4aad-b5b5-e32b4374e3fb
5
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){ ...
4c85544b-2a64-4d8b-b81b-1307205ef12a
7
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...
01ba20bb-e0d4-4bd0-bf20-8df70bf13ad2
3
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++; } } }
217c29e3-d1cb-4fd5-9974-7d3271d48255
6
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 == ...
9cb04e4d-e5dd-4212-909c-62be9b8904d7
9
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...
13fbfa27-1da8-4e81-b1ee-83e58f58e981
8
* @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...
7d883f4a-ab13-48cc-8426-276ad0f506ac
5
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]...