method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
dd1b2687-0467-4362-a15b-32fcc2c97bf9
9
public static Vector<Integer> SLOrestricted(GraphModel g, Vector<Integer> V) { List<Pair<Integer, Integer>> VertexDegree = new Vector<>(); Vector<Integer> Ordering = new Vector<>(); //Compute N_2-degree for all vertices in V for (int v : V) { VertexDegree.add(new Pair<>(v, Neighbors.N_2_restricte...
6c4b669e-4528-41c0-a2cd-469a3a576782
8
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed //ADD SEARCH STUFF HERE Search searcher = new Search(); String title = titleText.getText(); String crn = crnText.getText(); String professor = professorText.getText(); ...
a9efc12e-383e-442b-9035-d05956e310b2
9
@Override public Object evaluate(ArrayList<Context1> pila_basura) throws Exception { try{ StringBuilder output = new StringBuilder(); for (Evaluator e : lista) { if (e != null) { if (e instanceof ReturnEvaluator) { return e.evaluate(pila); } Object ob; ob = e.evaluate(pila); if (ob !...
9884b261-2620-4bee-b8c5-445f064050ae
3
public void setParent(Node<T> parent) { this.parent = parent; if (parent != null) { for (Node<T> sibling : parent.children) { if (sibling == this) { return; } } parent.children.add(this); } }
b8d4bcbd-ee19-4396-8ff1-6201ce2d50ec
7
public String toString() { IntFraction f = simp(this); if (f.d == 0) return "Error: Denominator is zero."; else if (f.n == 0) return "0"; else if (f.d == 1) return String.valueOf((negative?"-":"") + f.n); else if (f.n < f.d) ...
5ddc3f38-daab-4003-8468-fba0b69ad7f9
0
public AntiAliasingLine(Excel ex1, Excel ex2) { begin = ex1; end = ex2; setColoredExes(); }
93412a80-6ec4-4e17-b48f-687ae7a7d9f0
8
public CardListPanel() { final CardTableModel dm = new CardTableModel(); final JTable t = new JTable(dm); dm.setTable(t); t.getColumnModel().getColumn(0).setCellRenderer( new DefaultTableCellRenderer() { private static final long serialVersionUID = -9109954835956521771L; @Override public Co...
9fafbefb-45e0-4233-a744-061831a7166d
3
public void write() { if (!valid()) { System.err.println("Not saving invalid map"); return; } try { ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(filepath())); output.writeObject(this); } catch (FileNotFoundExcepti...
0a6bcf2a-7e78-41c2-bba7-93d2e8702037
7
public static String protdist(String query, String model, String GammaDistrOfRates, double CoeffOfVariation, double fracOfInvSites, String oneCatOfSubRates, int noOfCat, String rateForEachCat, String categoriesFile, String UseWts4Posn, String weightsFile, String analyzeMultipleDataSe...
03d9c0db-caa0-4778-98db-5d5bc38e9414
4
public static void changeLendability(MediaCopy mc, boolean lendable) { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCom...
3f066446-57db-4401-9031-60361b962eaf
5
public void redo() { if (patchIndex >= undoPatches.size()) { return; } UndoPatch p = undoPatches.get(patchIndex++); // Perform patch int prow; for (prow = 0; prow < p.oldText.length; prow++) { if (prow >= p.patchText.length) { for (int da = p.oldText.length - prow; da > 0; da...
19d50b8b-c7fa-4ac3-b704-cf858d7b104d
0
public PlotWindowView(PlotView view) { setTitle("Plot"); setSize(WIDTH, HEIGHT); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); getContentPane().add(view); view.setFocusable(true); view.requestFocus(); }
3032abb7-3d9e-4693-ad5a-4209ff4e880c
3
protected void actionPerformed(GuiButton var1) { if(var1.id == 0) { ; } if(var1.id == 1) { this.mc.thePlayer.respawnPlayer(); this.mc.displayGuiScreen((GuiScreen)null); } if(var1.id == 2) { this.mc.changeWorld1((World)null); this.mc.displayGui...
77a66d92-d8b4-4939-b226-9fe412786bf7
3
private void paintPictures(Graphics g){ for(int i = 0; i <4; i++){ for(int n = 0; n <4; n++){ int j = convertBase4(i, n); BufferedImage img = imageQueue.get(j); if(img != null)//img will be null if we are not online. g.drawImage(img, n*img.getWidth(), i*img.getHeight(), null); } ...
e9c9838d-0824-4e39-86b1-182a38974829
7
@Action public void deleteItem() { TreePath selectedPath = jTree1.getSelectionPath(); if (selectedPath == null) { JOptionPane.showMessageDialog(mainPanel, "Please select a category or item first", "You need a category or item", ...
cb48c75a-7450-4a0d-8719-8bd65e59d65c
3
public static void main(String[] args) { long start = System.nanoTime(); int sum = 0; for(int i = 3; i < 1000; i++){ if(i % 3 == 0 || i % 5 == 0){ sum += i; } } System.out.println(sum); System.out.println("Done in " + (double) (System.nanoTime() - start) / 1000000000 + " seconds."); }
e3c7806c-8169-4138-9b28-c76b30825846
6
public void submitAll(IntervalList intervals) { //adjust threshold to be bigger if we're dealing with genome-sized files, //elsewise we may blow the stack if (intervals.getExtent() > 1e8) { thresholdExtent = (long) 1e7; } if (intervals.getExtent() > 1e9) { thresholdExtent = (long) 1e8; } if (i...
7c70e1b6-48d3-4fc5-ad16-622b33438696
2
@Override public int compare(Announcement announcement1, Announcement announcement2) { if (announcement1.timestamp.getTime() < announcement2.timestamp.getTime()) return 1; else if (announcement1.timestamp.getTime() > announcement2.timestamp.getTime()) return -1; else return 0; }
b86f1d9e-24bf-4c86-a48f-7156d86d1e1e
5
@Override public void run() { String line = ""; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(file))); line = br.readLine(); //Throw away first two lines of title info line = br.readLine(); while (br.ready()) { ...
d47a30f0-a068-4cb8-be90-af20eeb7d8f2
7
private String decodePapPassword(byte[] encryptedPass, byte[] sharedSecret) throws RadiusException { if (encryptedPass == null || encryptedPass.length < 16) { // PAP passwords require at least 16 bytes logger.warn("invalid Radius packet: User-Password attribute with malformed PAP password, length = " + e...
d6817e20-53da-44ca-a380-c0ba223c00a9
7
private void vergebeIDs(IOManager manager) { manager.readRaeume(); List<Raum> rlist = manager.getRaeume(); Set<Integer> idList = new HashSet<Integer>(); for(Raum r : rlist) { idList.add(r.getId()); } Random rand = new Random(); int newid; GridButton[][] buttons = _ui.getMap().getButtonArray(); ...
d44069d5-c440-4214-8af9-b81dff08a3c6
0
public String GetStringData() { return data1; }
ccce0e0b-d13b-479a-8dda-a903b5c7d32a
8
private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(7, old0, old1); try { curChar = input_stream.readChar(); } catch (IOException e) { jjStopStringLiteralDfa_0(8, ...
981f7cd5-94dd-48ed-95ac-4c4e90ff9f4e
6
@Override protected void sort(int[] a) { int largest = a[0]; for (int n : a) if (largest < n) largest = n; int log = (int) Math.ceil(Math.log(largest) / Math.log(RADIX)); for (int i = 0; i < log; i++) { for (int n : a) regist...
17cdd149-fc77-4564-9735-da9ae77e03d1
1
public void queueLoad(Point p) { try { toLoad.put(p); } catch (InterruptedException e) { e.printStackTrace(); } }
73db3997-68c0-4d98-b97e-70a542bfcbc7
6
public boolean checkCheckmate(Board b,int l,int o ){ aiarr=b.getBoardArray(); for(int x=0;x<8;x++){ for(int y=0;y<8;y++){ Point[] mov=canMove(new Point(x,y)); Piece [][] arr0=new Piece[8][8]; for(int x1=0;x1<8;x1++){ for(int y1=0;y1<8;y1++){ arr0[x1][y1]=aiarr[x1][y1]; } } Pie...
125f5b22-2d5d-424d-8c18-8b2b25618082
2
public void fillUpProductComboBox() { ArrayList<StockItem> productComboboxList = driver.getStockDB().getStockList(); comboBoxItems.clear(); itemsQuantity.clear(); itemsPrice.clear(); for (StockItem stockItem : productComboboxList) { String values[] = supplierComboBox.getSelectedItem().toString().split("...
cd3037d1-7b08-4acf-b516-661d627b1a27
0
@Override public String getDef() {return def;}
023e180c-21d7-402b-8509-290fe98143a3
9
public int compareTo(Animatable other) { if (other instanceof GameOfLife) { GameOfLife o = (GameOfLife) other; if (x > o.x) return 1; else if (x < o.x) return -1; else if (y > o.y) return 1; else if (y < o.y) return -1; else if (boxSize > o.boxSize) return 1; else if (boxSize ...
9cf68151-38e0-41d3-bc9e-60c191e04ef1
4
private void close() { try { if (rs != null) { rs.close(); } if (statement != null) { statement.close(); } if (conn != null) { conn.close(); } } catch (SQLException e) { th...
231278b4-4232-4d5b-a354-67c2ebb8e397
3
public void onIncomingFileTransfer(DccFileTransfer transfer) { int choix = JOptionPane.showConfirmDialog(null, transfer.getNick() + " veux vous envoyer " + transfer.getFile() + ", voulez vous accepter?", transfer.getNick() +...
b3074a37-6ed6-444c-816f-d748a5b94b56
1
public GenericDAO<Project> getProjectsDAO() { if (_projectsDAO == null) { _projectsDAO = new GenericDAO<Project>(Project.class); } return _projectsDAO; }
be21953d-ebb8-4e68-9455-c1c7532768df
6
public static void load(String path) { try { String vertexFilename = "vertex.txt"; String edgeFilename = "edges.txt"; String streetFilename = "streets.txt"; boolean isDirected = true; PreProcessingMap preProcessingMap = new PreProcessingMap(...
c69eb4cd-7b81-4974-857a-9e35a7e1cbb6
1
public void stopgame() { if(!running) return; running = false; synchronized(applets) { applets.remove(p); } p.interrupt(); remove(h); p = null; h = null; }
72249467-54e7-448b-898e-daa8bb8510f2
8
private static void initializeGame() { System.out.println("\n\nTHE Dot.Com GUESSING GAME"); System.out.println("--------------------------------------------------------------------------------"); System.out.println("This is a simple guessing game. There are a few web addresses hidden randomly inside " + "t...
8cb31291-1d2a-47bd-adf7-6e658e1037c1
5
private static operation getOperateur(String equation) { //cette fonction retourne un opérateur et affiche l'équation actuelle final String menu[] = {"=", "/", "*", "-", "+"}; int choix; operation op; choix = JOptionPane.showOptionDialog( null, "Quelle opéranteur voulez-vous ajouter?\n"+equation, "C...
189301ea-a947-44ea-9a85-758128329bfc
8
private void chooseMovement(){ if (x == 49 && y == 25){ world.removeObject (hpBar); world.removeObject (dv); currentHp = 0; world.mobDie (this, true); } else{ if (x == 10 && y == 12 && stage == 0){ stage = 1; ...
a2e873b5-395f-4bbc-9861-ee9b74eb1c8a
3
public boolean isEmpty() { if (size == 0) { return true; } for (int i = 0; i < taulu.length; i++) { if (taulu[i] != null) { return false; } } return true; }
e5f474a6-0512-4fe9-bd67-98675fe4b8b8
0
public KeyHandler(String alias) { this.alias = alias; keychain = new HashMap<String, KeyNoncePair>(); }
ce0930bd-e14c-4bc3-a3a0-015a261b947d
6
public List<Cluster> performClustering(double[][] distances , String[] clusterNames , LinkingRule linkingRule , int k , Matrix features) { /* Argument checks */ if (distances == null || distances.length == 0 || distances[0].length != distances.length) { throw new IllegalArgumentException("...
8a8f5542-410e-44a9-b649-ae6ebfc60fe1
7
public String toString() { int length = 2 * ((z1[0].toString()).length()); String sidespace = ""; for(int i=0; i<length/2; i++){sidespace += " ";} String unit = "+"; String horiz = " "; String verti = " | "; String lab = ""; ...
4263e5fd-9d7b-4e7d-ac7d-9f8b57c6a018
4
private void displayPRF(String prefixStr, int correct, int guessed, int gold, int exact, int total, PrintWriter pw) { double precision = (guessed > 0 ? correct / (double) guessed : 1.0); double recall = (gold > 0 ? correct / (double) gold : 1.0); double f1 = (precision > 0.0 && recall > 0.0 ? 2.0 / (1...
cdf50c8c-c7f1-431d-8b1c-f90ca3bb5c63
1
private void processDeckClick() { //Can assume did click on the deck. final Stack<Card> deck = game.getDeck(); if (!deck.isEmpty()) { activeMove = new DeckClickMove(); String result = activeMove.makeMove(game, this); processMoveResult(result, activeMove); ...
290bfd9a-c5d1-4c10-9a49-bc0f2cc0df30
8
public boolean equals(Object x) { // der Parameter muss vom Typ Object sein wegen der Spezifikation der Klasse Object // deswegen kann diese Methode nicht generisch genacht werden if (this == x) return true; if (x == null) return false; if (getClass() != x.getClass()) return fal...
93d16f5c-fbf7-4505-a2e2-fa315364125a
3
public static String toString(JSONObject jo) throws JSONException { boolean b = false; Iterator keys = jo.keys(); String string; StringBuffer sb = new StringBuffer(); while (keys.hasNext()) { string = keys.next().toString(); if (!jo.isNull(s...
1894ad17-2552-404c-917f-163931a09aa7
0
@Override public void die() { tile.getBombers().remove(this); this.tile = null; this.cooldown = match.dyingCooldown; this.points -= match.pointsLostForDying; }
3251fc3e-e06c-4804-ac30-cb84a922e618
8
public void resolveJumpMarkings() throws SemanticException { //scan for positions int position = 0; final Map<String, Integer> jumpAddresses = new HashMap<>(); for (final Instruction instruction : instructions) { if (jumpMarkings.containsKey(instruction)) { fi...
400963c4-57b0-4e70-af91-662e45f649c7
7
@Override public void execute(FileSearchBean task) throws Exception { final FileInputStream fileInputStream = new FileInputStream(task.getInputFile()); final BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream, bufferSize); try { int j = 0; ...
bfe19ee3-c7f2-4bc7-a34e-353c1e4953ca
0
PhysConstantEnum(double value) { this.value = value; }
18ed7495-2a28-41aa-a156-aae990b4b5c1
4
public int returnCoorFromXY(int x, int y) { if (x < 0 || x >= this.squaresX) { return -1; } if (y < 0 || y >= this.squaresY) { return -1; } return (x + (y * this.squaresX)); }
c7b69818-bb50-422a-8297-7826a8b2f87b
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Empresa)) { return false; } Empresa other = (Empresa) object; if ((this.codempresa == null && other.codempresa ...
c89caefa-6d19-452e-ae56-58b2f8ce0dff
2
public static FiniteStateAutomaton removeMultipleCharacterLabels( Automaton automaton) { FiniteStateAutomaton fsa = (FiniteStateAutomaton) automaton.clone(); Transition[] transitions = fsa.getTransitions(); for (int k = 0; k < transitions.length; k++) { FSATransition transition = (FSATransition) transitions...
fd9db603-e3a6-4aaf-920c-df4d829eebf2
0
public ArrayList<Villager> getPeople() {return this.people;}
1c86a85a-e2dc-4950-ac61-b679b410c6e1
5
@Override public boolean importData(TransferSupport support) { logger.info("importData"); if (!canImport(support)) { return false; } JTable.DropLocation dl = (JTable.DropLocation) support.getDropLocation(); int row = dl.getRow(); logger.info("Row number {}...
09f235e8-3061-49c2-8196-78d52836eae0
3
private int getNumberBySlot(int slot) { slot--; // skip this parameter (not an outer value) for (int i = 0; slot >= 0 && i < headCount; i++) { if (slot == 0) return i; slot -= head[i].getType().stackSize(); } return -1; }
5bc61ea8-5fb0-419e-a743-d53395be2986
7
@Override public void explore(ProcessConfiguration config, ExploringThread thread, Explorable parent) throws ExplorationException { try { ZipFile zip = (ZipFile) parent; File zipFile = zip.getPath(); File tempFolder = getTempFolder(zipFile.getName()); tempFolder.mkdirs(); if (log.isLoggable(Le...
116cd656-5db0-4b59-9e6f-f9df7f4648c1
2
private void isGreaterThanEqualsToString(String param, Object value) { if (value instanceof String) { if (param.compareTo((String) value) <= 0) { throw new IllegalStateException("String is not greater than supplied value."); } } else { throw new IllegalArgumentException(); } }
91fcb0b7-e6c7-4ef8-9dab-7825dfef4c13
0
public String getHouseNumber() { return addressCompany.getHouseNumber(); }
3270c27e-e398-4d89-b28a-2554d2e45bd7
1
public void shutdown() { super.shutdown(); try { workers.awaitTermination(500, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { // NOP } finally { workers.shutdownNow(); } }
418e3af7-560c-4ac1-ad18-f978ed214047
6
private static void method495(char ac[]) { int i = 0; for(int j = 0; j < ac.length; j++) { if(method496(ac[j])) ac[i] = ac[j]; else ac[i] = ' '; if(i == 0 || ac[i] != ' ' || ac[i - 1] != ' ') i++; } for(int k = i; k < ac.length; k++) ac[k] = ' '; }
e7db90ff-1581-461c-9fe8-43f220d447f6
7
private static String parseData(String data) { if(data == null || data.length() == 0) return data; if(data.startsWith(BINARY_KEY)) return data.substring(4); // return parseHexString(data.substring(4), false); else if(data.startsWith(DWORD_KEY)) return data.substring(6); // retu...
679409a4-ec5d-4cf0-ab8d-55acd3ece469
1
@Test public void twoCompCircular3() throws Exception { try { C3 c = new C3(); fail(); } catch (RuntimeException E) { // E.printStackTrace(); // assertTrue(E.getMessage().contains("src == dest")); } }
5e9b9d44-7e0f-40db-8989-015264ff7ddb
8
@Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case statePackage.STATE__PLAYERS: return getPlayers(); case statePackage.STATE__COUNTRY_STATE: if (coreType) return getCountryState(); else return getCountryState().map(); case statePackage.STAT...
a6f63a14-d43f-41da-a5d0-d894f040c24d
9
@Override public void run() { for(Object socket : sockets) { if(socket instanceof DatagramSocket) if(((DatagramSocket) socket).isClosed()) { ((DatagramSocket) socket).close(); continue; } if(socket instanceof Se...
c99de8cd-11fb-4c1f-81da-4ca5ccace6ec
7
public void setTree(RootedTree tree, Collection<Node> selectedNodes) { this.originalTree = tree; if (!originalTree.hasLengths()) { transformBranches = true; } Painter<?>[] pl = { taxonLabelPainter, nodeLabelPainter, branchLabelPainter }; for( Painter<?> p : pl ) { ...
a2917733-ab9e-41c4-bbd4-6c749bfe5ff2
7
private void updateAndClose(final String initials) { if (!closing && getDate() != null) { closing = true; try { Connection conn = MySql.getConnection(); PreparedStatement statement = conn.prepareStatement(MySql.OPENING_COUNT_UPDATE); final ...
39c3a936-6061-45fc-9b49-fe01cfdc8e9d
1
public static void main(String[] args) { // Command line arguments for (String arg : args) { System.out.println(arg); } String code = "declare a transreal declare b transreal set b 1 set a + b nullity"; EsperCompiler compiler = new EsperCompiler(); compiler.readCommandLineArguments(args); compil...
43c09d89-737c-44cb-9bed-ae2b981479a3
4
private void initCarTypes() { this._carTypes = new CarType[4]; this._carTypes[0] = new CarType(UUID.randomUUID(), "硬座车", 1L); for(int i = 1; i <= 118; i ++) { Seat seat = new Seat(); seat.setId(UUID.randomUUID()); seat.setNumber(Integer.toString(i)); seat.setType(1L); this._carTypes[0].getSeat...
40b256eb-baaa-4466-ba06-cdae7b1b3639
8
public boolean groupSumClump(int start, int[] nums, int target) { if (start >= nums.length) return (target == 0); int sum = nums[start]; for (int i = start; i < nums.length - 1; i++) { if (nums[i + 1] == nums[start]) { sum += nums[i]; } else { ...
bff855f4-6d77-4c29-b958-3efe64701fdf
4
public masterControl(){ // create main controls buttons[0] = new JButton("New"); buttons[1] = new JButton("Play/Pause"); buttons[2] = new JButton("Step"); //buttons[3] = new JButton("State Editor"); //buttons[4] = new JButton("Cell Editor"); //buttons[5] = new JButton("Cell Picker"); //buttons[6] = new ...
c1368c88-1c2d-4e0d-a997-b476e24e9c1c
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
d3659df0-5be3-4b4a-bc31-7970b8f3d073
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
3cb80853-a994-4507-9fab-fe3852ed1b28
8
public String processInput(String theInput) { String theOutput = null; if (state == WAITING) { theOutput = "Knock! Knock!"; state = SENTKNOCKKNOCK; } else if (state == SENTKNOCKKNOCK) { if (theInput.equalsIgnoreCase("Who's there?")) { theOutpu...
aa135ac1-9fd2-4377-87ca-536e60192eaf
7
public static Proposition buildMemberOfProposition(Cons tree) { Logic.verifyNumberOfPropositionArguments(tree, 2); { Stella_Object collectionref = tree.rest.rest.value; { Surrogate testValue000 = Stella_Object.safePrimaryType(collectionref); if (Surrogate.subtypeOfSurrogateP(testValue000)) { ...
dba8ed1f-9ec7-453b-8d94-8108a63087cb
8
public static void writeOSM(HashMap<Integer, CustomNode> clcMainNodes, HashMap<Integer, CustomWay> clcMainWays, HashMap<Integer, CustomRelation> clcMainRelations, String filename) { XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer; FileOutputStream stream; try { stream ...
9d2b5a3f-6447-43df-a2ef-2030d2bb90c3
2
private boolean executeNotRandomMusics(int indexMusic) { for(int i = indexMusic; i < getMusics().size(); i++){ getMusics().get(i).play(); if(isRamdom) return true; } return false; }
bebe92d2-fe80-4e8a-8f7f-b359b105bb46
8
private void boardDraw(Graphics2D g2d) { ChessEngine game = gameThread.getGame(); g2d.drawImage(assets.getBackground(), 0, 0, null); State state = gameThread.getGameState(); if(state == State.PLAYING) { for(Piece p : game.getWhitePieces()) { drawPiece(p, g2d); } for(Piece p : game.getBlackPieces...
288a307c-6832-4bbc-8003-38ce2cf78c44
0
public static void Help() { GUI.log("" + "Commands:\n" + "north exit through the northern door.\n" + "east exit through the eastern door.\n" + "south exit through the southern door.\n" + "west exit through the western door.\n" + "exit go back to the main menu.\n" + "inspect get more i...
ed54bb88-5cba-420d-9005-bfb321123cc0
0
public RegularExpression getExpression() { return (RegularExpression) super.getObject(); }
f4c9cdbb-2a45-4eb7-ba8b-a270ff85af87
5
private long removeRefRippleServer(long lIndex) { // // loop through the elements in the actual container, in order to find the one // at lIndex. Once it is found, then loop through the reference list and remove // the corresponding reference for that element. // RippleServer refActualElement = GetRippleServer(l...
c36ba8da-4835-4692-9687-509719a83e3e
9
private String getFieldString(Object o, int type) { if (o == null) return "null"; switch (type) { case java.sql.Types.INTEGER: return ((Integer)o).toString(); case java.sql.Types.BOOLEAN: return ((Boolean)o).toString(); case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: return "'" + (String)...
17bc9ae4-45ee-41ab-b5d9-5ffeb962d18f
4
public NChatServer(){ //Try to start connection on server port (Start.port). System.out.println("Trying to connect to port " + Start.port + "..."); try{ connectionSocket = new ServerSocket(Start.port); }catch(IOException e){ System.out.println("Error connecting to port " + Start.port + "!"); e.print...
840832bf-d149-49c1-a1e3-12d1882aca96
1
private static void doTest(boolean b, String msg) { if (b) { System.out.println("Good."); } else { System.err.println(msg); } }
f6c082fc-de15-4cf4-bad7-451273283f42
2
public void service(ServletRequest request,ServletResponse response) throws ServletException, IOException { String st=request.getParameter("ques"); int i=Integer.parseInt(st); String str=request.getParameter("comments"); String str1=request.getParameter("option1"); String str2=request.getParameter("option2")...
df1249ad-46ba-46a9-bc84-dc4b1bb7530f
9
public static void main(String args[]) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int N=parseInt(in.readLine().trim()); int[][] arr=new int[N][]; for(int i=0;i<N;i++) { StringTokenizer st=new StringTokenizer(in.readLi...
8c6c8ae2-907e-4aa3-9bde-57edcf305f85
3
private static String valueLine(ArrayList<String> values, int columnSize) { String line = "|"; for(int i = 0; i < values.size(); i++) { String cell = " "; if(values.get(i).length() > columnSize-1) { cell += values.get(i).substring(0, columnSize-4); cell += ">> "; } else { cell += values....
7f0ec907-a95a-4b48-838f-673a8e69ddf6
0
public void setPosLab(String posLab) { this.posLab = posLab; }
49e1d964-5472-4f1e-87a7-ffa211a4da38
6
@Override public boolean equals (Object other){ if(other == null) return false; if (!(other instanceof Meld)) return false; Meld otherMeld = (Meld) other; if(this.isRun != otherMeld.isRun) return false; if(this.getNumTiles() != otherMeld.getNumTiles()) return false; ArrayList<Tile> myTile...
a430b83a-b47a-42e8-a7d6-9244cce7e465
1
public ExtendableClassLoader() { cache = new Hashtable<String, Class<?>>(); paths = new ArrayList<String>(); }
51d59121-227b-467e-a033-e89d6bf934ca
5
private void loadDictionary() throws IOException, FileNotFoundException{ BufferedReader in = null; try { in = new BufferedReader(new FileReader(WORDS_FILE)); String word; while ((word = in.readLine()) != null) { dictionary.add(word.trim().toLowerCase()); } in.close(); } catch (FileNotFoundExcep...
9797808a-5df6-4ba0-aa3a-f0b4752fb561
4
private static String TranslateEnumToContentType(ContentType contentType){ switch(contentType){ case RDF: return "application/rdf+xml"; case TURTLE: return "application/x-turtle"; case NT: return "text/plain"; case N3: return "text/rdf+n3"; default: return "text/plain"; } }
eb22a5b5-7aee-45c1-9839-853ff0b522dc
5
public static void main(String[] args) { int port; if (args.length != 2) { System.err.println("Usage: java ChatServer <port> <database name>"); return; } try { port = Integer.parseInt(args[0]); } catch (NumberFormatException nfe) { System.err.println("Usage: java ChatServer <port>"); return;...
456bb11d-5a1a-4850-b803-404a16416188
4
public float getI() { float input = 0f; for (int j = 0; j < inputs.size(); j++) { FiringState fired = inputs.get(j).getFired(); //fired == null indicates an External Connection which do not fire) if (fired == FiringState.DISABLED) { input += activatio...
3efe9140-2f71-4970-b504-a3939667c451
7
public static Scriptable jsConstructor(Context cx, Object[] args, Function ctorObj, boolean inNewExpr) { Font f = new Font(); String font = cx.toString(args[0]); if (font.startsWith("data:")) { URI dataUri = null; ...
55f7ec42-0303-4bcd-8325-4241614c1904
1
private int getOffset(TimeZone zone, long millis) { Date date = new Date(millis); if (zone.inDaylightTime(date)) { return zone.getRawOffset() + 3600000; } return zone.getRawOffset(); }
b83a22fb-bea4-4597-bbba-c3eae32e7c15
2
private void selectAndSpillValue() { Value spill = null; int maxEdges = 0; for(Entry<Value, HashSet<Value>> v : adjacencyList.entrySet()) { if(v.getValue().size() > maxEdges) { spill = v.getKey(); maxEdges = v.getValue().size(); } ...
f3a41948-583a-419b-a964-5eee45c07052
3
private CharSequence getExpectedActionString(InputOutputEventType expectedEventType) { if (expectedEventType == InputOutputEventType.HALT) { return new HaltEvent().getExpectedActionDescription(); } else if (expectedEventType == InputOutputEventType.INPUT) { return new InputEvent(...
d3fdbdfc-2598-4ee0-a1d6-a1ae7e93bac0
6
public static String vectorPlaceToHTML(Vector<Place> rs){ if (rs.isEmpty()) return "<p class=\"plusbas\">Il n'y a plus de places disponibles.</p>"; String toReturn = "<TABLE BORDER='1' width=\"1000\">"; toReturn+="<CAPTION>Les places disponibles (#) sont :</CAPTION>"; int i=0; for (int j=1;j<=10;j++){ ...
1cee26fd-c90b-4ee2-b823-4bd9bcd770a1
6
public static void main(String[] args) { if (0 == args.length) { System.out.println("Invalid input parameter"); return; } String param = args[0]; if (param.equals(RECORD)) { System.out.println("User selected RECORD"); /****** RECORD SOUND *********/ final Record dataRecorder = new Record(); ...
4271009c-166f-48a4-a5f3-866df2449030
5
public static ArrayList<Student> sortMenu(ArrayList<Student> inList){ int choice = 0; do { System.out.println("What would you like to do: \n 1) Sort by Last Name \n 2) Sort by GPA \n 3) Sort BY Class \n 4) Return to main menu"); Scanner userinput = new Scanner(System.in); choice = userinput.nex...