method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f77bdf7c-dd6c-4556-85af-73716fd56936
5
public void body() { // wait for a little while for about 3 seconds. // This to give a time for GridResource entities to register their // services to GIS (GridInformationService) entity. super.gridSimHold(3.0); LinkedList resList = super.getGridResourceList(); // in...
3ce8f0a3-f9e1-49d0-abf0-f7ca1ac60444
2
@Override public boolean open(String hostname, String port, String database, String username, String password) { // load driver if necessary loadDriver(); // if the driver failed to load we need to cancel if (!driverLoaded) return false; try { String jdbcpath = "jdbc:mysql://" + hostname + ":" + p...
b2013b12-e249-4da4-948d-4cecf502f868
3
public static void main(String[] args) { // TODO Auto-generated method stub for (int i = 1; i <= 5; i++) { // for (int j = 1; j <= i; j++) { // System.out.print("*"); // } // for (int j = 5; j >= i; j--) { // System.out.print("*"); // } // for (int j = 1; j <= 6 - i; j++) { // i + j <= 6 // ...
4c11904c-800e-4d90-aec3-304540721023
1
private JComboBox getJComboBox1() { if (jComboBox1 == null) { jComboBox1 = new JComboBox(); jComboBox1.setModel(new DefaultComboBoxModel(new Object[] { "GB2312", "UTF-8","ASCII" })); jComboBox1.setDoubleBuffered(false); jComboBox1.setBorder(null); } return jComboBox1; }
2c5d53bd-da98-462d-a5cf-a3160ea76ea2
4
private static Class<?> declaringClassOf(TypeVariable<?> typeVariable) { GenericDeclaration genericDeclaration = typeVariable.getGenericDeclaration(); return genericDeclaration instanceof Class ? (Class<?>) genericDeclaration : null; }
fe722143-b10f-4337-b7bd-b035b8682d97
5
@Override public void paint(Graphics g) { int width = this.getWidth(); int height = this.getHeight(); int nRows = ocean.getNRows(); int nColumns = ocean.getNColumns(); Denizen water = Water.getInstance(); g.setColor(oceanColor); g.fillRect(0, 0, width, height)...
bb1643e2-1978-44cd-9daf-f29f65f748c1
3
public static void toFile(String stats, String filename) { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(filename + ".dat")); writer.write(stats); } catch (IOException ignored) { } finally { try { if (w...
ac869849-421d-4556-a408-0d3cd42c6939
7
private void cleanValueForest(Model mod, int max, int ndmax){ Posizione temp = null; for(int i=0;i<mod.getDamiera().getDim();i++) for(int j=0;j<mod.getDamiera().getDim();j++){ temp = new Posizione(i,j); if(!mod.getDamiera().isFreePos(temp) && !mod.getDamiera().getPezzo(temp).isNullAM()) if(mod.ge...
a48912bc-1f77-4024-87f2-ab3773d3d360
7
private static String toRange(char c,int low,int high) /** * If 'c' is outside the range 'low' through 'high' (inclusive), * return its representation as Java escape. * Otherwise return 'c' as a one-character string. * * @param c the character. * @return Representaton of c within the range. */ ...
0d7272c6-20b9-4376-93bf-7103c4610a0e
8
protected void writeNumber(String name, Number value) { if (value instanceof Integer || value instanceof Short || value instanceof Byte || value instanceof AtomicInteger) { writeFieldSpec(BSON.INT, name); output.writeInt(value.intValue()); } else if (value instanceof Long || valu...
22c88c36-2a2c-4521-aca1-c50d9640b6ff
0
private void newGame() { // We set gameTime to zero and lastTime to current time for later calculations. gameTime = 0; lastTime = System.nanoTime(); //all the magic happens game = new Game(); }
3f83119c-829a-4276-8a52-13501db33d30
2
public static Channel getSimilarChannel( String name ) { for ( Channel chan : channels ) { if ( chan.getName().toLowerCase().contains( name.toLowerCase() ) ) { return chan; } } return null; }
4692e97e-1931-46da-9d96-d2e24363f9a4
3
public static Object[][] accessRubricItems(String courseID, String actName) { ResultSet res = accessRubric(courseID, actName); Object[][] rubric = null; int i = 0; try { while (res.next()) i++; res = accessRubric(courseID, actName); rubric = new Object[i][2]; i = 0; while (res.next()) { r...
6bcec85c-c09a-4200-a366-19b28593a841
0
public boolean getColour() { return this.colour; }
c3b1d456-2eeb-4ea7-bda9-97ff76dc08af
0
@Override public String toString() { return this.equivalenceList.toString(); }
1b4ed64e-aa78-47f5-87c7-d6785942e769
3
public void tallenna() { ObjectOutputStream output = null; try { output = new ObjectOutputStream(new FileOutputStream(new File(elokuvanTiedot))); output.writeObject(elokuvat); } catch (IOException ex) { System.out.prin...
86260536-03ae-421e-87c2-597d25b6e26d
8
@Override public Class<?> getColumnClass(int columnIndex){ Class type = String.class; switch (columnIndex){ case 0: type = Integer.class; break; case 1: type = String.class; break; case 2: type = Integer.class; break; case 3: type = Double.class; break; case 4: ty...
89b18ec8-aec8-4aad-b5b4-b4a8097050f0
4
@Test public void findsCorrectDefaultKeys() { assertTrue(settings.findKey(Input.PLR1RIGHT) == KeyEvent.VK_RIGHT && settings.findKey(Input.PLR1LEFT) == KeyEvent.VK_LEFT && settings.findKey(Input.PLR1UP) == KeyEvent.VK_UP && settings.findKey(Input.PLR1DOWN) ...
a624cdd7-2a33-4a44-9c41-a202023609f8
4
@Override public Integer get(int index) { switch(index) { case 0: return x; case 1: return y; case 2: return z; case 3: return w; default: throw new IndexOutOfBoundsException(); } }
8be49640-38a6-4699-a9c4-3047b15da885
5
@Test public void testRollbackSuccess2() throws InvalidProcessStateException, ProcessExecutionException, InterruptedException, ExecutionException { // test executing component (execution ongoing) IProcessComponent<Void> decoratedComponent = TestUtil.rollbackSuccessComponent(); IProcessComponent<Void> busyCom...
ec109293-b28c-4577-b903-85dbfcb05672
1
private boolean jj_3_17() { if (jj_3R_35()) return true; return false; }
0fe2f233-e6e4-4cb0-9345-5c6ee70261b0
4
public boolean isJunction(int[][] gameBoard){ if ((gameBoard[this.x][this.y-1] == 0) && (gameBoard[this.x][this.y+1] == 0)) return false; if ((gameBoard[this.x-1][this.y] == 0) && (gameBoard[this.x+1][this.y] == 0)) return false; return true; }
839b985f-f681-4b0c-b7d7-8ed3d624de19
1
public void printLastNameStr(String enteredLastName, boolean lineSeparator) { if (lineSeparator) { System.out.printf("Last name: %s\n", enteredLastName); } else { System.out.printf("Last name: %s", enteredLastName); } }
307b2634-9f89-4910-b985-8842d856c650
9
public void updateGame(long gameTime, Point mousePosition) { // Create new target, if it's time, and add to array if (System.nanoTime() - Target.lastTargetTime > Target.timeBetweenTargets) { // Random target targetImgCurrent = targetImg[rand.nextInt(targetImg.length)]; // Create new target and add to arra...
161b85a5-1359-4e79-9b6f-fd827cd6d66e
9
private String getHighCard(List<String> hand) { String result = null; List<String> values = convertRoyalValues(getValuesFromHand(hand)); int high = 0; for (String s : values) { if (getIntValue(s, false) > high) { high = getIntValue(s, false); } ...
3e78a54f-4f51-4389-9b5f-1fc984c37239
8
public void update(){ //move X if(speedX!= 0){ int temp = speedX + centerX; if((temp - radius > 0) && (temp + radius <borderX)){ centerX =temp; } else { speedX = 0; } } //jump if(jumped){ if(speedY>jumpStart){ jumped = false; jumpEnd = true; if(furtherjump){ jumped = tr...
8de28bc5-5294-41ac-9f8a-353800db4fa9
3
public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode = 'o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma = false; return this; } t...
b9030943-9b65-477e-9b70-14c277a9c0a4
3
public void print(int[][] clusters,String filename){ try { FileWriter fstream = new FileWriter(filename+".csv", true); //true tells to append data. BufferedWriter out = new BufferedWriter(fstream); for(int j = 0; j < clusters[0].length; j++) { for(int i = 0; i...
1aee54a9-1c60-44cd-9e5b-1b5c795fc0de
3
public Analyst(String arg0) { super(applicationName+ " - " + ADocument.DEFAULT_TITLE); addWindowListener(this); setMinimumSize(new Dimension(600,400)); setPreferredSize(new Dimension(1000,700)); //Create the text pane and configure it. textPane = new JTextPane...
ff4c487e-c26c-4261-9e0d-e81607548d45
7
public void CheckForCompleteness() throws Exception { int framebuffer = EXTFramebufferObject.glCheckFramebufferStatusEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT); switch (framebuffer) { case EXTFramebufferObject.GL_FRAMEBUFFER_COMPLETE_EXT: mIsComplete = true; break; case EXTFramebufferObject.GL_FR...
a300c3d1-a0e0-4cce-8978-35d4537d344a
3
public static boolean hasOwnedWindowsShowing(Window window) { if (window != null) { for (Window one : window.getOwnedWindows()) { if (one.isShowing()) { return true; } } } return false; }
e25c2501-bbdf-44a8-9ed7-4d5c577ed9a1
0
public void setSenha(String senha) { this.senha = senha; }
60f192e3-ed3f-4509-8886-412e657fa0cd
0
public FenetreJeu(Modele plateau) { super(); score = new Score(); grid = new GrilleTetris(plateau.getTailleX(), plateau.getTailleY(), 2); pieces = new Reserve(plateau.getSuivantes(), plateau.getSuivantes().length); ImageIcon icon = new ImageIcon(scaleImage(new ImageIcon(getClas...
c0b237fa-214c-41a5-9cfd-d611ea01569b
8
public void unparkVehicle(Vehicle v,int departureTime) throws VehicleException, SimulationException { if(!v.isParked()) throw new VehicleException ("Vehicle is not parked"); if(v.isQueued()) throw new VehicleException ("Vehicle is in queue"); if(departureTime > Constants.CLOSING_TIME || departureTime < 0) ...
8ecfcef2-ff66-4ca7-ab53-e3a199bbfa1c
3
private static void addDir(File dirFile, ZipOutputStream out, String prefix) throws IOException { File[] files = dirFile.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { addDir(files[i], out, prefix); continue; } FileInputStream in = new FileInputStream...
2fd2803e-9c05-42c4-8e4d-8b88bd21f727
0
public static void question10() { /* QUESTION PANEL SETUP */ questionLabel.setText("Do you like crouded places?"); questionNumberLabel.setText("10"); /* ANSWERS PANEL SETUP */ //resetting radioButton1.setSelected(false); radioButton...
6c2aee4b-6ae2-42ae-8a72-f0413b1154d5
7
public static Stella_Object symbolPropertySetter(Symbol symbol, Stella_Object value, StandardObject key) { { Cons vplist = symbol.symbolValueAndPlist; Cons plist = vplist.rest; while (!(plist == Stella.NIL)) { if (plist.value == key) { if (value != null) { plist.rest.value...
791c37eb-9d6e-4667-90f6-f5b323dcc33f
4
public void createFromXML(NodeList research) { Node n = research.item(0); while(n != null) { if(n.getNodeType() == Node.ELEMENT_NODE) { if(n.getNodeName().equalsIgnoreCase("ResearchItem")) { createResearchItem(n); } else if(...
6e0fad60-24db-4fd7-b111-27be6c5df88d
5
private void nodeDFS(Node v, ArrayList<String> visited){ visited.add(v.data.name); v.dfsnum = dfsnum++; v.backnum = v.dfsnum; //System.out.println(v.data.name); for(Node w = v.next; w!=null; w=w.next){ if(!visited.contains(w.data.name)){ nodeDFS(graph.get(w.data.name), visited); if...
b309cd07-3f07-4c07-a148-ae8c1525927a
7
@Override public void run() { try { if (this.c_model.equals("Customer")) { Thread t = new Thread (fa.getCustomerTable()); t.start(); t.join(400); } if (this.e_model.equals("Employee")){ Thread t = new Thread ...
ca65c040-9723-47f9-af1a-b3f327560be5
0
public void setPort(int port) { this.port = port; this.authority = assembleAuthority(this.host, this.port, this.userInfo, null); }
731eea04-6956-48cd-a476-4cbc4def16ac
7
public static ArrayList<String> classifySet(Nod nod, ArrayList<LearningObject> workingSet){ ArrayList<String> resultClasses = new ArrayList<String>(); System.out.println("Start classify " + workingSet.size()); for(int i=0; i<workingSet.size();i++){ LearningObject workObject = workingSet.get(i); Sy...
7c7921d1-2c73-43cc-9481-8c10bd5a7099
9
public static boolean isPointInPolygon(Point2D[] polygon, Point2D point) { if (polygon == null) { return false; } int size = polygon.length; if (size <= 1) { return false; } int intersections_num = 0; int prev = size - 1; boolean prev_under = polygon[prev].getY() < point.getY(); for (int i = 0; i <...
d38d4d3e-7073-4642-b039-03a192c4241f
6
private void extractPages() { Document indexHtml = null; try { indexHtml = Jsoup.connect(this.url).timeout(3000).get(); } catch (IOException e) { this.view.newPopUp("Internal Error:\n"+ e.toString()); } Elements link_nodes = indexHtml.select("div.pagination > a"); //in xpath: //div[@class="pagination...
8dca3c11-828d-49ff-8d6b-a991b048f99a
4
@Override public int altaCliente(TCliente cliente) { int idCliente =-1; TransactionManager.obtenerInstanacia().nuevaTransaccion(); try{ TransactionManager.obtenerInstanacia().getTransaccion().start(); idCliente = FactoriaDAO.obtener...
baae5339-139b-4f3f-876e-0afee7f34cb0
4
@Override public void remove(T t) { Node<T> node = new Node<T>(t); lock.lock(); try { if (root == null) return; if (root.compareTo(node) == 0) { if (root.getLeft() == null) { root = root.getRight(); } else if (root.getRight() == null) { root = root.getLeft(); } else { // se...
5e36634c-8b5d-47a3-853f-cf1731a1e64e
7
private void removeGaps(int nodesLevel[]) { int temp = m_nodes.size(); int temp2=graphMatrix[0].length, tempCnt=1; for(int n=0; n<temp; n++) { for(int i=0; i<temp2; i++) { int len = graphMatrix.length; if(graphMatrix[n][i]>0) if(nodesLevel[i]>nodesLevel[n]+1) { ...
168d1948-ad48-4aad-a801-5ffe03287bc3
0
public PlayerListener(The5zigMod plugin) { this.plugin = plugin; }
e6b7f2b2-9615-4601-a41c-98b86944cb3c
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Chunk other = (Chunk) obj; if (lines == null) { if (other.lines != null) ...
b1f7b809-22f7-4425-8b3e-9cad11ed69d4
1
@Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; }
2263e57b-b34a-481d-a7c5-313928a3a35b
1
@Test(timeout = 5000) public void rangeTest() { Random r = new Random(); T t = new T(); Ranges.Gen in = new Ranges.Gen(t, "in"); Ranges.Check out = new Ranges.Check(t, "out"); for (int i = 0; i < 2000; i++) { in.next(r); t.execute(); out.ch...
a106a61a-0557-4eb7-a36d-7a8927a8eb42
7
public void compFinalResult() { do { iStage++; compAllocation(); if (compDistribution()) { /* deadline can not be satisfied */ if (!bDeadline) { System.out.println("CostMET: THE DEADLINE CAN NOT BE SATISFIED!"); return; } else { println("\nNEW ROUND WITHOUT CHECKING:"); dEval...
274c4d13-8783-4b28-ad4e-20d86c8bba93
8
public int followDistance(int i) { switch (npcs[i].npcType) { case 2550: case 2551: case 2562: case 2563: return 8; case 2883: return 4; case 50: return 18; case 2881: case 2882: return 1; } return 0; }
fa005eff-5c95-4fa0-8dc9-449c6266ed46
6
public void addIconst(int n) { if (n < 6 && -2 < n) addOpcode(3 + n); // iconst_<i> -1..5 else if (n <= 127 && -128 <= n) { addOpcode(16); // bipush add(n); } else if (n <= 32767 && -32768 <= n) { addOpcode(17); ...
f91f30d9-9be7-4f96-befe-8f7821ed3819
8
public void putAll( Map<? extends Character, ? extends Short> map ) { Iterator<? extends Entry<? extends Character,? extends Short>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Character,? extends Short> e = it.next(); this.p...
2e75effe-c5ea-49d6-aad0-ed11435ab310
5
private final String getChunk(String s, int slength, int marker) { StringBuilder chunk = new StringBuilder(); char c = s.charAt(marker); chunk.append(c); marker++; if (isDigit(c)) { while (marker < slength) { c = s.charAt(marker...
67a8f3e3-dfa4-4ae6-a3e2-2e589b444981
3
public void insertAfter(AnyType key, AnyType toInsert) { Node<AnyType> tmp = head; while(tmp != null && !tmp.data.equals(key)) tmp = tmp.next; if(tmp != null) tmp.next = new Node<AnyType>(toInsert, tmp.next); }
85fcc7c0-c889-47ed-ae6e-10551d065858
5
* @param date2 second parameter. Can be null. * @return days between parameters. Can be negative when date2 is before date1. Returns 0 if any parameter is null. */ public static int toDaysBetween(Date date1, Date date2) { if (date1 == null || date2 == null) { return 0; } Date fromDate, toDate; if (date1...
573224bd-4c2a-49f2-aa25-b98ae2d81ab9
4
public boolean search(String val){ for(int i=0;i<wSeats.length;i++) { if(wSeats[i].equals(val)){ return true; } } for(int i=0;i<aSeats.length;i++) { if(aSeats[i].equals(val)){ return true; } } return false; }
0ca4677d-ad2d-43c3-9c36-75eb8e52778b
3
static 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) { ...
b3dfa7d3-882b-412d-b925-bb4869316a9c
4
private boolean execRegQuery(String user, String pass, String email, boolean admin) { try { int accId = plugin.getPlyrMngr().createAccount(user, pass, email, player.getIPAddress()); if (accId > 0) { player.setAccountId(accId); player.setStatus(Status.Registered); response = admin ? "admin.register.s...
18491939-d930-4b35-9d89-51e4ff2fd111
4
private void dockWithContainer(DockContainer dc, DockLayoutNode target, DockLocation locationRelativeToTarget) { boolean horizontal = locationRelativeToTarget.isHorizontal(); int[] order = locationRelativeToTarget.getOrder(); if (mChildren[order[0]] != null) { if (mChildren[order[1]] == null) { mChildren[o...
99d06f25-3103-4c8e-9ba4-419c7936bc88
3
@Override public void init(ServletConfig config) throws ServletException { logMessages(Level.INFO, "Initializing the dispatcher servlet"); logMessages(Level.INFO, "Reading the router from the init parameter"); String routerClzName = config.getInitParameter( ROUTER_CLASS_NAME_...
27dc3ddd-5ab4-4c73-9f8b-d44b9c0b98ea
7
private void analiseRegistro() { if (!acabouListaTokens()) { nextToken(); if (tipoDoToken[0].equals("Identificador")) { if (!acabouListaTokens()) { nextToken(); if (tipoDoToken[1].equals(" {")) { if (!acabouL...
a779dddf-8c8b-4c10-8f4a-3ff164cf5689
5
public static void main(String[] args) { int[][] triangle = new int[10][]; //杨辉三角存入一个二维数组 for (int i = 0; i < triangle.length; i++) {//遍历第一层 triangle[i] = new int[i + 1]; //初始化第二层 for (int j = 0; j <= i; j++) { if (i == 0 || j == 0 || j == i) { ...
d06459ab-9ca9-42e4-b098-08f01397f92a
5
public void refreshSuffixedVariables () { suffixed.clear(); Iterator iterator = variables.iterator(); while (iterator.hasNext()) { String var = (String) iterator.next (); if ( var.indexOf("_") > -1 ) { String[] var_arr = var.split("_"); St...
be5a449b-60fb-4b01-b9a8-127b38159c07
7
private void groupListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_groupListValueChanged int indx = groupList.getSelectedIndex() - 1; //System.out.println("old: " + oldIndx + " new: " + (indx + 1)); if (indx + 1 == oldIndx) { return; } /...
ecd23c76-8912-4c21-88be-6672a5adcf68
2
private void printColumnHeads() { out.format("<thead>%n"); out.format(" <tr class=%s>%n", COL_HEAD_CLASS); out.format(" <th class=%s>&#x25CA;</th>%n", COL_HEAD_CLASS); //noinspection UnusedDeclaration StringBuilder colName = new StringBuilder(); for (int i = firstColu...
7121c47f-4799-4b1b-986a-fe1e818ab20a
4
public void doConfig(boolean print) { file = (YamlConfiguration)plugin.getConfig(); if (new File(plugin.getDataFolder(), "config.yml").exists()) { if (print) Main.log.info("[ClassSign] Configuration file loaded!"); } else { file.options().copyDefaults(true); i...
dc7bac12-11a9-4772-9eb3-4fb766301128
9
private static String getCause(int statusCode) { String cause = null; switch (statusCode) { case NOT_MODIFIED: break; case BAD_REQUEST: cause = "The request was invalid. An accompanying error message will explain why. This is the status code will be returned during rate limiting."; break; case NOT_A...
d29668b3-4a9e-42b6-94d1-7ee9e49c99fc
8
public String add() { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { System.out.println("Where is your MySQL JDBC Driver?"); e.printStackTrace(); return ""; } int i = 0; int j = 0; if (nam...
63693e6d-7170-40b9-bb99-641cd93d3119
0
@Test public void testInsertDates() throws Exception { }
0a4903cb-a6e4-4970-b80c-d4768ebeb3c8
0
@Override public String toString() { return name; }
50e2268f-728d-42c9-8523-6d6bf96b5178
0
public String doIt(String str) { System.out.println("Called .. " + LoggerUtils.getSig()); return str; }
a4a5932e-b014-4b62-b832-c5282a717ce5
0
public String getId() { return id; }
3adbcc3f-eeee-4180-9284-571f6a5f5b43
4
private void lifeCycle() { String s = ""; while (isInputActive) { try { s = readInput(); if (s.length()==0) { this.isInputActive = false; break; } if (this.isValidInput(s)) { collectInput(s); } else { System.out.println(MSG_WELCOME); } } catch (IOExce...
ca4a7087-96a9-4fd4-960b-b393846e86f0
7
public Unit getPrecision() { ensureParsed(); Unit result = null; if (isPresent(fNanosecond)) { result = Unit.NANOSECONDS; } else if (isPresent(fSecond)) { result = Unit.SECOND; } else if (isPresent(fMinute)) { result = Unit.MINUTE; } else if (isPresent(fHour)) { ...
a4ac37b6-805d-4a83-9331-e894e2b5b661
0
public String getPrecision() { return precision; }
0204bf52-68b5-4f4c-95b6-107fd81e4599
5
public static String getPluralForm(String word) { // remember the casing of the word boolean allUpper = true; // check if the word looks like an English word. // if we see non-ASCII characters, abort for(int i=0; i<word.length(); i++ ) { char ch = word.charAt(i); ...
4c350c54-883a-4060-bc27-fb6c235de4fe
2
private void addMenuItems() { JMenuBar menuBar = new JMenuBar(); JMenu file = new JMenu("File"); JMenu edit = new JMenu("Edit"); JMenuItem exit, exportXmlFile, exportSchema, importXmlFile; //add JMenus to the menu bar menuBar.add(file); menuBar.add(edit); exit = new JMenuItem("Exit"); exit.setMnemo...
97302973-e6e8-4b28-9418-aa60b3ff721d
0
public String getName() { return this._name; }
23d8a090-ff37-4fe8-a780-28c3a4dc8f85
3
private void update(int cycles) { if (cycles < 0) { while (true) { scape.step(); addInfo(scape.grid[scape.mainPanel.xSelected][scape.mainPanel.ySelected]); scape.epochs++; String ep = "Epochs: " + scape.epochs; epochsLabel.setText(ep); } } else { for (int c = 0; c < cycles; c++) { ...
b470495e-d1a7-410b-a305-e76b35cce3be
1
private void analyzeRechableMethods(SootClass lifecycleElement, List<MethodOrMethodContext> methods) { ReachableMethods rm = new ReachableMethods(Scene.v().getCallGraph(), methods); rm.update(); // Scan for listeners in the class hierarchy Iterator<MethodOrMethodContext> reachableMethods = rm.listener(); whi...
b83c742d-9973-4aab-8aeb-3688fd5f2c27
3
public static long[] toLongA(byte[] data) { if (data == null || data.length % 8 != 0) return null; // ---------- long[] lngs = new long[data.length / 8]; for (int i = 0; i < lngs.length; i++) { lngs[i] = toLong( new byte[] { data[(i*8)], data[(i*8)+1], ...
c13802f0-009f-40a3-8207-df208d530fc7
9
public static void initCommandLineParameters(String[] args, List<Option> specified_options, String[] manditory_args) { Options options = new Options(); if (specified_options != null) for (Option option : specified_options) options.addOption(option); Option option = null; OptionBuilder.withArgNam...
1454394e-5ee5-4665-a10b-b3789c0c0e35
2
public void paint(Graphics g){ setShowPicture(); for(int i=0;i<getHeight();i++){ for(int j=0;j<getWidth();j++){ //for size -1 to 1 double x = ((((double) j) / getWidth()) * 2.0) - 1.0; double y = ((((double) i) / getHeight()) * 2.0) - 1.0; ...
a57b1fca-5ac2-4b90-b8bb-0e2c8be19ef0
6
public EzimMsgIn(EzimContact ecIn, String strSbj, String strIn) { this.ec = ecIn; this.initGUI(); this.setIconImage(EzimImage.icoButtons[0].getImage()); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setTitle(EzimLang.IncomingMessage); this.pack(); this.setMinimumSize(this.getSize()); ...
8b744d0a-e612-423e-94f1-f9c181672eb4
3
@Override public void load(final ConfigurationSection config) { if (config == null) throw new RuntimeException("Configuration section missing for OfflinePlayers"); this.storage = new File(config.getString("storage")); if (!this.storage.isAbsolute()) this.storage = new File(this.writer.plugi...
07cb4477-79ef-4aa1-a99b-d38d21e33f3a
5
public void tellEveryone(String name, String message){ //general chat if (message==null || message.length()==0) return; for (ChatServerThread thread : threads){ if (thread!=null && thread.isLoggedIn()) thread.tell(name, message); } }
bbc06180-acfd-4796-b334-3e1df861e84a
6
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_LEFT) board.getBoard().moveShapeToLeft(); if (e.getKeyCode() == KeyEvent.VK_RIGHT) board.getBoard().moveShapeToRight(); if (e.getKeyCode() == KeyEvent.VK_UP) board.getBoard().rotateShapeAntiClock...
d44c07ce-2b1e-4d87-b629-35dd1104fb3a
0
public ManagerGraphicForm(ArrayList<GraphicForm> graphForms) { this.graphForms = graphForms; }
6d07b0e3-3c94-4940-9981-108c223fc12f
4
private void resize() { size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight(); width = size; height = size; if (width > 0 && height > 0) { frame.setPrefSize(width, height); off.setPrefSize(0.791...
533921cc-1606-4f1f-9473-f369316c776c
6
private static void relax(Counter<UnaryRule> pathCosts, Map<UnaryRule, String> intermediateStates, Map<String, List<UnaryRule>> closedUnaryRulesByChild, Map<String, List<UnaryRule>> closedUnaryRulesByParent, UnaryRule unaryRule, String intermediateState, double newScore) { if (intermediateState != null && (interm...
06ce19a6-78b8-4e8e-ad27-c4b5bd6c30b7
3
private Expression noteOff(List<Expression> args, String caller) { // check to make sure we got the right number of arguments if ( args.size() != 4 && args.size() != 3) { System.err.println("noteOff expected 3 or 4 arguments and got " + args.size() ); return new Void(); } ...
cbc638ec-34d9-41d2-93ab-27e002c79a32
7
public List<InetAddress> discoverHosts (int udpPort, int timeoutMillis) { List<InetAddress> hosts = new ArrayList<InetAddress>(); DatagramSocket socket = null; try { socket = new DatagramSocket(); broadcast(udpPort, socket); socket.setSoTimeout(timeoutMillis); while (true) { DatagramPacket packet ...
021e8a9f-518e-44db-aa63-6a1cde137f23
7
public void paint (Graphics g) { super.paint(g); g.setColor(Color.white); g.fillRect(xDie, yDie, 50, 50); g.setColor(Color.black); if(face == -1) { g.setColor(Color.white); g.fillRect(xDie, yDie, 50, 50); } if(face == 1) { g.fillOval(xDie + 20, yDie + 20, 10, 10); } if(face =...
9cd15448-7873-40b8-8918-093c4044dcea
6
private static boolean method518(char c) { return c < 'a' || c > 'z' || c == 'v' || c == 'x' || c == 'j' || c == 'q' || c == 'z'; }
035272e9-990a-4798-96e3-03d45bd9ccbe
2
public void printStack(Stack<Integer> stack) { Stack<Integer> tmpStack = new Stack<Integer>(); //pop all and print while (!stack.empty()) { int cur = stack.pop(); System.out.println(cur); tmpStack.push(cur); } //put it back while(!tmpStack.empty()){ stack.push(tmpStack.pop()); } }
066d89e1-566e-4f25-b9f5-03502c30500e
9
public void visitStoreExpr(final StoreExpr expr) { if ((expr.target() instanceof LocalExpr) || (expr.target() instanceof StaticFieldExpr)) { if (previous == expr.expr()) { // can't be target, because then // it would be a definition, for which // Type0Visitor is not called previous = expr; exp...
d503321f-1ad5-4a1d-b79a-84a9231c7f93
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final Set<MOB> h=properTargets(mob,givenTarget,auto); if(h==null) return false; boolean success=proficiencyCheck(mob...