method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
78efb85f-1616-4fc1-891a-822df6b4d194
4
public boolean toggleInitWithMouse(MouseEvent mouse) { Tool tool = GUI.controls.getTool(); Object o = getObject(mouseGetX(mouse), mouseGetY(mouse), tool); if (o == null) return false; if (o instanceof RandomInit) { ((RandomInit) o).toggleInitial(); ret...
f3b47956-cd12-45ae-9282-14ebc0623e5d
5
public static boolean getBooleanProperty(Properties properties, Object key) { String string = (String)properties.get(key); if(string == null) { System.err.println("WARN: couldn't find boolean value under '" + key + "'"); return false; } if(string.toLowerCase().equ...
f4141b67-d62d-4a73-bea8-af86fbd7507f
2
private void loginSession(String address, int port, String username, String password) { msgSocket = new MessageSocket(address, port); ServiceCommands service = new ServiceCommands(msgSocket); AccessControlCommands access = new AccessControlCommands(msgSocket); TransferParameterCommands tra...
600bae65-cd17-455c-a493-5a87323f30c3
1
public static byte[] downloadFile(String url) throws IOException { HttpURLConnection connection = null; InputStream inputStream = null; try { connection = (HttpURLConnection)new URL(url).openConnection(); connection.setDoInput(true); connection.setRequestMetho...
63c5b7a4-d1b3-4898-b770-c0139f9c0e51
2
public void mu() { System.out.println("Enter range of numbers to print their multiplication table"); a = in.nextInt(); b = in.nextInt(); for (c = a; c <= b; c++) { System.out.println("Multiplication table of " + c); for (d = 1; d <= 10; d++) { System.out.println(c + "*" + d + " = " + (c * d)); } ...
55b6b17a-ccde-4da5-8af9-2d31dc03d1dc
8
public boolean matches(InventoryCrafting var1) { ArrayList var2 = new ArrayList(this.recipeItems); for(int var3 = 0; var3 < 3; ++var3) { for(int var4 = 0; var4 < 3; ++var4) { ItemStack var5 = var1.getStackInRowAndColumn(var4, var3); if(var5 != null) { boolean...
8e975e72-9cca-4899-82fb-7d86de076c9c
1
public void analyze() { while (!toAnalyze.isEmpty()) { Identifier ident = (Identifier) toAnalyze.iterator().next(); toAnalyze.remove(ident); ident.analyze(); } }
be088d54-762c-4b85-9caa-1b8a9bf370e2
0
public Turn(direction lr, int state) { this.lr = lr; this.state = state; }
7bbf076c-a94e-49dc-88e1-5c9fd44cb833
1
@Override public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException { List paramList1 = new ArrayList<>(); List paramList2 = new ArrayList<>(); StringBuilder sb = new StringBuilder(UPDATE_QUERY); String ...
6621b9b2-9f1f-4571-9cd7-3930d8c46c83
1
@Override public void initTrans() throws Exception { try { oConexionMySQL.setAutoCommit(false); } catch (SQLException e) { throw new Exception("Mysql.initTrans: Error al iniciar transacci�n: " + e.getMessage()); } }
85b97f50-604a-422c-b796-5b7070d0453a
1
public void test_other() throws Exception { assertEquals(1, DateTimeFieldType.class.getDeclaredClasses().length); Class cls = DateTimeFieldType.class.getDeclaredClasses()[0]; assertEquals(1, cls.getDeclaredConstructors().length); Constructor con = cls.getDeclaredConstructors()[0]; ...
6b08fa19-e7f3-4791-a7ef-566a7ea98e3c
4
@Override public Item generateRandomStartItem(IGameMap game) { Item[] items = game.getStartItems().toArray(new Item[game.getStartItems().size()]); for (int i = 0; i < items.length; i++) { for (Item item : game.getItemsOnMap()) { if(item.getX() != items[i].getX() && item.getY() != items[i].getY()...
ee2aff30-cafc-429f-b3b2-f4ad79c80971
1
private VideoListVO addSearchMessageToVO(VideoListVO videoListVO, Locale locale, String actionMessageKey, Object[] args) { if (StringUtils.isEmpty(actionMessageKey)) { return videoListVO; } videoListVO.setSearchMessage(messageSource.getMessage(actionMessageKey, args, null, locale));...
c7c0f07e-c080-4f15-b55f-02a2b677d230
7
public Vector<Item> resourceHere(Room R, int material) { final Vector<Item> here=new Vector<Item>(); for(int i=0;i<R.numItems();i++) { final Item I2=R.getItem(i); if((I2!=null) &&(I2.container()==null) &&(I2 instanceof RawMaterial) &&(((I2.material()&RawMaterial.RESOURCE_MASK)==material) ||(((...
b4b7b865-096a-4718-824c-99bad02c71c5
9
synchronized Hashtable getProperties() { if ((props == null) && (getText() != null)) { Hashtable props = new Hashtable(); int off = 0; while (off < getText().length) { // length of the next key value pair int len = getTe...
b7ce0eb3-ab5e-4a32-bd90-364258254efe
0
public void changeColor() { this.trackImg = trackImg1; }
86334e73-664b-44d1-a50d-4b64eb218642
9
public static void writeShape(final Shape shape, final ObjectOutputStream stream) throws IOException { if (stream == null) { throw new IllegalArgumentException("Null 'stream' argument."); } if (shape != null) { stream.writeBoolea...
fa9e4c73-7e72-4f9a-ae23-5cf08b2d4521
4
public void fitToScreen() { if (vertices.size() == 0 || canvas.getWidth() <= 0 || canvas.getHeight() <= 0) { canvas.offX = canvas.getWidth() / 2; canvas.offY = canvas.getHeight() / 2; canvas.zoom = 1.0; return; } double minx = vertices.get(0).getX(...
7fc90e45-edc1-4b90-8abe-508ac49b55ea
3
@Override public void paintComponent(Graphics g){ Paint paint; Graphics2D g2d; if (g instanceof Graphics2D) { g2d = (Graphics2D) g; } else { System.out.println("Error"); return; } paint = new GradientPaint(0,0, getBackground(), getWidth(), getHeight(), getForeground()); g2d.setPaint(paint); ...
095ac3bc-f7e3-482d-a1ea-a1f4892850ca
3
void intialiseWithInfected(int N, int initI) { for (IndividualStateType state : allowedStates) { if (state.equals(IndividualStateType.SUSCEPTIBLE)) { createIndividualAgentsInState(state, (N-initI)); } else if (state.equals(IndividualStateType.INFECTED)) { ...
841fb155-c200-4002-ade3-f270a706af76
6
public String authenticate() throws Exception { logger.info("Authenticating to Rackspace API..."); HttpGet request = new HttpGet(API_AUTH_URL); request.addHeader("X-Auth-User", username); request.addHeader("X-Auth-Key", apiKey); try{ HttpResponse respo...
4686588c-410b-4017-b1ba-4062dbb2122c
1
private static int sgn(int x) { return x < 0 ? -1 : 1; }
a4647ac4-098c-45cd-b9d8-059104880d58
6
public synchronized boolean moveItem(FieldItem item, Position fromPosition, Position toPosition) { if (insideBounds(fromPosition) && insideBounds(toPosition)) { int transcurredTime = 0; while (getItemType(toPosition) != ' ') { try { long time = System....
6ad81458-e1eb-4d8a-8db8-902e1dfdfe13
6
public void loadFromConfig(){ try { BufferedReader reader = new BufferedReader(new FileReader("config.txt")); //S2 path s2Path = reader.readLine(); if (s2Path == null) s2Path = ""; //Developer mode if (reader.readLine().equals("1")) isDeveloper = true; else isDeveloper = false; //a...
6899cdd4-2eb7-4e81-b1c7-a40e290f1d48
7
protected String getTypeName(){ switch(this.eventType){ case(EVENT_MESSAGE_C): return "Message_Client"; case(EVENT_MESSAGE): return "Message"; case(EVENT_UPDATE_C): return "Update_Client"; case(EVENT_UPDATE): return "Update"; case(EVENT_DESTROY): return "Destroy"; case(EVENT_INTE...
74270310-edc6-44b1-9671-48f672b470a7
6
public boolean solution(Node root, int sum) { if (root == null) { if (sum <= 0) { return true; } else { return false; } } termNode = root; sum = sum - root.value; boolean lValue = solution(root.leftChild, sum); boolean rValue = solution(root.rightChild, sum); if (!lValue...
9339e312-5484-41bd-a74a-1e71f6e1aa33
5
@Override public void run(){ try ( InputStream inputStream = socket.getInputStream(); Scanner in = new Scanner(inputStream) ) { boolean done = false; while (!done && in.hasNextLine()) { String line = in.nextLine(); Out...
1e2b076e-d603-47fc-9f8b-39de6a2d0d74
5
public BTURL2(String loc, String ...params) throws Exception { if((params.length % 2) != 0) { throw new Exception("Parameters should be key, value array, length is not divisible by 2"); } String p = ""; if(params.length > 0) { p += "?"; for (int i = 0; i < params.length; i += 2) { if(params[i...
071e9429-da0b-4e60-a3b8-df0f585cd0e4
7
@Override public void paint(Graphics g) { super.paint(g); // paint background //Drawing Font f=new Font(Font.SANS_SERIF,Font.BOLD,12); g.setFont(f); g.setColor(Color.WHITE); //Get space dimensions. //Betting bar //Betting bar line g.drawLine(bettingW, 0, bettingW, HEIGHT); //Betting bar butto...
c828aa39-3e60-4314-938e-6134c9ff30c7
2
public int[] getIntArray(String key) { try { if(hasKey(key)) return ((NBTReturnable<int[]>) get(key)).getValue(); return new int[]{}; } catch (ClassCastException e) { return new int[]{}; } }
90c945ec-04a1-4e8e-8b03-0ab3c699650c
5
public void renderGradientQuad(float x, float y, float width, float height, ColorHelper color, SideHelper... sides) { for (SideHelper side : sides) { switch (side) { case TOP: gradientTop.setOverwriteColor(color); bindMaterial(gradientTop); ...
7136e617-a8dd-4f6c-a3b6-e5ceb9c9c93f
6
synchronized public Color[][] getColorTab(boolean withPiece) { if (!withPiece) { return super.getColorTab(); } else { Color[][] tab = super.getColorTab(); TetrisShape shape = (TetrisShape) getCurrentPiece().getShape(getCurrentPiece().getCurrentRotation()); ...
901e825d-86c3-4059-8720-30b7cb5380c1
0
public HyperbolicEquation(float a, float b, float h, float k) { this.a = a; this.b = b; this.h = h; this.k = k; }
c684f37a-d09b-4c01-aaf9-95870b0ad73f
9
public static byte[] hexStringToByteArray(String s) throws NumberFormatException { byte[] data = new byte[0]; if (s != null && s.length() > 0) { String[] split; if (s.length() > 2) { if (s.length() >= 3 && s.contains("x")) { s = s.startsWith("x...
42325280-eceb-47e4-8879-79caee9328e6
2
public List<Token> tokenize(String code) { final List<Token> tokens = new LinkedList<>(); for (char c : code.toCharArray()) { if (mapping.containsToken(c)) { tokens.add(new Token(c, mapping.getType(c))); } } return tokens; }
5c4f0679-92ee-4638-881e-1344e6859484
5
private int date_to_index(int date) { //System.out.println("date_to_index : date = " + date); //algorithme de recherche par dichotomie (a chaque fois on divise le tableau en 2) boolean fin_iteration = false; int debut = 0; int fin = filemessages.size(); int milieu=-1; if(date > filemessages.get(0).dat...
b2cd8be3-9131-407c-af56-c5a470f77797
4
public void launch() { // Load URLs final List<URL> urls = new ArrayList<URL>(); mods.fill(urls); File natives = new File(main.getApi().getMinecraftDirectory(), "bin/"); for (final UpdaterWorker.GameFile gameFile : main.getUpdater() .getGameF...
b1785b3f-73bb-465f-a7f3-b8266a3b1f59
3
public int compare(Object o1, Object o2) { Color first = (Color) o1; Color second = (Color) o2; if (first.getAlpha() != second.getAlpha()) return (second.getAlpha() - first.getAlpha()); // Extract the HSB, and impose the ordering. float[] firstHSB = Color.RGBtoHSB(first.getRed(), first.getGreen(), firs...
859a1ef3-47ed-4b2d-afc7-ad20d275b445
7
protected boolean fix_with_precedence( production p, int term_index, parse_action_row table_row, parse_action act) throws internal_error { terminal term = terminal.find(term_index); /* if the production has a precedence number, it can be fixed */ if (...
28d7f40c-9256-4569-b1cc-b6b5cec3a5a7
8
private int addNeighbours(Point p, List<Point> list) { int c = 0; if (p.x - 1 != 0) if (this.maze[p.x - 1][p.y] == true) {list.add(new Point(p.x - 1, p.y));c++;} if (p.x + 1 != this.width - 1) if (this.maze[p.x + 1][p.y] == true) {list.add(new Point(p.x + 1, p.y));c++;} ...
6b263d16-74db-4910-a43f-63308a1606d1
2
@Override public boolean matches(String[] input) { for (String word: input) { matcher.reset(word); if (matcher.find()) { return true; } } return false; }
101d8448-3419-4ffa-a80f-a696a4472ad9
1
private void saveSettings() { try { myMode = mySettingsSWT.getSelectedMode(); myBoardType = mySettingsSWT.getSelectedBoardType(); myBoardFile = mySettingsSWT.getFile(); myFileParser = new FileParser(myBoardFile); myFileParser.parse(); valid...
2cb6cbaa-2421-4476-b523-50b951e1c8b8
3
public void apply() throws XPathExpressionException { if(!this.isSelected()) { return; } Element e = editor.getXMLElementByString(this.xmlPath); if(e != null) { Node child = null; MessageUtil.debug("Remove all "+ this.name); while((child ...
98f0f672-88bb-4bdb-811f-d0c2e8b359e5
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=prof...
fb12e1cc-7e8e-40b5-aebe-0b03ee1fdbbb
1
public static void main(String[] args) throws Exception { ServerSocket serverSocket = new ServerSocket(6868); while(true) { Socket socket = serverSocket.accept(); //启动读写线程 new ServerInputThread(socket).start(); new ServerOutputThread(socket).start(); } }
894810f3-e2bf-4f88-b3e3-8644b6d3cfed
3
private LaunchProxy(File... files) { StringBuilder buffer = new StringBuilder(); mFiles = new ArrayList<>(); mTimeStamp = System.currentTimeMillis(); buffer.append(LAUNCH_ID); buffer.append(' '); buffer.append(mTimeStamp); buffer.append(' '); if (files != null) { for (int i = 0; i < files.length; i++...
b6e60608-f064-4af5-a4f9-763f6292e68b
8
private synchronized void processNetPacket(Sim_event ev, int tag) { double nextTime = 0; Packet pkt = (Packet) ev.get_data(); PacketScheduler sched = getScheduler(pkt); // if a packet scheduler is not found, then try reschedule this packet // in the future if (sched ...
81e5c496-e3db-4dde-8ff5-0bd47b93df85
0
@Basic @Column(name = "payment_type") public String getPaymentType() { return paymentType; }
b0390c82-bcb2-40a9-9474-76da1fd4ebf7
9
protected MD3_Surface( MD3_File parent_reader, int index) throws Exception{ this.parent_reader = parent_reader; this.byter = this.parent_reader.byter; INDEX = index; start_pos = byter.getPos(); S32_IDENT = byter.getInteger(0); STR_IDENT = byter.backward(4).getString(0, 4); ...
9ce2490a-bfb3-4ecf-ba72-7b6d5996bab0
9
private void runExperiment(int runType) { int[] query = convertObjectArrayToIntegerArray(chooseQuery()); if (query == null || query.length == 0) { ERROR("Query choose error."); return; } switch (runType) { case 0: debug(query); break; case 1: runExperiment1(query); break; case 2: brea...
4049cfd4-c271-4fd7-8133-f42a8fb4be16
3
public Item getItem(int slot) { if(slot >= 0 && slot < items.length && items[slot] != null) return items[slot]; return null; }
c6faa598-83b9-4358-b174-3436b19623a7
5
public InteractiveObject getInteractiveObject(int x, int y, int z) { GroundTile groundTile = groundTiles[z][x][y]; if (groundTile == null) { return null; } for (int l = 0; l < groundTile.anInt1317; l++) { InteractiveObject interactiveObject = groundTile.interactiveObjects[l]; if ((interactiveObject.uid...
59d59a5b-920b-4aff-b892-2152d7914a34
4
public Gui_Settings2(Gui_StreamRipStar mainGui) { super(mainGui, "Preferences"); this.mainGui = mainGui; this.setModalityType(ModalityType.APPLICATION_MODAL); Object elements[][] = { {"Look And Feel",commonPrefIcon}, {"Audio and Programs",pathPrefIcon}, {"Language and Log",audioPlayerPrefIcon}}; ...
391e25b3-4496-4d67-9639-9c8e40c2b414
4
private void addTeam() { clear(); System.out.println("Add a new team:"); System.out.println(); try { int counter = teammgr.showCount(); int maxId = teammgr.maxTeamId(); Team tm = teammgr.getById(maxId); if (tm == null || tm.ge...
c82dd8a3-6fb4-4571-9037-b3669385aaee
5
void Move_Send_Serial() { // send updates to hexapod? ByteBuffer buffer = ByteBuffer.allocate(64); int used=0; int i; for(i=0;i<6;++i) { Leg leg=legs[i]; // update pan leg.pan_joint.angle=Math.max(Math.min(leg.pan_joint.angle,(float)leg.pan_joint.angle_max),(float)leg.pan_joint.ang...
39dcd8a4-c639-4640-9c75-5f631cfb08c7
9
public boolean execute(CommandSender sender, String[] args) { if(!(sender instanceof Player)){ return true; } String groupName = args[0]; String targetName = args[1]; GroupManager groupManager = Citadel.getGroupManager(); Faction group = groupManager.getGroup(groupName); if(group == null){ sendMessa...
1c2e64e7-491b-4b34-9a20-89c263610dbf
4
@Override public void mousePressed(MouseEvent e) { if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed() && isStartEvent(e)) { start(e); e.consume(); } }
8d762c18-d1c8-4be8-a40f-1fb4af35b262
5
@Override public void epoch(Player p) { //Save the network if (model_mimic != null){ if (drawNet_file != null) drawNet.export(drawNet_file); if (playNet_file != null) playNet.export(playNet_file); //Deep learning stopping criteria //If no improvement, add another deep learning layer if (DL_...
e3423437-ec01-47e3-9da8-d11de46925de
2
private void setGroupNames(String username, String[] groups) { Vector<String> v = null; if (groups == null) { v = emptyVector; } else { v = new Vector<String>(groups.length + 1); for (int i = 0; i < groups.length; i++) { v.add(groups[i]); ...
84e906b7-f933-46c9-a7fb-f096eb8ee2f8
5
public void init() { // TODO Auto-generated method stub try { //setCurMap(new TiledMap("assets/grassmap.tmx")); setCurMap(new TiledMap(map)); } catch (SlickException e) { // TODO Auto-generated catch block e.printStackTrace(); // could not find the map brooo!!! BBOOOOMMMMM!!!!! } // B...
dc98e8aa-dd65-4155-a513-cf24ed5a4f1d
1
public void visit_lushr(final Instruction inst) { stackHeight -= 3; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 2; }
8539c196-7ac5-4eef-a4b3-fcb7a3132f43
0
public void addFind(int i, String s) { this.finds.add(i, s); }
71e32417-452e-4876-8467-1758882ba872
5
@Override protected boolean evaluateLayer(final T baseValue, final T testValue) { if (baseValue instanceof Integer) { return testValue.intValue() < baseValue.intValue(); } else if (baseValue instanceof Float) { return testValue.floatValue() < baseValue.floatValue(); } else if (baseValue instan...
b072d4c3-bf1f-43f0-b031-a36f01ffece8
1
public void delegateLoadingOf(String classname) { if (classname.endsWith(".")) notDefinedPackages.addElement(classname); else notDefinedHere.put(classname, this); }
44564e54-2a3a-4816-9bce-61786d5b1bdd
0
@EventHandler public void init(FMLInitializationEvent event) { }
41fdff1e-affb-43bd-abc6-cd1a73dd31da
8
private void crearMazo(){ for(int x=0; x<40; x++){ //condicionales que asigna distintos palos a las cartas if(x<10){ if(x<7){ mazo[x] = new Carta(x+1,"Espada"); }else{ mazo[x] = new Carta(x+3,"Espada"); } }else if(x < 20){ if(x<17){ mazo[x] = new Carta((x-10)+1,"Oro"); ...
bdda7397-fb51-4ac8-a4cb-93293cc0ce8b
0
public SimpleFileFormat() {}
30aa46b7-dfd1-4584-8e88-48af497672e3
2
public final void useType(Type type) { if (type instanceof ArrayType) useType(((ArrayType) type).getElementType()); else if (type instanceof ClassInterfacesType) useClass(((ClassInterfacesType) type).getClassInfo()); }
75594df1-4304-47ec-9641-6267227097f3
8
public boolean isContinuousForRC(int curRes, int curAA, int curRC){ //Check if the DOF can be continuously minimized in the given RC, //i.e. there is an interval of nonzero width compatible with the RC if( intervals == null ) return false; //Convert curRes (numbered among al...
6a2dbc76-1d1e-4b08-998c-04e480df17d7
1
@Test public void testGetValue() { Genotype g = new Genotype(1, 1); Agent a; try { a = new Agent(g, 0, 0, 0); HungerInputNeuron neuron = new HungerInputNeuron(a); assertEquals("New agent should have 0 hunger.", 0.0, neuron.getValue(), 0); } catch (WeigthNumberNotMatchException e) { fail("Error whi...
5e18296a-ae21-4ae2-bb51-f828e62c64b4
0
private DeviceType(String name) { this.name = name; }
4d9fba94-7f76-4f43-96de-b42b4950613d
4
private int calculateOffset(int original, int watermark, Alignment alignment) { if (alignment == HorizontalAlignment.LEFT || alignment == VerticalAlignment.TOP) { return 0; } if (alignment == HorizontalAlignment.RIGHT || alignment == VerticalAlignment.BOTTOM) { return ori...
0fbf3d3d-db9e-44c6-a34c-ed474535d6fc
9
public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { StringBuffer s = new StringBuffer( nf.format(number) ); if( s.length() > width ) { if( s.charAt(0) == ' ' && s.length() == width + 1 ) { s.deleteCharAt(0); } else { s.setLength( width ); for( in...
caa5785d-5e14-4e2d-a81b-5010e576f5eb
8
public void printTree() throws CloneNotSupportedException { int korkeus = laskeKorkeus(this.getRoot()); int tamanHetkinenKorkeus = korkeus; int solmujenMaara = 1; int korkeudenLaskemisraja = 1; boolean tulostetaankoEkatValit = true; // Tehdään puusta "täydellinen" puu ...
12319529-d7da-436a-a4fc-cafac7e3def2
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...
41bab783-99de-482c-b0ae-f9fdbbc3afe9
3
public OximataAdd(int editId) { /* * parathiro gia prosthiki oximatos an to editId einai 0 i epe3ergasia an einai megaluterao tou 0 */ con = new Mysql(); id=editId; if(id==0) //emfanizei ton katalilo titlo analoga thn leitourgia pou exei epilex8ei setTitle("Prosthiki Oxhmatos"); else setTitle("Epe...
d262e3d6-b3b8-4cf1-93e9-93a6876fdcdd
9
public void paintComponent(Graphics g) { super.paintComponent(g); if(numberStorage != null) { Set<Integer> keys = numberStorage.getKeys(); int maxCount = numberStorage.getMaxValue(); int minCount = numberStorage.getMinValue(); int totalCount = numberStorage.getTotalCount(); int numbKeys = keys...
e69ea8a5-6e29-4f6e-b215-93a9580e101d
9
public Set<Action> actions(Object state) { Sudoku sudoku = (Sudoku) state; int grille[][] = sudoku.getGrille(); Set<Action> actions = new LinkedHashSet<Action>(); // boolean positionTrouve = false; // // Genere exception Java heap space // for(int i = 0; i < 9 ; i++){ // for(int j = 0; j < 9 ; ...
ba221025-5595-4c4d-806a-073b067961a7
4
public void createPanel(JPanel mainPanel) { contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); mainPanel.add(contentPane); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); JPanel panel = new JPanel(); contentPane.add(panel); panel.setLayout(null); JLis...
5b8387b4-7dd2-4be8-9d08-cac95084f1ca
1
public void update(float dt) { for(Letter letter: this.lettersOnTheTable){ letter.update(dt); } checkingPlatform.update(dt); hero.update(dt); monster.update(dt); timer.update(dt); checkForBodiesToDelete(); }
1d0eda9e-3102-449f-954b-b849cc1806d9
7
public EditorData(int index,String header,String dataUrl){ this.url=dataUrl; this.id=index; HorizontalPanel upPanel=new HorizontalPanel(); add(upPanel); HorizontalPanel downPanel=new HorizontalPanel(); add(downPanel); String[] headerValues=header.split("\t"); title = new Label(he...
388a9292-344f-4e33-9cb8-673427d1e3ee
0
public void onMessage(IMessage message) throws JFException { }
a5cc44ae-e6db-4b02-a4cb-5427fd843c0a
9
@Override public HeightMap applyTo(HeightMap... heightMaps){ double[][] finalHeights = heightMaps[0].getHeights().clone(); double[][] newHeights = heightMaps[0].getHeights(); int xSize = finalHeights.length; int ySize = finalHeights[0].length; for(int iteration = 0; iteration...
0e9f56a7-5632-4875-94b7-1c582035a4cb
3
public void InsertaMedio (int ElemInser,int Posicion) { if (VaciaLista()) { PrimerNodo = new NodosProcesos (ElemInser); PrimerNodo.siguiente = PrimerNodo; } else { if (Posicion<=1) InsertaInicio(ElemInser); else { NodosProcesos Aux = PrimerNodo; int i = 2; ...
3cdadfc5-fc03-4f76-9adf-65e5fed5fade
3
public void loadMap() { try { InputStream in = getClass().getResourceAsStream(src); BufferedReader br = new BufferedReader(new InputStreamReader(in)); numCols = Integer.parseInt(br.readLine()); numRows = Integer.parseInt(br.readLine()); width = numCols * tileSize; height = numRows * tileSize; ...
19be62c4-77a2-4f9d-9f79-27357e347a19
7
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); for (int i = 0; i < n; i++) { int len = Integer.parseInt(br.readLine()); String[] in = br.readLine().split(" "); int pred = Intege...
53a28d2e-5c30-481c-8d92-ee8c13897e9e
2
private void increasePoolSizePercent(int increment) throws SQLException { synchronized (this.mutex) { double percincr = 1 + (increment / 100.0); int newsize = (int) (pool.size() * percincr); if (newsize <= pool.size()) { newsize = pool.size() + 1; } LOGGER.fine("Increasing pool size from " + ...
0c89f5c1-f82c-4ea0-9bb6-446bb5f9b86f
6
private void drawLines(int[][] lines, Graphics2D g, boolean addToX) { for (int line = 0; line < lines.length; line++) { for (int i = 0; i < lines[line].length; i += 2) { int grid = 30; int p1 = xTop + lines[line][i] * grid; int p2 = yTop + line * grid; int x1 = addT...
2cfa851a-a808-4a49-b025-7e38e80137c5
8
private int findIndexByKeyEvent(KeyEvent keyEvent) { for (int i = 0; i < icons.size(); i++) { IconInformation info = (IconInformation) icons.get(i); final KeyStroke iconKeyStroke = info.getKeyStroke(); if (iconKeyStroke != null && (keyEvent.getKeyCode() ==...
93214263-a3a7-408c-99d2-6280c02651ce
5
private String read() throws IOException, EOFException, InterruptedIOException { StringBuffer buffer = new StringBuffer(); int codePoint; boolean zeroByteRead=false; if (DEBUG) System.out.println("Reading..."); do { codePoi...
aebd73d9-3f85-416e-887b-852197f5534a
9
public void submit() { String Benutzername = nameTextPane.getText(); if (Benutzername.length() <= 0) { JOptionPane.showMessageDialog(this, "Your username must have at least one character.", "Oh, come on...", JOptionPane.WARNING_MESSAGE); } else if (Benutzername.length() > 16) { JOptionPane.showMessageDialog...
80b24506-25f3-415e-8f56-cd4e3971d5a0
7
public static void test(Class<?> surroundingClass){ for(Class<?> type : surroundingClass.getClasses()){ System.out.println(type.getSimpleName() + ": "); try{ Generator<?> g = (Generator<?>) type.newInstance(); for(int i = 0 ; i < size; i++) System.out.println(g.next() + " "); System.out.println...
a115779e-6602-498d-b74c-2547d2915b50
2
public Transition addIncomingTransition(Transition t) { if(t != null && !incomingTransitions.contains(t)) { incomingTransitions.add(t); return t; } return null; }
de29fde5-de2f-4903-b461-7583b3af854b
8
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for(int c = 0, C = parseInt(in.readLine().trim()); c++ < C; ){ StringTokenizer st = new StringTokenizer(in.readLine()); int W = abs(parse...
60eab88b-252b-40d5-bfbc-3759df63f59d
7
private void handle(Object input) { if (input instanceof Datagram) { TransitionEvent event = getTransitionEventFromDatagram((Datagram) input); try { this.fsm.handleEvent(event); if(this.fsm.getCurrentState() != null && "acked".equals(this.fsm.getCurrentState().getIdentifier())) { if(Statics.RX...
1a680442-3ba4-4149-9b45-59a81a928665
1
@Override public String execute(HttpServletRequest request) { String text = request.getParameter("text"); Text nText = Parser.parseText(text); List<Sentence> sentences = new ArrayList<>(); for (int i = 0; i < nText.getElements().size(); i++) { sentences.addAll(nText.getE...
0899e163-a157-48c9-b8e4-e46587d5e284
8
private void langSelector_settingsListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_langSelector_settingsListValueChanged if (langSelector_settingsList.getSelectedValue() == null) return; String oldLang = String.valueOf(settings.getLanguage()); ...
020c2b37-cf74-44af-8a57-3b81fe0c9151
5
private static String intArrayToString(int[] sa) throws Exception { StringBuffer res=new StringBuffer(); for(int i=0;i<sa.length;i++) { int ii=sa[i]; char ch0=(char) (ii& 0xFF); char ch1=(char) (ii>>>8& 0xFF); ...
29a6e87d-903f-4cfc-9560-8c17fa82362e
2
public static void main(String[] args) { try { UIManager .setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } EventQueue.invokeLater(new Runnable() { public void run() { try { ClientGUI frame = new ClientGUI(); frame.se...
e0e19314-4959-41ca-9451-6ff9cd2e327a
3
private void determineOrbits() { int maxPerOrbit = Math.min((int) (baseOrbit.getCircumference() / componentSize), this.getNumSubComponents()); componentTheta = Math.PI*2/maxPerOrbit; int numOrbits = (int)Math.ceil((double)this.getNumSubComponents() / maxPerOrbit); orbitCounts = new in...