method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1eb90d5e-9450-46c0-9e6a-3ec8edb332ef
4
public ArrayList<Integer> preorderTraversal(treeNode root) { ArrayList<Integer> valsInPreOrder = new ArrayList<Integer>(); Stack<treeNode> nodesInPreOrder = new Stack<treeNode>(); if (root == null) return valsInPreOrder; // push root in to begin with nodesInPreOrder.push(root); // for each node in sta...
ed2119e8-abfd-4fe8-ab01-0518a17f0676
5
public void onClicked(Interactable i) { if(clicked < clicks) { i.hide(); Interactable i2 = getInteractable(new Location(i.getX(), i.getY() - maze.getyWallScale())); if(i2!=null) { i2.hide(); map[i2.getX()/i2.getWidth()][i2.getY()/i2.getHeight()] = 1; } i2 = getInteractable(new Location...
4dbadded-5078-453e-bad3-595036162269
8
private void onClickLogin(){ MySession sess = (MySession)getSession(); // ------------------- // ユーザ名 // ------------------- String username = _openidname.getModelObjectAsString(); // ------------------- // コンシューマ名 // ------------------- SelectOption op = (SelectOption)_openidprovider.getModelO...
149f4630-f86b-46d8-b291-84b63c5a05f0
6
@Override public void run() { long lastT = 0; while(true) { if(lastT != file.lastModified()) { try { List<String> lines = Files.readAllLines(file.toPath(), Charset.defaultCharset()); ...
bc1a17a0-8df0-4e80-b61b-2fb751debbca
8
void output( int code, OutputStream outs ) throws IOException { cur_accum &= masks[cur_bits]; if ( cur_bits > 0 ) cur_accum |= ( code << cur_bits ); else cur_accum = code; cur_bits += n_bits; while ( cur_bits >= 8 ) ...
4b74dc8c-c83f-42c4-81c4-ab0296c6ddd2
5
public boolean isFree(int gridX,int gridY){ switch(Screen.land[gridY][gridX]){ //all the solids: case 1: case 2: case 3: case 4: case 8: return false; } return true; }
8c4565a6-56bf-481e-87bf-c952e6a36e43
6
private TagPos findTag(String tagName) { if (tagName != null) { ListIterator<TagPos> it = list.listIterator(list.size()); String fatalTag = null; TagInfo fatalInfo = getTagInfoProvider().getTagInfo(tagName); if (fatalInfo != null) { ...
ab980fa8-7693-4f22-aa0c-0f322dba05f6
5
@SuppressWarnings("resource") public static void copy(File src, File dest) throws IOException { if (!src.exists()) return; if (!dest.exists()) dest.mkdir(); for (File f : src.listFiles()) { File target = new File(dest, f.getName()); if (f.isDirectory()) copy(f, target); if (f.isFile()) { FileChannel...
087cd18b-3ad7-444e-a315-2ff07ca3c849
0
private PDestination(String whereTo) { label = whereTo; }
3c151078-4de1-4a0a-bd09-3bbffb459e01
8
private void bindJNDIConfig(EnvConfigBean envConfig, Document document) { NodeList jndiNodes = document.getElementsByTagName("jndi"); if(null != jndiNodes && jndiNodes.getLength() > 0) { Node node = jndiNodes.item(0); NodeList jndiProps = node.getChildNodes(); ...
5b4f16e3-efa4-4d22-bd10-ddf91cdf616d
6
public static void setNimbus() { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.ora...
1fb0f3e6-58a8-49e6-8b08-a7b145587c9c
6
public static Stella_Object generateOneVariable(PatternVariable self, boolean typedP) { { Stella_Object value = null; if (((Justification)(Logic.$CURRENTJUSTIFICATION$.get())) != null) { value = Logic.justificationArgumentBoundTo(self, null); } if (value == null) { value = Logic.s...
0d8ee2a7-0f87-4279-9d94-c308db1ab42b
9
public void move(int spot, char symbol) { switch (spot) { case 1 : field[0][0] = symbol; break; case 2 : field[0][1] = symbol; break; case 3 : field[0][2] = symbol; break; case 4 : field[1][0] = symbol; ...
af84d59f-34e4-4a51-9d9d-d5f8a142e845
3
public String getNick() { int i = prefix.indexOf('!'); if (i != -1 || (i = prefix.indexOf('@')) != -1) return prefix.substring(0, i); return (prefix.length() != 0) ? prefix : null; }
f5147c77-2a3d-466f-bb70-5ee5c729ff78
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Room1)) { return false; } Room1 other = (Room1) object; if ((this.id == null && other.id != null) || (this.id !...
c7bccbf2-a315-40b2-8d29-6c63756d8505
0
@Override public void focusLost(FocusEvent e) { handleUpdate(); }
f734c897-0264-4c42-9de0-47331c887222
1
@Override public void setPricing(Character productCode, int productQuantity, float productPackPrice) { Product product = null; product = this.locateProductByCode(productCode); if (product==null) { product = new Product(productCode); product.writePriceForQuantity(productQuantity, BigDecimal.valueOf(product...
1d4bc595-c2ca-4dc4-b9c4-998f0dade442
2
public void dropFlagOnAdjacentPosition(Position position) { if (position == null) throw new IllegalArgumentException("The given arguments are invalid!"); final PlayerFlag inventoryFlag = getInventory().findFlag(); if (inventoryFlag != null) { List<Position> positionsAroundPlayer = getGrid().getPositions...
5b609877-24e2-403d-87fd-0b650e9644b3
1
@Override public void mouseDragged(MouseEvent event) { if (pos == -1) return; /*Point loc = getLocation(); displacement = event.getPoint(); points[1].setRect(points[1].getX()-displacement.x,points[1].getY()-displacement.y,points[1].getWidth(),points[1].getHeight());*/ ...
d08b3726-b769-48fc-9bd2-7aba01604416
2
private void uploadSkinFile(String url) throws Exception { CloseableHttpClient httpclient = HttpClients.createDefault(); try { HttpPost httppost = new HttpPost(url); FileBody skin = new FileBody(skinFile); StringBody user = new StringBody(this.username, ContentType.T...
b783236c-3b3b-4581-b825-463cee0865dd
0
public FirstFollowTable(Grammar grammar) { super(new FirstFollowModel(grammar)); model = (FirstFollowModel) getModel(); getColumnModel().getColumn(1).setCellRenderer(RENDERER); getColumnModel().getColumn(2).setCellRenderer(RENDERER); setCellSelectionEnabled(true); }
836f5ef8-1dec-4b0d-a811-384cb4b13f0c
1
public void reload() { try { this.yml.save(configFile); this.yml.load(configFile); } catch (Exception e) { System.out.println("[BurningCS] Could not read config file!"); e.printStackTrace(); } }
b2106300-2da3-4790-b6ed-c8fe6857297d
3
public static void main(String[] args) throws Exception { final SwingTerminal swingTerminal = new SwingTerminal(); final GUIScreen guiScreen = new GUIScreen(new Screen(swingTerminal)); guiScreen.getScreen().startScreen(); final Window window1 = new Window("Palette Switcher"); ...
78244c6c-955f-48ec-b7b7-f9683f5971c3
7
public Coordinate move( Move move ) { Coordinate jumped = null; int jumpedPiece = 0; int movePiece = 0; //makes sure the move is valid if( isValidCoordinate( move.getStart( ) ) && isValidCoordinate( move.getEnd( ) ) && !isEmpty( move.getStart( ) ) && isEmpty( move.getEnd( ) ) ) { /...
8221d79d-5dfd-4a6e-a92c-fed9f91a5694
6
public String stComposeEmailForOutlookEmailService(int dataId,int ExpVal,String flow ) { int actVal=1000; String returnVal=null; hm.clear(); hm=STFunctionLibrary.stMakeData(dataId, "ExternalEmail"); String to = hm.get("To"); String subject = hm.get("Subject"); String message = hm.get("Message...
a02bb559-e37d-4f79-9dfe-d34497d8ee44
5
public static void main(String[] args) throws UnsupportedEncodingException { Map<String, Double> orderList = new HashMap<String, Double>(); double result = 0; try { Scanner fileScanner = new Scanner(new File("input.txt")); while(fileScanner.hasNext()){ String[] tokens = fileScanner.nextLine().split("\\s...
c759275a-de23-4ea2-ae4a-78c2be10f970
7
public SpikeCollection getRandom(int numberOfRandomSpikesToAnalyse) { SpikeCollection randomSpikes = new SpikeCollection(); RandomDataImpl generator = new RandomDataImpl(); // find total number of spikes int total = 0; for (SingleASspikes asSpikes : allUpdates.values()) { total = total + asSpikes.getNum...
1326d989-2a98-4eb3-b071-9e3f0b4cf5fe
0
public static void main(String[] args) { AddStrategy addStrategy = new AddStrategy(); Environment environment = new Environment(addStrategy); System.out.println(environment.calculate(3, 4)); SubStrategy subtractStrategy = new SubStrategy(); environment.setStrategy(subtractStrategy); System.out.println...
80be7b6c-aabb-4262-bce9-1d0f9c309bfa
0
public short getId() { return id; }
667556b1-42e0-47fa-bbab-6f187d5bbd70
9
private Object invoke(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException { Context cx = enterContext(); try { if (name == null) { throw new NullPointerException("method name is null"); } if (thiz != nul...
d3c78d84-16bb-4fda-83bd-7aa92fb47e41
6
ArrayList<ArrayList<Integer>> permuteUnit(int[] num, int[] pre, int[] post, ArrayList<ArrayList<Integer>> permutation) { // base case if (pre.length == num.length) { ArrayList<Integer> unit = new ArrayList<Integer>(); for (int i = 0; i < pre.length; i++) { unit.add(pre[i]); } permutation.add(uni...
ae315fa9-1c6b-4888-bcfe-a550aacdf47b
8
public ArrayList<ArrayList<String>> splitString(String input) { sentence = input; ArrayList<String> sentenceArray, tokenizedSentence = new ArrayList<>(), charIdentifier = new ArrayList<>(); // splits sentence into single words at spaces // Note: will also bring punctuation with word (if applic...
401f7766-1eb5-4eba-b501-a180ae4583a1
2
public static void ChooseNan () { if (Game.characterChoice == 1) { Game.CharacterOne = "Nan"; Game.CharacterOneHP = CharacterStats.NanHP; Game.CharacterOneAttack = CharacterStats.NanAttack; Game.CharacterOneMana = CharacterStats.NanMana; Game.CharacterOneRegen = CharacterStats.NanRegen; ...
8f19ffae-41c0-4d9a-933c-94723189689e
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target=getAnyTarget(mob,commands,givenTarget,Wearable.FILTER_UNWORNONLY); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false;...
7bafe8b8-9259-405e-ad79-3c576008677e
4
@SuppressWarnings("CallToThreadDumpStack") private void miFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miFornecedorActionPerformed if (getCadFornecedor() != null && !cadFornecedor.isVisible()) { deskPane.remove(getCadFornecedor()); setCadFornecedor(nul...
2fc66a8c-f413-4f6c-965b-747fb5ed25dc
8
@Override public boolean resetDeckBackTo52Cards() { if((cardsCache==null)||(cardsCache.size()==0)) return false; // first retreive all our cards by looping // through our cached list. If we already // have a card, make sure its faced-down for(int i=0;i<cardsCache.size();i++) { final PlayingCard ca...
79e7c912-e800-47f0-ad4a-b698aeae240f
5
public List<Section> parseData(String[] cleanedTimetable) { Section currentSection; List<Section> sectionList = new LinkedList<Section>(); int index = 0; int nextCRNIndex; //parse sections //while there is another section while ((index = nextCRN(cleanedTimet...
eddfadc9-7b33-4a82-bc03-c15df11ea570
4
public Tweet(final Status tweet) { setBorder(new LineBorder(Color.CYAN, 2)); setLayout(new BorderLayout(0, 0)); JTextArea txtrYourTweet = new JTextArea(); txtrYourTweet.setText(tweet.getText()); add(txtrYourTweet); JPanel panel = new JPanel(); add(panel, BorderLayout.SOUTH); JButton btnNewButton = ne...
e486ddfd-439e-4ed1-ad65-195f920f1b01
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Point other = (Point) obj; if (x == null) { if (other.x != null) return false; } else if (!x.equals(other.x)) return false; if (y =...
60d5b57c-e9a6-4afb-896a-49ed93e1d39d
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Category other = (Category) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) retur...
36a36418-7333-43a9-a5bc-22a0559247b4
9
private void skipCommon() { char ch = jsonStr.charAt(++index); if (ch == '/') { for (index++; index < length; index++) { ch = jsonStr.charAt(index); if (ch == '\n' || ch == '\r') { break; } } } else if (c...
1ae17e91-2011-47da-b2ca-a9152c6ffc72
7
private static <T> Letter<?> createRandomLetter(Inhabitant senderI, Inhabitant receiverI) { Random rand = new Random(); Letter<?> letter; Random rand2 = new Random(); switch (rand.nextInt(5)) { case 0: letter = new PromissoryNote(senderI, receiverI, new Money( rand2.nextInt(100))); break; case...
adf335f9-aea8-4e0a-9cb9-029bc786350d
6
public int getMax(int start, int end) { if (this.start == start && this.end == end) return maxVal; int mid = (this.start + this.end) / 2; if (start <= mid && end <= mid) return left.getMax(start, end); if (start > mid && end > mid) return right.getMax(start, end); return Math.max(left.getMax(start, m...
963de2dd-a4c8-46d0-9962-2deab180de1d
6
public void pickCode() { codeNum1 = (int) (Math.random()*10); do { codeNum2 = (int) (Math.random()*10); } while (codeNum2==codeNum1); do { codeNum3 = (int) (Math.random()*10); } while ((codeNum3==codeNum1)||(codeNum3==codeNum2)); do { codeNum4 = (int) (Math.random()*10); } while ((codeNum4==codeN...
e7e5eb51-aa0a-4378-9d20-d1e93e6362b0
3
public void saveExpression(String fileName, String expression) { if (!fileName.contains(".txt")) { fileName += ".txt"; } FileWriter writer = null; try { writer = new FileWriter(fileName); PrintWriter fout = new PrintWriter(writer); fout.printf(expression,(Object) null); } catch (IOException e) { ...
3c0f582e-9b9c-4800-a7b8-1c77807cfe7c
8
public static String mySqlStringLiteral(String value) { StringBuilder sql = new StringBuilder(); sql.append('\''); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); switch (c) { case '\0': sql.append("\\0"); ...
00416692-1680-4d3f-9276-d5bdbdc0ba6f
8
public MapleAlliance(MapleClient c, int id) { guilds = new ArrayList<MapleGuild>(); this.id = id; try { Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM alliances WHERE id = ? "); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); ...
176f1ad5-780a-4476-a78f-94380b6aa92d
3
public void repaintCommon() { if(activeTrayIcon.isSelected()) { windowActionBox.setEnabled(true); windowClosing.setEnabled(true); } else { windowActionBox.setEnabled(false); windowClosing.setEnabled(false); //set status: close when click on x windowActionBox.setSelectedIndex(1); } if(useA...
88d843a2-77ca-4463-b6f4-ac39f494896a
1
public void add (Object answer){ Integer answerInstances = answers.get(answer); answerInstances = answerInstances==null?0:answerInstances; answers.put(answer, answerInstances+1); }
12d5b7af-847c-4246-9601-829c31728f87
4
private ArrayList<PiezaArqueologica> generarLista(int civilizacion) { ArrayList<PiezaArqueologica> milistaObjetos=new ArrayList<>(); PiezaArqueologica artefacto; try { FileInputStream fstream = new FileInputStream("items.txt"); DataInputStream e...
7f38258d-6536-49d5-a0c0-be1ee71a2166
9
void playSound(int intSFX,int intLocX, int intLocY) { int i, i2, i3; DuskObject objStore; LivingThing thnStore; i=0; intLocX = intLocX-viewrange; intLocY = intLocY-viewrange; if (intLocX<0) { i = -1*(intLocX); } i2=0; if (intLocY<0) { i2 = -1*(intLocY);...
c6fe634c-b79f-492c-804d-903465e328b4
2
public void shiftIndex(int lessThan, int delta) { int size = info.length; for (int i = 2; i < size; i += 10){ int org = ByteArray.readU16bit(info, i + 8); if (org >= lessThan) ByteArray.write16bit(org + delta, info, i + 8); } }
42a51705-0c4f-45e0-bea0-43de9979d415
5
public void move(int pX, int pY) { if(alive) { if(pY < row) super.move(NORTH); else if(pY > row) super.move(SOUTH); if(pX < column) super.move(WEST); else if(pX > column) super.move(EAST); } }
261673aa-09aa-4a89-85c5-8cb479426a24
3
public int hashCode() { int lHashCode = 0; if ( this.getCod_Jornada() != null ) { lHashCode += this.getCod_Jornada().hashCode(); } if ( this.getCod_Competicao() != null ) { lHashCode += this.getCod_Competicao().hashCode(); } if ( lHashCode == 0 ) { lHashCode = super.hashCode(); } return lHas...
955c16a6-1733-4119-b6e9-3d1042158440
8
public static void update() { mouseScroll = 0; if(canvas != null && canvas.getMousePosition() != null) mousePoint = canvas.getMousePosition(); for(int i = 0; i < 3; i++) { if(mouseEvents[i] == TYPE_RELEASED) mouseEvents[i] = TYPE_NONE; if(mouseEvents[i] == TYPE_PRESSED) mouseEvents[i] ...
c766d0ca-d551-4d8a-9b6e-363e2d02326d
6
public static GrammarTreeMonitor getGrammarTreeBySentenceKeyWord( String value) { if (value == null || value.length() < 1) { return null; } String monitorName = value.toLowerCase(); monitorName = packageName + "." + monitorName.substring(0, 1).toUpperCase() + monitorName.substring(1) + "WordMonito...
a69c2d12-3f65-4ea4-ab88-e77a435152ef
8
private void dropIndex(String sql, StringTokenizer tokenizer) throws Exception { try { //get index name String idxName = tokenizer.nextToken(); // Check for the semicolon String tok = tokenizer.nextToken(); if (! ";".equalsIgnoreCase(tok)) { throw new NoSuchElementException(); } // Ch...
c745a0a4-3892-45fa-90fe-7da902b78edb
1
private void closeClientSocket() { try { this.clientSocket.close(); this.log.info("close client Socket " + this.clientSocket.toString()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); this.log.info("close client Socket: fail"); } }
6dd1b219-0c1c-462a-b0db-95374b603714
4
public boolean isAllPlayersFullyAsleep() { if (this.allPlayersSleeping && !this.multiplayerWorld) { Iterator var1 = this.playerEntities.iterator(); EntityPlayer var2; do { if (!var1.hasNext()) { return true; } ...
8a6d877d-1203-48fe-875f-fd23125041b1
5
public void disconnect() { try { if(out != null) out.close(); if(in != null) in.close(); if(socket != null) socket.close(); if(ssl_socket != null) ssl_socket.close(); } catch(IOException e) { } out = null; in = null; socket =...
556893ff-4731-4390-b392-6d7085a1fa7d
9
@Override public DamageReport hit(double damage, Class<? extends Tower> towerClass) { if(!alive) { return null; } damage *= calculateMultiTowerBonus(towerClass); double adjustedDamage = damage; if(adjustedDamageTicksLeft > 0) { adjustedDamage *= damageMultiplier; ...
c8203749-b0d7-4038-ad77-69cd7160b273
3
@Override public void run() { while (cont) { try { Thread.sleep(100); rotateTicker(); this.repaint(); } catch (InterruptedException e) { e.printStackTrace(); } synchronized (this) { if (!isShowing()) { cont = false; } } } }
f029f981-d4ab-465e-9618-5ef37b68cb3f
9
@Override public UrlPair generateShortUrl(String longUrl) throws GenerateShortUrlFailureException { if (longUrl == null || longUrl.length() == 0) { throw new IllegalArgumentException("[generateShortUrl] longUrl is empty."); } /* If the UrlPair of the given longUrl has already existed, return it directly. */ ...
58731de4-80c5-4d2e-829b-386dfebdfdb8
5
private boolean modificaUsuario(HttpServletRequest request, HttpServletResponse response) { String nombre = request.getParameter("nombre"); String apellidos = request.getParameter("apellidos"); String dni = request.getParameter("dni"); String direccion = request.getParameter("direccion")...
82a07a24-0643-4368-94ae-b09641d60149
4
@Override public void tick(EnemyWave allEnemies) { super.tick(allEnemies); //send action to all objects for (Placeable obj : getPlacablesWithinRangeOfThisTower()) { if (!obj.equals(this)) { for (GameAction currentAction : getGameActions()) { i...
be8cfb58-0939-4115-843a-38d513eac639
8
private BufferedImage getCroppedImage( String innerPath, int x, int y, int w, int h) { Rectangle keyRect = new Rectangle( x, y, w, h ); BufferedImage result = null; HashMap<Rectangle, BufferedImage> cacheMap = cachedImages.get(innerPath); if ( cacheMap != null ) result = cacheMap.get(keyRect); if (result != n...
c27ef92c-e7ab-4438-979b-c8bcb03dba71
9
public Parameter getLiblinearParameters() throws MaltChainedException { Parameter param = new Parameter(SolverType.MCSVM_CS, 0.1, 0.1); String type = liblinearOptions.get("s"); if (type.equals("0")) { param.setSolverType(SolverType.L2R_LR); } else if (type.equals("1")) { param.setSolverType(SolverType....
0a65c979-3a52-4588-98e9-22e4ade5a363
3
public static final boolean AABB_AABB(Box a, Box b) { return b.x <= a.getXMax() && b.getXMax() >= a.x && b.y <= a.getYMax() && b.getYMax() >= a.y; }
b5637115-67b3-4ccb-9743-58f227093bff
1
public java.net.Socket openSocket(int socketId) throws IOException { if (Signlink.mainapp != null) { return Signlink.opensocket(socketId); } else { return new java.net.Socket(InetAddress.getByName(getCodeBase().getHost()), socketId); } }
1ac2c999-c7d2-44d3-9dc0-e8ca832a234a
9
public void setLocale(Locale locale) { if (locale == null || isCommitted()) return; _locale = locale; setHeader(HttpFields.__ContentLanguage,locale.toString().replace('_','-')); if (this._outputState==0) { /* get current MIM...
d77843d3-7562-4f34-87e3-b3d8680a6f0e
4
private void updateClient() { try { if(Long.parseLong(txtPhoneNo.getText()) != _client.getPhoneNo()) { if(_cliCtrl.getClientByPhone(Long.parseLong(txtPhoneNo.getText())) != null) { throw new Exception(); } } } catch (Exception e) { ...
fb6d44fa-b7eb-4f8d-b5dc-f0e92f4037a5
3
public static String full2HalfChange(String QJstr) throws Exception { StringBuffer outStrBuf = new StringBuffer(""); String Tstr = ""; byte[] b = null; for (int i = 0; i < QJstr.length(); i++) { Tstr = QJstr.substring(i, i + 1); // 全角空格转换成半角空格 if (Tst...
593bb6bb-ab29-426e-b218-97fcd6c924ed
3
public synchronized void endThreadAccess() { Object requestingUser = Thread.currentThread(); if (m_oCurrentUser == null) { this.notifyAll(); } else if (m_oCurrentUser == requestingUser) { m_oCurrentUser = null; this.notifyAll(); } else { // Some other ...
faee37a7-a48f-4edf-a593-d7f0c72355dc
6
public double[][] form() { //muodostaa alkutilanteen mukaisen 2D-arrayn for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { initialGrid[i][j] = tempInitial; if (i == 0) { initialGrid[i][j] = tempUp; } else i...
919b9102-846a-431e-bdc0-f0373fa1aef1
7
public void writeTermsToFile(String strNumber, Hashtable<String, Double> oTermVsTFIDF) throws IOException { String strKey = null; Double maxValue = Double.MIN_VALUE; String strTerms = ""; int len = oTermVsTFIDF.size() < 5 ? oTermVsTFIDF.size() : 5; for (int i = 0; i < len; ++i) { for (Map.Entry<String,...
5d6c507b-21e0-4447-b3e2-370c8bcb697b
3
public void setExpLogica(PExpLogica node) { if(this._expLogica_ != null) { this._expLogica_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.par...
6369bde8-15fc-4738-ae94-b1cd79779060
5
public boolean metodoCompare(Pessoa u ){ { if (this.end.equals(u.getEnd()) && this.nome.equals(u.getNome()) && this.login.equals(u.getLogin()) && this.senha.equals(u.getSenha()) &&this.instituicao.equals(getInstituicao())){ return true; } return false; } }
9883ee3b-e0a9-4b7f-aa1f-03aaf85b9a6a
7
public void collect() { if ( scannerData == null) return ; Vector fileList = scannerData.getFileList() ; fileList.clear() ; File file = new File( scannerData.getSourcePath() ) ; if ( file.exists() ) { Stack stack = new Stack() ; stack.push( file ) ; while ( !stack.e...
e8eb6874-5449-4c35-a874-6af0c58da1fd
8
private static BPRMF getBprmf(CommandLine cmd) { BPRMF bprmf = new BPRMF(); String learnRate = cmd.getOptionValue(CommandLineOptions.LEARNRATE); if (learnRate != null) { bprmf.setLearnRate(Float.parseFloat(learnRate)); } String iters = cmd.getOptionValue(CommandLine...
af711ade-a8f2-4387-b031-4662da3d2be7
0
public String getRHS() { return myRHS; }
a11f75e3-224c-4a60-922d-32798f9e2e7e
6
public static Cons optimizeOrderOfApplicableRules(Cons rules, boolean tailP) { { Cons cursor = rules; Cons result = Stella.NIL; Description antecedent = null; int antecedentindex = (tailP ? 0 : 1); if (rules.rest == Stella.NIL) { return (rules); } { int i = Stella.NULL_I...
6cd2c47e-320c-4ecd-8d54-01dcd9020e01
3
public List<VcfLof> parseLof() { String lofStr = getInfo(LossOfFunction.VCF_INFO_LOF_NAME); ArrayList<VcfLof> lofList = new ArrayList<VcfLof>(); if (lofStr == null || lofStr.isEmpty()) return lofList; // Split comma separated list String lofs[] = lofStr.split(","); for (String lof : lofs) lofList.add(n...
27871887-9227-4ab3-a2fa-d3929ca3217e
4
protected void assertEquals(String tekst, Object verwacht, Object werkelijk) { boolean gelijk; if (verwacht == null) { gelijk = werkelijk == null; } else { gelijk = werkelijk != null && verwacht.equals(werkelijk); } if (! gelijk) { if (! isPrin...
319af8d4-ad97-46c8-a145-f959cf3db6b7
3
public static boolean validateTimeZone(double timeZone) { int MIN_GMT = -12; int MAX_GMT = 13; if (timeZone < MIN_GMT || timeZone > MAX_GMT) { return false; } double decimal = timeZone - (int) timeZone; if (decimal >= 0.60) { return false; ...
482ea544-382b-430b-9aa0-90838b1d7011
3
public void drawBasicString(String string, int x, int y, int color) { if (string == null) { return; } y -= baseHeight; for (int index = 0; index < string.length(); index++) { char c = string.charAt(index); if (c != ' ') { drawCharacter(characterPixels[c], x + characterOffsetX[c], y + characterOffse...
72c75ecd-fbac-403e-8470-5f01b14ce52f
3
@Override public void deserialize(Buffer buf) { presetId = buf.readByte(); if (presetId < 0) throw new RuntimeException("Forbidden value on presetId = " + presetId + ", it doesn't respect the following condition : presetId < 0"); code = buf.readByte(); if (code < 0) ...
b30b8d5e-8e5b-41b3-82bd-f5d240b0b3b7
9
@SuppressWarnings("unchecked") private void collectCourseChanges(CourseModel model, ArrayList<Change> list) { // Copy list and prune ArrayList<HashMap<String, Object>> newCourses = new ArrayList<HashMap<String, Object>>(); for (Object c : courses) newCourses.add((HashMap<String, Object>) c); for (CourseRec...
0f146a13-01c3-45a9-9f57-298a3c021230
3
@Override public Class getColumnClass(int columnIndex) { if (columnIndex == 0) { return Person.class; } else if (columnIndex == 1 || columnIndex == 3) { return Integer.class; } return String.class; }
e32993c2-9247-4720-929c-8aafc0659845
4
private void playerStatusAction(Player user, PlayerStatusData actionData) { switch(actionData.getStatus()) { case GIVEUP: removePlayer(user, actionData); break; case FINANCIAL: for(Thread thread : actions.get(actionData.getUserId()).values()) { synchronized(thread) { if(thread.getState() ...
edad11a9-3ce6-4519-a63d-e7edf38fd061
1
public static void spawnHellSkeleton (Location loc, int amount) { int i = 0; while (i < amount) { Skeleton HS = (Skeleton) loc.getWorld().spawnEntity(loc, EntityType.SKELETON); LeatherArmorMeta legMeta; ItemStack HSLeg = new ItemStack(Material.LEAT...
aed1408f-85af-413b-a1c9-3893800dbee0
4
public static boolean isProperYoutubeChannel(String channelName) { try { URL url = new URL("http://gdata.youtube.com/feeds/base/users/" + channelName + "/uploads"); BufferedReader in = new BufferedReader( new InputStreamReader(url.openStream())); String i...
5d26a3dc-7a57-4bf8-9a25-775f0bca1f5f
0
public final void setV(final V v) { this.v = v; }
d212b0a9-cc03-4931-b6a6-009f8b7ff1b1
7
public boolean write(aos.apib.OutStream out, aos.apib.Base o) { HeartBeatTimer v = (HeartBeatTimer)o; int i = -1; while ((i = out.nextField(i, this)) >= 0) { switch (i) { case 0: out.putInt(v.peerID, i, __def.peerID, this); break; case 1: out.putInt(v.upload, i, __def.upload, this)...
7fb97e81-295e-49e2-a514-2f9188f58347
7
public boolean remove(Object o) { if (o == null) { for (int i = 0; i < size; i++) { if (taulu[i] == null) { int numMoved = size - i - 1; if (numMoved > 0) { System.arraycopy(taulu, i + 1, taulu, i, numMoved); ...
1e147f6d-bb73-4f2a-b0d9-8043ddcbf267
1
public static CanvasMouse getInstance(Component component) { if (instance == null) instance = new CanvasMouse(component); return instance; }
bec60c3d-b27d-459f-b703-733dc271174b
5
public static boolean idInArr(String[] param, String id) { boolean result = false; if ((param != null) && (param.length > 0) && (!isEmpty(id))) { int i = 0; for (int len = param.length; i < len; i++) { if (id.equals(param[i]) == true) { result = true; break; } }...
da7dcde9-0d7f-45ac-84b2-eb6c9a97c8dc
4
private static String executeRemoveCommand(DataBaseManager dbManager, Command command) { List<String> args = command.getArgs(); String tableName = args.get(0); String key = args.get(1); String msg = ""; try { boolean modified = dbManager.removeByKey(tableName, key);...
5f0d76c6-b22d-4be3-bdb9-55fc3c147db8
2
public static void main(String[] args) { String series = "73167176531330624919225119674426574742355349194934" + "96983520312774506326239578318016984801869478851843" + "85861560789112949495459501737958331952853208805511" + "12540698747158523863050715693290963295227443043557" + "668966489504452445231617...
0754b265-3c51-4372-bb6b-d0385e117b0d
8
private void updateWorkerDay(ACTION action, String imsi, long startTime, Set days) { int oldSize = days.size(); switch (action) { case ADD: days.add(startTime); break; case REMOVE: days.remove(startTime); break; ...
8e34ca1d-a976-48eb-8e8a-d8735a35b3a6
6
@Override public String toString() { String result = getName() + ", average=" + getAverage() + ", " + getProgram() + ", " + getDegree() + ", "; if (this.universityOne != null) result += this.universityOne + "-" + (this.universityOneAccept ? "admitted" : "rejected") ; if (this.universityTwo != null) ...