method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
784f6da1-ab18-474c-a3ba-5fac1a588630
9
@EventHandler(priority=EventPriority.HIGH) public void onPlayerMove(PlayerMoveEvent e) { Player p = e.getPlayer(); Fruit f = null; if(FruitManager.getInstance().checkIfPlayerIsDFUser(p)) //Drown Devil Fruit users { f = FruitManager.getInstance().getFruitByPlayer(p); switch(f.getId()) { ...
a9ec8686-d005-4f0a-8f4a-55353e7ed868
3
public static void Inspect(String item) { Random number = new Random(); int i = number.nextInt(3); i = i+1; boolean shownInspection = false; for(int k=0; k<Items.itemDesc.length; k++) { if(item.equalsIgnoreCase(Items.itemDesc[k][0])) { GUI.log(Items.itemDesc[k][i]); shownInspection = true;...
3c42ea19-77d4-4d71-8583-031f7109b9d6
3
public void execute() throws Exception { Number amount; Currency currency; String input = ""; while (true) { try { input = readAmount(reader); amount = Number.valueOf(input); currencyDialog.execute("Introduzca la divisa origen: ...
c3fee286-28c5-47c8-9a0a-4587f64e6411
8
public void play(){ int mode = mode(); if(mode == 1){ setup(_player1, _grid1); setup(_player2, _grid2); } else if(mode == 2){ setup(_player1, _grid1); setup(_comp1, _grid2); } else{ setup(_comp1, _grid1); setup(_comp2, _grid2); } while(!(_grid1.deathCount()==17 || _grid2.deathCou...
6c7a4faf-7df8-46ee-8fdc-995d5a827184
6
public String getText() { if (content.size() == 0) { return ""; } // If we hold only a Text or CDATA, return it directly if (content.size() == 1) { final Object obj = content.get(0); if (obj instanceof Text) { return ((Text) obj).getTe...
cd910f9a-af7d-4090-8769-5d6123dbe69b
6
@Override public boolean equals(Object obj){ if (obj == null) return false; if (obj == this) return true; if (!(obj instanceof deltaQ)) return false; deltaQ another = (deltaQ)obj; if (another.i.u_id.equals(this.i.u_id) && another.j.u_id.equals(this.j.u_id) && another.dQ == this.dQ) return true; ...
32e0bf2e-1c14-4c42-b00c-21f40da7f356
2
public static boolean isTypeMap(Class<?> type) { return (type != null && isAssignable(type, Map.class)); }
3fbcb757-d8bd-489d-8d98-dce94242c5b1
7
public Instruction findMatchingPush() { int count = 0; Instruction instr = this; int poppush[] = new int[2]; while (true) { if (instr.preds != null) return null; instr = instr.prevByAddr; if (instr == null || instr.succs != null || instr.doesAlwaysJump()) return null; instr.getStackPopPush(...
14cd331e-b244-4a86-ba8a-37f3fd5125ca
2
public void keyPressed(KeyEvent e) { int code = e.getKeyCode(); if (code > 0 && code < keys.length) { keys[code] = true; isMovingWithKey = true; } }
1f746f10-22de-45dc-9bd5-b0f52d0688fd
1
@Override public synchronized void close() { if (isClosed) { return; } isClosed = true; }
95efa875-3a5e-42ac-bc28-8c522f2a03b8
6
private void handle(Resource res) { InputStream in = null; try { res.error = null; res.source = src; try { try { in = src.get(res.name); res.load(in); res.l...
01994b14-e359-41b2-9ce6-c2c4e1536a1e
7
@Test public void testValorTotalEmEstoque() { try { Assert.assertEquals(25653.1f, facade.getValorTotalEmEstoque(), 0.1); } catch (FacadeException e) { Assert.fail(e.getMessage()); } Produto p5 = new Produto(5,"Smartphone Samsung Galaxy Ace Preto, Desbloqueado Vivo, GSM, Android, C‚mera de 5MP, Tela Touch...
d8cf2420-ffd7-49f6-96bb-6d2beb07bdcb
8
public MoveSet getValidMoves(int player) { Move empty_move = new Move(); MoveSet rtn_mset = null; int[] dice; int dice_left; if ((dc1==dc2)&&(use_doubles)) { dice_left = 4; dice = new int[4]; dice[0]=dc1; dice[1]=dc1; dice[2]=d...
6df9475a-2291-4cd8-9b8b-38fab5acf581
0
@Override public String toString() { return "ModelClassDesc [packgeName=" + packgeName + ", className=" + className + ", fileds=" + fileds + "]"; }
2373879e-f8c5-4bd6-b3e0-00e57d63bdc4
0
public InputEvent removeEvent() { return unprocessedEvents.remove(); }
cf9b08fe-041d-4007-a741-82f91d15c209
4
private void sink(int k){ while(2*k <= N){ int j = 2*k; if(j < N && less(j, j+1)) ++j; if(!less(k,j)) break; exch(k, j); k = j; } }
5fcd025c-d166-4a90-aa2b-1251f1b47083
8
private int getNrBlacks(int x, int y) { int number = 0; for (int i=(x>0?x-1:0); i<=x+1 && i<width; i++) { for (int j=(y>0?y-1:0); j<=y+1 && j<height; j++) { if (black[i][j] != null) number += black[i][j] ? 1 : 0; } } return number; }
b3919433-9a1a-40c9-b938-a53b775d3e21
4
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || this.length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this....
0e4b678e-7906-4981-b8d2-4f60ae0d91bc
9
public Model createNarfModelFromPDB(String aPdbId, NucleicAcid aNucleicAcid, List<Cycle<Nucleotide, InteractionEdge>> acycleList, boolean basepaironly) throws IOException { aPdbId = aPdbId.toUpperCase(); Random r_i = new Random(); int rand_i = r_i.nextInt()+1; Model rm = ModelFactory.createDefaultModel();...
583673ab-1f4a-4e0f-a057-67fd84414207
7
@Override public void render(GameContainer gc, Graphics g) { //our current y offset from the top int ypos = 0; Color reset = g.getColor(); for (Message m : messages) { switch(m.getType()) { case IMPORTANT: g.setColor(new HexColor(getImportantColor())); break; case ERROR: g...
d3eb585e-cd9d-44d6-b24d-7190984ace7a
1
private static ActionListener makeDBLoadButtonListener( final String buttonTitle, final JRadioButton yes) { return new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (yes.isSelected()) startLoadingDataBase(); else return; yes.setSelected(false); yes....
6382ee30-bd45-412f-bb1f-129f5825c3c6
7
private String createColumnsSqLite(List<Columns> listColumns) { String columnString = ""; int index = 0; for (Columns columns : listColumns) { columnString += "'" + columns.getColomnName() + "'"; columnString += " " + columns.getTypeData().getTypeInString(); columnString += (!columns.isAutoIncremented()?...
eb58e29d-466c-493d-8807-7bad2f5f7de7
3
private int countResults(ResultSet result) { if (result == null) { return -1; } int noof = 0; try { while (result.next()) { noof++; } } catch (Exception ex) {} return noof; }
031da5e5-6326-4b95-bde2-c58056d64575
0
public PowerUp(Animation anim) { super(anim); }
bd560976-048d-43f0-80e2-3f12bda6e197
9
public static String composeDateWhere(String sql, String fieldName, String fieldValue, int action) { if (fieldValue == null || fieldValue.trim().compareTo("") == 0) return sql; String sTmp = fieldValue; String sOper = "="; switch (action) { case EQUAL: sTmp = "'" + sTmp + "'"; break; case LIKE: ...
d73055b2-ab3e-453f-aaf5-9db261cd21bf
1
private ByteBuffer convertImageData(BufferedImage bufferedImage) { ByteBuffer imageBuffer; WritableRaster raster; BufferedImage texImage; int texWidth = bufferedImage.getWidth(); int texHeight = bufferedImage.getHeight(); // create a raster that can be used by OpenGL as a source // for a texture ...
bf38e66d-5208-47f4-af09-0669bbcf5ff3
9
private Map<String, Double> extractAdditionalFeatures(Map<String, Double> additionalFeatures, Document d, Query q, Map<String, Double> idfs) { Map<String, Double> newAdditionalFeatures = new HashMap<String, Double>(); if (additionalFeatures.containsKey("bm25")) { try { newAdditionalFeatures.put("bm25"...
300aee8f-1c73-452e-a9d8-1f65725513b8
1
private boolean jj_3R_83() { if (jj_scan_token(INTEGER)) return true; return false; }
daefc72e-5aa3-4410-b568-9c45496b0c8e
3
public Object getValueAt(int rowIndex, int columnIndex) { Schedule schedule = scheduleList.get(rowIndex); switch (columnIndex) { case 0: return schedule.getName(); case 1: return schedule.getWeekDay(); case -1: return schedule; } return ""; }
c6c264a8-f246-420e-9704-5c42f687f91c
5
public static <T> boolean isNominal(Class<T> classdef) { Class<?> classdef2 = getWrapper(classdef); return (classdef2 != null && (classdef2.isEnum() || classdef2 == Character.class || classdef2 == Boolean.class || classdef2 == Byte.class)); }
1c309868-6221-4e33-a06c-498f2ee7b275
6
static boolean isThereAThree(Hand hand) { for(int x = 1;x < hand.size(); x++){ if(hand.get(x).getValue() < hand.get(x-1).getValue()) { Card card1 = hand.get(x); Card card2 = hand.get(x-1); hand.setElementAt(card2, x); hand.setElementAt(card1, ...
458f443f-5604-4845-a2a1-f8b36e821608
4
private Set beginTry() { final Set beginTry = new HashSet(); final Iterator blocks = cfg.catchBlocks().iterator(); while (blocks.hasNext()) { final Block block = (Block) blocks.next(); final Handler handler = (Handler) cfg.handlersMap().get(block); if (handler != null) { final HashSet p = new Has...
62a99fbc-8bab-487d-adcc-cc14cf4368e8
3
@Override public Recipe getRecipeById(int recipeId) { try (Connection connection = DriverManager.getConnection(connectionString)) { Recipe recipe = new Recipe(); /* TODO: check the impact of fetching everything in one query */ PreparedStatement statement = connection.prepareStatement("select id, name, numPe...
58f84d6e-8981-4424-8cfa-dc1633b7316b
9
@Override public void mouseTouched(Actor actor, GGMouse mouse, Point spot) { if (enabled && isRunning()) { boolean last = hover; boolean lastP = pressed; switch (mouse.getEvent()) { case GGMouse.enter: hover = true; break; case GGMouse.leave: hover = false; break; case GGMouse...
9eee954f-2444-40fa-b36b-62f6fb33af69
0
public static Supervisor getSupervisor(){ return instance; }
0fd1fbac-f93a-46a9-ad3f-4c0ee7eb4622
3
private int get(final int local) { if (outputLocals == null || local >= outputLocals.length) { // this local has never been assigned in this basic block, // so it is still equal to its value in the input frame return LOCAL | local; } else { int type = outp...
71bbb3ca-1884-4e4c-8fd5-2bf20e20000d
1
private boolean jj_3R_50() { if (jj_3R_86()) return true; return false; }
726cd766-e41a-4968-bfbc-98e7c3fc1066
6
@Override public void run() { while (m_blnRunning) { if (m_plugin.economyInstance.isEnabled()) { Player[] vPlayers = m_plugin.getServer().getOnlinePlayers(); if (vPlayers.length > 0) { m_plugin.log(Level...
8afb240a-71dc-413a-ad98-4cb86567db60
9
public boolean update(int mx,int my){ if(mbi==null) return false; boolean go = (mx>x && mx<x+sx && my>y && my<y+sy && parent.isVisible() && visible); if(go){ if(data!=null) mbi.clicked(name+data,parent); if(data==null) mbi.clicked(name,parent); } return (g...
46953eae-6f70-4a4e-8133-adec36b3e7ec
4
public ArrayList<String> getWords() { // Create a list to return ArrayList<String> list = new ArrayList<String>(); //If this node represents a word, add it if (isWord) { list.add(getPathWord()); } // If any children if (!isLeaf) { // Add any words belonging to any children for (int i =...
6cc0af75-e3fb-4ded-96c6-ad20554b8d19
0
public void clear() { exceptions.clear(); }
cb701fb0-474b-485b-a391-9b6ab4d62a17
1
public void addInterface(String name) { cachedInterfaces = null; int info = constPool.addClassInfo(name); if (interfaces == null) { interfaces = new int[1]; interfaces[0] = info; } else { int n = interfaces.length; int[] newarray = ...
1bb6a962-5521-4900-a5c6-0ad42191b818
8
public void mouseClicked(int par1, int par2, int par3) { boolean var4 = par1 >= this.xPos && par1 < this.xPos + this.width && par2 >= this.yPos && par2 < this.yPos + this.height; if (this.canLoseFocus) { this.setFocused(this.isEnabled && var4); } if (this.isFocu...
cbf35311-2899-466b-8043-dc6fbb87175e
1
private void apply( DefaultConnectionLabelConfiguration config ) { DefaultConnectionLabelConfiguration.RESET.applyTo( this ); if( config != null ) { config.applyTo( this ); } }
f4e8e446-00a0-456a-9fbd-92fab4a3048c
9
protected void performGradientDescent(Pattern<?,?> pattern) throws NNException { try { network.process(pattern.getInputSignal()); // Calculate derivatives for the final layer: for (int i = 0; i < network.numberOfOutputs(); i++) { Neuron neuron = network.outputLayer.get(i); Double correctValue = p...
58510135-629f-4676-ace5-7190b041e1ea
2
public void testGetFieldType_int() { LocalDate test = new LocalDate(COPTIC_PARIS); assertSame(DateTimeFieldType.year(), test.getFieldType(0)); assertSame(DateTimeFieldType.monthOfYear(), test.getFieldType(1)); assertSame(DateTimeFieldType.dayOfMonth(), test.getFieldType(2)); try ...
828ec57f-c639-49f6-9a0e-e76a4d498de7
5
private void createFeedbackTypes(Group parent) { parent.setLayout(new RowLayout(SWT.VERTICAL)); Button b = new Button(parent, SWT.CHECK); b.setText("FEEDBACK_SELECT"); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Button b = (Button)e.widget; if (b.getSelecti...
3b0efe8b-6d3c-4883-8528-7cc8289a1e27
6
public void backToMenu() { int reply = JOptionPane.showConfirmDialog(null, "Would you like to return to the Main Menu?"); if(reply == JOptionPane.YES_OPTION) { timer.stop(); reply = JOptionPane.showConfirmDialog(null, "Would you like to save your progress before quiting?"); if(reply == JOptionPane.YES_OPTI...
70d16649-8352-4119-9af7-63a45cf383d1
5
public void loadConfig(final boolean initialLoad) throws Exception { // create directories FileStructure.createDir(pluginDir); // get config.yml path File file = new File(pluginDir, "config.yml"); if (!file.exists()) { FileStructure.extractResource("/config.yml", plu...
bc87257f-8dc2-4fe6-8064-4ce901298541
7
protected int getCorrectDirToOriginRoom(Room R, int v) { if(v<0) return -1; int dir=-1; Room R2=null; Exit E2=null; int lowest=v; for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--) { R2=R.getRoomInDir(d); E2=R.getExitInDir(d); if((R2!=null)&&(E2!=null)&&(E2.isOpen())) { final int dx=com...
60be4fe7-bcc3-444c-be09-581797208451
6
public void create(){ init = true; //hitbox if(this.shape.equals("circle")){ CircleShape shape = new CircleShape(); shape.setRadius((rw)/PPM); fdef.shape = shape; }else{ PolygonShape shape = new PolygonShape(); shape.setAsBox((rw)/PPM, (rh)/PPM); fdef.shape = shape; } bdef.position.se...
9525ce56-6a57-4202-ae5e-65d7ab9dff7e
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
16fec4bd-3e5a-4fb8-9ed2-1793cb47a4bf
4
public int maxProfit(int[] prices) { if(prices == null || prices.length == 0){ return 0; } int res = 0; for(int i = 1; i <= prices.length-1 ;i++){ if(prices[i-1] < prices[i]){ res += prices[i]-prices[i-1]; } } return res; }
4e2bc4b1-f34c-4308-bea6-4d70d5aa3ba0
5
public static boolean trashSlot(final int slot) { return getSlotType(slot) == ActionSlotType.NOTHING || (checkIndex(slot) && setLocked(false) && makeReadyForInteract() && dragBetween(getMainChild(slot), getTrashButton()) && new TimedCondition(2000) { @Override public boolean isDone() { retu...
47f3198e-6b7b-440d-9724-c88ce90a7460
6
public static final String getASCIIStr(byte[] bs, int index, int len) { StringBuffer ascii = new StringBuffer(); if ((bs == null) || (index > bs.length) || (index < 0) || (len <= 0) || (index + len > bs.length)) { return ascii.toString(); } for (int i = 0; i < len; i++) { ascii.append((char) bs[(i + index...
d1db1654-5f30-4d3f-bfd5-46cb067f4327
8
@Override public int[] getInts(int par1, int par2, int par3, int par4) { int i1 = par1 - 1; int j1 = par2 - 1; int k1 = par3 + 2; int l1 = par4 + 2; int[] aint = this.parent.getInts(i1, j1, k1, l1); int[] aint1 = IntCache.getIntCache(par3 * par4); for (in...
6aa36170-ef05-459a-8d7a-b39f4cb937dd
2
public static <T> CycList<T> construct(final T object1, final Object object2) { final CycList<T> cycList = new CycList<T>(object1); if (object2.equals(CycObjectFactory.nil)) { return cycList; } if (object2 instanceof CycList) { final CycList cycList2 = (CycList) object2; cycList.addAll...
4314a422-3869-419c-afd6-0711ea510c17
2
public void updateScoreboard() { if(scoreboard == null) return; OfflinePlayer target = getServer().getOfflinePlayer(scoreboardText); objective.getScore(target).setScore((int) getTimeFromType(scoreboardScoreType)); for(Player player : getServer().getOnlinePlayers()) player.setScoreboard(scoreboard); }
26344f17-064b-4d14-a272-7a4af406bafe
5
public MalayansClient() { settingManager = SettingManager.getInstance(); settingManager.init(); logger = Logger.getLogger(MalayansClient.class.toString()); if (moduleInfo == null) { moduleInfo = new ModuleInfo(); moduleInfo.setDescription(Setting.str_ModuleDescription); moduleInfo.setId(Setting.s...
d9d1f6d4-1b14-4762-be57-a1ec4853e466
0
@Test public void test_get_int() { Assert.assertEquals(8989, getInt("b_local_port")); }
092f3cf6-421d-411d-bfc4-777ff8b7c6f7
3
public Object[] selectRegion(Rectangle rect, MouseEvent e) { Object[] cells = getCells(rect); if (cells.length > 0) { selectCellsForEvent(cells, e); } else if (!graph.isSelectionEmpty() && !e.isConsumed()) { graph.clearSelection(); } return cells; }
df8b83f8-dd66-4b8a-869e-a4bc1b613bda
9
public void actionPerformed(ActionEvent e) { String act = e.getActionCommand(); if (act.equals("BLUR")) { Integer integer = IntegerDialog.getInteger(Resources.getString("EffectsMenu.BLUR_AMOUNT"),1,9,3,3); if (integer != null) applyAction(new Blur(integer)); return; } if (act.equals("SATURATION")...
2bf0216f-2c84-492e-abbc-47ae4bbfad38
2
public void fromJSONObject(JSONObject o) throws ParseException { setPrompt((String)o.get(KEY_PROMPT)); setAnswer((String)o.get(KEY_ANSWER)); String type = (String)o.get(KEY_TYPE); setBonusType(BONUS_TYPE.valueOf(type)); JSONArray jChoices = (JSONArray)o.get(KEY_CHOICES); if (jChoices == null) { setC...
c70f9cb2-14dc-435d-8fe3-e72c82a3ae71
3
public Annotation getParentAnnotation() { Annotation parent = null; Object ob = getObject("Parent"); if (ob instanceof Reference) ob = library.getObject((Reference) ob); if (ob instanceof Annotation) parent = (Annotation) ob; else if (ob instanceof Hashta...
f400a947-91ed-4584-bc98-1a023047c494
3
@Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (PreciseDecimal.class.isInstance(obj)) { final PreciseDecimal other = (PreciseDecimal) obj; return this.base == other.base && this.factor == other.factor; } else { return false; } }
d4e78dea-034d-41d8-9857-794ccec560c9
9
void applyBoundary(float[][] t) { if (boundary instanceof DirichletThermalBoundary) { DirichletThermalBoundary b = (DirichletThermalBoundary) boundary; float tUpper = b.getTemperatureAtBorder(Boundary.UPPER); float tLower = b.getTemperatureAtBorder(Boundary.LOWER); float tLeft = b.getTemperatureAtBorder(...
4eabaad5-04da-4e28-880f-1ef80831a8b6
5
static final Class142_Sub27_Sub6 method562(boolean flag) { if (Class26.aNodeChildList_471 == null) { return null; } Class142_Sub18.aClass38_3546.method396((byte) -16, Class26.aNodeChildList_471); Class142_Sub27_Sub6 class142_sub27_sub6 = (Class142_Sub27_Sub6) Class142_Sub18.a...
871af38c-839c-4505-94f5-aeec411337d3
3
private void loadSpelprojekt() { try { ArrayList<String> games = DB.fetchColumn("select sid from spelprojekt"); ArrayList<Spelprojekt> sp = new ArrayList<>(); cbAvalibleSpelprojekt.removeAllItems(); for (String st : games) { sp.add(new Spelprojekt(...
ce408bfb-efe9-4068-a9b3-b87a6e0049cf
3
public Msg readMsg(Socket socket, ObjectInputStream in) { try { if (!socket.isConnected()) { return null; } Msg msg = (Msg) in.readObject(); while (msg == null) { } return msg; } catch (IOException | ClassNotFoundException e) { e.printStackTrace(); } return null; }
1d8b485b-a8d0-4bdd-be77-aa2ecbb0f973
5
@Override protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); if (kirjaudutaankoUlos(request)) { kirjauduUlos(request, response); } else if (...
6f2ca078-f144-4328-a669-d2e1d22da479
2
private String getResponse(HttpURLConnection connection) throws Exception { InputStream in = null; // Load stream if(status != 200) { in = connection.getErrorStream(); } else { in = connection.getInputStream(); } BufferedInputStream input = new BufferedInputStream(in); StringBuffer sb = new Str...
ffe00981-c33c-4f4e-9c25-376f7f11b97b
5
static public void main(String[] args){ //efficiency comparison Vector<Integer> container = new Vector<Integer>(); Random rand = new Random(); for(int i=0; i<2000000; i++) container.add(rand.nextInt()); //Testing my priority queue long time = System.currentTimeMillis(); MyPriorityQueue<Integer> tes...
99324c54-5909-4215-a24d-dac0790c0663
5
private void removeOld() { double[] location = this.locationStack.removeFirst(); KdTree<T> cursor = this; // Find the node where the point is while (cursor.locations == null) { if (location[cursor.splitDimension] > cursor.splitValue) { cursor = cursor.right; } else { cursor = cursor.left; } }...
1aa76aee-e3e4-438f-a51c-8bf51c03cda1
3
public static Long getMaxDiagonal2Product(int[][] data, int numbers) { int max = Integer.MIN_VALUE; for (int x = 0; x + numbers <= DATA.length; x++) { for (int y = 0; y + numbers <= DATA.length; y++) { int sum = 1; for (int offset = 0; offset < numbers; offset...
b9db9d66-a76e-45fc-9f95-e35b554212bd
8
final public void Class_declaration() throws ParseException { /*@bgen(jjtree) Class_declaration */ SimpleNode jjtn000 = new SimpleNode(JJTCLASS_DECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { Class_head(); ...
9ef161f6-19bc-4758-a1c7-241460ae65b9
5
protected void printTopChild4Stn(String filePrefix){ String topChild4StnFile = filePrefix + "/topChild4Stn.txt"; try{ PrintWriter pw = new PrintWriter(new File(topChild4StnFile)); for(_Doc d:m_corpus.getCollection()){ if(d instanceof _ParentDoc){ _ParentDoc pDoc = (_ParentDoc)d; pw.pri...
e1f0e513-264c-4703-8a2f-bacaf9831550
0
@Column(name = "module_id") @Id public String getModuleId() { return moduleId; }
fb66f43a-dd3c-4a4c-ad55-f0a7dbd30753
4
public void businessScoreDist() { double totalScore = 0; int totalBusinessCnt = 0; Map<Double, Integer> businessScoreMap = new TreeMap<Double, Integer>(); for (Business business:businessMap.values()) { //System.out.println("hello"); totalBusinessCnt += 1; double star = business.stars; totalScore += ...
4f8fa09b-801c-4fc7-a014-dbca7a1e804c
6
public void start() throws IllegalStateException { if (instructions == null || endgamewindow == null || gameboard == null || lobby == null || loginsingup == null || newgame == null) throw new IllegalStateException(); done = false; // Start Socket connection attempConnection(); setState(ModelStates.log...
1477fd20-f0a7-4e6c-aa6c-af21fe432c51
3
public List getEntitiesWithinAABBExcludingEntity(Entity var1, AxisAlignedBB var2) { this.field_1012_M.clear(); int var3 = MathHelper.floor_double((var2.minX - 2.0D) / 16.0D); int var4 = MathHelper.floor_double((var2.maxX + 2.0D) / 16.0D); int var5 = MathHelper.floor_double((var2.minZ - 2...
4b699edb-beaa-41ed-abe3-750f584be3f4
4
public static Image rayleighNoise(Image original, double psi, double p) { if (original == null) return null; Image rayleigh = original.shallowClone(); for (int x = 0; x < original.getWidth(); x++) { for (int y = 0; y < original.getHeight(); y++) { double rand = Math.random(); double noise = 1; i...
0b52124c-1b59-4a43-84c7-bdb9329b479d
5
public static String[] getFirstNums(String str) { if(str.length() == 1) if(Character.isDigit(str.charAt(0))) return new String[] { str, str.charAt(0) + "" }; // if there is a specified quantity, set quantity to that number int quantity = 1; if (Character.isDigit(str.charAt(0))) { int end = 0; ...
9da940b7-42ce-4dc7-aaf1-b428218c9e9f
1
public AnnotationVisitor visitAnnotation( final String desc, final boolean visible) { return new SAXAnnotationAdapter(getContentHandler(), "annotation", visible ? 1 : -1, null, desc); }
15172c7f-07a5-4930-bfa8-a9756f79c221
3
public static <T extends DC> Equality getPhiEqu(Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>> done) { if(done!=null) { if(done.getNext()!=null) { return new Equality(done.getFst().fst().fst().delta(done.getFst().snd().fst()).equa().getValue()&&getPhiEqu(done.getNext()).getValue()); } else ...
4fbce21a-196c-4670-ab81-0a7b8b8d4d09
6
private static PathNode findTargetPath(AIUnit aiUnit, boolean deferOK) { if (invalidAIUnitReason(aiUnit) != null) return null; final Unit unit = aiUnit.getUnit(); final Tile startTile = unit.getPathStartTile(); if (startTile == null) return null; // Not on the map? Euro...
74220873-1374-4a05-8a87-782eea164a4b
3
public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int[] comp = new int[n]; for(int i=0;i<n;i++){ comp[i]=in.nextInt(); } Arrays.sort(comp); int count = 0; for(int i=comp.length-1;i>=0;i--){ count++; if(count==k...
7920493d-50ea-4efd-b6dd-dbc74f621849
0
public static float getFovY() { return fovY; }
e0278667-2a0b-45d5-99a0-386dbdcb5b02
4
public static int allocateSchools(String id[]) { String schoolid=id[0]; System.out.println("in DAO school award"); System.out.println(schoolid); String testid="",awardid="",awardname=""; try{ con=DBConnection.getConnection(); System.out.println("in try"); String query1="select count(schoolid) from ...
b79d7465-3508-41a3-bd40-43e8d8f49634
4
@Override public Card chooseCard(Player player, Card[] cards, GameState state) { //If there's only one choice, we have no choice but to do it if(cards.length == 1) { return cards[0]; } int alpha = Integer.MIN_VALUE; int beta = Integer.MAX_VALUE; Card choice = null; ArrayList<Color> playerLi...
201eac50-e995-41ce-9368-4d11ad6b52e8
5
public double minValue(KrakenState state, String player, double alpha, double beta) { if (expandedNodes==maxNodesExpand || game.isTerminal(state)){ if (heuristics==null) return heuristic.h(state); else return getHeuristicFusion(state); } expandedNodes++; double value = Double.POSITIVE_INFINITY;...
e8742d93-cd63-4572-91f1-492b09098886
1
public Transition getTransitionForUnitProduction(Production production, VariableDependencyGraph graph) { ProductionChecker pc = new ProductionChecker(); if (!ProductionChecker.isUnitProduction(production)) return null; String lhs = production.getLHS(); String rhs = production.getRHS(); State from = getS...
4f417fff-b7e9-48e5-b0a2-6c05882f0ef9
0
public void setChefVente(String chefVente) { this.chefVente = chefVente; }
43fda3e2-9c25-40e9-827c-8fbfbdf2c827
5
@Override public boolean equals(Object other) { if(other instanceof Board) { Board board = (Board) other; if(deck.equals(board.deck)) { if(shipLoot.length == board.shipLoot.length) { for(int i = 0; i < shipLoot.length; i++) { if(!shipLoot[i].equals(board.shipLoot[i])) { ...
fe465325-e69f-49e0-9f25-193781bc3c92
5
@Test public void smallBoardSize2WithBishopAndRook() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(BISHOP.toString(), 1); figureQuantityMap.put(ROOK.toString(), 1); int dimension = 2; Set<String> boards = prepareBoardsWithBishopAndRook(fig...
554b4131-1fa5-4571-91da-caf15f0949f1
7
public boolean isBinaryTreeABST(Node head) { if (head != null) { if (head.left != null) { if ((Integer) head.left.value > (Integer) head.value) return false; } if (head.right != null) { if ((Integer) head.right.value < (Integer) head.value) ret...
566b5845-d98f-4045-b8b3-a24a9ad2ca74
7
protected void printSubMenuText(Integer number){ switch (number){ case 0: {System.out.print(MENU_TEXT_BACK_ANY);break;} case 1: {System.out.print(MENU_TEXT_411_ISBN);break;} case 2: {System.out.print(MENU_TEXT_411);break;} case 3: {System.out.print(MENU_TEXT_411_C...
e3b1cb6d-3ae9-4f1d-8397-3c334b03ad76
6
public static void updateFolders(){ try { registerFont(); GraphicsConfiguration.load(); } catch (FontFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if(!MAP_FOLDER.exists()){ MAP_FOLDER.mkdir(); FileTools.extract(new File(MAP_FOLDER_PATH+"default.sm...
3f1ae4dd-ebb3-435e-ac40-8b12d0ae780c
1
protected boolean isFinished() { if(_goal < 0) { return _dist <= _goal; } else { return _dist >= _goal; } }
5b463344-174d-4914-bf96-a70811063bc0
6
public static Records getQueryResults(PreparedStatement preparedStatement, Set<Column> selectedColumns, BaseDatabaseConnection dbConnection) throws SQLException { ResultSet resultSet = null; try { resultSet = preparedStatement.executeQuery(); Records results = new Records(); while (resultSet....
44dbad79-a9fa-4381-b214-cc3f5da9c515
4
public void build(File exportFile) throws TaskIOException { if (exportFile == null) { throw new TaskIOException(ApplicationSettings.getInstance().getLocalizedMessage("log.err.file")); } log.info(ApplicationSettings.getInstance().getLocalizedMessage("log.create.file")); m_taskList.setName(exportFile.getName...