method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3af0f869-9963-47ba-96e4-07a822b59f59
6
private static Double getType(int i) { switch (i) { case 1: return 1.0; case 2: return 1.3; case 3: return 1.6; case 4: return 2.0; case 5: return 2.4; case 6: return 2.7; default: return 0.0; } }
d6a588e0-1ba1-4d43-b48c-4357df9fe10e
5
public Object [][] getDatos(){ Object[][] data = new String[getCantidadElementos()][colum_names.length]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (colum_names.length>=0){ r_con.Connection(); String c...
acb0b398-f926-42b2-8352-7482becaed87
0
public Double getTimePeriod() { return timePeriod; }
cb569ca4-69be-4ac0-8e83-1e5f3905e96d
7
final void delete(int index) { if (!isNominal() && !isString() && !isRelationValued()) throw new IllegalArgumentException("Can only remove value of " + "nominal, string or relation-" + " valued attribute!"); else { ...
8d46d753-57c6-4a35-999b-7e73a9b67b73
4
public static Path writeMatrix(double[][] matrix, Path path, HamaConfiguration conf) { SequenceFile.Writer writer = null; try { FileSystem fs = FileSystem.get(conf); writer = new SequenceFile.Writer(fs, conf, path, IntWritable.class, VectorWritable.class); for (int i = 0; i < matrix.length; i++) { ...
c1c79d70-6db6-4f0d-a979-879237e409e5
1
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); response.setContentType("application/json"); String date = request.getParameter("date"); // format must be yyyy-mm-dd String city = request.getParamet...
9f883c8c-dadb-43dd-a084-4d3a2cc5e7b7
8
public static String checkUser(String u_name, String u_pwd) { String result = null; Connection con = DBUtil.getConnection(); Statement st = null; ResultSet rs = null; try { st = con.createStatement();// 创建语句 rs = st.executeQuery("select uid from mstx_user where u_name = '" + u_name + "' and u_pwd = '" +...
0f3e913f-a452-48bf-892d-be637c3bc4d5
5
private static Node maxValue(Node n, int color, int depth, int alpha, int beta) { // Test if we have hit the max depth, or if the node has a state of solved if (depth <= 0 || n.b.gameIsOver()) { return n; } Node a = new Node(); a.evaluation = alpha; int opponentColor = Board.opponentColor(color); Arr...
35f2cbaa-02e0-473b-b13d-15847ff408d5
5
public <N, T> void setValue(TKey<N, T> key, List<QualifiedValue<T>> values) { List<QualifiedValue<?>> oldValues = fields.get(key); if (oldValues != null) { throw new IllegalArgumentException( "setValue should only be called be called once per tkey"); } if ...
a22158f4-c89a-4d6e-9732-4c819f2d2799
9
public static boolean containsPackage(String o) { return CS.contains(o) || o.startsWith("java") || o.startsWith("javax") || o.startsWith("com.sun") || o.startsWith("sun") || o.startsWith("oracle") || o.startsWith("com.oracle") || o.startsWith("org.xml") || o.startsWith("org....
9d956e83-b752-4c75-97b9-1f196363b1bd
4
public List<String> toBag(String query) { Preconditions.checkNotNull(query); List<String> ls = Lists.newArrayList(); String prev = null; for (String term : SPLITTER.split(Dictionary.applyReplacements(query))) { String x = checker.correct(simplify(term)); String ...
a4eb8a55-2f0d-4fbb-8eb1-59ca3347dd3f
0
@Override public ArrayList<Excel> getColoredExes() { return coloredEx; }
9b32e482-9f9f-4f2b-ab4d-5c5c5be7008e
1
private void notifyOfRowsWillBeRemoved(Row[] rows) { for (OutlineModelListener listener : getCurrentListeners()) { listener.rowsWillBeRemoved(this, rows); } }
032fc71c-f61d-4941-a6c3-c92d677526ac
3
public static void updateBD(Object[] what) { // TODO: en la interfaz debe preguntarse qué partes quiere poner. //Object[] what; boolean conexion = (boolean) what[0]; String usuarioBD = (String) what[1]; String passwdBD = (String) what[2]; String conexionBD = (String) what[3]; ArrayList tablaUpdate = (Arr...
beb526a6-51e7-4634-839f-f9f0b16b4da3
0
public void mouseEntered(MouseEvent e) {}
1f157fba-60a8-4650-8d30-2a48a7697ff8
7
public Node[] twoOpt(Graph graph, Node[] tour, double deadline) { boolean hasChanged = true; while (hasChanged) { hasChanged = false; for (int i = 0; i < tour.length - 1; i++) { Node u1 = tour[i]; Node u2 = tour[i + 1]; Node v1 = null; Node v2 = null; for (int j = i + 2; j < tour.length -...
674f64b6-0f25-4e6d-926f-5dd31013fbe5
3
@Override public List<Categoria> ListByNome(String descricao) { Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; List<Categoria> categorias = new ArrayList<>(); try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepa...
4f26cfb5-4ad0-467f-a1e2-8fe4e53381de
5
private boolean duplicateFieldDefined(String line) { String[] splitLine = line.split("(?=[^a-zA-Z0-9])|(?<=[^a-zA-Z0-9])"); ArrayList<String> test = new ArrayList<String>(); for(String str : splitLine) if(Assembler.isAlphaNumeric(str)) test.add(str); for (int j=0;j<test.size();j++) { for (...
474ae08c-771b-44c2-82a3-69877bbff497
4
public Sprite(String filename, int numberOfImages, int originX, int originY) { // Checks the variables if (filename == null || numberOfImages <= 0) throw new IllegalArgumentException(); // Initializes attributes this.origX = originX; this.origY = originY; this.dead = false; // Loads the image ...
cef5d9aa-4a44-4805-a60a-0f4ea9a2e77c
9
private void logic1(){ int floorCounter = 0; while(this.getCustomersInTransit()>0){ int current = this.getElevator().getCurrentFloor(); System.out.print(current+": "); for(Customer cust : this.customerList){ if(!cust.getFinished()){ if( !cust.getInElevator() && current == cust.getStart()){ ...
99428a44-5d1b-42b9-8caf-47b7a123e925
7
@Test public void testChangeNameOfProperty() throws Exception { // connect to database PersistenceManager pm = new PersistenceManager(driver, database, login, password); // drop all tables pm.dropTable(Object.class); // create test objects OriginalObject oo = new OriginalObject(); oo.setValue(76); Co...
f9ad567f-b6a2-4b97-9d3a-b950c16d100c
2
public void randDnaSeqTest(int numTests, int lenMask, long seed) { Random rand = new Random(seed); for( int t = 0; t < numTests; t++ ) { String seq = ""; int len = (rand.nextInt() & lenMask) + 10; // Randomly select sequence length seq = randSeq(len, rand); // Create a random sequence if( verbose ) Sy...
22932c1b-2309-4da7-ac1f-84b8b9901464
8
public static Cons javaTranslateUnit(TranslationUnit unit) { { Symbol testValue000 = unit.category; if (testValue000 == Stella.SYM_STELLA_GLOBAL_VARIABLE) { return (TranslationUnit.javaTranslateDefineGlobalVariableUnit(unit)); } else if (testValue000 == Stella.SYM_STELLA_CLASS) { ...
de7147f8-6166-4940-adf6-770e4accf723
8
public void read() throws Exception { System.out.println(name+"\n{"); if (data == null && file != null) { readFileData(); } magic |= ((byte) data.get() & 0xCA) << 24; magic |= ((byte) data.get() & 0xFE) << 16; magic |= ((byte) data.get() & 0xBA) << 8; magic |= ((byte) data.get() & 0xBE); if (magic...
563f36ed-9dad-4a70-b9b5-4b6371aae269
5
private void removed (DeviceImpl dev) { if (Windows.trace) System.err.println ("notify remove " + dev); // call synch'd on devices for (int i = 0; i < listeners.size (); i++) { USBListener listener; listener = (USBListener) listeners.elementAt (i); try { listener.deviceRemoved (dev); ...
6ab41481-5006-4cf2-9536-3d716aa4700c
8
int inflateSync() { int n; // number of bytes to look at int p; // pointer to bytes int m; // number of marker bytes found in a row long r, w; // temporaries to save total_in and total_out // set up if (z == null) return Z_STREAM_ERROR; if (this.mode != BAD) { this.mode = BAD; this.marker = 0; ...
e363b97d-1d45-41a7-ac97-4e8f5bdb2054
2
private void setTopPanel() { FlowLayout fl = new FlowLayout(); GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); JPanel topPanel = new JPanel(gbl), temp = new JPanel(fl); //slider.setBorder(new TitledBorder("Percentage Zoom")); rcb.addItemListener(this); back.addAc...
a3bd4bb6-2312-4422-80ba-0ce036d54354
5
@RequestMapping(value="/USER.do", method=RequestMethod.POST) public String doActions(@ModelAttribute USER USER, BindingResult result, @RequestParam String action, Map<String, Object> map){ USER USERResult = new USER(); switch(action.toLowerCase()){ case "add": USERService.add(USER); USERResult = USER; b...
3c40a1ff-250e-4919-acfb-a1e99149bb0a
8
public static void main(String args[]) throws ParseException { File myFile; if(args.length > 0) { myFile = new File(args[0]); } else { myFile = new File("./t1.c"); } FileReader fr; if(myFile.exists()){ try { ...
e8231aea-4d60-4483-ae27-16062b40ab9c
5
private int calcSize(String name, String desc, Output output) { int out = 0; out += 2; out += name.length(); out += 2; out += 4; out += 4; out += 1; out += desc.length(); out += 2; for (Tile tile : output.getTilesArray().values()) { out += 5; if (compression) { if (!(tile.floor == 1 && til...
06a4f013-dac6-474c-87f7-e8a07dead1e7
9
public List<String> findWords(char[][] board, String[] words) { if (board.length == 0 || board[0].length == 0 || words.length == 0) { return new ArrayList<String>(); } TrieNode root = new TrieNode(false); for (String word : words) { char[] str = word.toCharArray(); TrieNode cur = root; for (int i = ...
5a2c704a-cca7-4413-9654-7bf3cc949f39
6
private void sendHandshake() throws InvalidHandshakeException { String path; String part1 = uri.getPath(); String part2 = uri.getQuery(); if( part1 == null || part1.length() == 0 ) path = "/"; else path = part1; if( part2 != null ) path += "?" + part2; int port = getPort(); String host = uri.ge...
ba90cdbe-a621-491d-9cd3-21d8e464fe46
7
public static void makeCompactGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout) parent.getLayout(); } catch (ClassCastException exc) { System.err.println("The first argument to m...
5dc74d57-d30c-49ca-add4-9acb39ec8041
9
private String getTypeChar() { String typeC; switch (type) { case TYPE_6_NUM: typeC = TYPE_6; break; case TYPE_7_NUM: typeC = TYPE_7; break; case TYPE_8_NUM: typeC = TYPE_8; ...
ad611fc1-467c-47e1-a117-2799904bc528
8
public static void BitFilter(BufferedWrapper bw, int type) { BufferedImage temp = bw.Clone(); int w_Squares, h_Squares, s; Color c; switch (type) { //============================================================================ //==== 16-Bit ...
926d7f07-1e42-48b3-a764-6384b38e32c7
1
public String return_ascii (String msg) { char c; int j; String result=""; for ( int i = 0; i < msg.length(); ++i ) { c = msg.charAt( i ); j = (int) c; //System.out.print(j); result+=j; } return result; }
64992653-4f10-4d74-b0dc-8db4dddad88a
6
public static Polygon multiplyLines(Polygon p, int times) { if (times < 2) return p; Polygon ret = new Polygon(); ret.setClosed(p.closed()); for (int i = 0; i < p.getPointCount(); i++) { float[] point = p.getPoint(i); float[] pointNext = i < p.getPointCount()-1 ? p.getPoint(i+1) : (p.closed() ? p.ge...
f3f3a560-93b3-42fe-b2c0-618b1fde086d
2
public List<String> getCitationPapers(int id) { List<String> list = new ArrayList<>(); String query = "select citationids from citationlist where paperid=" + id; ResultSet rsSet = null; rsSet = sqLconnection.Query(query); try { while (rsSet.next()) { String citation = rsSet.getString("citationids")...
8d645469-cc1b-4ec8-b497-f4b2dab7f75e
3
public static void main (String args[]) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); while (true) { String line = reader.readLine(); if (line == null || line.length() == 0) { break; } Str...
2a06cf31-df60-403b-a274-873059d39a5b
7
public void insert(String[] columns, String[] values) throws SQLException { Map<String, String> data = new HashMap<String, String>(); for (int i=0; i < columns.length; i++) { Field field = description.findField(columns[i]); if (field.isUnique()) { if (!select(new Equals(columns[i], values[i])).isEmpty(...
1ee1b5e4-947a-41ce-b8b4-1a51dfef86a0
7
* @param cs a <code>ChangeSet</code> value */ private void csDamageBuilding(Building building, ChangeSet cs) { Colony colony = building.getColony(); if (building.getType().getUpgradesFrom() == null) { // Eject units to any available work location. unit: for (Unit u : bui...
2f63844c-d658-47e5-9b1d-96f9f667ac21
6
final AnimatableToolkit method3565(int i, int i_16_, int i_17_, int i_18_, boolean bool, AbstractToolkit var_ha, int i_19_, int i_20_, int i_21_, AnimationLoader class87, s var_s, int i_22_, s var_s_23_) { try { anInt4496++; if (i_21_ != -129) method3566(null, 36, -84, null, 43, nul...
affc1448-b04b-4646-8287-07516480248c
3
@Override public void display(Boolean showCorrect) { System.out.println(prompt); int count = 1; for (String item: choices){ System.out.println("\t"+count+"). "+item); ++count; } if (answers.size()>0 && showCorrect){ System.out.println("The answers are: " + answers.toString()); } }
542b98d7-3ccb-43f5-88b4-7b3fc45d5053
5
public DatagramSocket connection(String name, String address, int port) { this.name = name; this.address = address; this.port = port; System.out.println("In method 'Connection' - here"); // boolean connect = initiateConnection(address, port); ...
725489b4-0e55-4e8e-8ad2-77f792a9c9e0
4
public void saveAs() { String fileName; fileName = chooseFile( Constantes.SAVE ); if (fileName == null) return; this.setSave ( true ); AnalyseFilter af = getAnalyseFilter(); if (Utilities.getExtension(fileName).equals("")) this.fileName = ...
aff5a1ed-152f-46ae-83c2-237996d4da9d
2
public void printOdds() { InnerOddsIterator iterator = this.new InnerOddsIterator(); while (iterator.hasNext()) { int returnValue = iterator.getNext(); if (returnValue != -1) { System.out.print(returnValue + " "); } } }
d2a6738e-b483-43c5-af51-37a455c60770
3
public int [] getLanguages () throws IOException { synchronized (lock) { if (!checkedStrings) languages = ControlMessage.getLanguages (this); checkedStrings = true; //if don't set this can get repetitive lookup failures? -- Wayne Westerman } if (languages == null) return null; int ...
030e12e6-ebbe-48aa-8e9e-481543c82c13
5
private void handleQueryReservation(Sim_event ev) { int src = -1; // the sender id boolean success = false; int tag = -1; try { // id[0] = resID, [1] = reservID, [2] = trans ID, [3] = sender ID int[] obj = ( int[] ) ev.get_data(); int re...
c0fc4c4a-80e8-4032-a351-56db252095b5
1
public boolean isMoving() { Moving m = gob().getattr(Moving.class); if(m == null) return false; else return true; }
6701fd67-19a6-42db-9859-f21fa2d5136e
0
public void set(int value) { _led.setRaw(value); }
860da6d7-5185-44c3-a969-6d4123277282
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...
53a16aba-17ec-47e2-8d96-00513dd0b12e
6
public ClassFile clone() { ClassFile res=null; try { res=(ClassFile)super.clone(); // clone all primitive members // clone containers res.Items=new HashMap<Object,Integer>(res.Items); res.UTFs=new HashMap<String,Integer>(res.UTFs); res.paramsVars=(int [])res.paramsVars.clone(); ...
8a6b86dd-b5ec-412f-aa59-fd401e5efa4e
4
public int findNodeWithHighestScore(int node) { int highestScore = 0; int nextNode = 0; boolean found = false; for (List<Integer> list : graph) { if (list.get(1) == node) { int score = list.get(2); if (score > highestScore) { ...
b72e36a2-be29-4d98-8395-1f9eb1347bca
4
private static void visitSpecialVal(MemoryStateCreator mem, SpecialValContext tree) { switch (tree.getText()) { case "SP": mem.addSp(); break; case "PC": mem.addPc(); break; case "POP": mem.addPop(); break; case "PEEK": mem.addPeek(); break; } }
22bab020-8889-4194-8ee5-0f9f31a945d4
9
public static String generate(PasswordGeneratRequest req) { String domainName = req.getDomainName(); String securityQuestion = req.getSecurityQuestion(); String securityAnswer = req.getSecurityAnswer(); String birthday = req.getBirthday(); String passwordLength = req.getPasswordL...
6d44165a-4b42-4b99-b7a5-d92f655fcb95
6
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
7655ac73-90f3-48e2-aaf8-61bb8ab07c73
0
@BeforeClass public static void setUpClass() { }
b448e6d1-432b-405b-90a3-0f92e96298fc
5
public int[] plusOne(int[] digits) { int flag = 1; for (int i = digits.length-1; i >= 0; i--){ if (flag == 1){ if (digits[i] == 9){ digits[i] = 0; flag = 1; } else{ digits[i] = digits[...
da20099b-9aea-4de7-aad6-2b5bb20b3637
4
public String toString() { if (givenName == null && familyName == null) return "[Name unknown]"; else return (givenName == null ? "[Given name unknown]" : givenName + " ") + (familyName == null ? "[Family name unknown]" : familyName); }
1c4caf75-678b-4cae-a491-36645ea4f204
6
public void criaDEP(Departamento Dep) throws SQLException { Connection conexao = null; PreparedStatement comando = null; try { conexao = BancoDadosUtil.getConnection(); comando = conexao.prepareStatement(SQL_INSERT_DEPARTAMENTO); comando.setString(1, Dep.get...
f87d606f-f5b3-4778-9ca7-6bf6c0d9f927
2
private static void split(final double d, final double split[]) { if (d < 8e298 && d > -8e298) { final double a = d * HEX_40000000; split[0] = (d + a) - a; split[1] = d - split[0]; } else { final double a = d * 9.31322574615478515625E-10; split...
50293079-5b3e-4b22-93ea-83e11a5fc59b
7
private static void drawCountGraph(Graphics g, GraphPanel graphPanel) { g.setFont(new Font("Arial", Font.PLAIN, 10)); int graphHeight = graphPanel.getHeight(), graphWidth = graphPanel.getWidth(); double scalarX = lastRetrievedVirusCount * 1.05 / graphWidth; double scalarY = maxCount * 1.05 / graphHeight; int ...
79c613e2-7df2-41b0-946d-15a7b4326b19
4
public void drawDialog(SpriteBatch sb, int emotion) { sb.draw(textHud, x, y - 76); drawString(sb); if (speaker != null) if (speaker.nickName != null) { if(speaker.getFace(0)!=null){ sb.draw(emotions[emotion], x + 7, y - 69); sb.draw(speaker.getFace(emotion), x + 7, y - 69); } } if (canShowCo...
7938e529-dcf1-4fc8-a8e5-233245faff14
9
public int checkDifficulty() { ControlroomWorld world = (ControlroomWorld)getWorld(); if(difficultyScore < 300) { return 1000; } else if (difficultyScore >= 300) { return 900; } else if (difficultyScore >= 700) {...
892f9f17-e274-43cc-bc6e-684b929a816a
2
private void deleteRequest(HttpExchange he) throws IOException { try { InputStreamReader isr = new InputStreamReader(he.getRequestBody(), "UTF-8"); BufferedReader br = new BufferedReader(isr); String jsonInput = br.readLine(); String path = he.getRequestURI().get...
ca0d1e11-182a-44c3-9ddb-347980534cce
5
@Override public void paint(Graphics g) { super.paint(g); // check whether the height of this panel matches the height of the text component or not Dimension textComponentPreferredSize = textComponent.getPreferredSize(); if (textComponentHeight != textComponentPreferredSize.height) { textCompon...
b6cd9fae-648e-4abf-9380-cd33e0b8a5e2
2
public void read() { Scanner ler = new Scanner(System.in); System.out.printf("Informe o nome de arquivo texto:\n"); String nome = ler.nextLine(); System.out.printf("\nConteúdo do arquivo texto:\n"); try { FileReader arq = new FileReader(nome); BufferedRead...
55ac787e-63e6-46b5-9ff9-a416c9c23182
7
public char prev() { char token = prevChar(); if ( token == (char)-1 ) { return token; } else if (token == '\r'||token=='\n') { if ( lastWasLetter && readHyphenatedWordBackwards() ) { char last = undo.get(undo.size()...
5f929531-6279-46f3-abd2-44dab29a5761
2
@Override public ParseResult<T, Tuple2<A, B>> parse(LList<T> tokens) { ParseResult<T,A> r1 = this.left.parse(tokens); if(!r1.isSuccess()) { return ParseResult.failure(r1.getErrorMessage(), r1.getRestTokens()); } ParseResult<T,B> r2 = this.right.parse(r1.getRestTokens()); if(!r2.isSuccess()) { return Pa...
4e33c544-b28b-4c57-9d8b-078d5ded7800
2
public void addOutputCallPanel( String localChannel, String remoteChannel){ if(!localChannel.equals(null)&&!remoteChannel.equals(null)){ String remoteNumber = remoteChannel.substring(0,remoteChannel.indexOf("-")); JPanel panel = new JPanel(); panel.add(HangupButton(remoteChannel)); addPanel(remoteNumbe...
fb6b2237-9e0c-450e-96a5-60d42426f441
4
public String[] getArchiveList() { int numImages = imageArchive.countImages(); String[] values = new String[numImages]; int count = 0; for (int index = 0; index < numImages; index++) { int identifier = archive.getHashAt(index); if (imageArchive.isValid(identifier)) { String fileName = String.valueOf(i...
404d53df-164b-453f-85f6-0ed651235f34
6
public void readBackButton() { if (buttonCombi1 == 0 && buttonCombi2 == 1) { timePressed = System.currentTimeMillis(); } while (buttonCombi1 == 0 && buttonCombi2 == 1) { checkInput(); if ((System.currentTimeMillis() - timePressed) > 1000) { fastRewindSong = true; } } if ((System.currentTimeMil...
32eadbf8-25ef-4c44-b0cc-f05275cb10ce
7
private Map<String, String> createParameterMap(String queryString) { Map<String, String> map = new HashMap<String, String>(); String[] pairs = queryString.split("&"); for (String pair: pairs) { if (pair.length() < 1) { continue; } String[] to...
7b879592-c15f-4eca-9eed-e2374ae7581e
0
@Override public String getLastName() { return super.getLastName(); }
8daa1001-edb7-4a63-92cd-cdedfeca02dc
6
public static void nearestNeighbourClustering(double threshold,List<Vector> dataset){ //Nearest neighbour clustering List<Cluster> clusters = new ArrayList<Clustering.Cluster>(); DistanceMeasure dm = new EuclideanDistance(); for(Vector v : dataset){ double smallestDistance = Double.MAX_VALUE; Cluster clos...
daea1c44-27a4-4527-a328-858e3087c8d9
1
public SymbolDigraph(int V) { st = new HashMap<T, Integer>(); keys = new Vector<T>(V); for (int i = 0; i < V; i++) keys.add(null); G = new Digraph(V); }
3ae218e6-2904-44db-90f2-b0d7e50f33bf
7
private JComboBox getComboBox(AbstractListModel lm) { if (getContentType().equals("text/plain")) return null; Component[] c = getComponents(); if (c == null || c.length == 0) return null; Container container = null; JComponent comp = null; for (Component x : c) { if (x instanceof Container) { c...
b43ff9e1-b18e-4069-809a-3b59dc0855f8
6
@Override public int compareTo(Object o) { if (this == o) return 0; if (!(o instanceof Mode)) return getClass().getName().compareTo(o.getClass().getName()); Mode m = (Mode) o; int c = name.compareTo(m.name); if (c != 0) return c; if ("".equals(name)) return 0; if (isNegation != m.isNegation()) return (i...
70b5b7bb-f074-4807-aa9f-9c241804d3ea
7
public static void helpDistributeGoal(Stella_Object argument, Proposition parentgoal, boolean generatorP) { { Surrogate testValue000 = Stella_Object.safePrimaryType(argument); if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PATTERN_VARIABLE)) { { PatternVariable argument000 = ((PatternVariable...
c0f64b22-db17-4a51-a3d3-52a97ece73d6
3
public void removeAluno(String matricula) throws AlunoInexistenteException { boolean teste = false; for (Aluno e : alunos) { if (e.getMatricula().equals(matricula)) { alunos.remove(e); teste = true; break; } } if (teste == false) { throw new AlunoInexistenteException("Remove Aluno Inexisten...
ce4ce9f8-3bc3-4227-aeae-cdaeb9c494ba
0
public Train getTrain() { return this._train; }
f094973e-3c77-4ea2-a843-3992b292179f
2
@Override public int getPreferredWidth(Row row, Column column) { int width = TextDrawing.getPreferredSize(getFont(row, column), getPresentationText(row, column)).width; StdImage icon = row == null ? column.getIcon() : row.getIcon(column); if (icon != null) { width += icon.getWidth() + H_MARGIN; } return H...
470dfd24-a368-4486-93e1-2b6c9f2c33e6
8
protected double[][] calculateClustersPartitionsMatrix() throws RuntimeException { if( this.clustersPartitionsMatrixSet) return this.getClustersPartitionsMatrix(); // Table initialization double[][] newMatrix = new double[this.clusterNumber()][this.classesNumber()]; for(int i = 0; i < newMatrix.length; ...
2c2392d8-4bf2-4853-aebb-ce789672f542
3
public void create(int bufferSize) { int kMinBlockSize = 1; if (bufferSize < kMinBlockSize) bufferSize = kMinBlockSize; if (_buffer != null && _bufferSize == bufferSize) return; _bufferSize = bufferSize; _buffer = new byte[bufferSize]; }
18235917-8eb6-4b6c-87eb-f72f41b6eed7
6
public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) { try { final Method method = version.getClass().getMethod(methodName); return new Adapter.Getter<V>() { public V call() { try { Transaction me = Thread.getTransaction(); Transaction o...
a77e91d8-a3f1-44a3-8e0e-627313f8b9f2
8
@Override protected List<List<String>> loadList(StringBuffer str) { final List<List<String>> lists=super.loadList(str); final List<String> parmNames=CMParms.parseTabs(parametersFormat(), true); int levelParmPos=-1; for(int p=0;p<parmNames.size();p++) { if(parmNames.get(p).endsWith("_LEVEL")) { lev...
39a76fd2-be9e-4edb-8763-736c10682c9c
7
private void parseParameterAnnotations(Method method, Annotation[][] annotations, Map<String, Integer> paramIndexes, Map<String, Integer> batchParamIndexMap, Class<?>[] paramTypes) throws DaoGenerateException { for (int index = 0; index < annotations.length; index++) { for (Annotation annotation : annotati...
f683eb57-9dd8-4bde-bebf-0714a5421e0e
4
@Override public Class<?> getColumnClass(int columnIndex) { switch (columnIndex) { case 0: return IFile.class; case 1: return Long.class; case 2: return Date.class; } return String.class; }
e6a54676-6eef-416b-9132-264bc160097f
8
final public void Logical_expression() throws ParseException { /*@bgen(jjtree) Logical_expression */ SimpleNode jjtn000 = new SimpleNode(JJTLOGICAL_EXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { Or_expression(...
4917c4ac-c908-4a4b-84be-f7decee9750f
1
@Override public void execute() { if (isValid()){ field.move(start, getDestination()); field.eliminate(new Position (start.getY()+(vertical/2), start.getX()+(horizontal/2))); } }
c19d286e-06ff-4183-a170-6f62946759a9
0
public void setName(String name) { this.name = name; }
ee75c369-b6f8-4096-9c7f-5be57cbb7452
8
public double funct(int n, double x[]){ double lh = 0.0; for(int i=1 ; i<x.length; i++){ if(x[i] <= 0|| x[i] > PMAX) return LARGE; } try{ BigDecimal bd1 = new BigDecimal(x[1]); bd1 = bd1.setScale(decimalPlace,BigDecimal.ROUND_HALF_UP); x[1] = bd1.doubleValue(); }catch(java.lang.NumberFormatExc...
a55127fd-66c1-4629-935c-597f6a87f46a
5
public static String formatJsonValue(Object fieldValue, String type) { NumberFormat nf = createFixedPointFormat(); // These strings have been interned so == works for comparison if ("string" == type) { if (fieldValue instanceof Text) { return AnalysisUtility.escapeAndQuoteField(((Text) fieldValue).getValue...
3d95351c-4dc7-4db6-bc94-5a35671ba82f
2
public Tile load(String name) throws TileNotFoundException{ Tile t = null; if(!tileMap.containsKey(name)){ throw new TileNotFoundException(); } else{ File f = new File(tileMap.get(name)); try { t = (Tile) biIn.load(f); } cat...
3f0a3a0a-bf39-4d6e-a586-cc08c781fc8c
3
private void setLoggedInUser() { try { String id = "" + PanelHelper.getMainFrame().getLoggedInUser(); String user = DB.fetchSingle("select namn from anstalld where aid=" + id); if (user != null) { if (user.length() <= 25) { lblLoggedinUser....
12cd54a3-25e3-48e5-96b5-1644f5044b18
3
@Override protected boolean isAttackPlacesForPositionNotHarmingToAnotherFigures(int position, char[] boardElements, int dimension) { return isAttackPlaceAboveNotHarming(position, boardElements, dimension) && isAttackPlaceBelowNotHarming(position, boardElements, dimension) && ...
c85a13c1-dc68-4488-8980-f098bcdc792b
6
public final boolean isCharge() { switch (sourceid) { case 1211003: case 1211008: case 11111007: case 12101005: case 15101006: case 21111005: return skill; } return false; }
625748eb-272a-4667-9b89-1d80ebe47c09
3
public GameObject createEntity(LevelColor color){ GameObject object = null; /* * reserves colors: * 255.1-200.255 npc's * * 1-255.1-255.255 mobs * id.lvl.255 */ // Objects with soft Color if(!color.hasRed(0) && !color.hasGreen(0) && color.hasBlue(255)) object = E...
aadce87c-c044-4e83-b1c1-73924936236f
5
protected void patch_addContext(Patch patch, String text) { if (text.length() == 0) { return; } String pattern = text.substring(patch.start2, patch.start2 + patch.length1); int padding = 0; // Look for the first and last matches of pattern in text. If two different // matches are found, increase the pa...
35d39e10-6fa6-4f4e-8eff-54dbae34467d
9
public static float[] calcAvgHues(String[] files) throws Exception { // Load in the tile from all files WritableRaster[] wrs = loadTileSet(files, new Button()); char[] ls = loadLetterSet(files); // Spaces for the colour number (0 to 6) and then the avg RGB for each // tile int[] corCols = new int[files.leng...