method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0481305f-9ccf-44e2-a4aa-ed76c9e70bb3
5
public void Play() { if (!left && !right) snapToX(); if (!up && !down) snapToY(); moveRight(right); moveLeft(left); moveDown(down); moveUp(up); for(int a = 0; a < totalBullets; a++){ bullet[a].Play(); } }
8b7e45d8-e73d-416d-a4b0-396635bd9130
6
private boolean processProduction(Production production, Grammar grammar, FirstSets firstSets) { if (production.isEpsilonMove()) { return false; } boolean result = false; int index = 0; for (final Symbol symbol : production.getR...
aa35ac6d-f151-463b-8bb5-161decc15bb2
0
public void execute( JobExecutionContext context ) throws JobExecutionException { invocation++; }
e23bbc89-915b-48c6-bac8-3c83f0f4e923
9
public boolean esDigito(int num) { boolean retorno; switch(num) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': retorno=true; break; default: retorno=false; ...
4c68048b-080f-49be-87cc-4b18897f5305
5
public void newTitle(String title) { final int length = title.length(); if (length == 0) { title = "NO_TITLE"; newTitle(title); return; } if (_first) _first = false; else newLine(); StringBuilder line = new StringBuilder(); int i; for (i = 0 ; i < _titleMargin ; i++) line.append(' '); ...
b0bd1b58-c1e5-4053-a798-8ea613f39dd3
7
public String and(String field, int min, int max) { String newField = "", number = ""; System.out.println(field.substring(0, 3)); if(field.substring(0, 3).equals("AND")) { newField = ","; field = field.substring(3); for(int i = 1; i <= field.leng...
1012379f-d7db-4a14-a7c7-fcbf905272f4
7
@Test public void multipleBoxTest() { BoundingBox bigBox = new BoundingBox(-100.0d, 100.0d, -100.0d, 100.0d); List<BoundingBox> boxes = new ArrayList<BoundingBox>(); for (int i=0; i<10000; i++) { boxes.add(BoundingBox.containing(bigBox.randomPoint(), bigBox.randomPoint())); ...
81f0bcff-3553-4b43-bf67-e3e70969050e
7
public static Type wrapTypeAndReplaceTypeVariables(final Type type, final TypeMap typeMap) { if (isParameterizedType(type)) { final ParameterizedType parameterizedType = getAsParameterizedType(type); final Type[] wrappedArguments = wrapTypeParameters(parameterizedType.getActualTypeArgume...
6c8af38a-041f-47e0-bad0-8257f83fd705
0
public CheckResultMessage checkJ01(int day) { return checkReport.checkJ01(day); }
89df6d12-860f-462c-b07f-e8ef42361631
6
public void close(ResultSet rs, PreparedStatement ps, Connection conn) { if (rs != null) { try { rs.close(); rs = null; } catch (SQLException e) { e.printStackTrace(); } } if (ps != null) { try { ps.close(); ps = null; } catch (SQLException e) { e.printStackTrace(); } }...
1f6a78ce-c715-4bf3-bea7-ca835954a543
0
public void setIntArray(int[] intArray){ this.intArray = intArray; }
8655c036-63ab-4952-b144-5ad371694e17
8
public void actionPerformed (ActionEvent event) { String eventName=event.getActionCommand(); // OK if (eventName.equals("OK")) { // Transfer the trigger this to the main program TtheApp.setListTriggers(triggerList); changedTriggers=true; dispose(); } // Cancel else if (eventName.equals("Cancel"...
b71469b5-a7a5-4f38-ac95-b41098f6856d
8
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[17]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 5; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
4b454831-e8f4-4eeb-9774-761e35e2721b
0
public void setNombre(String nombre) { this.nombre = nombre; }
09895555-bb48-428c-80a4-4aa3d303c1b7
8
private boolean check() { if (N == 0) { if (first != null) return false; } else if (N == 1) { if (first == null) return false; if (first.next != null) return false; } else { if (first.next == null) return false; } // check internal consistency of instance variable N int numberOf...
b81788c0-91b8-4975-814f-9c859b238378
7
public int[] getInts(int par1, int par2, int par3, int par4) { int ai[] = IntCache.getIntCache(par3 * par4); for (int i = 0; i < par4; i++) { for (int j = 0; j < par3; j++) { initChunkSeed(par1 + j, par2 + i); ai[j + i * par3] = nextIn...
048978ce-1977-4678-a45b-857a052568b4
3
public void set(long pos, long val) { if (start == end && start == pos) { minVal = maxVal = val; sumVal = val; } else { long mid = (start + end) / 2; if (pos <= mid) left.set(pos, val); else right.set(pos, val); minVal = Math.min(left.minVal, right.minVal); maxVal = Math.max(...
6f79750c-db81-4249-82d2-e92ecc7340b2
4
private void Escalao_ComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Escalao_ComboBox3ActionPerformed // atualizar Torneio_ComboBox Torneio_ComboBox.removeAllItems(); Collection <Competicao> competicoes = a.getDAOCompeticao().values(); if (competicoes != null)...
a1f65c58-1171-4c7c-84cf-2da339b9ce9e
6
public static void main(String[] args) { System.out.println("Tervetuloa etsimään polkuja. Haluatko syöttää " + "karttatiedoston nimen (1) vai antaa kartan koon koordinaatteina (jokin muu numero)? "); BufferedReader br = new BufferedReader(new InputStreamReader(System.in...
08c52ca1-2d00-4f79-afa6-e1ca62c0c31b
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Utente other = (Utente) obj; if (nome == null) { if (other.nome != null) return false; } else if (!nome.equals(other.nome)) return fa...
9efab639-633f-471a-b1a5-cd73598e0caa
1
private void doPublicStuff(Patient patient) { LinkedBlockingDeque<Patient> q = doc_queues.get(HospitalPart.PUBLIC); q.add(patient); log("enter " + "Public" + " Q", clock, patient, "Public", doc_queues .get(HospitalPart.PUBLIC).size()); if (q.size() > max.getMaxQ()) { max.setMaxQ(q.size()); max.setHp(H...
f92958be-1b72-4afd-a6ad-6bd321ecc608
4
public void setChildren() { if (main == null) { return; } if (main.hasChildren()) { children = new LinkedList<RSInterface>(); layers = new LinkedList<RSInterface>(); for (int index = 0; index < main.children.size(); index++) { RSInterface child = RSInterface.getInterface(main.children.get(index));...
c1d50d28-be2f-44c6-9cc6-eabfa13be9d1
2
public void populateTable() { NPC_DATA.removeAllElements(); NPC[] allNPCs = NPCs.getLoaded(new Filter<NPC>() { final int Radius = 20; @Override public boolean accept(NPC npc) { return (double)Calculations.distanceTo(npc) <= Radius && !npc.getName()....
68b2493b-9e63-4819-a7a4-c94aac064ea8
8
public MOB victimHere(Room room, MOB mob) { if(room==null) return null; if(mob==null) return null; for(int i=0;i<room.numInhabitants();i++) { final MOB M=room.fetchInhabitant(i); if((M!=null) &&(M!=mob) &&(!CMLib.flags().isEvil(M)) &&(mob.mayIFight(M)) &&(M.phyStats().level()<(mob.phySt...
71ab40e6-0af5-4cc2-a7a8-df97c53bb856
3
private void begin () { long t__send, dt; double rate; _t_send = System.currentTimeMillis(); while (++times <= Utils.MAX) { broadcast("TEST", String.format("%d", System.currentTimeMillis())); if (times % Utils.STEP == 0) { t__send = System.currentTimeMillis(); dt = t__send - _t_send; if (dt > ...
6270f43f-210e-4263-8f50-8dc5fd42f129
6
public boolean locationWithinActor(double x, double y) { if(enabled) { // disabled actors cannot be targeted (TODO: is this good???) PhysicsComponent pc = (PhysicsComponent)getComponent("PhysicsComponent"); //HitboxComponent hc = (HitboxComponent)getComponent("HitboxComponent"); ...
e193cd63-00df-4854-b6fc-e1d1e9bac6ec
2
public void breakmethod () { while (true) { System.out.println("Input an integer"); n = input.nextInt(); if (n == 0) { break; } System.out.println("You entered " + n); } }
de100937-bc9a-4831-9928-3287a65bc7fe
2
protected void process_term (int linger_) { assert (!pending); // If the termination of the pipe happens before the term command is // delivered there's nothing much to do. We can proceed with the // stadard termination immediately. if (pipe == null) { proceed...
84ac9ff5-e022-437d-b837-130e1880289f
6
public static int[] findLIS(int[] A) { int n = A.length; int[] M = new int[n]; int[] P = new int[n]; M[0] = 0; P[0] = -1; int L = 1; for (int i = 1; i < n; ++i) { int j = search(M, A, i, L); if (j == -1) P[i] = -1; else P[i] = M[j]; if (j == L - 1 || A[i] < A[M[j + 1]]) { M[j + 1...
70b5fb99-0ddf-480a-b1be-b973619a5095
1
@Override public File touch(String fileName) { //System.out.println("touch"); try { File f = new File(directory, fileName); f.createNewFile(); FileOutputStream os = new FileOutputStream(f); //os.write("Generated by Bulka".getBytes()); o...
30f9176a-591f-4699-ba90-37e50c655e31
1
@Override public String toString() { if (filterConfig == null) { return ("filtroAutenticacion()"); } StringBuffer sb = new StringBuffer("filtroAutenticacion("); sb.append(filterConfig); sb.append(")"); return (sb.toString()); }
7dd79be0-ef53-448d-a251-a7f849f0ad24
2
@Override public Record removeRecord(Account from, Record record) { PreparedStatement pStmt = null; Record rec = null; Integer result; rec = getRecord(record.getId()); if(rec != null){ try { pStmt = conn.prepareStatement("DELETE FROM RECORD WHERE id = ? AND id_account = ?;"); pSt...
ed47793e-3b4d-4f2a-9a26-e3f2841fe5a2
8
public boolean szabalyose(){ if(aktualispoz1+2==hovaakar1 || aktualispoz1-2==hovaakar1) if(aktualispoz2+1==hovaakar2 || aktualispoz2-1==hovaakar2) return true; else {logger.info("A lépés nem huszár lépés!");return false;} else if(aktualispoz2+2==hovaakar2 || aktualispoz2-2==hovaakar2) if(aktualispo...
244b5711-15be-4aa3-9955-4d1e6caa45d1
4
final public CycVariable variable(boolean requireEOF) throws ParseException { CycVariable val = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SIMPLE_VARIABLE: val = simpleVariable(false); break; case META_VARIABLE: val = metaVariable(false); break; default: jj_la1[30...
a138111b-586d-4a9d-b7f8-518db102684c
3
@SuppressWarnings(value = "unchecked") public void put(int field$, java.lang.Object value$) { switch (field$) { case 0: intField = (java.lang.Integer) value$; break; case 1: floatField = (java.lang.Float) value$; break; case 2: stringField = (java.lang.CharSequence) value$; break; default: ...
1d1a7586-d2de-4c40-8385-653aea0f9704
1
private JPanel createTimePanel() { JPanel newPanel = new JPanel(); newPanel.setLayout(new FlowLayout()); SpinnerDateModel dateModel = new SpinnerDateModel(); timeSpinner = new JSpinner(dateModel); if( timeFormat == null ) timeFormat = DateFormat.getTimeInstance( DateFormat.SHOR...
d5af0538-3507-464d-bfe8-8f5ec2b6277c
9
public Object[] update(final int i, final int j) { int gridValue = seaGrid[i + 1][j + 1]; Logger.debug("gridValue:" + gridValue); // You hit that before if (gridValue < 0 || gridValue == AbstractFleedModel.MISS) { return new Object[]{AGAIN, null}; } if (gridValue > 0 &...
5a3026d0-2eee-41f9-ad41-a3a0ad99503a
5
protected void processSpecialTag(boolean allowCDATA) throws Exception { String str = XMLUtil.read(this.reader, '&'); char ch = str.charAt(0); if (ch == '&') { XMLUtil.errorUnexpectedEntity(reader.getSystemID(), reader.getLineNr(), ...
399c2e10-0930-42eb-a325-31b980201c94
4
protected void updateAsMobile() { final Target target = this.targetFor(null) ; float idealHeight = DEFAULT_FLY_HEIGHT ; if (! health.conscious()) idealHeight = 0 ; else if (target == null) idealHeight = flyHeight ; else if (target instanceof Tile) idealHeight = DEFAULT_FLY_HEIGHT ; else if ...
5e4dce93-8f10-4e5c-8673-32ccf45722c1
8
public void doWork() throws IOException, NoSuchAlgorithmException{ Iterator<MetaConnection> itor = connections.iterator(); while(itor.hasNext()){ //Stand connection loop... MetaConnection mc = itor.next(); if(mc.getConnectionState() == ConnectionState.closed){ itor.remove(); System.out.println("END...
3adea405-09c4-402d-9ed5-94b8ee794b4d
7
private void removeDefeaterImpl() throws TheoryNormalizerException { List<Rule> rulesToAdd = new ArrayList<Rule>(); Set<String> rulesToDelete = new TreeSet<String>(); Map<String, List<Rule>> oldNewRuleMapping = new Hashtable<String, List<Rule>>(); List<Rule> newRules; List<Rule> newRuleMapping = null; t...
3dc0be35-3820-4aa1-934e-9be9d7c940c3
7
public ListNode reverseKGroup(ListNode head, int k) { if (head == null || head.next == null) { return head; } ListNode pre = new ListNode(0); pre.next = head; head = pre; ListNode cur = pre.next; while (cur != null) { int counter = k; while (cur != null && counter > 1) { cur = cur.next; ...
203db8dd-ffa9-4dcf-86cd-e9517f844b74
2
public static String insertInSpecialPosition(String s, String s1, int position) { if(s.isEmpty()) { return s1; } else { StringBuilder sb = new StringBuilder(); sb.append(s.substring(0,position)); sb.append(s1); if(s.length()>position) { ...
2f2867f6-4d7e-48ff-8a2e-fef1af1e93da
9
private void serialiseResponse() { byte[] responseHeader = new byte[2]; byte[] responsePayload; // set the bits for the first byte responseHeader[0] = 0; responseHeader[1] = 0; if (FIN) responseHeader[0] = (byte) (responseHeader[0] | (byte) (1 << ...
0a6cc383-4b61-4750-a063-06b3e89a7fb3
0
public void setSource(boolean isSource) { this.isSource = isSource; }
1d81b14f-94f6-45f2-91aa-f6f52858dc9b
3
public int genShader(int shaderType,String source) { int shader = 0; try { shader = GL20.glCreateShader(shaderType); if(shader == 0) return 0; GL20.glShaderSource(shader, source); GL20.glCompileShader(shader); if (GL20.glGetShader...
29665046-d730-42be-9b3f-7338e58eafcb
4
void makeIgnoreList(File dir) throws IOException { excludeFiles.clear(); final File ignoreFilesFile = new File(dir, EXCLUDE_FILES_FILENAME); if (!ignoreFilesFile.exists()) { return; } try (BufferedReader is = new BufferedReader(new FileReader(ignoreFilesFile))) { String line; while ((line = is.readLi...
78b16e19-cd00-4bb8-8e6a-6e5650c3125e
9
Object[] choose(double P[], double D[][], double F[][], int Rank[], int n) { double sP[] = new double[P.length]; double sum = 0; int counter = 0; int Selected[] = new int[n]; double S1[][] = new double[n][D[0].length]; double F1[][] = new double[n][F[0].length]; i...
a8a7b4fd-3c51-41dd-89a1-52acac43b139
5
public static void main(String[] arg){ String s = arg[0].toUpperCase(); //public char charAt(int index), index of the character will be returned char grade = s.charAt(0); switch(grade){ case 'H': System.out.println("Your score is between 85-100."); break; case 'D': System.out.println("Your sco...
0be81fac-3f14-4ada-8504-ef959999965a
1
private void initializeSingleSource(Vertex start) { for (int i = 0; i < vertices.getSize(); i++) { vertices.get(i).setColor(VertexColor.WHITE); vertices.get(i).setDistance(Integer.MAX_VALUE); vertices.get(i).setPath(null); } int indexOfStart = vertices.indexOf...
9edd6d5c-affb-4bfa-8f94-777c430944f3
5
public static void main(String[] args) { String config = null; if (args.length != 0) { for (int i = 0; i < args.length; i++) { String arg = args[i]; if ("-c".equals(arg) && args.length > i) { config = args[i+1]; } } } SQLRunner.setOkToExit(true); SQLRunnerGUI prog = new SQLRunnerGUI(new...
4c12aac5-01a8-46af-8df2-9cb6611a7fcb
8
private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed //Botão salvar/adicionar Endereco e = new Endereco(); e.setEstado(txEstado.getText()); e.setCidade(txCidade.getText()); e.setBairro(txBairro.getText()); e...
3a77040b-c909-4a09-ab47-0c4344ec3a14
4
final private static String trimZeroes(String output) { String copyOfOutput = output; if (copyOfOutput.contains(".")) { while (copyOfOutput.substring(copyOfOutput.length() - 1, copyOfOutput.length()).equals("0")) { if (copyOfOutput.length() > 1) { copyOfOutput = copyOfOutput.substring(0, copyO...
d9ca9bcb-f6b1-43f0-9cca-3de6a52e5a9e
3
public static void checkIntParam(SessionRequestContent request, Criteria criteria, String reqName, String critName){ String param = (String) request.getParameter(reqName); if (param != null && !param.isEmpty()) { Integer currParam = Integer.decode(param); if (currParam > 0) { ...
e625eae9-edc4-4f6c-9c6f-245ad743085a
4
public void majInformations() { if(_informations == null || _informations.isEmpty()) { _informations = new ArrayList<>(); _informations.add("Aucune information"); } JLabel label; JPanel panelGrid = new JPanel(new GridLayout(_informations.size(), ...
382af04c-2bdb-4368-b47c-5be8edfa53d9
3
@Override public void handleHttpRequest(final HttpRequest request, final HttpResponse response, final HttpControl control) throws Exception { String authHeader = request.header("Authorization"); if (authHeader == null) { needAuthentication(response); } else { if (auth...
e5aa4029-03da-4b56-804a-0b6512da0a8c
7
public List<User> divideFirstUser(List<User> userList, int index) { List finalList = new ArrayList(); for (int i = 0; i < userList.size(); i++) { User user = (User) userList.get(i); List firstUserList = null; if (i == index) { firstUserList = new Array...
533dbcdc-6a31-4350-9d75-0bf8dd4c3106
4
@Override public void run() { BmTestManager bmTestManager = BmTestManager.getInstance(); FileServer fileServer = FileServer.getFileServer(); String projectPath = null; if (fileServer.getScriptName() != null) { projectPath = fileServer.getBaseDir() + "/" + fileServer.getSc...
99713101-f80c-4414-a675-f8fc07a628a3
8
private void initialize(JComponent component) { component.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { notifyInputAction("Keyboard_Any_Down", new AlertObject(e.getWhen())); String keyName = KeyboardMappings...
7c845cca-4a28-4c13-9734-3f18af54fa4e
0
public VirtualDateNode(Property property, PropertyTree parent) { super(property, parent); }
6c02ac7e-c8a7-4e3a-bc93-303139f478eb
7
private void notifyOverseers(String key, OperatorCommand opcmd) { //get list of players PluginManager pm = plugin.getServer().getPluginManager(); Set<Permissible> notifiedPlayers = new HashSet<Permissible>(); Set<Permissible> approvers = pm.getPermissionSubscriptions("SudoOp.Approve"); Set<Permissible> denier...
0658ed61-5325-4e6b-a0d8-c856fe03b6a1
2
private void initBackgroundMenu(Color bg) { this.backgroundMenu = new JPanel(); this.backgroundMenu.setBackground(bg); this.backgroundMenu.setLayout(new VerticalLayout(5, VerticalLayout.LEFT)); // image Path initialValue = this.skin.getBackground(); ImageField imgField =...
f0a4c314-ac00-4e0c-a0d5-51f81526e326
2
@Override public boolean parseArg(String[] values) { int w = Integer.parseInt(values[0]); int h = Integer.parseInt(values[1]); if(w>0 && h>0) { Properties.Client.WINDOW_WIDTH = w; Properties.Client.WINDOW_HEIGHT = h; return true; } return false; }
661d32fa-7277-421c-bdc0-c245c671f98f
5
private String getName(final ZipEntry ze) { String name = ze.getName(); if (isClassEntry(ze)) { if (inRepresentation != BYTECODE && outRepresentation == BYTECODE) { name = name.substring(0, name.length() - 4); // .class.xml to // .class } else if (...
7dd549a5-dc46-4f64-b3ac-099607073cd9
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS-ARE> ...
2422b25d-916c-48f3-8064-397569456f87
8
void setBlock(int x, int y, int z, byte[][] chunk, Material material) { if (chunk[y >> 4] == null) chunk[y >> 4] = new byte[16 * 16 * 16]; if (!(y <= 256 && y >= 0 && x <= 16 && x >= 0 && z <= 16 && z >= 0)) return; try { chunk[y >> 4][((y & 0xF) << 8) | (z <<...
96533e2f-6f14-438f-9266-053b6990c7e0
1
public static void MakeFramesVisible(Boolean state) { for(int i =0;i<callFrameList.size();i++) callFrameList.get(i).setVisible(state); }
13cd6010-5867-4a06-8000-7b3e362f609b
9
private void sampleTopics(InstanceList docs, boolean init) { // resample topics int ndMax = -1; int[] wordCounts = (init) ? new int[W] : null; for (int d=0; d<D; d++) { FeatureSequence fs = (FeatureSequence) docs.get(d).getData(); int nd = fs.getLength(); if (init) { z[...
af4d16c6-cac2-4888-8a79-deb63eaa84fb
4
private static boolean isWindowInScreenBounds(Point location, Point size) { Point myLocation = new Point(location); if (!isLocationInScreenBounds(myLocation)) { return false; } myLocation.translate(size.x - 1, 0); if (!isLocationInScreenBounds(myLocation)) { return false; } myLocation.translate(...
8a08b169-feee-44f5-a983-949d2e5be79d
7
public void mainFlow() throws IOException { StringBuilder headersb = new StringBuilder(); headerWrite(Mode.Co, nameArray, headersb); resp.getWriter().println( "<!-- mainflow_start: " + (System.currentTimeMillis() - time) + "-->"); // 出力キャッシュが揃っていなければメインの処理をする if (flush == null || sideCount == null ...
12762b0a-120a-4b6d-a310-42da478088a5
7
private static boolean test6_1() throws FileNotFoundException { String input = "new\n" + "pick up key\n" + "lock cell door\n" + "lock cell door with key\n" + "open door\n" + "open cell door\n" + "go through door\n" + "unlock cell door\n" + "wait\n" + "unlock cell door with key\n" + "open door\n" ...
777e214a-b685-4b1c-b2f5-b5db857ae888
6
final int[][] method3047(int i, int i_0_) { anInt9141++; int[][] is = ((Class348_Sub40) this).aClass322_7033.method2557(-119, i); if (((Class322) ((Class348_Sub40) this).aClass322_7033).aBoolean4035) { int[][] is_1_ = this.method3039((byte) 120, (aBoolean9147 ? -i + Class299_Sub2.anInt6325 :...
86ee4ef3-0350-4ccc-8dcb-c122d7294469
7
public List<String> fullJustify(String[] words, int L) { List<String> list = new ArrayList<String>(); int sta=0; int length =0; for(int i=0 ; i < words.length && words[i] != "";i++){ length += words[i].length() + 1; // System.out.println(length); if(...
0ccaa661-9789-4ef8-9575-1fe43bb2adc0
2
private Color getValueAsColor(String value, Color defaultColor) { try { if(value.startsWith("#")) { return Color.decode(value.substring(1)); } else { Field f = Color.class.getField(value); return (Color) f.get(null); } } catch (Exception e) { e.printStackTrace(); } return defaultColor; ...
e75b7f19-d5ad-4496-838b-fa8c3b24462e
2
private Component[] getChildren(Container target, boolean useMinimumSize) { ArrayList<Component> children = new ArrayList<>(); for (Component child : target.getComponents()) { PrecisionLayoutData data = mConstraints.get(child); if (!data.shouldExclude()) { children.add(child); data.computeSize(child, ...
cc5d874a-27fd-496b-a071-d4caa11fba67
6
public JSONObject updateRANKTag(int USER_ID,int QUESTION_ID,int ANSWER_ID, int RANK, int increased) { try { Class.forName(JDBC_DRIVER); conn=DriverManager.getConnection(DB_URL,USER,PASS); stmt=conn.createStatement(); json=new JSONObject(); String SQL="update ANSWERS set ...
8b2f3439-e477-4daa-9591-c85fbccf5bc6
5
private int getClickedRoom(int cursorX, int cursorY){ for(Room room : this.map.getRooms()){ if (cursorX > room.getPositionX() && cursorX < room.getPositionX() + room.getWidth() && cursorY > room.getPositionY() && cursorY < room.getPositionY() + room.getHeight()){ return map.getRooms().ind...
f584ec52-3d66-4235-b11b-ffdd44ac7a82
4
private void stop() { if (server == null) return; readyToGo = false; if (taskID != -1) server.getScheduler().cancelTask(taskID); server = null; // go ahead and unload any chunks we still have loaded while(!storedChunks.isEmpty()) { CoordXZ coord = storedChunks.remove(0); if (!originalChunks...
5686206d-3595-49ec-b8c7-2c661055aea6
8
public void setPosicionJugador2(int x,int y){ if(x>=0&&x<8&&y<8&&y>0){ switch (pd.mapa_jugador2[x][y]) { case "SM": case "PA": case "AZ": System.out.print("POSICION OCUPADA"); System.out.println("OTRA CORDENADA"); ...
5ba61de7-cdf4-49df-b81f-5ff1ca7cb732
9
private static void shade(short[] imageColorArray, int[] imageShadeArray) { int i = 512; int j = 512; int k = 0; for (int m = 0; m < j; m++) { for (int n = 0; n < i; k++) { if (imageShadeArray[k] != 0) { float f1; if (n...
7b2724d7-b677-4fa2-9eae-a11966a007b2
8
public void collisionWall() { if(snake.isSnakeUp()) { if(snake.getSnakeY()<20) { finishGame(); }else{ snake.setSnakeY(snake.getSnakeY() - 15); } }else if(snake.isSnakeDown()) { if(snake.getSnakeY()>335) { finishGame(); }else { snake.setSnakeY(snake.getSnakeY() + 15); } }else if(...
c49e6593-537c-426e-b057-4d5a90dead22
0
public int getTileSize() { return tileSize; }
1196e8e0-32e4-41e4-b6ec-82384a8e973d
7
public LinkedList<Kokus> initialisationPaquetKokus(){ LinkedList<Kokus> llk = new LinkedList<Kokus>(); for(Kokus k : this.hashKokus){ // 12 cartes kokus de 1 unité if(k.getNbkoku()==1){ for(int i=0; i<12; i++){ llk.add(k); ...
ca1c53b0-df47-42be-a11e-a89b0e8eb357
9
public static void main(String[] args) { Locale.setDefault(Locale.US); Scanner s = new Scanner(System.in); double salary = s.nextDouble(); double newSalary = 0; double earned = 0; int percentage = 0; if(salary >= 0 && salary <= 400){ percentage = ...
8682eab6-057e-4b58-b23a-b8aafdeba830
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (hashCode() == o.hashCode()) return true; Comet comet = (Comet) o; if (tailColor != comet.tailColor) return false; if (mineralResourc...
14487763-c7fa-49fe-8b81-33447924bcec
3
private void myListMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_myListMousePressed // TODO add your handling code here: if( evt.getButton() == MouseEvent.BUTTON2 ) { myList.clearSelection(); Rectangle r = myList.getCellBounds( 0, usernames.size()-1 ); ...
31728d96-e74f-4071-89f7-dbcc155dd54c
6
public void addFrame(Frame frame) { if (frame == null) { System.err.println("oh no! frame is null"); } String[] idRefParts; for (FrameElement fe : frame.getFrameElements()) { for (String feID : fe.getIdrefs()) { idRefParts = feID.split(":"); if (!containsNode(idRefParts[0])) return; } } ...
07728d76-bf18-475a-a98b-e93efda34567
3
public static BufferedImage makeColorTransparent(BufferedImage ref, Color color) { BufferedImage dimg = new BufferedImage(ref.getWidth(), ref.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g = dimg.createGraphics(); g.setComposite(AlphaComposite.Src); g.drawImage(ref, null, 0, 0); g.dispose(); ...
633d5c9d-bb66-4cfa-9fbc-cab54ebe7044
2
public AnnotationVisitor visitParameterAnnotation( final int parameter, final String desc, final boolean visible) { buf.setLength(0); buf.append(tab2).append('@'); appendDescriptor(FIELD_DESCRIPTOR, desc); buf.append('('); text.add(buf.toString()); ...
18326a86-2e92-4808-b7aa-66047bf37ec0
3
@Override public void updateView() { Model model = controller.getModel(); Object col[] = new Object[3]; movieHash.clear(); int c = tModel.getRowCount(); for (int i = c - 1; i >= 0; i--) { tModel.removeRow(i); movieTable.revalidate(); } if (model.getMovies().getMovieList().isEmpty()) { Sys...
8d5f5633-057b-469a-8cb0-fc5c60cf35bc
6
@SuppressWarnings({"unchecked","rawtypes"}) public Object copyTransferrableProperties(AdministeredComponent target, AdministeredComponent source) { try { Iterator<String> propertyIterator = PropertyUtils.describe( target ).keySet().iterator(); Map sourceValuesMap = PropertyUtils.describe( source ...
e9394bcc-cbe0-42e5-a40a-dcd7b6691977
6
private boolean processInternCommand(MapleClient c, MessageCallback mc, String[] splitted) { DefinitionInternCommandPair definitionCommandPair = interncommands.get(splitted[0]); if (definitionCommandPair != null) { try { definitionCommandPair.getCommand().execute(c, mc, split...
5567f8ba-e058-44ef-8cf4-0794ef3839c0
7
private void tablaUsuariosDelSistemaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaUsuariosDelSistemaMouseClicked // TODO add your handling code here: String opcionHabilitar = "Habilitar"; String nombreUsuario = String.valueOf(tablaUsuariosDelSistema.getValueAt(tablaUsuarios...
2922f75f-2da8-483c-98cf-245d1c149337
0
public void setjButtonPrevious(JButton jButtonPrevious) { this.jButtonPrevious = jButtonPrevious; }
60be1d2b-27ee-491d-bb58-bfe7d351e6ca
7
@Override public void atualizarAVItem(AvaliacaoItem avItem, int idUser, String refeicao, String data, String item) { if(avItem.getData() != null){ if( avItens.get(avItem.getDataFormatoAmericano()+avItem.getRefeicao()+avItem.getItem()) != null){ List<AvaliacaoItem> avaliacoes = avItens.get(avIte...
ed286ca2-e535-4497-95a6-d20f1a73afc6
0
public String getStringToPop() { return myStringToPop; }
4546f813-77db-4ed2-b785-87dfa3e13d6e
0
public void setComments(String comments) { this.comments = comments; }
b98dd4a2-ebe7-4895-be4b-eca20f17902a
0
public static void main(String[] args) { // Working with Strings System.out.println("String letter 10 11 12 $%<!"); // Working with Intergers System.out.println(50); System.out.println(30000); System.out.println(5 + 5 - 2 * 4 / 2); // Working with Doubles System.out.println(1.2); System.out.println(...
d724a130-dcbb-4f5b-9470-30bcfb3200ac
1
public void checkExit(final int status) { if (!allowExit) { System.err.println("exit " + status); throw new SecurityException("Tried to exit (status=" + status + ")"); } }
cae8e132-0f17-48b4-9d52-193291c8c251
8
public static void test() throws Exception { // ######################################################################################### System.out.println("Testing packet serialization:"); /** * Foreach packet class, create an instance, serialize it and * unserialize it. Packet class and a random sequenc...