method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
26c60232-5dc7-42ee-906c-08de2958acff
6
@Override public void run() { BufferedReader is; try { is = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); String response=is.readLine(); String[] parts=response.split(":"); String action=parts[0]; String[] contents=parts[1].split("/"); PrintWriter os=new PrintW...
4e3d4326-4fc1-4d8e-afc2-8a2652dffb2c
7
@Override public List<Point> startPathfinder(boolean diagonalAllowed) { ArrayList<MazeCell> closedSet = new ArrayList<>(); ArrayList<MazeCell> openSet = new ArrayList<>(); openSet.add(start); ArrayList<MazeCell> pathMap = new ArrayList<>(); while (!openSet.isEmpty()) { ...
86628900-0071-41ef-af8f-6e1666cc3175
5
private void writeDoubleArray(Object value, int type) { writeList.clear(); int len = Array.getLength(value); if (len > 0) { if (type == ElementType.TYPE_DOUBLE_ARRAY) { for (int i=0;i<len;i++) { writeList.append(Array.getDouble(value,i)); ...
6820f341-5a48-4677-9f3e-9edb9690937e
3
public static String[] split(String eff) { int idxBr = eff.indexOf('['); int idxParen = eff.indexOf('('); String eff0 = null; if ((idxBr >= 0) && (idxBr < idxParen)) { int idxRbr = eff.indexOf(']'); eff0 = eff.substring(0, idxRbr + 1); eff = eff.substring(idxRbr); } eff = eff.replace('(', '\t'); ...
71074cdb-147e-40da-a415-d624e7894152
4
public boolean empty() { for (int i = 0; i < tileArray.length; i++) { for (int j = 0; j < tileArray[0].length; j++) { for (int k = 0; k < tileArray[0][0].length; k++) { if (tileArray[i][j][k] != 0) { return false; } ...
ae25b961-6d90-42ce-a2af-dbadebe12708
0
LenDecoder() { }
1447b249-4d2b-4929-b4dc-aff47a835eec
1
public Character SwapHero(Character willBeSwappedHero) { Character temp = null; try{ temp = hero; hero = null; //hero = CharacterFactory.getCharacter(Constants.CHARACTER_RANDOM); hero = willBeSwappedHero; }catch(Exception e){ hero = temp; temp = null; } return temp; }
88e3a87d-479a-4990-80f8-5e84506ca711
4
public String mode_string() { switch (h_mode) { case STEREO: return "Stereo"; case JOINT_STEREO: return "Joint stereo"; case DUAL_CHANNEL: return "Dual channel"; case SINGLE_CHANNEL: return "Single channel"; } return null; }
e07f7b59-a14e-4d40-8517-8640a3fbff98
0
public static void main(String[] args) { prepareMenu(); printMenu(); supplyBeverage(inputCustomerChoice()); }
7fa9c777-3321-4bbf-862c-caa0103c55ed
0
@Override public void buildTopping() { pizza.setTopping("pepperoni+salami"); }
0a53526d-efa0-445b-b3f3-6046a3d1c726
8
public void fireBundleEvent(BundleEvent event) { // Take a snapshot of the listener array. Map<BundleContext, List<ListenerInfo>> listeners = null; Map<BundleContext, List<ListenerInfo>> syncListeners = null; synchronized (this) { listeners = m_bndlListeners; ...
18b60094-3ed8-4ea6-8208-988a71190d0c
5
public String getID(double x, double y) { if (nw == null) return this.id; if (nw.canZoom(x, y)) return nw.getID(x, y); if (ne.canZoom(x, y)) return ne.getID(x, y); if (sw.canZoom(x, y)) return sw.getID(x, y); if (se.canZoom(x, y)) return se.getID(x, y); return id; }
f4302c31-bd33-4c9d-bb11-45723268fde5
8
@Override public Parameter getParameter(final int parameterIndex) { Parameter parameter; switch (parameterIndex) { case 0: case 1: parameter = super.getParameter(parameterIndex); break; case 2: parameter = rate; ...
e4b57ea7-a6d7-4f70-864e-2859e8c82706
4
public String getUsers(){ StringBuffer ret = new StringBuffer(threads.size()*10+12); ret.append("Users in room: ["); for (ChatServerThread thread : threads){ if (thread!=null && thread.isLoggedIn() && thread.isAlive()) ret.append(""+thread.getUserName()+", "); } ...
c00cab5f-ff03-4ae9-9afc-ffecb1c3692b
6
public void fireMissiles(){ int checker = rd.nextInt(400); if(checker < 10){ if(!shoudlGenerateExtremeMissiles){ for(int i = 0; i < missiles.length; i++){ if(missiles[i] == null){ missiles[i] = new Missile(this, settings.missileColor, settings.missileSpeed, rd.nextInt(Math.abs(settings...
27b06a03-530a-4e7f-ba74-44986ef318fe
4
@EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true) public void damageDealt(EntityDamageByEntityEvent event) { if(event.getDamager() instanceof Player) { Player damager = (Player) event.getDamager(); if (event.getEntity() instanceof Player) { plugin.getASPlayer(damag...
68d9ff5d-262b-4ddc-9fc9-1c7a326de271
2
private static Boolean checkInterval(int intervalSeconds) { if ((intervalSeconds < MIN_SECONDS) || (intervalSeconds > MAX_SECONDS)) { return false; } return true; }
ebc6905f-2861-48d2-9ade-1f1ed64ce07b
0
public NondeterminismDetector() { }
103acbb1-9c96-4841-a89b-dac2fd7df3b6
1
public Word get(Word word){ int index = base.indexOf(word); if(index == -1) return null; return base.get(index); }
73185616-a561-4f85-9dad-fd987dc097e2
4
public FieldImpl(int width, int height) throws WrongArgumentException { if(width < 1 || height < 1){ throw new WrongArgumentException("Слишком маленькие размеры поля"); } if(width > MAX_ALLOWED_FIELD_SIDE_SIZE || height > MAX_ALLOWED_FIELD_SIDE_SIZE){ throw new WrongArgumentException("Слишком большие размер...
4fddd755-012e-47ec-a085-c4f4a6c1aa02
4
public void sendAFile( Peer a_recipient, File a_file ) throws UnknownHostException, IOException { Socket l_cliSock = new Socket( a_recipient.addr, this.ctrl_fileTransfertPort); ctrl_uploader.ReSet( l_cliSock, a_file.getAbsolutePath() ); ctrl_uploader.enableProgress( this.ctrl_mainwindow.getFileProgressBar()); ...
1ae7f47b-9a5a-4e56-b960-7686712b2064
5
public static void disposeImages() { // dispose loaded images { for (Image image : m_imageMap.values()) { image.dispose(); } m_imageMap.clear(); } // dispose decorated images for (int i = 0; i < m_decoratedImageMap.length; i++) { Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decora...
aaa9bf5b-1e60-43f2-af09-eb5e7cc52d73
5
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 1. 实例化一个硬盘文件工厂,用来配置上传组件ServletFileUpload DiskFileItemFactory factory = new DiskFileItemFactory(); // 设置上传文件时用于临时存放文件的内存大小,这里是2K.多于的部分将临时存在硬盘 //factory.set...
26a9017f-1f12-4685-bedd-1d8cde28ac0d
8
boolean chooseFile() { folderChooser = ModelerUtilities.folderChooser; folderChooser.setDialogType(JFileChooser.SAVE_DIALOG); String s = Modeler.getInternationalText("Download"); folderChooser.setDialogTitle(s != null ? s : "Download"); folderChooser.setApproveButtonText(s); folderChooser.setApproveButtonTo...
83b197c3-782f-459a-a41a-ba5c5da16534
8
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { ChatColor yellow = ChatColor.YELLOW; ChatColor red = ChatColor.RED; if(args.length < 1) { if(sender instanceof Player) { Player player = (Player) sender; if(player.hasPermission("CrazyFeet.crazysmoke...
010e4dbb-5e4c-468a-b6c3-0cc714a0c01b
1
private static final boolean isDigit(char ch) { return ch >= '0' && ch <= '9'; }
b16f36b8-ebca-4d05-8fc2-e11dd085f14e
2
public boolean fieldEmpty() { String met = MetSearch.getText(); String con = ConSearch.getText(); String pop = PopSearch.getText(); return (met.equals("") || con.equals("") || pop.equals("")); }
827afe69-bf3a-469b-ae4c-4e3a1ae181c2
0
public TurnTest() { }
7d47bb04-d3e9-4413-82a5-216d71f2f82c
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
ea7f8fa2-78c7-474e-bf46-6162784ecb9f
9
@Override public void acceptButtonActionPerformed() { String selectedNames[] = ds.getSelectedData(); if(selectedNames.length == 3 || selectedNames.length == 4){ DataFrame df = mainApplication.getActiveDataFrame(); boolean[] selection = getValidComposition(df, selectedNames); ...
c596ca8c-6e25-4388-ac68-01dcf6daf1c7
1
private JPanel createCanvas() { return new JPanel() { @Override protected void paintComponent( Graphics g ) { super.paintComponent( g ); for( GraphPaintable paintable : paintables ) { Graphics2D g2 = (Graphics2D) g.create(); paintable.paint( g2 ); g2.dispose(); } } }; }
a915d99b-b1a9-4a24-a88e-0babd162e0b1
1
public void dispose(){ for (GUI gui:guiLayer){ Input.inputBus.unregister(gui); } }
a0612c21-c284-41dc-a884-e3b905804db7
8
private void handleHttpRequests(ChannelHandlerContext ctx, HttpRequest req) { if (req.getMethod() != HttpMethod.GET){ log.info("Detected POST request - FORBIDDEN"); sendHttpResponse(ctx, req, new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.FORBIDDEN)); } switch (req.getUri()){ case "/"...
0da81497-7382-41b3-8731-221503f65383
7
public void getAction(GameState gs, int time_limit) { //MAXSIMULATIONTIME = time_limit; PlayerActionGenerator pag; pag = new PlayerActionGenerator(gs); if (pag.choices.size() > 0) { List<PlayerAction> l = new LinkedList<PlayerAction>(); { PlayerAction pa = null; ...
5541a367-111a-484e-a0cb-f9f0daad1338
0
public Contents contents() { return new PContents(); }
fcc7966d-9913-4858-b55a-bccf4867d8c1
9
int[][] IteracionesBusquedaSoluciones(int f, int c) { int[][] resp = new int[8][2]; int pos = 0; if(ValidacionSolucion(f-2,c-1)) { resp[pos][0]=f-2; resp[pos++][1]=c-1; } if(ValidacionSolucion(f-2,c+1)) { resp[pos][0]=f-2; resp[pos++][1]=c+1; } if(ValidacionS...
b15bc5ad-3a42-4f4c-8657-243b223eb9eb
3
public void init() { Client.nodeID = Integer.parseInt(getParameter("nodeid")); Client.portOff = Integer.parseInt(getParameter("portoff")); String s = getParameter("lowmem"); if (s != null && s.equals("1")) { Client.setLowMem(); } else { Client.setHighMem()...
d2da3a28-5fd5-43a0-9d43-5c5db7a33462
6
public static <GItem extends Comparable<? super GItem>> GItem minItem(final Iterable<? extends GItem> items) { final Iterator<? extends GItem> iterator = Iterators.iterator(items); if (!iterator.hasNext()) return null; GItem result = iterator.next(); while (iterator.hasNext()) { final GItem item = iterator.n...
12e9c009-f33c-4e68-94a1-704e02d6e866
8
public void initCards(Random gen, boolean playerOne) { isPlayerOne = playerOne; // Generate Player One's deck for (int i = 0; i < 50; i++) { int rand = gen.nextInt(10); if (rand < 4) playerOneCards.addToDeck(new Monster(CardInstance.MONSTER, CardType.ATTACK)); else if (rand >= 4 && rand < 8) ...
36a26ed0-e198-4e10-98c2-e4725022821f
5
@Override public String getColumnName(int column) { switch (column) { case 0: return "SUBP"; case 1: return "URL"; case 2: return "Drajver"; case 3: return "Username"; case 4: ...
46de3980-7b94-49cb-8790-5fcb9d442565
6
public boolean render(Level level, int x, int y, int z, ShapeRenderer shapeRenderer) { boolean rendered = false; float var7 = 0.5F; float var8 = 0.8F; float var9 = 0.6F; ColorCache colorCache; if (canRenderSide(level, x, y - 1, z, 0)) { colorCache = getBrightn...
5a732ef8-ad5a-4922-b55d-ff2b8a4517b8
3
@Override public Program mutate(Program program) throws InvalidProgramException { if (!(program instanceof ProgramImpl)) { throw new InvalidProgramException(); } Random randomGenerator = new Random(); ProgramImpl program1 = (ProgramImpl) program.clone(); List<Reaction> reactions = program1.getReactions();...
e5f9052a-0a7e-4ca5-98da-01b95cea1b32
6
private boolean shortCircuit() { boolean shortCirc = false; Circuit copy = new Circuit(this); for (int i = copy.getComponents().size() - 1; i >= 0; i--) { Component c = copy.getComponents().get(i); { if (c instanceof Resistor) {...
12d77fcc-4ac1-41e9-b18f-1956d10a854b
6
public static void loadDAS4InfoFromConfig() throws IOException{ Properties prop = new Properties(); FileInputStream fis = new FileInputStream("config.txt"); prop.load(fis); if (!prop.containsKey("username")) throw new IOException("Missing username entry for config.txt! (key=username)"); if (!prop.conta...
a5acfcee-f82c-4b55-bc56-586b3e61cd16
1
/** @return The header panel for this table. */ public OutlineHeader getHeaderPanel() { if (mHeaderPanel == null) { mHeaderPanel = new OutlineHeader(this); } return mHeaderPanel; }
9f4cd21d-5222-4e0c-8484-e788b06f2440
3
public void draw(Graphics g) { for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { tiles[i][j].setType(Scheme.tiles[i][j]); if (Scheme.labels[i][j]!="") { tiles[i][j].makeTextTile(Scheme.labels[i][j]...
a50cac36-cca0-4c50-9b91-3411731778e7
5
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { // Set System L&F UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Unsuppor...
82e1fd31-3019-4298-84b8-f9cc710186ce
0
public void usunOsobe(Osoba osoba) { osoba = em.find(Osoba.class, osoba.getId()); em.remove(osoba); }
015b466a-4af1-4be7-8f71-e3aa56618101
0
public void setVerbose(boolean verbose) { this.verbose = verbose; }
9e877b9a-4d16-4377-ba72-973ac596af5b
4
private int forward(int obj) { // There are three cases that you will need to handle here. // 1) If obj is not a pointer (i.e., if it is greater than // or equal to zero), then you should just return obj // directly. // 2) If obj is a pointer, but the length field of the object // that ...
9c43e093-6c83-46d8-b159-13e2a9352ccf
6
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof Variable)) return false; Variable other = (Variable)obj; if (this.getValue() == null && other.getValue() == null) return true; if (this.getValue() != null && other.getValue() != null) return this.getValue().equals(other....
ef1b82a1-a4a5-4b2e-b0fb-2c439cd0364a
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JAgoraNodeID other = (JAgoraNodeID) obj; if (localID == null) { if (other.localID != null) return false; } ...
d858780c-1ef0-47e0-9b3b-ae10098b0a49
1
@Override public List<Member> getListOfMembers() { List<Member> member = null; try { member = (List<Member>) deserializeXMLToObject("Member.xml"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return member; }
0c1f9cae-4b8c-4d37-a3a7-90fefb0b837a
4
private JPanel createParamLine(int i) { JPanel paramLine = new JPanel(); paramLine.setLayout(new GridLayout(1, 2)); if(i == 0){ JTextArea originXTA = new JTextArea("Origine en X :"); originXTA.setEditable(false); originX = new JTextField("" + currentDrawable.getOriginX()); originXTA.setPreferredSiz...
d070c547-d950-4a96-8c36-b57bebd7fe68
2
@Override public String getChoix(String p) { if(p.equals(player1)) { return this.choise1; } else if (p.equals(player2)) { return this.choise2; } return "aucun"; }
1e2a7bdf-dec1-48c0-96d8-bf1a074b596f
7
static final void method2383(AbstractToolkit var_ha, int i, Widget class46) { do { try { if (i != -2) method2383(null, -63, null); anInt6385++; boolean bool = ((ToolkitException.itemLoader.method1941 (((Widget) class46).anInt672, (byte) -74, ((Widget) class46).itemId, ((Widget) class4...
61bf11cc-1eb0-4b55-a077-d74fba293524
4
public boolean sideCollision(ArrayList<Double> xArray, ArrayList<Double> yArray) { for (Block block : blockArray) { for (int i = 0; i < xArray.size(); i++) { if ((xArray.get(i) == block.getXValue()) && (yArray.get(i) == (block.getYValue()))) { return true; } } } return false...
89783ca2-b1f8-4b0f-adcd-da2dea9990c5
1
@Override public void onSuccessfulStarted() { System.out.println("onSuccessfulStarted!"); if(!errorsWhileStarting) { setChanged(); notifyObservers(ModelNotification.CONNECTION_ESTABLISHED); } }
ac15b034-b7de-4ff9-b6a8-c656d4c24b47
2
@Override public void editElection(Date openNominations, Date start, Date end, String electoratelectionID) { if (context.getCurrentUser() != null && context.getCurrentUser().isElectionManager()) { context.getAdminTools().editElection(context.getCurrentUser(), context.getCurrentElectionID(), openNomina...
cd959e36-1ff9-486f-ae73-7b3edb847464
3
@Override public String execute() throws Exception { try{ Map session =ActionContext.getContext().getSession(); setUser((User) session.get("User")); setSitelist((List<Publish>) getMyDao().getDbsession().create...
fd440e7e-a20d-41c0-8bde-3375b9b752d0
0
private VariablePrecisionTime getVorbisRecordingDate() { return vorbisDate(true); }
70ddef5a-5708-4b8f-9503-9a0883cc8800
3
public void encrypt(InputStream in, OutputStream out) throws Exception { // Symmetrically Encrypted Data Packet byte version = 4; int block_size = ecipher.getBlockSize(); int len = 0; byte[] buf = new byte[184]; int add = 0; int packet_len; byte[] padded_b...
9675a8b5-041b-40ab-ac3a-431694bc5c82
7
public List<String> fullJustify(String[] words, int L) { if(words == null || words.length == 0) return new ArrayList<String>(); List<String> result = new ArrayList<String>(); int lineCount = 0; List<String> line = new ArrayList<String>(); for(int i=0; i<words.length; i++){ lineCount += words[i]....
4d0f5bcb-527f-48f1-9d0e-5db4f21611b8
3
public void makeNewBlock(int x, int y, int length){ x = x + 8; Prefab prefab = new Prefab(0, 0, 0, 0); RoadGenerator roadGen = new RoadGenerator(); int xStart = x - 8; int xFar = x + (length * 24) + 8; int yFar = y + ((2 * 8) + (24 * 2)); roadGen.layRoad(xStart, y, xStart, yFar); roadGen.layRo...
50bcaca4-7d5a-45d3-97c3-176dd34366b7
0
public Component getComponentAfter(Container container, Component component) { return cycle(component, 1); }
69c76839-c410-45f6-bb7a-4e1ea490fd0a
5
private void collectCategoryChanges(CourseModel courseModel, ArrayList<Change> changes) { // TODO: category names are long, and they are mapped to numeric codes // in facets. Something to use in description? for (String c : categories) { String code = makeIdSafe(c); if (courseModel.getCategory(Source.EDX...
02df8af7-801e-490d-b37f-08c7dccc2d4b
3
private void afficherInfos(String path, String fichier) { File f = new File(maConf.getRacine() + "\\" +path + "\\" + fichier); Date date = new Date(f.lastModified()); if(!path.equalsIgnoreCase("/") && !path.equalsIgnoreCase("\\") ) { path += "/"; } writer....
1f6c8059-376b-4aed-8e0e-400753b48538
2
@Override public void run() { while(running) { System.out.print("eva < "); if(scanner.hasNextLine()) { String input = scanner.nextLine(); emit(new Event(EventType.INPUT, this, input)); } } }
cd4486b7-9d79-4ee3-8333-cd65fe64dd2b
0
public DoorTile(Sprite sprite, String id){ super(sprite, id); }
3d6e30d1-94c4-49aa-963f-6a254d3bc343
2
public boolean SetChartType(int type) { if ((type>=0) && (type<NUMOFCHARTS)) { m_chartType = type; return(true); } else { return(false); } }
1428e522-1d56-4e09-8b38-a03b600ad929
9
public int largestRectangleArea(int[] height) { int result = 0; Stack<Integer> s = new Stack<Integer>(); for (int i=0; i<height.length; i++) { if (s.isEmpty() || height[s.peek()] < height[i]) { s.push(i); } else { while (!s.isEmpty() && height[s.peek()] > height[i]) { in...
63316f7c-11a9-47b7-ba29-fe38dd7404c5
5
public E remove(Position<E> p) throws IllegalArgumentException { Node<E> node = validate(p); if (numChildren(p) == 2) throw new IllegalArgumentException("p has two children"); Node<E> child = (node.getLeft() != null ? node.getLeft() : node.getRight() ); if (child != null) child.setParent(nod...
cca770fa-1812-4644-b78a-f1a301ce4fd1
9
private static EasyPostResponse makeURLConnectionRequest(EasyPostResource.RequestMethod method, String url, String query, String apiKey) throws EasyPostException { javax.net.ssl.HttpsURLConnection conn = null; try { switch (method) { case GET: conn = createGetConnection(url, query, apiKey); break; ...
d639bdc5-0a7c-4658-b23a-27a507784bb8
6
public static void main(String[] args) throws Throwable { ServerSocket serverSocket = null; int port = 10009; try { serverSocket = new ServerSocket(port); } catch (IOException e) { System.err.println("Le serveur ne peut écouter sur le port : " + port); System.exit(1); } Socket clientSocket = null;...
628d6184-bda0-44bd-a6b1-8ec535804daa
0
public ArrayList<Ball> getBalls() { return this.balls; }
5be50f1d-fed3-452d-bbd5-beee009e8f68
2
void Translations() { if (lang == "Eng") { file = "File"; help = "Help"; image = "Image"; new1 = "New"; open = "Open"; save = "Save"; exit = "Exit"; about = "About GraphicEditor " + Constants.ver + ""; clear = "Clear"; colourChooser = "ColorChooser"; color = "Color"; fone = "Fo...
ac082b28-50bc-4039-b32e-b995c8180ac9
9
public void writeUntil(final int end, final CodedOutputStream output) throws IOException { while (next != null && next.getKey().getNumber() < end) { FieldDescriptor descriptor = next.getKey(); if (messageSetWireFormat && descriptor.getLiteJavaType() == ...
6a00457c-d4a8-41fb-9470-ca0a50c8d6c7
1
public void shutdown() { shuttingDown = true; Logger.log("Shutdown was called."); if(ownsSocket) { Logger.log("Closing socket."); socket.close(); } else { Logger.log("Note: not closing socket!"); } runningLock.unlock(); }
c552aacb-2406-4e76-af7d-b58cf50e04b6
6
private void openCoreLocationWindow() { JFileChooser coreFolderSelect = new JFileChooser(); coreFolderSelect.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); coreFolderSelect.setDialogTitle("Select NGECore2 folder"); int success = coreFolderSelect.showOpenDialog(contentPanel); if (success == JFileChoos...
1c60dda4-4a34-4d0a-92ed-e3a27938a12b
1
private void processMoveToHand(MouseEvent e) { List<Card> hand = game.getHand().getList(); if (hand.size() > 0) { final double handXGap = handXGap(hand.size()); int indexTo = (int) ((e.getX() - handXStart()) / (handXGap + CARD_WIDTH)); activeMove.cardReleased(indexT...
0fb72176-bf4a-4c3c-95cb-ddfaffbf2c9b
9
@Override public String toString() { StringBuilder string = new StringBuilder(); string.append("Citation type: ").append(this.citationType).append("\n"); if (authors != null) { string.append("Authors: "); for (Author author : this.authors) { string.a...
98c0f33d-cedb-432a-8e2b-726ef7765377
3
@Override public boolean execute(Player player) { if (!this.hasSecondWord()) { GameEngine.gui.println("Test what?"); return false; } Scanner vScanner; try { vScanner = new Scanner(new File("./" + this.getSecondWord())); while...
bd07032f-f899-4e03-a060-ee8ccef53835
5
@Override public Token parse() { Token test = first.getNext(); if (!test.isOperator(Operator.BRACKET_LEFT)) throw new RuntimeException("Expected '(' after IF, found: " + test.toString()); testExpression = new BooleanExpression(test.getNext(), scope); test = testExpression.parse(); if (!test.isOpe...
ca7645aa-1c96-44b8-af77-ad77f0131ffd
1
private void register(){ int max = deck.cards; for (int i=0; i<player_count; i++){ Rack r = new Rack(rack_size, this); players[i].register(this, r); } }
43f85460-f3f8-4587-abc6-cc52634cda29
0
public PickUp(int state1, int state2) { this.state1 = state1; this.state2 = state2; }
ead0c0e1-b2f7-4d5e-af5c-c140840aaa39
0
protected void fireConnect(ConnectEvent evt) { //.. }
4d4ac2c5-9d31-4b6e-8a16-2ffda60c7a35
6
public static void main(String[] args) { Map<Integer, Integer> p = new HashMap<>(); TreeMap<Integer, Integer> sorted = new TreeMap<>(new ValueComparator(p)); for (int a = 1; a < 999; a++) { for (int b = 1; b < 999; b++) { for (int c = 1; c <= 1000; c++) { ...
4d5fa6e1-0563-4095-b238-57b79f2da155
5
private String cipher_digraph(String pl,HashMap<Character,Pair<Integer> > h1, HashMap<Character,Pair<Integer>> h2) { assert(pl.length()==2); StringBuilder sb=new StringBuilder(); char c1=pl.charAt(0); char c2=pl.charAt(1); if(c1=='J') { c1='I'; } if(c2=='J') { c2='I'; } if(!h1...
dd5cb7db-8b29-496c-869b-0926c73d6d95
4
public Vector<Vector<Object>> notesTable() { try { String[] keys = {"eventID", "cbsEventID", "noteID", "text", "active"}; crs = qb.selectFrom(keys, "notes").all().executeQuery(); data.clear(); while(crs.next()) { Vector<Object> row = new Vector<Object>(); ResultSetMetaData metadata = crs.getMet...
3d61819b-3405-41f6-bf3b-4c9b88bcaa20
9
private double[] sort_intervals(double[] unsorted_intervals) { int i, length; double min = unsorted_intervals[0]; double max = unsorted_intervals[0]; double[] sorted_intervals = new double[unsorted_intervals.length]; double[] intervals; for (i=0; i < unsorted_intervals.length; i++) { if (max<unsorted_int...
7ad56ec5-aa39-4ebe-a313-eead8e30aa12
9
public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if (!(o instanceof KeyedObjects)) { return false; } KeyedObjects kos = (KeyedObjects) o; int count = getItemCount(); ...
9b8ddfb8-1848-4c8c-b659-0a5712bdf9f8
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Comentario other = (Comentario) obj; if (this.idComentario != other...
39cd527d-648b-434c-87eb-41d4b29736e5
4
public Iterable<Work<TI>> iterableWork() { final Master<TI, TO> master = this; return new Iterable<Work<TI>>() { @Override public Iterator<Work<TI>> iterator() { return new Iterator<Work<TI>>() { @Override public boolean hasNext() { return master.hasNext(); } @SuppressWarning...
bd615ac8-a8af-4bca-8d7a-306dea6c39e1
3
public void playAnimation(){ for(BufferedImage bi : images) { ActionListener animate = new ActionListener() { private int index = 0; @Override public void actionPerformed(ActionEvent e) { if (index<images.length-1) { ...
d8b569b7-e809-4aa2-821d-4c3d3aa6b51a
8
public static boolean shouldBuild() { int factories = UnitCounter.getNumberOfUnits(TerranFactory.getBuildingType()); int armories = getNumberOfUnits(); boolean weAreBuilding = Constructing.weAreBuilding(buildingType); if (armories == 0 && (factories >= 2 && !weAreBuilding && !TechnologyManager.isSieg...
272c13aa-9c65-419d-81a4-f373b2fa6c4b
1
public static int getNowPage() { String nowPage = getHttpServletRequest().getParameter("nowPage"); if (StringUtils.isNull(nowPage)) { return 0; } else { return Integer.parseInt(nowPage); } }
7bf5c03a-6385-440b-a1ca-53fb76cf03b9
5
private boolean backupSystem() { new Thread() { @Override public void run() { ProcessBuilder process = null; Process pr = null; BufferedReader reader = null; String line = null; List<String> args = null; ...
59130d6a-5b62-4377-99b6-5d2e2907d3bd
9
public static void main(String [] args) { try { PairedStats ps = new PairedStats(0.05); java.io.LineNumberReader r = new java.io.LineNumberReader( new java.io.InputStreamReader(System.in)); String line; while ((line = r.readLine()) != null) { line = line.trim(); if (l...
daf10fb1-f7b0-42b8-8caf-717be45b0adf
0
public double getStrength() { return strength; }
1b75fb33-97c9-483d-be8d-449e6ae90123
2
private void phaser() { int count = 4; final Phaser phaser = new Phaser(); phaser.register(); for (int i = 0; i < count; i++) { phaser.register(); final int localCount = i; new Thread(new Runnable() { public void run() { ...