method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
76d8db1e-9428-42e8-bb00-8a3b13bf6f3b
3
public static String asctodec(String code) { char[] codeline = removeSpaces(code).toCharArray(); String[] parts = new String[codeline.length]; String result = ""; for(int i = 0; i < codeline.length; i++) { parts[i] = ""; if(codeline[i] / 100 < 1) { ...
879bc9d4-fdee-4d62-8e7f-193830fa835d
6
public BookList readBookXML(String inputFile) { //Check to see if xml is valid File schemaFile; Schema schema; Source xmlFile = new StreamSource(new File(inputFile)); SchemaFactory schemaFactory = SchemaFactory .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaFile = new File("bin/schema.xsd"); ...
80856ea7-caf2-462c-bda2-9ada0836ab42
0
@AfterClass public static void tearDownClass() { }
536e2294-a352-4dfb-8464-ae97abfa29a9
2
public VariableStack mapStackToLocal(VariableStack stack) { // first the try block. VariableStack after = subBlocks[0].mapStackToLocal(stack); for (int i = 1; i < subBlocks.length; i++) { // now merge the catch blocks; they start on empty stack. after = VariableStack.merge(after, subBlocks[i].mapStackT...
6680c594-a4b2-4cbd-b05c-3f0a7a3b6b7d
2
public void awake() { synchronized (this) { // Continue to loop until all blockers have exited their section. while (holds.get() > 0) { // Awake all blockers! blockers.proxy().awake(); // Wait at most 1 millisecond or for a notification. try { this.wait(1); } catch (Except...
a6c79853-96ef-4fc1-95c8-8a5660a9686b
0
public MulticastReceiverThread() { super("Multicast Heartbeat Receiver Thread"); //setDaemon(true); }
d5e1f11a-e762-42fb-bf51-915f145c7847
8
public String updateQuantity(int quantitydeduct,int adid) { String query =null,result=null; ResultSet rs; int quan=0; int rowcount; try { System.out.println("Inside inserttransactionupdate"); query = "select quantity from advertisement where adid = " + adid + ""; rs = stmt.executeQuery(query); ...
c3a75395-01d6-45cb-8bad-90aedddbcf2c
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Ryhma other = (Ryhma) obj; if (nimi == null) { if (other.nimi != null) return false; } else if (!nimi.equals(other.nimi)) return fals...
25b86336-3580-4561-b0b1-2aad842a884a
4
public void init(){ if (isInit) { return; } //------------------------------- try { if (settingFile.exists()) { logger.info("File Exsit....Reading"); properties.load(new FileReader(settingFile)); if (checkProperty(properties)) { logger.info("Property read complete!"); this.updateSett...
d1d4ac6d-5649-4803-9930-9b0c69bc002e
3
public String getUserProfileXmlToJsonTransformed() { DefaultHttpClient httpClient = new DefaultHttpClient(); String output = null; try { HttpGet httpGetRequest = new HttpGet("http://localhost:2022/mule-esb/rest/userprofiles"); httpGetRequest.addHeader("accept", "application/json"); HttpResponse respo...
9aed0d8e-eb0b-48d0-9eee-f70194e2ea11
7
void krzyzowanie() { for (int i=0;i<liczba_rozw;i++) { if (loteria.nextFloat() < prawd_krzyz) { int drugi = loteria.nextInt(liczba_rozw); // losowanie drugiego rozwiązania int czy_zam_wierszy = loteria.nextInt(2); // czy zamiana wierszy ( w przeciw...
5b1d62f2-0bd0-4b09-8e7b-8241bace758b
9
private static void piFiller(ArrayList<String> sentenceArrayList, HashMap<Integer, HashMap<String, Double>> piValues, String countFile) throws IOException { HashMap<String, TreeMap<Double, String>> emissionParams = HMMHelpers .eParamsCalculator(countFile); HashMap<String, Integer> nGramMap = HMMHelpers ...
fad351d4-0e87-4dbc-8fbc-442f31db0464
1
public Fox(boolean randomAge, Field field, Location location) { super(field, location); if(randomAge) { setAge(getRandom().nextInt(MAX_AGE)); setFoodLevel(getRandom().nextInt(RABBIT_FOOD_VALUE)); } else { setAge(0); setFoodLevel(RABBIT_...
07d3c100-d2c6-4ce7-b8a7-a5f298277f1d
8
public static void main(String[] args) { if (args.length < 3 || (! args[0].startsWith("-b") && ! args[0].startsWith("-s") && !args[0].startsWith("-c")) ){ System.err.println("usage: com.github.dyamah.sjdat.tools.MkTrie -[b|s|c] trie keys"); System.exit(1); } if (args[0]....
a6e503e6-d5fa-4208-a648-0fd17405f7e8
1
public Object get(int index) throws JSONException { Object object = this.opt(index); if (object == null) { throw new JSONException("JSONArray[" + index + "] not found."); } return object; }
bb2e083e-de5a-4d99-aff2-f59eccd6ace1
1
public static void main(String[] args) { InetAddress addr = null; String ip = null; int port; // String portString = JOptionPane.showInputDialog(null, "˿ :"); // // // if(portString!=null ){ // port = Integer.parseInt(portString); // } // else{ // port = 9090; // } port = 9090; try { addr = Inet...
c7d84b43-2dd5-4b5b-83bb-98f5d3d9c7e2
0
public static <T> Query<T> flatternChildren(T ancestor, Selector<T, Iterable<T>> selector) { Iterable<T> rs = new FlatternerIterable<T>(ancestor, selector); return new Query<T>(rs); }
3db73bb9-23a7-4096-aa06-fbba81016958
6
private ErrorHandlingState decideDialogBasedErrorHandling(Dialog currentDialog) { DialogModus dialogModus = currentDialog.getDialogModus(); String result; ErrorHandlingState errorState = null; switch(dialogModus) { case START: result = handleStart(currentDialog); this.errorHandling = ErrorHandling....
4ca49325-baf4-41f0-b8a7-1b5dd54ff056
7
private void writeParameter( StringBuilder sb, Node parameter, Node configurationElement ) throws MojoExecutionException { String parameterName = getValue( parameter, "name" ); String parameterDescription = getValue( parameter, "description" ); Node fieldConfigurationElement = findS...
57027d2a-8ccc-42f7-95d3-8e7aadb51c81
2
public void startRunnable(Runnable runnable, int priority) { if (priority > 10) { priority = 10; } if (Signlink.mainapp != null) { Signlink.startthread(runnable, priority); } else { super.startRunnable(runnable, priority); } }
6f421bf4-964e-4236-98b8-27523883f845
9
private Method getActionMethod(Object action, String methodName) { // 不能直接调用init和destroy方法 if (methodName.equals(Constants.ACTION_INIT_METHOD) || methodName.equals(Constants.ACTION_INIT_METHOD)) { return null; } String key = action.getClass().getName() + '$' + me...
3edd0cd7-a2ee-45d4-99a8-599f0db132b4
8
public static Interval convergentInterval(Interval oldInter, Interval newInter) { if (oldInter.isBottom() || newInter.isBottom()) return Interval.BOTTOM; if (newInter.getUpperBound() > oldInter.getUpperBound() && !(newInter.getLowerBound() < oldInter.getLowerBound())) { return new Interval( oldInter.getL...
d4105858-ef94-4c55-b1cf-bcb0e6cd21f2
5
public static void disableControls(Component comp) { if (comp instanceof Container) { Container container = (Container) comp; int count = container.getComponentCount(); for (int i = 0; i < count; i++) { disableControls(container.getComponent(i)); } } if (comp instanceof AbstractButton || comp in...
8cb7352a-cdce-48ee-8f89-51c939118adb
2
public String[] getCarnumberByUID(Statement statement,String UID)//根据用户ID获取车牌号 { int i = 0; String[] result = new String[20]; sql = "select carnumber from CarNumber where UID = '" + UID +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result[i] = rs.getString("carnumber"...
be0e93de-5907-4b4c-8bbe-df6374677f50
2
protected void repaint( long delay ) { if( fContainer != null && fBounds!=null ) { fContainer.repaint(delay, fBounds.x,fBounds.y,fBounds.width,fBounds.height); } }
ae9e2e6e-a3c3-40db-a92a-d8745d4190ce
1
public static void main(String[] args) { filename = System.getProperty("user.dir")+"\\target\\Reports.html"; FileWriter fstream =null; BufferedWriter out =null; try { fstream = new FileWriter(filename); out = new BufferedWriter(fstream); String RUN_DATE = TestUtil.now("dd.MMMMM.yyyy").to...
2af1dcad-7fec-48cc-8ae4-5753480ca159
8
@Override public void run() { while (t != null) { for (SubSystem system : systems) { system.processOneGameTick(0); System.out.println(system.getSimpleName()); } renderingSystem.processOneGameTick(0); repaint(); try {...
e3fd2af1-56d1-48ae-b64b-74938072229a
5
public FormData readFormData() throws IOException, HeaderFormatException, DataFormatException, UnsupportedFormatException { // Switch the request's 'Content-Type' field. HTTPHeaderLine hl_contentType = this.getRequestHeaders().get( HTTPHeaders.NAME_CONTENT_TYPE ); // This search is ...
dda7e8b2-901e-46b7-bb27-12b6c98f69cf
3
public void createReferenceObjects(){ System.out.println("Creating "+ref_objects_num+ " reference objects..."); //We first create the directory to store the referenceo object file //in case it does not exists. File indexDirectory_f=new File(indexDirectory); if(!inde...
6bca5ab7-1e12-4ea0-82ed-b6cbdb51d2d2
9
public void enhanceList(MOB mob) { final StringBuffer extras=new StringBuffer(""); String stage=null; String key=null; final List<String> types=getThisSkillsExpertises(); for(int t=0;t<types.size();t++) { key=types.get(t); final int stages=CMLib.expertises().getStages(key); final EnhancedExpertise...
9a8ed184-1ffa-412d-ab88-959f12f1bfdd
4
public static Location findLocation( Color p, Location from, int distance) { int _to; if (from == Location.B_BAR) { _to = distance; } else if (from == Location.R_BAR) { _to = 25 - distance; } else { _to = fro...
947b105d-591c-45ee-a6cb-a685585a2295
0
public static void incrementId() { id++; }
0ab7f201-207a-40cd-b059-395d3703c352
4
public Generator(String arrival_file, String rates_file, int stream) { s = stream; arrivalTimes = new ArrayList<Double>(); arrivals = new HashMap<Double, Double>(); speeds = new HashMap<Double, Double>(); speedCdf = new ArrayList<Double>(); try { Path path = FileSystems.getDefault().getPath(arriva...
bab8376f-d603-4947-9cc5-d690fc15cf0b
3
public void saveToFile(File f) { try { ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream(f)); for (Osoba osoba : data) { outputStream.writeObject(osoba); } outputStream.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.p...
2b5bec96-078f-4e09-a55b-f02a16d70525
4
private static Result doSendViaGcm(String message, Sender sender, DeviceInfo deviceInfo) throws IOException { // Trim message if needed. if (message.length() > 1000) { message = message.substring(0, 1000) + "[...]"; } // This message object is a Google Cloud Messaging object, it is NOT ...
9a2cba29-b6a2-47ab-bf79-90f8c7a051e5
4
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("------------ RunningStatus ------------\n"); sb.append("[taskId] " + taskId + "\n"); sb.append("[RunningPhase] " + runningPhase + "\n"); sb.append("[is map() running] " + isMapRunning + "\n\n"); sb.append("------------ map() --------...
d354a14c-3148-4e98-9ae3-02d51a52d065
3
private boolean notInSameLUPair(Integer s) { for (AcceptingPair pair : acceptanceCondition) { if (pair.U.contains(s)) { HashSet<Integer> tmpSs = (HashSet<Integer>) liveStates.clone(); tmpSs.retainAll(pair.L); if (tmpSs.isEmpty()) { return true; } } } return false; }
23006968-476f-4cfe-9fbe-46721fd8fed1
4
@Override public AsciiImage execute(AsciiImage img) throws OperationException { charset = img.getCharset(); if (!charset.contains("" + threshold)) throw new OperationException(); for (int x = 0; x < img.getWidth(); ++x) { for (int y = 0; y < img.getHeight(); ++y) {...
6f034389-0a8a-49ba-8eaf-3557859038e5
3
public void saveHotel() { if (fileConfiguration == null || HotelFile == null) { return; } else { try { getHotel().save(HotelFile); } catch (IOException ex) { plugin.getLogger().log(Level.SEVERE, "Could not save Hotel to " + HotelFile, e...
5e165c57-192c-412f-9396-fd3cd577f9ea
4
public void init(String n,int id){ if(n.equals("Promotion")) etat = Etat.Promotion; else if (n.equals("Promotion2")){ etat = Etat.Promotion2; } else if (n.equals("Promotion1")){ etat = Etat.Promotion1; try { this...
3bca670c-1228-4d2b-b0b8-aa92d1e74b58
0
public static void main(String[] args) { Parcel p = new Parcel(); Contents c = p.contents(); Destination d = p.destination("Tasmania"); // Illegal -- can't access private class: // ! Parcel4.PContents pc = p.new PContents(); }
644ce65b-c764-4886-b9ce-f730922ff363
1
public void checkCast(final Type type) { if (!type.equals(OBJECT_TYPE)) { typeInsn(Opcodes.CHECKCAST, type); } }
8443bc8f-27ff-4ec5-9e36-2821d87bf786
9
private boolean verifyHTMLContent(File file) { BufferedReader reader = null; boolean valid = true; try { reader = new BufferedReader(new FileReader(file)); String line; while ((line = reader.readLine()) != null) { if (line.contains("content=\"text/html;charset=utf-8\"")) { valid = false; } e...
78e7279a-222e-4ec3-af6b-37a1bb95748d
3
public boolean equals(Object var1) { if(!(var1 instanceof ChunkPosition)) { return false; } else { ChunkPosition var2 = (ChunkPosition)var1; return var2.x == this.x && var2.y == this.y && var2.z == this.z; } }
6aee6cce-ecb0-44a6-9a1e-e64d9f97f8b9
3
void clearPrinted() { HashMap<Integer,Node> hash = new HashMap<Integer,Node>(1500); SimpleQueue<Node> queue = new SimpleQueue<Node>(); queue.add(start); while ( !queue.isEmpty() ) { Node node = queue.poll(); ListIterator<Arc> iter = node.outgoingArcs(); while ( iter.hasNext() ) { Arc a = iter...
a1f64c0e-360f-47de-bc08-1ecaeddf40eb
2
public static void main(String[] args) { // All code that accesses the simple GUI must run in the AWT event handling thread. // A simple way to achieve this is to run the entire application in the AWT event handling thread. // This is done by simply wrapping the body of the main method in a call of EventQueue.inv...
3a9cdd9d-67a8-4cbd-a555-ef4dfa64d7d8
6
public static void main2(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://dow...
1b6bdc11-89c6-4cb0-a3e5-c18627c12cc0
4
public void dragEventOccurred(String startZone, int mouseX, int mouseY, Boolean dragComplete) { if(!dragComplete && Debug.localMouse == true) System.out.println("Drag started at "+startZone+", now at "+ mouseX+","+mouseY); if(dragComplete && Debug.localMouse == true) System.out.println("Dra...
5b85fd58-b0c5-43d2-a724-5908bccd63d7
6
public void okButtonActionPerformed(java.awt.event.ActionEvent e) { Image i = image_frame.getJIPTImage().getImage(); Image new_image = i; // Check for prefilter if(meanPrefilterRadio.isSelected()) { //System.out.println("Mean prefilter selected"); String ...
16df6a1c-c699-47f7-8fe6-d416a5954627
0
public String getShortName() { return super.toString(); }
32fe2dc8-21c3-459c-b3df-5c3055036b3d
3
public Value get(Key key) { Node temp = root; while (temp != null) { int cmp = key.compareTo(temp.key); if (cmp < 0) temp = temp.left; else if (cmp > 0) temp = temp.right; else return temp.value; } ...
5257f9ff-5ff4-4684-a8af-80e65755d1b5
5
private void listenSocket() { // Create server try { serverSocket = new ServerSocket(port); } catch (IOException e) { System.err.println("Could not listen on port: 10007."); } //Wait for clients to connect while(true){ // Temp client object Client c; try { System.out.println(...
12f85784-d2a6-4ad9-a5c2-8670c03dbd51
3
private boolean isPositioned(FieldItem item) { for (int i = 0; i < field.length; i++) { for (int j = 0; j < field[0].length; j++) { if (item == field[i][j]) { return true; } } } return false; }
a6b1bb15-1e3f-4adf-a4e7-657072ddc614
3
private void countExecutedViewers() { count = 0; for (int i = 0; i < matrix.length; i++) for (int j = 0; j < matrix[i].length; j++) if (matrix[i][j].isShowed()) count++; }
5ff29f41-561a-46cf-aac5-2e276576b242
7
@Override public List<Course> getFreeCourse() throws SQLException { List<Course> courseList = new ArrayList<>(); Connection connect = null; PreparedStatement statement = null; try { Class.forName(Params.bundle.getString("urlDriver")); connect = DriverManager.g...
716f130e-f019-4b8c-bc9f-4d7847aec18a
4
public static void kickPlayer( String sender, String player, String reason ) { if ( reason.equals( "" ) ) { reason = Messages.DEFAULT_KICK_MESSAGE; } BSPlayer p = PlayerManager.getPlayer( sender ); BSPlayer t = PlayerManager.getSimilarPlayer( player ); if ( t == null ...
5a668af7-c64f-47e5-adb3-7d74f926f77d
6
public boolean equals(MC_Location loc) { if(x != loc.x) return false; if(y != loc.y) return false; if(z != loc.z) return false; if(dimension != loc.dimension) return false; if(Math.abs(yaw - loc.yaw) > 0.0001) return false; if(Math.abs(pitch - loc.pitch) > 0.0001) return false; return true; ...
ebb104e9-5272-45bc-b8cf-008337c1ec52
0
public RouterPacket GetRecentPacket() { return recentPacket; }
bfd71834-bbe9-41de-ab08-e82865eedfa9
8
public List<Integer> getIntegerList(String path) { List<?> list = getList(path); if (list == null) { return new ArrayList<Integer>(0); } List<Integer> result = new ArrayList<Integer>(); for (Object object : list) { if (object instanceof Integer) { ...
13138d22-8d29-42c5-a12a-35d09a797086
9
private void handle(boolean sv, SyncPDU m) throws Exception { SyncPeer f = m.getFrom(); SyncPeer t = m.getTo(); byte[] sid = m.getSetID(); int mB = m.getSetsize(); long begin = m.getBegin(); long end = m.getEnd(); long[] eB = m.getRecVector(); ...
e05cb13f-c7ee-470e-910a-cee78169a876
1
private double hahmojenValinenKulma(Pelihahmo h){ if (h == h1){ return h1Kulmah2(); } else { return h2Kulmah1(); } }
252c4608-b572-4567-ae1b-e32655c26f8a
9
public static void test(){ //10 4 //25 20 9 100 BufferedReader br=null; try{ String sCurrentLine; br=new BufferedReader(new FileReader("C:\\Users\\CPD02\\Downloads\\A-small-practice (1).in")); sCurrentLine="1"; int testCase=Integer.parseInt(sCurrentLine); for(int i=1;i<=testCase;i++){ String ...
895ae2cf-b89a-4c5a-bf7e-5d6ca3baa092
6
protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else ...
7fd07ebf-b422-4365-be14-3988f4b5eb6e
1
@Override public void cleanUp() { synchronized (registeredListeningObjects) { registeredListeningObjects.clear(); } synchronized (currentMouseOver) { currentMouseOver.clear(); } synchronized (waitingEventLists) { for (Collection<IMouseEventable> list : waitingEventLists.values()) { list.clear();...
bb8bc386-c72e-4b36-a720-9371c204bf4b
1
protected void processTimeEvent(TimeEvent e) { if(timeListener != null) { timeListener.timeStep(e); } }
efa252b9-0e16-4232-a37f-3e13cfa1fc74
8
public static Keyword nativeSlotReaderSpecialist(ControlFrame frame, Keyword lastmove) { { Proposition proposition = frame.proposition; NamedDescription description = Logic.getDescription(((Surrogate)(proposition.operator))); Stella_Object argumentvalue = Logic.argumentBoundTo((proposition.arguments.the...
5a902d62-2b56-493e-852c-f1937226d05c
8
static DefaultSwitchBuilder create(Mandatory mandatory, int number, String switch1, String... switches) { if (mandatory == null) { throw new NullPointerException("mandatory"); } List<String> list; checkSwitch(switch1); if (switches != null && switches.length > 0) { list = new ArrayList<String>(); lis...
cf64d689-ca06-4f68-9221-899d52cf2ee0
8
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try { HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.set...
6d1f62d5-a564-42ec-9f2d-19cd8550a98d
1
public void render() { for (int i = 0; i < pixels.length; i++) { pixels[i] = 0xff000000; } }
4a72c75d-a4cb-4048-9365-e67c4b7c51a1
4
private void init() { // Create the map from resource to Sites that contains it // and remove the resources that no site contains it Set<String> removeResources = new HashSet<String>(); for (String resource : resources) { List<Site> temp = new LinkedList<Site>(); ...
dd347f41-afc1-460c-acdf-213af5e42e67
7
public Board() { _board = new ChessPiece[8][8]; int r = 0; String color = "B"; for (ChessPiece[] row : _board) { for (ChessPiece piece : row) { if (r == 0 || r == 7) { _board[r][0] = new Rook(color); _board[r][1] = new Knight(color); _board[r][2] = new Bishop(color); _board[r][3] = ne...
46e84f91-d314-42e7-b84d-ff0a7ac8be8a
7
public int sumNumbersItr(TreeNode root) { // IMPORTANT: Please reset any member data you declared, as // the same Solution instance will be reused for each test case. int res = 0; int tmp = 0; if (root == null) return res; Stack<TreeNode> stack = new Stack<TreeNode>(); HashSet<TreeNode> visited = new H...
d35ff559-b261-4fb3-9d5e-18d913af3b66
7
public ArrayList<Move> getPossibleMoves() { ArrayList<Move> possibleMoves = new ArrayList<Move>(); for(int i = -1; i <= 1; i ++) { for(int j = -1; j <= 1; j ++) { boolean openSpace = true; int count = 1; while(openSpace) { Location currentLoc = new Location(getLoc().getRow() + ...
7e1521ef-b49c-4c67-879c-3f7b24a83e9e
1
public long getTotalElapsedTimeSecs() { long elapsed; if (running) { elapsed = ((System.currentTimeMillis() - startTime) ); elapsed +=totalTime; elapsed = elapsed / 1000; } else { elapsed = (totalTime / 1000); } return elaps...
e559ed5e-9dd3-4ba7-b29d-fa40f164211b
6
public void handlePacket(Packet packet){ switch (packet.getID()){ case 1: RegisterUserPacket registerUserPacket = (RegisterUserPacket) packet; DB_users registerUser = registerUserPacket.getUser(); System.out.println("Received registerUserPacket. User: " + reg...
26de5417-1ea9-4de0-ac75-59fff5582cdd
1
public Type pop() { if (top < 1) throw new IndexOutOfBoundsException("Stack is empty"); return stack[--top]; }
b4b54ba1-e2ca-4703-a6c2-4ca54779086a
3
@Override public void ParseIn(Connection Main, Server Environment) { int UserId = Main.DecodeInt(); if(!Main.Data.Friends.contains(UserId)) { Environment.InitPacket(349, Main.ClientMessage); Environment.Append(0, Main.ClientMessage); Environment.EndPa...
090422dd-8103-445e-a2c7-382ef7fa0a12
3
private void executeArg(String arg, String[] words, HTMLDocument doc) throws IOException, BadLocationException { if (arg.equals("-w")){ page.setCountWords(getCountMap(words, doc)); return; } if (arg.equals("-c")){ page.setCountCharacters(doc.getText(0, doc.get...
92c87425-3afc-438e-9642-9fe4a8fb7985
3
protected void changeView(String name) { if (name.equals("Noninverted Tree")) { treeDerivationLayout.first(treeDerivationPane); treeDrawer.setInverted(false); treePanel.repaint(); } else if (name.equals("Inverted Tree")) { treeDerivationLayout.first(treeDerivationPane); treeDrawer.setInverted(true); ...
12810d82-8bd3-42e5-9e10-a15f22f140cf
3
public void setTimeout(int time) { this.timeout = time; // super.removeCommand(ALERT_COMMAND); if (timeout != FOREVER) { terminator = new Thread() { public void run() { try { sleep(timeout); if (terminator == this) { handleCommand(DISMISS_COMMAND, null); } } catch (Inte...
cb80670f-2866-4958-836a-c89500edbb74
0
public void setA(float a) { this.a = a; }
e8423898-6d61-46d5-974e-f9b94d1ce750
0
public String getId() { return id; }
a6679b9e-ca08-4ebe-9ab1-2b63cdab95f5
4
public void ReadLogFile() { try { if (returnValue == JFileChooser.APPROVE_OPTION) { fileWithXmlAndGarbageData = chooserForReadingLogFile.getSelectedFile(); filepath = fileWithXmlAndGarbageData.getCanonicalPath() .substring( 0, fileWithXmlAndGarbageData.getCanonicalPath() ...
0b340ea5-0468-48d6-9fa2-746cf3c1282d
8
public void finish() { for (Entry<String, Collector<?, ?, ?>> ee : coll.entrySet()) { Collector<?, ?, ?> collector = ee.getValue(); @SuppressWarnings("unchecked") Function<Object, Object> finisher = (Function<Object, Object>) collector.finisher(); Object value = values.get(ee.getKey()); Objects.req...
e408b2ee-0edb-4628-9a37-ddabd967c060
3
@Override protected boolean deletingGUI(Object o) { viewingGUI(o); String op; while(true){ op = guiImpl.requestData("Deseja apagar esse Cliente? S/N:"); op = op.toLowerCase(); if(op.charAt(0)=='s'){ return true; } if...
8cb1e15a-48ae-46e0-93ad-abb1f8ef8737
9
public void actionPerformed(ActionEvent ae) { if(ae.getSource() == GUI.g.playButton){ if(GUI.g.enterName.getText().trim().length() == 0){ GUI.g.mainMenuPanel.validName = false; GUI.g.repaint(); GUI.g.mainMenuPanel.repaint(); } else{ GUI.g.connect(); GUI.g.playerName = GUI.g.enterName....
bb6b3223-461e-4944-b4a4-d3d31450bcb3
3
private void setUpDatabase() { File f = new File(DBNAME); boolean firstRun = !f.exists(); dbconn = new SQLiteDatabaseConnector(DBNAME); try { dbconn.openDBConnection(); } catch (SQLException e) { e.printStackTrace(); System.out.println("Could not open Connection"); System.exit(0); } if (fir...
225a29c7-1737-4a57-8aba-5614853d7221
4
private Object handleLang(Object tos) { if ((tos instanceof Submitter && ((Submitter)tos).getLanguage() == null) || (tos instanceof Header && ((Header)tos).getLanguage() == null)) { return new FieldRef(tos, "Language"); } return null; }
ccbfe905-dbe3-4545-ae00-f51e31004dda
8
@Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { //Move up case KeyEvent.VK_UP: case KeyEvent.VK_W: yoshi.location.y -= 10; repaint(); break; // Move Left case KeyEvent.VK_L...
b39a8bf0-9c71-484b-b5cf-5cfccee3f933
7
public static void main(String[] args) { // TODO code application logic here //9. Dado un número entero positivo determinar si es la potencia de dos de otro número entero. //No empezar a programar, lea las limitaciones. //Por ejemplo: //Si la función recibe 25, debe devolver TRUE, porque 5 ^ 2 = 25 Si la funció...
24bef4af-ac5f-4602-8ccd-aeaa7e58cf3e
6
static boolean ejecutarAccion(int popcion)throws java.io.IOException { boolean noSalir = true; //Arreglo con valores predefinidos //Nota: Se puede crear un método donde el usuario manualmente ingrese //los valores int [] valores = {4,5,6,1,1,2,4,56,6,45,1,2,10,100,45...
f6fb1c46-20ef-44bb-85e0-655a5f6bc67d
0
public Object getValue() { return value; }
fdcc3a32-602b-4d8c-86ca-fd175edc4cae
6
public final static void scale2(String srcImageFile, String result, int height, int width, boolean bb) { try { double ratio = 0.0; // 缩放比例 File f = new File(srcImageFile); BufferedImage bi = ImageIO.read(f); Image itemp = bi.getScaledInstance(width, height, bi.SCA...
0204eb89-1e99-42e8-84c7-d179c7989da9
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the ...
81e5da1c-1c51-492b-a06a-8a32e5cb8abf
4
public boolean equals(XmlNode node) { if (node != null) { if (this.nodetype.equals(node.nodetype) && this.attris.equals(node.attris) && this.path.equals(node.path)) return true; } return false; }
d5961221-c2c7-4a76-92bf-c1d0f55acdd7
5
@Override public void update(GameContainer gc, StateBasedGame sbg, int delte) throws SlickException { Input input = gc.getInput(); if (input.isKeyDown(Input.KEY_DOWN)) { selectorOffset = 15f; } else if (input.isKeyDown(Input.KEY_UP)) { selectorOffset = 0; } else if (input.isKeyDown(Input.KEY_SPACE) ...
dcc840e6-4c6b-4551-b9db-82bbdf91f52a
7
public static List getSystemFiles(SystemDefinition system, Keyword type, boolean probefilesP) { { List files = List.newList(); String filename = null; { Object old$Currentsystemdefinition$000 = Stella.$CURRENTSYSTEMDEFINITION$.get(); Object old$Currentsystemdefinitionsubdirectory$000 = Stella.$...
006d84a1-ba73-4525-9115-64f8795e979a
9
void compress( int init_bits, OutputStream outs ) throws IOException { int fcode; int i /* = 0 */; int c; int ent; int disp; int hsize_reg; int hshift; // Set up the globals: g_init_bits - initial number of bits g_...
b6de2854-b9e7-4c12-99b0-70f30ad7bb30
3
public ParseTreeNode excludeSetTail() throws SyntaxError { ParseTreeNode node = new ParseTreeNode("<exclude-set-tail>"); if (accept('[')) { node.addChild("["); node.addChild(charSet()); if (accept(']')) { node.addChild("]"); } return node; } else if (isDefinedClass()) { node.addChild(String....
05d589a5-e86d-4575-9f49-7fe90dd0334d
8
public void run() { int to = 0, d = 0; // first itaration int vertix = 1; int distance = 0; verticesWeight[0] = 0; for (WeightedEdge edge : data.get(vertix)) { to = edge.getTo(); d = distance + edge.getWeight(); if (verticesWeight[to - 1] > d) { verticesWeight[to - 1] = d; queue.add(ed...