method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a219e615-f0b4-4ad5-bc0c-ce01913f0806
0
public boolean isEnabled(Component component) { return tabbed.isEnabledAt(tabbed.indexOfComponent(component)); }
bfb48202-64a4-449f-a8b3-1b6a0b250451
1
public void clearEditingShips() { if(myTurnEditing) mySea.clearShips(); else theirSea.clearShips(); }
d90adc0f-179b-4176-ae6e-4da368632871
9
public static void main(String []args) { long maxClients = help.Default.SERVER_INFO.getMaxClients(); int serverPort = help.Default.SERVER_INFO.getPort(); for (int i = 0; i < args.length; i += 2) { if (args[i].equals("-c") || args[i].equals("--max-client")) maxClients = Long.parseLong(args[i + 1]); el...
98a6507c-835e-465e-9624-9aad84abcf41
5
private BufferedReader makeRequest() { URL request; try { // Check that the URL is ok and form the request URL. System.out.println(mUrl + "/wfs"); request = new URL(mUrl + "/wfs"); } catch (MalformedURLException e) { mUi.displayAlert(GSInsert.URL_WARNING_TITLE, GSInsert.URL_WARNING_MESSAGE, JOptionPane....
5f835151-7d34-4ec7-b211-4538e3451f80
9
public int spielzug() { int zug = -1; do { System.out.print("Koordinaten Ihres Zugs (Spalte Zeile, m zum Abbrechen) >"); String s = ""; try { s = in.readLine(); } catch (IOException e) { System.out.println("Lesefehler: " + e); continue; } if (s.length() < 0) { continue; } if ...
ef91013b-73d4-424d-aa82-775db7585e2c
7
public Container read(ObjectInputStream inputStream){ Container inputMessage = null; try { try { if(!theEnd) { inputMessage = (Container) inputStream.readObject(); return inputMessage; } } catch (IOException ex) { System.out.println("theEnd = " + theEnd); try { for (Connection ...
8ce12454-4cea-4194-b544-cbf75fe84912
6
public void addData(String values) { data.add(values); /* * Parse string data to ArrayList<String> */ int id = values.trim().indexOf(" "); id = values.indexOf(values.trim().substring(id - 1, id + 1)) + 1; while (values.length() <= dataLength + id + numColumns) values += " "; ArrayList<Stri...
968cc03e-21b6-4785-9a69-f39d77ba0500
2
private static void update(BufferedReader br, ServiceInterface obj, Scanner cs) throws IOException { // TODO Auto-generated method stub String str[] = new String[2]; for (int i = 0; i < 2; i++) { str[i] = br.readLine(); } String str2=obj.update(str[0], str[1]); if(!str.equals(null)){ System.out.pr...
024fadee-a579-436d-bf5e-8eac409f7f0e
4
public boolean peutModifier(Utilisateur utilisateur) { return utilisateur != null && ( utilisateur.equals(getCreateur()) || utilisateur.getRole().getValeur() >= Role.Moderateur.getValeur() ) && ( getCategorie...
6dfe4fa6-e25c-4f6e-a0fb-415284c7c217
3
static int reserve(int bookID) { if(bookID>bookList.size()-1||bookID<0) return 1; Book t=bookList.get(bookID); if(t.getAvailablity()) { t.reserve(); return 2; } else return 3; }
2a90c9e8-0ff2-4cec-bd6f-162e15a82624
2
static int cycleLength(int a){ LinkedList<Integer> list = new LinkedList<Integer>(); Integer [] arr=null; while(a>1){ if(a%2==0){ a=a/2; list.add(new Integer(a)); }else{ a=3*a+1; list.add(new Integer(a)); } } /*Collections.sort(list, new Comparator<Integer>() { ...
12063902-3db0-4c40-822d-7db99f41163d
9
private static Predictor train(List<Instance> instances, String algorithm) throws Exception { Predictor p; if (algorithm.equals("even_odd")) { p = new EvenOddClassifier(); } else if (algorithm.equals("majority")) { p = new MajorityClassifier(); } else if (algorithm.equals("logistic_regression")) { ...
c2980e0f-b150-4e9c-8e53-e1c26241cc83
1
public void kickActiveUser (String user, KeepAlive keepAlive) { ClientHandler client = activeUsers.get(user); Socket socket = activeSockets.get(user); try { PrintWriter out = client.out; out.println(ANSI.BACKGROUND_RED + "You have been forcefully disconnected!"); ...
a2e99ca8-5768-4953-b1e8-75c7ad701d63
4
public double rawItemMaximum(int index){ if(!this.dataPreprocessed)this.preprocessData(); if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive"); if(!this.variancesCalculated)t...
46861d3c-7b6e-4cc1-9d5d-4f7d4187c3ba
6
@Override public String getColumnName (int column) { if (column == 0) return "Name"; if (column == 1) return "Vorname"; if (column == 3 + MainWindow.setupData.getEventLength () -1 +1) return "Teilnehmer"; if (column == 3 + MainWindow.setupData.getEventLength () -1 +2) return "Aktiv"; if (column =...
93cb3747-a039-44af-aa4b-c335a3dc97f8
1
private void newUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newUserButtonActionPerformed // TODO add your handling code here: try{ String result = (newNameField.getText() + ";" + newAddressField.getText() + ";" + newNumberField.getText() + ";" + n...
d44d606d-18fe-4239-93d7-97b144f33780
2
public HeightRecord(final Label label, final int height) { if (ClassEditor.DEBUG || CodeArray.DEBUG) { System.out.println(" push " + label + " at " + height); } this.label = label; this.height = height; }
74e94ece-3ab5-4fc2-9bb9-9d654c62037a
3
private <T> void shiftArrayBy(T[] array, int number) { T[] temparr = (T[]) new Object[array.length + number]; int srcPos = (number > 0) ? 0 : number; int destPos = (number > 0) ? number : 0; int length = (number > 0) ? array.length : array.length - number; System.arraycopy(arra...
ade2e096-4659-4e45-9bc0-aaf48e1cc633
5
public static boolean royalFlush(Hand hand) { if(flush(hand) && ( (hand.getCard(1).getValue() == hand.getCard(1).getValue()+1) && (hand.getCard(1).getValue() == hand.getCard(1).getValue()+2) && (hand.getCard(1).getValue() == hand.getCard(1).getValue()+3) && (hand.getCard(0).getValueAsString() == ...
9add5825-101a-4ecb-9a25-d5285f5bd52c
3
public void calculateShadows(LightSource light){ glColorMask(false, false, false, false); glStencilFunc(GL_ALWAYS, 1, 1); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); for (Vector2 block : getOpaqueTiles()) { Vector2[] vertices = { new Vector2(block.x, block.y), new Vector2(block.x, block.y + tile...
8696748f-0989-44bb-a8bc-b694ba955ed0
8
public Integer getEventId(int parentEventId, String eventName) { // clear map if eventMapExpireTime past if (eventMapExpireTime.before(Calendar.getInstance().getTime())) { Calendar eventMapExpireTimeCal = Calendar.getInstance(); if (eventMapExpireTimeCal.getTime().toString().con...
5d69991a-bf27-42b4-8936-3a0ee9f6c51b
8
protected Type getTypeWithProcType(Environment<Type> env, ProcedureType type) throws TypeIllegalException, TypeEnvironmentException { ASTArguments args = (ASTArguments) getChild(0); LinkedList<Type> types = args.getTypeList(env); Collection<Type> requiredTypes = type.getArgumentTypes(); if (types.isEmpty() ...
15595d0e-6e2a-49e3-a48b-36801dae1506
0
public void testAddDay() { Date date = DateUtils.addDay(testDate, 1); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); assertEquals(24, calendar.get(Calendar.DAY_OF_MONTH)); date = DateUtils.addDay(testDate, 360); calendar.setTime(date); assertEquals(2013, calendar.get(Calendar.YEAR));...
cc63493e-989d-4738-8cf6-ed8ad8f7aa7a
7
@Override public void evaluateLabels(Map<String, Integer> labelValues, int position) throws TokenCompileError { data.evaluateLabels(labelValues, position); int dest = data.getUnresolvedWord(); int delta = dest - position; // Q: If the instruction's size might be 2 words, the...
5d8fc4e9-04f7-4085-8cf7-00a73a8e2046
1
public void stageOne() { synchronized (lock1) { try { Thread.sleep(1); } catch (InterruptedException e) { //do your work here e.printStackTrace(); } list1.add(random.nextInt(100)); } }
cd7f5f40-45fe-4dae-8ef2-16908851bc16
1
static public byte[] imageToPNG(Image image) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { BufferedImage buffer = new BufferedImage( image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB); buffer.cre...
220ff81c-f365-4366-be7a-6e391365b7ea
3
public void set(int pos, int val){ if(start == end && start == pos){ minVal = maxVal = val; }else{ int 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(left.maxVal, right.maxVal); } ...
f5bcbd05-e566-4eec-b725-b26b50715a59
4
public void fusionWithNormal(CPLayer fusion, CPRect rc) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(rc); for (int j = rect.top; j < rect.bottom; j++) { int off = rect.left + j * width; for (int i = rect.left; i < rect.right; i++, off++) { int color1 = data[off]; int alpha = (color1 >...
146c6c23-5795-4b2f-95b7-6e6e7f63d563
8
public void actionPerformed(ActionEvent event){ if(event.getSource()==novoJogo){ if(General.isIngame()){ int a=JOptionPane.showConfirmDialog(null, "Se iniciar um novo jogo, todo o progresso não salvo será perdido!\nTem certeza que deseja iniciar um novo jogo?", "Novo Jogo...
beb7a873-5a5c-4a9a-8198-77ae2b64485c
1
private boolean jj_2_46(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_46(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(45, xla); } }
0b5e5fb0-1948-458e-8e4d-5a16d971aae3
7
private void initFlowPhases() { int tmpphase = 0; for(Street incoming:this.incomingStreets.values()) { for(Street outgoing: this.routing.get(incoming).values()) { IntersectionStreet is = new IntersectionStreet(5,incoming.getNumOfLanes(),incoming.getId() + outgoing.getId()); ...
7967f88b-26b6-4217-87d8-ea5880555020
7
@Override public double prejudiceFactor(MOB customer, String factors, boolean pawnTo) { factors=factors.toUpperCase(); if(factors.length()==0) { factors=CMProps.getVar(CMProps.Str.PREJUDICE).trim(); if(factors.length()==0) return 1.0; } if(factors.indexOf('=')<0) { if(CMath.s_double(factors)!...
47bb3bca-2698-4f67-990d-175cadc03e34
2
public void setCommandButtonMargin(int[] margin) { if ((margin == null) || (margin.length != 4)) { this.buttonCom_Margin = UIMarginInits.COM_BTN.getMargin(); } else { this.buttonCom_Margin = margin; } somethingChanged(); }
6e7bfb93-2c3f-446a-81f5-fb7e6c8a1ae1
1
public static String check(String value, String name) { if(value == null) { throw new NullPointerException(name + " cannot be null"); } return value; }
a991cfe3-03d3-4acf-a274-c9951645154d
0
public ChildClass(T2 a){ this.foo2 = a; }
93031ea2-eeaa-42c4-b584-098e856dafe9
3
public boolean countHighBFactor(ArrayList<Residue> residueList) { int countBFactorGreaterThanOne = 0; for (int i = 0; i < residueList.size(); i++) { Residue currentResidue = residueList.get(i); if (currentResidue.getBFactor() > 1.0) { countBFactorGreaterThanOne++; } } int halfOfResidueListSize = (r...
e91b5e35-7e27-4ec0-b992-f7ce0e498337
6
public static void loadSlot(String hostname, String[] words, int level, String channel, String sender) { if (words.length == 2) { if (Functions.isNumeric(words[1])) { int slot = Integer.parseInt(words[1]); if (slot > 10 || slot < 1) { bot.sendMessage(bot.cfg_data.irc_channel, "Slot must be between 1 a...
b169d6f2-8f51-4c3f-83c8-6b50084afd46
4
private static boolean matches(SpielAlt spielAlt) { return playerMatches(spielAlt.getSpieler1()) && playerMatches(spielAlt.getSpieler2()) && playerMatches(spielAlt.getSpieler3()) && playerMatches(spielAlt.getSpieler4()) && dateMatches(spielAlt); }
8cc2242d-4d53-47ab-829c-81c162a3bb20
2
@Override public String toString() { String strConfidence = this.actualConfidenceLevel+""; int zeroes = 0; if(strConfidence.length()!=5){ zeroes = 5 - strConfidence.length(); for(int i = 0; i < zeroes; i++){ strConfidence = strConfidence + "0"; } } return "IF " + this.antecedent.toStringW...
73aa993b-684d-4e23-81e8-0a217bd596cf
9
static private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpo...
8adc8a1d-9cab-478f-a1d6-09e3a01a293b
3
public static void main(String[] args) throws Exception{ String filepath = "query_test.txt"; String dictFile = "words.txt"; BufferedReader reader = new BufferedReader((new FileReader(filepath))); String line; ArrayList<String> topQueue1; ArrayList<String> topQueue2; ...
12963565-2381-417b-8f1d-2bc0d1e9d346
8
public PlayerAction getNextAction(long cutOffTime) { int count = 0; while(moreActions) { boolean consistent = true; PlayerAction pa = new PlayerAction(base_ru); int i = choices.size(); if (i == 0) { return null; } //if ...
001cfbab-7140-42d7-9983-fd3c4a2561c1
2
public static boolean diagonal_check(String prev_pos,String new_pos) { if((prev_pos.substring(0,1).equals(new_pos.substring(0,1)))&&(prev_pos.substring(1).equals(new_pos.substring(1))==false))//up down { return false; } return true; }
8a8311e3-adfd-4f44-aa3d-3ff9c7c3f43a
8
public final int partitionByBarCode(int lb, int ub) { // for an outline of how this works, see the partition method for name Product pivotElement = allProducts[lb]; int max = logicalSize; int left = lb, right = ub; Product temp; while (left < right) { while((allProducts[left].getBarCode() <= pivotElem...
d7d6bd61-3b67-47b6-8481-399c5a31cab2
5
public String chooseFromAliases(final String[] aliases) throws InvocationTargetException, InterruptedException { Preferences prefs = Preferences.userNodeForPackage(getClass()); String choosenAlias = prefs.get("choosenAlias", ""); int dident = -1; int i = 1; for (final CertDescription cd : provider.makeCertLi...
50cf10f0-c948-499d-a65c-67e3b6559d0e
7
private void onPacket(Packet packet) { if (this.readyState == ReadyState.OPENING || this.readyState == ReadyState.OPEN) { logger.fine(String.format("socket received: type '%s', data '%s'", packet.type, packet.data)); this.emit(EVENT_PACKET, packet); this.emit(EVENT_HEARTBEAT...
2c3e2e89-647b-428b-890f-448357df0221
9
public static void move(State st, int x, int y){ ObjectInstance agent = st.getObjectsOfTrueClass(AGENTCLASS).get(0); List<ObjectInstance> blocks = st.getObjectsOfTrueClass(BLOCKCLASS); int curX = agent.getDiscValForAttribute(XATTNAME); int curY = agent.getDiscValForAttribute(YATTNAME); int nx = curX + x; i...
afdeface-4933-4778-9f2a-43163bd55526
1
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); ControllerFenetres.nouvellePartie(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex)...
05adf81e-1ac1-4910-84a3-d73c28e2733a
6
public SequenceListener getListener( Class<? extends SequenceListener> listenerClass, int preOrPost) { List<SequenceListener> toGet = null; if (preOrPost == POST) toGet = postTrimListeners; if (preOrPost == PRE) toGet = preTrimListeners; if (toGet == null) return null; for (SequenceListener l : to...
682f7572-2edc-4677-95fa-efb63b750eac
0
@Before public void setUp() { }
6341cb56-7daf-4ec2-a987-2694ebe9cb64
5
public String toString() { StringBuffer buff = new StringBuffer(); for (int i = 0; i < c && i < view.length; i ++) { buff.append(((view[i] != null) ? view[i].toString() : "null")); if (i < c - 1 && i < view.length - 1) { buff.append(","); } } return buff.toString(); }
19992b06-e9cd-4396-a0a9-9168f9d91ccb
1
@Override public int getErrorCount() { if (getErrors() != null) { return getErrors().size(); } return 0; }
779516c5-9d78-4d6e-9b44-751b50c70eef
9
public void merge(int A[], int m, int B[], int n) { int x = m+n -1; int i,j; for(i = m-1,j = n-1;j>=0 && i>=0;){ if(A[i] >= B[j]){ A[x--] = A[i--]; }else A[x--] = B[j--]; } if(i >= 0) while(x>= 0 && i >= 0 ){ A[x--] = A[i--]; } if(j >= 0) while(x>= 0 &&j >= 0 ){ A[x--] = B[...
29ca95fe-6eaf-4c76-a55a-c8a2691e524c
3
public void run() { System.out.println("Chef run"); try { while (!Thread.interrupted()) { restaurant.lock.lock(); try { if (restaurant.meal != null) restaurant.noMealCondition.await(); restaurant.meal = new Meal(0); System.out.println("Meal come"); restaurant.fullMealCondition.sign...
547146bc-cb88-482c-801d-a0a7594901b5
7
private static List<Boolean> getIncludeList( File inFile ) throws Exception { List<Float> list = new ArrayList<Float>(); BufferedReader reader =new BufferedReader(new FileReader(inFile)); String[] splits = reader.readLine().split("\t"); for( int x=0;x < splits.length; x++) list.add(0.0f); fo...
382f04ff-6f3e-493a-878d-eaa555355f11
1
private Animation createEnemyAnim(String str) { Animation anim = new Animation(); for(int i=1;i<=26;i++){ anim.addFrame(loadImage(str+i+".png"), 80); } return anim; }
62f5dd02-949f-4e2d-8209-351ee14ca03e
4
public static void cleanup(ResultSet rs, Statement st, Connection conn) { try { if (rs != null) rs.close(); if (st != null) st.close(); if (conn != null) conn.close(); } catch (SQLException e) { throw new DataBaseException("Cleanup caught exception: " + e); } }
bd423f9b-8111-46a1-ba7e-30d230c994e4
1
private KeyListener keyListener(){ return new KeyAdapter() { @Override public void keyPressed( KeyEvent e ) { if( e.getKeyCode() == KeyEvent.VK_ESCAPE ){ cancelConnecting(); } } }; }
9630fe9f-8a1a-4906-9b15-9926bf90a506
2
public static AreaOfInterestEnum fromValue(String v) { for (AreaOfInterestEnum c: AreaOfInterestEnum.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
86bb439c-b745-44d8-bed5-cd84f475ed13
6
private static void testRules(CA game, int neighborCount) { System.out.println("Asetetaan soluautomaatin kooksi 6x3."); boolean[][] initialCells = Grid.getDeadGrid(6, 3); initialCells[4][1] = true; for(int n = 0; n < neighborCount; n++) { int i = n + (n >= 4 ? 1 : 0)...
0ff4cd70-4597-4ae4-9ca3-d999de9fe85a
4
public int getAnswer() { int a = 0; int b = 0; int c = 0; for (int z = 997; z >= 335; z--) { for (int y = (1000 - z - 1); y + z <= 999 && ((1000 - (y + z)) < y); y--) { c = z; b = y; a = 1000 - (b + c); if (Math.pow(a, 2) + Math.pow(b, 2) == Math.pow(c, 2)) { return (a * b * c); ...
53f595ab-634d-4b84-b377-8bcc225c9032
7
public void insert(String from, String to, double from_balance, double to_balance, double set, double gain, double loss) { if (!Constants.Logging) { return; } int i = 1; long timestamp = System.currentTimeMillis() / 1000L; Object[] data = { from, to, Double.valueOf(from_balance), Double.val...
9bfbb7a7-45a3-4832-b089-f013d6f67867
5
private Boolean updateIntern(String query, Boolean drop){ if(!drop){ switch(this.type){ case PUT: String pattern = "GRAPH <[^>]*>"; Matcher m = Pattern.compile(pattern).matcher(query); while(m.find()){ dropGraph(m.group().replace("GRAPH <", "").replace(">", "")); } break; case POST: break;...
329b21d3-bff0-40f1-af7b-b2fe35cb2c56
2
private static Object[] asArray(final List l) { Object[] objs = new Object[l.size()]; for (int i = 0; i < objs.length; ++i) { Object o = l.get(i); if (o instanceof LabelNode) { o = ((LabelNode) o).getLabel(); } objs[i] = o; } return objs; }
a7069bca-a19a-40f3-977e-4ec15053f5b7
5
private void useTestData(int timeBetweenTraces){ /* * First part are performance tests for runtime-efficiency */ // different setups for time evaluation // this was for explicit packetnumber, hops and time // int[] traceNumbers = new int[]{100,1000,5000,10000,20000}; // int[] hops = new int[]{2,10,20}...
555b8a07-a4cf-4f17-b02b-64ba2ae59fd7
9
private Verify initVerifyParams() { if(CUSTOMER_ID.isEmpty() || SECRET_KEY.isEmpty() || PHONE_NUMBER.isEmpty()) { fail("CUSTOMER_ID, SECRET_KEY and PHONE_NUMBER must be set to pass this test"); } Verify ver; if(!timeouts && !isHttpsProtocolSet) ver = new Verify(CUSTOMER_ID, SECRET_KEY); else if(ti...
e9ff7c64-4cdb-4fae-af44-fed5e0cbac8c
0
public PhpposAppConfigEntity getAppConfig(String key){ return (PhpposAppConfigEntity) getHibernateTemplate().get(PhpposAppConfigEntity.class, key); }
dd253671-f183-41f6-a883-f06c46e7a078
8
public List<List<Integer>> zigzagLevelOrder(TreeNode root) { int level = 0; Deque<TreeNode> deque = new LinkedList<TreeNode>(); List<List<Integer>> result = new LinkedList<List<Integer>>(); if (root == null) { return result; } deque.add(root); while (!deque.isEmpty()) { Deque<TreeNode> nextLevel = n...
6d60a2f6-ed09-4f40-b3b9-21a92214c7b8
6
@Override public boolean equals(Object o) { if(o == null) return false; if(this == o) return true; if(!(o instanceof StuecklistenPosition)) return false; StuecklistenPosition p = (StuecklistenPosition)o; if(!p.getBauteil().equals(this....
a4072732-fff9-426a-a134-65e7ad483b37
3
public int inserir(Fornecedor f){ Connection conn = null; PreparedStatement pstm = null; int retorno = -1; try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS); pstm.setString(1, f.getNome...
69071dbf-c208-415e-801c-30c96bdad759
6
public static void showOrders(){ for (int i=0; i < ordersList.size(); i++){ //System.out.println((i+1) + ". "); System.out.println((i+1) + ". \n" + ordersList.get(i)); } if (ordersList.size() != 0){ System.out.println("Which order would you like to view? ( Enter 0 for exit. )"); System.out.print(">");...
956f8924-fab0-4783-bdda-8f133aa676cf
3
public TfIdfCalculator(Map<Indexed<Product>, Integer> bags) { docs = Maps.newHashMap(bags); for (Indexed<Product> bag : docs.keySet()) { for (Tag word : bag.getWords()) { int count = !docCount.containsKey(word) ? 0 : docCount.get(word); docCount.put(word, coun...
ca391737-9831-4bf4-806c-be0664a0f1a9
8
private void BtondesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtondesActionPerformed vtexto = Ctexto.getText(); DefaultTableModel tr = (DefaultTableModel)tabla.getModel(); try { Statement s = cone.getMiConexion().createStatement(); Strin...
0445ca0e-d5d3-4580-accc-418cfada8639
4
public void run(){ while(loop()); new read("deletePlayer;"+gameTag+";",ID).start(); }
5f54041c-7158-4415-99b2-7233083715ee
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { if (player == null) { sender.sendMessage(ChatColor.RED+"This command can o...
1d787526-7fd5-4c53-9a5a-beaff80ccff7
1
private void initializePool(SockIOPool pool) { Assert.notNull(servers, "Servers必须设置"); pool.setServers(servers); if (weights != null) { pool.setWeights(weights); } pool.setInitConn(initConn); pool.setMinConn(minConn); pool.setMaxConn(maxConn); pool.setMaxIdle(maxIdle); pool.setMaintSleep(maintSlee...
297d7e1d-0fc8-4db7-9a0a-28c476d21c82
6
public boolean getBlocked(String direction) { if(direction == "north") return northBlocked; if(direction == "south") return southBlocked; if(direction == "east") return eastBlocked; if(direction == "west") return westBlocked; if(direction == "up") return upBlocked; ...
8e28980c-1879-48b9-b9d2-85d81c483760
5
@Override protected void actionPerformed(ActionEvent event) { if (event.getSource() == newGameButton) { changeRenderableObject(hub.game); return; } else if (event.getSource() == saveLoadButton) { return; } else if (event.getSource() == helpButton) { retu...
4ab482e3-972e-44e9-9e9a-0290a5710001
4
private void ParseOutElements(org.w3c.dom.Element parentElement) { Node child = parentElement.getFirstChild(); while (child != null) { if (! handleGeneralProperty(child)) { String nodeName = child.getNodeName(); // Creature specific properties: vulnerability[ ], attack if (nodeName == "vulnerability"...
230e43a7-d981-4903-82b9-6fd4546f7487
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Sentence other = (Sentence) obj; if (!Objects.equals(this.sentence, other.sentence)) { return...
ef6c7bc2-0665-4acc-a358-ec567d32751a
1
public void traceBack() { // System.out.println("ANSWER NOW = "+myTrace); backTrackToCNF(); backTrackToUnit(); backTrackToLambda(); //System.out.println("size is = "+myAnswer.size()); if (myAnswer.size()==0) myAnswer.addAll(myTrace); // System.out.println("final answer"); // System.out.println(myAns...
42480931-7079-4bcc-bcd6-6169a52c9e27
6
public void onFrame(Controller controller) { Frame frame = controller.frame(); if (recording) { pattern.addFrame(frame); if (frameCount > 1 && pattern.justMoved()) framesNotMoving = 0; else framesNotMoving++; if (framesNotMoving > RECORDING_TIMEOUT) { done = true; recording = false; ...
0a486db2-c85f-4d6d-81d1-ca1378c208b3
5
private String printLapTimes(int currentIndex, List<Time> startTime, List<Time> finishTime, StringBuilder sb) { String totalLapCheck = ""; if (!(startTime.size() == 0 || finishTime.size() == 0)) { String lapTime = ""; for (int j = 0; j < laps; j++) { lapTime = index.get(currentIndex).getLapTime(j); ...
03d28b9b-2a2b-4eac-aa51-a674d931be14
2
private void refreshList() { DefaultListModel<Item> listModel = new DefaultListModel<Item>(); ArrayList<Item> items = (ArrayList<Item>) Main.getItemList(); for (Item item : items) { listModel.addElement(item); } if (list == null) list = new JList<Item>(listModel); else list.setModel(listModel); }
217c9328-7aee-4cce-9d30-d03813d47492
8
@Override public void run() { if(mConnectionList.size() < 3) { System.out.println("Dosen't Initialized!"); return; } try { // wait for sign up little Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } while(true) { int UID = 0; int GID = 0; int ...
a996a9f4-e0d5-4d3a-95d1-bb5cb2dd9b74
0
public String getTextColor() { return textColor; }
dd478c6d-4242-416b-afad-c075e23c12a8
9
JTuningAdvancedPanel(int extraXMargin, int extraYMargin) { super(extraXMargin,extraYMargin); setLayout(new FlowLayout()); jTuningNotePanel = new JPanel(new FlowLayout()); jTuningNotePanel.setBorder(advancedSettingsBorder); jTuningNotePanel.add(new JLabel("Tuning Ref")); // What note is use...
e0b34420-e3aa-416b-9538-324c80ef829c
4
protected static int getArrayIndex(int[] intArray, int key) { int i = 0; boolean foundMatch = false; while (!foundMatch && i < intArray.length) { foundMatch = (intArray[i] == key); if (!foundMatch) { i++; } } if (!foundMatch) { return NO_MATCH; } else { return i; } }
c0d45cd5-8fc2-481e-ac33-dedf89499d64
3
public void stopEveryone() { System.out.println("Stopping clusters.."); for (int i = 0; i < nrClusters; i++) { ControlMessage cMessage = new ControlMessage(ControlMessageType.ShutDown); sendMessage(cMessage, "cluster" + i); //socket.sendMessage(cMessage, "localsocket://" + "cluster" + i); } System.ou...
0208924f-611b-41f6-b68d-23a03e432b72
9
public void open(int row, int col) { validate(row); validate(col); if (!isOpenV(row, col)) { // open it int idx = index(row, col); open[idx] = true; // connect UP if (row == 1) { // if row = 1 connect to TOP uf.union(idx, theTOP); ufFull.union(idx, theTOP); ...
7cfe92da-6f64-4c89-adc8-516435b25338
4
@Override public ArrayList<TProducto> listarProducto()throws Exception { Statement query = null; Connection connection = null; TProducto temp = new TProducto(); ArrayList<TProducto> ret = new ArrayList<TProducto>(); String contenido_query = "SELECT * FROM Productos"; ...
5ae2ed42-8bde-42f3-bf08-f30a91e72ef1
8
@Override public Map<File, File> getVideoWithSubtitlesPairs(File inputFolder) throws NotFolderException { Map<File, File> filePairs = new HashMap<File, File>(); if (!inputFolder.isDirectory()) { throw new NotFolderException(inputFolder.getAbsolutePath()); } ExtentionFileFilterFactory extentionFileFilterF...
7fc53ee5-9207-4004-98c8-f90386329c40
0
@Override public void addDefaultAppenders() throws Exception { addConsoleAppender("STDOUT", "ALL"); addFileAppender("FILEOUT", "ALL"); }
38422c42-9b88-4101-8ba1-7b691dea18f6
8
private void rotateEnemy() { float rotation = enemy.getRotation(); float wRotation = (float) Math.PI * 2 - rotation; float angle = getRelativeAngle(); if (angle > Math.PI * (3 / 2)) { angle -= 2 * Math.PI; } if (wRotation > Math.PI * (3 / 2)) { ...
08476f3f-4730-4470-b9b5-ee3e426cd16d
0
RSAcreator() throws Exception { //DESede -- Triple DES Encryption key = KeyGenerator.getInstance("DESede").generateKey(); /* byte[] keyBytes = "0123456789ABCDEFABCDEF01234567890123456789ABCDEF".getBytes("ASCII"); DESedeKeySpec keySpec = new DESedeKeySpec(keyBytes); SecretKeyFac...
0ef8b7c9-2a57-41ef-b900-43235ee86c8c
3
private boolean aikaValidi(String aika) { if (aika.length() != 4) { return false; } else if ( Integer.parseInt(aika.substring(0, 1)) <25 && Integer.parseInt(aika.substring(2, 3)) <61 ) { return true; } else { return false; } }
9fd0895b-d1b0-4038-b6d5-51e9793aaac9
0
private ValidationHelper() { }
18b8aa71-aa74-412a-8486-2b19f33ad91f
4
private void InsertGlyph(Glyph glyph){ ICommand cmd = null; int physicalIndex = Integer.MIN_VALUE; if (this.selectionRange == null){ /* Add at the end of document*/ physicalIndex = this.document.getChildren().size(); } else if (this.selectionRange != null && this.selectionRange.isSingleGlyphSelection())...
eb8d79ce-629d-4634-acf1-44476dfd9869
9
private static void checkValidSubstraction(String s1, String s2) throws InvalidNumber { //int indexPrevChar = index(convertFromString(s2)); //int indexCurChar = index(convertFromString(s1)); //if ((indexPrevChar % 2) == 0) { // if ((indexPrevChar - indexCurChar) > 2) { // ...
a13fd092-ca7d-4aa2-9771-6ba10de2b683
9
@Override public boolean touchDown(int x, int y, int pointer, int button) { boolean attacked = false; if (System.currentTimeMillis() - prevTime > 500) { if (!m.getAtEnd() && current != null && game.isPlayerTurn() && !game.getPlayer().isDead()) { for (Creature c : game.getCreatures()) { if (c.getLo...