method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
13254d0c-84e9-4dcd-afa9-ff376b11c4e2
3
public boolean didHouseWin() { return !theHouse.hasBust() && theHouse.getScore() > player.getScore() || theHouse.getScore() <= 21 && player.hasBust(); }
8cfd5127-006b-4b86-a28a-42028c4354f5
5
String longestPalindrome (String s){ String longest; int l = s.length(); if (l==0) return ""; longest = s.substring(0,1); // a single char itself is a palindrome for (int i = 0; i < l-1; i++) { String s1 = expandCenter(s,i,i); if (s1.length() > longest.length()) longest = s1; String s2 = ex...
29a2e20c-47c5-4752-a825-8de31e1b2959
1
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); EntradaParam oEntradaParam = new EntradaParam(request); EntradaBean oEntradaBean = new EntradaBean(); HiloDao...
7013341e-f44a-460b-8f97-79a9f33a13ad
9
public void setFormat(String s) { if ("xmi".equalsIgnoreCase(s)) { option.setFileFormat(FileFormat.XMI_STANDARD); } if ("xmi:argo".equalsIgnoreCase(s)) { option.setFileFormat(FileFormat.XMI_ARGO); } if ("xmi:start".equalsIgnoreCase(s)) { option.setFileFormat(FileFormat.XMI_STAR); } if ("eps".equa...
5b9eb530-f810-48d2-a858-e17c5b3d4682
4
public synchronized void loadConfigData(String propFile, boolean overwriteProperty) { Configuration propData = getConfigFileData(propFile); if (propData != null) { Iterator<String> itr = propData.getKeys(); while (itr.hasNext()) { String key = itr.next(); if (ove...
e27a9fbf-f8c6-4d03-a850-f0d32635896a
2
private void readmagicItemsFromFileToList(String fileName, ListMan lm) { File myFile = new File(fileName); try { Scanner input = new Scanner(myFile); while (input.hasNext()) { // Read a line from the file. String itemName = input.nextLine(); // Construct a new list item and set its attributes. ...
aac95246-b99c-4e21-892d-10f18ae4533a
5
public static void addNew() { for (Organism org: a) { switch (org.species) { case Organism.BLUE: bOrgs.add(org); break; case Organism.RED: rOrgs.add(org); break; case Organism.YELLOW: yOrgs.add(org); break; ...
366330e8-c937-46d6-945b-0867cc9a0d55
2
public static AbstractModel getRegularGrid(int min, int max, int distance,AbstractModel result) { // AbstractModel result = new ModelParallel(); for (int i = min; i < max; i += distance) { for (int j = min; j < max; j += distance) { result.p.add(new Particle(0.5, 0, 0, i, j)); } } return result; }
3427b300-5cb3-4eaa-855d-76831ba73408
8
GridData getData(Control[][] grid, int row, int column, int rowCount, int columnCount, boolean first) { Control control = grid[row][column]; if (control != null) { GridData data = (GridData) control.getLayoutData(); int hSpan = Math.max(1, Math.min(data.horizontalSpan, columnCount)); int vSpan = Math.ma...
a411461a-18cd-4c3b-87fb-d565a6e75ddd
7
public String escapeObfuscation() { String escapeObfuscatedCode = null; /* * エスケープ処理は文字ごとに行う必要があるため、1文字ずつに分ける。 * 後に正規表現により比較作業を行うため、String型の配列に格納する。 */ char ch[] = targetCode.toCharArray(); String[] choppedCode = new String[ch.length]; for (int i = 0; i < choppedCode.length; i++) { choppedCode[...
764ab10d-9bb8-490e-b9c1-d0cc107be48b
8
@Override public V put(K key, V value) { V candidateValue = straight.get(key); K candidateKey = reverse.get(value); if (candidateKey==null && candidateValue==null) { straight.put(key, value); reverse.put(value, key); return null; } else if (candidateKey==null && candidateValue!=null) { V cur...
8a74c0c7-7daf-47e5-aecf-c154886a54a5
2
private ChannelEventsListener getChannelEventsListener(String name) { for (ChannelEventsListener listener : channelEventsListeners) { if ( listener.getChannelName().equalsIgnoreCase(name) ) return listener; } return null; }
b963ca69-0835-462f-a27c-9bfb426c7648
5
@Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.MAGENTA); g.fillRect(0, 0, tileSize * tileLineWidth, this.getHeight()); // System.out.println(imgs.size()); // for(int i = 0; i < imgs.length; i++){ Ima...
5f2e6751-2b6e-4f4b-a128-df61c37b6f0c
0
public TreeNode nodeAtPoint(Point2D point) { return treeDrawer.nodeAtPoint(point, getSize()); }
715242cc-9900-443c-97f2-4195d987e30f
6
@Test public void addParameterTest() { TeleSignRequest tr; if(!timeouts && !isHttpsProtocolSet) tr = new TeleSignRequest("https://rest.telesign.com", "/v1/phoneid/standard/15551234567", "GET", "customer_id", "secret_key"); else if(timeouts && !isHttpsProtocolSet) tr = new TeleSignRequest("https://rest.tele...
eeba5d90-4113-4333-be15-3eee946dfd6b
6
public boolean isSCC() { Set<V> visited = new HashSet<>(); //Step 1 : clone and obtain a reversed graph MyGraph<V,E> reversed = cloneAndReverse(); //Step 2: Calculate finishing times.. pass the vertex one by one Set<Vertex<V>> vertices = reversed.getAllVertex(); //stack...
76054287-cc05-43d0-91ec-280efeb78330
2
public ArrayList<Integer> decodage(ArrayList<Integer> codeADecoder) { ArrayList<Integer> codeSort = new ArrayList<Integer>(); ArrayList<Integer> chaineDecodee = new ArrayList<Integer>(); //Trie du code codeSort = new ArrayList<>(codeADecoder); Collections.sort(codeSor...
53c5b210-5f7e-498b-be5b-9808a26ba52f
3
@Override public Customer findCustomerByEmail(String email) { String sql = "SELECT * FROM customer WHERE email='" + email + "';"; Connection con = null; Customer customer = null; try { con = getConnection(); PreparedStatement statement = con.prepareStatement(sql); ResultSet resultSet = statement.ex...
daaea4cc-2fcc-4369-ab3f-53177f49f189
7
public waitGUI() throws ImageLoadFailException { addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { //listens for Spacebar to skip to next GUI if(' ' == e.getKeyChar()) waiter.startNext(); } }); setResizable(false); ImageIcon loadIcon = null; JOptionPane .show...
f6378b76-6ea7-4352-ba8a-2ff35e434f94
9
private void run() { Scanner scn = new Scanner(System.in); String line = scn.nextLine(); while (!line.trim().equals("0 0 0")) { String input[] = line.trim().split(" "); stickers = 0; lr = -1; cr = -1; lin = Integer.parseInt(input[0]); ...
62153d99-23ed-4fe9-9ab4-64af1e4205d1
9
protected static int matchColour(Color colour, Color[] palette, int paletteStart, int paletteEnd, double chromaWeight) { if (chromaWeight < 0.0) { int bestI = paletteStart; int bestD = 4 * 256 * 256; for (int i = paletteStart; i < paletteEnd; i++) { int ðr = colour.getRed() - palette[i].ge...
5d9387df-cadc-4446-8cef-7bca1829b591
6
public static void setPixels(BufferedImage img, int x, int y, int w, int h, int[] pixels) { if (pixels == null || w == 0 || h == 0) { return; } else if (pixels.length < w * h) { throw new IllegalArgumentException("pixels array must have a length" ...
f693bc7a-13f0-4e3b-93f3-e3f10eb7aba0
5
public void trackTarget(){ Target targetFromDashboard = null; String visionData = SmartDashboard.getString("VisionData", null); if (visionData == null) { // Only report error once if (!m_visionWidgetMissingReported) { System.out.println("VisionDat...
b6662172-1c42-4a57-8b2f-d84027daf581
7
private String getscoreMineralDifference(HashMap<String, int[]> otherScoreMinerals){ String a = ""; int scoreDiff = 0; int mineralDiff = 0; if(!otherScoreMinerals.keySet().equals(playerScoreMinerals.keySet())){ for(String s: otherScoreMinerals.keySet()){System.out.println(s);} System.out.println("differe...
c81d5ba3-3455-4237-a888-a4f94df91449
8
public void namiLogin() throws IOException, NamiLoginException { // skip if already logged in if (isAuthenticated) { return; } HttpPost httpPost = new HttpPost(NamiURIBuilder.getLoginURIBuilder( server).build()); List<NameValuePair> nvps = new ArrayLi...
b5d12691-224d-436a-a1c7-25f9a94751dc
0
public void setId(Long id) { this.id = id; }
ecabe776-aed8-4934-a140-e8afc6352147
1
public static void main(String args[]) { for (;;) { break; } System.out.println("Value:" + new TestFor().test); }
928a601b-b22d-431e-aa84-311cdff58743
2
public long node() { if (version() != 1) { throw new UnsupportedOperationException("Not a time-based UUID"); } if (node < 0) { node = leastSigBits & 0x0000FFFFFFFFFFFFL; } return node; }
b66cb7ab-d460-429f-a852-409eabb4f385
3
public void EliminaFinal () { if ( VaciaLista()) System.out.println ("No hay elementos"); else { if (PrimerNodo == PrimerNodo.siguiente) PrimerNodo = null; else { NodosProcesos Actual =PrimerNodo; while (Actual.siguiente.siguiente != PrimerNodo) Actual = Actual.siguiente; Actua...
475b0454-68dd-4311-88a2-ea1262334e12
6
@SuppressWarnings("unchecked") public <T> T[] getArray(Class<T> type, ReadCallback<T> callback) { if (getBoolean()) { T[] array = (T[])Array.newInstance(type, getUshort()); if (!valid) { return null; } for (int i = 0; i < array.length && valid; i++) { if (getBoolean()) { array[i] = callbac...
06826a32-3be3-4b19-9ccc-2b85fcb6a524
8
public void makeExcitatoryVBHConnections3(CABot3Net linesNet, CABot3Net gratingsNet, String lineType, String grateType){ int netSize =linesNet.getInputSize(); int column; int cols = linesNet.getCols(); double weight; if (grateType.compareToIgnoreCase("vgrate3")==0){ weight = 1.5; } el...
96c36707-3ca0-4053-9ed4-0376e15e2be8
3
public static Map<String, Ban> load(String path) { Map<String, Ban> result = Collections.emptyMap(); File f = new File(path); if (f.exists() == false) { touchBanList(path); } else { try { FileInputStream fileStream = new FileInputStream(f); ...
a82b4b4e-4ed7-4723-a497-99ec7e78e0d7
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if((commands.size()<1)&&(givenTarget==null)) { mob.tell(L("What would you like to open?")); return false; } final Environmental item=super.getAnyTarget(mob,commands,givenTarget,Wearable.FIL...
a5454a66-e09b-4827-a69d-540bfe25c2fb
9
@Override protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { DatabaseManager manager=DatabaseManager.getManager(); try { Equipment equipment = manager.getEquipmentDao().queryForId( Integer.parseInt(request.getParameter(ID))); if(equipment=...
4856d0ee-a183-4cad-883d-90312b4e36ca
4
@Override public String toString() { StringBuilder hex = new StringBuilder(); for(byte b : value) { String hexDigits = Integer.toHexString(b).toUpperCase(); if(hexDigits.length() == 1) { hex.append("0"); } hex.append(hexDigits).append(" "); } String name = getName(); String append = ""; if(...
3212ba4c-852d-4a83-877a-15287f3070f1
6
public static void main(String args[]) { //<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://download.oracle.com/javase/tutorial/uiswing/loo...
61674307-ccfc-4420-a5a4-4fc55c3d5e7b
5
public void start(BundleContext context) throws Exception { m_context = context; synchronized (m_refList) { // Listen for events pertaining to dictionary services. m_context.addServiceListener(this, "(&(objectClass=" + DictionaryService.class.getName() + ")" + "(Language=*))"); // Query for all dictionar...
6fad42d0-17b7-4c1d-a34f-a0c8ab40c483
6
public void moveDown(Tetromino piece, int x, int y, int orientation) { boolean[][] tiles = piece.getTiles(); int count = 0; // clear the current piece out int width = piece.getTiles()[0].length == 9 ? 3 : 4; // get width (3 or 4) of piece width = piece.getTiles()[0].length == 4 ? 2 : width; for(int row = ...
aa058620-d0f3-4c90-9565-a4825bfdb8e4
1
private void inorder(Node node, Queue<Key> q) { if (node == null) return; inorder(node.left, q); q.add(node.key); inorder(node.right, q); }
4e2dc6cc-a31e-4732-9646-940f3c71a878
4
public void draw(MinuetoWindow window, MinuetoImage[] imageMapImages, int x, int y) { int sizeScreenX = window.getWidth(); int sizeScreenY = window.getHeight(); int tileIndexX = x / this.tileSize; int tileRemainderX = x % this.tileSize; int tileIndexY = y / this.tileSize; int tileRemainderY = y % this.til...
23b412bf-25d3-4b32-a2bd-39db4b22b6ef
3
private boolean isOperator( String op ) { return op.equals("+") || op.equals("-") || op.equals("/") || op.equals("*"); }
3175c588-d0e2-46f6-ab78-c378cd637f8b
2
public void playerTurn(int id) { boolean myTurn = false; if (id == myID) { myTurn = true; } //Enable all the buttons if its your turn, otherwise disable them for (int i=0;i<digitButton.length; i++) { digitButton[i].setEnabled(myTurn); } }
55713440-cda8-4087-9732-e975a9b4574c
2
public static synchronized void writeLogFile(final String message) { new Thread(new Runnable() { @Override public void run() { try { if (Logger.log == null) { Logger.log = new Logger(); } ...
596e1599-ed56-4342-aedf-22edecd5d3d7
6
public GetDataBySubjectResponse(Request request, String response) throws XPathExpressionException, IOException { super(request, response, false); this.subjects = new HashMap<SubjectID, Subject>(); try { Document doc = this.getDocument(); if(response != null) { NodeList nodes = Utilities.selectNod...
14385839-93b4-47ed-a320-5f310d29bb36
8
public void checkdoors() { System.out.println(); String convertstring; // Check of er een deur is aan de oostzijde if (getEast() == 0) { } else {// als er een deur is doe dit: System.out.println("There is a door on the east side of the room"); convertstring = "" + getEast(); // Als de string getvisit...
6fef30c8-83f0-4c35-a2bb-e50950460133
7
public static void process_queue(Queue<FileMessage> q[]){ //to be completed........................ based on readwrite class.......... while(true ){ int exit_flag=1; for(int i=0; i<q.length;i++){ if(!q[i].isEmpty()){ //System.out.println("Index--"+i+"::Queue size---"+q[i].size()); exit_flag=0...
c6dd02a7-6e69-4603-85b7-b4799b9f999d
9
@Override public void checkMail() { super.checkMail(); List<Literal> percepts = convertMessageQueueToLiteralList(getTS().getC().getMailBox()); model.update(percepts); Iterator<Message> im = getTS().getC().getMailBox().iterator(); while (im.hasNext()) { Message message = im.next(); Literal percept...
b83c2688-424b-4311-a093-5b23e1ae55a0
1
public static void crop(Rectangle rect) { if (lastScreenshot == null) return; BufferedImage image = lastScreenshot.getImage(); int x = (int) rect.getX(); int y = (int) rect.getY(); int width = (int) rect.getWidth(); int height = (int) rect.getHeight()...
4ffedcf8-d8c6-4d47-9120-0baacea479cf
9
MainFrame() { final ClassLoader cLoader = getClass().getClassLoader(); ImageIcon collapseIcon = new ImageIcon(/*cLoader.getResource("images/Toggle_03_Hide.png"*/); final JLabel collapseBtn = new JLabel(collapseIcon); ImageIcon windowIcon = new ImageIcon(/*cLoader.getResource("images/Win...
b53a3fe5-39b3-4a58-8842-b61a0c6c6867
4
public int getPostIndex(byte[] bytes, Charset charset) { String firstBytes = new String(bytes, charset); String separator = CRLFx2; int index = firstBytes.indexOf(CRLFx2); int indexCR = firstBytes.indexOf(CRx2); int indexLF = firstBytes.indexOf(LFx2); if (indexCR != -1 &&...
0677ae5f-b64c-46a3-9c9d-d11afbd47a5a
7
private void add(File source, JarOutputStream target) throws IOException { BufferedInputStream in = null; try { // If the file provided is a directory if (source.isDirectory()) { // Replace \ with File.separator String name = source.getPath().replace("\\"...
495c9b1a-9581-4980-8980-1a7de41b1761
0
public boolean isLive() { return isLive; }
a582b3e8-723f-4997-904c-e81ea6f5212d
9
@Override public boolean equals(Object object) { if (object == null) { return false; } if (getClass() != object.getClass()) { return false; } Person person = (Person) object; if (this.gender == null || !this.gender.equals(person.getGender())...
2d5c9cae-896d-4a9d-874e-5ad4b55e413d
6
private int addToShow(int rowIndex, int colIndex, Integer index, int[][] array){ field[rowIndex][colIndex].show(); for (int i = rowIndex - 1; i <= rowIndex + 1; i++) { for (int j = colIndex - 1; j <= colIndex + 1; j++) { if (checkIndex(i, j)) { if (field[i...
c818863e-ba30-401e-ac95-4d9bf25aea35
0
public static boolean getDontQuit() { return dontQuit; }
f084d7b5-15ae-4660-acff-75e069f492b4
5
@FXML private void handleTxtBarCodeAction(ActionEvent event) { clearIndicator(); if (txtBarCode.getText().isEmpty()) { return; } txtItemName.setDisable(false); txtItemName.requestFocus(); Item item = select(txtBarCode.getText()); if (item != nul...
ae14dd76-51b4-4042-af63-44d611c8827a
2
public LauncherView(Fighter[] m) { p2ReadyBool = p1ReadyBool = false; model = m; selection = new int[model.length]; // general layout stuff GridBagLayout generalLayout = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); constraints.insets = new Insets(5, 5, 5, 5); // defau...
dbafaa08-1b21-4056-89b4-b218058035b4
2
@Override public void hyperlinkUpdate(HyperlinkEvent e) { if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { URL url = e.getURL(); try { viewer.setPage(url); addURL(url); } catch (IOException ex) { System.out.println("IOException: " + ex.getMessage()); } } }
30030ba5-6e16-4923-8478-763dacfc3e21
3
@Override public void render(Document html, Element node) { Element sectionNode = html.createElement("section"); sectionNode.setAttribute("data-section-name", name); // set coded content in ID if (getCodedContentCollection() != null) { sectionNode.setAttribute("id", getCodedContentCollection().getId()); }...
f0f818cb-937d-4921-9fde-8f1e46613580
1
public static void highlight(String position, int r, int g, int b){ if(false){ GraphicsConnection.debugConnection.sendHighlight(position, r, g, b); } }
ff417813-b5ca-4d1b-adce-8483e5cbbf3e
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(ID())!=null) { mob.tell(target,null,null,L("<S-NAME> already <S...
30833378-3214-4c55-9637-d4752480f653
4
public String extractSection (int start,int end) { StringBuilder out=new StringBuilder(); int a; int tc=counter+start; if (tc>=totalLength) tc=tc-totalLength; for (a=start;a<end;a++) { if (this.get(tc)==true) out.append("1"); else out.append("0"); tc++; if (tc==totalLength) tc=0; } return out....
3b7120d3-a434-40a3-9efe-930cf5a9c3dd
4
private Batch <Actor> talksTo() { final Batch <Actor> batch = new Batch <Actor> () ; if (subject instanceof Actor) { final Actor a = (Actor) subject ; batch.add(a) ; } else if (subject instanceof Venue) { final Venue v = (Venue) subject ; for (Actor a : v.personnel.residents()) b...
0cace05e-84c6-4788-8f76-12dd5d0a6432
3
public boolean find(long searchKey) { // find specified value int j; for (j = 0; j < nElems; j++) // for each element, if (a[j] == searchKey) // found item? break; // exit loop before end if (j == nElems) // gone to end? return false; // yes, can’t find it else return true; // no, found it } //...
856fca14-d59c-40d7-83b9-44e83948aef8
5
public static void writeSearchResponse(SearchResponse response, BufferedWriter out, boolean writeQuery, boolean writeLink, boolean writeTitle, boolean writeSnippet) throws Exception { List<SearchResponse.Result> results = response.getResults(); System.out.println(">>>> WRITE " + results.size() + " RESULTS FOR \"" +...
d7b0cf83-2382-4e74-b577-d0ec703a05ac
5
public String getNextUntitledDockableName(String baseTitle, Dockable exclude) { List<Dockable> dockables = getDockables(); int value = 0; String title; boolean again; do { again = false; title = baseTitle; if (++value > 1) { title += " " + value; //$NON-NLS-1$ } for (Dockable dockable : doc...
2c9adf70-2a42-4575-bd94-f6f6cbc9cf6c
9
public void set(int key, int value) { int hk = hash(key); boolean isSet = false; int index = -1; if (full==false) { for (int i=0;i<cache.length;i++) { if (cache[(hk+i)%cache.length]==null) { index = i; isSet = true; ...
47e5b2e4-6379-4230-ab20-3020e11fc45f
6
public byte[] toByteArray(){ byte [] out = null; try { ByteArrayOutputStream bo = new ByteArrayOutputStream(); OutputStream baos = bo; if(this.type==Type.Dictionary){ baos.write('d'); for(Entry<String, Bencoding> s:dictionary.entrySet()){ byte [] bytes = s.getKey().getBytes("UTF-8"); Stri...
74ba8d8f-1688-40e0-8541-1573b294ff52
8
public void actionPerformed(ActionEvent e) { JButton sourceButton = (JButton)e.getSource(); String s = sourceButton.getName(); //Use the dummy game to make a guess MasterMindGame m = gui.getGameP2(); if (s.contains("send")) { //Assuming user sets enough colours sol will be the solution to send ...
2882c74d-4610-49bd-ad32-b1aec5be4cef
5
@Override public JSite load() { if (loaded) return this; String body = null; try { body = JHttpClientUtil.postText( context.getUrl() + JHttpClientUtil.Sites.URL, JHttpClientUtil.Sites.GetSite.replace("{SiteUrl}", context.getUrl()), ...
2497c480-6198-44f8-b883-141b8f5b44cc
7
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String p; if ((p = request.getParameter("delete_id")) != null) { // del Advertisement advertToDelete = this.advertRepo.getById(Integer .parseInt(p)); if (advertToDelete.getA...
aaea07a2-932e-4b74-a0ae-8ad57b4dc128
6
protected Query getWildcardQuery(String field, String termStr) throws ParseException { if ("*".equals(field)) { if ("*".equals(termStr)) return newMatchAllDocsQuery(); } if (!allowLeadingWildcard && (termStr.startsWith("*") || termStr.startsWith("?"))) throw new ParseException("'*' or '?' not ...
8428a103-31fa-4c3c-9edd-eec3224be246
0
public Player(Level level, int x, int y) { super(level, x, y); hWidth = 8; hHeight = 15; hXOffs = 4; hYOffs = 7; movementSpeed = 0.2; maxMovementSpeed = 4.0; maxFallingSpeed = 6; stopMovementSpeed = 0.3; jumpMomentum = -6; gravity ...
a551494b-f224-400a-af6d-4c88025da08c
8
public static boolean manuallySetGuildLevel(String[] args, CommandSender s) { //Various checks if(Util.isBannedFromGuilds(s) == true){ //Checking if they are banned from the guilds system s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server ad...
fbf21faa-5503-4583-8be8-c09120a83ae4
9
public static List readWatchableObjects(DataInputStream par0DataInputStream) throws IOException { ArrayList var1 = null; for (byte var2 = par0DataInputStream.readByte(); var2 != 127; var2 = par0DataInputStream.readByte()) { if (var1 == null) { var1 = ...
c27ef1bf-5163-4ebd-9155-b93f43542af7
1
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { List<BankDeposit> deposits = ReaderFactory.getInstance().getDOMReader() .readXML(DataPath.XML_FILE); request.setAttribute("deposi...
668c87f0-6b1a-4a2d-a9c6-283d8830275f
8
public Configuration(String path, int splitSize) { List<String> lines = new ArrayList<>(); try(BufferedReader br = new BufferedReader(new InputStreamReader( new BufferedInputStream(new FileInputStream(new File(path)))))) { while(true) { String line = br.readLine(); if(line == null) { ...
557210de-b7a9-4ae2-a2d5-13179d35df53
5
public static void otherMethod(int[] src,int k){ if( k > src.length){ return; } TreeSet<Integer> s = new TreeSet<Integer>(); for(int i=0;i<k;i++){ s.add(src[i]); } for(int i=k;i<src.length;i++){ int last = s.last(); if(last > src[i] ){ s.remove(last); s.add(src[i]); } } Iterator ...
b300fd20-1f15-4566-94a7-ddbfe8847bc9
9
protected int checkForDraw() { //db.a(includeImages,"Rules checkForDraw: with no images included"); //db.a(boardImagesStored > 0, "Rules checkForDraw: no board images stored"); // db.pr("Rules: stag count is "+stagnateCount); // Check for stagnation. if (stagnateCount == maxStagnationMoves * 2 - 1) ...
6bcc48da-8d17-45f7-8da6-cd7ba41c66c4
9
protected String encodeTerm(List<Term> sentence, int idx, Response prediction, boolean isTrainingSet, String predictionType) { Term term = sentence.get(idx); String text = term.getText().trim(); StringBuilder builder = new StringBuilder(); builder.append("curToken=").append(text); builder.append(" entityT...
7a7bc351-7bc2-41d5-906c-88bf2ce6951d
9
public static Vector<Assignment> assignNextChance() { if(DEBUG) System.out.println("Making sure we have assigned all chance variables"); //get the next chance variable to assign Variable nextChance = null; for(int i = 1; i < variables.size(); i++) { Variable v = variables.get(i); if(v.isChance() && v.getA...
255fe0c0-3e43-4b6f-bced-dc1659ded7bf
0
private BinaryStdOut() { }
844117e8-3f27-4449-a0c2-9bb7f2a964cc
9
public int getArrayIndex(int... ind) { if(ind.length == indexDim) { if(ind.length == 1) { return ind[0]; } if(ind.length == 2) { if(this.checkIndex(0, ind[0]) == false || this.checkIndex(1, ind[1]) == false) { ...
48993b8b-707e-46e8-9d05-2c9737fffec3
4
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (sender.hasPermission("peacekeeper.addbadword")) { if (args[0] == "-d") { for (String arg : args) { config.FilterList.remove(arg); } } else { for (String arg : args) { config.FilterList....
4ac40716-f77d-4102-89f7-73d7a15e3742
1
private List<String> getPhoneNumbersDisplay() { List<String> displayList = Lists.newArrayList(); for (PhoneNumber phoneNumber : phoneNumbers) { displayList.add(phoneNumber.toDisplayString()); } return displayList; }
fc5805a9-3588-4599-959f-60dcaa6a9d36
6
public boolean startsWith(String word) { if (word == null || word.length() == 0) return false; int len = 0; TrieNode node = root; while (len < word.length()) { boolean found = false; for (int i = 0; i < node.nodes.size(); i++) { if (no...
df33ab70-ea62-4045-ba78-aacd1086a222
1
@Override public byte[] getHTTPMessageBody() { try { writeToPatchContent(); } catch (Exception e) { e.printStackTrace(); } return "Request Invalid".getBytes(); }
f69258bf-a979-41a3-b5fe-97963b6f4521
2
public void bytesWrite(int bytes, int clientId) { if (this.clientId == clientId) { for (Iterator i = observers.iterator(); i.hasNext();) { ObservableStreamListener listener = (ObservableStreamListener) i .next(); listener.bytesWrite(bytes, clientId); } } }
3fe2629a-33b1-4b68-8afa-ea29cd43d16b
3
@Override public int[][] getCost() { final int PAS_DE_TRONCON = this.getMaxArcCost() + 1; int size = this.getNbVertices(); int[][] costs = new int[size][size]; for (int i = 0; i < size; ++i) { for(int j=0; j<size; j++) { costs[i][j] = PAS_DE_TRONCON; ...
a909c7c7-220c-4c1e-9f62-0c01ecfe04d5
1
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/backlog/form.jsp"); BacklogBean oBacklogBean; BacklogDao oBacklogDao; oBacklo...
5c3eac07-98cf-453f-8ac1-e82d3c0a36df
8
@Override public void keyPressed(KeyEvent e) { int keycode = e.getKeyCode(); try { good2.hero.getX(); good2.keyPressed(e); } catch (Exception E) { //pass } //Key commands if (keycode == KeyEvent.VK_Q) { WindowFrame.exit(); } if (keycode == KeyEvent.VK_R) { WindowFrame....
324b8825-71ba-4e09-b3e8-1ea0de58c67e
7
@Override public void handleDFSInit() { // rst $28 dfs.addJumpTable(0x6e, 5); dfs.addJumpTable(0x2fb, 55, "GameStateTable"); dfs.addJumpTable(0x6480, 8); dfs.addJumpTable(0x6490, 8); dfs.addJumpTable(0x64a0, 4); dfs.addJumpTable(0x64a8, 4); dfs.addFunction(0x0, "Unused_rst00"); dfs.addRawBytes(0x3,...
08123ca3-6247-4836-8e22-c10a6baccf2b
8
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equals("voyageur")) { if (currentVoyageur != null) { throw new IllegalStateException("already processing a voyageur"); } currentVoyageu...
4ff092b7-25ae-429b-aec6-a2979c0da6f7
0
public int getNum() { return num; }
ca413966-2193-4cac-a1eb-34bb3a3b1472
6
public void run() { synchronized (fQuitTimerObject) { // // Loop forever. // while (true) { while (fQuitTimerStart == false) { try { fQuitTimerObject.wait(); } ...
5d1ae198-a8eb-4375-9ca0-c49c4785d85c
2
@Override public void xterminated(Pipe pipe_) { if (!anonymous_pipes.remove(pipe_)) { Outpipe old = outpipes.remove(pipe_.get_identity()); assert(old != null); fq.terminated (pipe_); if (pipe_ == current_out) current_out = null; ...
b370d4d8-74e5-41db-924a-2ebe0302b1d2
2
public Vector<String> getBelegung(String sessionID){ Vector<String> resString = new Vector<String>(); CSVFileManager csvMgr = new CSVFileManager(); String stundenplan = "https://puls.uni-potsdam.de/qisserver/rds;jsessionid=" + sessionID + ".node11?state=wplan&amp;week=-2&amp;act=show&amp;pool=&amp;show=liste&amp;...
ea306937-98f5-4824-b222-fe5883ecd417
2
public void teleopInit() { shooter.enable(); new SpinDown().start(); SmartDashboard.putBoolean("Enabled", true); if (autonomouse != null) { autonomouse.cancel(); } if (teleop != null) { teleop.start(); } }
883300fe-6505-4bc7-b73a-95b461cc1829
6
private String addOptionalsToLaTex() { String palautettava = ""; if (volume != 0) { palautettava += "VOLUME = {" + volume + "},\n"; } if (number != 0) { palautettava += "NUMBER = {" + number + "},\n"; } if (pages != null) { palautettava...
501af123-f2da-4aad-8142-f0fe160a1bc1
7
private int mapSingle(String s) { switch (s){ case "M": return 1000; case "D": return 500; case "C": return 100; case "L": return 50; case "X": return 10; case "V": return 5; case "I": return 1; default: return 0; } }