method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
eb7b605a-9fb7-46a1-92ae-8de5ebd50da5
0
private Angle(String name) { this.name = name; }
c67bda7b-c2d6-4937-ba63-262135628dc2
7
private Read map(Read r) { List<Kmer> kmers = r.getKmers(); for (int x = 0; x < this.genome.length; x++) { for (Kmer kmer : kmers) { if (this.genome[x].getKmerMap().containsKey(kmer.getSequence())) { for (int pos : this.genome[x].getKmerMap().get(kmer.getS...
82e4fe54-64ae-4625-a1de-526793374ff9
0
public int getGridSize() { return gridSize; }
02fb884b-1b43-405a-97a6-9e5f04998f76
8
public void callLift(Player playerSender, int liftID, int floor){ Lift lift = getLift(liftID); int orig = lift.getLiftPosition(); int dest = lift.getY(floor); int liftX = lift.getLiftX(); int liftZ = lift.getLiftZ(); int doorHeight = lift.getDoorHeight(); Location wall1Loc = lift.getWall1Loc();...
37c55336-892c-46fe-bb1d-282d62747f6b
2
public static void printToExcel(ArrayList<Long> graf, String f_name){ File f = new File(f_name); //Convert to mb int packSize = (int) ((Params.nPacks * Params.packSize) * 0.00000096367); System.out.println(packSize); try{ FileOutputStream fout = new FileOutputStream(f); DataOutputStream dou...
fbbb01af-4da3-4cf8-bb42-ea94eaa5dafe
2
private int findKeyIndex(K key) { // Check every position -- if we find the key, return the index; for (int i = 0; i < size; i++) { if (mapArray[i].getKey().equals(key)) { return i; } } // If we didn't find the key, return -1 return -1; }
c7d975e7-c7cd-4533-85b2-6d28b386d05d
1
public void testSearch() { FolderTreeSearcher s = new FolderTreeSearcher(); try { s.search("/", "test.json"); } catch(Exception e) { e.printStackTrace(); } }
6631eea4-7e78-484e-84bf-6d15136cac56
9
public static void main(String[] args) { RPK RPK_out = new RPK(); RPK RPK_in = new RPK(); Params p = new Params(); Client.setIP_address("176.189.122.201");// 176.189.122.201 //localhost Client.setConnection_port(6528); Client.setConnect(false); Client.startClient(); // TODO Auto-generated method st...
77141b15-3a13-4b80-9fed-e4ddddc11b5e
1
public void updateParallax(int x, int y) { Parallax parallax = null; int camMapX = registry.getGameController().getMapOffsetX(); int camMapY = registry.getGameController().getMapOffsetY(); for (int i = 0; i < parallaxBackgrounds.size(); i++) { parallax = parallaxBackgrounds.g...
d4a7f691-3762-4e77-aafe-f9e7a054b9aa
6
public void generationAleatoire() throws Exception{ Scanner sc = new Scanner(System.in); Date date = new Date(); TachePeriodique tacheP; //tâche périodique Tache tacheA; //tâche apériodique int Di = 0; System.out.println("Donner nombre taches périodiques aléatoires: "); int nbTaches = sc.nextInt(); if( ...
0ad5118f-781b-4d2f-8ae7-50fa4aeaf406
0
public StackPane initContent() { StackPane content = new StackPane(); content.setAlignment(Pos.TOP_LEFT); content.setPadding(new Insets(8, 5, 5, 5)); content.getStyleClass().add("popUpBody"); content.setMinHeight(50); GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPaddin...
1257bd43-53ee-4b10-bf16-b67a8e0d6d28
9
public void valueChanged(ListSelectionEvent e) { if(e.getSource().equals(lst1)){ this.remove(fontList); this.remove(fontSizeList); if(lst1.getSelectedValue().equals("font")){ add(1, 0, 1, 1, fontList, gbl, gbc); } else if(lst1.getSelectedValue().equals("font size")){ add(1, 0, 1, 1, fo...
340521da-b346-4599-8303-a75c55c707e9
1
public Actor remove(Location loc) { Actor occupant = getGrid().get(loc); if (occupant == null) return null; occupant.removeSelfFromGrid(); return occupant; }
c72eaeb3-dcb4-4e54-9f18-061d2fe8fcc6
1
public void save() { try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(fileName)); ...
c768076b-f0f5-4ef2-a28c-6d649936494e
7
public static double[][] getMarkerAlleleTotals(List<Accession> accessions) { if (accessions.size()==0) return null; Accession a1 = accessions.get(0); int markerCnt = a1.numSSRMarkers(); double markerAlleleTotals[][] = new double[markerCnt][]; ListIterator<List<Double>> mItr = a1.getSSRValues().listIterator(); L...
3a9879f8-16ca-425f-b006-09a07feecfeb
6
public Move findRandomMove(String player) { // Check if player is valid (so we don't have to worry about // null pointers later). if (player == null || ! (player.equals("red") || player.equals("blue"))) return null; MyList moves = new MyList(); ...
fbd3215b-4201-45e7-87ff-eb54f7281bb5
1
public void newEntry(final String name) throws IOException { makeDirs(name); currEntry = new JarEntry(name); currEntry.setTime(System.currentTimeMillis()); if (compress) { currEntry.setMethod(ZipEntry.DEFLATED); } else { currEntry.setMethod(ZipEntry.STORED); } this.putNextEntry(currEntry); FunkyJ...
9818b12f-a31e-4f89-901a-006b11b339b9
2
public Coordinate getEndPoint2() { Coordinate coord2 = new Coordinate(0,0); if ((rotation % 2) == 1 ) { coord2 = new Coordinate(x+100, y); }if ((rotation % 2) == 0 ) { coord2 = new Coordinate(x, y+100); } return coord2; }
c74bd02a-be1b-47de-8372-1fa65bd4793c
0
@Override public String getGUITreeComponentID() {return this.id;}
f1cc3482-932c-4513-b9b2-d8930b1414d5
3
protected void paintBackground(Graphics g) { if (graphComponent != null) { Graphics2D g2 = (Graphics2D) g; AffineTransform tx = g2.getTransform(); try { // Draws the background of the outline if a graph exists g.setColor(graphComponent.getPageBackgroundColor()); mxUtils.fillClippedRect(g,...
1106f59a-27cc-41ba-b6a4-8f1cc2430b8b
5
private static void checkJar(URL resource, String pkgname, List<Class<?>> classes) { String jarPath = resource.getPath() .replaceFirst("[.]jar[!].*", ".jar").replaceFirst("file:", ""); try (JarFile jarFile = new JarFile(jarPath)) { String relPath = pkgname.replac...
33757644-2679-428a-88cb-fb1dd8945a8e
4
public EnglishCharacter getCharacter(int characterCode){ EnglishCharacter character = characters.get(new Integer(characterCode)); if (character == null){ switch (characterCode){ case 1 : { character = new CharacterA(); break; } case 2 : { character = new CharacterB(); break; }...
efad80d0-86b0-4e4e-9864-5272ca530a85
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final SequenceOf<?> other = (SequenceOf<?>) obj; if (values == null) { if...
05238ebe-a783-4501-8077-52706cbf11ec
4
public String translate(int aNumber) { String result = ""; while (aNumber > 0) { for (int i = RomanBoundaries.values().length - 1; i >= 0; i--) { final RomanBoundaries boundary = RomanBoundaries.values()[i]; final int value = boundary.getValue(); ...
cbe6fadd-e1fb-4376-87ab-c7ad9bfd1104
8
private void setEditorBarStatus() { if (mainfolder.getSelection().getControl() instanceof EditorComposite) { SymitarFile file = ((EditorComposite) mainfolder.getSelection().getControl()).getFile(); if (file.getType() != FileType.REPGEN || file.isLocal()) install.setEnabled(false); else install.setEna...
0cb96fa6-d4dc-44ff-a4c9-011d6c688f37
4
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!plugin.hasPerm(sender, "support", false)) { sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use /" + label); return true; } if (args.length < 1) { sender.sendMessage(CraftEsse...
af4c71dc-3c7f-47fa-b025-d22ece3c191a
2
protected String parseString(String s, HashMap<String, String> strings) { do { int b = s.indexOf("<"); if (b != -1) { int e = s.indexOf(">", b); s = s.substring(0, b) + strings.get(s.substring(b + 1, e)) + s.substring(e + 1, s.length()); } else { break; } } while (true); return s; }
caeb7339-16e1-40e3-8c46-5c828b57faf0
5
public static ArrayList<Achievement> updateAchievement(User user) { ArrayList<Achievement> records = AchievementRecord.getAchievementsByUserID(user.userID, HIGHSCORE_TYPE); ArrayList<Achievement> newAchievements = new ArrayList<Achievement>(); for (int i = 0; i < getAllAchievements().size(); i++) { Achievement...
6e0f52dc-c28f-4590-918c-b6af29f41d47
6
public Node solution(Node node1, Node node2, Node root) { // Base case, check whether a tree exists if (root == null) { return null; } // Base case, if root is one of the two nodes if (root == node1 || root == node2) { return root; } Node L = solution(node1, node2, root.getLeftChild()); Node R = ...
797dfd95-be71-40ae-83da-41d58cadb31a
7
void postRiderEvent(int event, int floor, int elevator) { int direction = dirNeither; if (elevator != -1) { Lib.assertTrue(elevator >= 0 && elevator < numElevators); direction = elevators[elevator].direction; } RiderEvent e = new RiderEvent(event, floor, elevator, direction); for (int i = 0; i < numRid...
ac2b6891-f2bb-409e-a2a2-9f7ab7444adb
2
public static String getEnteredText(){ while(!haveRecivedInput){ try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } haveRecivedInput = false; display.setCaretPosition(display.getDocument().getLength()); return lastEntere...
106d0264-33d5-4bb8-ada0-8f41cff7c9b3
9
public static StringBuilder evaluateChildElements(Elements elements,StringBuilder value) { for(Element x : elements) { if(!x.isBlock()) { String txt = x.ownText(); if(txt != null && txt.length() > 0){ value.append(" "); value.append(txt.trim()); } } else { Elements children...
55415ae3-b11d-4837-8733-e37053bd55e0
0
public void setFood(boolean b) { this.hasFood = b; }
357ee413-2f43-4d78-9ee6-b83a61399d90
5
public void signAndSaveMessage(String message) { // die Nachricht als Byte-Array byte[] msg = message.getBytes(); Signature rsaSig = null; byte[] signature = null; try { // als Erstes erzeugen wir das Signatur-Objekt rsaSig = Signature.getInstance("SHA1wi...
983a3d63-7c77-4dc0-8436-486b08e4b27b
2
HyperCube(Sample a, Sample b, Sample midPoint, HyperCube parent) { this.a = a; this.b = b; this.midPoint = midPoint; this.parent = parent; this.InCubeSamples = new ArrayList<Sample>(); InCubeSamples.add(a); InCubeSamples.add(b); ...
37920ca0-233f-4727-833b-49845438d4bb
3
private void gameLoop() { long lastTime=System.currentTimeMillis(), delta=0; while(isRunning) { //System.out.println(delta); update(delta/1000f); Graphics2D g2d=(Graphics2D)(window.getBufferStrategy().getDrawGraphics()); g2d.fillRect(0, 0, window.getWidth(), window.getHeight()); paint(g2d); ...
70acac04-5a85-4cb4-8a35-40de9c450138
3
public JSONArray toJSONArray(JSONArray names) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (int i = 0; i < names.length(); i += 1) { ja.put(this.opt(names.getString(i))); } re...
9b893bde-baff-4851-ac85-c3bc2e1c83f6
6
public static void sharkOcean(Ocean sea) { /** * Visit each cell (in a roundabout order); randomly place a fish, shark, * or nothing in each. */ Random random = new Random(0); // Create a "Random" object with seed 0 int x = 0; int y = 0; int i = sea.width(); int j = sea.he...
ceacf67e-d5e3-4cb9-b3af-c4b2a9393a02
6
@Override public void process() { if (spawnMonster > 0) spawnMonster--; if (spawnMonster == 0) { player.getPestControl().spawnMonsters(); spawnMonster = 15; } if (portalShield > 0) portalShield--; // uhh fuck this.. if (portalShield == 0) { for (NPC n : World.getNPCs()) { if (n.getId() =...
266c2ca7-1287-4825-a4db-ffd989f95aee
4
public StringFormat(int maxCh, int justn) { switch(justn) { case JUST_LEFT: case JUST_CENTRE: case JUST_RIGHT: this.just = justn; break; default: throw new IllegalArgumentException("invalid justification arg."); } if (maxCh < 1) { throw new IllegalArgumentException("maxChars must be positive."...
6f9a7abf-b422-4593-b2d2-1efb26346415
3
public void savingXmlFileAfterSearchingForDataOrSpecialChars() { try { int rVal = chooserForWritingLogFile.showSaveDialog(null); if (rVal == JFileChooser.APPROVE_OPTION) { fileForSavingTheEndResult = chooserForWritingLogFile.getSelectedFile(); // DirName = // fileAfter.getCanonicalPath().substring...
543018d7-dd1a-4ce3-b26e-117d279f6c04
4
@Override public void run() { if (System.getSecurityManager() == null) { System.setSecurityManager(new SecurityManager()); } try { String name = "ICompute"; Registry registry = LocateRegistry.getRegistry(50000); ICompute comp = (ICompute) registry.lookup(name); IRemoteAnswer remoteAnswe...
ba0ee18d-f84b-4671-aab6-d12c178cc881
4
@Override public void control(float delta) { updateMousePos(); if(Gdx.input.isButtonPressed(Input.Buttons.RIGHT)){ rightDown = true; rightDown(delta); } else if(rightDown){ rightDown = false; onRightReleased(); } if(Gdx.input.isButtonPressed(Input.Buttons.LEFT))...
47a396aa-275a-46a8-9185-92d4840c6197
4
public void moveX(int dx) { if( (dx == -1 && this.dx != -1) || (dx == 1 && this.dx != 1)){ this.dx += dx; } }
dbb78173-f088-4c04-b82b-e7d0bf92e66e
0
@Override public String getName() { return this.name; }
f53e0faf-dbb2-43d9-98dd-ffe3d5777cb3
3
public void newGame() { // clear the board for (int i = 0; i < 6; i++) { arLblPlayer[i].setIcon(null); arLblDealer[i].setIcon(null); } // initialize the deck and hands (or do this in a newGame method) arLblDealer[0].setText("Dealer's Cards"); arLb...
2bbebabb-a606-4165-a21e-89354486860b
6
private Action scanArenaColByCol(Robot robot) { Action actionForTentativeTurn = actionForTentiveTurn(robot); if(actionForTentativeTurn != null) return actionForTentativeTurn; if(robotOnArenaEdge(robot, headingOrientation)){ Orientation current = robot.getCurrentOrientation(); if(!current.toOppsite().equ...
00592d88-8a46-43e0-b833-08a06f5e35bd
8
private void parseString() throws CompilationException { if (Debug.enabled) Debug.check(buf.length()==0); while(true) { switch(c) { case -1: // EOF case '\n': case '\r': case '\'': // these can't be encountered inside String literal consume(-1); break...
7a307e2c-c90a-48b0-ad9c-4e60b0441e1c
9
private boolean makeAvailable(int required) throws IOException { if (avail >= required) return true; if (buf == null) buf = new byte[required > INIT_BUF_SIZE ? required : INIT_BUF_SIZE]; else if (required > buf.length - start) { if (buf.length >= required) { // move the available bytes f...
22e86732-2455-45a1-9566-5ea268125135
4
private void clearReferences(DatabaseUpdater updater, MergeMapping mapping) throws UpdateException { if (mapping.isManyToMany()) { String query = "DELETE FROM " + DB.ESCAPE + "" + mapping.getMappingTable() + "" + DB.ESCAPE + " WHERE " + DB.ESCAPE + "" + mapping.getColumnFrom() + "" + DB.ESCAPE +...
c5b28928-43cf-4642-a16f-c96a977488ce
2
@Test public void testUseItem() throws InvalidActionException { final PlayerInfo player = game.getActivePlayerInfo(); assertEquals(4, player.getInventoryItems().size()); assertEquals(null, game.getFirstItemOnPosition(player.getPlayerPosition())); game.useItemAction(0); assertEquals(3, player.getInventoryIt...
804a2586-e155-4d33-8b9a-7a7e7602f843
7
@Override protected Object encode(ChannelHandlerContext ctx, Channel chan, Object msg) throws Exception { if(chan == null || !chan.isConnected()) { return null; } if(msg instanceof ChannelBuffer) { MessageBuilder bldr = new MessageBuilder(); bldr.writeBytes(((ChannelBuffer) msg)); msg = bldr; } M...
af6ac647-e9e3-43fb-80bf-77058459c083
8
private void doMain(BufferedReader reader, PrintStream writer) throws Exception { int n = Integer.parseInt(reader.readLine()); for (int i = 0; i != n; ++i) { String message = reader.readLine().toUpperCase(); StringBuilder code = new StringBuilder(); for (int c = 0; c != message.length(); ++...
ccd6b50d-78a5-4656-b866-0fee827798b9
6
private void quickSort(int left, int right) { if (right > left) { Object o1 = elementAt(right); int i = left - 1; int j = right; while (true) { while (compare.lessThan(elementAt(++i), o1)) ; while (j > 0) if (compare.lessThanOrEqual(elementAt(--j), o1)) break; // out of while i...
cf61ce9d-3b4d-43ba-8a17-c5f24475b9b2
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (!userId.equals(other.getUserId())) return fa...
6e343645-d63a-4e87-beda-af83d31afca2
1
@Override public void adjust() { boolean enable = false; Openable openable = getTarget(Openable.class); if (openable != null) { enable = openable.canOpenSelection(); } setEnabled(enable); }
e3ea00c9-855b-4b19-b35b-c060f10e35d9
4
@Override public boolean login(String userName, String password, ClientInterface clientObject, int sentBy) { if (!db.checkUser(userName, password)) { System.out.println("falscher Username oder falsches Passwort"); return false; } _userStore.put(userName, clientObject); this.notifyUserListChanged...
dc48c0ec-5cfd-4fb1-8852-49d588f85a9d
0
private void btnRegistrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegistrarActionPerformed int n = Integer.parseInt(txt1.getText()); nuevo(n); setVisible(false); }//GEN-LAST:event_btnRegistrarActionPerformed
5b131566-3778-473c-9dbd-f75f16990be2
1
public final <T> T getClonedObject(Class<T> clazz, String name) { // If we have a valid factory for this clazz and valid asset name if (isValidAssetType(clazz, name)) { return clazz.cast(factoryList.get(clazz).getClonedObject(name, data.get(name))); } return null; }
ef25d783-c191-48e9-914b-298ecf947b6b
3
public void jump() { if (!grounded || Player.dead) return; Vector2D jump = (type == Type.CAT) ? JUMP_VECTOR_CAT : JUMP_VECTOR_DOG; movement = movement.add(jump); //play sound SoundLibrary.playSound("jump.wav"); }
fd6ede18-de10-482c-ac83-bd9d5d8f4f70
2
public void removeEntity(Entity entity) { entities[entity.id] = null; if (entity.sid >= 0 && entity.sid < set.entities.length) set.entities[entity.sid] = null; }
225c97d3-a3cc-40a0-bf58-a2f1a1efc8fa
3
private void generateData(){ numberOfLetters = wordLength.getItemCount(); int cap = (Integer)valueWords.get(Integer.toString(numberOfLetters-1)); if (checkData()){ try{ GenerateDataKit dataKit = new GenerateDataKit(Integer.parseInt(textFieldResult.getText()), ...
7f08c8a6-cf12-45da-8530-0f6f0bbcdba4
5
private String readLine(ByteBuffer buf) { StringBuffer sb = new StringBuffer(); while (buf.remaining() > 0) { char c = (char) buf.get(); if (c == '\r') { if (buf.remaining() > 0) { char n = (char) buf.get(buf.position()); ...
8d36c7be-69c2-46be-9f74-fa476112ff49
2
@Override public void execute() { Bank.open(); ItemCombiner.status = "Opening bank"; final Timer timeout = new Timer(2000); while(!Bank.isOpen() && timeout.isRunning()) { Task.sleep(500); } }
47009492-451a-4c85-9987-44bf71bc127f
6
public static void renderParticles() { List<Particle> particleList = new LinkedList<Particle>(); for (ParticleEmitter particleEmitter : particleEmitterList) { particleList.addAll(particleEmitter.getParticles()); } glEnable(GL_TEXTURE_2D); int[] currentBlendFunc = {GL...
f1b8907a-ba16-4e2e-98a5-5373e1b94953
0
public void copy(Rectangle src) { X = src.X; Y = src.Y; Width = src.Width; Height = src.Height; }
355441ae-ace6-4c5e-a200-e81c57f6f00a
8
public Event[][] getWeek(DateTime startDay) { if (startDay.compareTo(FIRST_SUNDAY) < 0 || startDay.compareTo(LAST_SATURDAY) > 0) { return null; } //Check if date is a sunday DateTime check = new DateTime(FIRST_SUNDAY.toString()); DateTime last = new DateTime(FIRST_SUNDAY.toString()); while (check....
f9f72c9b-28d8-4e3f-b419-ba94b7a24755
7
public static Model loadModel(String location) { Model model = new Model(); List<Vector3f> vectors = new LinkedList<>(); List<Vector2f> textures = new LinkedList<>(); List<Vector3f> normals = new LinkedList<>(); try (Scanner file = new Scanner(new File(location))) { while (file....
4d315265-72e4-4823-91fc-0f413e178209
6
public static void startupCppOutput() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); if ...
4b5b95b9-9fef-4a87-8039-be1e5daa6d37
4
private void jListStatusListeMousePressed(java.awt.event.MouseEvent evt)//GEN-FIRST:event_jListStatusListeMousePressed {//GEN-HEADEREND:event_jListStatusListeMousePressed String ab = ""; for (int i = 0; i < control.getOrderlist().size(); i++) { if (control.getOrderlist().get(i)....
8d2ad90b-59f3-4b4f-a3f4-4f861e95caa0
6
@Override public boolean equals(Object o){ if(!(o instanceof Event)) return false; if(this.sampleStamp == ((Event)o).getSampleStamp() && this.type.equalsIgnoreCase(((Event)o).getType()) && (((this.comment == null)&&(((Event)o).getComment() == null)) || this.comment.equalsIgnoreCase(((Event)o).getComment()))){ ...
daf7a3eb-8de8-4830-bb1b-c39239d63266
7
public boolean accept(File f) { if (f.isDirectory()) { return true; } String extension = FileTools.getExtension(f); if (extension != null) { if (extension.equals("zip") || extension.equals("tar") || extension.equals("rar") || ...
fe21df22-f1a1-4f31-9993-db29aa34215b
0
public StatsTracker(String target) { packetsSent = 0; bytesSent = 0; timer = new Timer(); secondsRunning = 0; this.target = target; }
6ac50e86-33a3-45c9-aaac-eda605c574b1
7
public static void showRanks(Player player) { for (int i = 10; i < 310; i++) player.getPackets().sendIComponentText(275, i, ""); for (int i = 0; i < 300; i++) { if (ranks[i] == null) break; String text; if (i >= 0 && i <= 2) text = "<col=ff9900>"; else if (i <= 9) text = "<col=ff0000>"; ...
4c0cb05a-a26f-47e9-a296-15f331fcd6ae
2
private void block() { gcprint("{"); symtab.begin_st_block(); while( first(f_declaration) ) { declaration(); } while( first(f_statement) ) { statement(); } symtab.end_st_block(); gcprint("}"); }
aac40d60-4719-472e-b42e-0c43b0e5a375
1
public final static Carte getInstance(int largeur1, int hauteur1, float ratio, ArrayList<Chevalier> c){ //if (Carte.AuxQuatresCoinDuMonde==null){ synchronized(Carte.class){ if(Carte.AuxQuatresCoinDuMonde==null) { Carte.AuxQuatresCoinDuMonde= new Carte(ratio, largeur1, hauteur1); Carte.AuxQuatresC...
53b8e0df-5557-4798-ab6e-3c90d867abe9
9
public Format(String formatString) { _staticParts = new Vector(); Vector formatElements = new Vector(); StringBuffer part = new StringBuffer(); boolean insideFormatElement = false; boolean atPercentSymbol = false; for (int i = 0, n = formatString.length(); i < n; i++) { char c = formatStri...
e2f592ac-919f-489a-891b-c235492bda4f
3
public static void main(String[] args) throws JFAuthenticationException, JFVersionException, Exception { // 結果出力ファイル File file = new File("rate.txt"); final PrintWriter printWriter = new PrintWriter(new BufferedWriter(new FileWriter(file))); final ITesterClient client = TesterFactory.getDefaultInstance(); ...
e30ae6b4-18a2-4919-b1df-de5ec30562d2
0
public boolean isRemoving() { return this.aWaitingId.size() > 0; }
7396ccbd-9985-49ad-866a-bde25fc267a9
7
public boolean detectPlayer() { if (player.getCam().getCurrent() != null) { int xdiff = this.location.getX() - player.getCam().getCurrent().getX(); int ydiff = this.location.getY() - player.getCam().getCurrent().getY(); int dir; if (Math.abs(xdiff) + Math.abs(ydiff) == 1) { if (ydiff == 1) {...
46e62c9f-bc8d-41f9-817e-6122de8ac268
8
@Override public String createNewExit(Room from, Room room, int direction) { Room opRoom=from.rawDoors()[direction]; if((opRoom!=null)&&(opRoom.roomID().length()==0)) opRoom=null; Room reverseRoom=null; if(opRoom!=null) reverseRoom=opRoom.rawDoors()[Directions.getOpDirectionCode(direction)]; if((reve...
88b2d7d7-751c-40f8-b34a-c207b8038fc6
0
public static void main(String[] args) { System.out.println("Hello, World!"); }
c2014c7c-a385-4ab8-b623-2eac7a299dac
8
public void mouseDragged(MouseEvent e) { double xOff = my3ddata.ElementAt(my3ddata.ActiveElement).DisplayOffset[otherCanvas1.DimNr]; double yOff = my3ddata.ElementAt(my3ddata.ActiveElement).DisplayOffset[otherCanvas2.DimNr]; if (ROIMoveStarted) { if (! e.isControlDown()) { ROIMoveStart...
eb9296fb-bfec-46ce-9460-9df4a1a8a950
6
public void run() { try { byte[] buffer = new byte[1024]; StringBuffer lastMessage = new StringBuffer(); int len; int lastPos; while (!disconnected && (len = input.read(buffer)) != -1) { lastPos = 0; for (int i = 0; i < len; i++) { if (buffer[i] == 0) { String msg = new Stri...
a7f987af-ac81-4cec-8814-d6f4a2532adb
3
public VariableStack mapStackToLocal(VariableStack stack) { VariableStack newStack = stack; if (instr != null) { int params = instr.getFreeOperandCount(); if (params > 0) { this.stack = stack.peek(params); newStack = stack.pop(params); } } if (jump != null) jump.stackMap = newStack; return...
8e9b9ac0-d13d-4bb9-862c-d0b481b135a6
5
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
bdf3af85-fe17-4b19-a94b-1513aeaa9b5e
3
public static long[] getFactors(long n){ ArrayList<Long> factors = new ArrayList<Long>(); for(int i=2;i<Math.sqrt(n);i++){ if(n%i==0){ factors.add((long)i); factors.add((long)n/i); } } long[] factorsArr = new long[factors.size()]; for(int i=0;i<factors.size();i++){ factorsArr[i] = (long) ...
cfc86bb7-e128-4a50-a015-0a00d52c4564
6
private static boolean isGameOver(int[][] board) { for (int row = 0; row < 4; row++) { for (int col = 0; col < 3; col++) { if (board[row][col] == board[row][col + 1]) { return false; } } } for (int col = 0; col < 4; col++) { for (int row = 0; row < 3; row++) { if (board[row][col] == boa...
520d031d-c623-430a-bdbd-9d058aa5db53
6
private String parseValueForCompile() { try { String strStore = readScriptForCompile(); //functions: if (strStore.equals("+")) return ("+ "+parseValueForCompile()+parseValueForCompile()); if (strStore.equals("-")) return ("- "+parseValueForCompile()+parseValueForCompile()); if (strStore.equa...
b24c061a-30ac-4482-bf0a-bed2086ac0c7
1
public int queueLengthRec(){ if (nextPatient == null){ return 1; } int count = nextPatient.queueLengthRec() + 1; return count; }
0c81b9d3-07df-47d4-b1ce-3f03c1ad459b
6
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...
c161a2bf-e61b-41b6-b9e6-47b6c6375384
7
public static FieldState parseXmlFieldType(FieldType fieldType) { switch (fieldType) { case COMPLETED: return COMPLETED; case DIAMOND: return DIAMOND; case EMPTY: return EMPTY; case GOAL: return GOAL;...
496a37d2-06de-4d35-a33d-e33f1d13aa5b
7
void emitClearLocalsOld(GeneratorAdapter gen){ for(int i=0;i<argLocals.count();i++) { LocalBinding lb = (LocalBinding) argLocals.nth(i); if(!localsUsedInCatchFinally.contains(lb.idx) && lb.getPrimitiveType() == null) { gen.visitInsn(Opcodes.ACONST_NULL); gen.storeArg(lb.idx - 1); } } ...
add2a666-f94f-4c1a-8cb3-6ff3b8b3d5d4
1
public static void initDB() throws ClassNotFoundException, SQLException, IOException { Executor.run("CREATE DATABASE Forum"); String initDbCode = utility.IO.read("init.sql"); String[] commands = initDbCode.split("--NEXT--"); for (int i=0; i<commands.length; i++) Executor.run(commands[i]); }
40705181-0d3e-4453-813a-d510ed4bdc98
1
public void move() { y -= MISSILE_SPEED; if (y > BOARD_HEIGHT) visible = false; }
e04d4da3-04b6-493e-973e-3ff2be2f9b73
0
public boolean isInitialized() { return this.initialized; }
d97a93bb-1983-44b5-a094-0aa24f46070d
2
private void setEndCost(){ if (x == map.startX && y == map.startY){ endCost = 0;} endCost = ( (Math.abs (x-map.endX)) + (Math.abs (y-map.endY)) ); }
33b581dd-ec93-4c64-a4eb-c8c8d6cc2e59
5
public static Piece getPieceFromChar(char in) throws IllegalArgumentException{ Piece out = null; switch(in){ case ChessConstants.KING_PIECE_CHAR:{ out = Piece.KING; break; } case ChessConstants.QUEEN_PIECE_CHAR:{ ...
2225d616-3c2f-44d2-a3a1-42d99d05553a
7
private void loadResourceTypes(String fn) { String line; String parts[]; try { InputStream in = getClass().getResourceAsStream(GameController.CONFIG_DIR + fn); BufferedReader br = new BufferedReader(new InputStreamReader(in)); int mapLevel = 1; S...
a903622f-f852-43d9-ad91-78a86f2bd311
4
private void removeFilterDatabase() { List<Name> names = getBuiltInNames(); Name n = null; try { for( int i = 0; (i < names.size()) && (n == null); i++ ) { if( (names.get( i )).getBuiltInType() == Name._FILTER_DATABASE ) { n = names.get( i ); getWorkBook().removeName( n ); break; ...