method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
94b7b79e-36d0-4b59-917f-0f25ce1074b6
2
private void render() { renders++; BufferStrategy bs = this.getBufferStrategy(); if(bs == null){ this.createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); if(!input.focus.hasFocus){ screen.fill(0, 0, WIDTH, HEIGHT, 0, 50); String msg = "CLICK TO FOCUS"; screen.draw(msg, 2...
29c20b78-dbd3-46ff-a1c3-dcfb2550be5b
5
@Override public UserInput fetchUserInput() { String userInput; try { userInput = bufferedReader.readLine(); if (userInput.trim().equals("u")) { return new UserInput(InputType.UNDO); } else if (userInput.trim().equals("r")) { return new UserInput(InputType.REDO); } else if (userInput.trim().equ...
e9ca3e25-bf69-4e4d-a720-1301b0a5fbab
3
public LinkedList<Board.Field> findSolution(int startX, int startY) { if( n > 4) { solveWithBacktrack(0,b.getField(startX, startY)); } else { //special cases if(n == 1) { System.out.println(startX + " , " + startY); } //print nothing, there is no solution } Iterator<Boa...
102f3c6b-1d58-4372-97e0-1fae0a551773
1
public static void main(String[] args) { List<Integer> list = new ArrayList<Integer>(); List<Integer> list2 = new ArrayList<Integer>(); System.out.println("Creating array. Size: " + N_ELEMENTS); for (int i = 0; i < N_ELEMENTS; i++) { list.add(rand.nextInt(Integer.MAX_VALUE));...
7f17f06d-3f7a-4a0f-9633-892cb87544c5
7
public boolean requestPermission(SkiPass sp) { Calendar currentTime = Calendar.getInstance(); boolean permission; if (!sp.getValid()) { SkiPassSystem.addStats(sp.getId(), sp.getType(), currentTime, false); return false; } if (sp.getType().getWorkingOrWeeke...
c7a3cace-9fd0-4804-912c-ed7010d55f97
4
public void loadAllTasks(){ allTasks = null; try { ResultSet dbAllTasks = null; Statement statement; statement = connection.createStatement(); dbAllTasks = statement.executeQuery( "SELECT Task.* FROM Task;"); while(dbAllTa...
e943670b-0028-4238-830c-1ad5816a47cf
7
public void connect() throws IOException { if (level != 0) // otherwise disconnected or connect throw new SocketException("Socket closed or already open ("+ level +")"); IOException exception = null; SSLSocketFactory sf = null; SSLSocket s = null; for (int i = 0; i < ports.length && s == null; i++) { tr...
6dc8db28-1370-407b-98ef-dadeae9bc200
4
@Override public int compare(Task o1, Task o2) { int result = 0 ; switch(TypeOfComparison) { case By_title: result = o1.getTitle().compareToIgnoreCase(o2.getTitle()); case By_modelID: result = o1.getModelId().compareTo(o2.getModelId...
322d6a3d-1701-4989-a55c-e8ccb3a07f2c
6
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Object ret = null; if (component instanceof PickList) { Object dualList = ((PickList) component).getValue(); @SuppressWarnings("unchecked") DualListModel<Livro> dl = (DualListModel<Livro>) dualList; ...
b0a666e8-2917-4e22-8b15-51b36a9f81b6
3
public static boolean dif(int a, int b) { char[] numA = f(a).toCharArray(); char[] numB = f(b).toCharArray(); int mask = 0; for (int i = 0; i < numA.length; i++){ if ((mask & (1 << (numA[i] - '0'))) == 0) mask |= (1 << (numA[i] - '0')); else return false; if ((mask & (1 << (numB[i] - '0'))) == ...
4caa046a-125c-4ea3-84f4-a8e76a06f1b0
5
@EventHandler public void onPlayerJoin(PlayerJoinEvent event) { if (event.getPlayer().hasPermission("apply.check")) { ResultSet set = this.getMySQL().executeQuery("SELECT * FROM " + this.getTable() + " WHERE promoted=0"); if (set == null) { return; } ...
90047cd1-d6e8-44a1-a524-8456da782624
8
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line; StringTokenizer st; while ((line = br.readLine()) != null) { st = new StringTokenizer(line); int S = Integer.parseInt(s...
ae311f6b-3340-46e2-be20-1ee6cf592630
7
public double calculateTotalCostOfRoute(Vehicle vehicle, String weekDay, boolean specialFee, boolean axles) throws IOException { double cost = 0; String fuel = readFuelsCSV(weekDay); for(Route route : routeList) { if(vehicle instanceof Truck) { Tr...
63152d85-1557-4bc7-8ff1-1923941588e2
1
public Iterator getChilds() { /* * Since loadedClasses is somewhat sorted by the hashcode of the * _original_ names, swap it here to prevent to guess even parts of the * names. */ if (swappedClasses == null) { swappedClasses = Arrays.asList(loadedClasses.values().toArray()); Collections.shuffle(sw...
1df3684e-4094-47d7-901c-8873ffa5bd5d
1
public void removeRange(int fromIndex, int toIndex) { int numMoved = size - toIndex; System.arraycopy(data, toIndex, data, fromIndex, numMoved); int newSize = size - (toIndex - fromIndex); while (size != newSize) { data[--size] = null; } }
c221733c-a10f-422e-9db0-88f2f5e648a1
9
public String content() { String s = ""; org.w3c.dom.NodeList nodeList = domNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { org.w3c.dom.Node node = nodeList.item(i); int type = node.getNodeType(); AdapterNode adpNo...
d79019cf-496d-4b6d-8427-6be5d073534c
7
public boolean validateAFNExpression(String expression) throws Exception{ errorMessage = ""; List<String> currentStates = new ArrayList<String>(); currentStates.add(content.getInitial()); for(int i=0; i<expression.length();i++){ String currentSymbol = "" + expression.charAt(i...
f4531594-e669-4982-b504-9e749e01bffe
7
public static int getRevision(ClassNode node){ ListIterator<MethodNode> mnIt = node.methods.listIterator(); while(mnIt.hasNext()){ MethodNode mn = mnIt.next(); if(mn.name.equals("init")){ ListIterator<AbstractInsnNode> abIn = mn.instructions.iterator(); ...
00bd54ef-d0b7-445a-846d-ea0709c56a0e
4
private boolean hasAugmentingPath(FlowNetwork G, int s, int t) { edgeTo = new FlowEdge[G.V()]; marked = new boolean[G.V()]; Queue<Integer> q = new LinkedList<Integer>(); q.add(s); marked[s] = true; while (!q.isEmpty()) { int v = q.remove(); for (FlowEdge e : G....
a41e0848-1c7d-4f7d-b980-ce13e58b57c7
9
public static String encode64(byte[] b) { StringBuffer sb = new StringBuffer((b.length / 3) * 4); int i = 0; int remaining = b.length; char c[] = new char[4]; while (remaining > 0) { // Three input bytes are encoded as four chars (6 bits) as // 00000011 1...
4552a2c7-6a8c-40c9-bd07-fe66e2a85903
0
public static AffineTransform fit(Rectangle rectDraw, Rectangle rectSpace) { return new AffineTransform(); }
7e0f6174-34b6-4c02-834c-a943679af92b
7
@Override public void keyReleased(KeyBindingEvent event) { SpoutPlayer player = event.getPlayer(); boolean flightPerm = false; if (plugin.getSFConfig().useOps()) { flightPerm = player.isOp(); } else if (player.hasPermission("spoutflight.fly")) { flightPerm = true; } if (event.getScreenType().toStri...
65934064-0e37-434b-ba58-d089d3a20d33
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AccurateTime that = (AccurateTime) o; return hour == that.hour && minute == that.minute && second == that.second; }
daf5bf29-c92a-4b88-a5ef-06551a41e680
3
private String performJsonPost(URL url, String json) { try { HttpURLConnection conn = (HttpURLConnection) url.openConnection(); byte[] payloadAsBytes = json.getBytes(Charset.forName("UTF-8")); conn.setConnectTimeout(15000); conn.setReadTimeout(15000);...
9041543f-69ce-4396-9966-9c474bb6a6d5
3
public static mxPngEncodeParam getDefaultEncodeParam(RenderedImage im) { ColorModel colorModel = im.getColorModel(); if (colorModel instanceof IndexColorModel) { return new mxPngEncodeParam.Palette(); } SampleModel sampleModel = im.getSampleModel(); int numBands = sampleModel.getNumBands(); if (numB...
3ee05a33-cee7-4527-99c8-9d05f206243d
9
@Override public void render(final Graphics g) { if (levelType == LEVEL_MID) { g.drawImage(ImageLoader.background_norm, 0, 0); g.drawImage(ImageLoader.shade_white, 0, 0); } if (levelType == LEVEL_COMPLEX) { g.drawImage(ImageLoader.background_complex, 0, 0); if (levelBlendTimeleft < 0 && !isWin) ...
bf021b77-9678-4915-8faf-025c90bf7055
5
@Test public void testReceiveMultipleManyToBeExpiredSomeValid() { int noOfMessages = 13; try { consumer = new AbstractMessageConsumer(mockTopic) { }; assertNotNull(mockTopic.getTopicSubscriber()); HashSet<Message> messages = new HashSet<Message>(); for (int i = 0; i < noOfMessages; i++) { Messa...
f626fd06-0a69-48d8-8092-878e9a27704c
2
public boolean equalsExpr(final Expr other) { return (other != null) && (other instanceof CheckExpr) && ((CheckExpr) other).expr.equalsExpr(expr); }
933c9b24-db72-4f80-b824-5c0a39003ac9
8
public boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2) { if (mode1.getWidth() != mode2.getWidth() || mode1.getHeight() != mode2.getHeight()) { return false; } if (mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode1.g...
97bc5084-7471-43c3-9fb0-638772c828ac
5
@SuppressWarnings({ "rawtypes", "unchecked" }) private void initAjaxRender() { try { Element root = configXml.getDocumentElement(); NodeList nodeList = root.getElementsByTagName("ajaxRender"); if (nodeList.getLength() == 0) {// 如果没有配置则默认是json渲染 RenderFactory.setAjaxRender(new JsonRender()); } else if...
e506038a-f121-4f9f-bc07-1c2a384f477a
9
public List<Token> tokenize(String formula) { int offset = 0; int length = formula.length(); List<Token> parts = new ArrayList<Token>(); while (offset < length) { char current = formula.charAt(offset); if (Character.isWhitespace(current)) { offs...
96436bfc-6047-40f5-85da-9a5b6f05b143
2
public int Obtener_Secuencia() { try { int id1 = 0; String sql = "select count(*) from mensajesprogramados"; ResultSet rs; if ((rs = conn.consultar(sql)).next()) { id1 = Integer.parseInt(rs.getString(1)); } return id1; ...
b01ebd17-e524-429c-a4ac-818584f2b5f9
4
@Override public void updateAnimation() { preview = new mxCellStatePreview(graphComponent, false); if (cells != null) { // Animates the given cells individually without recursion for (Object cell : cells) { animateCell(cell, preview, false); } } else { // Animates all changed cells by ...
56c3c438-8107-49c8-805c-6d1b0b5b4efe
5
private synchronized BigInteger[] generateParameters() { // N A large safe prime (N = 2q+1, where q is prime) // g A generator modulo N BigInteger q, p, g; byte[] qBytes = new byte[l / 8]; do { do { nextRandomBytes(qBytes); q = new BigInteger(1, qByte...
3deb1a45-e757-4050-8122-ebf7368fdb5e
2
private static JMenuItem saveImage( final UmlDiagramView view ){ JMenuItem menuItem = new JMenuItem( "Save image" ); menuItem.addActionListener( new ActionListener() { @Override public void actionPerformed( ActionEvent e ) { Path path = Paths.get( "test-image.png" ); int index = 1; while( Files.ex...
ce2689ed-f97a-4a56-990e-dc465f1b5152
9
@SuppressWarnings("deprecation") private void drawDate(Graphics g){ g.setColor(FULL_CIRCLE_COLOR); int day[] = { (date.getDate() / 10 ) , date.getDate() - ((date.getDate() / 10) * 10) }; /* date.getDate(); System.out.println( date.getDate()date.getDate() - ((date.getDate() / 10) * 10)); for (int...
99c58591-a16f-4df4-bf63-bb2d990cc8d9
7
public void sortList() { ArrayList<Object> genericList = null; ArrayList<Item> out = null; if(parent instanceof MainPanel){ genericList = ((MainPanel) parent).getSortPanel().retrieveCats(); out = DataManagement.getInventorySubset(player.getInventory(), genericList); out = DataManagement.alphaSortedLi...
7edcb726-c81b-4363-90e7-b36038197c84
0
public static void add(Client client) { clients.put(client.id, client); }
7934f65b-f1a4-47d2-87dd-4ba8ea6a9e4e
5
private Object maybeReadSequence(int cfaslOpcode) throws IOException { switch (cfaslOpcode) { case CFASL_LIST: return readCycList(); case CFASL_DOTTED: return readCons(); case CFASL_VECTOR: return reportUnhandledCfaslOpcode(cfaslOpcode); case CFASL_STRING: int...
f2a4fba0-6c36-41eb-9a27-f72c11f5c9ff
5
private void init() { if (client != null) { try { out = client.getOutputStream(); } catch (IOException e) { // TODO Auto-generated catch block delegate.connectionFailed(e.getLocalizedMessage()); return; } try { in = client.getInputStream(); } catch (IOException e) { // TODO Aut...
e2979fbe-5a3d-4dec-9a00-e21426288a8f
2
public static void main(String args[]) throws Exception{ int fis=0,sec=0; Map numMap=new LinkedHashMap(); int cycleLength=0; if(args.length==2){ fis=Integer.parseInt(args[0]); sec=Integer.parseInt(args[1]); }else{ throw new Exception ("Inputs are not correct"); } for (int count=fis;count<=sec;...
2c6845be-18df-4c92-8fd6-bc48a9bbc385
3
@Override public void move(Direction dir) { if (tile == null) { return; //null check in case we're dead } Tile target = match.getTile(tile.y + dir.getY(), tile.x + dir.getX()); if (target != null && target.passable()) { tile.moveBomber(this, target); ...
bb7532e6-69eb-4be7-8d21-923657aadfa3
6
public void initializePart2(String[] args) { if(args.length < 2) { System.out.println("Invalid Arguments."); return; } Robots model; if(args[1].equals("map0")) { int[][] maze = { { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 3, 1, 1, 1, 1, 3, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 } }; model = new Robots(maze); ...
f67a1a59-b60c-4e5a-99bf-88c062e0add2
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ConstDeclarationNode other = (ConstDeclarationNode) obj; if (expression == null) { if (other.expression != null) return false; } else...
04d4f053-c7fd-41ea-bd1d-00a4e92539ba
7
public Boolean atualizarPorTodosOsDados(Cidadao cidadao) { Boolean sucesso = false; Connection connection = conexao.getConnection(); try { String valorDoComandoUm = comandos.get("atualizarPorTodosOsDados" + 1); String valorDoComandoDois = comandos.get("atualizarPorTodosOs...
377f16ed-4b4f-4143-b6f7-7d8e5885d13e
6
@Override public boolean importData(TransferHandler.TransferSupport info) { JTable target = (JTable) info.getComponent(); JTable.DropLocation dl = (JTable.DropLocation) info.getDropLocation(); int index = dl.getRow(); int max = table.getModel().getRowCount(); if (index < 0 || index > max) { index = max; ...
474bb109-a072-439d-a1ac-5964d9bc09b7
7
protected void actionPerformed(GuiButton par1GuiButton) { if (par1GuiButton.enabled) { if (par1GuiButton.id == 2) { String var2 = this.getSaveName(this.selectedWorld); if (var2 != null) { this.deleting = tru...
cb5231c4-7ee6-40a1-a0b0-85a8cace20f9
9
public static int numDecodings(String s) { int len = s.length(); if(len == 0) { return 0; } String[] tmp = s.split(""); int[] nums = new int[len]; for(int i=1;i<len+1;i++) { nums[i-1] = Integer.valueOf(tmp[i]); } if(nums[0] == 0) { return 0; }...
39501a85-73b0-4c3e-8325-ab2ab54e7189
7
@Override public boolean isValid(Object value, ConstraintValidatorContext context) { if (!new RequiredValidator().isValid(value, context)) { return true; } Date dateValue = (Date) value; if (!util.isValid(annotation, dateValue, context)) { if (annotation.message().isEmpty()) { buildConstraintViolat...
473f9c4e-f086-442a-b2aa-abe41ed51bae
7
public void handleSaveButton() { int index = transitionView.getTransitionList().getSelectedIndex(); if (index != -1){ String currentState = transitionView.getCurrentState().getText(); String currentSymbol = transitionView.getCurrentAlphabet().getText(); String switch...
361bbcfd-fd33-4fa3-9fc9-7c746d1d1885
1
public void setValue(double value) { if(this.value != value) { fireEvent(new ValueChangeEvent(value, value - this.value)); this.value = value; } }
68d9c700-d8af-41c6-80c0-b686e8c5fbdd
7
public void visitBlock(final Block block) { Assert.isTrue(block.graph() == cfg, block + " is not in the CFG"); Iterator e; final Handler handler = (Handler) cfg.handlersMap().get(block); // If this block is the first block in an exception handler, make // sure that the only predacessor edges the block has ...
4f759c47-6f2e-4f43-b4bd-92daf4762756
4
public static FloorObstructions setValue(String x) { int intX = Integer.parseInt(x); switch (intX) { case 0: return UNKNOWN; case 1: return OPEN; case 2: return OBSTACLE; case 4: return STAIRS; } return null; }
9db677d6-a42b-4ec6-b8b0-4590b58445c7
8
private boolean r_Step_1c() { int v_1; // (, line 51 // [, line 52 ket = cursor; // or, line 52 lab0: do { v_1 = limit - cursor; lab1: do { // literal, line 52 if (!(eq_s_b(1, "y"))) { break lab1; } break lab0; } while (false); cursor = limit - v_1; // literal, line 52 ...
8ab6cdbf-8243-4bd8-ab2f-cca4e1aae2d5
4
public void setAllLeafIcons(ImageIcon normal, ImageIcon selected) { if (normal != null) { for (AccordionLeafItem leaf : getAllLeafs()) { leaf.setNormalIcon(normal); } } if (selected != null) { for (AccordionLeafItem leaf : getAllLeafs()) { ...
9768f010-29d5-4d08-8fc3-f679bc90e91e
0
public ConcreteDecorator1 (Component component) { super(component); }
f63c00df-5fc0-4c64-b626-41f6216fcf3d
5
public void addHeadLiteral(final Literal literal) throws RuleException { // addHeadLiteral(literal,true); // } // public void addHeadLiteral(final Literal literal,boolean checkLiteralVariable) throws RuleException { if (null == literal || "".equals(literal.getName())) throw new RuleException(ErrorMessage.LITERAL_NAM...
d1eb32b4-908e-4aec-aea6-9ef53f5a42e2
0
public void updateTable() { tableModel.setRowCount(0); addRowToTable(getDataToTable()); }
89ed24da-fae4-41c5-99ea-5efc9f58603a
8
public boolean equals(Object other) { if (other instanceof Pair) { Pair otherPair = (Pair) other; return (( this.first == otherPair.first || ( this.first != null && otherPair.first != null && this.first.equals(otherPair.first))) && ( this.second == otherPair.second || ...
c0ae544e-4c09-4a3a-a2be-8b7ceb49ba97
2
public static CalculateWeapon makeCalc(int type, int roundNumber) { switch (type) { case RANDOM: return new RandomCalculator(); case SMARTCALCULATOR: return new SmartCalculator(roundNumber); } throw new IllegalArgumentException("Not a valid...
22c524bd-a359-4cdd-b79c-65ee30692a41
3
private ArrayList<Creador> obtenerCreadores(ArrayList<String> listaIdCreadores){ ArrayList<Creador> creadores = new ArrayList(); for (String idCreador : listaIdCreadores) { for (Creador creador : misCreadores) { if (creador.obtenerNombre().equals(idCreador)) ...
f6e76d3b-e8db-40a3-872e-4f98e0c7aa81
9
public static Cons synthesizeMethodBody(MethodSlot method) { if (((Stella_Class)(Stella.SGT_STELLA_BOOLEAN.surrogateValue)) == null) { return (Stella.NIL); } { Symbol storageslotname = ((Symbol)(KeyValueList.dynamicSlotValue(method.dynamicSlots, Stella.SYM_STELLA_STORAGE_SLOT, null))); Symbol in...
54fb4183-7339-417f-9821-3f8cff45cf5f
6
public SkiPass createSkiPass(String cardType, Date activationDate, Date expirationDate, int numPassages) { if (cardType == null || activationDate == null || expirationDate == null) { return null; } SkiPassType skiPassType = SkiPassType.valueOf(cardType);...
2b167bef-9f82-42b1-bb48-295bdaa70964
6
public static void load() { if (!FILE.exists()) { reset(); return; } ObjectInputStream ois = null; FileInputStream fis = null; try { fis = new FileInputStream(FILE); ois = new ObjectInputStream(fis); instance = (Scores) ...
6a4bb2de-2a9f-4e51-a598-6312ada0d3ba
0
public boolean hasLegalField(Player player) { return !this.getLegalFields(player).isEmpty(); }
53f3f3a0-ef2d-480b-9a3f-4fb9e4e15c09
1
protected final Label getLabel(final Object label) { Label lbl = (Label) labels.get(label); if (lbl == null) { lbl = new Label(); labels.put(label, lbl); } return lbl; }
e8bc6fc3-1046-47c4-a9ae-a2e3f3a44586
4
public static boolean esNumero(String s) { if (s.isEmpty() || s == null) return false; for (int x = 0; x < s.length(); x++) { if (!Character.isDigit(s.charAt(x))) return false; } return true; }
8b82ef80-3b87-4596-9db7-f80371c44c2f
2
private int findYear (String input) { Scanner s = new Scanner (input); int[] date = new int[3]; s.useDelimiter("/"); while(s.hasNext()) { for (int i = 0; i < date.length; i++) { date[i] = s.nextInt(); } } s.close(); return date[2]; }
f3fa2bae-315e-406a-88b9-af2db6b2681d
7
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { AttributesImpl attrs = new AttributesImpl(); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: if (type == Opcodes.F_NEW) ...
2e308e0a-592a-44a8-a3da-33a72f03fa44
0
@Test public void testIsEmpty() { System.out.println("isEmpty"); Cell instance = new Cell(0,0); boolean expResult = true; boolean result = instance.isEmpty(); assertEquals(expResult, result); instance.setAnthill("red"); expResult = false; resu...
1b750661-8460-4b57-837b-b86749e9b6d2
2
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { // String str=request.getParameter("opiton"); Connection conn; Statement stmt; response.setContentType("text/html"); PrintWriter out=response.getWriter(); try { Class.forName("com.mysql.jdbc.Driver")...
8f948273-6226-4abf-9a4e-a06e86dfb857
4
public boolean isNormalized() { if (x > 1.0f || x < -1.0f || y > 1.0f || y < -1.0f) { // Fast check return false; } return ((x*x + y*y) == 1.0f); // Sqrt(1) = 1, no need to take sqrt }
d46ffa47-71c0-47f3-9c4c-87f4957948f0
2
public void listen(int port) { try { server = new ServerSocket(port); listening = true; while (listening) { new HTTPClient(server.accept()).start(); } } catch (Exception ex) { ex.printStackTrace(); } }
efa501a0-7323-4667-8feb-ca577a3c2cf1
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()); ...
81844361-ae5a-4f51-b98c-f0e076fed443
7
public static void main(String[] args) { boolean[] isPrime = EulerMath.getSieve(N); HashSet<Integer> primeFactors = new HashSet<Integer>(); TreeMap<Integer, HashSet<Integer>> map = new TreeMap<Integer, HashSet<Integer>>(); for(int i = 2; i < N && map.size() < 4; i++) { int x = i; primeFactors = new Has...
6b85c5ed-b349-48c6-8ed4-3387c03dd584
0
public static void main(String[] args) { int x, y, z; x = y = z = 1; System.out.println("x = " + x + ", y = " + y + ", z = " + z); System.out.println(32 % 7 % 3); // 1 System.out.println((32 % 7) % 3); // 1 System.out.println(32 % (7 % 3)); // 0 }
5946f32a-da37-4cde-9b01-722f7bc85bf1
1
public static CollectionCompanyApplication getInstanceCollectionCompanyApplication() { if (collectionCompanyApplication == null) { collectionCompanyApplication = new CollectionCompanyApplication(); } return collectionCompanyApplication; }
0c3fabbe-8185-4cc7-8790-86f8c079a127
7
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(SCRIPT_TAG)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (id) { ...
9170889c-3345-4960-a3cc-798a554c6eb9
5
@GET @Path("/receive/{macAdr}") @Produces({"application/xml", "application/json"}) public List<History> receive(@PathParam("macAdr") String macAdr) { query = em.createNamedQuery("UserMaster.findByMacAdr").setParameter("macAdr", macAdr); if(!query.getResultList().isEmpty()){ um = ...
3d91bda4-77cc-470d-9e73-8eb80a924ce6
4
public static void startpriv(InetAddress inetaddress) { Signlink.threadliveid = (int) (Math.random() * 99999999D); if (Signlink.active) { try { Thread.sleep(500L); } catch (Exception exception) { } Signlink.active = false; } Signlink.socketreq = 0; Signlink.threadreq = null; Signlink.dnsreq ...
5162ce27-9f17-40ec-ad34-450f34f8bfee
4
public static int[] getWayWithDirection(int direction) { int[] way = new int[2]; switch (direction) { case 1: way[0] = 0; way[1] = -1; break; case 2: way[0] = -1; way[1] = 0; break; case 3: way[0] = 0; way[1] = 1; break; case 4: way[0] = 1; way[1] = 0; break; default: ...
e7ca92ec-7cce-40f0-b935-d869e5fd90e7
0
public void setSeed(byte[] value) { this.seed = value; }
2b723125-0f10-4d63-afda-0976b4077c0b
9
public boolean isMobCollision(int x, int y, Projectile projectile) { for (int i = 0; i < mobs.size(); i++) { if (mobs.get(i) != null && projectile.getSource() != null && mobs.get(i).getUniqueID() != projectile.getSource().getUniqueID()) { int mx = (int) mobs.get(i).getX(); int my = (int) mobs.get(i).getY(); ...
5338e454-1c7c-4488-8126-aa5c00bf94ea
7
protected void genAttackAttribute(MOB mob, CharClass E, int showNumber, int showFlag, String FieldDisp, String Field) throws IOException { if((showFlag>0)&&(showFlag!=showNumber)) return; mob.tell(showNumber+". "+FieldDisp+": '"+CharStats.CODES.DESC(CMath.s_int(E.getStat(Field)))+"'."); if((showFlag!=showNu...
ac671c3c-4a67-4bff-b6f8-63a01048ed86
9
public Raster2pgsqlVector2Points() throws IOException, SQLException, InterruptedException { System.out.println("hello3"); int i=0; String [] locateshppgsql=null; locateshppgsql= new String[2]; locateshppgsql[i++] = "locate"; locateshppgsql[i++] = "raster2pgsql"; ProcessBuilder launchershppgsql = ...
fa77cfde-6d0e-49c1-980b-5b84231cf226
0
public CheckResultMessage checkF1(int day) { return checkReport.checkF1(day); }
67116920-96f4-4964-8fe6-830b6c564cc8
6
public static void wordBreak(String s, Set<String> dict) { boolean[] isWord = new boolean[s.length()+1]; int[] revPointer = new int[s.length()+1]; isWord[0] = true; // add the first index as the front pointer for 0th index //frontPointer.put(0, new ArrayList<Integer>()); ...
82ee23f8-681f-43e3-a317-eb141b611044
1
public void inicio(InstituicaoSubmissao instituicaosubmissao) throws Exception { salvar = new JButton("Salvar"); id = new JTextInt(instituicaosubmissao.getId()); id.setEditable(false); id.setEnabled(false); nome = new JTextField(instituicaosubmissao.getNome() == null ? "" : instituicaosubmissao.getNom...
96c53499-2301-426f-874c-f6d437c5f74e
6
@Override public boolean runLocal() throws SQLException { String sql = "CREATE TABLE score_history (score_id serial PRIMARY KEY, " + "record_id integer references records(recordnumber)," + "user_id integer references user_table(user_id)," + "score_date timestamp," + "score_value integer)"; Connect.get...
0d761eab-0a2a-4f24-a61f-fc9d29e4e467
5
public void notify(Object producer, String name, Object data) { if (isEnabled()) { StringTokenizer tokenizer = new StringTokenizer(name, SEPARATOR); StringBuilder builder = new StringBuilder(); while (tokenizer.hasMoreTokens()) { builder.append(tokenizer.nextToken()); String value = builder.toString(...
9b2ec199-c23f-4c7a-ba5e-954089f5516a
3
@Override public void draw() { BufferedImage layer = canvas.getLayers()[canvas.getLayerSelected()]; // Graphics2D g = (Graphics2D) layer.getGraphics(); // get the color of the pixel you clicked int clickedColor = layer.getRGB(x, y); Queue<Point> points = new LinkedList<Point>(); points.add(new Point(x, y...
07e1eaab-96a9-4f14-b56d-00414ddf991d
0
public static byte[] RSAoperation(String key, String exp, String modulus) throws Exception { BigInteger e = new BigInteger(exp, 16); BigInteger n = new BigInteger(modulus, 16); BigInteger m = new BigInteger(key, 16); BigInteger encrypted_m = m.modPow(e, n); return Utilities.toBy...
0f99e45c-9c1a-440e-8ae0-d9b215983535
8
@Override public List<Map<String, ?>> ListFotos(String tipo) { List<Map<String, ?>> lista = new ArrayList<Map<String, ?>>(); this.cnn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE); String sql = "select * " + "from RHTR_FOTOS_TRABAJADOR a , RHTM_TRABAJADOR b " + "w...
8725561c-6694-4540-b5bd-0479b87c8505
8
@SuppressWarnings("static-access") void parseCmdLineOptions(String[] args) { //--- // Create command line options //--- Option help = OptionBuilder.withArgName("help").withDescription("Show this help message").create("help"); Option inPe1Opt = OptionBuilder.withArgName("file").hasArg().withDescription("Qseq ...
6e496dc5-4d2d-478d-ba22-b3fb8c434ab2
5
public String readTextFile(String fileName) { String returnValue = ""; FileReader file = null; String line = ""; try { file = new FileReader(fileName); BufferedReader reader = new BufferedReader(file); while ((line = reader.readLine()) != null) { ...
82017dac-a9c6-4563-9647-067cae70031b
6
@Override public void saveBlock() { colorHEX.requestFocus(); editing.obj=logoObj.getText(); editing.commentIsHTML=global.useJLabels; String c=((ComboText)command.getSelectedItem()).getValue(); editing.command=c; if(c.equals("forward") || c.equals("backward") ...
d18f5f71-4713-4f99-9282-358f35dfaa42
4
@Override protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { session = req.getSession(true); sc = getServletContext(); if(!req.getParameter("korisnickoIme").equals("")){ korisnickoIme = req.getParameter("korisnickoIm...
f99517c7-6341-4784-a9fd-7772b0941672
4
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed // TODO add your handling code here: String nombre = StringValidation.validaTexto(tfGrupo.getText()); if (nombre != null) { try { Grupo grupo = new Gr...
2d9047ed-0445-482a-af97-f03faea23936
9
private void setPrefsRecurse(Component c, Preferences prefs, boolean reset) { SwingPrefSetter setter = getSetter(c.getClass()); if (setter != null || c instanceof PrefWidget) { // Make up name for component Class klass = c.getClass(); // String name = c.getName(); // Bad default names like frame1, frame2, etc. ...
78ecd456-e0e6-4752-a513-9394c2b57978
0
public static void main(String[] args) { Scanner input = new Scanner(System.in); IntArrayBag bag1 = new IntArrayBag(9); IntArrayBag bag2 = new IntArrayBag(9); bag1.add(10); bag1.add(20); bag1.add(30); bag1.add(40); bag1.add(4); bag1.add...