method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
466ef56a-ea65-4f70-9098-a4692a2ab51a
4
private IdentificadorVariavel completarIdVariavel(Identificador id) throws SemanticError, IdentificadorNaoDefinidoException { if(analisandoRegistro) return new IdentificadorVariavelCampoRegistro(id.getNome(), deslocamento++, tipoAtual); switch (tipoAtual) { case VETOR: return completarIdVariavelV...
bbf48cc8-96ff-4b5c-bf4a-010787f84dc1
0
@Override public void error(JoeException someException) { System.out.println(someException.getMessage()) ; this.errorOccurred = true; } // end method error
953bd603-407c-4920-a8b1-1f5a4e06b583
0
public void clearList(){ list.clear(); }
1bda0d06-55cb-4b63-a8b6-3e520359914d
2
@Override public void createFrom(int elementIndex, int numberOfPoints) { int size = 0; for(int i = 0; i<numberOfPoints; i++){ size = size + inData.getLength()/numberOfPoints; String[] array = new String[size]; for(int j = 0; j < size; j++ ){ array[...
f2b970b0-9db8-4e43-97d6-de4327a926d2
8
@Override public Word getMemoryCell(DCPU dcpu, OperandMode mode) { dcpu.getPc().inc(); final Word totalValue = dcpu.getRam(dcpu.getPc()).clone(); Register register; switch (this.value) { case 0x10: register = Register.A; break; ...
8250627c-2e85-4da4-b5af-cf808a792ea1
5
private static void go(boolean gotoColumn) { // Get a valid line number int lineNumber = 1; String lineNumberString = lineNumberTextField.getText(); if (lineNumberString == null) { return; } try { lineNumber = Integer.parseInt(lineNumberString); } catch (NumberFormatException nfe) { return; ...
3884a6ac-5b75-4f74-81a9-039b547fa434
7
public static String[] getResourceListing(Class c, String path) throws Exception { java.net.URL dirURL = c.getResource(path); if (dirURL != null && dirURL.getProtocol().equals("file")) { /* A file path: easy enough */ return new File(dirURL.toURI()).list(); } if ...
e6251df6-a062-4133-ad31-defbe067e1a2
3
public void delAll1(File file) { //确定出口 if (file.isFile() || (file.list().length == 0)) { file.delete(); } else { File[] files = file.listFiles(); for (File f : files) { delAll1(f); } //最后删除自己文件夹,最后的处理 System.out.println(file.delete()); } }
f92490bc-d38b-4ce1-aa22-b847820bdaf4
6
public List<List<Integer>> dfs(List<List<Integer>> result, List<Integer> line, int[] num, int index, int target) { if (target == 0) { result.add(line); return result; } if (index >= num.length || num[index] > target) return result; for (int i = index; i < num.length; i++) { if (i > index && n...
b99dbf7c-182a-43dc-b0b5-745b16bfb6cc
7
public void generateProfile() { File directory = new File(get("directory")); for (String lang: arglist) { File file = searchFile(directory, lang + "wiki-.*-abstract\\.xml.*"); if (file == null) { System.err.println("Not Found abstract xml : lang = " + lang); ...
b75cdbc5-a693-4c9f-833f-279009913cb0
7
public void playAudioStream(AudioInputStream audioInputStream) { // Audio format provides information like sample rate, size, channels. AudioFormat audioFormat = audioInputStream.getFormat(); System.out.println("Play input audio format=" + audioFormat); // Convert comp...
0c263928-887a-4e4c-9fe4-bddf50456ef4
1
private void LuoHahmo(double kentanLeveys, double kentanKorkeus, double sijainti) { double vartalonHalkaisija = 40; double raajanMaxPituus = vartalonHalkaisija * 2; osat = new ArrayList<KentallaOlija>(); raajat = new ArrayList<Raaja>(); double pallonKeskipiste = raajanM...
88a67da3-0475-482c-9c7e-a46be0d8013b
0
private void callStatement() { callExpression(); expect(Token.Kind.SEMICOLON); }
4ca1a8a5-6e21-4d53-bb31-9ba088fcb09d
2
public static int[] qualtityArray(Fastq fastq) { char qc[] = fastq.getQuality().toCharArray(); int q[] = new int[qc.length]; int min = (fastq.getVariant().isSanger() ? 33 : 64); for( int i = 0; i < qc.length; i++ ) q[i] = qc[i] - min; return q; }
36d5832c-3d47-40b8-a06f-3242bfe17167
0
public void setCsaCantidad(int csaCantidad) { this.csaCantidad = csaCantidad; }
0a613f23-085d-44b3-9a1f-3b1c0d846305
0
@Override public Iterator getKeys() { return current_values.keySet().iterator(); }
166fb617-51a7-4252-a34a-8ec2368df522
6
public static Node performMiniMax(Board b, int color, int depth, Response r) { Node root = new Node(b, Integer.MIN_VALUE); Node move = null; if (r.secondsleft > 60) { Future<Node> control = Executors.newSingleThreadExecutor().submit(new TimedJob(root, color, depth)); try { // Try to get the result with...
ac852394-3c2d-4ab3-9af0-c957c7482582
3
private V getFromFile(String file) throws NullPointerException { try { FileInputStream fileStream = new FileInputStream(file); ObjectInputStream objectStream = new ObjectInputStream(fileStream); V value = (V) objectStream.readObject(); fileStream.close(); ...
5ad7a0c2-3e66-488f-9c5d-31699b742704
9
@Override public void run() { byte[] buf = new byte[10000000]; DatagramPacket p = new DatagramPacket(buf, buf.length); while (true) { try { //System.out.println("Waiting request"); multiSocket.receive(p);// fica aguardando requisição. outra thread ...
ba505441-b6bf-4bfa-9e80-afc1a2de832c
8
public static ArrayList<Post> getAllPage() throws SQLException, NamingException { Connection conn = null; Statement stmt = null; ResultSet rs = null; ArrayList<Comment> comment = new ArrayList<Comment>(); ArrayList<Graffiti> graffiti = new ArrayList<Graffiti>(); DataSource ds = getDataSource(); Array...
725e55bf-b177-4acf-a5a9-2a3283c70c63
1
@SuppressWarnings("unchecked") public synchronized List<WayOsm> getWays(String codigo, List<Long> ids){ List<WayOsm> ways = new ArrayList<WayOsm>(); for (Long l: ids) ways.add(((WayOsm) getKeyFromValue((Map< String, Map <Object, Long>>) ((Object)totalWays), codigo, l))); ways.remove(null); return ways; ...
50adede7-146b-46a9-8ef3-5f6fce1ea397
6
public void close(){ if(this.requestWithFile != null && this.requestWithFile.isReadFile()){ FileTransfer fr = requestWithFile.getFileReceiver(); if(fr != null && !fr.finishWrite()){ fr.forceClose();// 强制关闭删除损害的文件 } } // 关闭连接 SocketChannel socketChannel = (SocketChannel) this.key.channel(); ...
082fb5c3-e05c-4d2b-9460-f724683ed43b
6
private Fundamental transformHelper() { String[] answer = this.resultString.split("\n"); // The first flag says if it is bounded, 0 -> Unbounded so we want a // UnknwonFundamental if (answer[0].equals("0")) { logger.info("Unbounded Fundamental Region computed. Returning UnkownFundamental instead"...
d11e1964-cd13-45ad-84e6-c2d407573aa8
5
private String removeFromParent(Rack rack) { for (int i = 1; i < aisleID; i++) { try { Aisle aisle = (Aisle) storage.find("A" + i); if (aisle == null) { i++; aisle = (Aisle) storage.find("A" + i); } ...
11990374-b7e5-47da-adfe-a10124281321
8
private boolean isItemInMarkupItem(Resource item, Set<Resource> visitedItems) { if (!visitedItems.contains(item)) { visitedItems.add(item); Set<Resource> subjects = model.listResourcesWithProperty(pitem_r, item).toSet(); subjects.addAll(model.listResourcesWithProperty(pfirstitem_r, item).toSet()); sub...
729438c1-4a5e-4047-831a-ea2486624e66
1
public static void resetPixels() { int total = Graphics2D.width * Graphics2D.height; for (int i = 0; i < total; i++) { Graphics2D.pixels[i] = 0; } }
7f9fbcf5-3058-4b67-af95-606b51e8be45
8
@Override public double[] computeValue(char refBase, FastaWindow window, AlignmentColumn col) { values[major] = 0.0; values[minor] = 0.0; int countMajor = 0; int countMinor = 0; if (col.getDepth() > 0) { calculateAlleles(col.getBases(), col.getDepth(), refBase...
f590c38d-749e-4fa8-b9ba-2e54c010e659
6
void readDir(String dirName) { filesByCellType = new AutoHashMap<String, ArrayList<String>>(new ArrayList<String>()); epiMarkByFile = new HashMap<String, String>(); // Read all files int countFiles = 0; File dir = new File(dirName); for (String file : dir.list()) { if (file.indexOf(".bed") > 0) { // Is ...
ca896489-5cef-4ef6-b069-54dd17a698b5
6
private int jjMoveStringLiteralDfa13_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(11, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(12, active0); return 13; } switch(curChar) { case 3...
1286d019-6b62-48ad-9def-d59c23c3523c
1
private static boolean insertEmployee(Employee bean, PreparedStatement stmt) throws SQLException{ stmt.setString(1, bean.getName()); stmt.setString(2, bean.getUsername()); stmt.setString(3, bean.getPass()); stmt.setDate(4, bean.getDob()); stmt.setString(5, bean.getPhone()); stmt.setString(6, bean.getAddr...
16896a2a-fb12-4db2-8088-eda2fc0a932f
5
private void algoritmo(){ Cromosoma mejor; int max = 1; for(int i = 0; i < individuos; ++i){ poblacion[i] = new Cromosoma(); poblacion[i].generarCodificacion(); } calcularAptitud(); ordenar(); mejor = mejor(); ++ciclo; while(ciclo <= 200...
d218314e-38b5-4f45-80c4-67af245c0111
7
public static Double absorbtivity(Double absorbtivity, Double molarAbsorbtivity, Double cuvetteWidth, Double concentration) { boolean[] nulls = new boolean[4]; nulls[0] = (absorbtivity == null); nulls[1] = (molarAbsorbtivity == null); nulls[2] = (cuvetteWidth == null); nulls[3] = (concentration == null); ...
9c65e205-f8fd-43a3-abea-120cb1951d3e
9
public Message parseMessage(String s) { //System.out.println(s); JSONObject data; JSONArray argdata; String[] args; try { data = new JSONObject(s); switch(data.getInt("type")) { case Message.TYPE_CHAT: return new STDMessage(this, data.getString("payload")); case Message.TYPE_USER: a...
1c4d04d0-71c6-4f99-adf8-1f256c8a6e66
0
public YamlPermissionWorld(String n, ConfigurationSection config) { super(n, config); }
dfd17d86-ffb6-4b6b-b29a-b8b02c113ec7
3
public void pageSearchAction() { PageSearchDialog pageSearchDialog = new PageSearchDialog(vermilionCascadeNotebook.getEditor().getShell()); pageSearchDialog.open(); PageSearchDialog.DialogResult dr = pageSearchDialog.getResult(); if (dr != null) { searchingText = dr.searchText; isCaseSensitive = dr.isC...
5c6cabbf-8c05-4a5b-ac40-45c3ab26b222
1
@Before public void dbPreserve(){ originalItemList=(ArrayList<Item>) ItemDAO.getInstance().getAllItems(); quantityList=new ArrayList<Integer>(); for (Item item : originalItemList){ quantityList.add(item.getQuantity()); } Main.clearTable(); }
19be962a-2aa2-4842-bbd9-8733107d2f12
9
@Override public void simpleUpdate(float tpf){ elapsedTime += tpf; //handle messages from server handleMessages(); /* for(int a=0;a<5;a++){ //ninjas[a].rotate(0, 2*tpf, 0); ninjas[a].move(tpf*2, 0, tpf*2); } */ // System.out.println("Amount of unit...
c99e2d76-1556-420b-bf58-8dbcd0f6bff2
9
@Override public boolean equals (Object obj) { if (!(obj instanceof TorrentMetaInfo)) return false; TorrentMetaInfo tmi = (TorrentMetaInfo) obj; boolean dateEq = (creationDate == null && tmi.creationDate == null) || (creationDate != null && creationD...
64632c62-b9cf-495a-ac48-4643df55c251
6
final void method3829(Class70 class70, int i, byte i_0_, boolean bool) { if (i_0_ == 80) { int i_1_ = 0; int i_2_ = i; int i_3_; while_232_: do { do { if (i_2_ != 1) { if (-3 != (i_2_ ^ 0xffffffff)) break; } else { i_3_ = 6; break while_232_; } ...
4ff755cc-a910-4e8d-958f-01e7e6a10089
3
public String getNumOfOdigoi(){ /* * epistefei ton arithmo twn odigwn ths vashs */ String num=null; try { pS = conn.prepareStatement("SELECT COUNT(*) AS num FROM odigoi"); rs=pS.executeQuery(); while(rs.next()){ num=rs.getString("num"); } } catch (SQLException e) { e.printStackTrace(); ...
0b8d5df8-0922-41ba-a369-7a4e28dee00a
2
private void resize(int chains) { SeparateChainingHashST<Key, Value> temp = new SeparateChainingHashST<Key, Value>(chains); for (int i = 0; i < M; i++) { for (Key key : st[i].keys()) { temp.put(key, st[i].get(key)); } } this.M = temp.M; thi...
20a4cb89-7fea-44c1-b095-b0ae6a31a6c8
5
public void swap(){ int x1=boton1.getBounds().x/30; int x2=boton2.getBounds().x/30; int y1=boton1.getBounds().y/30; int y2=boton2.getBounds().y/30; if((x1+y1)==(x2+y2) || (x1+y1-x2-y2)>1 || (x2+y2-x1-y2)>1){ boton1=null; boton2=null; presionado=0; return;} bloque aux=buttonMatrix[x1][y1]; b...
9f671b02-0ac9-49be-bfec-485aa52e5361
6
public static boolean createFunny(ConditionalBlock cb, StructuredBlock last) { if (cb.jump == null || !(cb.getInstruction() instanceof CompareUnaryOperator) || !(last.outer instanceof SequentialBlock) || !(last.outer.getSubBlocks()[0] instanceof IfThenElseBlock)) return false; CompareUnaryOperator ...
c45b589b-7981-4fcd-8e59-b16851d23054
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 AttributeEnumeration)) { return false; } AttributeEnumeration other = (AttributeEnumeration) object; if ((this....
cc23a9c3-589d-47b9-b5c0-d2c03fb2ca9d
6
@Override protected Value evaluate(ExecutionContext context) throws InterpretationException { Value val1 = ((AbsValueNode) this.getChildAt(0)).evaluate(context); Value val2 = ((AbsValueNode) this.getChildAt(1)).evaluate(context); if (val2.getType() == VariableType.STRING) { if ...
d68a393a-7887-4dd0-b9b6-fa391899d314
0
public static String formatBig(BigDecimal value, int minnum) { return format(value, minnum, false); }
caa0ad2a-e29a-4e27-b9a5-d31b0aad0645
1
protected void replaceCase(int index) { if(myLemma.replaceCase(tempDecomposition, tempI, index)) myMessage.setText("Case #" + (index + 1) + " replaced."); else myMessage.setText("Wrong case selected."); }
5c757946-e5b7-4be7-83ea-c8398c128699
8
public void processLocalKeyEvent(KeyEvent evt) { if (viewer.rfb != null && rfb.inNormalProtocol) { if (!inputEnabled) { if ((evt.getKeyChar() == 'r' || evt.getKeyChar() == 'R') && evt.getID() == KeyEvent.KEY_PRESSED ) { // Request screen update. try { rfb.writeFramebufferUpdateRequest(0, 0, r...
807c661d-21a6-4591-873d-b3454de6d1ef
9
public boolean enviarMail(String email, String passw, boolean envio) throws MessagingException { boolean ret = false; abrirBase(); LazyList<Email> emailsModel = Email.findAll(); if (!emailsModel.isEmpty() || !envio) { cerrarBase(); if (envio) { ab...
da034714-071a-43ac-9ac8-111351c090b3
2
public ArrayList<String[]> importData(String filepath){ BufferedReader buffReader = null; String line = ""; ArrayList<String[]> readPatterns = new ArrayList<String[]>(); try { buffReader = new BufferedReader(new FileReader(filepath)); while((line = buffReader.readLine()) != null){ String[] stringNu...
4bb4c1a5-1ab2-4d3d-a78b-8b624107e2a2
2
public GraphLine[] getSelectedLines() { ArrayList<GraphElement> buffer = new ArrayList(); Iterator<Map.Entry<Integer, GraphLine>> it = lines.entrySet().iterator(); GraphLine bgp; while (it.hasNext()) { bgp = it.next().getValue(); if (bgp.getComponent().getSelect(...
02bddd85-8f95-4afb-ac62-d1660e91b13c
6
private void filterPoints(int[] depthMap) { for (int x = 0; x < resx; x++) { for (int y = 0; y < resy; y++) { int i = x + y * resx; if (i % nthpoint == 0) { int z = depthMap[i]; if (z > minZ) { Vector3D v...
358cdaa2-cf6d-4213-805f-d22f62d15d59
6
public static void main(String args[]) { /* 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://down...
96f6fac8-26d9-4f35-aeef-02920c9a1fe1
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TimePeriod other = (TimePeriod) obj; if (this.id != other.id && (this.id == null || !this.id.equ...
a39a2530-ae9d-4d4b-b309-c9a82fcda931
3
public void loadIgnoredPlayers() { if (getConfig().contains("Ignore.players")) { List<String> ignored = getConfig().getStringList("Ignore.players"); if (ignored.size() > 0) { Iterator<String> i = ignored.iterator(); while (i.hasNext()) { String thisLine = i.next(); ignoredPlayers.add(thisLine)...
6cf7fe24-a309-4151-915e-9456093f0d1d
9
public static LinkedList<Object> readCSV(){ String filePath = "rundata.csv"; BufferedReader br = null; String line = ""; String csvSplit = ","; LinkedList<Object> days = new LinkedList<Object>(); LinkedList<Object> currDay = null; //Take note, when returned the first element is a Event currEvent = null; ...
5811ab03-e13b-40d3-a5f7-d517cb82d05b
2
public static void BottomUpMergeSort(Comparable[] a) { Comparable[] aux = new Comparable[a.length]; for (int i = 1; i < aux.length; i += i) { for (int j = 0; j < aux.length - i; j += i + i) { merge(a, aux, j, i + j - 1, Math.min(j + i + i - 1, aux.leng...
d3516b01-6617-4e1d-bb0a-243bba3abe29
7
@Override public void update() { bg.update(); if(KeyHandler.isPressed(Keys.KEY_ENTER)) selectOption(); if(KeyHandler.isPressed(Keys.KEY_UP) || KeyHandler.isPressed(Keys.KEY_W)){ currentChoice--; if(currentChoice == -1) currentChoice = options.length - 1; } ...
9556c939-17ab-4040-8767-1928b6ba5fad
4
private static boolean isEqual(String str,String[] array){ if(null == array || array.length < 0 ) return false; for(String t : array){ if(t.equalsIgnoreCase(str)) return true; else continue; } return false; }
bcfbbb03-3ff0-4dc1-b8b3-34bb8cb61dda
9
public void execute() throws InterruptedException { final NPC mob = getBestExperiment(); final Player player = client.getMyPlayer(); if (mob != null) { if (mob.getPosition().distance(player.getPosition()) > 7 && !player.isMoving()) { if (!player.isUnderAttack()) { if (walk(mob.getPosition(...
ec0ce3fa-4423-4765-8839-8d2d1cfee7a6
5
public static String stringZip(String inputstr){ String outputstr=""; int tempCount=1; if(inputstr.length() == 0) return outputstr; char preChar=inputstr.charAt(0); for(int i=1;i<inputstr.length();i++){ if(inputstr.charAt(i) == preChar) tempCount++; else { if(tempCount > 1) outputstr+=tempC...
46908adc-76f6-4a3c-a426-a34b82fef8f2
1
public void insert(Connection conn) throws SQLException { if (isValid()) { PreparedStatement stmt = conn.prepareStatement("INSERT INTO crmcorporations VALUES (?, ?, ?, ?)"); stmt.setInt(1, id); stmt.setString(2, name); stmt.setString(3, address); stmt.setString(4, email); stmt.execute(); } }
57a7662a-f8ab-43cd-a4a6-c84ac0b6ff13
5
private void renderVisibleObjects(Graphics g) { for (VisibleObject object : objectsToRender) { if (!(object instanceof AnimationBasedVisualEffect)) { object.render(g); } } for (VisibleObject object : objectsToRender) { if (object instanceof AnimationBasedVisualEffect) { object.render(g); ...
f3e640aa-846b-4c10-9a00-0e3eba19bbc2
2
static void checkSignedShort(final int value, final String msg) { if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { throw new IllegalArgumentException(msg + " (must be a signed short): " + value); } }
c8fc0fcb-69f9-4974-bf59-b6926ef7eb86
1
public Log generate(int n){ List<Record> records = new ArrayList<Record>(); RecordGen recordGen = new RecordGen(); for (int i=0; i<n; i++){ records.add(recordGen.generate()); } return new Log(records); }
c7f8469b-8da2-4e77-a93b-b609d128c2a9
8
private void configure(final JDialog configDialog, final int portNumber) { try { Utils.logToConsole("Performing port configuration"); if (!Utils.selectConfigSection(configDialog, new String[] {"API","Settings"})) // older versions of TWS don't have the Settin...
01a10098-e875-40a0-8842-33abcd67b715
7
public static void initializeLabels(Label[] label) { /* * Iterate through the labels */ int[] statementList={4,7,8,28,13,14,27,24,26,36,38}; int[] identifierAssignedList={2,5,12,20,25,29}; int[] identifierInlineList={9,15,21,30,37}; int nLabels=label.length; for(int i=0;i<nLabels;i++) {...
82461d60-e42a-4c6a-a68f-f407cc6d8d11
7
private Entry parseEntry(Element rootEntryElement) { Entry rEntry = new Entry(); rEntry.setDate(rootEntryElement.getAttribute("date")); NodeList entryNodes = rootEntryElement.getChildNodes(); for (int i = 0; i < entryNodes.getLength(); i++) { // Changing all children...
71b483b6-2f0d-4dd3-8bef-735661795357
5
private static Field makeNewField(Menu menuElement) { Field field; switch (menuElement) { case SmallField: field = new Field(10, 10, 10); break; case MediumField: field = new Field(15, 30, 40); break; cas...
2a7e1464-2889-4da5-a301-bcf7430baa84
1
public void setRight(boolean b) { right = b; if(left) left = !b; // facingRight = b; }
47952267-0f8b-4615-b6a0-e1f7340ee9ab
8
public static int parseDirection(int deltaX, int deltaY) { if (deltaX < 0) { if (deltaY < 0) { return 5; } else if (deltaY > 0) { return 0; } else { return 3; } } else if (deltaX > 0) { if (deltaY < 0) { return 7; } else if (deltaY > 0) { return 2; } else { return 4; ...
735e6d3c-cc25-4ddf-93f5-befcb36a4246
1
private void assertThatWeeklyTotalIsEqualToBudgetBreakdownValue(BigDecimal expected, BigDecimal actual) { System.out.println("Expected Value: " + expected); System.out.println("Actual Value: " + actual); if(!actual.equals(expected)) { fail("TotalMoneyAvailableWeekly should be calcu...
9b8276b4-a009-46f4-ae86-9e79c571e76a
2
private void handleUpdate() { // We can simplify this when we move more methods into the Preference Interface. if (pref instanceof PreferenceStringList) { // Update pref PreferenceStringList prefStringList = (PreferenceStringList) pref; String text = list.getText(); StringList stringList = new S...
6f24b096-41e5-46ca-9eea-3a1c73b6de88
9
protected long freePhysTake(int size, boolean ensureAvail, boolean recursive) { assert(structuralLock.isHeldByCurrentThread()); assert(size>0); //check free space if(spaceReclaimReuse){ long ret = longStackTake(size2ListIoRecid(size),recursive); if(ret!=0){ ...
9d292490-2679-459f-856b-245736c5916d
6
protected StringBuffer renderWrappedText(StringBuffer sb, int width, int nextLineTabStop, String text) { int pos = findWrapPos(text, width, 0); if (pos == -1) { sb.append(rtrim(text)); return sb; } sb.app...
492c4be4-7f5d-44b5-be47-153002f39498
2
public boolean hasPermission(Permission p){ if(permsList.contains(p))return true; if(p.equals(Permission.magical))return true; return false; }
3904e462-a65f-4a95-a3ba-49ae004561b7
5
public Game(char [][] b) { //JFrame constructor which puts the //current game number in the title super("Sym4 Game " + gamesPlayed); //get content pane and set layout contents = getContentPane(); contents.setLayout(new BorderLayout(55,50)); //create individual gridlayouts for different //sections of...
26eea5e3-ab65-46b9-92c6-25e7ad4c0bac
3
public void locateWindows() { // Exit if (!locatingWindows) { return; } for (final Locatable window : locatableWindows) { Rectangle position = deserializeWindowPosition(window); final Rectangle defaultPosition = getDefaultPositionValues(window); if (position == null) { position = defaultPositi...
cfa69308-0e4d-414b-affc-9822ff34187a
7
private void loadInfo(String name) { FileReader baseSave = null; try { charCount = (new File(name + ".rcf")).length(); charCount = (long) 1.25*charCount; baseSave = new FileReader(name + ".rcf"); //Read the header if(!readTill(';',baseSave).equals("Server Info")) { baseSave.close(); lo...
7dc4b439-799d-468b-9f82-83b7ee4723fc
5
public int longestConsecutive(int[] num) { map.clear(); heads.clear(); for (int n : num) { if (map.containsKey(n)) continue; ListNode node = new ListNode(n); map.put(n, node); node.next = null; if (map.containsKey(n +...
976123a6-67c3-4b14-9007-417aca07ec71
7
private static int[] getColor() { int[] color = { 0xFF111111, 0xFFD50000, 0xFFFFFFFF }; switch (random.nextInt(8)) { case 0: { // red color color[1] = 0xFFD50000; break; } case 1: { // yellow color color[1] = 0xFFFFF115; break; } case 2: { // blue color color[1] = 0xFF6997FF; b...
bb64e1d0-fded-49d8-82eb-9f1ff76a7da0
9
protected boolean bruteForceForPath(Place currentPlace, Place destinationPlace, LinkedList<Road> path, HashMap<String, Boolean> vis, int[] minLength, int currentLength) { String current = new String(currentPlace.getName()); String destination = new String(destinationPlace.getName()); String expectedKey = current...
508f9270-980f-42ca-90cb-22bb759f9ee1
6
public static boolean containsWordsFromDict(String s, String[] dict) { boolean[] contains = new boolean[s.length()+1]; contains[0] = true; for( int i = 0; i< s.length(); i++) { if(!contains[i]) { continue; } for(String word : dict) { ...
9a97fe11-0910-4ef4-9f09-6fde5b9d6162
3
public void func_860_a() { if(this.field_1235_h) { if(!this.field_1234_i) { this.field_1236_g.flip(); this.field_1234_i = true; } if(this.field_1236_g.remaining() > 0) { GL11.glPushMatrix(); GL11.glTranslatef((float)this.field_1242_a - th...
def6c63e-ccf6-40a4-8090-d6a4cb758870
9
@POST @Path("/{repoName}/{fileName}/issue") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) public String submitIssue( @PathParam("repoName") String repoName, @PathParam("fileName") String fileName, @FormDataParam("battleScribeVersion")...
bdcae947-dd7d-4e67-af1b-576945d0dcc8
4
@Test public void testArrayListLong() { long minTime = Long.MAX_VALUE; long maxTime = Long.MIN_VALUE; long avgTime = 0; long beforeTime = 0; long afterTime = 0; long curTime = 0; Random random = new Random(); int value; AbstractProcessor<Long>...
217668f5-7792-4322-8c3c-5b5809b51b0c
6
private String needMessage(int meetLevel) { meetLevel = Visit.clamp(meetLevel, HoldingUpgrades.NUM_LEVELS) ; final Object met = HoldingUpgrades.NEEDS_MET ; final Object access = HoldingUpgrades.checkAccess (this, meetLevel, true), materials = HoldingUpgrades.checkMaterials(this, meetLevel, ...
020b7653-543e-4db8-b45d-be0162a4fc31
0
@Override protected void setColoredExes() { coloredEx = LineGenerator.WuAlgorithm(begin, end); }
119ab4f3-f2d9-4284-b19e-2c0a8fd05220
6
private Table createTable(Connection conn, ResultSet rs) throws SQLException { String tableName = rs.getString("TABLE_NAME"); String tableType = rs.getString("TABLE_TYPE"); String remarks = rs.getString("REMARKS"); if (StringUtil.isNullOrEmpty(remarks)) { String sql = "select TABLE_COMMENT from information_s...
d7602b3a-80e1-484d-8d90-b1bcea970be5
2
protected void hypothesizeUseless(GrammarEnvironment env, Grammar g) { UselessProductionRemover remover = new UselessProductionRemover(); Grammar g2 = UselessProductionRemover .getUselessProductionlessGrammar(g); if (g2.getTerminals().length==0) { JOptionPane.showMessageDialog(env, "Error : Th...
bd1b65c8-84d7-45a8-a356-c172b8454eb2
9
void sort(int[] a) throws Exception { for (int i = a.length; --i>=0; ) for (int j = 0; j<i; j++) { if (stopRequested) { return; } if (a[j] > a[j+1]) { int T = a[j]; a[j] = a[j+1]; a[j+1] = T; } pause(i,j); } }
40e49d9a-1e5e-4093-b6b3-841862402e6d
3
public void printWorld() { System.out.println(height); System.out.println(width); for (int i = 0; i < height; i++) { if (i % 2 == 1) { //odd row System.out.print(" "); } for (int j = 0; j < width; j++) { System.out.print(cells[...
d8a7fec3-32e4-4432-8bbe-44a3a6779350
8
public void visit_istore(final Instruction inst) { final int index = ((LocalVariable) inst.operand()).index(); if (index + 1 > maxLocals) { maxLocals = index + 1; } if (inst.useSlow()) { if (index < 256) { addOpcode(Opcode.opc_istore); addByte(index); } else { addOpcode(Opcode.opc_wide); ...
f3506142-8c22-41e0-abf7-3b7032cedec4
5
public void WorldChecker(Block chest, Player player, Boolean respawn) { Chest chestc = (Chest)chest.getState(); if ((!this.pl.chest.containsKey(chest.getLocation())) && (!BlockChecker(player, Integer.valueOf(chest.getLocation().getBlockX()), Integer.valueOf(chest.getLocation().getBlockY()), Integer.valueOf(chest.ge...
9c0ecc26-64a6-43c6-8125-a6d43b9e7c8b
6
private static void savePort(ConfigurationSection maincs, Port port) { ConfigurationSection cs = maincs.createSection(port.getName()); cs.set("srcCorner1", getLocString(port.getSrcLowerCorner())); cs.set("srcCorner2", getLocString(port.getSrcUpperCorner())); cs.set("destination", getLocString(port.getDestinati...
6ab69c56-d225-49fb-b010-98b4dea6b361
4
public static String shorten(float f, int decimals) { if (Math.abs(f) < 0.1f) return "0" ; final boolean neg = f < 0 ; if (neg) f *= -1 ; final int i = (int) f ; final float r = f - i ; if (r == 0) return ""+i ; final String fraction = r+"" ; final int trim = Math.min(decimals + 2, fract...
c414eb27-15a4-413b-bc66-7885c8fb414d
2
public void setShortMessageFont(String font) { if ((font == null) || font.equals("")) { this.shortMessageFont = UIFontInits.SHORTMESSAGE.getFont(); } else { this.shortMessageFont = font; } somethingChanged(); }
5d21e2a3-64e5-4bbc-afba-07b4ab1c8e69
0
@Override public String toString() { return "TableColumnDesc [field=" + field + ", type=" + type + ", isNull=" + isNull + ", isKey=" + isKey + ", default_=" + default_ + ", extra=" + extra + "]"; }
c9c30135-803e-4850-90f2-a9d970717847
6
public ArrayList<ArrayList<Integer>> levelOrderBottom(TreeNode root) { // Start typing your Java solution below // DO NOT write main() function ArrayList<ArrayList<Integer>> resArr = new ArrayList<ArrayList<Integer>>(); if (root == null) return resArr; Queue<TreeNode> pre = new LinkedList<TreeNode>(); Ar...
071a10c7-0f12-47c8-b750-34c27cf7ab4d
7
public void process() { Item[] items = player.getEquipment().getItems().getItems(); for (int slot = 0; slot < items.length; slot++) { Item item = items[slot]; if (item == null) continue; if (player.getAttackedByDelay() > Utils.currentTimeMillis()) { int newId = ItemConstants.getDegradeItemWhenComba...