method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
656c263b-5b77-4525-8056-d74af4b1fc02
1
public static MenuBar getInstance() { if (instance_ == null) instance_ = new MenuBar(); return instance_; }
88f1569d-0149-4fa5-a694-04da2a715242
0
public void setA(float a) { this.a = a; }
b608ccae-f895-4304-b36a-099250ff7111
6
public void cargarListaComprobantes(){ try{ r_con.Connection(); ResultSet rs=r_con.Consultar("select * from tipo_comprobante"); DefaultListModel modelo = new DefaultListModel(); while(rs.next()){ Strin...
6d8d42cb-8a26-4359-867f-33c95355a078
5
public boolean play() { int i = 1; while(true) { System.out.println(""); System.out.println("Turn " + i + " :"); System.out.println(""); if(makeTurn()) { System.out.println("Do you want to make another game ? [y/n]"); sc = new Scanner (System.in); String ans = sc.nextLine(); while (!(ans...
b2f7a00d-ca1c-4521-a9ee-5202838895eb
2
public void replaceLast(Element element) { { final Element removed = elements.removeLast(); fireElementRemoved(removed); elements.add(element); fireElementAdded(element); } if (element instanceof Obstacle) { final Obstacle removed = obs...
6403840d-735b-4bec-9c7a-85b2ea68f962
0
public CNFConverter(Grammar grammar) { this.grammar = grammar; productionComparator = new ProductionComparator(grammar); productionDirectory = new ProductionDirectory(grammar); }
0008fe2a-dbdd-4f1d-82e3-f95f4d70e03c
9
public void run() { while(true){ for (Map.Entry<Integer, String> peer : pingPeers.entrySet()) { try{ // TODO add host name to the address and parse it here instead of hard code localhost int peerId = peer.getKey(); int peerPort = Integer.parseInt(peer.getValue()); FailureDetectorThread.hand...
024eb90c-534c-47c8-88b7-889da170b335
9
static TreeNode genTree(char[] tree){ if(tree.length == 0) return null; ArrayList<TreeNode> nodes = new ArrayList<TreeNode>(20); for(int i = 0; i < tree.length; i++){ if(tree[i] == '#') nodes.add(null); else{ TreeNode node = new TreeNode(tree[i]-'0'); nodes.add(node); } } // System.out.println...
9a6768bd-d81e-45fd-8b0c-02a4b5bdab5c
2
public void toFile(String[] args, String outfile) { try ( FileOutputStream fOutStream = new FileOutputStream(new File(outfile), false); ) { Labyrinth laby = new Labyrinth(Integer.parseInt(args[2]), Integer.parseInt(args[3])); ObjectOutputStream oOutStream = new Ob...
61cf64fe-c7cd-48b9-a06a-7354a3477516
1
public SendTCP(Socket socket, String message) { try{ out = new PrintWriter(socket.getOutputStream()); out.print(message); out.flush(); } catch(Exception e){ } }
855c7f69-b8e6-4e62-84f4-e4a51cb6607b
3
private static int maxSum(int[] a){ int maxSum=0; int tempSum=0; int max = Integer.MIN_VALUE; for(int i=0;i<a.length;i++){ tempSum+=a[i]; max = Math.max(max, a[i]); if(tempSum>0){ maxSum+=tempSum; tempSum=0; } } // System.out.println(maxSum); return maxSum==0?max:maxSum; }
38f43f58-74b6-42e1-820b-dc6243242d4d
2
public void addToQueue(TestRunInfo testrunInfo) { try { if (!postResult2QcThreadExecutor.stop) { queue.put(testrunInfo); log.info("Added test run result into queue :" + testrunInfo); } else { log.warn("Queue is closed, no more result is added to queue"); ...
a410c16e-021d-47c9-ad39-514387b55fe2
4
public static void main(String[] args) { String nivel; Scanner scanner = new Scanner(System.in); System.out.println("Ingrese el nivel que desea jugar (Basico,Intermedio,Avanzado): "); nivel = scanner.nextLine(); JuegoAhorcado j = new JuegoAhorcado(); j.inicializarJuego(nivel); while(j.intentos() != 0){ ...
2dfbd53a-e8d3-4019-b1f5-f31f741212ae
2
@Override public void setCredits(double credits) { if(credits < 0.5 || credits > 4.0) { JOptionPane.showMessageDialog(null, "Error: credits must be in the range 0.5 to 4.0"); System.exit(0); } this.credits = credits; }
b4f65c32-5ea2-4f9d-b337-ff9d04cc6d2a
5
public boolean authenticateUserPassword(String userPassword) { // Step 1: Perform all but the last step of Algorithm 3.4(Revision 2) or // Algorithm 3.5 (Revision 3) using the supplied password string. byte[] tmpUValue = calculateUserPassword(userPassword); byte[] bigU = Utils.convertBy...
229f0535-822e-46d1-8ae0-dcedce1f0122
1
private void piirraElinvoima(Graphics graphics){ int x = (int)(getX() - vartalo.getHalkaisija()/2); int y = (int)(getY() + vartalo.getHalkaisija()*7/10); int leveys = (int)(vartalo.getHalkaisija()); int korkeus = (int)(vartalo.getHalkaisija()/5); graphics.setColor(Color.BLACK); ...
673a42d5-d4c5-4bc5-9ff4-fab9e8a50c5a
4
public void active(int speed){ if( dir==DirKey.Up ){ this.y = this.y - speed; } else if( dir==DirKey.Down ){ this.y = this.y + speed; } else if( dir==DirKey.Left ){ this.x = this.x - speed; } else if( dir==DirKey.Right ){ this.x = this.x + speed; } }
dd2866dd-3ab3-4a17-ad1f-44b894f60d94
1
private MusicObject populateMusic(ResultSet rs) throws SQLException { MusicObject tempMusic = new MusicObject(); tempMusic.setUid(rs.getInt("id")); tempMusic.setSongName(getString(rs,"song_name")); tempMusic.setFileName(getString(rs,"file_name")); tempMusic.setArtist(getString(rs,"artist")); if (Utils...
50f5241e-f0e2-4f5e-b996-ea70ec9c6907
4
public static void main(String args[]) { //TODO if debug: LOGGER.getRootLogger().setLevel((Level) Level.DEBUG); if ( args.length > 1 ) { System.out.println("The editor takes one argument which is the configuration file."); System.out.println("If no configuration file is supplied,...
bf41a314-591f-45a5-9f10-2d2316d31cf0
0
public ProblemList getProblemList() { return problemList; }
8da900b6-7fda-423f-abc7-32256cd3cfd5
2
public final void back() throws JSONException { if (useLastChar || index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } index -= 1; useLastChar = true; }
7e6f440c-dfe4-496c-9503-f8631af216ed
6
private void firstLoad() { if (initialLoad) { if (gui.connection != null) { try { statement = gui.connection.createStatement(); if (rslt != null) { rslt.close(); } rslt = statement .executeQuery("SELECT * FROM GETREFERENCES('" + mainTableName + "')"); rsltMetaData...
a6d485af-b354-4d5d-9898-df6d2fab224a
6
private Set<TKey<?, ?>> setupDescriptionKeys() { Set<TKey<?, ?>> descriptionKeys = new HashSet<>(); descriptionKeys.add(DatasetKeys.DISCIPLINE); descriptionKeys.add(DatasetKeys.LANGUAGE); descriptionKeys.add(DatasetKeys.SUBJECT); descriptionKeys.add(DatasetKeys.TIME_COVERAGE); ...
71056db7-f78e-406d-b1d5-167c23801a1c
1
public void test_DateTime_setHourBack_Moscow_Spring() { DateTime dt = new DateTime(2007, 3, 25, 8, 0, 0, 0, ZONE_MOSCOW); assertEquals("2007-03-25T08:00:00.000+04:00", dt.toString()); try { dt.hourOfDay().setCopy(2); fail(); } catch (IllegalFieldValueExce...
3cdca1a9-3d6a-42e4-b4f6-6cb0d3edef4f
1
public boolean equals(Object o) { MethodType mt; return (o instanceof MethodType && signature .equals((mt = (MethodType) o).signature)); }
18c9dbda-dc50-4966-8148-a0eb1a3ee0aa
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((!super.okMessage(myHost,msg)) ||(affected==null)) { if(affected instanceof MOB) undanceMe((MOB)affected,null); else unInvoke(); return false; } else if(msg.amITarget(affected)) switch(msg.targetMinor(...
1e112ce3-a989-4316-b890-082073f211e4
5
public void setConfigOptions(FileConfiguration config){ if (!config.contains("sql.hostname")) config.set("sql.hostname", "localhost"); if (!config.contains("sql.port")) config.set("sql.port", 3306); if (!config.contains("sql.dbname")) config.set("sql.dbname", "nametracker"); if (!config.contains("sql.usernam...
7fd03cc3-4a83-4a99-acab-b24fe53cb6c6
0
@Basic @Column(name = "FUN_GRADO") public String getFunGrado() { return funGrado; }
ee1f97bb-d969-4e84-a9b7-3d9e5b126d09
1
public int getNumberOfComments() { if (comments == null) { return 0; } else { return comments.size(); } }
482ade83-9d10-4095-a55e-79525653a424
4
public void setEstrCaso(List<?> list) { for(PEstrCaso e : this._estrCaso_) { e.parent(null); } this._estrCaso_.clear(); for(Object obj_e : list) { PEstrCaso e = (PEstrCaso) obj_e; if(e.parent() != null) { ...
3c9ef15b-5407-41f3-8e2c-fbe8b90a5db9
5
public static void main(String args[]) throws IOException { ServerSocket srvr = null; Socket skt = null; int port = 1234; if (args.length != 0) port = Integer.parseInt(args[0]); try { srvr = new ServerSocket(port); System.out.println("Server running on port " + port); while (true) { skt...
b04da5df-7e25-4ea5-9a5b-2868a89f178a
5
private void init() { savedir = getSaveDir(); conffile = new File(savedir, "data.txt"); qm = new QuestManager(); fm = new FileManager(); conf = new StringConfig(); //Set LookAndFeel to Nimbus try { UIManager.setLookAndFeel(NimbusLookAndFeel.class.getName()); } catch (Exception e) { e.printStackTr...
72697cba-1c07-4106-8fab-777c8f53cc8b
3
public void visitChildren(final TreeVisitor visitor) { final List list = preOrder(); if (!visitor.reverse()) { final ListIterator iter = list.listIterator(); while (iter.hasNext()) { final Block block = (Block) iter.next(); block.visit(visitor); } } else { final ListIterator iter = list.lis...
098c9653-7453-4ade-90b5-b0d7c7af4bfb
2
private void makeGenderHistogram() { for(int i=0; i<IDList.size(); i++) { String thisID = new String( (String)IDList.get(i) ); if( thisID.charAt(1) == 'M' ) genderHist.set(0,new Integer(( (Integer)genderHist.get(0) ).intValue()+1) ); else genderHist.set(1,new Integer(( (Integer)genderHist.get(1...
925dfb33-5eee-4b31-95b9-25d11ff4dc77
1
@Override public void deleteAttribute(int row, AttributeTableModel model) { AttributeContainer node = view.tree; if (node == null) { return; } String key = (String) model.keys.get(row); Object oldValue = node.getAttribute(key); boolean oldReadOnly = node.isReadOnly(key); node.removeAttribu...
2754125a-f734-48c2-b6f1-a6805b9af705
4
@EventHandler public void onChat(AsyncPlayerChatEvent ev) { ev.setCancelled(true); Player p = ev.getPlayer(); if(RushPlugin.isARushPlayer(p) && RushPlugin.isGameRunning()) { if(p.isOp()) Bukkit.broadcastMessage(ChatColor.RED+"<"+ChatColor.RESET+RushPlugin.getRushPlayer(p).getTeam().getColor()+p.getName()+...
f237a414-147a-443a-bf59-ed6c7dd4b156
1
public void render(){ for (GameComponent component:components){ component.render(); } }
cc06ccc0-b8f0-477c-8049-e6b24ce187ec
1
public SLKeyframe setDelayIncr(float delay, Component... cmps) { float d = 0; for (Component c : cmps) delays.put(c, d += delay); return this; }
0d5b7cc2-38bd-4104-83cc-fbd6f907fe60
2
private int[] parseCaptureGroups(String input){ String[] groups = input.split("\\^"); int[] returnArray = new int[groups.length]; for (int i = 0; i < groups.length; i++){ try{ returnArray[i] = Integer.valueOf(groups[i]); } catch(NumberFormatException e){ ...
7f56afc0-2f79-4564-8a0f-d1cce0275314
5
public double jumpTime(double timeStep) { double loopTime = timeStep; Position calculatedPosition = this.getPosition(); ArrayList<Worm> hits = new ArrayList<Worm>(); double calcRadius = this.getRadius(); //So we don't recalculate this too many times. while(this.getWorld().liesWithinBoundaries(calculated...
bc3db7ee-894e-49d7-b308-2ef41f58a92a
4
public void SendQuery(String query) { String url = "jdbc:"+serverAdd+"/" + dataBaseName; Connection conn; Statement stmt; vals = new ArrayList<ArrayList<String>>(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection(url, userName, password); stmt = conn.cr...
59419e83-ab7d-4a5a-b9f8-10a9637b95a2
2
public static void main(String[] args) { Main m = new Main(); CmdLineParser parser = new CmdLineParser(m); try { parser.parseArgument(args); if (m.filenames.size() == 0) { System.err.println("Usage: pdf2xml [options] <FILEs>"); ...
e288080b-bb65-4de6-adb9-ae635b53a9ee
3
private void parseArguments(String[] args) { int i=0; while (i < args.length) { if (args[i].equals(Arguments.FOLDER)) { folderPath = args[++i]; } else if (args[i].equals(Arguments.FILE)) { filePath = args[++i]; } i++; } }
2b5ac01b-2269-4e20-8d90-595ea446b0d9
9
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); System.out.println("GroupChatServlet"); UserBean cu...
11732ce7-9ddc-450e-ac7d-ca77835b5c19
4
private void writeScoreList(OutputStream out, List<Score> scores) throws IOException { writeInt(out, scores.size()); for (Score score : scores) { writeString(out, score.getShipName()); writeString(out, score.getShipType()); writeInt(out, score.getScore()); writeInt(out, score.getSector()); writ...
90eed89f-b7ef-4988-9f5b-80862e27f3bf
0
public String getDescription() { return delegate.getDescription(); }
f78b9eea-e02a-445c-b6f1-3853a5c7c061
9
@Override public void doIncoming(ProcessorContext context, Node node, Node from, Flow flow) { super.doIncoming(context, node, from, flow); Map<Flow, Node> predecessors = node.getPredecessors(); // join if (predecessors.size() == 1) { doOutgoing(context, node); ...
8adf76a3-a56a-43c8-a231-355f936a1ef7
0
public remove() { this.info = "remove a venue"; this.addParamConstraint("id", ParamCons.INTEGER); this.addRtnCode(201, "venue not found"); }
10f2c348-1196-4b2e-9022-287a9e496562
1
@Test public void tiedostoonTallentaminenToimii() { kasittelija.tallennaTiedostoon("testi1"); String a = ""; try { Scanner lukija = new Scanner(tiedosto); a = lukija.nextLine(); } catch (Exception e){ a = "Tiedostoa ei löydy!"; } as...
c33cde25-1eac-4550-b01f-3a0b38345ded
7
@Override public void sortByValueAceHigh() { final List<Item> unsorted=new Vector<Item>(); unsorted.addAll(getContents()); if(unsorted.size()==0) return; // first step is to get them out of the deck and // then re-add them in order. for(int u=0;u<unsorted.size();u++) removeCard((PlayingCard)unsorted...
4fe67a12-6744-4548-a3c6-d75e59396e63
4
public static boolean recToRect(float rect1x, float rect1y, int width1, int height1, float rect2x, float rect2y, int width2, int height2) { if(rect1x <= rect2x + width2 && rect1x + width1 >= rect2x && rect1y <= rect2y + height2 && rect1y + height1 >= rect2y) return true; return false; }
ffdcef31-8c52-489a-8d4f-df8fe0eab9e3
1
private CommandLogger initLogger(String loggerName, String loggerFilePath) throws DataBaseServerException { try { return new CommandLogger(loggerName, loggerFilePath); } catch (IOException e) { throw new DataBaseServerException("Unable to initialize logger " + loggerName, e); ...
0fbd2fec-6a85-43b0-a542-7bce96b28894
9
@Override protected void flushSpi() throws BackingStoreException { final File file = FilePreferencesGenerator.getPreferencesFile(); synchronized (file) { Properties p = new Properties(); try { StringBuilder sb = new StringBuilder(); ...
8afb3ba2-673b-4fc4-8afe-51beabf51f7e
7
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ("name".equals(qName)) { isName = true; } else if ("state".equals(qName)) { isState = true; } else if ("np".equals(qName)) { isNp...
479c78b5-b991-41ea-aeae-ca47ce4106ce
1
@Override public void received(Connection connection, Object message) { // Ignore keepalive messages if(message instanceof KeepAlive) return; client.networkMessages.add(message); }
44ca5556-c587-4b14-9aeb-f5b5624e4927
1
private void buildTerritoires() { // TODO nombre de player territoires = SQLite.createTerritoires(2); for (TerritoireCase t : territoires) { getContentPane().add(t); } }
689505da-d308-4a33-aae7-3e2f3b587a5e
7
private int negL(int dest) { clearFlags(SR_X, SR_N, SR_Z, SR_V, SR_C); int result = -dest; if (msbSetL(result)) setFlag(SR_N); if (isZeroL(result)) setFlag(SR_Z); if (msbSetL(dest) && msbSetL(result)) setFlag(SR_V); if (msbSetL(dest) || msbSetL(result)) setFlag(SR_C); if (isCarrySet()) setEx...
edc1b8c6-4e55-4562-ac66-2fcff3878c81
2
@Override protected Dimension getSizeSelf(LayoutSize type) { createGrid(type); int width = 0; for (int i = 0; i < mColumns; i++) { width += mColumnWidths[i]; } int height = 0; for (int i = 0; i < mRows; i++) { height += mRowHeights[i]; } flush(); return new Dimension(width, height); }
7e0dd436-fd24-4807-b372-4e39b34c5a7c
1
public PlayerFlag getPlayerFlag() { if(this.playerFlag == null ) throw new IllegalStateException("This player hasn't got a playerflag set yet!"); return playerFlag; }
91cd3efe-a819-4f26-b48f-bc139aa889fc
0
public void setFileIndex(int fileIndex) { this.fileIndex = fileIndex; }
4a7d32b5-071a-401e-95df-eef4aeb06c33
9
protected String getPairValueFromXML(XPath xpath, String path, Document doc) { if (doc == null || xpath == null || path == null) { return ""; } try { XPathExpression expr = xpath.compile(path); Object res = expr.evaluate(doc, XPathConstants.NODESET); ...
ec4d4639-8bf3-4029-a2cf-43a00969df42
2
public void saveTreasureSpots() throws IOException { FileOutputStream fos = new FileOutputStream(TreasureHunt.getInstance().getDataFolder() + "/treasureLocations.xml"); if(fos == null) return; ObjectOutputStream oos = new ObjectOutputStream(fos); if(oos == null) return; oos.writeObject(p...
611033d0-c098-402a-805b-4b930f4e12aa
9
static AccessibleObject fetchMethod(Class<?> clazz, String methodName, Class<?> ... parameterTypes) throws NoSuchMethodException { if (clazz == null) { throw new NullPointerException(); } NoSuchMethodException exception = null; if (clazz.getSimpleName().equals(methodName) || pDigits.matcher(methodName).ma...
36f199b5-3216-4178-957e-48678e58c7e3
0
public Ticket in(Car car, List<Park> parkList){ Ticket t=null; return t; };
8cfd9fef-bf2c-42e2-8cac-89eb179e8527
9
public void update() throws MaltChainedException { // Retrieve the address value final AddressValue arg1 = addressFunction1.getAddressValue(); final AddressValue arg2 = addressFunction2.getAddressValue(); if (arg1.getAddress() != null && arg1.getAddressClass() == org.maltparserx.core.syntaxgraph.node.Dependenc...
a4f14a62-f5ef-4b99-a69b-4ad924c0db10
4
private void normalizeContrast() { int[] histogram = new int[256]; for (int i = 0; i < data.length; i++) { histogram[data[i]]++; } int[] remap = new int[256]; int sum = 0; int j = 0; for (int i = 0; i < histogram.length; i++) { sum += histo...
3a21f973-0ebd-4594-b62c-fafe1df1f374
3
public static int Z(String str1,String str2,Map<String, String> tmap,Map<String, Integer> hmap) { int zheight=0; while(tmap.containsKey(str2)){ str2=tmap.get(str2); zheight++; if(str1.equals(str2)){ return zheight; } } if(str1.equals(str2)){ return zheight; } return -1; }
375b81e1-4991-4e89-832b-6c1345a724b7
8
@Override public String stringify(int level) { ArrayList<String> strArray = new ArrayList<String>(); int width = 0; String strJSON; for (Entry<Object, JSON> e : mapObject.entrySet()) { strJSON = escape((String) e.getKey()) + ": " + e.getValue().stringify(level + 1); strArray.add(strJSON); width += st...
025afb59-b070-46e5-9f53-e11969b30f85
8
public static void allBinStrings(String file, ByteBuffer allBin, ByteBuffer bootDol, List<HomelandString> collector) throws IOException { List<Integer> offsets = readOffsets(bootDol); for (int i = 1; i <= offsets.size(); i++) { int start = offsets.get(i - 1); int end; ...
e56e451b-b822-4fa8-88a3-3164c2784ae5
0
public String getWRholder() { return WRholder; }
67b19d35-32eb-4e0e-ac82-5a765b704c5b
0
public void setSearch_word(String search_word) { this.search_word = search_word; }
5e4a706b-1f69-4c9a-9182-7c4f2d810c46
1
public Object parameterValueCycListApiValue(Object val) { if (((Boolean) val).booleanValue()) { return (CycObjectFactory.t); } else { return (CycObjectFactory.nil); } }
3c865fa7-0e1d-41b3-8c4b-be360e1f6ca6
8
public Player(String s, TileMap tm) { super(tm); this.tiley = tm; //width = size of animation/tiles width = 30; height = 60; //cwidth = makes the dragon go kinda into the ground cwidth = 30; cheight = 50; moveSpeed = 0.6; maxSpeed = 2.0; stopSpeed = 0.4; fallSpeed = 0.15; maxFallSpeed = ...
d8e99518-e81f-4fa0-b101-ba9b85268027
1
public void printSubjectState(){ for(Map.Entry<String, Subject> entry : subjects.entrySet()){ Subject subject = entry.getValue(); System.out.println(subject.subjectName + "has recently read: " + subject.readValue); } }
a10633fd-71c9-4513-a5b5-060bc68b2aa0
9
@Override public void update(Observable ml, Object e) { Warborn model = (Warborn)ml; currentPlayer.setText(model.getCurrentPlayer().getFullName()); currentState.setText("Battle Phase"); float[] hsbFloats = {0,0,0}; Color.RGBtoHSB(model.getCurrentPlayer().getColor().brighter().getRed(), model.getCurren...
deb1f063-3c01-4dd6-b1cb-f9b42e0da20b
7
private String getCertainExpression(int exp) { String result=""; switch(exp+1) { case 1: result=fx; break; case 2: result=gx; break; case 3: result=ax; break; ...
79cbaeef-b1a8-44fa-88da-e9dfa374d446
0
@Override public void init(List<String> argumentList) { levelsOfStackToPop = Integer.parseInt(argumentList.get(0)); }
71e995fa-3d89-4fd5-be7f-e53993490186
1
public void writeBytes(byte buf[], int len, int off) { for (int i = off; i < off + len; i++) { payload[offset++] = buf[i]; } }
a21745d5-1524-4a5c-8758-b83ab64bc40e
5
public static void merge(Comparable[] a, int lo, int mid, int hi) { int i = lo; int j = mid + 1; for (int k = lo; k <= hi; k++) { aux[k] = a[k]; } for (int k = lo; k <= hi; k++) { if (j > hi) { a[k] = aux[i++]; } else if (i > mid) { a[k] = aux[j++]; } else if (less(aux[j], aux[i])) { ...
6f0fe973-8bac-48d0-bc05-2c42a5d730e9
5
@Override public void valueChanged(ListSelectionEvent e) { if (productType != null) { if (lstSubProcesses.getSelectedValues().length == 1) { btnUpdate.setEnabled(true); btnDelete.setEnabled(true); btnUp.setEnabled(true); btnDown.setEnabled(true); int index = lstSubProcesses.getSelecte...
d75ce510-063c-46cf-a88f-51b778c2a09e
9
boolean testBufferChunk (Chunk bufferChunk, Instantiation inst) { for (int i=0 ; i<slotConditions.size() ; i++) { SlotCondition slotCondition = slotConditions.elementAt(i); if (model.getProcedural().whyNotTrace) { int savedSize = inst.size(); boolean result = slotCondition.test (buffer, bufferChun...
ed47e606-f508-453f-814e-838a2def1c4d
0
public String summary() { return "( Task id : " + id + " _priority : " + priority + ")"; }
cc1d71bf-25c6-4e0e-88fb-a1ff0afddf92
9
public void replace(String statement) throws CannotCompileException { thisClass.getClassFile(); // to call checkModify(). ConstPool constPool = getConstPool(); int pos = currentPos; int index = iterator.u16bitAt(pos + 1); Javac jc = new Javac(thisClass); CodeAttribute ...
5eaa7f7b-779d-4741-9da7-0ecec64102d2
2
@Override public void keyTyped(KeyEvent e) { keys[e.getKeyCode()] = true; if (e.getKeyChar() == (char)27) { aiTimer.stop(); if (JOptionPane.showConfirmDialog(null, "Juego en progreso\n" + "Desea continuar jugando?", "Pausa",...
09801433-6160-47be-b66b-051f28285751
1
public static void main(String args[]) { ExecutorService exec = Executors.newCachedThreadPool(); //PriorityBlockingQueue<Runnable> queue = new PriorityBlockingQueue<Runnable>(); PriorityBlockingQueue<Runnable> queue = new PriorityBlockingQueue<Runnable>(); exec.execute(new Prioritize...
cb072c5c-5050-4692-a5d3-74a1219c8f30
3
public List<GenericObject> getOwned() { final List<GenericObject> owned = new ArrayList<GenericObject>(); final String tag = getTag(); for (int i = 1; /* loop until broken */; i++) { GenericObject prov = dataSource.getProvince(i); if (prov == null) break; ...
5c281f70-894b-42c9-95b8-75652a03edeb
0
public static String inputPassword(Frame owner, String loginName) { PasswordDialog dialog = new PasswordDialog(owner, loginName); dialog.setLocation(owner.getLocation()); dialog.setVisible(true); return String.copyValueOf(dialog.password.getPassword()); }
ace421d8-a7df-47ea-bd5f-e22ffc472197
1
@Override public void display() { if (realImage == null) { realImage = new RealImage(fileName); } realImage.display(); }
13a5980d-fb2a-433e-96a6-89c0f2d9e007
7
private void printHangman() { Object[] args = null; switch (getNumErrors()) { case 0: args = new Object[] { "", "", "", "", "", "", "", "" }; break; case 1: args = new Object[] { "O", "", "", "", "", "", "", "" }; break; case 2: args = new Object[] { "O", "", "|", "", "", "", "", "" }; break...
3d156d78-2cf0-46b8-9ecf-7b09b21369c7
1
public static RestS3Service connectToS3(AWSCredentials a){ RestS3Service s3Service = null; try { s3Service = new RestS3Service(a); } catch (S3ServiceException e) { e.printStackTrace(); } return s3Service; }
622cbe4d-9d23-4ddb-9eda-16452787405e
9
public static int[] sliceByTime(CSTable table, int timeCol, Date start, Date end) { if (end.before(start)) { throw new IllegalArgumentException("end<start"); } if (timeCol < 0) { throw new IllegalArgumentException("timeCol :" + timeCol); } int s = -1; ...
936e2257-2d5e-4711-80ad-94e5951c9d61
0
public DefaultComboBoxModel getAnswersCombo() { return answers; }
cbd6242c-1374-41b7-b838-9bbd8a953602
2
public void dbConnect(String db_connect_string, String db_userid, String db_password) { try { Class.forName("net.sourceforge.jtds.jdbc.Driver"); Connection conn = DriverManager.getConnection(db_connect_string, db_userid, db_password); System.out.printl...
8915b016-1777-43cf-9cd1-6db7718e49d7
5
public void edit(Usuario usuario) throws NonexistentEntityException, Exception { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); usuario = em.merge(usuario); em.getTransaction().commit(); } catch (Exception ex) ...
6ed858dc-9c68-42a4-b463-422f712bd507
1
public Calibration getCalibration () { if (calibration == null) { throw new IllegalArgumentException("Missing calibration argument"); } return calibration; }
f51bfb1e-08f3-4278-bf47-f46d5c0efa12
8
@Override public String replace(String[] args, Page page) { String image = ""; String link = ""; String alt = "image"; for (String arg : args) { if (arg.startsWith("img=")) { image = arg.substring("img=".length()); } else if (arg.startsWith("li...
22b8c64e-f343-433c-ac9a-4ba640ff1bf6
4
private void setupForDragging(MouseEvent e) { source.addMouseMotionListener( this ); potentialDrag = true; // Determine the component that will ultimately be moved if (destinationComponent != null) { destination = destinationComponent; } else if (destinationClass == null) { destination = sourc...
f46b268b-95ed-4982-b099-71de24a278e9
7
public static String getAbsolutePath(final String parentPath, final String relativePath) { if (parentPath == null || relativePath == null) return null; if (parentPath.isEmpty() || relativePath.isEmpty()) { return null; } final File parentFile = new File(Filename...
c0f59e7b-cb54-4b75-b0ee-845fbd930c89
6
private void processSessions(Set<SelectionKey> keys) { for (SelectionKey key : keys) { if (!key.isConnectable()) { continue; } SocketChannel ch = (SocketChannel) key.channel(); ConnectionRequest entry = (ConnectionRequest) key.attachment(); ...
1ef74e36-bc98-4ae4-8094-8927d8e3d954
2
public void createFile() { File file=new File(path); if(!file.exists()) { file.getParentFile().mkdirs(); try { file.createNewFile(); } catch (Exception e) { //dobug.log(e,true); e.printStackTrace(); } } }